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

xine-lib 1.2.12

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

## Data Structures
struct | stretchscr_s
struct | stretch_parameters_s

## Macros
#define | AUDIO_FRAGMENT 120/1000 /* ms of audio */
#define | CLIP_INT16(s)

## Typedefs
typedef struct stretchscr_s | stretchscr_t
typedef struct post_plugin_stretch_s | post_plugin_stretch_t
typedef struct stretch_parameters_s | stretch_parameters_t

## Functions
static int | stretchscr_get_priority (scr_plugin_t *scr)
static void | stretchscr_set_pivot (stretchscr_t *this)
static int | stretchscr_set_speed (scr_plugin_t *scr, int speed)
static void | stretchscr_adjust (scr_plugin_t *scr, int64_t vpts)
static void | stretchscr_start (scr_plugin_t *scr, int64_t start_vpts)
static int64_t | stretchscr_get_current (scr_plugin_t *scr)
static void | stretchscr_exit (scr_plugin_t *scr)
static stretchscr_t * | stretchscr_init (double *stretch_factor)
| PARAM_ITEM (POST_PARAM_TYPE_BOOL, preserve_pitch, PARAM_ITEM(NULL, PARAM_ITEM(0, 1, PARAM_ITEM(0, "Preserve pitch")
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 | stretch_port_open (xine_audio_port_t *port_gen, xine_stream_t *stream, uint32_t bits, uint32_t rate, int mode)
static void | stretch_port_close (xine_audio_port_t *port_gen, xine_stream_t *stream)
static void | stretch_process_fragment (post_audio_port_t *port, xine_stream_t *stream, extra_info_t *extra_info)
static void | stretch_port_put_buffer (xine_audio_port_t *port_gen, audio_buffer_t *buf, xine_stream_t *stream)
static void | stretch_dispose (post_plugin_t *this_gen)
static post_plugin_t * | stretch_open_plugin (post_class_t *class_gen, int inputs, xine_audio_port_t **audio_target, xine_video_port_t **video_target)
void * | stretch_init_plugin (xine_t *xine, const void *data)

## Macro Definition Documentation

## ◆ AUDIO_FRAGMENT

#define AUDIO_FRAGMENT 120/1000 /* ms of audio */

## ◆ CLIP_INT16

#define CLIP_INT16 | ( |  | s | ) |

Value:
((s) < INT16_MIN) ? INT16_MIN : \
(((s) > INT16_MAX) ? INT16_MAX : (s))
INT16_MAX
#define INT16_MAX
Definition: goomsl_lex.c:65
INT16_MIN
#define INT16_MIN
Definition: goomsl_lex.c:56

## Typedef Documentation

## ◆ post_plugin_stretch_t

typedef struct post_plugin_stretch_s post_plugin_stretch_t

## ◆ stretch_parameters_t

typedef struct stretch_parameters_s stretch_parameters_t

## ◆ stretchscr_t

typedef struct stretchscr_s stretchscr_t

## Function Documentation

## ◆ get_help()

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

References _.

Referenced by stretch_open_plugin().

## ◆ get_param_descr()

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

Referenced by stretch_open_plugin().

## ◆ get_parameters()

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

Referenced by stretch_open_plugin().

## ◆ PARAM_ITEM()

PARAM_ITEM | ( | POST_PARAM_TYPE_BOOL | ,
|  | preserve_pitch | ,
|  | PARAM_ITEM( | NULL,
|  | PARAM_ITEM( | 0,
|  | 1 | ,
|  | PARAM_ITEM( | 0,
|  | "Preserve pitch" |
| ) |  |

References _ftype_t, and RESAMPLE_MAX_CHANNELS.

## ◆ set_parameters()

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

Referenced by stretch_open_plugin().

## ◆ stretch_dispose()

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

References _x_post_dispose().

Referenced by stretch_open_plugin().

## ◆ stretch_init_plugin()

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

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

## ◆ stretch_open_plugin()

static post_plugin_t * stretch_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(), xine_post_in_s::name, post_audio_port_s::new_port, NULL, xine_audio_port_s::open, stretch_parameters_s::preserve_pitch, xine_audio_port_s::put_buffer, set_parameters(), xine_post_api_t::set_parameters, stretch_dispose(), stretch_port_close(), stretch_port_open(), stretch_port_put_buffer(), xine_list_push_back(), and XINE_POST_DATA_PARAMETERS.

Referenced by stretch_init_plugin().

## ◆ stretch_port_close()

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

References _x_freep(), _x_post_dec_usage, xine_s::clock, xine_audio_port_s::close, NULL, post_audio_port_s::original_port, post_audio_port_s::post, post_audio_port_s::stream, metronom_clock_s::unregister_scr, and xine_stream_s::xine.

Referenced by stretch_open_plugin().

## ◆ stretch_port_open()

static int stretch_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, xine_s::clock, metronom_clock_s::get_current_time, 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, metronom_clock_s::register_scr, post_audio_port_s::stream, stretchscr_init(), and xine_stream_s::xine.

Referenced by stretch_open_plugin().

## ◆ stretch_port_put_buffer()

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

References _ftype_t, _x_ao_mode2channels(), AUDIO_FRAGMENT, post_audio_port_s::bits, audio_buffer_s::extra_info, audio_buffer_s::mem, xine_stream_s::metronom, post_audio_port_s::mode, NULL, audio_buffer_s::num_frames, post_audio_port_s::original_port, post_audio_port_s::post, xine_audio_port_s::put_buffer, post_audio_port_s::rate, metronom_s::set_audio_rate, stretch_process_fragment(), stretchscr_set_speed(), triang(), and audio_buffer_s::vpts.

Referenced by stretch_open_plugin().

## ◆ stretch_process_fragment()

static void stretch_process_fragment | ( | post_audio_port_t * | port,
|  | xine_stream_t * | stream,
|  | extra_info_t * | extra_info
| ) |  |
| static

References _ftype_t, _x_audio_out_resample_mono(), _x_audio_out_resample_stereo(), _x_extra_info_merge(), post_audio_port_s::bits, CLIP_INT16, xine_audio_port_s::get_buffer, post_audio_port_s::mode, audio_buffer_s::num_frames, post_audio_port_s::original_port, post_audio_port_s::post, xine_audio_port_s::put_buffer, and post_audio_port_s::rate.

Referenced by stretch_port_put_buffer().

## ◆ stretchscr_adjust()

static void stretchscr_adjust | ( | scr_plugin_t * | scr,
|  | int64_t | vpts
| ) |  |
| static

References NULL, and xine_monotonic_clock().

Referenced by stretchscr_init().

## ◆ stretchscr_exit()

static void stretchscr_exit | ( | scr_plugin_t * | scr | ) |
| static

Referenced by stretchscr_init().

## ◆ stretchscr_get_current()

static int64_t stretchscr_get_current | ( | scr_plugin_t * | scr | ) |
| static

References NULL, and xine_monotonic_clock().

Referenced by stretchscr_init().

## ◆ stretchscr_get_priority()

static int stretchscr_get_priority | ( | scr_plugin_t * | scr | ) |
| static

References stretchscr_s::scr.

Referenced by stretchscr_init().

## ◆ stretchscr_init()

static stretchscr_t * stretchscr_init | ( | double * | stretch_factor | ) |
| static

References NULL, stretchscr_adjust(), stretchscr_exit(), stretchscr_get_current(), stretchscr_get_priority(), stretchscr_set_speed(), stretchscr_start(), and XINE_SPEED_PAUSE.

Referenced by stretch_port_open().

## ◆ stretchscr_set_pivot()

static void stretchscr_set_pivot | ( | stretchscr_t * | this | ) |
| static

References NULL, and xine_monotonic_clock().

Referenced by stretchscr_set_speed().

## ◆ stretchscr_set_speed()

static int stretchscr_set_speed | ( | scr_plugin_t * | scr,
|  | int | speed
| ) |  |
| static

References stretchscr_set_pivot(), and XINE_FINE_SPEED_NORMAL.

Referenced by stretch_port_put_buffer(), stretchscr_init(), and stretchscr_start().

## ◆ stretchscr_start()

static void stretchscr_start | ( | scr_plugin_t * | scr,
|  | int64_t | start_vpts
| ) |  |
| static

References NULL, stretchscr_set_speed(), XINE_FINE_SPEED_NORMAL, and xine_monotonic_clock().

Referenced by stretchscr_init().