当前位置:网站首页>【MLT】MLT多媒体框架生产消费架构解析(一)
【MLT】MLT多媒体框架生产消费架构解析(一)
2022-08-02 04:29:00 【一二三o-0-O】
MLT多媒体框架生产消费架构解析
通过本文可以获取什么?
- 了解LGPL多媒体框架MLT的核心C++类封装的层级关系
- 了解MLT的生产消费者架构
- demon演示生产-消费的使用
核心类层级关系
MLT官方有为MLT库提供C++包装,根据MLT的设计梳理了核心类的层级关系,如下图:
如上图可见:整个封装分为4个层级,简单介绍一下关键类的功能:
- Properties:这个基类提供了后续所有派生类属性的序列化与反序列化能力。
- Service:这个服务类将会提供给消费者与生产者连接的能力、滤镜的订阅与反订阅能力等功能。
- Producer:生产者类,所有剪辑处理的最小单位。
- Playlist:生产者的容器。
生产消费者架构
生产消费基础流程图如下:
生产者初始化
// 默认视频图像制式设置是dv_pal(PAL特点:每秒钟有25帧,奇数场,主要应用在中国、香港、中东地区和欧洲一带,视频输出常用格式是PAL制式)
Profile profile;
// 根据profile配置与媒体资源初始化生产者
Producer producer(profile, filename);
消费者初始化
// 默认初始化为sdl
Consumer consumer(profile);
// 防止缩小到 profile 配置的尺寸.
// 让 sdl consumer 做所有的缩放.
consumer.set("rescale", "none");
// 在文件结束时自动退出.
consumer.set("terminate_on_pause", 1);
生产消费关联启动
// 从Service继承的关联消费者的能力
consumer.connect(producer);
// 启动
consumer.run();
consumer.stop();
demon展示
使用Consumer(sdl)消费Producer(mp4)效果

代码
void play(const char *filename)
{
qDebug() << filename;
Profile profile; // defaults to dv_pal
Producer producer(profile, filename);
Consumer consumer(profile); // defaults to sdl
// Prevent scaling to the profile size.
// Let the sdl consumer do all scaling.
consumer.set("rescale", "none");
// Automatically exit at end of file.
// consumer.set("terminate_on_pause", 1);
consumer.connect(producer);
consumer.run();
consumer.stop();
}
void func1()
{
Factory::init();
play("D:\\msys64\\home\\Administrator\\mltDemon\\qianyuqianxunKTV.mp4");// 替换自己本地的资源路径
Factory::close();
}
附属代码下载链接
参考资料
【1】MLT github链接
【2】官方代码示例
边栏推荐
- 违约金过高”的认定依据
- 投资组合分析:portfolio_analysis.Tangenvy_portfolio(切点组合)
- CodeTON Round 2 (Div. 1 + Div. 2, Rated, Prizes!) C题
- PDF文件转换格式
- Live | 7.30 ApacheCon Asia 2022 IOT/IIOT topic, IoTDB PMC Qiao Jialin as the producer
- 捷信将ESG理念注入企业DNA致力于提供“负责任的消费金融服务”
- 翻转(DAY 97)
- 地牢大师(DAY 95)
- YOLOV5学习笔记(四)——项目目录及代码讲解
- What if some fields don't want to be serialized?
猜你喜欢

学内核之四:关于内核与硬件的衔接

其他重要协议(DNS,ICMP,NAT,交换机)

安装部署 Kubernetes 仪表板(Dashboard)

Arduino框架下ESP32重启原因串口信息输出示例

The practice of alibaba, data synchronization component canal

Live | 7.30 ApacheCon Asia 2022 IOT/IIOT topic, IoTDB PMC Qiao Jialin as the producer

应用pca和K-means实现用户对物品类别的喜好细分划分

浅学一下二叉树的顺序存储结构——堆

洛谷P2437蜜蜂路线

如何运用3DGIS技术整合智慧社区综合管理解决方案
随机推荐
ADSP21489数据手册表摘要
Scala basics [common method supplement, pattern matching]
MySQL存储函数详解
力扣练习——45 二叉树的锯齿形层次遍历
递归实现指数型枚举(DAY 91)
【数字IC手撕代码】Verilog固定优先级仲裁器|题目|原理|设计|仿真
ADSP21489工程中LDF文件配置详解
26. 如何判断一个对象是否存活?(或者GC对象的判定方法)?
七月阅读:《刘慈欣科幻短篇小说集Ⅰ》笔记
什么是接触电流怎么测?
Minecraft 1.18.1、1.18.2模组开发 23.3D动画盔甲制作
A practice arrangement about map GIS (below) GIS practice of Redis
Anatomy of Unreal Playback System (Part 1)
ffmpeg基本命令
Nuscenes数据集总结(下)
已更新 联通 电信 tiny模式
Liquidated damages are too high"
Minecraft 1.18.1, 1.18.2 module development 23.3D animation armor production
【Interview】Recruitment requirements
PyQt5_pyqtgraph鼠标在折线图上画方形