FFmpeg之AVFilterGraph

AVFilterGraph是对pileline的一个整体描述,没看之前以为里面大概是个有向无环图什么的来描述,进去一看,居然只是用链表来描述

结构体

先看结构体,主要关注里面的两个成员变量

AVFilterContext **filters;unsigned nb_filters;
AVFilterLink **sink_links;int sink_links_count;

以为avfilter是通过avFilterlink链接起来的,所以本质上来说只要有AVFilterLink就能描述清楚所有的链接图了

下面是全部定义


typedef struct AVFilterGraph {const AVClass *av_class;AVFilterContext **filters;unsigned nb_filters;char *scale_sws_opts; ///< sws options to use for the auto-inserted scale filters/*** Type of multithreading allowed for filters in this graph. A combination* of AVFILTER_THREAD_* flags.** May be set by the caller at any point, the setting will apply to all* filters initialized after that. The default is allowing everything.** When a filter in this graph is initialized, this field is combined using* bit AND with AVFilterContext.thread_type to get the final mask used for* determining allowed threading types. I.e. a threading type needs to be* set in both to be allowed.*/int thread_type;/*** Maximum number of threads used by filters in this graph. May be set by* the caller before adding any filters to the filtergraph. Zero (the* default) means that the number of threads is determined automatically.*/int nb_threads;/*** Opaque object for libavfilter internal use.*/AVFilterGraphInternal *internal;/*** Opaque user data. May be set by the caller to an arbitrary value, e.g. to* be used from callbacks like @ref AVFilterGraph.execute.* Libavfilter will not touch this field in any way.*/void *opaque;/*** This callback may be set by the caller immediately after allocating the* graph and before adding any filters to it, to provide a custom* multithreading implementation.** If set, filters with slice threading capability will call this callback* to execute multiple jobs in parallel.** If this field is left unset, libavfilter will use its internal* implementation, which may or may not be multithreaded depending on the* platform and build options.*/avfilter_execute_func *execute;char *aresample_swr_opts; ///< swr options to use for the auto-inserted aresample filters, Access ONLY through AVOptions/*** Private fields** The following fields are for internal use only.* Their type, offset, number and semantic can change without notice.*/AVFilterLink **sink_links;int sink_links_count;unsigned disable_auto_convert;
} AVFilterGraph;

函数


/*** Allocate a filter graph.** @return the allocated filter graph on success or NULL.*/
AVFilterGraph *avfilter_graph_alloc(void);/*** Create a new filter instance in a filter graph.** @param graph graph in which the new filter will be used* @param filter the filter to create an instance of* @param name Name to give to the new instance (will be copied to*             AVFilterContext.name). This may be used by the caller to identify*             different filters, libavfilter itself assigns no semantics to*             this parameter. May be NULL.** @return the context of the newly created filter instance (note that it is*         also retrievable directly through AVFilterGraph.filters or with*         avfilter_graph_get_filter()) on success or NULL on failure.*/
AVFilterContext *avfilter_graph_alloc_filter(AVFilterGraph *graph,const AVFilter *filter,const char *name);/*** Get a filter instance identified by instance name from graph.** @param graph filter graph to search through.* @param name filter instance name (should be unique in the graph).* @return the pointer to the found filter instance or NULL if it* cannot be found.*/
AVFilterContext *avfilter_graph_get_filter(AVFilterGraph *graph, const char *name);/*** Create and add a filter instance into an existing graph.* The filter instance is created from the filter filt and inited* with the parameter args. opaque is currently ignored.** In case of success put in *filt_ctx the pointer to the created* filter instance, otherwise set *filt_ctx to NULL.** @param name the instance name to give to the created filter instance* @param graph_ctx the filter graph* @return a negative AVERROR error code in case of failure, a non* negative value otherwise*/
int avfilter_graph_create_filter(AVFilterContext **filt_ctx, const AVFilter *filt,const char *name, const char *args, void *opaque,AVFilterGraph *graph_ctx);/*** Enable or disable automatic format conversion inside the graph.** Note that format conversion can still happen inside explicitly inserted* scale and aresample filters.** @param flags  any of the AVFILTER_AUTO_CONVERT_* constants*/
void avfilter_graph_set_auto_convert(AVFilterGraph *graph, unsigned flags);enum {AVFILTER_AUTO_CONVERT_ALL  =  0, /**< all automatic conversions enabled */AVFILTER_AUTO_CONVERT_NONE = -1, /**< all automatic conversions disabled */
};/*** Check validity and configure all the links and formats in the graph.** @param graphctx the filter graph* @param log_ctx context used for logging* @return >= 0 in case of success, a negative AVERROR code otherwise*/
int avfilter_graph_config(AVFilterGraph *graphctx, void *log_ctx);/*** Free a graph, destroy its links, and set *graph to NULL.* If *graph is NULL, do nothing.*/
void avfilter_graph_free(AVFilterGraph **graph);

dump一个图

/*** Dump a graph into a human-readable string representation.** @param graph    the graph to dump* @param options  formatting options; currently ignored* @return  a string, or NULL in case of memory allocation failure;*          the string must be freed using av_free*/
char *avfilter_graph_dump(AVFilterGraph *graph, const char *options);

解析一个图

图的解析分为三层,突然就忘了艹,总之就是先解析外边最大的block,再解析图内部的filter


/*** Add a graph described by a string to a graph.** @note The caller must provide the lists of inputs and outputs,* which therefore must be known before calling the function.** @note The inputs parameter describes inputs of the already existing* part of the graph; i.e. from the point of view of the newly created* part, they are outputs. Similarly the outputs parameter describes* outputs of the already existing filters, which are provided as* inputs to the parsed filters.** @param graph   the filter graph where to link the parsed graph context* @param filters string to be parsed* @param inputs  linked list to the inputs of the graph* @param outputs linked list to the outputs of the graph* @return zero on success, a negative AVERROR code on error*/
int avfilter_graph_parse(AVFilterGraph *graph, const char *filters,AVFilterInOut *inputs, AVFilterInOut *outputs,void *log_ctx);/*** Add a graph described by a string to a graph.** In the graph filters description, if the input label of the first* filter is not specified, "in" is assumed; if the output label of* the last filter is not specified, "out" is assumed.** @param graph   the filter graph where to link the parsed graph context* @param filters string to be parsed* @param inputs  pointer to a linked list to the inputs of the graph, may be NULL.*                If non-NULL, *inputs is updated to contain the list of open inputs*                after the parsing, should be freed with avfilter_inout_free().* @param outputs pointer to a linked list to the outputs of the graph, may be NULL.*                If non-NULL, *outputs is updated to contain the list of open outputs*                after the parsing, should be freed with avfilter_inout_free().* @return non negative on success, a negative AVERROR code on error*/
int avfilter_graph_parse_ptr(AVFilterGraph *graph, const char *filters,AVFilterInOut **inputs, AVFilterInOut **outputs,void *log_ctx);/*** Add a graph described by a string to a graph.** @param[in]  graph   the filter graph where to link the parsed graph context* @param[in]  filters string to be parsed* @param[out] inputs  a linked list of all free (unlinked) inputs of the*                     parsed graph will be returned here. It is to be freed*                     by the caller using avfilter_inout_free().* @param[out] outputs a linked list of all free (unlinked) outputs of the*                     parsed graph will be returned here. It is to be freed by the*                     caller using avfilter_inout_free().* @return zero on success, a negative AVERROR code on error** @note This function returns the inputs and outputs that are left* unlinked after parsing the graph and the caller then deals with* them.* @note This function makes no reference whatsoever to already* existing parts of the graph and the inputs parameter will on return* contain inputs of the newly parsed part of the graph.  Analogously* the outputs parameter will contain outputs of the newly created* filters.*/
int avfilter_graph_parse2(AVFilterGraph *graph, const char *filters,AVFilterInOut **inputs,AVFilterInOut **outputs);

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/217939.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

HarmonyOS第一课ArkTS开发语言(TypeScript快速入门)

编程语言介绍 ArkTS是HarmonyOS优选的主力应用开发语言。它在TypeScript&#xff08;简称TS&#xff09;的基础上&#xff0c;匹配ArkUI框架&#xff0c;扩展了声明式UI、状态管理等相应的能力&#xff0c;让开发者以更简洁、更自然的方式开发跨端应用。要了解什么是ArkTS&…

python安装库问题记录

1.basicsr库安装 pip install -i https://mirrors.aliyun.com/pypi/simple tb-nightly pip install -i https://pypi.tuna.tsinghua.edu.cn/simple basicsr1.4.2

HTML如何使用图片链接

文章目录 图片链接的使用常见图片类型PNGJPGGIFBMP 图片链接的使用 在 HTML 中&#xff0c;图像由 标签定义。 是空标签&#xff0c;意思是说&#xff0c;它只包含属性&#xff0c;并且没有闭合标签。 语法&#xff1a; <img src”图片路径" title“鼠标悬浮在图片上…

数据无效:问题和解决方案的分析

一、说明 在数字时代&#xff0c;数据已成为企业、组织和个人的基本资源。然而&#xff0c;在浩瀚的数据海洋中&#xff0c;困扰数据分析的一个常见问题是存在空值或缺失数据。数据无效是指某些数据字段中缺少信息&#xff0c;这在根据该数据进行分析和决策时可能会导致重大问题…

STM32读取EEPROM存储芯片AT24C512故障然后排坑记录

背景&#xff1a; 有一个项目用到STM32F091芯片去读取 AT24C512C-SSHD EEPROM 芯片&#xff0c;我直接移植了之前项目的IIC库&#xff0c;结果程序运行后&#xff0c;读不出EEPROM里面的数据。 摘要&#xff1a; 本文主要介绍一个基于STM32F091芯片和AT24C512C-SSHD EEPROM芯片…

java-servlet

文章目录 一、概念二、Idea搭建javaWeb项目三、Servlet的生命周期四、请求重定向五、请求转发六、jsp基本使用七、JSTL标签库八、Servlet 过滤器 一、概念 定义 运行在服务端的Java应用程序。 作用 处理客户端发送的请求及响应处理的结果。 二、Idea搭建javaWeb项目 javaWe…

运筹学经典问题(四):多商品网络流问题

问题描述 多商品网络流问题&#xff08;Multicommodity Network Flow, MCNF&#xff09;是指在一个图网络中&#xff0c;多个商品从各自起点运输到各自终点的问题。 更具体的&#xff0c;给定一个图网络 G ( V , A ) G(V, A) G(V,A)&#xff1a; K K K&#xff1a;表示商品的…

MTK Android P Sensor架构(一)

需求场景&#xff1a; 本来如果只是给传感器写个驱动并提供能读取温湿度数据的节点&#xff0c;是一件比较轻松的事情&#xff0c;但是最近上层应用的同事要求我们按照安卓标准的流程来&#xff0c;这样他们就能通过注册一个服务直接读取传感器事件数据了。这样做的好处就是第…

TiDB存储引擎的初步认识

文章目录 TiDB简介分布式系统CAP 理论一致性可用性分区容错性 应用场景关系型模型事务ACID 特性原子性一致性隔离性持久性 与传统非分布式数据库架构对比TiDB 分布式数据库整体架构 TiDB简介 TiDB 是 PingCAP 公司自主设计、研发的开源分布式关系型数据库&#xff0c;是一款同…

静态路由原理与配置

文章目录 静态路由原理与配置一、路由器的工作原理1、路由概述2、路由器的工作原理 二、路由表的形成1、路由表2、路由表的形成 三、静态路由和默认路由1、静态路由的缺点2、默认路由&#xff08;是特殊的静态路由&#xff09;3、查看路由表 四、路由器转发数据包的封装过程五、…

Django模型

一、model 文件中的类的建立&#xff1a; 对应的是数据库中的每个表&#xff0c;类中有什么字段&#xff0c;表就会对应的生成某个字段&#xff0c;主键id字段会自己生成&#xff1b; 数据库中的文件获取&#xff1a;只能通过模型类.objects来获取&#xff0c;不能通过模型类…

TikTok与虚拟现实的完美交融:全新娱乐时代的开启

TikTok&#xff0c;这个风靡全球的短视频平台&#xff0c;与虚拟现实&#xff08;VR&#xff09;技术的深度结合&#xff0c;为用户呈现了一场全新的娱乐盛宴。虚拟现实技术为TikTok带来了更丰富、更沉浸的用户体验&#xff0c;标志着全新娱乐时代的开启。本文将深入探讨TikTok…

数据结构与算法-动态规划-买卖股票的最佳时机

买卖股票的最佳时机 给定一个数组 prices &#xff0c;它的第 i 个元素 prices[i] 表示一支给定股票第 i 天的价格。 你只能选择 某一天 买入这只股票&#xff0c;并选择在 未来的某一个不同的日子 卖出该股票。设计一个算法来计算你所能获取的最大利润。 返回你可以从这笔交…

C# WPF上位机开发(内嵌虚拟机的软件开发)

【 声明&#xff1a;版权所有&#xff0c;欢迎转载&#xff0c;请勿用于商业用途。 联系信箱&#xff1a;feixiaoxing 163.com】 学习过halcon的同学都知道&#xff0c;它不仅有很多的图像算子可以使用&#xff0c;而且调试很方便。每一步骤的调试结果&#xff0c;都可以看到对…

C语言内存池的使用场景和代码示例

当然可以。在C语言中&#xff0c;内存池是一种用于管理内存分配的技术。使用内存池可以避免频繁地申请和释放内存&#xff0c;从而提高内存的使用效率&#xff0c;并减少内存碎片。内存池的使用场景主要包括需要频繁分配和释放相同大小的内存块的情况。下面是一个简单的C语言代…

什么是云际计算?SD-WAN在云际计算中的作用是什么?

在当今数字化时代&#xff0c;云计算已经成为企业处理数据和应用程序的主要方式。然而&#xff0c;随着物联网设备数量的增加和对实时性要求的提高&#xff0c;传统的集中式云计算模型面临一些挑战。为了解决这些问题&#xff0c;云际计算&#xff08;Edge Computing&#xff0…

TDengine Kafka Connector将 Kafka 中指定 topic 的数据(批量或实时)同步到 TDengine

教程放在这里&#xff1a;TDengine Java Connector&#xff0c;官方文档已经写的很清晰了&#xff0c;不再赘述。 这里记录一下踩坑&#xff1a; 1.报错 java.lang.UnsatisfiedLinkError: no taos in java.library.pathat java.lang.ClassLoader.loadLibrary(ClassLoader.j…

亚马逊、速卖通、虾皮等平台有哪些测评补单方案,哪个比较好用

随着全球电子商务的迅速发展&#xff0c;跨境电商环境的潜力和机遇日益显现。跨境卖家们可以更便捷地将产品销售到全球市场&#xff0c;但同时也面临着更激烈的竞争、更严格的规定和更高的运营成本等挑战。在这个环境中&#xff0c;如何抓住机遇并克服挑战&#xff0c;成为了所…

Harmony OS基本介绍

作为华为最新的操作系统&#xff0c;Harmony OS在全球范围内引起了广泛的关注和探讨。它是一款开放、协同、可定制的智能终端操作系统&#xff0c;可以在不同的设备上实现无缝的互联互通。在本篇文章中&#xff0c;我们将对Harmony OS的使用做一个总结&#xff0c;分别从以下几…

数据库系统相关概念

数据&#xff1a;描述事务的符号记录。 数据库(DB)&#xff1a;按一定的数据模型组织&#xff0c;描述和存储在计算机内的&#xff0c;有组织的&#xff0c;可共享的数据集合。 数据库管理系统(DBMS)&#xff1a;位于用户和操作系统之间的一层数据管理软件。主要功能包括&#…