Defines | Functions | Variables

libavformat/utils.c File Reference

various utility functions for use within FFmpeg More...

#include "avformat.h"
#include "avio_internal.h"
#include "internal.h"
#include "libavcodec/internal.h"
#include "libavcodec/raw.h"
#include "libavutil/opt.h"
#include "libavutil/dict.h"
#include "libavutil/pixdesc.h"
#include "metadata.h"
#include "id3v2.h"
#include "libavutil/avstring.h"
#include "riff.h"
#include "audiointerleave.h"
#include "url.h"
#include <sys/time.h>
#include <time.h>
#include <strings.h>
#include <stdarg.h>
#include "network.h"
#include <assert.h>
#include "libavutil/parseutils.h"

Go to the source code of this file.

Defines

#define LICENSE_PREFIX   "libavformat license: "
#define PROBE_BUF_MIN   2048
#define PROBE_BUF_MAX   (1<<20)
#define DURATION_MAX_READ_SIZE   250000
#define DURATION_MAX_RETRY   3
#define PRINT(...)   do { if (!f) av_log(avcl, level, __VA_ARGS__); else fprintf(f, __VA_ARGS__); } while(0)
#define PRINT(...)   do { if (!f) av_log(avcl, level, __VA_ARGS__); else fprintf(f, __VA_ARGS__); } while(0)

Functions

unsigned avformat_version (void)
 Return the LIBAVFORMAT_VERSION_INT constant.
const char * avformat_configuration (void)
 Return the libavformat build-time configuration.
const char * avformat_license (void)
 Return the libavformat license.
static void av_frac_init (AVFrac *f, int64_t val, int64_t num, int64_t den)
 f = val + (num / den) + 0.5.
static void av_frac_add (AVFrac *f, int64_t incr)
 Fractional addition to f: f = f + (incr / f->den).
AVInputFormatav_iformat_next (AVInputFormat *f)
 If f is NULL, returns the first registered input format, if f is non-NULL, returns the next registered input format after f or NULL if f is the last one.
AVOutputFormatav_oformat_next (AVOutputFormat *f)
 If f is NULL, returns the first registered output format, if f is non-NULL, returns the next registered output format after f or NULL if f is the last one.
void av_register_input_format (AVInputFormat *format)
void av_register_output_format (AVOutputFormat *format)
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.
static int match_format (const char *name, const char *names)
AVOutputFormatguess_format (const char *short_name, const char *filename, const char *mime_type)
AVOutputFormatav_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 parameters, or return NULL if there is no match.
AVOutputFormatguess_stream_format (const char *short_name, const char *filename, const char *mime_type)
enum CodecID 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.
AVInputFormatav_find_input_format (const char *short_name)
 Find AVInputFormat based on the short name of the input format.

Variables

AVInputFormatfirst_iformat = NULL
 head of registered input format linked list
AVOutputFormatfirst_oformat = NULL
 head of registered output format linked list

Detailed Description

various utility functions for use within FFmpeg

Definition in file utils.c.


Define Documentation

#define DURATION_MAX_READ_SIZE   250000
#define DURATION_MAX_RETRY   3
#define LICENSE_PREFIX   "libavformat license: "
#define PRINT (   ...  )     do { if (!f) av_log(avcl, level, __VA_ARGS__); else fprintf(f, __VA_ARGS__); } while(0)
#define PRINT (   ...  )     do { if (!f) av_log(avcl, level, __VA_ARGS__); else fprintf(f, __VA_ARGS__); } while(0)
#define PROBE_BUF_MAX   (1<<20)
#define PROBE_BUF_MIN   2048

Function Documentation

AVInputFormat* av_find_input_format ( const char *  short_name  ) 

Find AVInputFormat based on the short name of the input format.

Definition at line 291 of file utils.c.

Referenced by http_receive_data(), movie_init(), opt_format(), opt_input_file(), parse_ffconfig(), and sap_read_header().

static void av_frac_add ( AVFrac f,
int64_t  incr 
) [static]

Fractional addition to f: f = f + (incr / f->den).

Parameters:
f fractional number
incr increment, can be positive or negative

Definition at line 100 of file utils.c.

static void av_frac_init ( AVFrac f,
int64_t  val,
int64_t  num,
int64_t  den 
) [static]

f = val + (num / den) + 0.5.

'num' is normalized so that it is such as 0 <= num < den.

Parameters:
f fractional number
val integer value
num must be >= 0
den must be >= 1

Definition at line 82 of file utils.c.

enum CodecID 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.

Definition at line 270 of file utils.c.

Referenced by new_audio_stream(), new_subtitle_stream(), and new_video_stream().

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 parameters, or return NULL if there is no match.

Parameters:
short_name if non-NULL checks if short_name matches with the names of the registered formats
filename if non-NULL checks if filename terminates with the extensions of the registered formats
mime_type if non-NULL checks if mime_type matches with the MIME type of the registered formats

Definition at line 214 of file utils.c.

Referenced by av_guess_format(), ff_rtp_chain_mux_open(), ffserver_guess_format(), guess_format(), guess_stream_format(), parse_ffconfig(), and rtp_new_av_stream().

AVInputFormat* av_iformat_next ( AVInputFormat f  ) 

If f is NULL, returns the first registered input format, if f is non-NULL, returns the next registered input format after f or NULL if f is the last one.

Definition at line 131 of file utils.c.

Referenced by av_find_input_format(), opt_default(), opt_find(), opt_formats(), and probe().

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.

Parameters:
extensions a comma-separated list of filename extensions

Definition at line 161 of file utils.c.

Referenced by av_guess_format(), http_parse_request(), ipod_get_codec_tag(), mpegts_probe(), and nsv_probe().

AVOutputFormat* av_oformat_next ( AVOutputFormat f  ) 

If f is NULL, returns the first registered output format, if f is non-NULL, returns the next registered output format after f or NULL if f is the last one.

Definition at line 137 of file utils.c.

Referenced by av_guess_format(), opt_default(), opt_find(), opt_formats(), and opt_help().

void av_register_input_format ( AVInputFormat format  ) 

Definition at line 143 of file utils.c.

void av_register_output_format ( AVOutputFormat format  ) 

Definition at line 152 of file utils.c.

const char* avformat_configuration ( void   ) 

Return the libavformat build-time configuration.

Definition at line 59 of file utils.c.

const char* avformat_license ( void   ) 

Return the libavformat license.

Definition at line 64 of file utils.c.

unsigned avformat_version ( void   ) 

Return the LIBAVFORMAT_VERSION_INT constant.

Definition at line 54 of file utils.c.

AVOutputFormat* guess_format ( const char *  short_name,
const char *  filename,
const char *  mime_type 
)
Deprecated:
Use av_guess_format() instead.

Definition at line 207 of file utils.c.

AVOutputFormat* guess_stream_format ( const char *  short_name,
const char *  filename,
const char *  mime_type 
)

Definition at line 250 of file utils.c.

static int match_format ( const char *  name,
const char *  names 
) [static]

Definition at line 188 of file utils.c.

Referenced by av_find_input_format().


Variable Documentation

head of registered input format linked list

Definition at line 124 of file utils.c.

head of registered output format linked list

Definition at line 129 of file utils.c.