FFmpeg
Data Fields
AVChannelLayout Struct Reference

An AVChannelLayout holds information about the channel layout of audio data. More...

#include <channel_layout.h>

Data Fields

enum AVChannelOrder order
 Channel order used in this layout. More...
 
int nb_channels
 Number of channels in this layout. More...
 
union {
   uint64_t   mask
 This member must be used for AV_CHANNEL_ORDER_NATIVE, and may be used for AV_CHANNEL_ORDER_AMBISONIC to signal non-diegetic channels. More...
 
   AVChannelCustom *   map
 This member must be used when the channel order is AV_CHANNEL_ORDER_CUSTOM. More...
 
u
 Details about which channels are present in this layout. More...
 
void * opaque
 For some private data of the user. More...
 

Detailed Description

An AVChannelLayout holds information about the channel layout of audio data.

A channel layout here is defined as a set of channels ordered in a specific way (unless the channel order is AV_CHANNEL_ORDER_UNSPEC, in which case an AVChannelLayout carries only the channel count). All orders may be treated as if they were AV_CHANNEL_ORDER_UNSPEC by ignoring everything but the channel count, as long as av_channel_layout_check() considers they are valid.

Unlike most structures in FFmpeg, sizeof(AVChannelLayout) is a part of the public ABI and may be used by the caller. E.g. it may be allocated on stack or embedded in caller-defined structs.

AVChannelLayout can be initialized as follows:

The channel layout must be unitialized with av_channel_layout_uninit()

Copying an AVChannelLayout via assigning is forbidden, av_channel_layout_copy() must be used instead (and its return value should be checked)

No new fields may be added to it without a major version bump, except for new elements of the union fitting in sizeof(uint64_t).

Examples
encode_audio.c, mux.c, and resample_audio.c.

Definition at line 303 of file channel_layout.h.

Field Documentation

◆ order

enum AVChannelOrder AVChannelLayout::order

Channel order used in this layout.

This is a mandatory field.

Examples
decode_filter_audio.c, and transcode.c.

Definition at line 308 of file channel_layout.h.

Referenced by adx_decode_header(), aiff_write_header(), ambisonic_order(), ambisonics_config(), audio_open(), av_buffersrc_add_frame_flags(), av_channel_layout_channel_from_index(), av_channel_layout_check(), av_channel_layout_compare(), av_channel_layout_custom_init(), av_channel_layout_default(), av_channel_layout_describe_bprint(), av_channel_layout_from_mask(), av_channel_layout_from_string(), av_channel_layout_index_from_channel(), av_channel_layout_index_from_string(), av_channel_layout_retype(), av_channel_layout_subset(), av_channel_layout_uninit(), av_frame_move_ref(), av_frame_ref(), caf_write_header(), canonical_order(), codec_parameters_reset(), configure_input_audio_filter(), decode_init(), dolby_e_decode_frame(), dolby_e_parse(), ff_aac_ac3_parse(), ff_dca_set_channel_layout(), ff_default_get_audio_buffer(), ff_flac_set_channel_layout(), ff_get_wav_header(), ff_iamf_add_audio_element(), ff_mov_get_channel_layout_tag(), ff_mp4_read_dec_config_descr(), ff_parse_channel_layout(), ff_put_wav_header(), ff_rtp_get_codec_info(), ffat_create_decoder(), ffat_init_encoder(), flac_encode_init(), flac_init(), get_codec_data(), get_stream_info(), guess_input_channel_layout(), has_channel_names(), iff_read_header(), init_filter(), init_filters(), libopus_check_vorbis_layout(), libopus_decode_init(), libvorbis_setup(), mov_finalize_stsd_codec(), mov_parse_stsd_audio(), mov_read_SA3D(), new_stream_audio(), oggvorbis_decode_init(), osq_init(), osq_read_header(), output_configure(), parse_channel_list(), parse_dsd_prop(), parse_mca_labels(), pulse_write_header(), query_formats(), read_specific_config(), s302m_parse_frame_header(), sane_layout(), sbc_decode_frame(), sbc_parse_header(), scalable_channel_layout_config(), show_frame(), show_stream(), speex_decode_init(), swr_init(), tak_decode_frame(), tak_read_header(), try_describe_ambisonic(), tta_decode_init(), vorbis_decode_frame(), vorbis_decode_init(), and xma_decode_init().

◆ nb_channels

int AVChannelLayout::nb_channels

Number of channels in this layout.

Mandatory field.

Examples
decode_audio.c, decode_filter_audio.c, demux_decode.c, encode_audio.c, filter_audio.c, resample_audio.c, transcode.c, and transcode_aac.c.

Definition at line 313 of file channel_layout.h.

Referenced by aa_read_header(), aac_decode_frame_int(), aac_decode_init(), aac_encode_frame(), aac_encode_init(), aax_read_header(), aax_read_packet(), ac3_decode_frame(), ac3_downmix(), ace_read_header(), acm_read_header(), activate(), adpcm_decode_frame(), adpcm_decode_init(), adpcm_encode_init(), adpcm_swf_decode(), ads_read_header(), adx_decode_frame(), adx_decode_header(), adx_decode_init(), adx_encode_frame(), adx_encode_header(), adx_encode_init(), adx_parse(), adx_read_header(), adx_read_packet(), aea_read_header(), aea_write_header(), aea_write_trailer(), aeval_config_output(), afc_read_header(), aiff_write_header(), aix_read_header(), al_decode_frame(), alac_decode_init(), alac_encode_frame(), alac_encode_init(), allocate_buffers(), ambisonic_order(), ambisonics_config(), amr_handle_packet(), amr_parse(), amr_wb_encode_init(), amrnb_decode_frame(), amrnb_decode_init(), amrwb_decode_frame(), amrwb_decode_init(), amv_write_alist(), apac_decode(), apac_init(), apac_read_header(), ape_decode_init(), ape_read_header(), apply_window_and_mdct(), aptx_decode_frame(), aptx_read_header_common(), ast_read_header(), ast_write_header(), ast_write_packet(), at_write_header(), atrac1_decode_frame(), atrac1_decode_init(), atrac3_decode_init(), audio_decode_frame(), audio_frame_cksum(), audio_open(), audio_read_header(), audio_thread(), audio_write_header(), av_buffersrc_parameters_set(), av_channel_layout_channel_from_index(), av_channel_layout_check(), av_channel_layout_compare(), av_channel_layout_custom_init(), av_channel_layout_default(), av_channel_layout_describe_bprint(), av_channel_layout_from_mask(), av_channel_layout_from_string(), av_channel_layout_index_from_channel(), av_channel_layout_index_from_string(), av_channel_layout_retype(), av_find_best_stream(), av_frame_get_plane_buffer(), av_frame_move_ref(), av_frame_ref(), av_frame_replace(), av_get_audio_frame_duration(), av_get_audio_frame_duration2(), avcodec_open2(), avisynth_create_stream_audio(), avr_read_header(), binka_read_header(), binkaudio_receive_frame(), bonk_decode(), bonk_init(), bonk_read_header(), caf_write_header(), canonical_order(), cdata_read_header(), celt_header(), check_idx_and_id(), choose_channel_layouts(), cin_read_header(), clean_layout(), close_output(), compand_drain(), compressor(), compute_frame_rms(), config_audio_output(), config_filter(), config_output(), config_props(), configure_input_audio_filter(), connect_ports(), construct_perm_table(), cook_decode_init(), cook_parse(), create_master_playlist(), create_vorbis_context(), crossover_setup(), daud_init(), dcstr_read_header(), dec_bark_env(), dec_gain(), decode(), decode_0cpy(), decode_1dif(), decode_2slp(), decode_5elp(), decode_block(), decode_end(), decode_extension_payload(), decode_frame(), decode_init(), decode_packet(), decode_ppc(), decode_stream_header(), decoder_init(), dfpwm_enc_frame(), dhav_read_packet(), discard_samples(), do_decode(), dolby_e_decode_frame(), dolby_e_parse(), dpcm_decode_frame(), dpcm_decode_init(), draw_items(), dsd_channel(), dsf_read_header(), dsf_read_packet(), dshow_add_device(), dtshd_read_header(), dump_stream_group(), dv_init_mux(), dvdvideo_audio_stream_add(), ea_read_header(), eightsvx_decode_frame(), eightsvx_decode_init(), enc_open(), encode_frame(), encode_init(), encode_preinit_audio(), epaf_read_header(), fastaudio_decode(), fastaudio_init(), fdk_aac_decode_frame(), ff_aac_ac3_parse(), ff_ac3_validate_metadata(), ff_aptx_init(), ff_argo_asf_fill_stream(), ff_dca_set_channel_layout(), ff_dca_xll_filter_frame(), ff_default_get_audio_buffer(), ff_encode_alloc_frame(), ff_flac_set_channel_layout(), ff_frame_pool_get(), ff_get_buffer(), ff_get_wav_header(), ff_iamf_add_audio_element(), ff_make_channel_layout_list(), ff_mov_get_channel_layout_tag(), ff_mov_read_chan(), ff_mov_read_chnl(), ff_mov_read_stsd_entries(), ff_mp4_read_dec_config_descr(), ff_opus_parse_extradata(), ff_parse_channel_layout(), ff_pcm_default_packet_size(), ff_pcm_read_seek(), ff_psy_init(), ff_psy_preprocess_init(), ff_put_wav_header(), ff_rtp_get_codec_info(), ff_rtp_get_payload_type(), ff_voc_get_packet(), ff_wma_init(), ffat_create_decoder(), ffat_decode(), ffat_encode(), ffat_encode_callback(), ffat_init_decoder(), ffat_init_encoder(), ffat_update_ctx(), fft_channels(), film_read_header(), film_write_header(), filter_channel(), filter_channels(), filter_frame(), filter_frame_fixed(), filter_frame_float(), find_peak_magnitude(), fir_frame(), flac_encode_init(), flv_read_packet(), flv_write_codec_header(), frame_configure_elements(), frame_copy_audio(), frame_encode(), fsb_read_header(), fsb_read_packet(), ftr_decode_frame(), ftr_init(), ftr_parse(), g723_1_decode_frame(), g723_1_decode_init(), g723_1_parse(), g726_read_header(), g729_parse(), gate(), gdv_read_header(), genh_read_header(), genh_read_packet(), get_aiff_header(), get_audio_buffer(), get_audio_flags(), get_codec_data(), get_m2ts_stream_type(), get_nb_samples(), get_stream_info(), guess_channel_layout(), guess_input_channel_layout(), gxf_write_header(), handle_file(), has_channel_names(), has_codec_parameters(), hca_read_header(), hcom_init(), hcom_read_header(), headphone_convolute(), headphone_fast_convolute(), iff_read_header(), ilbc_encode_init(), imc_decode_frame(), imc_decode_init(), imdct_output(), imf_read_packet(), init(), init_bitstream_params(), init_converted_samples(), init_fifo(), init_filter(), init_filters(), init_hca(), init_mdct_win(), init_muxer(), ircam_read_header(), ircam_write_header(), iss_read_header(), join_config_output(), laf_read_header(), lame_window_init(), lavfi_read_packet(), libopus_check_max_channels(), libopus_check_vorbis_layout(), libopus_decode(), libopus_decode_init(), libopus_encode(), libopus_encode_init(), libopus_validate_layout_and_get_channel_map(), libopus_write_header(), libshine_encode_init(), libspeex_decode_frame(), libspeex_decode_init(), libvorbis_setup(), LLVMFuzzerTestOneInput(), lvf_read_header(), lxf_read_header(), mace_decode_frame(), mace_decode_init(), main(), map_auto_audio(), mark_pns(), masked_description(), match_stream_specifier(), merge_channel_layouts_internal(), metasound_read_bitstream(), mf_a_avframe_to_sample(), mf_enca_input_adjust(), mf_enca_input_score(), mf_enca_output_score(), misc4_decode(), mkv_write_track(), mlp_decode_init(), mlp_encode_frame(), mlp_encode_init(), modplug_read_header(), moflex_read_sync(), mov_finalize_stsd_codec(), mov_init(), mov_parse_stsd_audio(), mov_read_dac3(), mov_read_dec3(), mov_read_SA3D(), mov_write_audio_tag(), mov_write_chan_tag(), mov_write_header(), mov_write_isml_manifest(), mov_write_uuidprof_tag(), mp3_write_xing(), mp3lame_encode_frame(), mp3lame_encode_init(), MPA_encode_init(), mpc7_decode_init(), mpc8_decode_frame(), mpc8_read_header(), mpeg_mux_init(), mpegts_write_pmt(), msf_read_header(), msf_read_packet(), mtaf_read_header(), musx_read_header(), mv_read_header(), mxf_get_d10_aes3_packet(), mxf_handle_missing_index_segment(), mxf_init(), mxf_parse_structural_metadata(), mxf_set_audio_pts(), mxf_write_d10_audio_packet(), mxf_write_generic_sound_common(), new_stream_audio(), nist_read_header(), nsp_read_header(), oggvorbis_decode_init(), ogm_dshow_header(), ogm_header(), oma_write_header(), on2avc_decode_init(), opus_decode_packet(), opus_encode_init(), opus_header(), opus_write_extradata(), osq_decode_block(), osq_init(), osq_read_header(), output_configure(), output_data(), output_frame(), paf_audio_init(), parse_channel_list(), parse_chunk(), parse_dsd_prop(), parse_strk(), pcm_bluray_decode_frame(), pcm_bluray_encode_frame(), pcm_bluray_parse_header(), pcm_decode_frame(), pcm_dvd_decode_samples(), pcm_dvd_encode_frame(), pcm_dvd_encode_init(), pcm_dvd_parse_header(), pcm_encode_frame(), pcm_encode_init(), pcm_read_header(), pmp_header(), pp_bnk_read_header(), print_codec(), print_enc_params(), print_frame(), process_output(), pulse_read_header(), pulse_write_header(), pulse_write_packet(), push_frame(), pvf_read_header(), qdmc_decode_init(), qoa_decode_frame(), qoa_read_header(), query_formats(), r3d_read_reda(), read_access_unit(), read_and_decode_spectrum(), read_desc_chunk(), read_diff_float_data(), read_frame_data(), read_header(), read_header_gme(), read_index(), read_kuki_chunk(), read_major_sync(), read_packet(), read_packet_openmpt(), read_seek(), read_specific_config(), receive_samples(), redspark_read_header(), redspark_read_packet(), remap_layout(), request_frame(), rka_decode_init(), rka_read_header(), rl2_read_header(), rm_read_audio_stream_info(), roq_dpcm_encode_frame(), roq_dpcm_encode_init(), roq_read_packet(), rsd_read_header(), rsd_read_packet(), rso_write_header(), rtp_write_header(), rtp_write_packet(), run_test(), rv10_write_header(), s302m_decode_frame(), s302m_encode2_frame(), s302m_encode_init(), s302m_parse_frame_header(), samples_per_packet(), sane_layout(), sbc_decode_frame(), sbc_encode_init(), sbc_parse_header(), scd_read_packet(), scd_read_track(), sdr2_read_header(), sds_read_header(), sdx_read_header(), search_for_pns(), search_for_quantizers_fast(), search_for_quantizers_twoloop(), select_channel_layout(), send_silence(), seq_read_header(), set_channel_info(), set_channel_params(), show_frame(), show_stream(), smacker_read_header(), smjpeg_read_header(), smjpeg_write_header(), smka_decode_frame(), smka_decode_init(), smush_read_header(), sox_read_header(), sox_write_header(), speex_decode_frame(), speex_decode_init(), str_read_packet(), stream_cycle_channel(), svag_read_header(), swap_channel_layouts_on_filter(), swf_write_header(), swr_build_matrix2(), swr_init(), tak_decode_frame(), tak_read_header(), take_samples(), thp_read_header(), threedostr_read_header(), threedostr_read_packet(), tmv_read_header(), track_header(), truespeech_decode_init(), try_describe_ambisonic(), tta_decode_init(), tta_encode_frame(), tta_encode_init(), tta_read_header(), tta_write_header(), twinvq_read_bitstream(), twolame_encode_init(), update_extradata(), update_frame_pool(), vag_read_header(), validate_options(), decklink_input_callback::VideoInputFrameArrived(), viv_read_packet(), vivo_read_header(), vmdaudio_decode_frame(), vmdaudio_decode_init(), voc_write_packet(), vorbis_decode_frame(), vorbis_decode_init(), vorbis_encode_init(), vorbis_header(), vpk_read_header(), vpk_read_packet(), vqf_read_header(), wavarc_decode(), wavarc_init(), wavesynth_decode(), wavesynth_init(), wavpack_decode_block(), wavpack_decode_frame(), wavpack_encode_frame(), wavpack_encode_init(), wc3_read_header(), write_metadata(), write_streamheader(), wsaud_read_packet(), wsaud_write_header(), wsd_read_header(), wve_read_header(), xa_read_header(), xa_read_packet(), xma_decode_init(), xmv_process_packet_header(), xvag_read_header(), and xwma_read_header().

◆ mask

uint64_t AVChannelLayout::mask

This member must be used for AV_CHANNEL_ORDER_NATIVE, and may be used for AV_CHANNEL_ORDER_AMBISONIC to signal non-diegetic channels.

It is a bitmask, where the position of each set bit means that the AVChannel with the corresponding value is present.

I.e. when (mask & (1 << AV_CHAN_FOO)) is non-zero, then AV_CHAN_FOO is present in the layout. Otherwise it is not present.

Note
when a channel layout using a bitmask is constructed or modified manually (i.e. not using any of the av_channel_layout_* functions), the code doing it must ensure that the number of set bits is equal to nb_channels.

Definition at line 335 of file channel_layout.h.

Referenced by aiff_write_header(), ambisonic_order(), av_channel_layout_channel_from_index(), av_channel_layout_check(), av_channel_layout_compare(), av_channel_layout_describe_bprint(), av_channel_layout_from_mask(), av_channel_layout_from_string(), av_channel_layout_index_from_channel(), av_channel_layout_retype(), av_channel_layout_subset(), caf_write_header(), ff_mov_get_channel_layout_tag(), ff_put_wav_header(), flac_init(), main(), pcm_bluray_decode_frame(), pcm_bluray_encode_frame(), query_formats(), set_channel_info(), swap_channel_layouts_on_filter(), swr_build_matrix2(), and try_describe_ambisonic().

◆ map

AVChannelCustom* AVChannelLayout::map

This member must be used when the channel order is AV_CHANNEL_ORDER_CUSTOM.

It is a nb_channels-sized array, with each element signalling the presence of the AVChannel with the corresponding value in map[i].id.

I.e. when map[i].id is equal to AV_CHAN_FOO, then AV_CH_FOO is the i-th channel in the audio data.

When map[i].id is in the range between AV_CHAN_AMBISONIC_BASE and AV_CHAN_AMBISONIC_END (inclusive), the channel contains an ambisonic component with ACN index (as defined above) n = map[i].id - AV_CHAN_AMBISONIC_BASE.

map[i].name may be filled with a 0-terminated string, in which case it will be used for the purpose of identifying the channel with the convenience functions below. Otherise it must be zeroed.

Definition at line 354 of file channel_layout.h.

Referenced by ambisonic_order(), ambisonics_config(), av_channel_layout_channel_from_index(), av_channel_layout_check(), av_channel_layout_copy(), av_channel_layout_custom_init(), av_channel_layout_describe_bprint(), av_channel_layout_from_string(), av_channel_layout_index_from_channel(), av_channel_layout_index_from_string(), av_channel_layout_retype(), av_channel_layout_uninit(), canonical_order(), ff_mov_read_chan(), ff_mov_read_chnl(), has_channel_names(), masked_description(), mov_get_channel_layout(), parse_channel_list(), parse_mca_labels(), and try_describe_ambisonic().

◆ u

union { ... } AVChannelLayout::u

◆ opaque

void* AVChannelLayout::opaque

For some private data of the user.

Definition at line 360 of file channel_layout.h.

Referenced by av_channel_layout_retype().


The documentation for this struct was generated from the following file: