中文亚洲精品无码_熟女乱子伦免费_人人超碰人人爱国产_亚洲熟妇女综合网

當(dāng)前位置: 首頁(yè) > news >正文

什么網(wǎng)站做國(guó)外批發(fā)國(guó)內(nèi)免費(fèi)建站平臺(tái)

什么網(wǎng)站做國(guó)外批發(fā),國(guó)內(nèi)免費(fèi)建站平臺(tái),網(wǎng)站換模板對(duì)seo,公司網(wǎng)站建設(shè)推薦Flutter視頻渲染系列 第一章 Android使用Texture渲染視頻 第二章 Windows使用Texture渲染視頻 第三章 Linux使用Texture渲染視頻 第四章 全平臺(tái)FFICustomPainter渲染視頻 第五章 Windows使用Native窗口渲染視頻 第六章 桌面端使用texture_rgba_renderer渲染視頻(本…

Flutter視頻渲染系列

第一章 Android使用Texture渲染視頻
第二章 Windows使用Texture渲染視頻
第三章 Linux使用Texture渲染視頻
第四章 全平臺(tái)FFI+CustomPainter渲染視頻
第五章 Windows使用Native窗口渲染視頻
第六章 桌面端使用texture_rgba_renderer渲染視頻(本章)


文章目錄

  • Flutter視頻渲染系列
  • 前言
  • 一、如何實(shí)現(xiàn)
    • 1、添加插件
    • 2、創(chuàng)建texture
    • 3、關(guān)聯(lián)texture控件
    • 4、寫入bgra
  • 二、效果預(yù)覽
  • 三、問題分析
  • 四、完整代碼
  • 總結(jié)


前言

前面幾章介紹了flutter使用texture渲染視頻的方法,但是有個(gè)問題就是在每個(gè)平臺(tái)都需要寫一套原生代碼去創(chuàng)建texture,這樣對(duì)于代碼的維護(hù)是比較不利的。最好的方法應(yīng)該是一套代碼每個(gè)平臺(tái)都能運(yùn)行,筆者最近剛好找到了pub上對(duì)texture封裝的插件,直接提供dart代碼調(diào)用texture進(jìn)行rgba的渲染,當(dāng)然只支持桌面端,即Windows、Linux、Macos,但依然是很方便了。本文只實(shí)現(xiàn)了Windows、Linux的視頻渲染。


一、如何實(shí)現(xiàn)

1、添加插件

插件的地址是https://pub-web.flutter-io.cn/packages/texture_rgba_renderer。我們直接在pubspec.yaml添加依賴即可。
依賴

texture_rgba_renderer: ^0.0.16

引用

import 'package:texture_rgba_renderer/texture_rgba_renderer.dart';

在這里插入圖片描述

2、創(chuàng)建texture

定義一個(gè)全局插件對(duì)象

final _textureRgbaRendererPlugin = TextureRgbaRenderer();

創(chuàng)建texture,得到textureId

//textureId,使用ValueNotifier方便刷新界面
ValueNotifier<int> _textureId = ValueNotifier<int>(-1);
//參數(shù)為唯一標(biāo)識(shí)符,使用當(dāng)前對(duì)象this的hashCode。_textureId.value = await _textureRgbaRendererPlugin.createTexture(hashCode);

3、關(guān)聯(lián)texture控件

//ValueListenableBuilder與ValueNotifier是配套使用的,方便界面刷新。
ValueListenableBuilder(valueListenable: _textureId,builder: (c, v, w) {//關(guān)聯(lián)textureIdreturn Texture(textureId: _textureId.value);})),

4、寫入bgra

數(shù)據(jù)格式為ffmpeg的AV_PIX_FMT_BGRA

//數(shù)據(jù)地址
int adress = msg[2];
//一行數(shù)據(jù)長(zhǎng)度
int linesize = msg[3];
int width = msg[4];
int height = msg[5];
//將bgra數(shù)據(jù)寫入texture
final ptr = await _textureRgbaRendererPlugin.getTexturePtr(hashCode);
Native.instance.onRgba(Pointer.fromAddress(ptr),Pointer.fromAddress(adress),height* linesize,width,height,linesize);

二、效果預(yù)覽

基本的一個(gè)運(yùn)行效果

在這里插入圖片描述


三、問題分析

texture_rgba_renderer: 0.0.16,就目前的版本來看,cpu消耗比原生寫texture要高不少。主要原因是在dart寫入bgra數(shù)據(jù)時(shí),插件底層先是拷貝了一次數(shù)據(jù),然后對(duì)又?jǐn)?shù)據(jù)進(jìn)行第二次逐行掃描拷貝到新的緩沖區(qū)對(duì)齊數(shù)據(jù),這些操作都是比較消耗cpu的,尤其是逐行掃描拷貝。


四、完整代碼

https://download.csdn.net/download/u013113678/88124430
注:ttexture_rgba_renderer: 0.0.16的性能不算特別好,請(qǐng)根據(jù)需求下載。


總結(jié)

以上就是今天要講述的內(nèi)容,使用Ftexture_rgba_renderer實(shí)現(xiàn)視頻渲染是筆者無(wú)意中發(fā)現(xiàn)的一個(gè)方法,本質(zhì)也是texture,只是有人將其封裝為了插件,但是由于適應(yīng)場(chǎng)景應(yīng)該不是視頻渲染,雖然能使用但性能并不是特別的好。

http://m.risenshineclean.com/news/64256.html

相關(guān)文章:

  • 上海建筑建材業(yè)門戶網(wǎng)站項(xiàng)目推廣平臺(tái)排行榜
  • 牡丹江網(wǎng)站制作市場(chǎng)營(yíng)銷專業(yè)課程
  • 代注冊(cè)公司一般多少錢成都seo外包
  • 商城平臺(tái)系統(tǒng)谷歌seo優(yōu)化中文章
  • 自己建設(shè)網(wǎng)站怎么做山西seo優(yōu)化公司
  • 建設(shè)網(wǎng)站的企業(yè)是什么策劃公司
  • 順德企業(yè)手機(jī)網(wǎng)站建設(shè)怎么上百度推廣產(chǎn)品
  • wordpress建中文網(wǎng)站西安百度推廣運(yùn)營(yíng)
  • 網(wǎng)站建設(shè)及推廣百度論壇首頁(yè)
  • 網(wǎng)站說服力營(yíng)銷型網(wǎng)站策劃公司seo
  • 網(wǎng)站圖片做多大網(wǎng)站流量統(tǒng)計(jì)系統(tǒng)
  • 沈陽(yáng)中小企業(yè)網(wǎng)站制作站長(zhǎng)之家官網(wǎng)登錄入口
  • 無(wú)錫做百度網(wǎng)站軟文代寫接單平臺(tái)
  • 一鍵做網(wǎng)站廊坊百度關(guān)鍵詞優(yōu)化怎么做
  • 好的作文網(wǎng)站網(wǎng)站搭建模板
  • 合肥網(wǎng)站制作公司排名個(gè)人網(wǎng)站源碼免費(fèi)下載
  • 建網(wǎng)站素材短視頻平臺(tái)推廣
  • 上海專業(yè)網(wǎng)站建設(shè)網(wǎng)站沈陽(yáng)網(wǎng)站制作
  • 域名過期的網(wǎng)站怎么看seo點(diǎn)擊排名軟件哪里好
  • 360軟件商店衡陽(yáng)seo優(yōu)化報(bào)價(jià)
  • 網(wǎng)站建設(shè)施工方案如何百度收錄自己的網(wǎng)站
  • 網(wǎng)站 ip修改備案流程西安搜建站科技網(wǎng)站
  • 新手學(xué)做網(wǎng)站編程微信搜一搜seo
  • 網(wǎng)站開發(fā)工作簡(jiǎn)歷搜索引擎哪個(gè)好用
  • 看市場(chǎng)行情用什么軟件秦皇島網(wǎng)站seo
  • django 網(wǎng)站開發(fā)論文優(yōu)化網(wǎng)站服務(wù)
  • 合肥市建設(shè)網(wǎng)站市場(chǎng)信息價(jià)廣州網(wǎng)站制作實(shí)力樂云seo
  • 濱州做網(wǎng)站公司網(wǎng)絡(luò)建站
  • 做網(wǎng)站怎么做寧波網(wǎng)站推廣專業(yè)服務(wù)
  • 網(wǎng)站建設(shè)有利點(diǎn)谷歌seo需要做什么的