Go to the documentation of this file.
22 #include "config_components.h"
49 ext = strrchr(filename,
'.');
68 for (ext = uc.
query; *ext !=
'.' && ext > uc.
path; ext--)
73 if (uc.
query - ext >
sizeof(scratchpad))
81 const char *mime_type)
89 #if CONFIG_IMAGE2_MUXER
90 if (!short_name && filename &&
108 if (score > score_max) {
117 const char *filename,
const char *mime_type,
129 #if CONFIG_IMAGE2_MUXER || CONFIG_IMAGE2PIPE_MUXER
130 if (!strcmp(fmt->
name,
"image2") || !strcmp(fmt->
name,
"image2pipe")) {
156 int is_opened,
int *score_ret)
161 int score, score_max = 0;
166 ID3_ALMOST_GREATER_PROBE,
168 ID3_GREATER_MAX_PROBE,
172 lpd.
buf = (
unsigned char *) zerobuffer;
178 nodat = ID3_ALMOST_GREATER_PROBE;
182 nodat = ID3_GREATER_MAX_PROBE;
184 nodat = ID3_GREATER_PROBE;
200 score =
FFMAX(score, 1);
202 case ID3_GREATER_PROBE:
203 case ID3_ALMOST_GREATER_PROBE:
206 case ID3_GREATER_MAX_PROBE:
221 if (score > score_max) {
224 }
else if (score == score_max)
227 if (nodat == ID3_GREATER_PROBE)
229 *score_ret = score_max;
235 int is_opened,
int *score_max)
239 if (score_ret > *score_max) {
240 *score_max = score_ret;
253 const char *filename,
void *logctx,
254 unsigned int offset,
unsigned int max_probe_size)
258 int ret = 0, probe_size, buf_offset = 0;
267 "Specified probe size value %u cannot be < %u\n", max_probe_size,
PROBE_BUF_MIN);
271 if (
offset >= max_probe_size)
275 uint8_t *mime_type_opt =
NULL;
278 pd.
mime_type = (
const char *)mime_type_opt;
285 for (probe_size =
PROBE_BUF_MIN; probe_size <= max_probe_size && !*fmt && !eof;
286 probe_size =
FFMIN(probe_size << 1,
287 FFMAX(max_probe_size, probe_size + 1))) {
294 probe_size - buf_offset)) < 0) {
317 "Format %s detected only with low score of %d, "
318 "misdetection possible!\n", (*fmt)->name, score);
321 "Format %s probed with size=%d and score=%d\n",
322 (*fmt)->name, probe_size, score);
324 FILE *
f = fopen(
"probestat.tmp",
"ab");
325 fprintf(
f,
"probe_size:%d format:%s score:%d filename:%s\n", probe_size, (*fmt)->name, score, filename);
341 return ret < 0 ?
ret : score;
345 const char *filename,
void *logctx,
346 unsigned int offset,
unsigned int max_probe_size)
#define AV_OPT_SEARCH_CHILDREN
Search in possible children of the given object first.
#define AV_LOG_WARNING
Something somehow does not look correct.
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
int av_probe_input_buffer2(AVIOContext *pb, const AVInputFormat **fmt, const char *filename, void *logctx, unsigned int offset, unsigned int max_probe_size)
Probe a bytestream to determine the input format.
#define AVERROR_EOF
End of file.
enum AVCodecID ff_guess_image2_codec(const char *filename)
int buf_size
Size of buf except extra allocated bytes.
#define URL_COMPONENT_HAVE(uc, component)
int av_filename_number_test(const char *filename)
Check whether filename actually is a numbered sequence generator.
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
const AVInputFormat * av_probe_input_format3(const AVProbeData *pd, int is_opened, int *score_ret)
Guess the file format.
#define AV_LOG_TRACE
Extremely verbose debugging, useful for libav* development.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
const char * mime_type
mime_type, when known.
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
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.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
const char * query
including initial '?' if present
const AVInputFormat * av_probe_input_format2(const AVProbeData *pd, int is_opened, int *score_max)
Guess the file format.
const AVInputFormat * av_probe_input_format(const AVProbeData *pd, int is_opened)
Guess the file format.
This structure contains the data a format has to probe a file.
AVCodecID
Identify the syntax and semantics of the bitstream.
#define ID3v2_DEFAULT_MAGIC
Default magic bytes for ID3v2 header: "ID3".
int av_reallocp(void *ptr, size_t size)
Allocate, reallocate, or free a block of memory through a pointer to a pointer.
const AVInputFormat * av_demuxer_iterate(void **opaque)
Iterate over all registered demuxers.
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf offset
int av_probe_input_buffer(AVIOContext *pb, const AVInputFormat **fmt, const char *filename, void *logctx, unsigned int offset, unsigned int max_probe_size)
Like av_probe_input_buffer2() but returns 0 on success.
#define i(width, name, range_min, range_max)
int ff_id3v2_tag_len(const uint8_t *buf)
Get the length of an ID3v2 tag.
enum AVCodecID av_guess_codec(const AVOutputFormat *fmt, const char *short_name, const char *filename, const char *mime_type, enum AVMediaType type)
Guess the codec ID based upon muxer and filename.
const AVOutputFormat * av_muxer_iterate(void **opaque)
Iterate over all registered muxers.
static const FFInputFormat * ffifmt(const AVInputFormat *fmt)
int av_match_name(const char *name, const char *names)
Match instances of a name in a comma-separated list of names.
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
const AVInputFormat * av_find_input_format(const char *short_name)
Find AVInputFormat based on the short name of the input format.
static int read_probe(const AVProbeData *p)
const AVOutputFormat * av_guess_format(const char *short_name, const char *filename, const char *mime_type)
Return the output format in the list of registered output formats which best matches the provided par...
int ffio_rewind_with_probe_data(AVIOContext *s, unsigned char **buf, int buf_size)
Rewind the AVIOContext using the specified buffer containing the first buf_size bytes of the file.
size_t av_strlcpy(char *dst, const char *src, size_t size)
Copy the string src to dst, but no more than size - 1 bytes, and null-terminate dst.
int av_opt_get(void *obj, const char *name, int search_flags, uint8_t **out_val)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
int ff_url_decompose(URLComponents *uc, const char *url, const char *end)
Parse an URL to find the components.
int ff_id3v2_match(const uint8_t *buf, const char *magic)
Detect ID3v2 Header.
const AVClass * av_class
A class for private options.