FFmpeg
[フレーム]
Enumerations | Functions
Audio sample formats
Audio related

Audio sample format enumeration and related convenience functions. More...

Enumerations

  Audio sample formats. More...
 

Functions

const char *  av_get_sample_fmt_name (enum AVSampleFormat sample_fmt)
  Return the name of sample_fmt, or NULL if sample_fmt is not recognized. More...
 
enum AVSampleFormat  av_get_sample_fmt (const char *name)
  Return a sample format corresponding to name, or AV_SAMPLE_FMT_NONE on error. More...
 
enum AVSampleFormat  av_get_alt_sample_fmt (enum AVSampleFormat sample_fmt, int planar)
  Return the planar<->packed alternative form of the given sample format, or AV_SAMPLE_FMT_NONE on error. More...
 
  Get the packed alternative form of the given sample format. More...
 
  Get the planar alternative form of the given sample format. More...
 
char *  av_get_sample_fmt_string (char *buf, int buf_size, enum AVSampleFormat sample_fmt)
  Generate a string corresponding to the sample format with sample_fmt, or a header if sample_fmt is negative. More...
 
int  av_get_bytes_per_sample (enum AVSampleFormat sample_fmt)
  Return number of bytes per sample. More...
 
int  av_sample_fmt_is_planar (enum AVSampleFormat sample_fmt)
  Check if the sample format is planar. More...
 
int  av_samples_get_buffer_size (int *linesize, int nb_channels, int nb_samples, enum AVSampleFormat sample_fmt, int align)
  Get the required buffer size for the given audio parameters. More...
 

Detailed Description

Audio sample format enumeration and related convenience functions.

Enumeration Type Documentation

Audio sample formats.

  • The data described by the sample format is always in native-endian order. Sample values can be expressed by native C types, hence the lack of a signed 24-bit sample format even though it is a common raw audio data format.
  • The floating-point formats are based on full volume being in the range [-1.0, 1.0]. Any values outside this range are beyond full volume level.
  • The data layout as used in av_samples_fill_arrays() and elsewhere in FFmpeg (such as AVFrame in libavcodec) is as follows:
For planar sample formats, each audio channel is in a separate data plane, and linesize is the buffer size, in bytes, for a single plane. All data planes must be the same size. For packed sample formats, only the first data plane is used, and samples for each channel are interleaved. In this case, linesize is the buffer size, in bytes, for the 1 plane.
Enumerator
AV_SAMPLE_FMT_NONE 
AV_SAMPLE_FMT_U8 

unsigned 8 bits

AV_SAMPLE_FMT_S16 

signed 16 bits

AV_SAMPLE_FMT_S32 

signed 32 bits

AV_SAMPLE_FMT_FLT 

float

AV_SAMPLE_FMT_DBL 

double

AV_SAMPLE_FMT_U8P 

unsigned 8 bits, planar

AV_SAMPLE_FMT_S16P 

signed 16 bits, planar

AV_SAMPLE_FMT_S32P 

signed 32 bits, planar

AV_SAMPLE_FMT_FLTP 

float, planar

AV_SAMPLE_FMT_DBLP 

double, planar

AV_SAMPLE_FMT_NB 

Number of sample formats. DO NOT USE if linking dynamically.

Definition at line 59 of file samplefmt.h.

Function Documentation

const char* av_get_sample_fmt_name ( enum AVSampleFormat  sample_fmt )

Return the name of sample_fmt, or NULL if sample_fmt is not recognized.

Definition at line 47 of file samplefmt.c.

Referenced by audio_decode_frame(), audio_encode_example(), audio_frame_cksum(), audio_thread(), av_audio_resample_init(), av_opt_get(), avcodec_open2(), avcodec_string(), avresample_open(), choose_sample_fmt(), config_output(), config_props(), configure_input_audio_filter(), decode_audio(), dprint_options(), ff_all_formats(), ff_audio_convert_set_func(), ff_audio_mix_alloc(), ff_audio_mix_set_func(), ff_audio_resample_init(), ff_dither_alloc(), ff_tlog_link(), filter_frame(), get_format_from_sample_fmt(), init_audio(), init_filter(), init_filter_graph(), init_filters(), lavfi_read_header(), main(), mix_function_init(), opt_list(), pick_format(), print_digraph(), print_link_prop(), show_frame(), show_stream(), and swr_init().

enum AVSampleFormat av_get_sample_fmt ( const char *  name )

Return a sample format corresponding to name, or AV_SAMPLE_FMT_NONE on error.

Definition at line 54 of file samplefmt.c.

Referenced by ff_parse_sample_format(), init(), new_audio_stream(), and set_string_sample_fmt().

enum AVSampleFormat av_get_alt_sample_fmt ( enum AVSampleFormat  sample_fmt,
int  planar 
)

Return the planar<->packed alternative form of the given sample format, or AV_SAMPLE_FMT_NONE on error.

If the passed sample_fmt is already in the requested planar/packed format, the format returned is the same as the input.

Definition at line 64 of file samplefmt.c.

Referenced by get(), set(), and shift().

enum AVSampleFormat av_get_packed_sample_fmt ( enum AVSampleFormat  sample_fmt )

Get the packed alternative form of the given sample format.

If the passed sample_fmt is already in packed format, the format returned is the same as the input.

Returns
the packed alternative form of the given sample format or AV_SAMPLE_FMT_NONE on error.

Definition at line 73 of file samplefmt.c.

Referenced by auto_matrix(), cmp_audio_fmts(), ff_audio_convert_set_func(), ff_dither_alloc(), ff_volume_init_x86(), filter_frame(), get_fmt_score(), main(), PUT_FUNC(), swap_sample_fmts_on_filter(), swri_dither_init(), and volume_init().

enum AVSampleFormat av_get_planar_sample_fmt ( enum AVSampleFormat  sample_fmt )

Get the planar alternative form of the given sample format.

If the passed sample_fmt is already in planar format, the format returned is the same as the input.

Returns
the planar alternative form of the given sample format or AV_SAMPLE_FMT_NONE on error.

Definition at line 82 of file samplefmt.c.

Referenced by avcodec_open2(), avresample_open(), config_output(), swap_sample_fmts_on_filter(), and swr_init().

char* av_get_sample_fmt_string ( char *  buf,
int  buf_size,
enum AVSampleFormat  sample_fmt 
)

Generate a string corresponding to the sample format with sample_fmt, or a header if sample_fmt is negative.

Parameters
buf the buffer where to write the string
buf_size the size of buf
sample_fmt the number of the sample format to print the corresponding info string, or a negative value to print the corresponding header.
Returns
the pointer to the filled buffer or NULL if sample_fmt is unknown or in case of other errors

Definition at line 91 of file samplefmt.c.

Referenced by show_sample_fmts().

int av_get_bytes_per_sample ( enum AVSampleFormat  sample_fmt )

Return number of bytes per sample.

Parameters
sample_fmt the sample format
Returns
number of bytes per sample or zero if unknown for the given sample format

Definition at line 104 of file samplefmt.c.

Referenced by audio_decode_example(), audio_decode_frame(), audio_resample(), av_audio_resample_init(), av_samples_copy(), av_samples_get_buffer_size(), av_samples_set_silence(), available_samples(), avcodec_string(), avresample_open(), buffer_offset(), config_input(), config_output(), copy_samples(), decode_frame(), decode_init(), decode_packet(), fdk_aac_decode_frame(), ff_audio_data_alloc(), ff_audio_data_init(), ff_audio_resample(), ff_audio_resample_init(), ff_dither_alloc(), ff_parse_sample_format(), ff_planar_sample_fmts(), filter_frame(), flac_set_bps(), get_fmt_score(), init_sample_buffers(), lavfi_read_packet(), libopus_encode(), libopus_encode_init(), mkv_write_track(), process_output(), pulse_write_frame(), pulse_write_header(), pulse_write_packet(), resample_init(), set_audiodata_fmt(), setup_array(), shift(), swap_sample_fmts_on_filter(), swri_dither_init(), swri_rematrix(), vmdaudio_decode_init(), wavpack_decode_block(), wv_unpack_mono(), wv_unpack_stereo(), and yae_reset().

int av_sample_fmt_is_planar ( enum AVSampleFormat  sample_fmt )

Check if the sample format is planar.

Parameters
sample_fmt the sample format to inspect
Returns
1 if the sample format is planar, 0 if it is interleaved

Definition at line 110 of file samplefmt.c.

Referenced by audio_frame_cksum(), audio_write_frame(), av_audio_fifo_alloc(), av_frame_get_plane_buffer(), av_samples_alloc_array_and_samples(), av_samples_copy(), av_samples_fill_arrays(), av_samples_get_buffer_size(), av_samples_set_silence(), available_samples(), avcodec_encode_audio2(), avcodec_fill_audio_frame(), buffer_offset(), calc_ptr_alignment(), config_output(), ff_planar_sample_fmts(), ff_sample_fmt_is_planar(), filter_frame(), flac_set_bps(), frame_copy_audio(), get(), get_audio_buffer(), get_fmt_score(), main(), process_output(), pulse_write_frame(), set(), set_audiodata_fmt(), setup_array(), shift(), and update_frame_pool().

int av_samples_get_buffer_size ( int *  linesize,
int  nb_channels,
int  nb_samples,
enum AVSampleFormat  sample_fmt,
int  align 
)

Get the required buffer size for the given audio parameters.

Parameters
[out] linesize calculated linesize, may be NULL
nb_channels the number of channels
nb_samples the number of samples in a single channel
sample_fmt the sample format
align buffer size alignment (0 = default, 1 = no alignment)
Returns
required buffer size, or negative error code on failure

Definition at line 117 of file samplefmt.c.

Referenced by allocate_buffers(), audio_decode_frame(), audio_encode_example(), audio_open(), av_audio_fifo_alloc(), av_audio_fifo_realloc(), av_samples_alloc(), av_samples_fill_arrays(), avcodec_fill_audio_frame(), ff_audio_data_realloc(), get_audio_buffer(), main(), tak_decode_frame(), and update_frame_pool().


Generated on Mon Feb 15 2016 15:20:55 for FFmpeg by   doxygen 1.8.6

AltStyle によって変換されたページ (->オリジナル) /