android_media_MediaExtractor.h revision 74a78b0f6e8c07cfc7da8f043987f6de0648bc05
1/* 2 * Copyright 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 _ANDROID_MEDIA_MEDIAEXTRACTOR_H_ 18#define _ANDROID_MEDIA_MEDIAEXTRACTOR_H_ 19 20#include <media/stagefright/foundation/ABase.h> 21#include <utils/Errors.h> 22#include <utils/KeyedVector.h> 23#include <utils/RefBase.h> 24#include <utils/String8.h> 25 26#include "jni.h" 27 28namespace android { 29 30struct MetaData; 31struct NuMediaExtractor; 32 33struct JMediaExtractor : public RefBase { 34 JMediaExtractor(JNIEnv *env, jobject thiz); 35 36 status_t setDataSource( 37 const char *path, 38 const KeyedVector<String8, String8> *headers); 39 40 status_t setDataSource(int fd, off64_t offset, off64_t size); 41 42 size_t countTracks() const; 43 status_t getTrackFormat(size_t index, jobject *format) const; 44 45 status_t selectTrack(size_t index); 46 47 status_t seekTo(int64_t timeUs); 48 49 status_t advance(); 50 status_t readSampleData(jobject byteBuf, size_t offset, size_t *sampleSize); 51 status_t getSampleTrackIndex(size_t *trackIndex); 52 status_t getSampleTime(int64_t *sampleTimeUs); 53 status_t getSampleFlags(uint32_t *sampleFlags); 54 status_t getSampleMeta(sp<MetaData> *sampleMeta); 55 56 bool getCachedDuration(int64_t *durationUs, bool *eos) const; 57 58protected: 59 virtual ~JMediaExtractor(); 60 61private: 62 jclass mClass; 63 jweak mObject; 64 sp<NuMediaExtractor> mImpl; 65 66 DISALLOW_EVIL_CONSTRUCTORS(JMediaExtractor); 67}; 68 69} // namespace android 70 71#endif // _ANDROID_MEDIA_MEDIAEXTRACTOR_H_ 72