static picture_t *Adjust(filter_t *filter, picture_t *pic) { filter_sys_t *sys = filter->p_sys; vlc_vdp_video_field_t *f = pic->context; if (unlikely(f == NULL)) return pic; f->procamp.brightness = vlc_atomic_load_float(&sys->brightness); f->procamp.contrast = vlc_atomic_load_float(&sys->contrast); f->procamp.saturation = vlc_atomic_load_float(&sys->saturation); f->procamp.hue = vlc_atomic_load_float(&sys->hue); return pic; }
static block_t *DoPitchWork( filter_t * p_filter, block_t * p_in_buf ) { filter_sys_t *p = p_filter->p_sys; float rate_shift = vlc_atomic_load_float( &p->rate_shift ); /* Set matching rates for resampler's output and scaletempo's input */ p->resampler->fmt_out.audio.i_rate = rate_shift; p_filter->fmt_in.audio.i_rate = rate_shift; /* Change rate, thus changing pitch */ p_in_buf = p->resampler->pf_audio_filter( p->resampler, p_in_buf ); /* Change tempo while preserving shifted pitch */ return DoWork( p_filter, p_in_buf ); }
static filter_t *ResamplerCreate(filter_t *p_filter) { filter_t *p_resampler = vlc_object_create( p_filter, sizeof (filter_t) ); if( unlikely( p_resampler == NULL ) ) return NULL; p_resampler->owner.sys = NULL; p_resampler->p_cfg = NULL; p_resampler->fmt_in = p_filter->fmt_in; p_resampler->fmt_out = p_filter->fmt_in; p_resampler->fmt_out.audio.i_rate = vlc_atomic_load_float( &p_filter->p_sys->rate_shift ); aout_FormatPrepare( &p_resampler->fmt_out.audio ); p_resampler->p_module = module_need( p_resampler, "audio resampler", NULL, false ); if( p_resampler->p_module == NULL ) { msg_Err( p_filter, "Could not load resampler" ); vlc_object_release( p_resampler ); return NULL; } return p_resampler; }