• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 MEDIA_EXTRACTOR_FACTORY_H_
18 
19 #define MEDIA_EXTRACTOR_FACTORY_H_
20 
21 #include <stdio.h>
22 #include <unordered_set>
23 
24 #include <android/dlext.h>
25 #include <android/IMediaExtractor.h>
26 
27 namespace android {
28 
29 class DataSource;
30 struct ExtractorPlugin;
31 
32 class MediaExtractorFactory {
33 public:
34     static sp<IMediaExtractor> Create(
35             const sp<DataSource> &source, const char *mime = NULL);
36     static sp<IMediaExtractor> CreateFromService(
37             const sp<DataSource> &source, const char *mime = NULL);
38     static status_t dump(int fd, const Vector<String16>& args);
39     static std::vector<std::string> getSupportedTypes();
40     static void LoadExtractors();
41 
42 private:
43     static Mutex gPluginMutex;
44     static std::shared_ptr<std::list<sp<ExtractorPlugin>>> gPlugins;
45     static bool gPluginsRegistered;
46     static bool gIgnoreVersion;
47 
48     static void RegisterExtractors(
49             const char *libDirPath, const android_dlextinfo* dlextinfo,
50             std::list<sp<ExtractorPlugin>> &pluginList);
51     static void RegisterExtractor(
52             const sp<ExtractorPlugin> &plugin, std::list<sp<ExtractorPlugin>> &pluginList);
53 
54     static void *sniff(const sp<DataSource> &source,
55             float *confidence, void **meta, FreeMetaFunc *freeMeta,
56             sp<ExtractorPlugin> &plugin, uint32_t *creatorVersion);
57 };
58 
59 }  // namespace android
60 
61 #endif  // MEDIA_EXTRACTOR_FACTORY_H_
62