与muxing和demuxing有关的杂项效用函数(或两者)。
一、模块
一)、描述
获取将RIFF FourCCs映射到libavcodec AVCodecID的表。
这些表旨在传递给av_codec_get_id()/ av_codec_get_tag(),如下面的代码所示:
uint32_t tag = MKTAG('H', '2', '6', '4');
const struct AVCodecTag *table[] = { avformat_get_riff_video_tags(), 0 };
enum AVCodecID id = av_codec_get_id(table, tag);
二)、函数
const struct AVCodecTag * | avformat_get_riff_video_tags (void) |
const struct AVCodecTag * | avformat_get_riff_audio_tags (void) |
const struct AVCodecTag * | avformat_get_mov_video_tags (void) |
const struct AVCodecTag * | avformat_get_mov_audio_tags (void) |
二、宏
#define | AV_FRAME_FILENAME_FLAGS_MULTIPLE 1 |
三、枚举
enum | AVTimebaseSource { AVFMT_TBCF_AUTO = -1, AVFMT_TBCF_DECODER, AVFMT_TBCF_DEMUXER } |
四、函数
void | av_hex_dump (FILE *f, const uint8_t *buf, int size) |
参数:f:转储应发送到的文件流指针。
buf:缓冲
size:缓冲大小
void | av_hex_dump_log (void *avcl, int level, const uint8_t *buf, int size) |
参数:avcl:指向任意结构的指针,第一个字段是指向AVClass结构体的指针。
level:消息的重要性水平,较低的值表示较高的重要性。
buf:缓冲
size:缓冲大小
void | av_pkt_dump2 (FILE *f, const AVPacket *pkt, int dump_payload, const AVStream *st) |
参数:f:转储应发送到的文件流指针。
pkt:数据包转储
dump_payload:如果有效载荷也必须显示,则为真。
st:数据包所属的AVStream
void | av_pkt_dump_log2 (void *avcl, int level, const AVPacket *pkt, int dump_payload, const AVStream *st) |
参数:avcl:指向任意结构的指针,第一个字段是指向AVClass结构体的指针。
level:消息的重要性水平,较低的值表示较高的重要性。
pkt:转储的数据包
dump_payload:如果有效载荷也必须显示,则为真。
st:数据包所属的AVStream
enum AVCodecID | av_codec_get_id (const struct AVCodecTag *const *tags, unsigned int tag) |
如果没有找到编解码器ID返回AV_CODEC_ID_NONE。
参数:tags:支持的codec_id-codec_tag对的列表,存储在AVInputFormat.codec_tag和AVOutputFormat.codec_tag中
tag:编解码器标签与编解码器ID相匹配
unsigned int | av_codec_get_tag (const struct AVCodecTag *const *tags, enum AVCodecID id) |
如果没有找到编解码器标签返回0。
参数:tags:支持的codec_id-codec_tag对的列表,存储在AVInputFormat.codec_tag和AVOutputFormat.codec_tag中
id:编解码器ID与编解码器标签相匹配
int | av_codec_get_tag2 (const struct AVCodecTag *const *tags, enum AVCodecID id, unsigned int *tag) |
参数:tags:支持的codec_id - codec_tag对的列表,存储在AVInputFormat.codec_tag和AVOutputFormat.codec_tag中
id:应在列表中搜索的编解码器ID
tag:指向找到的标签的指针
返回:如果在标签中找不到ID,则为0,如果没有找到则为>0
int | av_find_default_stream_index (AVFormatContext *s) |
int | av_index_search_timestamp (AVStream *st, int64_t timestamp, int flags) |
参数:st:时间戳属于的流
timestamp:时间戳来检索索引
flags:如果AVSEEK_FLAG_BACKWARD,那么返回的索引将对应于<=所请求的索引的时间戳,如果向后是0,那么如果AVSEEK_FLAG_ANY寻求任何帧,则为> =否则只有关键帧
返回:<0如果没有找到这样的时间戳
int | av_add_index_entry (AVStream *st, int64_t pos, int64_t timestamp, int size, int distance, int flags) |
如果列表已经包含它,请更新该条目。
参数:timestamp:时间戳在给定流的时基
void | av_url_split (char *proto, int proto_size, char *authorization, int authorization_size, char *hostname, int hostname_size, int *port_ptr, char *path, int path_size, const char *url) |
用于存储单个组件的缓冲区的指针可以为空,以便忽略该组件。 未找到组件的缓冲区设置为空字符串。 如果未找到端口,则将其设置为负值。
参数:proto:协议的缓冲区
proto_size:原始缓冲区的大小
authorization:用于授权的缓冲区
authorization_size:授权缓冲区的大小
hostname:主机名的缓冲区
hostname_size:主机名的缓冲区大小
port_ptr:一个用于存储端口号的指针
path:路径的缓冲区
path_size:路径的缓冲区的大小
url:要拆分的URL
void | av_dump_format (AVFormatContext *ic, int index, const char *url, int is_output) |
参数:ic:用于分析的上下文
index:要转储信息的流的索引
url:要打印的URL,例如源文件或目标文件
is_output:选择指定的上下文是输入(0)还是输出(1)
int | av_get_frame_filename2 (char *buf, int buf_size, const char *path, int number, int flags) |
还处理'%0nd'格式,其中'n'是总位数和'%'。
参数:buf:目的缓冲区
buf_size:目的缓冲区的大小
path:编号序列字符串
number:帧号
flags:AV_FRAME_FILENAME_FLAGS_*
返回:如果OK,则为0,格式错误为-1
int | av_get_frame_filename (char *buf, int buf_size, const char *path, int number) |
int | av_filename_number_test (const char *filename) |
参数:filename:可能编号的序列字符串
返回:1如果有效的编号序列字符串,否则为0
int | av_sdp_create (AVFormatContext *ac[], int n_files, char *buf, int size) |
注意,这将覆盖muxer上下文中的AVStreams的id值,以获取唯一的动态有效负载类型。
参数:ac:描述RTP流的AVFormatContexts数组。 如果阵列仅由一个上下文组成,则这样的上下文可以包含多个AVStream(每个RTP流一个AVStream)。 否则,阵列中的所有上下文(每个RTP流的AVCodecContext)必须只包含一个AVStream。
n_files:AVCodecContexts的数量包含在ac中
buf:SDP将被存储的缓冲区(必须由主叫方分配)
size:缓冲区大小
返回:0如果OK,AVERROR_xxx出错
int | av_match_ext (const char *filename, const char *extensions) |
参数:filename:文件名来检查给定的扩展名
extensions:以逗号分隔的文件扩展名列表
int | avformat_query_codec (const AVOutputFormat *ofmt, enum AVCodecID codec_id, int std_compliance) |
参数:ofmt:容器检查兼容性
codec_id:可能存储在容器中的编解码器
std_compliance:标准合规级别,FF_COMPLIANCE_ *
返回:1如果具有ID codec_id的编解码器可以存储在ofmt中,如果不能存储,则为0。 如果此信息不可用,则为负数。
AVRational | av_guess_sample_aspect_ratio (AVFormatContext *format, AVStream *stream, AVFrame *frame) |
由于帧长宽比由编解码器设置,而是由解复用器设置流宽比,所以这两者可能不相等。 如果要显示框架,此函数将尝试返回您应该使用的值。
基本逻辑是使用流宽度比,如果它被设置为某种理由,否则使用帧长宽比。 这样通常容易修改的容器设置可以覆盖帧中的编码值。
参数:format:该流是其一部分的格式上下文
stream:帧是其中一部分的流
frame:要确定具有纵横比的框架
返回:猜到(有效)sample_aspect_ratio,0/1如果不知道
AVRational | av_guess_frame_rate (AVFormatContext *ctx, AVStream *stream, AVFrame *frame) |
参数:ctx:该流是其一部分的格式上下文
stream:帧是其中一部分的流
frame;应该确定帧速率的帧可以为NULL
返回:猜测(有效)帧率,0/1如果不知道
int | avformat_match_stream_specifier (AVFormatContext *s, AVStream *st, const char *spec) |
请参阅规范语法文档中的“流说明符”一章。
返回:> 0如果st匹配spec; 0如果st不符合规范; 如果spec无效,则为AVERROR代码
注意:流说明符可以匹配格式中的多个流。
int | avformat_queue_attached_pictures (AVFormatContext *s) |
int | avformat_transfer_internal_stream_timing_info (const AVOutputFormat *ofmt, AVStream *ost, const AVStream *ist, enum AVTimebaseSource copy_tb) |
执行流拷贝时,此函数很有用。
参数:ofmt:ost的目标输出格式
ost:输出流需要定时复制和调整
ist:参考输入流来复制定时
copy_tb:定义需要导入流编解码器时基的位置
AVRational | av_stream_get_codec_timebase (const AVStream *st) |
参数:st:输入流从中提取时基