FFmpeg零基础学习(二)——视频文件信息获取
目录
- 前言
- 正文
- 一、获取宽高信息
- 1、核心代码
- 2、AVFormatContext
- 3、avformat_alloc_context
- 4、avformat_open_input
- 5、avformat_find_stream_info
- 6、av_dump_format
- 7、av_find_best_stream
- End、遇到的问题
- 1、Qt Debug模式avformat_alloc_context 无法分配对象,而Release模式可以
- 2、avformat_open_input 返回值为-22
- 参考
前言
本篇文章的目的在于输出导入的视频文件的宽高信息,或者其他信息。
正文
一、获取宽高信息
1、核心代码
int CFFmpegDemoTest::_GetVideoWidthAndHeight(const QString &_sVideoPath, int &_iWidth, int &_iHeight)
{AVFormatContext *fmt_ctx = avformat_alloc_context();//创建对象并初始化if (fmt_ctx == nullptr){return -1;}int ret = 0;AVStream *videoStream = nullptr;const char* cFilePath = _sVideoPath.toStdString().c_str();char errbuf[AV_ERROR_MAX_STRING_SIZE];do {//打开文件if ((ret = avformat_open_input(&fmt_ctx, cFilePath, NULL, NULL)) < 0){qDebug() << "--> Cannot open Video File";av_strerror(ret, errbuf, sizeof(errbuf));qDebug() << "错误信息:" << errbuf<<";ret:"<<ret;break;}if ((ret = avformat_find_stream_info (fmt_ctx, NULL)) < 0){qDebug() << "--> Cannot Find Stream Information";av_strerror(ret, errbuf, sizeof(errbuf));qDebug() << "错误信息:" << errbuf;break;}av_dump_format(fmt_ctx, 0, cFilePath, 0);//输出视频信息int iVideoStreamIndex = av_find_best_stream(fmt_ctx, AVMEDIA_TYPE_VIDEO, -1, -1, nullptr, 0);if (iVideoStreamIndex >= 0){videoStream = fmt_ctx->streams[iVideoStreamIndex];_iWidth = videoStream->codecpar->width;_iHeight = videoStream->codecpar->height;qDebug() << "--> CFFmpegDemoTest::_GetVideoWidthAndHeight _iWidth:"<<_iWidth<<";_iHeight:"<<_iHeight;}} while(0);avformat_close_input(&fmt_ctx);return ret;
}
获取到的打印信息
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'D:/FFmpeg/FFmpegPlayer/product/video/phone1.mp4':Metadata:major_brand : mp42minor_version : 0compatible_brands: isommp42creation_time : 2023-11-22T06:06:55.000000Zlocation : +24.6182+118.0385/location-eng : +24.6182+118.0385/com.android.version: 13Duration: 00:01:41.40, start: 0.000000, bitrate: 17998 kb/sStream #0:0[0x1](eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1080x1920, 17845 kb/s, 29.67 fps, 60 tbr, 90k tbn (default)Metadata:creation_time : 2023-11-22T06:06:55.000000Zhandler_name : VideoHandlevendor_id : [0][0][0][0]Side data:displaymatrix: rotation of 90.00 degreesStream #0:1[0x2](eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)Metadata:creation_time : 2023-11-22T06:06:55.000000Zhandler_name : SoundHandlevendor_id : [0][0][0][0]
2、AVFormatContext
AVFormatContext是FFmpeg中的一个重要数据结构,用于表示音视频封装格式的上下文。它包含了音视频封装格式相关的信息,比如输入/输出文件、流信息、封装格式参数等。
AVFormatContext结构体定义在libavformat/avformat.h头文件中,它的定义如下:
typedef struct AVFormatContext {const AVClass *av_class;AVInputFormat *iformat;AVOutputFormat *oformat;void *priv_data;...
} AVFormatContext;
下面是对AVFormatContext结构体中常用字段的详细解释:
av_class:指向一个AVClass结构体的指针,用于获取封装格式的类信息,比如名称、类型等。
iformat:指向一个AVInputFormat结构体的指针,表示输入的封装格式。在打开输入文件时,FFmpeg会根据输入文件的扩展名或者其他信息自动选择合适的AVInputFormat。
oformat:指向一个AVOutputFormat结构体的指针,表示输出的封装格式。在写入输出文件时,FFmpeg会根据输出文件的扩展名或者其他信息自动选择合适的AVOutputFormat。
priv_data:指向一个私有数据结构的指针,用于存储封装格式相关的私有数据。具体的结构体类型和内容取决于使用的封装格式。
除了上述字段之外,AVFormatContext还包含了一些其他的字段,用于存储音视频封装格式的相关信息,比如:
nb_streams:表示流的数量,即输入/输出文件中的音视频流的数量。
streams:一个指针数组,用于存储每个音视频流的信息。每个流都是一个AVStream结构体,包含了流的索引、时长、编解码器参数等信息。
duration:表示音视频文件的总时长。
bit_rate:表示音视频文件的比特率。
metadata:一个字典结构,用于存储音视频文件的元数据,比如标题、作者、描述等。
filename:指向输入/输出文件名的指针。
pb:指向一个AVIOContext结构体的指针,用于输入/输出文件的读写操作。
AVFormatContext结构体是FFmpeg中非常重要的一个数据结构,它提供了对音视频封装格式的访问和操作接口。通过操作AVFormatContext,可以实现音视频文件的解封装、封装、转码等功能。

执行完avformat_alloc_context,主要的一些东西。
3、avformat_alloc_context
avformat_alloc_context是FFmpeg库中的一个函数,用于动态分配并初始化一个AVFormatContext结构体。它的函数原型如下:
/*** Allocate an AVFormatContext.* avformat_free_context() can be used to free the context and everything* allocated by the framework within it.*/
AVFormatContext *avformat_alloc_context(void);
该函数会分配一块内存,并将其初始化为一个空的AVFormatContext结构体,然后返回指向该结构体的指针。
使用avformat_alloc_context函数可以创建一个空的AVFormatContext对象,然后可以通过设置不同的字段和参数来配置它,以便进行音视频封装或解封装操作。
总结来说,avformat_alloc_context函数用于动态分配和初始化一个空的AVFormatContext对象,为后续的音视频封装和解封装操作做准备。
所以,分配后,可以对AVFormatContext 对象进行判空,防止初始化失败。
4、avformat_open_input
avformat_open_input是FFmpeg库中的一个函数,用于打开音视频输入文件并初始化相关的输入上下文(AVFormatContext)。它的函数原型如下:
/*** Open an input stream and read the header. The codecs are not opened.* The stream must be closed with avformat_close_input().** @param ps Pointer to user-supplied AVFormatContext (allocated by* avformat_alloc_context). May be a pointer to NULL, in* which case an AVFormatContext is allocated by this* function and written into ps.* Note that a user-supplied AVFormatContext will be freed* on failure.*> 传入值为avformat_alloc_context 分配的对象* @param url URL of the stream to open.*> 要打开的流的地址* @param fmt If non-NULL, this parameter forces a specific input format.* Otherwise the format is autodetected.* >输入的文件的格式,若为NULL,则自动检测* @param options A dictionary filled with AVFormatContext and demuxer-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 on success, a negative AVERROR on failure.*> 返回值0,为正确,其他值为失败* @note If you want to use custom IO, preallocate the format context and set its pb field.*/
int avformat_open_input(AVFormatContext **ps, const char *url,const AVInputFormat *fmt, AVDictionary **options);
该函数的参数说明如下:
ps:指向指针的指针,用于存储分配的AVFormatContext对象。
url:输入文件的URL或文件名。
fmt:指定输入格式,如果为NULL,则由FFmpeg自动检测输入文件的格式。
options:指向包含附加选项的字典。可以在打开输入文件时提供一些特定的选项,比如设置超时时间、设置输入缓冲大小等。
1、强调关闭使用avformat_close_input。
2、函数返回一个整数值,表示操作的结果。如果返回值小于0,则表示打开输入文件失败,否则返回0表示操作成功。使用avformat_open_input函数可以打开一个音视频输入文件,并将其与一个AVFormatContext对象关联起来,以便后续的音视频解封装操作。
3、avformat_open_input函数用于打开音视频输入文件,并初始化相关的输入上下文。它是进行音视频解封装操作的起点之一。
源码如下:
int avformat_open_input(AVFormatContext **ps, const char *filename,ff_const59 AVInputFormat *fmt, AVDictionary **options)
{AVFormatContext *s = *ps;int i, ret = 0;AVDictionary *tmp = NULL;ID3v2ExtraMeta *id3v2_extra_meta = NULL;if (!s && !(s = avformat_alloc_context()))return AVERROR(ENOMEM);if (!s->av_class) {av_log(NULL, AV_LOG_ERROR, "Input context has not been properly allocated by avformat_alloc_context() and is not NULL either\n");return AVERROR(EINVAL);}if (fmt)s->iformat = fmt;if (options)av_dict_copy(&tmp, *options, 0);if (s->pb) // must be before any goto fails->flags |= AVFMT_FLAG_CUSTOM_IO;if ((ret = av_opt_set_dict(s, &tmp)) < 0)goto fail;if (!(s->url = av_strdup(filename ? filename : ""))) {ret = AVERROR(ENOMEM);goto fail;}#if FF_API_FORMAT_FILENAME
FF_DISABLE_DEPRECATION_WARNINGSav_strlcpy(s->filename, filename ? filename : "", sizeof(s->filename));
FF_ENABLE_DEPRECATION_WARNINGS
#endifif ((ret = init_input(s, filename, &tmp)) < 0)goto fail;s->probe_score = ret;if (!s->protocol_whitelist && s->pb && s->pb->protocol_whitelist) {s->protocol_whitelist = av_strdup(s->pb->protocol_whitelist);if (!s->protocol_whitelist) {ret = AVERROR(ENOMEM);goto fail;}}if (!s->protocol_blacklist && s->pb && s->pb->protocol_blacklist) {s->protocol_blacklist = av_strdup(s->pb->protocol_blacklist);if (!s->protocol_blacklist) {ret = AVERROR(ENOMEM);goto fail;}}if (s->format_whitelist && av_match_list(s->iformat->name, s->format_whitelist, ',') <= 0) {av_log(s, AV_LOG_ERROR, "Format not on whitelist \'%s\'\n", s->format_whitelist);ret = AVERROR(EINVAL);goto fail;}avio_skip(s->pb, s->skip_initial_bytes);/* Check filename in case an image number is expected. */if (s->iformat->flags & AVFMT_NEEDNUMBER) {if (!av_filename_number_test(filename)) {ret = AVERROR(EINVAL);goto fail;}}s->duration = s->start_time = AV_NOPTS_VALUE;/* Allocate private data. */if (s->iformat->priv_data_size > 0) {if (!(s->priv_data = av_mallocz(s->iformat->priv_data_size))) {ret = AVERROR(ENOMEM);goto fail;}if (s->iformat->priv_class) {*(const AVClass **) s->priv_data = s->iformat->priv_class;av_opt_set_defaults(s->priv_data);if ((ret = av_opt_set_dict(s->priv_data, &tmp)) < 0)goto fail;}}/* e.g. AVFMT_NOFILE formats will not have a AVIOContext */if (s->pb)ff_id3v2_read_dict(s->pb, &s->internal->id3v2_meta, ID3v2_DEFAULT_MAGIC, &id3v2_extra_meta);#if FF_API_DEMUXER_OPENif (!(s->flags&AVFMT_FLAG_PRIV_OPT) && s->iformat->read_header)
#elseif (s->iformat->read_header)
#endifif ((ret = s->iformat->read_header(s)) < 0)goto fail;if (!s->metadata) {s->metadata = s->internal->id3v2_meta;s->internal->id3v2_meta = NULL;} else if (s->internal->id3v2_meta) {av_log(s, AV_LOG_WARNING, "Discarding ID3 tags because more suitable tags were found.\n");av_dict_free(&s->internal->id3v2_meta);}if (id3v2_extra_meta) {if (!strcmp(s->iformat->name, "mp3") || !strcmp(s->iformat->name, "aac") ||!strcmp(s->iformat->name, "tta") || !strcmp(s->iformat->name, "wav")) {if ((ret = ff_id3v2_parse_apic(s, id3v2_extra_meta)) < 0)goto close;if ((ret = ff_id3v2_parse_chapters(s, id3v2_extra_meta)) < 0)goto close;if ((ret = ff_id3v2_parse_priv(s, id3v2_extra_meta)) < 0)goto close;} elseav_log(s, AV_LOG_DEBUG, "demuxer does not support additional id3 data, skipping\n");}ff_id3v2_free_extra_meta(&id3v2_extra_meta);if ((ret = avformat_queue_attached_pictures(s)) < 0)goto close;#if FF_API_DEMUXER_OPENif (!(s->flags&AVFMT_FLAG_PRIV_OPT) && s->pb && !s->internal->data_offset)
#elseif (s->pb && !s->internal->data_offset)
#endifs->internal->data_offset = avio_tell(s->pb);s->internal->raw_packet_buffer_remaining_size = RAW_PACKET_BUFFER_SIZE;update_stream_avctx(s);for (i = 0; i < s->nb_streams; i++)s->streams[i]->internal->orig_codec_id = s->streams[i]->codecpar->codec_id;if (options) {av_dict_free(options);*options = tmp;}*ps = s;return 0;close:if (s->iformat->read_close)s->iformat->read_close(s);
fail:ff_id3v2_free_extra_meta(&id3v2_extra_meta);av_dict_free(&tmp);if (s->pb && !(s->flags & AVFMT_FLAG_CUSTOM_IO))avio_closep(&s->pb);avformat_free_context(s);*ps = NULL;return ret;
}
分析可以查看雷神的这篇文章:
FFmpeg源代码简单分析:avformat_open_input()
可以看到,若打开文件失败,或是分配资源失败等等,都会将传入的AVFormatContext的对象置为NULL.
5、avformat_find_stream_info
avformat_find_stream_info是FFmpeg库中的一个函数,用于获取音视频文件的流信息。它会分析输入文件,并将解码器的相关信息填充到AVFormatContext中的streams数组中的每个元素中。
函数原型如下:
/*** Read packets of a media file to get stream information. This* is useful for file formats with no headers such as MPEG. This* function also computes the real framerate in case of MPEG-2 repeat* frame mode.* The logical file position is not changed by this function;* examined packets may be buffered for later processing.** @param ic media file handle* @param options If non-NULL, an ic.nb_streams long array of pointers to* dictionaries, where i-th member contains options for* codec corresponding to i-th stream.* On return each dictionary will be filled with options that were not found.* @return >=0 if OK, AVERROR_xxx on error** @note this function isn't guaranteed to open all the codecs, so* options being non-empty at return is a perfectly normal behavior.** @todo Let the user decide somehow what information is needed so that* we do not waste time getting stuff the user does not need.*/
int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options);
该函数的参数说明如下:
ic:指向AVFormatContext的指针,表示输入文件的上下文。
options:指向包含附加选项的字典。可以在获取流信息时提供一些特定的选项,比如设置解码器参数、设置过滤器等。
函数返回一个整数值,表示操作的结果。如果返回值小于0,则表示获取流信息失败,否则返回0表示操作成功。
使用avformat_find_stream_info函数可以在打开输入文件后调用,以获取输入文件的流信息,包括音频流、视频流、字幕流等。通过分析文件的数据包,该函数将填充AVFormatContext中的streams数组,每个数组元素对应一个流,并包含有关该流的详细信息,如编解码器类型、时间基准、时长、帧率等。
avformat_find_stream_info函数获取文件的流信息,并将其填充到AVFormatContext对象中的streams数组中。最后,可以通过遍历streams数组,处理每个流的相关信息。
总结来说,avformat_find_stream_info函数用于获取音视频文件的流信息,是进行音视频解封装操作的一步。通过分析输入文件的数据包,它将填充AVFormatContext对象中的streams数组。
6、av_dump_format
av_dump_format是FFmpeg库中的一个函数,用于打印音视频文件的详细格式信息。它可以用于调试和分析音视频文件,提供有关文件的元数据、流信息、编码参数等方面的详细信息。
函数原型:
/*** Print detailed information about the input or output format, such as* duration, bitrate, streams, container, programs, metadata, side data,* codec and time base.** @param ic the context to analyze* @param index index of the stream to dump information about* @param url the URL to print, such as source or destination file* @param is_output Select whether the specified context is an input(0) or output(1)*/
void av_dump_format(AVFormatContext *ic,int index,const char *url,int is_output);
该函数的参数说明如下:
ic:指向AVFormatContext的指针,表示输入/输出文件的上下文。
index:要打印信息的流的索引。如果设置为-1,则会打印所有流的信息。
url:指定输入/输出文件的URL或文件名。
is_output:指示是否为输出文件。如果设为非零值(例如1),则会打印输出文件的格式信息。
av_dump_format函数会打印音视频文件的格式信息到标准输出(stdout)或由FFmpeg库设置的日志回调函数。它会包含文件的元数据(例如文件格式、时长、比特率)、流的信息(例如流索引、编解码器、时长、帧率)以及其他相关参数。
总结来说,av_dump_format函数是一个用于打印音视频文件格式信息的便捷函数。它可用于调试和分析音视频文件,提供有关文件的详细信息。
7、av_find_best_stream
av_find_best_stream是FFmpeg库中的一个函数,用于查找最佳的音视频流。它可以根据指定的流类型(音频、视频、字幕等)和其他条件,选择最合适的流进行后续操作,如解码、编码等。
函数原型如下:
/*** Find the "best" stream in the file.* The best stream is determined according to various heuristics as the most* likely to be what the user expects.* If the decoder parameter is non-NULL, av_find_best_stream will find the* default decoder for the stream's codec; streams for which no decoder can* be found are ignored.** @param ic media file handle* @param type stream type: video, audio, subtitles, etc.* @param wanted_stream_nb user-requested stream number,* or -1 for automatic selection* @param related_stream try to find a stream related (eg. in the same* program) to this one, or -1 if none* @param decoder_ret if non-NULL, returns the decoder for the* selected stream* @param flags flags; none are currently defined** @return the non-negative stream number in case of success,* AVERROR_STREAM_NOT_FOUND if no stream with the requested type* could be found,* AVERROR_DECODER_NOT_FOUND if streams were found but no decoder** @note If av_find_best_stream returns successfully and decoder_ret is not* NULL, then *decoder_ret is guaranteed to be set to a valid AVCodec.*/
int av_find_best_stream(AVFormatContext *ic,enum AVMediaType type,int wanted_stream_nb,int related_stream,const struct AVCodec **decoder_ret,int flags);
该函数的参数说明如下:
ic:指向AVFormatContext的指针,表示输入文件的上下文。
type:要查找的流类型,使用AVMediaType枚举类型,例如AVMEDIA_TYPE_VIDEO表示视频流,AVMEDIA_TYPE_AUDIO表示音频流,AVMEDIA_TYPE_SUBTITLE表示字幕流等。
wanted_stream_nb:期望的流索引。如果设置为大于等于0的值,则表示要查找的具体流索引;如果设置为负值(例如-1),则表示要查找符合条件的第一个流。
related_stream:关联流索引。在某些情况下,需要根据另一个流来选择最佳流,例如根据视频流选择对应的音频流。如果没有关联流,可以设置为-1。
decoder_ret:指向AVCodec指针的指针,用于返回找到的解码器。
flags:查找流的标志位。可以使用一些特定的标志位,如AV_FIND_STREAM_INFO_IGNORED表示忽略流信息等。
End、遇到的问题
1、Qt Debug模式avformat_alloc_context 无法分配对象,而Release模式可以
这个问题会出现在Qt 5.15 MSVC2019 Debug模式中,后面我切换成MinGW就可以了,就暂不深究了,若想深究的,可以看一下这篇文章。
FFmpeg调试环境搭建

有教在不同的环境中调试的方法,但依我的拙见,我觉得学习一样的东西,一定不断的给自己正反馈, 否则,学习很难进行下去。
2、avformat_open_input 返回值为-22
可能的问题出现在前面avformat_alloc_context 对对象的分配不对。分配的结果可能是空。
参考
1、FFmpeg调试环境搭建
相关文章:
FFmpeg零基础学习(二)——视频文件信息获取
目录 前言正文一、获取宽高信息1、核心代码2、AVFormatContext3、avformat_alloc_context4、avformat_open_input5、avformat_find_stream_info6、av_dump_format7、av_find_best_stream End、遇到的问题1、Qt Debug模式avformat_alloc_context 无法分配对象,而Rele…...
探索 Vue 中的 bus.$emit:实现组件通信的强大工具
🤍 前端开发工程师(主业)、技术博主(副业)、已过CET6 🍨 阿珊和她的猫_CSDN个人主页 🕠 牛客高级专题作者、在牛客打造高质量专栏《前端面试必备》 🍚 蓝桥云课签约作者、已在蓝桥云…...
2017年五一杯数学建模A题公交车排班问题解题全过程文档及程序
2017年五一杯数学建模 A题 公交车排班问题 原题再现 随着徐州市经济的快速发展,公交车系统对于人们的出行扮演着越来越重要的角色。在公交车资源有限的情况下,合理的编排公交车的行车计划成为公交公司亟待解决的问题。以下给出公交车排班问题中的部分名…...
【c++】——类和对象(下) ——内存管理
作者:chlorine 专栏:c专栏 目录 💻 C/C内存分布 💻C语言中动态内存管理方式:malloc/calloc/realloc/free 编辑 💻C内存管理方式 👉new/delete操作内置类型 👉new和delete操作自定义类型 …...
大数据平台/大数据技术与原理-实验报告--部署全分布模式Hadoop集群
实验名称 部署全分布模式Hadoop集群 实验性质 (必修、选修) 必修 实验类型(验证、设计、创新、综合) 综合 实验课时 2 实验日期 2023.10.16-2023.10.20 实验仪器设备以及实验软硬件要求 专业实验室(配有cen…...
Android Gradle 升级到7.x及Maven推送问题
7.0以下的Android插件工程使用Maven上传时脚本如下所示。 plugins {id com.android.libraryid kotlin-androidid maven }// 源代码一起打包 task androidSourcesJar(type: Jar) {archiveClassifier.set(sources)from android.sourceSets.main.java.sourceFiles }uploadArchive…...
【实战】K8S Helm部署Redis Cluster Redisinsight
文章目录 前言部署Redis Cluster安装Redis Insight写在最后 前言 在Web服务的开发过程中,Redis一直以来都有着举足轻重的作用。基本上所有的后端服务都会用这个中间件实现具体的业务场景,比如常作为系统缓存、分布式锁,也可以实现排名、定位…...
3.前端--HTML标签-文本图像链接【2023.11.25】
1.HTML常用标签(文本图像链接) 文本标签 标题 <h1> - <h6> 段落<p> 我是一个段落标签 </p> 换行 <br /> <!DOCTYPE html> <html lang"zh-CN"> <head><meta charset"UTF-8"><meta ht…...
ctfshow刷题web入门--1--ljcsd
文章目录 ctf.show。信息搜集web1web2web3web4web5web6web7web8web9web10web11web12web13web14web15web16web17web18web19web20。爆破。知识1.1 播种随机数生成器-mt_srand。参考web21--重点web22--做不出来web23web24web25web26web27web28。。。命令执行。知识1 绕过正则表达式…...
乘法原理 LeetCode 828. 统计子串中的唯一字符
我们定义了一个函数 countUniqueChars(s) 来统计字符串 s 中的唯一字符,并返回唯一字符的个数。 例如:s "LEETCODE" ,则其中 "L", "T","C","O","D" 都是唯一字符,…...
python桌面开发PyQt6库和工具库QTDesigner安装和配置
一、安装PyQt6 二、安装pyqt6-tools 三、安装外部工具 四、创建QTDesigner 1.首先查找designer.exe的路径(可以自己在窗口中选择,也可以使用Everything搜索) 2.使用Everything搜索后会出现多个designer.exe,选中,OpenPath 3.选择…...
火柴棒等式
枚举 只要在保证等式正确的基础上判断火柴棒有没有用完就可以 因为数比较小,而且我不知道最大的等式中的数是多少,索性就设置为999了 还好对效率要求不大(doge) 要不然就得自己慢慢改最大数来试了 代码如下: #in…...
给定两个字符串 s 和 t ,找不同
题意: 给定两个字符串 s 和 t ,它们只包含小写字母。 字符串 t 由字符串 s 随机重排,然后在随机位置添加一个字母。 请找出在 t 中被添加的字母。 示例 1: 输入:s “abcd”, t “abcde” 输出:“e”…...
从权限跳转看Activity的data android:scheme
在应用申请悬浮窗权限的时候,可以跳转到相应的设置界面,并且自动切换到应用的条目,高亮显示一下, android悬浮窗权限怎么申请 在Android中,要申请悬浮窗权限,需要以下步骤: 在 AndroidManifes…...
C++ Qt QFile用法介绍与代码演示
作者:令狐掌门 技术交流QQ群:675120140 csdn博客:https://mingshiqiang.blog.csdn.net/ 文章目录 打开和关闭文件读取文件写入文件示例代码自定义格式文件解析在Qt 中 QFile 的类用于读写本地文件系统中的文件。它继承自 QIODevice,所以它包含了许多用于数据输入和输出的功…...
Redis面试题:Redis的数据过期策略有哪些?
目录 面试官:Redis的数据过期策略有哪些 ? 惰性删除 定期删除 面试官:Redis的数据过期策略有哪些 ? 候选人: 嗯~,在redis中提供了两种数据过期删除策略 第一种是惰性删除,在设置该key过期时间后,我们…...
1.2.1 C语言结构体初始化方法总结
文章目录 结构体定义通用定义注册事项结构体初始化方法一简述示例方法二简述示例方法三简述示例方法四简述示例方法五简述示例结构体定义 通用定义 常用的结构体定义,有2种形式, 一种是关键字struct 结构体形式,如下...
CentOS 7 安装 Weblogic 14 版本
安装JDK程序 注意:安装weblogic前,先安装JDK!(要求jdk(1.7以上)): 一、创建用户组weblogic及用户weblogic groupadd weblogic useradd -g weblogic weblogic二、将下载好的jdk及weblogic上传至/home/webl…...
ES之x-pack-core-7.14.2许可证修改为白金版
X-Pack是什么 X-pack是elasticsearch的一个扩展包,将安全,警告,监视,图形和报告功能捆绑在一个易于安装的软件包中,虽然x-pack被设计为一个无缝的工作,但是你可以轻松的启用或者关闭一些功能。 主要分一下步…...
在Ubuntu18.04安装适合jdk8的eclipse
直接在Ubuntu软件那里下载的eclipse不能用,下载后启动会报错:Eclipse An error has occurred. See the log file/home/hadoop/.eclipse/ org.eclipse.platform_3.8_155965261/ configuration/1700567835954.log 上网搜索方法,按教程说的修改e…...
内存分配函数malloc kmalloc vmalloc
内存分配函数malloc kmalloc vmalloc malloc实现步骤: 1)请求大小调整:首先,malloc 需要调整用户请求的大小,以适应内部数据结构(例如,可能需要存储额外的元数据)。通常,这包括对齐调整,确保分配的内存地址满足特定硬件要求(如对齐到8字节或16字节边界)。 2)空闲…...
最新SpringBoot+SpringCloud+Nacos微服务框架分享
文章目录 前言一、服务规划二、架构核心1.cloud的pom2.gateway的异常handler3.gateway的filter4、admin的pom5、admin的登录核心 三、code-helper分享总结 前言 最近有个活蛮赶的,根据Excel列的需求预估的工时直接打骨折,不要问我为什么,主要…...
土地利用/土地覆盖遥感解译与基于CLUE模型未来变化情景预测;从基础到高级,涵盖ArcGIS数据处理、ENVI遥感解译与CLUE模型情景模拟等
🔍 土地利用/土地覆盖数据是生态、环境和气象等诸多领域模型的关键输入参数。通过遥感影像解译技术,可以精准获取历史或当前任何一个区域的土地利用/土地覆盖情况。这些数据不仅能够用于评估区域生态环境的变化趋势,还能有效评价重大生态工程…...
Java线上CPU飙高问题排查全指南
一、引言 在Java应用的线上运行环境中,CPU飙高是一个常见且棘手的性能问题。当系统出现CPU飙高时,通常会导致应用响应缓慢,甚至服务不可用,严重影响用户体验和业务运行。因此,掌握一套科学有效的CPU飙高问题排查方法&…...
Spring是如何解决Bean的循环依赖:三级缓存机制
1、什么是 Bean 的循环依赖 在 Spring框架中,Bean 的循环依赖是指多个 Bean 之间互相持有对方引用,形成闭环依赖关系的现象。 多个 Bean 的依赖关系构成环形链路,例如: 双向依赖:Bean A 依赖 Bean B,同时 Bean B 也依赖 Bean A(A↔B)。链条循环: Bean A → Bean…...
AI病理诊断七剑下天山,医疗未来触手可及
一、病理诊断困局:刀尖上的医学艺术 1.1 金标准背后的隐痛 病理诊断被誉为"诊断的诊断",医生需通过显微镜观察组织切片,在细胞迷宫中捕捉癌变信号。某省病理质控报告显示,基层医院误诊率达12%-15%,专家会诊…...
yaml读取写入常见错误 (‘cannot represent an object‘, 117)
错误一:yaml.representer.RepresenterError: (‘cannot represent an object’, 117) 出现这个问题一直没找到原因,后面把yaml.safe_dump直接替换成yaml.dump,确实能保存,但出现乱码: 放弃yaml.dump,又切…...
门静脉高压——表现
一、门静脉高压表现 00:01 1. 门静脉构成 00:13 组成结构:由肠系膜上静脉和脾静脉汇合构成,是肝脏血液供应的主要来源。淤血后果:门静脉淤血会同时导致脾静脉和肠系膜上静脉淤血,引发后续系列症状。 2. 脾大和脾功能亢进 00:46 …...
MeshGPT 笔记
[2311.15475] MeshGPT: Generating Triangle Meshes with Decoder-Only Transformers https://library.scholarcy.com/try 真正意义上的AI生成三维模型MESHGPT来袭!_哔哩哔哩_bilibili GitHub - lucidrains/meshgpt-pytorch: Implementation of MeshGPT, SOTA Me…...
SQL注入篇-sqlmap的配置和使用
在之前的皮卡丘靶场第五期SQL注入的内容中我们谈到了sqlmap,但是由于很多朋友看不了解命令行格式,所以是纯手动获取数据库信息的 接下来我们就用sqlmap来进行皮卡丘靶场的sql注入学习,链接:https://wwhc.lanzoue.com/ifJY32ybh6vc…...
