![]() |
UltraGrid
UltraGrid Low-Latency High-Resolution Transmission System
|
#include "debug.h"#include "lib_common.h"#include <inttypes.h>#include <libavcodec/avcodec.h>#include <libavutil/channel_layout.h>#include <libavutil/mem.h>#include <stddef.h>#include "audio/audio.h"#include "audio/codec.h"#include "audio/utils.h"#include "libavcodec/lavc_common.h"#include "utils/color_out.h"#include "utils/macros.h"#include "utils/string.h"#include "utils/text.h"
Go to the source code of this file.
Classes | |
| struct | codec_param |
| struct | libavcodec_codec_state |
| reallocate tmp_buffer if requested size is greater than currently allocated size More... | |
Macros | |
| #define | __STDC_CONSTANT_MACROS |
| #define | LOW_LATENCY_AUDIOENC_FRAME_DURATION 2.5 |
| #define | MAGIC 0xb135ca11 |
| #define | MOD_NAME "[lavcd aud.] " |
Enumerations | |
| enum | { TMP_DATA_LEN = 1024 * 1024 } |
Functions | |
| ADD_TO_PARAM ("audio-lavc-decoder", "* audio-lavc-decoder=<decoder_name>\n" " Use selected audio lavc decoder\n") | |
| ADD_TO_PARAM ("audio-lavc-encoder", "* audio-lavc-encoder=<encoder_name>\n" " Use selected audio lavc encoder\n") | |
| ADD_TO_PARAM ("audioenc-frame-duration", "* audioenc-frame-duration=<ms>\n" " Sets audio encoder frame duration (in ms), default is " TOSTRING(LOW_LATENCY_AUDIOENC_FRAME_DURATION) " ms for low-latency-audio\n") | |
| static void | append (char *dst, size_t dst_len, const char *name, bool prefered) |
| static int | check_sample_fmt (const AVCodec *codec, enum AVSampleFormat sample_fmt) |
| static void | cleanup_common (struct libavcodec_codec_state *s) |
| static int | get_bitrate (struct libavcodec_codec_state *s) |
| static void | get_encoders_decoders (enum AVCodecID id, const char *prefenc, char *buf, size_t buflen) |
| static int64_t | get_in_ts (const audio_channel *channel, int cached_samples) |
| static const struct AVCodec * | init_decoder (enum AVCodecID codec_id) |
| static const struct AVCodec * | init_encoder (enum AVCodecID codec_id, const char *preferred_encoder, bool silent) |
| static audio_channel * | libavcodec_compress (void *, audio_channel *) |
| static audio_channel * | libavcodec_decompress (void *, audio_channel *) |
| static void | libavcodec_done (void *) |
| static const char * | libavcodec_get_codec_desc (void *state, size_t buflen, char *buffer) |
| static const int * | libavcodec_get_sample_rates (void *state) |
| static void * | libavcodec_init (audio_codec_t audio_codec, audio_codec_direction_t direction, bool silent, int bitrate) |
| static void | print_libav_audio_error (int verbosity, const char *msg, int rc) |
| static bool | process_input (struct libavcodec_codec_state *s, const audio_channel *channel) |
| REGISTER_MODULE (libavcodec, &libavcodec_audio_codec, LIBRARY_CLASS_AUDIO_COMPRESS, AUDIO_COMPRESS_ABI_VERSION) | |
| static bool | reinitialize_decoder (struct libavcodec_codec_state *s, struct audio_desc desc) |
| static bool | reinitialize_encoder (struct libavcodec_codec_state *s, struct audio_desc desc) |
| static void | resize_tmp_buffer (unsigned char **tmp_buffer, size_t *cur_size, size_t new_size) |
| static void | set_out_ts (int recv_ret, struct libavcodec_codec_state *s) |
| static void | write_out_data (struct libavcodec_codec_state *s) |
Variables | |
| static const struct audio_compress_info | libavcodec_audio_codec |
| static const struct codec_param | mapping [AC_COUNT] |
| static const audio_codec_t | supported_codecs [] = { AC_ALAW, AC_MULAW, AC_SPEEX, AC_OPUS, AC_G722, AC_FLAC, AC_MP3, AC_AAC, AC_NONE } |
Definition in file libavcodec.c.
| #define __STDC_CONSTANT_MACROS |
Definition at line 38 of file libavcodec.c.
| #define LOW_LATENCY_AUDIOENC_FRAME_DURATION 2.5 |
Definition at line 65 of file libavcodec.c.
| #define MAGIC 0xb135ca11 |
Definition at line 64 of file libavcodec.c.
Referenced by libavcodec_compress(), libavcodec_decompress(), libavcodec_done(), and libavcodec_init().
| #define MOD_NAME "[lavcd aud.] " |
Definition at line 70 of file libavcodec.c.
Referenced by check_av_opt_set(), check_duration(), check_first_sps_vps(), cleanup_common(), configure_with(), decode_frame(), get_format_callback(), get_usable_decoders(), handle_lavd_error(), init_decoder(), init_encoder(), libavcodec_decompress(), libavcodec_decompress(), libavcodec_init(), read_forced_pixfmt(), reconfigure_convert_if_needed(), reinitialize_decoder(), reinitialize_encoder(), and set_codec_context_params().
| anonymous enum |
| Enumerator | |
|---|---|
| TMP_DATA_LEN | |
Definition at line 67 of file libavcodec.c.
| ADD_TO_PARAM | ( | "audio-lavc-decoder" | ) |
| ADD_TO_PARAM | ( | "audio-lavc-encoder" | ) |
| ADD_TO_PARAM | ( | "audioenc-frame-duration" | , |
| "* audioenc-frame- | duration = <ms>\n" " Sets audio encoder frame duration (in ms), | ||
| default is " TOSTRING(LOW_LATENCY_AUDIOENC_FRAME_DURATION) " ms for low-latency-audio\n" | ) |
|
static |
Definition at line 788 of file libavcodec.c.
References name, strappend(), TERM_BOLD, and TERM_RESET.
Referenced by get_encoders_decoders().

|
static |
Definition at line 302 of file libavcodec.c.
Referenced by reinitialize_encoder().
|
static |
Definition at line 742 of file libavcodec.c.
References AUDIO_DECODER, libavcodec_codec_state::av_frame, libavcodec_codec_state::codec_ctx, lavd_flush(), LOG_LEVEL_WARNING, log_msg(), MOD_NAME, and libavcodec_codec_state::pkt.
Referenced by libavcodec_done(), reinitialize_decoder(), and reinitialize_encoder().

|
static |
Definition at line 316 of file libavcodec.c.
References libavcodec_codec_state::codec, codec_param::default_bitrate, mapping, and MSG.
Referenced by reinitialize_encoder().
|
static |
Definition at line 803 of file libavcodec.c.
References append(), decoders, codec::name, and STR_LEN.
Referenced by libavcodec_get_codec_desc().

|
static |
Definition at line 561 of file libavcodec.c.
References kHz90, audio_channel::sample_rate, audio_channel::timestamp, and ts.
Referenced by libavcodec_compress().
|
static |
Definition at line 192 of file libavcodec.c.
References EXIT_FAIL_USAGE, get_commandline_param(), handle_error(), LOG_LEVEL_ERROR, log_msg(), and MOD_NAME.
Referenced by libavcodec_init().

|
static |
Definition at line 145 of file libavcodec.c.
References get_commandline_param(), LOG_LEVEL_INFO, LOG_LEVEL_WARNING, log_msg(), MOD_NAME, and MSG.
Referenced by libavcodec_init().

|
static |
fprintf(stderr, "%d %d\n", i++% 2, s->output_channel.data_len);
Definition at line 598 of file libavcodec.c.
References libavcodec_codec_state::av_frame, libavcodec_codec_state::codec, libavcodec_codec_state::codec_ctx, audio_channel::data, audio_channel::data_len, get_in_ts(), LOG_LEVEL_ERROR, LOG_LEVEL_WARNING, MAGIC, libavcodec_codec_state::magic, MSG, offset, libavcodec_codec_state::pkt, print_libav_audio_error(), process_input(), set_out_ts(), signed2unsigned(), state, libavcodec_codec_state::tmp, and write_out_data().

|
static |
Definition at line 666 of file libavcodec.c.
References audio_desc_eq(), audio_desc_from_audio_channel(), libavcodec_codec_state::av_frame, channels, libavcodec_codec_state::codec_ctx, audio_channel::data, audio_channel::data_len, float2int(), LOG_LEVEL_ERROR, log_msg(), MAGIC, libavcodec_codec_state::magic, MOD_NAME, libavcodec_codec_state::pkt, print_decoder_error(), reinitialize_decoder(), resize_tmp_buffer(), libavcodec_codec_state::saved_desc, signed2unsigned(), and state.

|
static |
Definition at line 771 of file libavcodec.c.
References libavcodec_codec_state::av_frame, cleanup_common(), MAGIC, libavcodec_codec_state::magic, libavcodec_codec_state::pkt, and state.

|
static |
Definition at line 842 of file libavcodec.c.
References AC_SPEEX, libavcodec_codec_state::codec, get_encoders_decoders(), codec_param::id, mapping, codec_param::preferred_encoder, state, strappend(), libavcodec_codec_state::tmp, and TYELLOW.

|
static |
Definition at line 735 of file libavcodec.c.
References libavcodec_codec_state::codec, and state.
|
static |
Initializates selected audio codec
| audio_codec | requested audio codec |
| direction | which direction will be used (encoding or decoding) |
| silent | if true no error messages will be printed. This is intended for checking which codecs are present |
| NULL | if initialization failed |
| !=NULL | codec state |
Definition at line 228 of file libavcodec.c.
References AC_PCM, AUDIO_CODER, libavcodec_codec_state::av_frame, libavcodec_codec_state::codec, libavcodec_codec_state::codec_ctx, audio_channel::data, get_commandline_param(), get_name_to_audio_codec(), codec_param::id, init_decoder(), init_encoder(), LOG_LEVEL_ERROR, LOG_LEVEL_NOTICE, log_msg(), MAGIC, libavcodec_codec_state::magic, mapping, MOD_NAME, libavcodec_codec_state::pkt, codec_param::preferred_encoder, libavcodec_codec_state::tmp, and ug_set_av_logging().

|
static |
Definition at line 137 of file libavcodec.c.
References log_msg().
Referenced by libavcodec_compress().

|
static |
Definition at line 503 of file libavcodec.c.
References audio_desc_eq(), audio_desc_from_audio_channel(), audio_channel::bps, audio_desc::bps, change_bps(), libavcodec_codec_state::codec_ctx, audio_channel::data, audio_channel::data_len, int2float(), MSG, reinitialize_encoder(), resize_tmp_buffer(), libavcodec_codec_state::saved_desc, libavcodec_codec_state::tmp, and TMP_DATA_LEN.
Referenced by libavcodec_compress().

| REGISTER_MODULE | ( | libavcodec | , |
| & | libavcodec_audio_codec, | ||
| LIBRARY_CLASS_AUDIO_COMPRESS | , | ||
| AUDIO_COMPRESS_ABI_VERSION | ) |
|
static |
Definition at line 472 of file libavcodec.c.
References AVCODECCTX_CHANNELS, cleanup_common(), libavcodec_codec_state::codec, libavcodec_codec_state::codec_ctx, desc, LOG_LEVEL_ERROR, log_msg(), MOD_NAME, and libavcodec_codec_state::saved_desc.
Referenced by libavcodec_decompress().

|
static |
Definition at line 331 of file libavcodec.c.
References AVCODECCTX_CHANNELS, check_sample_fmt(), cleanup_common(), libavcodec_codec_state::codec, libavcodec_codec_state::codec_ctx, count, desc, get_bitrate(), LOG_LEVEL_ERROR, log_msg(), and MOD_NAME.
Referenced by process_input().

|
static |
Definition at line 123 of file libavcodec.c.
Referenced by libavcodec_decompress(), and process_input().
|
static |
Definition at line 571 of file libavcodec.c.
References libavcodec_codec_state::codec_ctx, kHz90, and libavcodec_codec_state::pkt.
Referenced by libavcodec_compress().
|
static |
Definition at line 583 of file libavcodec.c.
References libavcodec_codec_state::codec_ctx, MSG, libavcodec_codec_state::pkt, and TMP_DATA_LEN.
Referenced by libavcodec_compress().
|
static |
Definition at line 861 of file libavcodec.c.
|
static |
Definition at line 87 of file libavcodec.c.
Referenced by delta_set_nb_channels(), get_bitrate(), device_state::init(), libavcodec_get_codec_desc(), libavcodec_init(), map_cuda_memcpy_kind(), parse_log_cfg(), and response_status_to_text().