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