当前位置: 首页 > news >正文

win7家用电脑做网站服务器360建筑网官网下载

win7家用电脑做网站服务器,360建筑网官网下载,网站优化千牛帮,深圳十佳设计公司排名上节学到setDataSource()时会创建各种Source#xff0c;source用来读取音视频源文件#xff0c;读取到之后需要demux出音、视频、字幕数据流#xff0c;然后再送去解码。那么负责进行demux功能的media extractor模块是在什么时候阶段创建的#xff1f;这里暂时不考虑APP创建…上节学到setDataSource()时会创建各种Sourcesource用来读取音视频源文件读取到之后需要demux出音、视频、字幕数据流然后再送去解码。那么负责进行demux功能的media extractor模块是在什么时候阶段创建的这里暂时不考虑APP创建的情况以前面学过的GenericSource为例它是在prepare阶段被创建的。本节暂时不分析GenericSource创建extractor的流程先来看看MediaExtractorService的启动过程。 mediaextractor MediaExtractorService的服务名为mediaextractor //frameworks/av/services/mediaextractor/mediaextractor.rc service mediaextractor /system/bin/mediaextractorclass mainuser mediaexgroup drmrpc mediadrmioprio rt 4writepid /dev/cpuset/foreground/tasks 直接看main函数 //frameworks/av/services/mediaextractor/main_extractorservice.cpp int main(int argc __unused, char** argv) {#if __has_feature(hwaddress_sanitizer)ALOGI(disable media.extractor memory limits (hwasan enabled)); #elseALOGI(enable media.extractor memory limits);limitProcessMemory(ro.media.maxmem, /* property that defines limit */SIZE_MAX, /* upper limit in bytes */20 /* upper limit as percentage of physical RAM */); #endifsignal(SIGPIPE, SIG_IGN);//b/62255959: this forces libutis.so to dlopen vendor version of libutils.so//before minijail is on. This is dirty but required since some syscalls such//as pread64 are used by linker but arent allowed in the minijail. By//calling the function before entering minijail, we can force dlopen.android::report_sysprop_change();SetUpMinijail(kSystemSeccompPolicyPath, kVendorSeccompPolicyPath);strcpy(argv[0], media.extractor);spProcessState proc(ProcessState::self());spIServiceManager sm defaultServiceManager();MediaExtractorService::instantiate();ProcessState::self()-startThreadPool();IPCThreadState::self()-joinThreadPool(); } 由于MediaExtractorService继承自模板类BinderService所以直接调用它的instantiate()来创建service且加入service manager中 //frameworks/native/include/binder/BinderService.h static void instantiate() { publish(); }static status_t publish(bool allowIsolated false,int dumpFlags IServiceManager::DUMP_FLAG_PRIORITY_DEFAULT) {spIServiceManager sm(defaultServiceManager());return sm-addService(String16(SERVICE::getServiceName()), new SERVICE(), allowIsolated,dumpFlags); } 接下来主要看MediaExtractorService构造函数做了什么 //frameworks/av/services/mediaextractor/MediaExtractorService.cpp MediaExtractorService::MediaExtractorService() {MediaExtractorFactory::LoadExtractors(); } 其直接调用到MediaExtractorFactory中的LoadExtractors()方法 //frameworks/av/media/libstagefright/MediaExtractorFactory.cpp // static void MediaExtractorFactory::LoadExtractors() {Mutex::Autolock autoLock(gPluginMutex);if (gPluginsRegistered) {return;}gIgnoreVersion property_get_bool(debug.extractor.ignore_version, false);std::shared_ptrstd::listspExtractorPlugin newList(new std::listspExtractorPlugin());android_namespace_t *mediaNs android_get_exported_namespace(com_android_media);if (mediaNs ! NULL) {const android_dlextinfo dlextinfo {.flags ANDROID_DLEXT_USE_NAMESPACE,.library_namespace mediaNs,};RegisterExtractors(/apex/com.android.media/lib #ifdef __LP64__64 #endif/extractors, dlextinfo, *newList);} else {ALOGE(couldnt find media namespace.);}RegisterExtractors(/system/lib #ifdef __LP64__64 #endif/extractors, NULL, *newList);RegisterExtractors(/system_ext/lib #ifdef __LP64__64 #endif/extractors, NULL, *newList);newList-sort(compareFunc);gPlugins newList;for (auto it gPlugins-begin(); it ! gPlugins-end(); it) {if ((*it)-def.def_version EXTRACTORDEF_VERSION_NDK_V2) {for (size_t i 0;; i) {const char* ext (*it)-def.u.v3.supported_types[i];if (ext nullptr) {break;}gSupportedExtensions.push_back(std::string(ext));}}}gPluginsRegistered true; } 简单描述下这段代码所做的操作 创建一个list用来保存即将获取到的指向ExtractorPlugin对象的sp指针。依次到如下目录通过RegisterExtractors()方法逐个注册ExtractorPlugin到list中 /apex/com.android.media/lib(64)/extractors/system/lib(64)/extractors/system_ext/lib(64)/extractors将list内的内容按extractor_name从小到大的顺序重新排序并将其保存到gPlugins中。最后一个for循环主要是将各个extractor所支持的mime type或者文件扩展名保存到gSupportedExtensions中可用于后续查询。 再简单看看RegisterExtractors()方法 //frameworks/av/media/libstagefright/MediaExtractorFactory.cpp void MediaExtractorFactory::RegisterExtractors(const char *libDirPath, const android_dlextinfo* dlextinfo,std::listspExtractorPlugin pluginList) {ALOGV(search for plugins at %s, libDirPath);DIR *libDir opendir(libDirPath);if (libDir) {struct dirent* libEntry;while ((libEntry readdir(libDir))) {if (libEntry-d_name[0] .) {continue;}String8 libPath String8(libDirPath) / libEntry-d_name;if (!libPath.contains(extractor.so)) {continue;}void *libHandle android_dlopen_ext(libPath.string(),RTLD_NOW | RTLD_LOCAL, dlextinfo);if (libHandle nullptr) {ALOGI(dlopen(%s) reported error %s, libPath.string(), strerror(errno));continue;}GetExtractorDef getDef (GetExtractorDef) dlsym(libHandle, GETEXTRACTORDEF);if (getDef nullptr) {ALOGI(no sniffer found in %s, libPath.string());dlclose(libHandle);continue;}ALOGV(registering sniffer for %s, libPath.string());RegisterExtractor(new ExtractorPlugin(getDef(), libHandle, libPath), pluginList);}closedir(libDir);} else {ALOGI(plugin directory not present (%s), libDirPath);} } 主要功能如下 遍历指定目录下的所有后缀为extractor.so的库并将其通过dlopen()打开。再通过dlsym()方法获取到GETEXTRACTORDEF()函数的指针。对于每一个extractor创建一个对应的ExtractorPlugin然后将他们一个个的加入pluginList中。 到此MediaExtractorService就启动完成了所做的事情也是相当简单加载目标目录下所有的extractor并保存到一个list中。 MediaExtractorService还提供了另外两个接口makeExtractor()和makeIDataSource()。通过搜索code大概总结一下 makeIDataSource()提供给GenericSource调用用于根据本地播放文件创建出一个IDataSource对象。这个对象进一步会被封装成一个TinyCacheSource对象用于后面创建extractor。makeExtractor()会被封装到MediaExtractorFactory::Create()方法中该方法会被GenericSource调用还会被JNI/JAVA调用来创建extractor。 简单以图来总结下
http://www.w-s-a.com/news/868615/

相关文章:

  • 明年做哪些网站致富网站站长 感受
  • 东莞营销网站建设优化怎么做微信网站推广
  • 网站建设一个多少钱php网站服务器怎么来
  • 引流用的电影网站怎么做2012服务器如何做网站
  • 什么网站可以做推广广州安全信息教育平台
  • 网站开发具备的相关知识wordpress简约文字主题
  • asp网站伪静态文件下载seo外包公司哪家好
  • 淘宝客网站根目录怎么建个废品网站
  • 网站备案更改需要多久百度免费网站空间
  • 外发加工是否有专门的网站wordpress主页 摘要
  • 企业网站优化系统浙江建设信息港证书查询
  • 很多年前的51网站如何做跨境电商需要哪些条件
  • 网站建设中 请稍后访问互联网营销设计
  • 软文网站名称用户浏览网站的方式
  • 大兴模版网站搭建哪家好网站建设与管理管理课程
  • 四川成都网站制作微信广告平台推广
  • 网站价格网页制作网站开发实训步骤
  • cms 导航网站鹤壁做网站价格
  • 微信营销软件免费版郑州关键词优化费用
  • 邢台专业做网站哪家好临沂网站建设中企动力
  • 建设网站是主营成本吗wordpress 后台
  • 猎头可以做单的网站企业网站建设
  • 建小程序需要网站吗在putty上怎样安装wordpress
  • 天津智能网站建设找哪家WordPress相册插件pro
  • 电脑网站页面怎么调大小济宁网站建设软件开发
  • 亿玛酷网站建设广州增城区最新消息
  • 企业网站视频栏目建设方案中企动力网站模板
  • 网站页面策划国外注册域名的网站
  • 百中搜如何做网站排名网站维护一年一般多少钱
  • 镇江地区做网站的公司wordpress说说加分类