【FFmpeg】av_get_token用法

本文介绍了`av_get_token`函数的用途,它用于从字符串中提取未转义的子串直到遇到指定的终止字符。测试程序展示了如何使用该函数,并给出了不同终止字符的测试案例,演示了函数如何截取并返回字符串的不同部分。
/**
 * Unescape the given string until a non escaped terminating char,
 * and return the token corresponding to the unescaped string.
 *
 * The normal \ and ' escaping is supported. Leading and trailing
 * whitespaces are removed, unless they are escaped with '\' or are
 * enclosed between ''.
 *
 * @param buf the buffer to parse, buf will be updated to point to the
 * terminating char
 * @param term a 0-terminated list of terminating chars
 * @return the malloced unescaped string, which must be av_freed by
 * the user, NULL in case of allocation failure
 */
char *av_get_token(const char **buf, const char *term);

从*buf字符串找到第一个出现在term中的任意一个字符,将*buf进行截断,前面一部分(不包含term中的任意一个字符)通过返回值反馈,后面一部分在*buf反馈。

测试程序:
 

#include <stdlib.h>
#include <stdio.h>
#include <string.h>

#include "libavutil/avstring.h"

int main(int argc, char **argv)
{
    char *str = (char *)malloc(16);
    
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值