博客
关于我
ACodec从UninitializedState状态到LoadedState状态分析
阅读量:380 次
发布时间:2019-03-05

本文共 2603 字,大约阅读时间需要 8 分钟。

MediaCodec native???????create?config

MediaCodec??Android??????????native??????create?config?????????????????????????????????

????

?????mediacodec?create?config????native??????????????????????

??create?native?????

?mediacodec?????????????ACodec???ACodec???????????????????UninitializedState???????????

MediaCodec.cppstatus_t MediaCodec::init(const AString &name, bool nameIsType, bool encoder) {    // 1. ???ACodec    mCodec = new ACodec;        // 2. ?MediaCodec??????ALooper???ACodec??????    if (needDedicatedLooper) {        if (mCodecLooper == NULL) {            mCodecLooper = new ALooper;            mCodecLooper->setName("CodecLooper");            mCodecLooper->start(false, false, ANDROID_PRIORITY_AUDIO);        }        mCodecLooper->registerHandler(mCodec);    } else {        // 3. ?ACodec???MediaCodec???ALooper?        mLooper->registerHandler(mCodec);    }        // 4. ?MediaCodec???jni????ALooper?    mLooper->registerHandler(this);    mCodec->setNotificationMessage(new AMessage(kWhatCodecNotify, id()));        // 5. ????kWhatInit??    sp
msg = new AMessage(kWhatInit, id()); msg->setString("name", name); msg->setInt32("nameIsType", nameIsType); if (nameIsType) { msg->setInt32("encoder", encoder); } sp
response; return PostAndAwaitResponse(msg, &response);}
?????
  • ?????init?????????ACodec???ACodec??????????????AHierarchicalStateMachine????
  • ??????kWhatInit??????onMessageReceived?????
  • ?onMessageReceived??????????kWhatInit??????????UNINITIALIZED????????mReplyID??????INITIALIZING????ACodec?initiateAllocateComponent???

    ACodec?????

    ACodec?????AHierarchicalStateMachine????????UninitializedState?????changeState???????UninitializedState???kWhatAllocateComponent??????onAllocateComponent???

    onAllocateComponent????
  • ??mediaplayerservice????
  • ??OMXClient???OMX???
  • ?????????????
  • ??OMX::allocateNode?????
  • ???????????kWhatComponentAllocated????????LoadedState?
  • ??configur?native?????

    ?config???mediacodec???kWhatConfigure?????onMessageReceived?????

    onMessageReceived????

    ??????kWhatConfigure???initiateConfigureComponent???LoadedState?onMessageReceived?????kWhatConfigureComponent?????configureCodec???

    configureCodec????

    ??ACodec?configureCodec????????mime???componentName??????????

    ????

    mediacodec?create?config????native?????????????

  • ACodec?????????????init?????ACodec?????UninitializedState???
  • ?????????????????????kWhatInit?kWhatAllocateComponent????????
  • OMX????????OMXClient????????????????????
  • ???????AHierarchicalStateMachine??????????????????
  • ???????mediacodec?Android????????????????????????????????

    转载地址:http://gfwwz.baihongyu.com/

    你可能感兴趣的文章
    Nginx 学习总结(17)—— 8 个免费开源 Nginx 管理系统,轻松管理 Nginx 站点配置
    查看>>
    nginx 常用配置记录
    查看>>
    Nginx 我们必须知道的那些事
    查看>>
    Nginx 的 proxy_pass 使用简介
    查看>>
    Nginx 的配置文件中的 keepalive 介绍
    查看>>
    nginx 配置 单页面应用的解决方案
    查看>>
    nginx 配置~~~本身就是一个静态资源的服务器
    查看>>
    Nginx下配置codeigniter框架方法
    查看>>
    nginx添加模块与https支持
    查看>>
    Nginx的Rewrite正则表达式,匹配非某单词
    查看>>
    Nginx的使用总结(一)
    查看>>
    Nginx的是什么?干什么用的?
    查看>>
    Nginx访问控制_登陆权限的控制(http_auth_basic_module)
    查看>>
    nginx负载均衡的五种算法
    查看>>
    Nginx配置ssl实现https
    查看>>
    Nginx配置TCP代理指南
    查看>>
    Nginx配置代理解决本地html进行ajax请求接口跨域问题
    查看>>
    Nginx配置参数中文说明
    查看>>
    Nginx配置好ssl,但$_SERVER[‘HTTPS‘]取不到值
    查看>>
    Nginx配置实例-负载均衡实例:平均访问多台服务器
    查看>>