TimedText3GPPSource.h revision 25eefbedf4b0ba6aea38605f4ba19c75a40810d1
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 {
31 public:
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
41 protected:
42  virtual ~TimedText3GPPSource();
43
44 private:
45  sp<MediaSource> mSource;
46
47  status_t extractAndAppendLocalDescriptions(
48        int64_t timeUs, const MediaBuffer *textBuffer, Parcel *parcel);
49
50  DISALLOW_EVIL_CONSTRUCTORS(TimedText3GPPSource);
51};
52
53}  // namespace android
54
55#endif  // TIMED_TEXT_3GPP_SOURCE_H_
56