【ijkplayer】 android 初始化硬解码

看了看ijkplayer 中,软硬解码器的创建流程

ffpipeline_android.c

  • func_open_video_decoder
c 复制代码
/**
 * 开始分配:视频:使用硬解还是软解
 * @param pipeline
 * @param ffp
 * @return
 */
static IJKFF_Pipenode *func_open_video_decoder(IJKFF_Pipeline *pipeline, FFPlayer *ffp)
{
    IJKFF_Pipeline_Opaque *opaque = pipeline->opaque;
    IJKFF_Pipenode        *node = NULL;

    if (ffp->mediacodec_all_videos || ffp->mediacodec_avc || ffp->mediacodec_hevc || ffp->mediacodec_mpeg2)
        // case 1:
        node = ffpipenode_create_video_decoder_from_android_mediacodec(ffp, pipeline, opaque->weak_vout);
    if (!node) {
        // case 2:
        node = ffpipenode_create_video_decoder_from_ffplay(ffp);
    }

    return node;
}

ffpipenode_android_mediacodec_vdec.c

  • ffpipenode_create_video_decoder_from_android_mediacodec

  • mediacodec_all_videos

是在哪里赋值为1 的?{ "mediacodec-all-videos", "MediaCodec: enable all videos",

流程图

graph TB IjkMediaPlayer_native_setup()--> ijkmp_android_create()
graph TD; A["IjkMediaPlayer_native_setup"] --> B["ijkmp_android_create"]; B --> C["ffpipeline_create_from_android"]; C --> D["ffpipenode_create_video_decoder_from_android_mediacodec 硬解"]; C --> E["ffpipenode_create_video_decoder_from_ffplay 软解"]; D --> F1["func_run_sync 解码快"]; D --> F2["func_run_sync_loop 音视频同步效果好"]; F1 --> G["enqueue_thread_func"]; G --> H["feed_input_buffer向MeddiaCodec 喂入 输入数据"]; H --> I["ffp_packet_queue_get_or_buffering"]; I --> J["packet_queue_get_or_buffering: 里面是一个while(1)循环"]; J --> J1["packet_queue_get: 从PacketQueue中获取AVPacket"]; E --> E2["func_run_sync"]; E2 --> E3["ffp_video_thread"]; E3 --> E4["ffplay_video_thread 里面有一个for (;;)"]; E4 --> E5["get_video_frame"]; E5 --> E5_1["decoder_decode_frame 里面有一个for (;;),得到一个完整的avframe"]; E5_1 --> E5_2["audio_frame:avcodec_receive_frame"]; E5_1 --> E5_3["video_frame:avcodec_receive_frame"]; E5_2 --> E6["queue_picture"]; E5_3 --> E6["queue_picture AVFrame 放进 FrameQueue"];
相关推荐
JarvanMo15 分钟前
Flutter:展示大段格式化文本的挑战
前端
兆子龙21 分钟前
Node.js ESM Loader Hooks 介绍:用 module.register 做转译、Import Map 与自定义解析
前端
四眼肥鱼22 分钟前
flutter 利用flutter_libserialport 实现SQ800 串口通信
前端·flutter
ZFSS23 分钟前
OpenAI Images Edits API 申请及使用
前端·人工智能
Lee川35 分钟前
从零构建AI对话应用:Vite脚手架搭建与API密钥安全实践
前端·程序员
允许部分打工人先富起来36 分钟前
在node项目中执行python脚本
前端·python·node.js
钟智强37 分钟前
Flutter引擎Android平台JNI层未验证指针转换漏洞
前端
骑着小黑马41 分钟前
Electron + Vue3 + AI 做了一个新闻生成器:从 0 到 1 的完整实战记录
前端·人工智能
Sailing43 分钟前
LLM 调用从 60s 卡死降到 3s!彻底绕过 tiktoken 网络阻塞(LangChain.js 必看)
前端·langchain·llm
洋洋技术笔记43 分钟前
计算属性与侦听器
前端·vue.js