NuPlayerSource.h revision b7c8e91880463ff4981e3e53e98e45d68e2fe374
15bc087c573c70c84c6a39946457590b42d392a33Andreas Huber/*
25bc087c573c70c84c6a39946457590b42d392a33Andreas Huber * Copyright (C) 2010 The Android Open Source Project
35bc087c573c70c84c6a39946457590b42d392a33Andreas Huber *
45bc087c573c70c84c6a39946457590b42d392a33Andreas Huber * Licensed under the Apache License, Version 2.0 (the "License");
55bc087c573c70c84c6a39946457590b42d392a33Andreas Huber * you may not use this file except in compliance with the License.
65bc087c573c70c84c6a39946457590b42d392a33Andreas Huber * You may obtain a copy of the License at
75bc087c573c70c84c6a39946457590b42d392a33Andreas Huber *
85bc087c573c70c84c6a39946457590b42d392a33Andreas Huber *      http://www.apache.org/licenses/LICENSE-2.0
95bc087c573c70c84c6a39946457590b42d392a33Andreas Huber *
105bc087c573c70c84c6a39946457590b42d392a33Andreas Huber * Unless required by applicable law or agreed to in writing, software
115bc087c573c70c84c6a39946457590b42d392a33Andreas Huber * distributed under the License is distributed on an "AS IS" BASIS,
125bc087c573c70c84c6a39946457590b42d392a33Andreas Huber * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
135bc087c573c70c84c6a39946457590b42d392a33Andreas Huber * See the License for the specific language governing permissions and
145bc087c573c70c84c6a39946457590b42d392a33Andreas Huber * limitations under the License.
155bc087c573c70c84c6a39946457590b42d392a33Andreas Huber */
165bc087c573c70c84c6a39946457590b42d392a33Andreas Huber
175bc087c573c70c84c6a39946457590b42d392a33Andreas Huber#ifndef NUPLAYER_SOURCE_H_
185bc087c573c70c84c6a39946457590b42d392a33Andreas Huber
195bc087c573c70c84c6a39946457590b42d392a33Andreas Huber#define NUPLAYER_SOURCE_H_
205bc087c573c70c84c6a39946457590b42d392a33Andreas Huber
215bc087c573c70c84c6a39946457590b42d392a33Andreas Huber#include "NuPlayer.h"
225bc087c573c70c84c6a39946457590b42d392a33Andreas Huber
235bc087c573c70c84c6a39946457590b42d392a33Andreas Hubernamespace android {
245bc087c573c70c84c6a39946457590b42d392a33Andreas Huber
255bc087c573c70c84c6a39946457590b42d392a33Andreas Huberstruct ABuffer;
265bc087c573c70c84c6a39946457590b42d392a33Andreas Huber
275bc087c573c70c84c6a39946457590b42d392a33Andreas Huberstruct NuPlayer::Source : public RefBase {
28b7c8e91880463ff4981e3e53e98e45d68e2fe374Andreas Huber    enum Flags {
29b7c8e91880463ff4981e3e53e98e45d68e2fe374Andreas Huber        FLAG_SEEKABLE           = 1,
30b7c8e91880463ff4981e3e53e98e45d68e2fe374Andreas Huber        FLAG_DYNAMIC_DURATION   = 2,
31b7c8e91880463ff4981e3e53e98e45d68e2fe374Andreas Huber    };
32b7c8e91880463ff4981e3e53e98e45d68e2fe374Andreas Huber
335bc087c573c70c84c6a39946457590b42d392a33Andreas Huber    Source() {}
345bc087c573c70c84c6a39946457590b42d392a33Andreas Huber
355bc087c573c70c84c6a39946457590b42d392a33Andreas Huber    virtual void start() = 0;
362bfdd428c56c7524d1a11979f200a1762866032dAndreas Huber    virtual void stop() {}
375bc087c573c70c84c6a39946457590b42d392a33Andreas Huber
38eac68baf095aeef54865c28b6888924dc6295cbdAndreas Huber    // Returns OK iff more data was available,
39eac68baf095aeef54865c28b6888924dc6295cbdAndreas Huber    // an error or ERROR_END_OF_STREAM if not.
40eac68baf095aeef54865c28b6888924dc6295cbdAndreas Huber    virtual status_t feedMoreTSData() = 0;
415bc087c573c70c84c6a39946457590b42d392a33Andreas Huber
42840667883fd09d44015716d79bc3ac4d60edc0f0Andreas Huber    virtual sp<AMessage> getFormat(bool audio);
435bc087c573c70c84c6a39946457590b42d392a33Andreas Huber
445bc087c573c70c84c6a39946457590b42d392a33Andreas Huber    virtual status_t dequeueAccessUnit(
455bc087c573c70c84c6a39946457590b42d392a33Andreas Huber            bool audio, sp<ABuffer> *accessUnit) = 0;
465bc087c573c70c84c6a39946457590b42d392a33Andreas Huber
4743c3e6ce02215ca99d506458f596cb1211639f29Andreas Huber    virtual status_t getDuration(int64_t *durationUs) {
4843c3e6ce02215ca99d506458f596cb1211639f29Andreas Huber        return INVALID_OPERATION;
4943c3e6ce02215ca99d506458f596cb1211639f29Andreas Huber    }
5043c3e6ce02215ca99d506458f596cb1211639f29Andreas Huber
5143c3e6ce02215ca99d506458f596cb1211639f29Andreas Huber    virtual status_t seekTo(int64_t seekTimeUs) {
5243c3e6ce02215ca99d506458f596cb1211639f29Andreas Huber        return INVALID_OPERATION;
5343c3e6ce02215ca99d506458f596cb1211639f29Andreas Huber    }
5443c3e6ce02215ca99d506458f596cb1211639f29Andreas Huber
55b7c8e91880463ff4981e3e53e98e45d68e2fe374Andreas Huber    virtual uint32_t flags() const = 0;
5643c3e6ce02215ca99d506458f596cb1211639f29Andreas Huber
575bc087c573c70c84c6a39946457590b42d392a33Andreas Huberprotected:
585bc087c573c70c84c6a39946457590b42d392a33Andreas Huber    virtual ~Source() {}
595bc087c573c70c84c6a39946457590b42d392a33Andreas Huber
60840667883fd09d44015716d79bc3ac4d60edc0f0Andreas Huber    virtual sp<MetaData> getFormatMeta(bool audio) { return NULL; }
61840667883fd09d44015716d79bc3ac4d60edc0f0Andreas Huber
625bc087c573c70c84c6a39946457590b42d392a33Andreas Huberprivate:
635bc087c573c70c84c6a39946457590b42d392a33Andreas Huber    DISALLOW_EVIL_CONSTRUCTORS(Source);
645bc087c573c70c84c6a39946457590b42d392a33Andreas Huber};
655bc087c573c70c84c6a39946457590b42d392a33Andreas Huber
665bc087c573c70c84c6a39946457590b42d392a33Andreas Huber}  // namespace android
675bc087c573c70c84c6a39946457590b42d392a33Andreas Huber
685bc087c573c70c84c6a39946457590b42d392a33Andreas Huber#endif  // NUPLAYER_SOURCE_H_
695bc087c573c70c84c6a39946457590b42d392a33Andreas Huber
70