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 //#define LOG_NDEBUG 0 18 #define LOG_TAG "MPEG2ExtractorBundle" 19 #include <utils/Log.h> 20 21 #include <media/MediaExtractor.h> 22 #include "MPEG2PSExtractor.h" 23 #include "MPEG2TSExtractor.h" 24 25 namespace android { 26 27 extern "C" { 28 // This is the only symbol that needs to be exported 29 __attribute__ ((visibility ("default"))) 30 MediaExtractor::ExtractorDef GETEXTRACTORDEF() { 31 return { 32 MediaExtractor::EXTRACTORDEF_VERSION, 33 UUID("3d1dcfeb-e40a-436d-a574-c2438a555e5f"), 34 1, 35 "MPEG2-PS/TS Extractor", 36 []( 37 DataSourceBase *source, 38 float *confidence, 39 void **, 40 MediaExtractor::FreeMetaFunc *) -> MediaExtractor::CreatorFunc { 41 if (SniffMPEG2TS(source, confidence)) { 42 return []( 43 DataSourceBase *source, 44 void *) -> MediaExtractor* { 45 return new MPEG2TSExtractor(source);}; 46 } else if (SniffMPEG2PS(source, confidence)) { 47 return []( 48 DataSourceBase *source, 49 void *) -> MediaExtractor* { 50 return new MPEG2PSExtractor(source);}; 51 } 52 return NULL; 53 } 54 }; 55 } 56 57 } // extern "C" 58 59 } // namespace android 60