1/* 2 * Copyright (C) 2017 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 INTERFACE_UTILS_H_ 18#define INTERFACE_UTILS_H_ 19 20#include <utils/RefBase.h> 21#include <media/MediaExtractor.h> 22#include <media/stagefright/RemoteMediaExtractor.h> 23#include <media/MediaSource.h> 24#include <media/IMediaExtractor.h> 25#include <media/IMediaSource.h> 26 27namespace android { 28 29class DataSource; 30class MediaExtractor; 31struct MediaSource; 32class IDataSource; 33class IMediaExtractor; 34class IMediaSource; 35 36// Creates a DataSource which wraps the given IDataSource object. 37sp<DataSource> CreateDataSourceFromIDataSource(const sp<IDataSource> &source); 38 39// creates an IDataSource wrapper to the DataSource. 40sp<IDataSource> CreateIDataSourceFromDataSource(const sp<DataSource> &source); 41 42// Creates an IMediaExtractor wrapper to the given MediaExtractor. 43sp<IMediaExtractor> CreateIMediaExtractorFromMediaExtractor( 44 MediaExtractor *extractor, 45 const sp<DataSource> &source, 46 const sp<RefBase> &plugin); 47 48// Creates a MediaSource which wraps the given IMediaSource object. 49sp<MediaSource> CreateMediaSourceFromIMediaSource(const sp<IMediaSource> &source); 50 51// Creates an IMediaSource wrapper to the given MediaSource. 52sp<IMediaSource> CreateIMediaSourceFromMediaSourceBase( 53 const sp<RemoteMediaExtractor> &extractor, 54 MediaTrack *source, const sp<RefBase> &plugin); 55 56} // namespace android 57 58#endif // INTERFACE_UTILS_H_ 59