libavfilter/formats.c File Reference

#include "libavutil/eval.h"
#include "libavutil/pixdesc.h"
#include "libavutil/audioconvert.h"
#include "avfilter.h"
#include "internal.h"
#include "all_channel_layouts.h"

Go to the source code of this file.

Defines

#define COPY_INT_LIST(list_copy, list, type)
#define MAKE_FORMAT_LIST()

Functions

static void merge_ref (AVFilterFormats *ret, AVFilterFormats *a)
 Add all refs from a to ret and destroy a.
AVFilterFormatsavfilter_merge_formats (AVFilterFormats *a, AVFilterFormats *b)
 Return a format list which contains the intersection of the formats of a and b.
int ff_fmt_is_in (int fmt, const int *fmts)
 Tell is a format is contained in the provided list terminated by -1.
int * ff_copy_int_list (const int *const list)
 Return a copy of a list of integers terminated by -1, or NULL in case of copy failure.
int64_t * ff_copy_int64_list (const int64_t *const list)
 Return a copy of a list of 64-bit integers, or NULL in case of copy failure.
AVFilterFormatsavfilter_make_format_list (const int *fmts)
 Create a list of supported formats.
AVFilterFormatsavfilter_make_format64_list (const int64_t *fmts)
int avfilter_add_format (AVFilterFormats **avff, int64_t fmt)
 Add fmt to the list of media formats contained in *avff.
AVFilterFormatsavfilter_all_formats (enum AVMediaType type)
AVFilterFormatsavfilter_make_all_formats (enum AVMediaType type)
 Return a list of all formats supported by FFmpeg for the given media type.
AVFilterFormatsavfilter_make_all_channel_layouts (void)
 Return a list of all channel layouts supported by FFmpeg.
AVFilterFormatsavfilter_make_all_packing_formats (void)
 Return a list of all audio packing formats.
void avfilter_formats_ref (AVFilterFormats *f, AVFilterFormats **ref)
 Add *ref as a new reference to formats.
static int find_ref_index (AVFilterFormats **ref)
void avfilter_formats_unref (AVFilterFormats **ref)
 If *ref is non-NULL, remove *ref as a reference to the format list it currently points to, deallocates that list if this was the last reference, and sets *ref to NULL.
void avfilter_formats_changeref (AVFilterFormats **oldref, AVFilterFormats **newref)
 Before After ________ ________ |formats |<---------.
int ff_parse_pixel_format (enum PixelFormat *ret, const char *arg, void *log_ctx)
 Parse a pixel format.
int ff_parse_sample_format (int *ret, const char *arg, void *log_ctx)
 Parse a sample format name or a corresponding integer representation.
int ff_parse_sample_rate (int *ret, const char *arg, void *log_ctx)
 Parse a sample rate.
int ff_parse_channel_layout (int64_t *ret, const char *arg, void *log_ctx)
 Parse a channel layout or a corresponding integer representation.
int ff_parse_packing_format (int *ret, const char *arg, void *log_ctx)
 Parse a packing format or a corresponding integer representation.

Variables

const int64_t avfilter_all_channel_layouts []
 A list of all channel layouts supported by libavfilter.


Define Documentation

#define COPY_INT_LIST ( list_copy,
list,
type   ) 

Value:

{                          \
    int count = 0;                                                      \
    if (list)                                                           \
        for (count = 0; list[count] != -1; count++)                     \
            ;                                                           \
    list_copy = av_calloc(count+1, sizeof(type));                       \
    if (list_copy) {                                                    \
        memcpy(list_copy, list, sizeof(type) * count);                  \
        list_copy[count] = -1;                                          \
    }                                                                   \
}

Definition at line 99 of file formats.c.

Referenced by ff_copy_int64_list(), and ff_copy_int_list().

 
#define MAKE_FORMAT_LIST (  ) 

Value:

AVFilterFormats *formats;                                           \
    int count = 0;                                                      \
    if (fmts)                                                           \
        for (count = 0; fmts[count] != -1; count++)                     \
            ;                                                           \
    formats = av_mallocz(sizeof(AVFilterFormats));                      \
    if (!formats) return NULL;                                          \
    formats->format_count = count;                                      \
    if (count) {                                                        \
        formats->formats = av_malloc(sizeof(*formats->formats)*count);  \
        if (!formats->formats) {                                        \
            av_free(formats);                                           \
            return NULL;                                                \
        }                                                               \
    }

Definition at line 125 of file formats.c.

Referenced by avfilter_make_format64_list(), and avfilter_make_format_list().


Function Documentation

int avfilter_add_format ( AVFilterFormats **  avff,
int64_t  fmt 
)

Add fmt to the list of media formats contained in *avff.

If *avff is NULL the function allocates the filter formats struct and puts its pointer in *avff.

Returns:
a non negative value in case of success, or a negative value corresponding to an AVERROR code in case of error

Definition at line 160 of file formats.c.

Referenced by avfilter_make_all_formats(), and query_formats().

AVFilterFormats* avfilter_all_formats ( enum AVMediaType  type  ) 

Deprecated:
Use avfilter_make_all_formats() instead.

Definition at line 178 of file formats.c.

void avfilter_formats_changeref ( AVFilterFormats **  oldref,
AVFilterFormats **  newref 
)

Before After ________ ________ |formats |<---------.

|formats |<---------. | ____ | ___|___ | ____ | ___|___ | |refs| | | | | | |refs| | | | | NULL | |* *--------->|*oldref| | |* *--------->|*newref| ^ | |* * | | |_______| | |* * | | |_______| ___|___ | |____| | | |____| | | | | |________| |________| |*oldref| |_______|

Definition at line 257 of file formats.c.

Referenced by avfilter_insert_filter().

void avfilter_formats_ref ( AVFilterFormats formats,
AVFilterFormats **  ref 
)

Add *ref as a new reference to formats.

That is the pointers will point like in the ASCII art below: ________ |formats |<--------. | ____ | ____|___________________ | |refs| | | __|_ | |* * | | | | | | AVFilterLink | |* *--------->|*ref| | |____| | | |____| |________| |________________________

Definition at line 220 of file formats.c.

Referenced by query_formats(), and set_common_formats().

void avfilter_formats_unref ( AVFilterFormats **  ref  ) 

If *ref is non-NULL, remove *ref as a reference to the format list it currently points to, deallocates that list if this was the last reference, and sets *ref to NULL.

Before After ________ ________ NULL |formats |<--------. |formats | ^ | ____ | ____|________________ | ____ | ____|________________ | |refs| | | __|_ | |refs| | | __|_ | |* * | | | | | | AVFilterLink | |* * | | | | | | AVFilterLink | |* *--------->|*ref| | |* | | | |*ref| | |____| | | |____| | |____| | | |____| |________| |_____________________ |________| |_____________________

Definition at line 236 of file formats.c.

Referenced by avfilter_free(), pick_format(), and query_formats().

AVFilterFormats* avfilter_make_all_channel_layouts ( void   ) 

Return a list of all channel layouts supported by FFmpeg.

Definition at line 204 of file formats.c.

Referenced by avfilter_default_query_formats(), init(), and query_formats().

AVFilterFormats* avfilter_make_all_formats ( enum AVMediaType  type  ) 

Return a list of all formats supported by FFmpeg for the given media type.

Definition at line 184 of file formats.c.

Referenced by avfilter_all_formats(), avfilter_default_query_formats(), init(), and query_formats().

AVFilterFormats* avfilter_make_all_packing_formats ( void   ) 

Return a list of all audio packing formats.

Definition at line 209 of file formats.c.

Referenced by avfilter_default_query_formats(), init(), and query_formats().

AVFilterFormats* avfilter_make_format64_list ( const int64_t *  fmts  ) 

Definition at line 151 of file formats.c.

Referenced by avfilter_make_all_channel_layouts(), and query_formats().

AVFilterFormats* avfilter_make_format_list ( const int *  fmts  ) 

Create a list of supported formats.

This is intended for use in AVFilter->query_formats().

Parameters:
fmts list of media formats, terminated by -1. If NULL an empty list is created.
Returns:
the format list, with no existing references

Definition at line 142 of file formats.c.

Referenced by avfilter_make_all_packing_formats(), and query_formats().

AVFilterFormats* avfilter_merge_formats ( AVFilterFormats a,
AVFilterFormats b 
)

Return a format list which contains the intersection of the formats of a and b.

Also, all the references of a, all the references of b, and a and b themselves will be deallocated.

If a and b do not share any common formats, neither is modified, and NULL is returned.

Definition at line 45 of file formats.c.

Referenced by insert_conv_filter(), and query_formats().

int64_t* ff_copy_int64_list ( const int64_t *const   list  ) 

Return a copy of a list of 64-bit integers, or NULL in case of copy failure.

Definition at line 118 of file formats.c.

int* ff_copy_int_list ( const int *const   list  ) 

Return a copy of a list of integers terminated by -1, or NULL in case of copy failure.

Definition at line 111 of file formats.c.

int ff_fmt_is_in ( int  fmt,
const int *  fmts 
)

Tell is a format is contained in the provided list terminated by -1.

Definition at line 88 of file formats.c.

Referenced by config_input_main(), config_input_overlay(), config_out_props(), and config_props().

int ff_parse_channel_layout ( int64_t *  ret,
const char *  arg,
void *  log_ctx 
)

Parse a channel layout or a corresponding integer representation.

Parameters:
ret 64bit integer pointer to where the value should be written.
arg string to parse
log_ctx log context
Returns:
0 in case of success, a negative AVERROR code on error

Definition at line 313 of file formats.c.

Referenced by init().

int ff_parse_packing_format ( int *  ret,
const char *  arg,
void *  log_ctx 
)

Parse a packing format or a corresponding integer representation.

Parameters:
ret integer pointer to where the value should be written
arg string to parse
log_ctx log context
Returns:
0 in case of success, a negative AVERROR code on error

Definition at line 328 of file formats.c.

Referenced by init().

int ff_parse_pixel_format ( enum PixelFormat ret,
const char *  arg,
void *  log_ctx 
)

Parse a pixel format.

Parameters:
ret pixel format pointer to where the value should be written
arg string to parse
log_ctx log context
Returns:
0 in case of success, a negative AVERROR code on error

Definition at line 271 of file formats.c.

Referenced by init().

int ff_parse_sample_format ( int *  ret,
const char *  arg,
void *  log_ctx 
)

Parse a sample format name or a corresponding integer representation.

Parameters:
ret integer pointer to where the value should be written
arg string to parse
log_ctx log context
Returns:
0 in case of success, a negative AVERROR code on error

Definition at line 286 of file formats.c.

Referenced by init().

int ff_parse_sample_rate ( int *  ret,
const char *  arg,
void *  log_ctx 
)

Parse a sample rate.

Parameters:
ret unsigned integer pointer to where the value should be written
arg string to parse
log_ctx log context
Returns:
0 in case of success, a negative AVERROR code on error

Definition at line 301 of file formats.c.

Referenced by init().

static int find_ref_index ( AVFilterFormats **  ref  )  [static]

Definition at line 227 of file formats.c.

Referenced by avfilter_formats_changeref(), and avfilter_formats_unref().

static void merge_ref ( AVFilterFormats ret,
AVFilterFormats a 
) [static]

Add all refs from a to ret and destroy a.

Definition at line 31 of file formats.c.

Referenced by avfilter_merge_formats().


Variable Documentation

A list of all channel layouts supported by libavfilter.

Definition at line 199 of file formats.c.

Referenced by avfilter_make_all_channel_layouts(), and lavfi_read_header().


Generated on Fri Oct 26 02:46:11 2012 for FFmpeg by  doxygen 1.5.8