TimedText3GPPSource.h revision f9d660a5e0196240add5daf0199f128d471e592c
1/*
2 * Copyright (C) 2012 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#ifndef TIMED_TEXT_3GPP_SOURCE_H_
18#define TIMED_TEXT_3GPP_SOURCE_H_
19
20#include <media/stagefright/MediaErrors.h>
21#include <media/stagefright/MediaSource.h>
22
23#include "TimedTextSource.h"
24
25namespace android {
26
27class MediaBuffer;
28class Parcel;
29
30class TimedText3GPPSource : public TimedTextSource {
31public:
32    TimedText3GPPSource(const sp<MediaSource>& mediaSource);
33    virtual status_t start() { return mSource->start(); }
34    virtual status_t stop() { return mSource->stop(); }
35    virtual status_t read(
36            int64_t *timeUs,
37            Parcel *parcel,
38            const MediaSource::ReadOptions *options = NULL);
39    virtual status_t extractGlobalDescriptions(Parcel *parcel);
40    virtual sp<MetaData> getFormat();
41
42protected:
43    virtual ~TimedText3GPPSource();
44
45private:
46    sp<MediaSource> mSource;
47
48    status_t extractAndAppendLocalDescriptions(
49            int64_t timeUs, const MediaBuffer *textBuffer, Parcel *parcel);
50
51    DISALLOW_EVIL_CONSTRUCTORS(TimedText3GPPSource);
52};
53
54}  // namespace android
55
56#endif  // TIMED_TEXT_3GPP_SOURCE_H_
57