【FFmpeg】avio_open2函数
【FFmpeg】avio_open2函数
- 1.avio_open2
- 1.1 创建URLContext(ffurl_open_whitelist)
- 1.1.1 创建URLContext(ffurl_alloc)
- 1.1.1.1 查找合适的protocol(url_find_protocol)
- 1.1.1.2 为查找到的URLProtocol创建URLContext(url_alloc_for_protocol)
- 1.1.2 打开URLContext(ffurl_connect)
- 1.2 根据创建的URLContext初始化AVIOContext(ffio_fdopen)
- 1.2.1 创建AVIOContext(avio_alloc_context)
- 2.小结
参考:
FFmpeg源代码简单分析:avio_open2()
示例工程:
【FFmpeg】调用ffmpeg库实现264软编
【FFmpeg】调用ffmpeg库实现264软解
【FFmpeg】调用ffmpeg库进行RTMP推流和拉流
【FFmpeg】调用ffmpeg库进行SDL2解码后渲染
流程分析:
【FFmpeg】编码链路上主要函数的简单分析
【FFmpeg】解码链路上主要函数的简单分析
结构体分析:
【FFmpeg】AVCodec结构体
【FFmpeg】AVCodecContext结构体
【FFmpeg】AVStream结构体
【FFmpeg】AVFormatContext结构体
【FFmpeg】AVIOContext结构体
【FFmpeg】AVPacket结构体
函数分析:
【FFmpeg】avformat_open_input函数
【FFmpeg】avformat_find_stream_info函数
【FFmpeg】avformat_alloc_output_context2函数
avio_open2函数的内部调用关系为
1.avio_open2
avio_open2函数的定义位于libavformat\avio.c中,功能是打开URL,之后方便进行读写操作。这里的URL是广义的地址,对于文件而言,就是文件的路径,如"C:\xxx\test.flv",也可以是地址例如"rtmp://127.0.0.1:1935/live/stream",flag表示控制如何打开url所指示的资源的标志,如AVIO_FLAG_READ和AVIO_FLAG_WRITE
/*** Create and initialize a AVIOContext for accessing the* resource indicated by url.* @note When the resource indicated by url has been opened in* read+write mode, the AVIOContext can be used only for writing.** @param s Used to return the pointer to the created AVIOContext.* In case of failure the pointed to value is set to NULL.* @param url resource to access* @param flags flags which control how the resource indicated by url* is to be opened* @param int_cb an interrupt callback to be used at the protocols level* @param options A dictionary filled with protocol-private options. On return* this parameter will be destroyed and replaced with a dict containing options* that were not found. May be NULL.* @return >= 0 in case of success, a negative value corresponding to an* AVERROR code in case of failure*/
// 创建并初始化一个AVIOContext,用于访问url指定的资源
// @note:当url所指示的资源以读+写方式打开时,AVIOContext只能用于写
int avio_open2(AVIOContext **s, const char *filename, int flags,const AVIOInterruptCB *int_cb, AVDictionary **options)
{return ffio_open_whitelist(s, filename, flags, int_cb, options, NULL, NULL);
}
avio_open2调用ffio_open_whitelist进行AVIOContext的创建,而ffio_open_whitelist的实现方式如下,其中主要使用了两个函数:(1)ffurl_open_whitelist根据白名单创建URLContext;(2)ffio_fdopen根据创建的URLContext来初始化AVIOContext。其中,URLContext完成协议的读写操作。
int ffio_open_whitelist(AVIOContext **s, const char *filename, int flags,const AVIOInterruptCB *int_cb, AVDictionary **options,const char *whitelist, const char *blacklist)
{URLContext *h;int err;*s = NULL;// 1.根据whitelist创建URLContexterr = ffurl_open_whitelist(&h, filename, flags, int_cb, options, whitelist, blacklist, NULL);if (err < 0)return err;// 2.根据创建的URLContext初始化AVIOContexterr = ffio_fdopen(s, h);if (err < 0) {ffurl_close(h);return err;}return 0;
}
1.1 创建URLContext(ffurl_open_whitelist)
该函数的主要内容为两个部分:(1)ffurl_alloc:创建URLContext;(2)ffurl_connect:打开已创建的URLContext;
int ffurl_open_whitelist(URLContext **puc, const char *filename, int flags,const AVIOInterruptCB *int_cb, AVDictionary **options,const char *whitelist, const char* blacklist,URLContext *parent)
{AVDictionary *tmp_opts = NULL;AVDictionaryEntry *e;// 创建URLContextint ret = ffurl_alloc(puc, filename, flags, int_cb);if (ret < 0)return ret;if (parent) {ret = av_opt_copy(*puc, parent);if (ret < 0)goto fail;}if (options &&(ret = av_opt_set_dict(*puc, options)) < 0)goto fail;if (options && (*puc)->prot->priv_data_class &&(ret = av_opt_set_dict((*puc)->priv_data, options)) < 0)goto fail;if (!options)options = &tmp_opts;av_assert0(!whitelist ||!(e=av_dict_get(*options, "protocol_whitelist", NULL, 0)) ||!strcmp(whitelist, e->value));av_assert0(!blacklist ||!(e=av_dict_get(*options, "protocol_blacklist", NULL, 0)) ||!strcmp(blacklist, e->value));if ((ret = av_dict_set(options, "protocol_whitelist", whitelist, 0)) < 0)goto fail;if ((ret = av_dict_set(options, "protocol_blacklist", blacklist, 0)) < 0)goto fail;if ((ret = av_opt_set_dict(*puc, options)) < 0)goto fail;// 打开获得的URLProtocolret = ffurl_connect(*puc, options);if (!ret)return 0;
fail:ffurl_closep(puc);return ret;
}
1.1.1 创建URLContext(ffurl_alloc)
int ffurl_alloc(URLContext **puc, const char *filename, int flags,const AVIOInterruptCB *int_cb)
{const URLProtocol *p = NULL;// 根据filename查找合适的protocolp = url_find_protocol(filename);if (p)// 为protocol分配URLContextreturn url_alloc_for_protocol(puc, p, filename, flags, int_cb);*puc = NULL;return AVERROR_PROTOCOL_NOT_FOUND;
}
1.1.1.1 查找合适的protocol(url_find_protocol)
函数主要工作是调用ffurl_get_protocols获取一个protocol
static const struct URLProtocol *url_find_protocol(const char *filename)
{const URLProtocol **protocols;char proto_str[128], proto_nested[128], *ptr;size_t proto_len = strspn(filename, URL_SCHEME_CHARS);int i;if (filename[proto_len] != ':' &&(strncmp(filename, "subfile,", 8) || !strchr(filename + proto_len + 1, ':')) ||is_dos_path(filename))strcpy(proto_str, "file");elseav_strlcpy(proto_str, filename,FFMIN(proto_len + 1, sizeof(proto_str)));av_strlcpy(proto_nested, proto_str, sizeof(proto_nested));if ((ptr = strchr(proto_nested, '+')))*ptr = '\0';// 寻找一个protocolsprotocols = ffurl_get_protocols(NULL, NULL);if (!protocols)return NULL;for (i = 0; protocols[i]; i++) {const URLProtocol *up = protocols[i];if (!strcmp(proto_str, up->name)) {av_freep(&protocols);return up;}if (up->flags & URL_PROTOCOL_FLAG_NESTED_SCHEME &&!strcmp(proto_nested, up->name)) {av_freep(&protocols);return up;}}av_freep(&protocols);if (av_strstart(filename, "https:", NULL) || av_strstart(filename, "tls:", NULL))av_log(NULL, AV_LOG_WARNING, "https protocol not found, recompile FFmpeg with ""openssl, gnutls or securetransport enabled.\n");return NULL;
}
ffurl_get_protocol的定义如下,大致的流程是遍历可选的url_protocol,检查是否位于白名单中且不在黑名单中
const URLProtocol **ffurl_get_protocols(const char *whitelist,const char *blacklist)
{const URLProtocol **ret;int i, ret_idx = 0;ret = av_calloc(FF_ARRAY_ELEMS(url_protocols), sizeof(*ret));if (!ret)return NULL;for (i = 0; url_protocols[i]; i++) {const URLProtocol *up = url_protocols[i];if (whitelist && *whitelist && !av_match_name(up->name, whitelist))continue;if (blacklist && *blacklist && av_match_name(up->name, blacklist))continue;ret[ret_idx++] = up;}return ret;
}
1.1.1.2 为查找到的URLProtocol创建URLContext(url_alloc_for_protocol)
在创建URLContext时,会先检查flag和函数对应的关系:(1)网络操作;(2)读取;(3)写入;如果有一个初始化失败,则返回错误
static int url_alloc_for_protocol(URLContext **puc, const URLProtocol *up,const char *filename, int flags,const AVIOInterruptCB *int_cb)
{URLContext *uc;int err;// flag中包含NETWORK,但是网络初始化模块失败,则返回错误
#if CONFIG_NETWORKif (up->flags & URL_PROTOCOL_FLAG_NETWORK && !ff_network_init())return AVERROR(EIO);
#endif// flag中包含AVIO_FLAG_READ,但是不包含url_read,则输出错误if ((flags & AVIO_FLAG_READ) && !up->url_read) {av_log(NULL, AV_LOG_ERROR,"Impossible to open the '%s' protocol for reading\n", up->name);return AVERROR(EIO);}// flag中包含AVIO_FALG_WRITE,但是不包含url_write,则输出错误if ((flags & AVIO_FLAG_WRITE) && !up->url_write) {av_log(NULL, AV_LOG_ERROR,"Impossible to open the '%s' protocol for writing\n", up->name);return AVERROR(EIO);}// 前续检查结束,创建结构体,并且进行初始化赋值uc = av_mallocz(sizeof(URLContext) + strlen(filename) + 1);if (!uc) {err = AVERROR(ENOMEM);goto fail;}uc->av_class = &url_context_class;uc->filename = (char *)&uc[1];strcpy(uc->filename, filename);uc->prot = up;uc->flags = flags;uc->is_streamed = 0; /* default = not streamed */uc->max_packet_size = 0; /* default: stream file */if (up->priv_data_size) {uc->priv_data = av_mallocz(up->priv_data_size);if (!uc->priv_data) {err = AVERROR(ENOMEM);goto fail;}if (up->priv_data_class) {char *start;*(const AVClass **)uc->priv_data = up->priv_data_class;av_opt_set_defaults(uc->priv_data);if (av_strstart(uc->filename, up->name, (const char**)&start) && *start == ',') {int ret= 0;char *p= start;char sep= *++p;char *key, *val;p++;if (strcmp(up->name, "subfile"))ret = AVERROR(EINVAL);while(ret >= 0 && (key= strchr(p, sep)) && p<key && (val = strchr(key+1, sep))){*val= *key= 0;ret = av_opt_set(uc->priv_data, p, key+1, 0);if (ret == AVERROR_OPTION_NOT_FOUND)av_log(uc, AV_LOG_ERROR, "Key '%s' not found.\n", p);*val= *key= sep;p= val+1;}if(ret<0 || p!=key){av_log(uc, AV_LOG_ERROR, "Error parsing options string %s\n", start);err = AVERROR(EINVAL);goto fail;}memmove(start, key+1, strlen(key));}}}if (int_cb)uc->interrupt_callback = *int_cb;*puc = uc;return 0;
fail:*puc = NULL;if (uc)av_freep(&uc->priv_data);av_freep(&uc);
#if CONFIG_NETWORKif (up->flags & URL_PROTOCOL_FLAG_NETWORK)ff_network_close();
#endifreturn err;
}
1.1.2 打开URLContext(ffurl_connect)
函数的主要功能是打开前面创建的URLContext,首先检查前面创建的URLContext是否被正确初始化,然后调用url_open打开URL
int ffurl_connect(URLContext *uc, AVDictionary **options)
{int err;AVDictionary *tmp_opts = NULL;AVDictionaryEntry *e;if (!options)options = &tmp_opts;// Check that URLContext was initialized correctly and lists are matching if set// 检查URLContext被正确的初始化// 如果设置了黑白名单需要检查URLContext是否符合要求av_assert0(!(e=av_dict_get(*options, "protocol_whitelist", NULL, 0)) ||(uc->protocol_whitelist && !strcmp(uc->protocol_whitelist, e->value)));av_assert0(!(e=av_dict_get(*options, "protocol_blacklist", NULL, 0)) ||(uc->protocol_blacklist && !strcmp(uc->protocol_blacklist, e->value)));if (uc->protocol_whitelist && av_match_list(uc->prot->name, uc->protocol_whitelist, ',') <= 0) {av_log(uc, AV_LOG_ERROR, "Protocol '%s' not on whitelist '%s'!\n", uc->prot->name, uc->protocol_whitelist);return AVERROR(EINVAL);}if (uc->protocol_blacklist && av_match_list(uc->prot->name, uc->protocol_blacklist, ',') > 0) {av_log(uc, AV_LOG_ERROR, "Protocol '%s' on blacklist '%s'!\n", uc->prot->name, uc->protocol_blacklist);return AVERROR(EINVAL);}if (!uc->protocol_whitelist && uc->prot->default_whitelist) {av_log(uc, AV_LOG_DEBUG, "Setting default whitelist '%s'\n", uc->prot->default_whitelist);uc->protocol_whitelist = av_strdup(uc->prot->default_whitelist);if (!uc->protocol_whitelist) {return AVERROR(ENOMEM);}} else if (!uc->protocol_whitelist)av_log(uc, AV_LOG_DEBUG, "No default whitelist set\n"); // This should be an error once all declare a default whitelistif ((err = av_dict_set(options, "protocol_whitelist", uc->protocol_whitelist, 0)) < 0)return err;if ((err = av_dict_set(options, "protocol_blacklist", uc->protocol_blacklist, 0)) < 0)return err;// 使用url_open2或者url_open// 对于协议例如file,ftp,rtp,tcp,libRTMP等,使用的是url_open// 对于http协议,使用的是url_open2// 如果是file,url_open会链接到ftp_open()// 如果是libRTMP,url_open会链接到rtmp_open()err =uc->prot->url_open2 ? uc->prot->url_open2(uc,uc->filename,uc->flags,options) :uc->prot->url_open(uc, uc->filename, uc->flags);av_dict_set(options, "protocol_whitelist", NULL, 0);av_dict_set(options, "protocol_blacklist", NULL, 0);if (err)return err;uc->is_connected = 1;/* We must be careful here as ffurl_seek() could be slow,* for example for http */if ((uc->flags & AVIO_FLAG_WRITE) || !strcmp(uc->prot->name, "file"))if (!uc->is_streamed && ffurl_seek(uc, 0, SEEK_SET) < 0)uc->is_streamed = 1;return 0;
}
例如协议的格式为ftp,会调用ftp_open,定义如下;会调用ftp_connect实现ftp连接的打开
static int ftp_open(URLContext *h, const char *url, int flags)
{FTPContext *s = h->priv_data;int err;ff_dlog(h, "ftp protocol open\n");if ((err = ftp_connect(h, url)) < 0)goto fail;if (ftp_restart(s, 0) < 0) {h->is_streamed = 1;} else {ftp_file_size(s);if (s->write_seekable != 1 && flags & AVIO_FLAG_WRITE)h->is_streamed = 1;}return 0;fail:av_log(h, AV_LOG_ERROR, "FTP open failed\n");ftp_close(h);return err;
}
1.2 根据创建的URLContext初始化AVIOContext(ffio_fdopen)
/*** Create and initialize a AVIOContext for accessing the* resource referenced by the URLContext h.* @note When the URLContext h has been opened in read+write mode, the* AVIOContext can be used only for writing.** @param s Used to return the pointer to the created AVIOContext.* In case of failure the pointed to value is set to NULL.* @return >= 0 in case of success, a negative value corresponding to an* AVERROR code in case of failure*/
// 创建并初始化一个AVIOContext,用于访问URLContext引用的资源
// @note 如果URLContext已经以read + write模式打开,那么AVIOContext只能被用于writing
int ffio_fdopen(AVIOContext **sp, URLContext *h)
{AVIOContext *s;uint8_t *buffer = NULL;int buffer_size, max_packet_size;// 首先初始化AVIOContext当中的buffer,如果前面配置max_packet_size,则将其配置为buffer_size// 否则将buffer_size配置为IO_BUFFER_SIZE=32768max_packet_size = h->max_packet_size;if (max_packet_size) {// buffer_size不必超过packet最大size,因为最多填充一个packet即可buffer_size = max_packet_size; /* no need to bufferize more than one packet */} else {buffer_size = IO_BUFFER_SIZE;}if (!(h->flags & AVIO_FLAG_WRITE) && h->is_streamed) {if (buffer_size > INT_MAX/2)return AVERROR(EINVAL);buffer_size *= 2;}buffer = av_malloc(buffer_size);if (!buffer)return AVERROR(ENOMEM);// 创建AVIOContext*sp = avio_alloc_context(buffer, buffer_size, h->flags & AVIO_FLAG_WRITE, h,ffurl_read2, ffurl_write2, ffurl_seek2);if (!*sp) {av_freep(&buffer);return AVERROR(ENOMEM);}s = *sp;if (h->protocol_whitelist) {s->protocol_whitelist = av_strdup(h->protocol_whitelist);if (!s->protocol_whitelist) {avio_closep(sp);return AVERROR(ENOMEM);}}if (h->protocol_blacklist) {s->protocol_blacklist = av_strdup(h->protocol_blacklist);if (!s->protocol_blacklist) {avio_closep(sp);return AVERROR(ENOMEM);}}s->direct = h->flags & AVIO_FLAG_DIRECT;s->seekable = h->is_streamed ? 0 : AVIO_SEEKABLE_NORMAL;s->max_packet_size = max_packet_size;s->min_packet_size = h->min_packet_size;if(h->prot) {s->read_pause = h->prot->url_read_pause;s->read_seek = h->prot->url_read_seek;if (h->prot->url_read_seek)s->seekable |= AVIO_SEEKABLE_TIME;}((FFIOContext*)s)->short_seek_get = ffurl_get_short_seek;s->av_class = &ff_avio_class;return 0;
}
1.2.1 创建AVIOContext(avio_alloc_context)
该函数首先使用av_malloc创建FFIOContext,随后通过调用ffio_init_context来初始化,这里做了一个封装,先通过初始化FFIOContext,随后返回FFIOContext之中的AVIOContext
AVIOContext *avio_alloc_context(unsigned char *buffer,int buffer_size,int write_flag,void *opaque,int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),int (*write_packet)(void *opaque, const uint8_t *buf, int buf_size),int64_t (*seek)(void *opaque, int64_t offset, int whence))
{FFIOContext *s = av_malloc(sizeof(*s));if (!s)return NULL;ffio_init_context(s, buffer, buffer_size, write_flag, opaque,read_packet, write_packet, seek);return &s->pub;
}
ffio_init_context的初始化操作为
void ffio_init_context(FFIOContext *ctx,unsigned char *buffer,int buffer_size,int write_flag,void *opaque,int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),int (*write_packet)(void *opaque, const uint8_t *buf, int buf_size),int64_t (*seek)(void *opaque, int64_t offset, int whence))
{AVIOContext *const s = &ctx->pub;memset(ctx, 0, sizeof(*ctx));s->buffer = buffer;ctx->orig_buffer_size =s->buffer_size = buffer_size;s->buf_ptr = buffer;s->buf_ptr_max = buffer;s->opaque = opaque;s->direct = 0;url_resetbuf(s, write_flag ? AVIO_FLAG_WRITE : AVIO_FLAG_READ);s->write_packet = write_packet;s->read_packet = read_packet;s->seek = seek;s->pos = 0;s->eof_reached = 0;s->error = 0;s->seekable = seek ? AVIO_SEEKABLE_NORMAL : 0;s->min_packet_size = 0;s->max_packet_size = 0;s->update_checksum = NULL;ctx->short_seek_threshold = SHORT_SEEK_THRESHOLD;if (!read_packet && !write_flag) {s->pos = buffer_size;s->buf_end = s->buffer + buffer_size;}s->read_pause = NULL;s->read_seek = NULL;s->write_data_type = NULL;s->ignore_boundary_point = 0;ctx->current_type = AVIO_DATA_MARKER_UNKNOWN;ctx->last_time = AV_NOPTS_VALUE;ctx->short_seek_get = NULL;
}
2.小结
avio_open2函数用于为指定的URL创建一个URLContext,并且打开它,随后基于这个URLContext创建一个AVIOContext,从而实现对数据源的控制。在AVIOContext中,可以使用read_packet和write_packet进行packet读写操作,在URLProtocol中,可以使用url_read和url_write从protocol中读写数据。
因为还不是很理解协议层procotol的内容,下面是从别的地方看来的对于read_packet和url_read的理解
url_read和read_packet都是用于读取数据的函数,但实现方式和应用场景有所不同:
(1)url_read
主要用于从网络URL中读取数据。在实际应用中,可能会涉及到更复杂的网络协议,如http和rtmp。例如librtmp库中的RTMP packet结构就复杂处理发送和接收过程中的协议解析、分包、合包等复杂逻辑
(2)read_packet
主要用于从数据流当中读取特定格式的数据包。在FFmpeg中,av_read_frame()函数就是用来读取AVPacket的。这种情况下,数据处理可能会涉及更加复杂的数据流处理,如解码、过滤等
CSDN : https://blog.csdn.net/weixin_42877471
Github : https://github.com/DoFulangChen
相关文章:
![](https://img-blog.csdnimg.cn/direct/4d0d1370a54c447c96086f426275ff86.png)
【FFmpeg】avio_open2函数
【FFmpeg】avio_open2函数 1.avio_open21.1 创建URLContext(ffurl_open_whitelist)1.1.1 创建URLContext(ffurl_alloc)1.1.1.1 查找合适的protocol(url_find_protocol)1.1.1.2 为查找到的URLProtocol创建UR…...
![](https://img-blog.csdnimg.cn/direct/cc82416ab8c84ca9b1c96c69e045ff85.png#pic_center)
技术成神之路:设计模式(二)建造者模式
1.定义 建造者模式(Builder Pattern)是一种创建型设计模式,它允许你分步骤创建复杂对象,而不必直接调用构造函数。建造者模式特别适合那些包含多个组成部分并且构造过程复杂的对象。 2. 结构 建造者模式的主要组成部分包括&#…...
![](https://img-blog.csdnimg.cn/direct/46bb1cb0a3b540de96e1e44c2a131036.png)
基于Springboot+Vue+mysql仓库管理系统仓库进销存管理系统
博主介绍: 大家好,本人精通Java、Python、C#、C、C编程语言,同时也熟练掌握微信小程序、Php和Android等技术,能够为大家提供全方位的技术支持和交流。 我有丰富的成品Java、Python、C#毕设项目经验,能够为学生提供各类…...
![](https://www.ngui.cc/images/no-images.jpg)
爬虫scrapy库精简使用大全
一、基本命令 创建项目 scrpay startproject myapp创建爬虫文件 scrapy genspider spider_name "https://www.baidu.com"运行爬虫文件 scrapy crawl spider_name一、使用代理ip 打开中间件middlewares.py,增加以下代码 class ProxyMiddleware:def process…...
![](https://www.ngui.cc/images/no-images.jpg)
Qt - 如何在新线程 (QThread)中使用一个进程 (QProcess)?
在Qt中,QThread 用于处理后台任务,而 QProcess 用于启动和管理外部程序。如果你想在一个新的 QThread 中使用 QProcess,你需要了解 QProcess 并不是专门为在特定线程中运行而设计的。实际上,QProcess 通常在创建它的线程ÿ…...
![](https://www.ngui.cc/images/no-images.jpg)
Qt绘制多线段
最近画辅助线有刚需。 画图准备增加绘制多线段功能。 有哪些方法呢? QPainter Class | Qt GUI 5.15.17 void QPainter::drawPolyline(const QPolygon &points) QPolygon Class | Qt GUI 5.15.17 QPolygon polygon; polygon << QPoint(10, 20) <&…...
![](https://img-blog.csdnimg.cn/direct/ba8188967a3647a4a7b7a25cd4b23daa.png)
去中心化革命:探索区块链技术的前沿
随着信息技术的飞速发展,区块链技术作为一种新兴的去中心化解决方案,正逐渐改变着我们的经济、社会和技术格局。本文将从区块链的基本原理、当前的应用实例以及未来的发展趋势三个方面,深入探讨区块链技术在革命性变革中的角色和影响。 1. 区…...
![](https://www.ngui.cc/images/no-images.jpg)
2024年湖南省各市科小申报时间(科技型中小企业申报流程、条件、好处)新政
湖南省各市科小申报时间流程 一、评价管理 省科技厅牵头负责科技型中小企业评价工作的组织和监督、实地核查、公示公告、入库登记及编号撤销和集中抽查工作,及时处理相关异议、投诉和举报信息。 各市州科技局负责科技型中小企业评价工作的具体实施,组…...
![](https://img-blog.csdnimg.cn/direct/684607d202874d1facd3ee12ca0e32ff.png)
【JD-GUI】MacOS 中使用Java反编译工具JD-GUI
希望文章能给到你启发和灵感~ 如果觉得文章对你有帮助的话,点赞 关注 收藏 支持一下博主吧~ 阅读指南 开篇说明概念理解一、基础环境说明1.1 硬件环境1.2 软件环境 二、下载与安装2.1 选择对应版本2.2 解压运行排除异常:2.3 关于…...
![](https://img-blog.csdnimg.cn/direct/1612b665baef4d16ab2ef9e01fcc84a2.jpeg#pic_center)
C++:求梯形面积
梯形面积 已知上底15厘米,下底25厘米,问梯形面积值是多少? #include<iostream> using namespace std; int main() {//梯形的面积公式(上底下底) 高 2//上底变量、下底变量int s,d,h,m;s15;d25;h 2*150 * 2/s ;…...
![](https://img-blog.csdnimg.cn/direct/643ceccd0ae64698b0ef766f502111ec.png)
学会python——在excel中写入数据(python实例十三)
目录 1.认识Python 2.环境与工具 2.1 python环境 2.2 Visual Studio Code编译 3 .想Excel中写入数据 3.1 代码构思 3.2 代码实例 3.3 运行结果 4.总结 1.认识Python Python 是一个高层次的结合了解释性、编译性、互动性和面向对象的脚本语言。 Python 的设计具有很强的…...
![](https://img-blog.csdnimg.cn/direct/0d967a3c2a6e4d8f841e4f2486bde037.gif#pic_center)
Stable Diffusion【基础篇】:降噪强度(denoising strength)
提到降噪强度(denoising strength),大家一定不会陌生,这个参数是图生图中最关键的参数之一。今天在Stable Diffusion Art网站看到一篇介绍降噪强度(denoising strength)的文章(地址:…...
![](https://www.ngui.cc/images/no-images.jpg)
【Python】语法入门
文章目录 Python 基础语法:打印和变量打印和变量的基本语法打印变量 变量操作变量的命名规则打印和变量的应用场景示例:基本计算器 Python 基础语法:列表推导式列表推导式的基本语法基本示例带条件的列表推导式列表推导式的应用场景 Python 基…...
![](https://img-blog.csdnimg.cn/img_convert/ff7cc2e4da9522c15f4451069b0dc82f.jpeg)
匠心独运:红酒与手工艺的很好结合
在岁月的长河中,红酒与手工艺都以其不同的魅力和技艺,书写着各自的故事。当这两者相遇,仿佛是一场跨越时空的对话,不仅展现了匠心独运的技艺之美,更在无声中诉说着对品质与生活的热爱。今天,就让我们一起探…...
![](https://img-blog.csdnimg.cn/direct/841cd9f572e644dbaa480bb765841718.png)
第20章 Mac+VSCode配置C++环境
1. 下载VSCode VSCode下载地址在mac终端里输入xcode- select --install命令,根据提示安装xcode工具。 2. 安装插件(4个) 打开VScode,点击应用右侧菜单栏 C/C(必装) Code Runner(必装…...
![](https://www.ngui.cc/images/no-images.jpg)
FactoryBean 原理简介
FactoryBean 首先是一个工厂类,它可以生产指定的Bean,特殊之处在于它可以向Spring容器中注册两个Bean,一个是它本身,一个是FactoryBean.getObject()方法返回值所代表的Bean。通过实现 FactoryBean 接口,你可以控制某个…...
![](https://img-blog.csdnimg.cn/direct/628b1a9a5c55478f90bece95f1a24b06.png#pic_center)
Redis中hash类型的操作命令(命令的语法、返回值、时间复杂度、注意事项、操作演示)
文章目录 字符串和哈希类型相比hset 命令hget 命令hexistshdelhkeyshvalshgetallhmgethlenhsetnxhincrbyhincrbyfloat 字符串和哈希类型相比 假设有以下一种场景:现在要在 Redis 中存储一个用户的基本信息(id1、namezhangsan、age17),下图表示使用字符串…...
![](https://img-blog.csdnimg.cn/direct/921ee90850eb4ad0a5fa43fd319ebfbc.png)
UE5基本操作(二)
文章目录 前言相机的移动速度修改默认地图使用初学者内容包文件夹结构 总结 前言 在我们的上一篇文章中,我们已经介绍了一些Unreal Engine 5(UE5)的基本操作。UE5是一款强大的游戏开发引擎,它提供了许多工具和功能,使…...
![](https://www.ngui.cc/images/no-images.jpg)
React Navigation 和 Expo Router
React Navigation 是 React Native 社区最常用的导航库,其具有高度可定制性且性能良好的特性。它提供了一系列导航器(如堆栈导航器、标签导航器、抽屉导航器等),可以满足绝大多数的页面导航需求。 Expo Router 是 Expo 官方最新发…...
![](https://img-blog.csdnimg.cn/img_convert/5b8a7f47375191d179c1ff03f61b49ea.png)
如何使用python网络爬虫批量获取公共资源数据教程?
原文链接:如何使用python网络爬虫批量获取公共资源数据教程?https://mp.weixin.qq.com/s?__bizMzUzNTczMDMxMg&mid2247608240&idx4&snef281f66727afabfaae2066c6e92f792&chksmfa826657cdf5ef41571115328a09b9d34367d8b11415d5a5781dc4c…...
![](https://img-blog.csdnimg.cn/direct/7ebc7bd0f58e436b941753ffabf446f8.png)
常见位运算总结
1.基础位运算 左移 (<<): 最左侧位不要了, 最右侧补 0 右移(>>): 最右侧位不要了, 最左侧补符号位(正数补0, 负数补1) 按位取反(~):如果该位为 0 则转为 1, 如果该位为 1 则转为…...
![](https://img-blog.csdnimg.cn/img_convert/df636afcbd1a42815a604bedac410b65.gif)
自动化任务工具 -- zTasker v1.94 绿色版
软件简介 zTasker 是一款功能强大的自动化任务管理软件,以其简洁易用、一键式操作而著称。软件体积小巧,启动迅速,提供了超过100种任务类型和30多种定时/条件执行方法,能够满足用户在自动化方面的多样化需求。 zTasker 支持定时任…...
![](https://img-blog.csdnimg.cn/direct/c952487c7121458ca9cc717ae7d9d234.png)
mybatis mapper.xml 比较运算符(大于|小于|等于)的写法: 转义和<![CDATA[]]>
文章目录 引言I 使用xml 原生转义的方式进行转义II 使用 <![CDATA[ 内容 ]]>引言 应用场景:查询时间范围 背景:在 *.xml 中使用常规的 < > = <= >= 会与xml的语法存在冲突 <![CDATA[]]> 比 转义符 来的繁琐 <![CDATA[]]> 表示xml解析器忽略…...
![](https://www.ngui.cc/images/no-images.jpg)
UE5的基本操作
涵盖了从建模、快捷键使用、界面操作到性能分析等多个方面,以下是一些关键点和技巧:12 建模操作: 使用Shift5切换到建模模式,可以通过Shapes创建基本图元如立方体、球体等。 利用Create面板中的工具,如polyext自由创…...
![](https://www.ngui.cc/images/no-images.jpg)
C++ 实现学生成绩管理系统
C 实现学生成绩管理系统 思路: 定义 Student 类,包含学生的基本信息和成绩。实现添加学生、删除学生、修改成绩、显示所有学生成绩和查找学生的功能。使用向量(vector)存储学生信息。 #include <iostream> #include <…...
![](https://img-blog.csdnimg.cn/direct/6eafbe0b5c2843648ad067b10fcacdc3.png)
Elasticsearch 第四期:搜索和过滤
序 2024年4月,小组计算建设标签平台,使用ES等工具建了一个demo,由于领导变动关系,项目基本夭折。其实这两年也陆陆续续接触和使用过ES,两年前也看过ES的官网,当时刚毕业半年多,由于历史局限性导…...
![](https://www.ngui.cc/images/no-images.jpg)
力扣1124.表现良好的最长时间段
力扣1124.表现良好的最长时间段 哈希表存最小的下标 当s[i] > 0 那么他到头可以构成一个合法时间段否则 找到之前的 s[i] - 1 的下标: 因为连续的前缀和一定只相差1若想算更小的s[i] - 2,s[i] - 3…一定会先算到s[i] - 1那么这些更小数必然在 s[i]−1 首次出现的…...
![](https://www.ngui.cc/images/no-images.jpg)
算法训练营day67
题目1: #include <iostream> #include <vector> #include <string> #include <unordered_set> #include <unordered_map> #include <queue>using namespace std;int main() {string beginStr, endStr;int n;cin >> n;ci…...
![](https://img-blog.csdnimg.cn/direct/4cec6ce38bd14170ba26fbc193fe3839.png)
人工智能--图像语义分割
个人主页:欢迎来到 Papicatch的博客 课设专栏 :学生成绩管理系统 专业知识专栏:专业知识 文章目录 🍉引言 🍉介绍 🍈工作原理 🍍数据准备 🍍特征提取 🍍像素分…...
![](https://img-blog.csdnimg.cn/img_convert/93e066b7f102c5593b7fb1046f692f03.webp?x-oss-process=image/format,png)
fl studio20和21用哪一个好?FL-Chan from FL Studio欣赏
最近接到很多小伙伴的私信,都在问我平时会使用哪些音乐软件,能不能给一些参考。其实每个人的使用习惯不一样,需求也不一样。以DAW为例,有些人就是喜欢FL Studio,有些人吹爆Studio One,还有些人习惯使用Cuba…...
![](https://img-blog.csdnimg.cn/direct/b913cec2b0dd4124900d5af93ec1e589.png#pic_center)
OpenCV直方图计算函数calcHist的使用
操作系统:ubuntu22.04OpenCV版本:OpenCV4.9IDE:Visual Studio Code编程语言:C11 功能描述 图像的直方图是一种统计表示方法,用于展示图像中不同像素强度(通常是灰度值或色彩强度)出现的频率分布。具体来说…...
![](https://img-blog.csdnimg.cn/img_convert/5ae038bd9691eca69c4b5586110319f0.png)
09 docker 安装tomcat 详解
目录 一、安装tomcat 1. tomcat镜像的获取 2. docker创建容器实列 3. 访问测试 404错误 4. 解决方案 5. 使用免修改版容器镜像 5.1. 运行实列的创建 5.2. 出现问题及解决: 6. 验证 OK 一、安装tomcat 1. tomcat镜像的获取 docker search tomcat #docker …...
![](https://img-blog.csdnimg.cn/direct/88299377d49142aca912f3edc348ba06.png)
44.实现管理HOOK点的链表对象
上一个内容:43.实现HOOK接管寄存器数据 以 43.实现HOOK接管寄存器数据 它的代码为基础进行修改 首先创建一个类 这里创建的名为HOOKPOINT.h HOOKPOINT.cpp文件里面的内容 #include "pch.h" #include "HOOKPOINT.h"HOOKPOINT::HOOKPOINT() {…...
![](https://www.ngui.cc/images/no-images.jpg)
Unity小知识
1.当我们把摄像机的内容渲染到RenderTexture上而不是屏幕上时,那么相机的Aspect默认会设置成和RenderTexture的分辨率一样.不过最终如果把RenderTexture作为贴图贴到模型上去的时候还是会被UV拉伸和缩小的。 2.要想自定义UnityPackage的内容,只要找到UnityProject/L…...
![](https://www.ngui.cc/images/no-images.jpg)
【Jupyter Notebook与Git完美融合】在Notebook中驾驭版本控制的艺术
标题:【Jupyter Notebook与Git完美融合】在Notebook中驾驭版本控制的艺术 Jupyter Notebook是一个流行的开源Web应用程序,允许用户创建和共享包含实时代码、方程、可视化和解释性文本的文档。而Git是一个广泛使用的分布式版本控制系统,用于跟…...
![](https://img-blog.csdnimg.cn/img_convert/a56b851af56b591057271d5ac3559467.jpeg)
Python开发者必看:内存优化的实战技巧
更多Python学习内容:ipengtao.com Python是一种高级编程语言,以其易读性和强大的功能而广受欢迎。然而,由于其动态类型和自动内存管理,Python在处理大量数据或高性能计算时,内存使用效率可能不如一些低级语言。本文将介…...
![](https://img-blog.csdnimg.cn/direct/b583308bf0e34952937bfb17ec2c3e64.png)
Golang | Leetcode Golang题解之第214题最短回文串
题目: 题解: func shortestPalindrome(s string) string {n : len(s)fail : make([]int, n)for i : 0; i < n; i {fail[i] -1}for i : 1; i < n; i {j : fail[i - 1]for j ! -1 && s[j 1] ! s[i] {j fail[j]}if s[j 1] s[i] {fail[i…...
![](https://www.ngui.cc/images/no-images.jpg)
【ajax实战08】分页功能
本文章目标:点击上/下一页按钮,实现对应页面的变化 实现基本步骤: 一:保存并设置文章总条数 设置一个全局变量,将服务器返回的数据返回给全局变量 二:点击下一页,做临界值判断,并…...
![](https://www.ngui.cc/images/no-images.jpg)
基于Hadoop平台的电信客服数据的处理与分析②项目分析与设计---需求分析-项目场景引入
任务描述 需求分析是软件生命周期中一个非常重要的过程,它决定着整个软件项目的质量,也是整个软件开发的成败所在。本环节任务是完成软件需求规格说明书。 知识点 :软件需求规格说明书的编写 重 点 :软件需求规格说明书内容的…...
![](https://www.ngui.cc/images/no-images.jpg)
debug-mmlab
mmyolo bug1: MMYOLO for yolov5 instance segmentation on balloon dataset getting this error "ValueError: Key img_path is not in available keys. solution: pip install albumentations1.3.1 reference...
![](https://img-blog.csdnimg.cn/img_convert/a60f143603134e4b4dd1663fe09277dd.png)
年轻人为什么那么爱喝奶茶?
作者 | 艾泊宇 为什么年轻人那么爱喝奶茶?答案很简单:对他们来说,奶茶之于年轻人,正如白酒之于中年人。 奶茶不仅仅是一种饮料,它已经演化成一种文化现象,代表着温暖和爱的象征,甚至在某种程度上…...
![](https://www.ngui.cc/images/no-images.jpg)
手写数组去重
方法1-判断相邻元素 function _deleteRepeat(arr){if(!Array.isArray(arr)){throw new Error(参数必须是数组)}let res[];// 使用slice创建arr的副本,并排序let sortArrarr.slice().sort((a,b)>a-b);for(let i0;i<sortArr.length;i){if(isortArr.length-1||s…...
![](https://www.ngui.cc/images/no-images.jpg)
Firewalld 防火墙
1. 概述 在 RHEL7 系统中,firewalld 防火墙取代了传统的 iptables 防火墙。iptables 的防火墙策略是通过内核层面的 netfilter 网络过滤器来处理的,而 firewalld 则是通过内核层面的 nftables 包过滤框架来处理。firewalld 提供了更为丰富的功能和动态更…...
![](https://img-blog.csdnimg.cn/direct/243900ae67014e52adca1d6c0c6815fc.png)
Hive查询优化 - 面试工作不走弯路
引言:Hive作为一种基于Hadoop的数据仓库工具,广泛应用于大数据分析。然而,由于其依赖于MapReduce框架,查询的性能可能会受到影响。为了确保Hive查询能够高效运行,掌握查询优化技巧至关重要。在日常工作中,高…...
![](https://img-blog.csdnimg.cn/direct/f35690957256443980a4c6a2bbdf562e.png)
【VUE3】uniapp + vite中 uni.scss 使用 /deep/ 不生效(踩坑记录三)
vite 中使用 /deep/ 进行样式穿透报错 原因:vite 中不支持,换成 ::v-deep 或:deep即可...
![](https://img-blog.csdnimg.cn/direct/65cae820633648a9bfab4e756fc52cf0.png)
容器部署rabbitmq集群迁移
1、场景: 因业务需要,要求把rabbitmq-A集群上的数据迁移到rabbitmq-B集群上,rabbitmq的数据包括元数据(RabbitMQ用户、vhost、队列、交换和绑定)和消息数据,而消息数据存储在单独的消息存储库中。 2、迁移要…...
![](https://img-blog.csdnimg.cn/direct/848e85cda365436b8ff75efb3cb77500.png)
DP:背包问题----0/1背包问题
文章目录 💗背包问题💛背包问题的变体🧡0/1 背包问题的数学定义💚解决背包问题的方法💙例子 💗解决背包问题的一般步骤?💗例题💗总结 ❤️❤️❤️❤️❤️博客主页&…...
![](https://www.ngui.cc/images/no-images.jpg)
React antd umi 监听当前页面离开,在菜单栏提示操作
需求是我这里有个页面,离开当前页面之后,需要在菜单栏显示个提示,也就是Tour const [unblock, setUnblock] useState<() > void>(() > () > {});const [next, setNext] useState();useEffect(() > {const unblockHandler…...
![](https://www.ngui.cc/images/no-images.jpg)
在 Windows PowerShell 中模拟 Unix/Linux 的 touch 命令
在 Unix 或 Linux 系统中,touch 命令被广泛用于创建新文件或更新现有文件的时间戳。不过,在 Windows 系统中,尤其是在 PowerShell 环境下,并没有内置的 touch 命令。这篇博客将指导你如何在 Windows PowerShell 中模拟 touch 命令…...
![](https://img-home.csdnimg.cn/images/20230724024159.png?be=1&origin_url=https://www-file.huawei.com/-/media/corporate/images/news4/2024/q2/240624-3.jpg?la=zh)
鸿蒙NEXT
[中国,东莞,2024年6月24日] 华为开发者大会(HDC)正式开幕,带来全新的 HarmonyOS NEXT、盘古大模型5.0等最创新成果,持续为消费者和开发者带来创新体验。 HarmonyOS NEXT 鸿蒙生态 星河璀璨 鸿蒙生态设备数…...
![](https://img-blog.csdnimg.cn/direct/9ddc2d83a5b84bafb88b804ec6105abe.png)
绝区叁--如何在移动设备上本地运行LLM
随着大型语言模型 (LLM)(例如Llama 2和Llama 3)不断突破人工智能的界限,它们正在改变我们与周围技术的互动方式。这些模型早已集成到我们的手机中,但到目前为止,它们理解和处理请求的能力还非常有限。然而,…...
![](https://i-blog.csdnimg.cn/direct/b3416e84ad9048c2b4938a24fd659347.png)
在5G/6G应用中实现高性能放大器的建模挑战
来源:Modelling Challenges for Enabling High Performance Amplifiers in 5G/6G Applications {第28届“集成电路和系统的混合设计”(Mixed Design of Integrated Circuits and Systems)国际会议论文集,2021年6月24日至26日,波兰洛迪} 本文讨…...
![](https://img-blog.csdnimg.cn/direct/5e4bce067182480e91cb7c465bb5aac2.gif)
Linux运维之管道符、重定向与环境变量
前言:本博客仅作记录学习使用,部分图片出自网络,如有侵犯您的权益,请联系删除 目录 一、输入输出重定向 二、管道命令符 三、命令行的通配符 四、常用的转义字符 五、重要的环境变量 致谢 一、输入输出重定向 输入重定向是…...
![](https://www.ngui.cc/images/no-images.jpg)
单线服务器有什么作用?
什么是单线服务器?单线服务器是指只有一条物理线路可以接入的服务器,这表明所有的数据信息与用户的访问请求都只能通过这一条线路来进行传输,因此单线服务器在服务器的性能与可扩展性方面有着一定的限制。 单线服务器与双线服务器相比&#x…...
![](https://www.ngui.cc/images/no-images.jpg)
antd vue a-select 下拉框模糊查询失效解决方法
我原以为这是一个简单的配置,写上就好了,没想到竟然无法搜索,原因是antd下拉框模糊搜索(show-search)是默认按照value字段来查询的,但是一般我们的都是需要按照label这个属性来查询的。简单点按照我下面标红…...
![](https://www.ngui.cc/images/no-images.jpg)
密封类知识点
基本概念 密封类是使用sealed密封关键字修饰的类。 作用:让类无法再被继承。 实例 class Father {}sealed class Son:Father {} 作用 面向对象程序的设计中,密封类的主要作用就是不允许最底层子类被继承。 可以保证程序的规范性、安全性。 总结 关…...
![](https://www.ngui.cc/images/no-images.jpg)
比亚迪BYDSHARK墨西哥上市,开启南美出行新篇章
全球瞩目:BYD SHARK墨西哥首发,开启新能源皮卡新纪元在5月14日这个值得纪念的日子里,比亚迪首款皮卡BYD SHARK在墨西哥城举行了盛大的全球产品发布暨墨西哥上市发布会。BYD SHARK的惊艳亮相不仅彰显了比亚迪作为世界级新能源科技公司的强大实力,也宣告了全球新能源皮卡时代的正…...
![](https://www.ngui.cc/images/no-images.jpg)
Flutter 中的 CompositedTransformTarget 小部件:全面指南
Flutter 中的 CompositedTransformTarget 小部件:全面指南 在Flutter的动画和高级布局系统中,CompositedTransformTarget是一个与CompositedTransformFollower配合使用的组件,用于创建硬件加速的跟随动画和视差效果。这种类型的动画通常用于…...
![](https://img-blog.csdnimg.cn/direct/250426e0efc2495f995f490b070ee8e3.png)
5,串口编程---实现简单的用串口发送接收数据
单片机通过串口向PC机发送数据 PC机通过串口接收单片机发过来的数据 1.UART和USART的区别: USART支持同步通信方式,可以通过外部时钟信号进行同步传输,而UART仅支持异步通信方式 本开发板STM32F103ZET6有5个串口,用串口1作调试串口,因为串…...
![](https://img-blog.csdnimg.cn/direct/50e41659d8a94574852ac66e7f56ace3.png)
目标检测基础初步学习
目标检测(Object Detection) 目标检测任务说明 在动手学习深度学习中对目标检测任务有如下的描述。 图像分类任务中,我们假设图像中只有一个主要物体对象,我们只关注如何识别其类别。 然而,很多时候图像里有多个我们…...
![](https://img-blog.csdnimg.cn/direct/7cea911f53c94fb488598d8fbe6a01da.png)
React18 apexcharts数据可视化之甜甜圈图
03 甜甜圈图 apexcharts数据可视化之甜甜圈图。 有完整配套的Python后端代码。 本教程主要会介绍如下图形绘制方式: 基本甜甜圈图个性图案的甜甜圈图渐变色的甜甜圈图 面包圈 import ApexChart from react-apexcharts;export function DonutUpdate() {// 数据…...
![](https://img-blog.csdnimg.cn/direct/19dc9dc6517a4a4b8a3e5a24b79c9b61.png)
农业场景下的slam论文汇总
文章目录 概述2020基于SLA M 技术的高杆环境下小型植保车自主行驶系统研究【M】基于语义 SLAM 的农田感知系统研究[M]Ground-Level Mapping and Navigating for Agriculture Based on IoT and Computer VisionCanopy Density Esti…...