31#include "config_components.h"
59 s->state = gsm_create();
68 gsm_option(
s->state, GSM_OPT_WAV49, &one);
80 gsm_destroy(
s->state);
90 uint8_t *buf = avpkt->
data;
91 int buf_size = avpkt->
size;
94 if (buf_size < avctx->block_align) {
103 samples = (int16_t *)
frame->data[0];
106 if ((ret = gsm_decode(
s->state, buf, samples)) < 0)
121 gsm_destroy(
s->state);
122 s->state = gsm_create();
124 gsm_option(
s->state, GSM_OPT_WAV49, &one);
127#if CONFIG_LIBGSM_DECODER
134 .p.wrapper_name =
"libgsm",
143#if CONFIG_LIBGSM_MS_DECODER
145 .p.name =
"libgsm_ms",
150 .p.wrapper_name =
"libgsm",
const FFCodec ff_libgsm_decoder
const FFCodec ff_libgsm_ms_decoder
static av_cold void close(AVCodecParserContext *s)
Libavcodec external API header.
#define i(width, name, range_min, range_max)
Public libavutil channel layout APIs header.
#define FF_CODEC_CAP_NOT_INIT_THREADSAFE
The codec is not known to be init-threadsafe (i.e.
#define FF_CODEC_DECODE_CB(func)
#define CODEC_LONG_NAME(str)
common internal and external API header
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
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 AV_CODEC_CAP_CHANNEL_CONF
Codec should fill in channel configuration and samplerate instead of container.
@ AV_CODEC_ID_GSM
as in Berlin toast format
#define AV_CHANNEL_LAYOUT_MONO
void av_channel_layout_uninit(AVChannelLayout *channel_layout)
Free any allocated data in the channel layout and reset the channel count to 0.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
@ AV_SAMPLE_FMT_S16
signed 16 bits
#define GSM_MS_BLOCK_SIZE
static av_cold int libgsm_decode_init(AVCodecContext *avctx)
static int libgsm_decode_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, AVPacket *avpkt)
static void libgsm_flush(AVCodecContext *avctx)
static av_cold int libgsm_decode_close(AVCodecContext *avctx)
An AVChannelLayout holds information about the channel layout of audio data.
main external API structure.
AVChannelLayout ch_layout
Audio channel layout.
enum AVSampleFormat sample_fmt
audio sample format
int sample_rate
samples per second
int block_align
number of bytes per packet if constant and known or 0 Used by some WAV based audio codecs.
int frame_size
Number of samples per channel in an audio frame.
This structure describes decoded (raw) audio or video data.
This structure stores compressed data.