World of Might and Magic  0.2.0
Open reimplementation of Might and Magic 6 7 8 game engine
Utility functions
+ Граф связей класса Utility functions:

Группы

 RIFF FourCCs
 Get the tables mapping RIFF FourCCs to libavcodec AVCodecIDs. The tables are meant to be passed to av_codec_get_id()/av_codec_get_tag() as in the following code:
 

Перечисления

enum  AVTimebaseSource { AVFMT_TBCF_AUTO = -1, AVFMT_TBCF_DECODER, AVFMT_TBCF_DEMUXER, AVFMT_TBCF_R_FRAMERATE }
 

Функции

void av_hex_dump (FILE *f, const uint8_t *buf, int size)
 
void av_hex_dump_log (void *avcl, int level, const uint8_t *buf, int size)
 
void av_pkt_dump2 (FILE *f, const AVPacket *pkt, int dump_payload, const AVStream *st)
 
void av_pkt_dump_log2 (void *avcl, int level, const AVPacket *pkt, int dump_payload, const AVStream *st)
 
enum AVCodecID av_codec_get_id (const struct AVCodecTag *const *tags, unsigned int tag)
 
unsigned int av_codec_get_tag (const struct AVCodecTag *const *tags, enum AVCodecID id)
 
int av_codec_get_tag2 (const struct AVCodecTag *const *tags, enum AVCodecID id, unsigned int *tag)
 
int av_find_default_stream_index (AVFormatContext *s)
 
int av_index_search_timestamp (AVStream *st, int64_t timestamp, int flags)
 
int av_add_index_entry (AVStream *st, int64_t pos, int64_t timestamp, int size, int distance, int flags)
 
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)
 
void av_dump_format (AVFormatContext *ic, int index, const char *url, int is_output)
 
int av_get_frame_filename2 (char *buf, int buf_size, const char *path, int number, int flags)
 
int av_get_frame_filename (char *buf, int buf_size, const char *path, int number)
 
int av_filename_number_test (const char *filename)
 
int av_sdp_create (AVFormatContext *ac[], int n_files, char *buf, int size)
 
int av_match_ext (const char *filename, const char *extensions)
 
int avformat_query_codec (const AVOutputFormat *ofmt, enum AVCodecID codec_id, int std_compliance)
 
AVRational av_guess_sample_aspect_ratio (AVFormatContext *format, AVStream *stream, AVFrame *frame)
 
AVRational av_guess_frame_rate (AVFormatContext *ctx, AVStream *stream, AVFrame *frame)
 
int avformat_match_stream_specifier (AVFormatContext *s, AVStream *st, const char *spec)
 
int avformat_queue_attached_pictures (AVFormatContext *s)
 
attribute_deprecated int av_apply_bitstream_filters (AVCodecContext *codec, AVPacket *pkt, AVBitStreamFilterContext *bsfc)
 
int avformat_transfer_internal_stream_timing_info (const AVOutputFormat *ofmt, AVStream *ost, const AVStream *ist, enum AVTimebaseSource copy_tb)
 
AVRational av_stream_get_codec_timebase (const AVStream *st)
 

Подробное описание

Miscellaneous utility functions related to both muxing and demuxing (or neither).

Перечисления

◆ AVTimebaseSource

#include <C:/git/world-of-might-and-magic/lib/win32/x86/ffmpeg-4.2.2/include/libavformat/avformat.h>

Элементы перечислений
AVFMT_TBCF_AUTO 
AVFMT_TBCF_DECODER 
AVFMT_TBCF_DEMUXER 
AVFMT_TBCF_R_FRAMERATE 

См. определение в файле avformat.h строка 3058

3058  {
3059  AVFMT_TBCF_AUTO = -1,
3062 #if FF_API_R_FRAME_RATE
3064 #endif
3065 };

Функции

◆ av_hex_dump()

void av_hex_dump ( FILE *  f,
const uint8_t buf,
int  size 
)

#include <C:/git/world-of-might-and-magic/lib/win32/x86/ffmpeg-4.2.2/include/libavformat/avformat.h>

Send a nice hexadecimal dump of a buffer to the specified file stream.

Аргументы
fThe file stream pointer where the dump should be sent to.
bufbuffer
sizebuffer size
См. также
av_hex_dump_log, av_pkt_dump2, av_pkt_dump_log2

◆ av_hex_dump_log()

void av_hex_dump_log ( void avcl,
int  level,
const uint8_t buf,
int  size 
)

#include <C:/git/world-of-might-and-magic/lib/win32/x86/ffmpeg-4.2.2/include/libavformat/avformat.h>

Send a nice hexadecimal dump of a buffer to the log.

Аргументы
avclA pointer to an arbitrary struct of which the first field is a pointer to an AVClass struct.
levelThe importance level of the message, lower values signifying higher importance.
bufbuffer
sizebuffer size
См. также
av_hex_dump, av_pkt_dump2, av_pkt_dump_log2

◆ av_pkt_dump2()

void av_pkt_dump2 ( FILE *  f,
const AVPacket pkt,
int  dump_payload,
const AVStream st 
)

#include <C:/git/world-of-might-and-magic/lib/win32/x86/ffmpeg-4.2.2/include/libavformat/avformat.h>

Send a nice dump of a packet to the specified file stream.

Аргументы
fThe file stream pointer where the dump should be sent to.
pktpacket to dump
dump_payloadTrue if the payload must be displayed, too.
stAVStream that the packet belongs to

◆ av_pkt_dump_log2()

void av_pkt_dump_log2 ( void avcl,
int  level,
const AVPacket pkt,
int  dump_payload,
const AVStream st 
)

#include <C:/git/world-of-might-and-magic/lib/win32/x86/ffmpeg-4.2.2/include/libavformat/avformat.h>

Send a nice dump of a packet to the log.

Аргументы
avclA pointer to an arbitrary struct of which the first field is a pointer to an AVClass struct.
levelThe importance level of the message, lower values signifying higher importance.
pktpacket to dump
dump_payloadTrue if the payload must be displayed, too.
stAVStream that the packet belongs to

◆ av_codec_get_id()

enum AVCodecID av_codec_get_id ( const struct AVCodecTag *const *  tags,
unsigned int  tag 
)

#include <C:/git/world-of-might-and-magic/lib/win32/x86/ffmpeg-4.2.2/include/libavformat/avformat.h>

Get the AVCodecID for the given codec tag tag. If no codec id is found returns AV_CODEC_ID_NONE.

Аргументы
tagslist of supported codec_id-codec_tag pairs, as stored in AVInputFormat.codec_tag and AVOutputFormat.codec_tag
tagcodec tag to match to a codec ID

◆ av_codec_get_tag()

unsigned int av_codec_get_tag ( const struct AVCodecTag *const *  tags,
enum AVCodecID  id 
)

#include <C:/git/world-of-might-and-magic/lib/win32/x86/ffmpeg-4.2.2/include/libavformat/avformat.h>

Get the codec tag for the given codec id id. If no codec tag is found returns 0.

Аргументы
tagslist of supported codec_id-codec_tag pairs, as stored in AVInputFormat.codec_tag and AVOutputFormat.codec_tag
idcodec ID to match to a codec tag

◆ av_codec_get_tag2()

int av_codec_get_tag2 ( const struct AVCodecTag *const *  tags,
enum AVCodecID  id,
unsigned int *  tag 
)

#include <C:/git/world-of-might-and-magic/lib/win32/x86/ffmpeg-4.2.2/include/libavformat/avformat.h>

Get the codec tag for the given codec id.

Аргументы
tagslist of supported codec_id - codec_tag pairs, as stored in AVInputFormat.codec_tag and AVOutputFormat.codec_tag
idcodec id that should be searched for in the list
tagA pointer to the found tag
Возвращает
0 if id was not found in tags, > 0 if it was found

◆ av_find_default_stream_index()

◆ av_index_search_timestamp()

int av_index_search_timestamp ( AVStream st,
int64_t  timestamp,
int  flags 
)

#include <C:/git/world-of-might-and-magic/lib/win32/x86/ffmpeg-4.2.2/include/libavformat/avformat.h>

Get the index for a specific timestamp.

Аргументы
ststream that the timestamp belongs to
timestamptimestamp to retrieve the index for
flagsif AVSEEK_FLAG_BACKWARD then the returned index will correspond to the timestamp which is <= the requested one, if backward is 0, then it will be >= if AVSEEK_FLAG_ANY seek to any frame, only keyframes otherwise
Возвращает
< 0 if no such timestamp could be found

◆ av_add_index_entry()

int av_add_index_entry ( AVStream st,
int64_t  pos,
int64_t  timestamp,
int  size,
int  distance,
int  flags 
)

#include <C:/git/world-of-might-and-magic/lib/win32/x86/ffmpeg-4.2.2/include/libavformat/avformat.h>

Add an index entry into a sorted list. Update the entry if the list already contains it.

Аргументы
timestamptimestamp in the time base of the given stream

◆ av_url_split()

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 
)

#include <C:/git/world-of-might-and-magic/lib/win32/x86/ffmpeg-4.2.2/include/libavformat/avformat.h>

Split a URL string into components.

The pointers to buffers for storing individual components may be null, in order to ignore that component. Buffers for components not found are set to empty strings. If the port is not found, it is set to a negative value.

Аргументы
protothe buffer for the protocol
proto_sizethe size of the proto buffer
authorizationthe buffer for the authorization
authorization_sizethe size of the authorization buffer
hostnamethe buffer for the host name
hostname_sizethe size of the hostname buffer
port_ptra pointer to store the port number in
paththe buffer for the path
path_sizethe size of the path buffer
urlthe URL to split

◆ av_dump_format()

void av_dump_format ( AVFormatContext ic,
int  index,
const char *  url,
int  is_output 
)

#include <C:/git/world-of-might-and-magic/lib/win32/x86/ffmpeg-4.2.2/include/libavformat/avformat.h>

Print detailed information about the input or output format, such as duration, bitrate, streams, container, programs, metadata, side data, codec and time base.

Аргументы
icthe context to analyze
indexindex of the stream to dump information about
urlthe URL to print, such as source or destination file
is_outputSelect whether the specified context is an input(0) or output(1)

Используется в Movie::Load(), AudioFileDataSource::Open() и AudioBufferDataSource::Open().

+ Граф вызова функции:

◆ av_get_frame_filename2()

int av_get_frame_filename2 ( char *  buf,
int  buf_size,
const char *  path,
int  number,
int  flags 
)

#include <C:/git/world-of-might-and-magic/lib/win32/x86/ffmpeg-4.2.2/include/libavformat/avformat.h>

Return in 'buf' the path with 'd' replaced by a number.

Also handles the '%0nd' format where 'n' is the total number of digits and '%'.

Аргументы
bufdestination buffer
buf_sizedestination buffer size
pathnumbered sequence string
numberframe number
flagsAV_FRAME_FILENAME_FLAGS_*
Возвращает
0 if OK, -1 on format error

◆ av_get_frame_filename()

int av_get_frame_filename ( char *  buf,
int  buf_size,
const char *  path,
int  number 
)

◆ av_filename_number_test()

int av_filename_number_test ( const char *  filename)

#include <C:/git/world-of-might-and-magic/lib/win32/x86/ffmpeg-4.2.2/include/libavformat/avformat.h>

Check whether filename actually is a numbered sequence generator.

Аргументы
filenamepossible numbered sequence string
Возвращает
1 if a valid numbered sequence string, 0 otherwise

◆ av_sdp_create()

int av_sdp_create ( AVFormatContext ac[],
int  n_files,
char *  buf,
int  size 
)

#include <C:/git/world-of-might-and-magic/lib/win32/x86/ffmpeg-4.2.2/include/libavformat/avformat.h>

Generate an SDP for an RTP session.

Note, this overwrites the id values of AVStreams in the muxer contexts for getting unique dynamic payload types.

Аргументы
acarray of AVFormatContexts describing the RTP streams. If the array is composed by only one context, such context can contain multiple AVStreams (one AVStream per RTP stream). Otherwise, all the contexts in the array (an AVCodecContext per RTP stream) must contain only one AVStream.
n_filesnumber of AVCodecContexts contained in ac
bufbuffer where the SDP will be stored (must be allocated by the caller)
sizethe size of the buffer
Возвращает
0 if OK, AVERROR_xxx on error

◆ av_match_ext()

int av_match_ext ( const char *  filename,
const char *  extensions 
)

#include <C:/git/world-of-might-and-magic/lib/win32/x86/ffmpeg-4.2.2/include/libavformat/avformat.h>

Return a positive value if the given filename has one of the given extensions, 0 otherwise.

Аргументы
filenamefile name to check against the given extensions
extensionsa comma-separated list of filename extensions

◆ avformat_query_codec()

int avformat_query_codec ( const AVOutputFormat ofmt,
enum AVCodecID  codec_id,
int  std_compliance 
)

#include <C:/git/world-of-might-and-magic/lib/win32/x86/ffmpeg-4.2.2/include/libavformat/avformat.h>

Test if the given container can store a codec.

Аргументы
ofmtcontainer to check for compatibility
codec_idcodec to potentially store in container
std_compliancestandards compliance level, one of FF_COMPLIANCE_*
Возвращает
1 if codec with ID codec_id can be stored in ofmt, 0 if it cannot. A negative number if this information is not available.

◆ av_guess_sample_aspect_ratio()

AVRational av_guess_sample_aspect_ratio ( AVFormatContext format,
AVStream stream,
AVFrame frame 
)

#include <C:/git/world-of-might-and-magic/lib/win32/x86/ffmpeg-4.2.2/include/libavformat/avformat.h>

Guess the sample aspect ratio of a frame, based on both the stream and the frame aspect ratio.

Since the frame aspect ratio is set by the codec but the stream aspect ratio is set by the demuxer, these two may not be equal. This function tries to return the value that you should use if you would like to display the frame.

Basic logic is to use the stream aspect ratio if it is set to something sane otherwise use the frame aspect ratio. This way a container setting, which is usually easy to modify can override the coded value in the frames.

Аргументы
formatthe format context which the stream is part of
streamthe stream which the frame is part of
framethe frame with the aspect ratio to be determined
Возвращает
the guessed (valid) sample_aspect_ratio, 0/1 if no idea

◆ av_guess_frame_rate()

AVRational av_guess_frame_rate ( AVFormatContext ctx,
AVStream stream,
AVFrame frame 
)

#include <C:/git/world-of-might-and-magic/lib/win32/x86/ffmpeg-4.2.2/include/libavformat/avformat.h>

Guess the frame rate, based on both the container and codec information.

Аргументы
ctxthe format context which the stream is part of
streamthe stream which the frame is part of
framethe frame for which the frame rate should be determined, may be NULL
Возвращает
the guessed (valid) frame rate, 0/1 if no idea

◆ avformat_match_stream_specifier()

int avformat_match_stream_specifier ( AVFormatContext s,
AVStream st,
const char *  spec 
)

#include <C:/git/world-of-might-and-magic/lib/win32/x86/ffmpeg-4.2.2/include/libavformat/avformat.h>

Check if the stream st contained in s is matched by the stream specifier spec.

See the "stream specifiers" chapter in the documentation for the syntax of spec.

Возвращает
>0 if st is matched by spec; 0 if st is not matched by spec; AVERROR code if spec is invalid
Заметки
A stream specifier can match several streams in the format.

◆ avformat_queue_attached_pictures()

◆ av_apply_bitstream_filters()

attribute_deprecated int av_apply_bitstream_filters ( AVCodecContext codec,
AVPacket pkt,
AVBitStreamFilterContext bsfc 
)

#include <C:/git/world-of-might-and-magic/lib/win32/x86/ffmpeg-4.2.2/include/libavformat/avformat.h>

Apply a list of bitstream filters to a packet.

Аргументы
codecAVCodecContext, usually from an AVStream
pktthe packet to apply filters to. If, on success, the returned packet has size == 0 and side_data_elems == 0, it indicates that the packet should be dropped
bsfca NULL-terminated list of filters to apply
Возвращает
>=0 on success; AVERROR code on failure

◆ avformat_transfer_internal_stream_timing_info()

int avformat_transfer_internal_stream_timing_info ( const AVOutputFormat ofmt,
AVStream ost,
const AVStream ist,
enum AVTimebaseSource  copy_tb 
)

#include <C:/git/world-of-might-and-magic/lib/win32/x86/ffmpeg-4.2.2/include/libavformat/avformat.h>

Transfer internal timing information from one stream to another.

This function is useful when doing stream copy.

Аргументы
ofmttarget output format for ost
ostoutput stream which needs timings copy and adjustments
istreference input stream to copy timings from
copy_tbdefine from where the stream codec timebase needs to be imported

◆ av_stream_get_codec_timebase()

AVRational av_stream_get_codec_timebase ( const AVStream st)

#include <C:/git/world-of-might-and-magic/lib/win32/x86/ffmpeg-4.2.2/include/libavformat/avformat.h>

Get the internal codec timebase from a stream.

Аргументы
stinput stream to extract the timebase from
AVFMT_TBCF_R_FRAMERATE
@ AVFMT_TBCF_R_FRAMERATE
Definition: avformat.h:3063
AVFMT_TBCF_DECODER
@ AVFMT_TBCF_DECODER
Definition: avformat.h:3060
AVFMT_TBCF_AUTO
@ AVFMT_TBCF_AUTO
Definition: avformat.h:3059
AVFMT_TBCF_DEMUXER
@ AVFMT_TBCF_DEMUXER
Definition: avformat.h:3061