#include <opus.h>
#include <opus_multistream.h>
#include "libavutil/channel_layout.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "avcodec.h"
#include "bytestream.h"
#include "codec_internal.h"
#include "encode.h"
#include "libopus.h"
#include "audio_frame_queue.h"
#include "vorbis_data.h"
Go to the source code of this file.
|
static void | libopus_write_header (AVCodecContext *avctx, int stream_count, int coupled_stream_count, int mapping_family, const uint8_t *channel_mapping) |
|
static int | libopus_configure_encoder (AVCodecContext *avctx, OpusMSEncoder *enc, LibopusEncOpts *opts) |
|
static int | libopus_check_max_channels (AVCodecContext *avctx, int max_channels) |
|
static int | libopus_check_vorbis_layout (AVCodecContext *avctx, int mapping_family) |
|
static int | libopus_validate_layout_and_get_channel_map (AVCodecContext *avctx, int mapping_family, const uint8_t **channel_map_result) |
|
static av_cold int | libopus_encode_init (AVCodecContext *avctx) |
|
static void | libopus_copy_samples_with_channel_map (uint8_t *dst, const uint8_t *src, const uint8_t *channel_map, int nb_channels, int nb_samples, int bytes_per_sample) |
|
static int | libopus_encode (AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr) |
|
static av_cold int | libopus_encode_close (AVCodecContext *avctx) |
|
◆ OFFSET
◆ FLAGS
◆ libopus_write_header()
static void libopus_write_header |
( |
AVCodecContext * |
avctx, |
|
|
int |
stream_count, |
|
|
int |
coupled_stream_count, |
|
|
int |
mapping_family, |
|
|
const uint8_t * |
channel_mapping |
|
) |
| |
|
static |
◆ libopus_configure_encoder()
◆ libopus_check_max_channels()
static int libopus_check_max_channels |
( |
AVCodecContext * |
avctx, |
|
|
int |
max_channels |
|
) |
| |
|
static |
◆ libopus_check_vorbis_layout()
static int libopus_check_vorbis_layout |
( |
AVCodecContext * |
avctx, |
|
|
int |
mapping_family |
|
) |
| |
|
static |
◆ libopus_validate_layout_and_get_channel_map()
static int libopus_validate_layout_and_get_channel_map |
( |
AVCodecContext * |
avctx, |
|
|
int |
mapping_family, |
|
|
const uint8_t ** |
channel_map_result |
|
) |
| |
|
static |
◆ libopus_encode_init()
◆ libopus_copy_samples_with_channel_map()
static void libopus_copy_samples_with_channel_map |
( |
uint8_t * |
dst, |
|
|
const uint8_t * |
src, |
|
|
const uint8_t * |
channel_map, |
|
|
int |
nb_channels, |
|
|
int |
nb_samples, |
|
|
int |
bytes_per_sample |
|
) |
| |
|
static |
◆ libopus_encode()
◆ libopus_encode_close()
◆ opus_coupled_streams
const uint8_t opus_coupled_streams[8] |
|
static |
◆ opus_vorbis_channel_map
const uint8_t opus_vorbis_channel_map[8][8] |
|
static |
Initial value:= {
{ 0 },
{ 0, 1 },
{ 0, 2, 1 },
{ 0, 1, 2, 3 },
{ 0, 4, 1, 2, 3 },
{ 0, 4, 1, 2, 3, 5 },
{ 0, 4, 1, 2, 3, 5, 6 },
{ 0, 6, 1, 2, 3, 4, 5, 7 },
}
Definition at line 66 of file libopusenc.c.
Referenced by libopus_encode_init().
◆ libavcodec_libopus_channel_map
const uint8_t libavcodec_libopus_channel_map[8][8] |
|
static |
Initial value:= {
{ 0 },
{ 0, 1 },
{ 0, 1, 2 },
{ 0, 1, 2, 3 },
{ 0, 1, 3, 4, 2 },
{ 0, 1, 4, 5, 2, 3 },
{ 0, 1, 5, 6, 2, 4, 3 },
{ 0, 1, 6, 7, 4, 5, 2, 3 },
}
Definition at line 78 of file libopusenc.c.
Referenced by libopus_encode_init().
◆ libopus_options
Initial value:= {
{
"application",
"Intended application type",
OFFSET(application),
AV_OPT_TYPE_INT, { .i64 = OPUS_APPLICATION_AUDIO }, OPUS_APPLICATION_VOIP, OPUS_APPLICATION_RESTRICTED_LOWDELAY,
FLAGS, .unit =
"application" },
{
"voip",
"Favor improved speech intelligibility", 0,
AV_OPT_TYPE_CONST, { .i64 = OPUS_APPLICATION_VOIP }, 0, 0,
FLAGS, .unit =
"application" },
{
"audio",
"Favor faithfulness to the input", 0,
AV_OPT_TYPE_CONST, { .i64 = OPUS_APPLICATION_AUDIO }, 0, 0,
FLAGS, .unit =
"application" },
{
"lowdelay",
"Restrict to only the lowest delay modes, disable voice-optimized modes", 0,
AV_OPT_TYPE_CONST, { .i64 = OPUS_APPLICATION_RESTRICTED_LOWDELAY }, 0, 0,
FLAGS, .unit =
"application" },
{
"mapping_family",
"Channel Mapping Family",
OFFSET(mapping_family),
AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 255,
FLAGS, .unit =
"mapping_family" },
}
Definition at line 547 of file libopusenc.c.
◆ libopus_class
Initial value:= {
.class_name = "libopus",
}
Definition at line 566 of file libopusenc.c.
◆ libopus_defaults
Initial value:= {
{ "b", "0" },
{ "compression_level", "10" },
}
Definition at line 573 of file libopusenc.c.
◆ libopus_sample_rates
const int libopus_sample_rates[] |
|
static |
Initial value:= {
48000, 24000, 16000, 12000, 8000, 0,
}
Definition at line 579 of file libopusenc.c.
◆ ff_libopus_encoder
Initial value:= {
.p.name = "libopus",
.p.wrapper_name = "libopus",
}
Definition at line 583 of file libopusenc.c.
static const AVClass libopus_class
static int libopus_encode(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr)
#define FF_CODEC_CAP_NOT_INIT_THREADSAFE
The codec is not known to be init-threadsafe (i.e.
static av_cold int libopus_encode_init(AVCodecContext *avctx)
#define FF_CODEC_ENCODE_CB(func)
static av_cold int libopus_encode_close(AVCodecContext *avctx)
#define CODEC_LONG_NAME(str)
#define LIBAVUTIL_VERSION_INT
const char * av_default_item_name(void *ptr)
Return the context name.
static const AVOption libopus_options[]
int(* init)(AVBSFContext *ctx)
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define CODEC_SAMPLEFMTS(...)
@ AV_OPT_TYPE_FLOAT
Underlying C type is float.
@ AV_SAMPLE_FMT_S16
signed 16 bits
static const FFCodecDefault libopus_defaults[]
#define CODEC_SAMPLERATES_ARRAY(array)
@ AV_OPT_TYPE_INT
Underlying C type is int.
#define AV_CODEC_CAP_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
#define AV_CODEC_CAP_SMALL_LAST_FRAME
Codec can be fed a final frame with a smaller size.
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
static const int libopus_sample_rates[]