68 last_iformat = &format->
next;
78 last_oformat = &format->
next;
88 ext = strrchr(filename,
'.');
95 const char *mime_type)
101 #if CONFIG_IMAGE2_MUXER
102 if (!short_name && filename &&
121 if (score > score_max) {
130 const char *filename,
const char *mime_type,
142 #if CONFIG_IMAGE2_MUXER
143 if (!strcmp(fmt->
name,
"image2") || !strcmp(fmt->
name,
"image2pipe")) {
174 int score, nodat = 0, score_max = 0;
178 lpd.
buf = zerobuffer;
201 if (nodat == 0) score =
FFMAX(score, 1);
211 if (score > score_max) {
214 }
else if (score == score_max)
219 *score_ret = score_max;
228 if (score_ret > *score_max) {
229 *score_max = score_ret;
242 const char *filename,
void *logctx,
243 unsigned int offset,
unsigned int max_probe_size)
247 int ret = 0, probe_size, buf_offset = 0;
255 "Specified probe size value %u cannot be < %u\n", max_probe_size,
PROBE_BUF_MIN);
259 if (offset >= max_probe_size)
265 pd.
mime_type = (
const char *)mime_type_opt;
277 probe_size =
FFMIN(probe_size << 1,
278 FFMAX(max_probe_size, probe_size + 1))) {
284 if ((ret =
avio_read(pb, buf + buf_offset,
285 probe_size - buf_offset)) < 0) {
294 if (buf_offset < offset)
307 "Format %s detected only with low score of %d, "
308 "misdetection possible!\n", (*fmt)->name, score);
311 "Format %s probed with size=%d and score=%d\n",
312 (*fmt)->name, probe_size, score);
314 FILE *f = fopen(
"probestat.tmp",
"ab");
315 fprintf(f,
"probe_size:%d format:%s score:%d filename:%s\n", probe_size, (*fmt)->name, score, filename);
331 return ret < 0 ? ret : score;
335 const char *filename,
void *logctx,
336 unsigned int offset,
unsigned int max_probe_size)
339 return ret < 0 ? ret : 0;
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AV_LOG_WARNING
Something somehow does not look correct.
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...
int av_probe_input_buffer2(AVIOContext *pb, AVInputFormat **fmt, const char *filename, void *logctx, unsigned int offset, unsigned int max_probe_size)
Probe a bytestream to determine the input format.
#define ID3v2_DEFAULT_MAGIC
Default magic bytes for ID3v2 header: "ID3".
AVInputFormat * av_probe_input_format3(AVProbeData *pd, int is_opened, int *score_ret)
Guess the file format.
Opaque data information usually continuous.
#define AV_LOG_TRACE
Extremely verbose debugging, useful for libav* development.
const AVClass * av_class
A class for private options.
int av_reallocp(void *ptr, size_t size)
Allocate or reallocate a block of memory.
#define AVERROR_EOF
End of file.
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.
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
AVCodecID
Identify the syntax and semantics of the bitstream.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define avpriv_atomic_ptr_cas
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
int av_match_name(const char *name, const char *names)
Match instances of a name in a comma-separated list of names.
static const uint8_t offset[127][2]
AVInputFormat * av_probe_input_format2(AVProbeData *pd, int is_opened, int *score_max)
Guess the file format.
const char * mime_type
mime_type, when known.
int buf_size
Size of buf except extra allocated bytes.
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
AVInputFormat * av_find_input_format(const char *short_name)
Find AVInputFormat based on the short name of the input format.
int av_strcasecmp(const char *a, const char *b)
Locale-independent case-insensitive compare.
#define AV_OPT_SEARCH_CHILDREN
Search in possible children of the given object first.
enum AVCodecID av_guess_codec(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.
int av_probe_input_buffer(AVIOContext *pb, 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.
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...
void av_register_input_format(AVInputFormat *format)
AVOutputFormat * av_oformat_next(const AVOutputFormat *f)
If f is NULL, returns the first registered output format, if f is non-NULL, returns the next register...
void av_register_output_format(AVOutputFormat *format)
int av_filename_number_test(const char *filename)
Check whether filename actually is a numbered sequence generator.
This structure contains the data a format has to probe a file.
int ff_id3v2_match(const uint8_t *buf, const char *magic)
Detect ID3v2 Header.
enum AVCodecID ff_guess_image2_codec(const char *filename)
int av_opt_get(void *obj, const char *name, int search_flags, uint8_t **out_val)
int ff_id3v2_tag_len(const uint8_t *buf)
Get the length of an ID3v2 tag.
AVInputFormat * av_probe_input_format(AVProbeData *pd, int is_opened)
Guess the file format.
AVInputFormat * av_iformat_next(const AVInputFormat *f)
If f is NULL, returns the first registered input format, if f is non-NULL, returns the next registere...