FFmpeg
Data Structures | Macros | Enumerations | Functions | Variables
ffwavesynth.c File Reference
#include "libavutil/intreadwrite.h"
#include "libavutil/log.h"
#include "avcodec.h"
#include "codec_internal.h"
#include "decode.h"

Go to the source code of this file.

Data Structures

struct  ws_interval
 
struct  wavesynth_context
 

Macros

#define SIN_BITS   14
 
#define WS_MAX_CHANNELS   32
 
#define INF_TS   0x7FFFFFFFFFFFFFFF
 
#define PINK_UNIT   128
 
#define LCG_A   1284865837
 
#define LCG_C   4150755663
 
#define LCG_AI   849225893 /* A*AI = 1 [mod 1<<32] */
 

Enumerations

enum  ws_interval_type { WS_SINE = MKTAG('S','I','N','E'), WS_NOISE = MKTAG('N','O','I','S'), WS_SINE = MKTAG('S','I','N','E'), WS_NOISE = MKTAG('N','O','I','S') }
 

Functions

static uint32_t lcg_next (uint32_t *s)
 
static void lcg_seek (uint32_t *s, uint32_t dt)
 
static void pink_fill (struct wavesynth_context *ws)
 
static uint64_t frac64 (uint64_t a, uint64_t b)
 
static uint64_t phi_at (struct ws_interval *in, int64_t ts)
 
static void wavesynth_seek (struct wavesynth_context *ws, int64_t ts)
 
static int wavesynth_parse_extradata (AVCodecContext *avc)
 
static av_cold int wavesynth_init (AVCodecContext *avc)
 
static void wavesynth_synth_sample (struct wavesynth_context *ws, int64_t ts, int32_t *channels)
 
static void wavesynth_enter_intervals (struct wavesynth_context *ws, int64_t ts)
 
static int wavesynth_decode (AVCodecContext *avc, AVFrame *frame, int *rgot_frame, AVPacket *packet)
 
static av_cold int wavesynth_close (AVCodecContext *avc)
 

Variables

const FFCodec ff_ffwavesynth_decoder
 

Macro Definition Documentation

◆ SIN_BITS

#define SIN_BITS   14

Definition at line 29 of file ffwavesynth.c.

◆ WS_MAX_CHANNELS

#define WS_MAX_CHANNELS   32

Definition at line 30 of file ffwavesynth.c.

◆ INF_TS

#define INF_TS   0x7FFFFFFFFFFFFFFF

Definition at line 31 of file ffwavesynth.c.

◆ PINK_UNIT

#define PINK_UNIT   128

Definition at line 33 of file ffwavesynth.c.

◆ LCG_A

#define LCG_A   1284865837

Definition at line 107 of file ffwavesynth.c.

◆ LCG_C

#define LCG_C   4150755663

Definition at line 108 of file ffwavesynth.c.

◆ LCG_AI

#define LCG_AI   849225893 /* A*AI = 1 [mod 1<<32] */

Definition at line 109 of file ffwavesynth.c.

Enumeration Type Documentation

◆ ws_interval_type

Enumerator
WS_SINE 
WS_NOISE 
WS_SINE 
WS_NOISE 

Definition at line 78 of file ffwavesynth.c.

Function Documentation

◆ lcg_next()

static uint32_t lcg_next ( uint32_t *  s)
static

Definition at line 111 of file ffwavesynth.c.

Referenced by pink_fill(), and wavesynth_synth_sample().

◆ lcg_seek()

static void lcg_seek ( uint32_t *  s,
uint32_t  dt 
)
static

Definition at line 117 of file ffwavesynth.c.

Referenced by wavesynth_seek().

◆ pink_fill()

static void pink_fill ( struct wavesynth_context ws)
static

Definition at line 138 of file ffwavesynth.c.

Referenced by wavesynth_seek(), and wavesynth_synth_sample().

◆ frac64()

static uint64_t frac64 ( uint64_t  a,
uint64_t  b 
)
static
Returns
(1<<64) * a / b, without overflow, if a < b

Definition at line 162 of file ffwavesynth.c.

Referenced by wavesynth_parse_extradata().

◆ phi_at()

static uint64_t phi_at ( struct ws_interval in,
int64_t  ts 
)
static

Definition at line 190 of file ffwavesynth.c.

Referenced by wavesynth_parse_extradata(), and wavesynth_seek().

◆ wavesynth_seek()

static void wavesynth_seek ( struct wavesynth_context ws,
int64_t  ts 
)
static

Definition at line 198 of file ffwavesynth.c.

Referenced by wavesynth_decode(), and wavesynth_init().

◆ wavesynth_parse_extradata()

static int wavesynth_parse_extradata ( AVCodecContext avc)
static

Definition at line 235 of file ffwavesynth.c.

Referenced by wavesynth_init().

◆ wavesynth_init()

static av_cold int wavesynth_init ( AVCodecContext avc)
static

Definition at line 313 of file ffwavesynth.c.

◆ wavesynth_synth_sample()

static void wavesynth_synth_sample ( struct wavesynth_context ws,
int64_t  ts,
int32_t channels 
)
static

Definition at line 344 of file ffwavesynth.c.

Referenced by wavesynth_decode().

◆ wavesynth_enter_intervals()

static void wavesynth_enter_intervals ( struct wavesynth_context ws,
int64_t  ts 
)
static

Definition at line 391 of file ffwavesynth.c.

Referenced by wavesynth_decode().

◆ wavesynth_decode()

static int wavesynth_decode ( AVCodecContext avc,
AVFrame frame,
int rgot_frame,
AVPacket packet 
)
static

Definition at line 416 of file ffwavesynth.c.

◆ wavesynth_close()

static av_cold int wavesynth_close ( AVCodecContext avc)
static

Definition at line 453 of file ffwavesynth.c.

Variable Documentation

◆ ff_ffwavesynth_decoder

const FFCodec ff_ffwavesynth_decoder
Initial value:
= {
.p.name = "wavesynth",
CODEC_LONG_NAME("Wave synthesis pseudo-codec"),
.p.type = AVMEDIA_TYPE_AUDIO,
.priv_data_size = sizeof(struct wavesynth_context),
.close = wavesynth_close,
.p.capabilities = AV_CODEC_CAP_DR1,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
}

Definition at line 462 of file ffwavesynth.c.

FF_CODEC_CAP_INIT_CLEANUP
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
Definition: codec_internal.h:42
AV_CODEC_ID_FFWAVESYNTH
@ AV_CODEC_ID_FFWAVESYNTH
Definition: codec_id.h:508
FF_CODEC_DECODE_CB
#define FF_CODEC_DECODE_CB(func)
Definition: codec_internal.h:287
wavesynth_decode
static int wavesynth_decode(AVCodecContext *avc, AVFrame *frame, int *rgot_frame, AVPacket *packet)
Definition: ffwavesynth.c:416
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
wavesynth_context
Definition: ffwavesynth.c:93
CODEC_LONG_NAME
#define CODEC_LONG_NAME(str)
Definition: codec_internal.h:272
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts.c:365
AV_CODEC_CAP_DR1
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
Definition: codec.h:52
wavesynth_init
static av_cold int wavesynth_init(AVCodecContext *avc)
Definition: ffwavesynth.c:313
wavesynth_close
static av_cold int wavesynth_close(AVCodecContext *avc)
Definition: ffwavesynth.c:453