FFmpeg 5.1.6
|
Miscellaneous utility functions related to both muxing and demuxing (or neither). More...
Modules | |
RIFF FourCCs | |
Get the tables mapping RIFF FourCCs to libavcodec AVCodecIDs. | |
Macros | |
#define | AV_FRAME_FILENAME_FLAGS_MULTIPLE 1 |
Allow multiple d. More... | |
Enumerations | |
enum | AVTimebaseSource { AVFMT_TBCF_AUTO = -1 , AVFMT_TBCF_DECODER , AVFMT_TBCF_DEMUXER , AVFMT_TBCF_R_FRAMERATE } |
Functions | |
void | av_hex_dump (FILE *f, const uint8_t *buf, int size) |
Send a nice hexadecimal dump of a buffer to the specified file stream. More... | |
void | av_hex_dump_log (void *avcl, int level, const uint8_t *buf, int size) |
Send a nice hexadecimal dump of a buffer to the log. More... | |
void | av_pkt_dump2 (FILE *f, const AVPacket *pkt, int dump_payload, const AVStream *st) |
Send a nice dump of a packet to the specified file stream. More... | |
void | av_pkt_dump_log2 (void *avcl, int level, const AVPacket *pkt, int dump_payload, const AVStream *st) |
Send a nice dump of a packet to the log. More... | |
enum AVCodecID | av_codec_get_id (const struct AVCodecTag *const *tags, unsigned int tag) |
Get the AVCodecID for the given codec tag tag. More... | |
unsigned int | av_codec_get_tag (const struct AVCodecTag *const *tags, enum AVCodecID id) |
Get the codec tag for the given codec id id. More... | |
int | av_codec_get_tag2 (const struct AVCodecTag *const *tags, enum AVCodecID id, unsigned int *tag) |
Get the codec tag for the given codec id. More... | |
int | av_find_default_stream_index (AVFormatContext *s) |
int | av_index_search_timestamp (AVStream *st, int64_t timestamp, int flags) |
Get the index for a specific timestamp. More... | |
int | avformat_index_get_entries_count (const AVStream *st) |
Get the index entry count for the given AVStream. More... | |
const AVIndexEntry * | avformat_index_get_entry (AVStream *st, int idx) |
Get the AVIndexEntry corresponding to the given index. More... | |
const AVIndexEntry * | avformat_index_get_entry_from_timestamp (AVStream *st, int64_t wanted_timestamp, int flags) |
Get the AVIndexEntry corresponding to the given timestamp. More... | |
int | av_add_index_entry (AVStream *st, int64_t pos, int64_t timestamp, int size, int distance, int flags) |
Add an index entry into a sorted list. More... | |
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) |
Split a URL string into components. More... | |
void | av_dump_format (AVFormatContext *ic, int index, const char *url, int is_output) |
Print detailed information about the input or output format, such as duration, bitrate, streams, container, programs, metadata, side data, codec and time base. More... | |
int | av_get_frame_filename2 (char *buf, int buf_size, const char *path, int number, int flags) |
Return in 'buf' the path with 'd' replaced by a number. More... | |
int | av_get_frame_filename (char *buf, int buf_size, const char *path, int number) |
int | av_filename_number_test (const char *filename) |
Check whether filename actually is a numbered sequence generator. More... | |
int | av_sdp_create (AVFormatContext *ac[], int n_files, char *buf, int size) |
Generate an SDP for an RTP session. More... | |
int | av_match_ext (const char *filename, const char *extensions) |
Return a positive value if the given filename has one of the given extensions, 0 otherwise. More... | |
int | avformat_query_codec (const AVOutputFormat *ofmt, enum AVCodecID codec_id, int std_compliance) |
Test if the given container can store a codec. More... | |
AVRational | av_guess_sample_aspect_ratio (AVFormatContext *format, AVStream *stream, AVFrame *frame) |
Guess the sample aspect ratio of a frame, based on both the stream and the frame aspect ratio. More... | |
AVRational | av_guess_frame_rate (AVFormatContext *ctx, AVStream *stream, AVFrame *frame) |
Guess the frame rate, based on both the container and codec information. More... | |
int | avformat_match_stream_specifier (AVFormatContext *s, AVStream *st, const char *spec) |
Check if the stream st contained in s is matched by the stream specifier spec. More... | |
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) |
Transfer internal timing information from one stream to another. More... | |
AVRational | av_stream_get_codec_timebase (const AVStream *st) |
Get the internal codec timebase from a stream. More... | |
Miscellaneous utility functions related to both muxing and demuxing (or neither).
#define AV_FRAME_FILENAME_FLAGS_MULTIPLE 1 |
Allow multiple d.
Definition at line 2721 of file avformat.h.
enum AVTimebaseSource |
Enumerator | |
---|---|
AVFMT_TBCF_AUTO | |
AVFMT_TBCF_DECODER | |
AVFMT_TBCF_DEMUXER | |
AVFMT_TBCF_R_FRAMERATE |
Definition at line 2871 of file avformat.h.
void av_hex_dump | ( | FILE * | f, |
const uint8_t * | buf, | ||
int | size | ||
) |
Send a nice hexadecimal dump of a buffer to the specified file stream.
f | The file stream pointer where the dump should be sent to. |
buf | buffer |
size | buffer size |
void av_hex_dump_log | ( | void * | avcl, |
int | level, | ||
const uint8_t * | buf, | ||
int | size | ||
) |
Send a nice hexadecimal dump of a buffer to the log.
avcl | A pointer to an arbitrary struct of which the first field is a pointer to an AVClass struct. |
level | The importance level of the message, lower values signifying higher importance. |
buf | buffer |
size | buffer size |
Send a nice dump of a packet to the specified file stream.
f | The file stream pointer where the dump should be sent to. |
pkt | packet to dump |
dump_payload | True if the payload must be displayed, too. |
st | AVStream that the packet belongs to |
void av_pkt_dump_log2 | ( | void * | avcl, |
int | level, | ||
const AVPacket * | pkt, | ||
int | dump_payload, | ||
const AVStream * | st | ||
) |
Send a nice dump of a packet to the log.
avcl | A pointer to an arbitrary struct of which the first field is a pointer to an AVClass struct. |
level | The importance level of the message, lower values signifying higher importance. |
pkt | packet to dump |
dump_payload | True if the payload must be displayed, too. |
st | AVStream that the packet belongs to |
enum AVCodecID av_codec_get_id | ( | const struct AVCodecTag *const * | tags, |
unsigned int | tag | ||
) |
Get the AVCodecID for the given codec tag tag.
If no codec id is found returns AV_CODEC_ID_NONE.
tags | list of supported codec_id-codec_tag pairs, as stored in AVInputFormat.codec_tag and AVOutputFormat.codec_tag |
tag | codec tag to match to a codec ID |
unsigned int av_codec_get_tag | ( | const struct AVCodecTag *const * | tags, |
enum AVCodecID | id | ||
) |
Get the codec tag for the given codec id id.
If no codec tag is found returns 0.
tags | list of supported codec_id-codec_tag pairs, as stored in AVInputFormat.codec_tag and AVOutputFormat.codec_tag |
id | codec ID to match to a codec tag |
int av_codec_get_tag2 | ( | const struct AVCodecTag *const * | tags, |
enum AVCodecID | id, | ||
unsigned int * | tag | ||
) |
Get the codec tag for the given codec id.
tags | list of supported codec_id - codec_tag pairs, as stored in AVInputFormat.codec_tag and AVOutputFormat.codec_tag |
id | codec id that should be searched for in the list |
tag | A pointer to the found tag |
int av_find_default_stream_index | ( | AVFormatContext * | s | ) |
int av_index_search_timestamp | ( | AVStream * | st, |
int64_t | timestamp, | ||
int | flags | ||
) |
Get the index for a specific timestamp.
st | stream that the timestamp belongs to |
timestamp | timestamp to retrieve the index for |
flags | if 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 |
int avformat_index_get_entries_count | ( | const AVStream * | st | ) |
Get the index entry count for the given AVStream.
st | stream |
const AVIndexEntry * avformat_index_get_entry | ( | AVStream * | st, |
int | idx | ||
) |
Get the AVIndexEntry corresponding to the given index.
st | Stream containing the requested AVIndexEntry. |
idx | The desired index. |
const AVIndexEntry * avformat_index_get_entry_from_timestamp | ( | AVStream * | st, |
int64_t | wanted_timestamp, | ||
int | flags | ||
) |
Get the AVIndexEntry corresponding to the given timestamp.
st | Stream containing the requested AVIndexEntry. |
timestamp | Timestamp to retrieve the index entry for. |
flags | If AVSEEK_FLAG_BACKWARD then the returned entry 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. |
int av_add_index_entry | ( | AVStream * | st, |
int64_t | pos, | ||
int64_t | timestamp, | ||
int | size, | ||
int | distance, | ||
int | flags | ||
) |
Add an index entry into a sorted list.
Update the entry if the list already contains it.
timestamp | timestamp in the time base of the given stream |
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 | ||
) |
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.
proto | the buffer for the protocol |
proto_size | the size of the proto buffer |
authorization | the buffer for the authorization |
authorization_size | the size of the authorization buffer |
hostname | the buffer for the host name |
hostname_size | the size of the hostname buffer |
port_ptr | a pointer to store the port number in |
path | the buffer for the path |
path_size | the size of the path buffer |
url | the URL to split |
void av_dump_format | ( | AVFormatContext * | ic, |
int | index, | ||
const char * | url, | ||
int | is_output | ||
) |
Print detailed information about the input or output format, such as duration, bitrate, streams, container, programs, metadata, side data, codec and time base.
ic | the context to analyze |
index | index of the stream to dump information about |
url | the URL to print, such as source or destination file |
is_output | Select whether the specified context is an input(0) or output(1) |
Referenced by main(), open_input_file(), and open_output_file().
int av_get_frame_filename2 | ( | char * | buf, |
int | buf_size, | ||
const char * | path, | ||
int | number, | ||
int | flags | ||
) |
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 '%'.
buf | destination buffer |
buf_size | destination buffer size |
path | numbered sequence string |
number | frame number |
flags | AV_FRAME_FILENAME_FLAGS_* |
int av_get_frame_filename | ( | char * | buf, |
int | buf_size, | ||
const char * | path, | ||
int | number | ||
) |
int av_filename_number_test | ( | const char * | filename | ) |
Check whether filename actually is a numbered sequence generator.
filename | possible numbered sequence string |
int av_sdp_create | ( | AVFormatContext * | ac[], |
int | n_files, | ||
char * | buf, | ||
int | size | ||
) |
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.
ac | array 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_files | number of AVCodecContexts contained in ac |
buf | buffer where the SDP will be stored (must be allocated by the caller) |
size | the size of the buffer |
int av_match_ext | ( | const char * | filename, |
const char * | extensions | ||
) |
Return a positive value if the given filename has one of the given extensions, 0 otherwise.
filename | file name to check against the given extensions |
extensions | a comma-separated list of filename extensions |
int avformat_query_codec | ( | const AVOutputFormat * | ofmt, |
enum AVCodecID | codec_id, | ||
int | std_compliance | ||
) |
Test if the given container can store a codec.
ofmt | container to check for compatibility |
codec_id | codec to potentially store in container |
std_compliance | standards compliance level, one of FF_COMPLIANCE_* |
AVRational av_guess_sample_aspect_ratio | ( | AVFormatContext * | format, |
AVStream * | stream, | ||
AVFrame * | frame | ||
) |
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.
format | the format context which the stream is part of |
stream | the stream which the frame is part of |
frame | the frame with the aspect ratio to be determined |
AVRational av_guess_frame_rate | ( | AVFormatContext * | ctx, |
AVStream * | stream, | ||
AVFrame * | frame | ||
) |
Guess the frame rate, based on both the container and codec information.
ctx | the format context which the stream is part of |
stream | the stream which the frame is part of |
frame | the frame for which the frame rate should be determined, may be NULL |
Referenced by open_input_file().
int avformat_match_stream_specifier | ( | AVFormatContext * | s, |
AVStream * | st, | ||
const char * | spec | ||
) |
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.
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 | ||
) |
Transfer internal timing information from one stream to another.
This function is useful when doing stream copy.
ofmt | target output format for ost |
ost | output stream which needs timings copy and adjustments |
ist | reference input stream to copy timings from |
copy_tb | define from where the stream codec timebase needs to be imported |
AVRational av_stream_get_codec_timebase | ( | const AVStream * | st | ) |
Get the internal codec timebase from a stream.
st | input stream to extract the timebase from |