xine-lib: xine-lib-1.2.12/src/post/audio/volnorm.c File Reference

xine-lib 1.2.12

Data Structures | Macros | Typedefs | Functions
volnorm.c File Reference
`#include <stdio.h>`
`#include <math.h>`
`#include <pthread.h>`
`#include <xine/xine_internal.h>`
`#include <xine/xineutils.h>`
`#include <xine/post.h>`
`#include "dsp.h"`
`#include "audio_filters.h"`

## Data Structures
struct | volnorm_parameters_s
struct | post_plugin_volnorm_s

## Macros
#define | NSAMPLES 128
#define | MIN_SAMPLE_SIZE 32000
#define | MUL_INIT 1.0
#define | MUL_MIN 0.1
#define | MUL_MAX 5.0
#define | MID_S16 (SHRT_MAX * 0.25)
#define | MID_FLOAT (INT_MAX * 0.25)
#define | SIL_S16 (SHRT_MAX * 0.01)
#define | SIL_FLOAT (INT_MAX * 0.01)
#define | SMOOTH_MUL 0.06
#define | SMOOTH_LASTAVG 0.06
#define | clamp(a, min, max) (((a)>(max))?(max):(((a)<(min))?(min):(a)))

## Typedefs
typedef struct post_plugin_volnorm_s | post_plugin_volnorm_t
typedef struct volnorm_parameters_s | volnorm_parameters_t

## Functions
static int | set_parameters (xine_post_t *this_gen, const void *param_gen)
static int | get_parameters (xine_post_t *this_gen, void *param_gen)
static xine_post_api_descr_t * | get_param_descr (void)
static char * | get_help (void)
static int | volnorm_port_open (xine_audio_port_t *port_gen, xine_stream_t *stream, uint32_t bits, uint32_t rate, int mode)
static void | volnorm_port_close (xine_audio_port_t *port_gen, xine_stream_t *stream)
static void | method1_int16 (post_plugin_volnorm_t *this, audio_buffer_t *buf)
static void | method1_float (post_plugin_volnorm_t *this, audio_buffer_t *buf)
static void | method2_int16 (post_plugin_volnorm_t *this, audio_buffer_t *buf)
static void | method2_float (post_plugin_volnorm_t *this, audio_buffer_t *buf)
static void | volnorm_port_put_buffer (xine_audio_port_t *port_gen, audio_buffer_t *buf, xine_stream_t *stream)
static void | volnorm_dispose (post_plugin_t *this_gen)
static post_plugin_t * | volnorm_open_plugin (post_class_t *class_gen, int inputs, xine_audio_port_t **audio_target, xine_video_port_t **video_target)
void * | volnorm_init_plugin (xine_t *xine, const void *data)

## Macro Definition Documentation

## ◆ clamp

#define clamp | ( |  | a,
|  |  | min,
|  |  | max
| ) |  | (((a)>(max))?(max):(((a)<(min))?(min):(a)))

## ◆ MID_FLOAT

#define MID_FLOAT (INT_MAX * 0.25)

## ◆ MID_S16

#define MID_S16 (SHRT_MAX * 0.25)

## ◆ MIN_SAMPLE_SIZE

#define MIN_SAMPLE_SIZE 32000

## ◆ MUL_INIT

#define MUL_INIT 1.0

## ◆ MUL_MAX

#define MUL_MAX 5.0

## ◆ MUL_MIN

#define MUL_MIN 0.1

## ◆ NSAMPLES

#define NSAMPLES 128

## ◆ SIL_FLOAT

#define SIL_FLOAT (INT_MAX * 0.01)

## ◆ SIL_S16

#define SIL_S16 (SHRT_MAX * 0.01)

## ◆ SMOOTH_LASTAVG

#define SMOOTH_LASTAVG 0.06

## ◆ SMOOTH_MUL

#define SMOOTH_MUL 0.06

## Typedef Documentation

## ◆ post_plugin_volnorm_t

typedef struct post_plugin_volnorm_s post_plugin_volnorm_t

## ◆ volnorm_parameters_t

typedef struct volnorm_parameters_s volnorm_parameters_t

## Function Documentation

## ◆ get_help()

static char * get_help | ( | void |  | ) |
| static

References _.

Referenced by volnorm_open_plugin().

## ◆ get_param_descr()

static xine_post_api_descr_t * get_param_descr | ( | void |  | ) |
| static

Referenced by volnorm_open_plugin().

## ◆ get_parameters()

static int get_parameters | ( | xine_post_t * | this_gen,
|  | void * | param_gen
| ) |  |
| static

References volnorm_parameters_s::method.

Referenced by volnorm_open_plugin().

## ◆ method1_float()

static void method1_float | ( | post_plugin_volnorm_t * | this,
|  | audio_buffer_t * | buf
| ) |  |
| static

References clamp, audio_buffer_s::mem, audio_buffer_s::mem_size, MID_FLOAT, MUL_MAX, MUL_MIN, SIL_FLOAT, SMOOTH_LASTAVG, and SMOOTH_MUL.

Referenced by volnorm_port_put_buffer().

## ◆ method1_int16()

static void method1_int16 | ( | post_plugin_volnorm_t * | this,
|  | audio_buffer_t * | buf
| ) |  |
| static

References clamp, audio_buffer_s::mem, audio_buffer_s::mem_size, MID_S16, MUL_MAX, MUL_MIN, SIL_S16, SMOOTH_LASTAVG, and SMOOTH_MUL.

Referenced by volnorm_port_put_buffer().

## ◆ method2_float()

static void method2_float | ( | post_plugin_volnorm_t * | this,
|  | audio_buffer_t * | buf
| ) |  |
| static

References avg, clamp, audio_buffer_s::mem, audio_buffer_s::mem_size, MID_FLOAT, MIN_SAMPLE_SIZE, MUL_MAX, MUL_MIN, NSAMPLES, and SIL_FLOAT.

Referenced by volnorm_port_put_buffer().

## ◆ method2_int16()

static void method2_int16 | ( | post_plugin_volnorm_t * | this,
|  | audio_buffer_t * | buf
| ) |  |
| static

References avg, clamp, audio_buffer_s::mem, audio_buffer_s::mem_size, MID_S16, MIN_SAMPLE_SIZE, MUL_MAX, MUL_MIN, NSAMPLES, and SIL_S16.

Referenced by volnorm_port_put_buffer().

## ◆ set_parameters()

static int set_parameters | ( | xine_post_t * | this_gen,
|  | const void * | param_gen
| ) |  |
| static

References volnorm_parameters_s::method.

Referenced by volnorm_open_plugin().

## ◆ volnorm_dispose()

static void volnorm_dispose | ( | post_plugin_t * | this_gen | ) |
| static

References _x_post_dispose().

Referenced by volnorm_open_plugin().

## ◆ volnorm_init_plugin()

void * volnorm_init_plugin | ( | xine_t * | xine,
|  | const void * | data
| ) |  |

References N_, NULL, post_class_s::open_plugin, and volnorm_open_plugin().

## ◆ volnorm_open_plugin()

static post_plugin_t * volnorm_open_plugin | ( | post_class_t * | class_gen,
|  | int | inputs,
|  | xine_audio_port_t ** | audio_target,
|  | xine_video_port_t ** | video_target
| ) |  |
| static

References _x_post_init(), _x_post_intercept_audio_port(), xine_audio_port_s::close, get_help(), get_param_descr(), get_parameters(), input(), MID_S16, MUL_INIT, xine_post_in_s::name, post_audio_port_s::new_port, NULL, xine_audio_port_s::open, xine_audio_port_s::put_buffer, set_parameters(), xine_post_api_t::set_parameters, volnorm_dispose(), volnorm_port_close(), volnorm_port_open(), volnorm_port_put_buffer(), xine_list_push_back(), and XINE_POST_DATA_PARAMETERS.

Referenced by volnorm_init_plugin().

## ◆ volnorm_port_close()

static void volnorm_port_close | ( | xine_audio_port_t * | port_gen,
|  | xine_stream_t * | stream
| ) |  |
| static

References _x_post_dec_usage, xine_audio_port_s::close, NULL, post_audio_port_s::original_port, and post_audio_port_s::stream.

Referenced by volnorm_open_plugin().

## ◆ volnorm_port_open()

static int volnorm_port_open | ( | xine_audio_port_t * | port_gen,
|  | xine_stream_t * | stream,
|  | uint32_t | bits,
|  | uint32_t | rate,
|  | int | mode
| ) |  |
| static

References _x_post_inc_usage, _x_post_rewire(), post_audio_port_s::bits, bits, post_audio_port_s::mode, mode(), xine_audio_port_s::open, post_audio_port_s::original_port, post_audio_port_s::post, post_audio_port_s::rate, and post_audio_port_s::stream.

Referenced by volnorm_open_plugin().

## ◆ volnorm_port_put_buffer()

static void volnorm_port_put_buffer | ( | xine_audio_port_t * | port_gen,
|  | audio_buffer_t * | buf,
|  | xine_stream_t * | stream
| ) |  |
| static

References ao_format_s::bits, audio_buffer_s::format, method1_float(), method1_int16(), method2_float(), method2_int16(), post_audio_port_s::original_port, post_audio_port_s::post, and xine_audio_port_s::put_buffer.

Referenced by volnorm_open_plugin().