Home | History | Annotate | Download | only in timedtext
      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 
     25 namespace android {
     26 
     27 class MediaBuffer;
     28 class Parcel;
     29 
     30 class 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 *startTimeUs,
     37             int64_t *endTimeUs,
     38             Parcel *parcel,
     39             const MediaSource::ReadOptions *options = NULL);
     40     virtual status_t extractGlobalDescriptions(Parcel *parcel);
     41     virtual sp<MetaData> getFormat();
     42 
     43 protected:
     44     virtual ~TimedText3GPPSource();
     45 
     46 private:
     47     sp<MediaSource> mSource;
     48 
     49     status_t extractAndAppendLocalDescriptions(
     50             int64_t timeUs, const MediaBuffer *textBuffer, Parcel *parcel);
     51 
     52     DISALLOW_EVIL_CONSTRUCTORS(TimedText3GPPSource);
     53 };
     54 
     55 }  // namespace android
     56 
     57 #endif  // TIMED_TEXT_3GPP_SOURCE_H_
     58