1 /*****************************************************************************
2 * headphone.c : headphone virtual spatialization channel mixer module
3 * -> gives the feeling of a real room with a simple headphone
4 *****************************************************************************
5 * Copyright (C) 2002-2006 the VideoLAN team
8 * Authors: Boris Dorès <babal@via.ecp.fr>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23 *****************************************************************************/
25 /*****************************************************************************
27 *****************************************************************************/
28 #include <math.h> /* sqrt */
32 #include <vlc_filter.h>
33 #include <vlc_block.h>
35 /*****************************************************************************
37 *****************************************************************************/
38 static int Create ( vlc_object_t * );
39 static void Destroy ( vlc_object_t * );
41 static void DoWork ( aout_instance_t *, aout_filter_t *, aout_buffer_t *,
45 static int OpenFilter ( vlc_object_t * );
46 static void CloseFilter( vlc_object_t * );
47 static block_t *Convert( filter_t *, block_t * );
49 /*****************************************************************************
51 *****************************************************************************/
52 #define MODULE_DESCRIPTION N_ ( \
53 "This effect gives you the feeling that you are standing in a room " \
54 "with a complete 7.1 speaker set when using only a headphone, " \
55 "providing a more realistic sound experience. It should also be " \
56 "more comfortable and less tiring when listening to music for " \
57 "long periods of time.\nIt works with any source format from mono " \
60 #define HEADPHONE_DIM_TEXT N_("Characteristic dimension")
61 #define HEADPHONE_DIM_LONGTEXT N_( \
62 "Distance between front left speaker and listener in meters.")
64 #define HEADPHONE_COMPENSATE_TEXT N_("Compensate delay")
65 #define HEADPHONE_COMPENSATE_LONGTEXT N_( \
66 "The delay which is introduced by the physical algorithm may "\
67 "sometimes be disturbing for the synchronization between lips-movement "\
68 "and speech. In case, turn this on to compensate.")
70 #define HEADPHONE_DOLBY_TEXT N_("No decoding of Dolby Surround")
71 #define HEADPHONE_DOLBY_LONGTEXT N_( \
72 "Dolby Surround encoded streams won't be decoded before being " \
73 "processed by this filter. Enabling this setting is not recommended.")
76 set_description( _("Headphone virtual spatialization effect") );
77 set_shortname( _("Headphone effect") );
78 set_help( MODULE_DESCRIPTION );
79 set_category( CAT_AUDIO );
80 set_subcategory( SUBCAT_AUDIO_AFILTER );
82 add_integer( "headphone-dim", 10, NULL, HEADPHONE_DIM_TEXT,
83 HEADPHONE_DIM_LONGTEXT, VLC_FALSE );
84 add_bool( "headphone-compensate", 0, NULL, HEADPHONE_COMPENSATE_TEXT,
85 HEADPHONE_COMPENSATE_LONGTEXT, VLC_TRUE );
86 add_bool( "headphone-dolby", 0, NULL, HEADPHONE_DOLBY_TEXT,
87 HEADPHONE_DOLBY_LONGTEXT, VLC_TRUE );
89 set_capability( "audio filter", 0 );
90 set_callbacks( Create, Destroy );
91 add_shortcut( "headphone" );
95 set_description( _("Headphone virtual spatialization effect") );
96 set_capability( "audio filter2", 0 );
97 set_callbacks( OpenFilter, CloseFilter );
101 /*****************************************************************************
102 * Internal data structures
103 *****************************************************************************/
104 struct atomic_operation_t
106 int i_source_channel_offset;
107 int i_dest_channel_offset;
108 unsigned int i_delay;/* in sample unit */
109 double d_amplitude_factor;
112 struct aout_filter_sys_t
114 size_t i_overflow_buffer_size;/* in bytes */
115 byte_t * p_overflow_buffer;
116 unsigned int i_nb_atomic_operations;
117 struct atomic_operation_t * p_atomic_operations;
122 size_t i_overflow_buffer_size;/* in bytes */
123 byte_t * p_overflow_buffer;
124 unsigned int i_nb_atomic_operations;
125 struct atomic_operation_t * p_atomic_operations;
128 /*****************************************************************************
129 * Init: initialize internal data structures
130 * and computes the needed atomic operations
131 *****************************************************************************/
132 /* x and z represent the coordinates of the virtual speaker
133 * relatively to the center of the listener's head, measured in meters :
142 * rear left rear right
146 static void ComputeChannelOperations( struct aout_filter_sys_t * p_data
147 , unsigned int i_rate, unsigned int i_next_atomic_operation
148 , int i_source_channel_offset, double d_x, double d_z
149 , double d_compensation_length, double d_channel_amplitude_factor )
151 double d_c = 340; /*sound celerity (unit: m/s)*/
152 double d_compensation_delay = (d_compensation_length-0.1) / d_c * i_rate;
155 p_data->p_atomic_operations[i_next_atomic_operation]
156 .i_source_channel_offset = i_source_channel_offset;
157 p_data->p_atomic_operations[i_next_atomic_operation]
158 .i_dest_channel_offset = 0;/* left */
159 p_data->p_atomic_operations[i_next_atomic_operation]
160 .i_delay = (int)( sqrt( (-0.1-d_x)*(-0.1-d_x) + (0-d_z)*(0-d_z) )
161 / d_c * i_rate - d_compensation_delay );
164 p_data->p_atomic_operations[i_next_atomic_operation]
165 .d_amplitude_factor = d_channel_amplitude_factor * 1.1 / 2;
169 p_data->p_atomic_operations[i_next_atomic_operation]
170 .d_amplitude_factor = d_channel_amplitude_factor * 0.9 / 2;
174 p_data->p_atomic_operations[i_next_atomic_operation]
175 .d_amplitude_factor = d_channel_amplitude_factor / 2;
179 p_data->p_atomic_operations[i_next_atomic_operation + 1]
180 .i_source_channel_offset = i_source_channel_offset;
181 p_data->p_atomic_operations[i_next_atomic_operation + 1]
182 .i_dest_channel_offset = 1;/* right */
183 p_data->p_atomic_operations[i_next_atomic_operation + 1]
184 .i_delay = (int)( sqrt( (0.1-d_x)*(0.1-d_x) + (0-d_z)*(0-d_z) )
185 / d_c * i_rate - d_compensation_delay );
188 p_data->p_atomic_operations[i_next_atomic_operation + 1]
189 .d_amplitude_factor = d_channel_amplitude_factor * 0.9 / 2;
193 p_data->p_atomic_operations[i_next_atomic_operation + 1]
194 .d_amplitude_factor = d_channel_amplitude_factor * 1.1 / 2;
198 p_data->p_atomic_operations[i_next_atomic_operation + 1]
199 .d_amplitude_factor = d_channel_amplitude_factor / 2;
203 static int Init( vlc_object_t *p_this, struct aout_filter_sys_t * p_data
204 , unsigned int i_nb_channels, uint32_t i_physical_channels
205 , unsigned int i_rate )
207 double d_x = config_GetInt( p_this, "headphone-dim" );
209 double d_z_rear = -d_x/3;
211 unsigned int i_next_atomic_operation;
212 int i_source_channel_offset;
217 msg_Dbg( p_this, "passing a null pointer as argument" );
221 if( config_GetInt( p_this, "headphone-compensate" ) )
223 /* minimal distance to any speaker */
224 if( i_physical_channels & AOUT_CHAN_REARCENTER )
234 /* Number of elementary operations */
235 p_data->i_nb_atomic_operations = i_nb_channels * 2;
236 if( i_physical_channels & AOUT_CHAN_CENTER )
238 p_data->i_nb_atomic_operations += 2;
240 p_data->p_atomic_operations = malloc( sizeof(struct atomic_operation_t)
241 * p_data->i_nb_atomic_operations );
242 if( p_data->p_atomic_operations == NULL )
244 msg_Err( p_this, "out of memory" );
248 /* For each virtual speaker, computes elementary wave propagation time
250 i_next_atomic_operation = 0;
251 i_source_channel_offset = 0;
252 if( i_physical_channels & AOUT_CHAN_LEFT )
254 ComputeChannelOperations( p_data , i_rate
255 , i_next_atomic_operation , i_source_channel_offset
256 , -d_x , d_z , d_min , 2.0 / i_nb_channels );
257 i_next_atomic_operation += 2;
258 i_source_channel_offset++;
260 if( i_physical_channels & AOUT_CHAN_RIGHT )
262 ComputeChannelOperations( p_data , i_rate
263 , i_next_atomic_operation , i_source_channel_offset
264 , d_x , d_z , d_min , 2.0 / i_nb_channels );
265 i_next_atomic_operation += 2;
266 i_source_channel_offset++;
268 if( i_physical_channels & AOUT_CHAN_MIDDLELEFT )
270 ComputeChannelOperations( p_data , i_rate
271 , i_next_atomic_operation , i_source_channel_offset
272 , -d_x , 0 , d_min , 1.5 / i_nb_channels );
273 i_next_atomic_operation += 2;
274 i_source_channel_offset++;
276 if( i_physical_channels & AOUT_CHAN_MIDDLERIGHT )
278 ComputeChannelOperations( p_data , i_rate
279 , i_next_atomic_operation , i_source_channel_offset
280 , d_x , 0 , d_min , 1.5 / i_nb_channels );
281 i_next_atomic_operation += 2;
282 i_source_channel_offset++;
284 if( i_physical_channels & AOUT_CHAN_REARLEFT )
286 ComputeChannelOperations( p_data , i_rate
287 , i_next_atomic_operation , i_source_channel_offset
288 , -d_x , d_z_rear , d_min , 1.5 / i_nb_channels );
289 i_next_atomic_operation += 2;
290 i_source_channel_offset++;
292 if( i_physical_channels & AOUT_CHAN_REARRIGHT )
294 ComputeChannelOperations( p_data , i_rate
295 , i_next_atomic_operation , i_source_channel_offset
296 , d_x , d_z_rear , d_min , 1.5 / i_nb_channels );
297 i_next_atomic_operation += 2;
298 i_source_channel_offset++;
300 if( i_physical_channels & AOUT_CHAN_REARCENTER )
302 ComputeChannelOperations( p_data , i_rate
303 , i_next_atomic_operation , i_source_channel_offset
304 , 0 , -d_z , d_min , 1.5 / i_nb_channels );
305 i_next_atomic_operation += 2;
306 i_source_channel_offset++;
308 if( i_physical_channels & AOUT_CHAN_CENTER )
310 /* having two center channels increases the spatialization effect */
311 ComputeChannelOperations( p_data , i_rate
312 , i_next_atomic_operation , i_source_channel_offset
313 , d_x / 5.0 , d_z , d_min , 0.75 / i_nb_channels );
314 i_next_atomic_operation += 2;
315 ComputeChannelOperations( p_data , i_rate
316 , i_next_atomic_operation , i_source_channel_offset
317 , -d_x / 5.0 , d_z , d_min , 0.75 / i_nb_channels );
318 i_next_atomic_operation += 2;
319 i_source_channel_offset++;
321 if( i_physical_channels & AOUT_CHAN_LFE )
323 ComputeChannelOperations( p_data , i_rate
324 , i_next_atomic_operation , i_source_channel_offset
325 , 0 , d_z_rear , d_min , 5.0 / i_nb_channels );
326 i_next_atomic_operation += 2;
327 i_source_channel_offset++;
330 /* Initialize the overflow buffer
331 * we need it because the process induce a delay in the samples */
332 p_data->i_overflow_buffer_size = 0;
333 for( i = 0 ; i < p_data->i_nb_atomic_operations ; i++ )
335 if( p_data->i_overflow_buffer_size
336 < p_data->p_atomic_operations[i].i_delay * 2 * sizeof (float) )
338 p_data->i_overflow_buffer_size
339 = p_data->p_atomic_operations[i].i_delay * 2 * sizeof (float);
342 p_data->p_overflow_buffer = malloc( p_data->i_overflow_buffer_size );
343 if( p_data->p_atomic_operations == NULL )
345 msg_Err( p_this, "out of memory" );
348 memset( p_data->p_overflow_buffer, 0 , p_data->i_overflow_buffer_size );
354 /*****************************************************************************
355 * Create: allocate headphone downmixer
356 *****************************************************************************/
357 static int Create( vlc_object_t *p_this )
359 aout_filter_t * p_filter = (aout_filter_t *)p_this;
360 vlc_bool_t b_fit = VLC_TRUE;
362 /* Activate this filter only with stereo devices */
363 if( p_filter->output.i_physical_channels
364 != (AOUT_CHAN_LEFT|AOUT_CHAN_RIGHT) )
366 msg_Dbg( p_filter, "filter discarded (incompatible format)" );
370 /* Request a specific format if not already compatible */
371 if( p_filter->input.i_original_channels
372 != p_filter->output.i_original_channels )
375 p_filter->input.i_original_channels =
376 p_filter->output.i_original_channels;
378 if( p_filter->input.i_format != VLC_FOURCC('f','l','3','2')
379 || p_filter->output.i_format != VLC_FOURCC('f','l','3','2') )
382 p_filter->input.i_format = VLC_FOURCC('f','l','3','2');
383 p_filter->output.i_format = VLC_FOURCC('f','l','3','2');
385 if( p_filter->input.i_rate != p_filter->output.i_rate )
388 p_filter->input.i_rate = p_filter->output.i_rate;
390 if( p_filter->input.i_physical_channels == (AOUT_CHAN_LEFT|AOUT_CHAN_RIGHT)
391 && ( p_filter->input.i_original_channels & AOUT_CHAN_DOLBYSTEREO )
392 && ! config_GetInt ( p_filter , "headphone-dolby" ) )
395 p_filter->input.i_physical_channels = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT |
402 msg_Dbg( p_filter, "requesting specific format" );
406 /* Allocate the memory needed to store the module's structure */
407 p_filter->p_sys = malloc( sizeof(struct aout_filter_sys_t) );
408 if( p_filter->p_sys == NULL )
410 msg_Err( p_filter, "out of memory" );
413 p_filter->p_sys->i_overflow_buffer_size = 0;
414 p_filter->p_sys->p_overflow_buffer = NULL;
415 p_filter->p_sys->i_nb_atomic_operations = 0;
416 p_filter->p_sys->p_atomic_operations = NULL;
418 if( Init( VLC_OBJECT(p_filter), p_filter->p_sys
419 , aout_FormatNbChannels ( &p_filter->input )
420 , p_filter->input.i_physical_channels
421 , p_filter->input.i_rate ) < 0 )
426 p_filter->pf_do_work = DoWork;
427 p_filter->b_in_place = 0;
432 /*****************************************************************************
433 * Destroy: deallocate resources associated with headphone downmixer
434 *****************************************************************************/
435 static void Destroy( vlc_object_t *p_this )
437 aout_filter_t * p_filter = (aout_filter_t *)p_this;
439 if( p_filter->p_sys != NULL )
441 if( p_filter->p_sys->p_overflow_buffer != NULL )
443 free( p_filter->p_sys->p_overflow_buffer );
445 if( p_filter->p_sys->p_atomic_operations != NULL )
447 free( p_filter->p_sys->p_atomic_operations );
449 free( p_filter->p_sys );
450 p_filter->p_sys = NULL;
454 /*****************************************************************************
455 * DoWork: convert a buffer
456 *****************************************************************************/
457 static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
458 aout_buffer_t * p_in_buf, aout_buffer_t * p_out_buf )
460 int i_input_nb = aout_FormatNbChannels( &p_filter->input );
461 int i_output_nb = aout_FormatNbChannels( &p_filter->output );
463 float * p_in = (float*) p_in_buf->p_buffer;
468 size_t i_overflow_size; /* in bytes */
469 size_t i_out_size; /* in bytes */
473 int i_source_channel_offset;
474 int i_dest_channel_offset;
475 unsigned int i_delay;
476 double d_amplitude_factor;
478 /* out buffer characterisitcs */
479 p_out_buf->i_nb_samples = p_in_buf->i_nb_samples;
480 p_out_buf->i_nb_bytes = p_in_buf->i_nb_bytes * i_output_nb / i_input_nb;
481 p_out = p_out_buf->p_buffer;
482 i_out_size = p_out_buf->i_nb_bytes;
484 if( p_filter->p_sys != NULL )
486 /* Slide the overflow buffer */
487 p_overflow = p_filter->p_sys->p_overflow_buffer;
488 i_overflow_size = p_filter->p_sys->i_overflow_buffer_size;
490 memset( p_out, 0, i_out_size );
491 if ( i_out_size > i_overflow_size )
492 memcpy( p_out, p_overflow, i_overflow_size );
494 memcpy( p_out, p_overflow, i_out_size );
496 p_slide = p_filter->p_sys->p_overflow_buffer;
497 while( p_slide < p_overflow + i_overflow_size )
499 if( p_slide + i_out_size < p_overflow + i_overflow_size )
501 memset( p_slide, 0, i_out_size );
502 if( p_slide + 2 * i_out_size < p_overflow + i_overflow_size )
503 memcpy( p_slide, p_slide + i_out_size, i_out_size );
505 memcpy( p_slide, p_slide + i_out_size,
506 p_overflow + i_overflow_size - ( p_slide + i_out_size ) );
510 memset( p_slide, 0, p_overflow + i_overflow_size - p_slide );
512 p_slide += i_out_size;
515 /* apply the atomic operations */
516 for( i = 0; i < p_filter->p_sys->i_nb_atomic_operations; i++ )
518 /* shorter variable names */
519 i_source_channel_offset
520 = p_filter->p_sys->p_atomic_operations[i].i_source_channel_offset;
521 i_dest_channel_offset
522 = p_filter->p_sys->p_atomic_operations[i].i_dest_channel_offset;
523 i_delay = p_filter->p_sys->p_atomic_operations[i].i_delay;
525 = p_filter->p_sys->p_atomic_operations[i].d_amplitude_factor;
527 if( p_out_buf->i_nb_samples > i_delay )
529 /* current buffer coefficients */
530 for( j = 0; j < p_out_buf->i_nb_samples - i_delay; j++ )
532 ((float*)p_out)[ (i_delay+j)*i_output_nb + i_dest_channel_offset ]
533 += p_in[ j * i_input_nb + i_source_channel_offset ]
534 * d_amplitude_factor;
537 /* overflow buffer coefficients */
538 for( j = 0; j < i_delay; j++ )
540 ((float*)p_overflow)[ j*i_output_nb + i_dest_channel_offset ]
541 += p_in[ (p_out_buf->i_nb_samples - i_delay + j)
542 * i_input_nb + i_source_channel_offset ]
543 * d_amplitude_factor;
548 /* overflow buffer coefficients only */
549 for( j = 0; j < p_out_buf->i_nb_samples; j++ )
551 ((float*)p_overflow)[ (i_delay - p_out_buf->i_nb_samples + j)
552 * i_output_nb + i_dest_channel_offset ]
553 += p_in[ j * i_input_nb + i_source_channel_offset ]
554 * d_amplitude_factor;
561 memset( p_out, 0, i_out_size );
568 /*****************************************************************************
570 *****************************************************************************/
571 static int OpenFilter( vlc_object_t *p_this )
573 filter_t *p_filter = (filter_t *)p_this;
574 vlc_bool_t b_fit = VLC_TRUE;
576 /* Activate this filter only with stereo devices */
577 if( p_filter->fmt_out.audio.i_physical_channels
578 != (AOUT_CHAN_LEFT|AOUT_CHAN_RIGHT) )
580 msg_Dbg( p_filter, "filter discarded (incompatible format)" );
584 /* Request a specific format if not already compatible */
585 if( p_filter->fmt_in.audio.i_original_channels
586 != p_filter->fmt_out.audio.i_original_channels )
589 p_filter->fmt_in.audio.i_original_channels =
590 p_filter->fmt_out.audio.i_original_channels;
592 if( p_filter->fmt_in.audio.i_format != VLC_FOURCC('f','l','3','2')
593 || p_filter->fmt_out.audio.i_format != VLC_FOURCC('f','l','3','2') )
596 p_filter->fmt_in.audio.i_format = VLC_FOURCC('f','l','3','2');
597 p_filter->fmt_out.audio.i_format = VLC_FOURCC('f','l','3','2');
599 if( p_filter->fmt_in.audio.i_rate != p_filter->fmt_out.audio.i_rate )
602 p_filter->fmt_in.audio.i_rate = p_filter->fmt_out.audio.i_rate;
604 if( p_filter->fmt_in.audio.i_physical_channels == (AOUT_CHAN_LEFT|AOUT_CHAN_RIGHT)
605 && ( p_filter->fmt_in.audio.i_original_channels & AOUT_CHAN_DOLBYSTEREO )
606 && !config_GetInt( p_filter, "headphone-dolby" ) )
609 p_filter->fmt_in.audio.i_physical_channels = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT |
616 msg_Dbg( p_filter, "requesting specific format" );
620 /* Allocate the memory needed to store the module's structure */
621 p_filter->p_sys = malloc( sizeof(struct filter_sys_t) );
622 if( p_filter->p_sys == NULL )
624 msg_Err( p_filter, "out of memory" );
627 p_filter->p_sys->i_overflow_buffer_size = 0;
628 p_filter->p_sys->p_overflow_buffer = NULL;
629 p_filter->p_sys->i_nb_atomic_operations = 0;
630 p_filter->p_sys->p_atomic_operations = NULL;
632 if( Init( VLC_OBJECT(p_filter), (struct aout_filter_sys_t *)p_filter->p_sys
633 , aout_FormatNbChannels ( &(p_filter->fmt_in.audio) )
634 , p_filter->fmt_in.audio.i_physical_channels
635 , p_filter->fmt_in.audio.i_rate ) < 0 )
640 p_filter->pf_audio_filter = Convert;
641 p_filter->fmt_out.audio.i_rate = p_filter->fmt_in.audio.i_rate;
646 /*****************************************************************************
647 * CloseFilter : deallocate data structures
648 *****************************************************************************/
649 static void CloseFilter( vlc_object_t *p_this )
651 filter_t *p_filter = (filter_t *)p_this;
653 if( p_filter->p_sys != NULL )
655 if( p_filter->p_sys->p_overflow_buffer != NULL )
657 free ( p_filter->p_sys->p_overflow_buffer );
659 if( p_filter->p_sys->p_atomic_operations != NULL )
661 free ( p_filter->p_sys->p_atomic_operations );
663 free( p_filter->p_sys );
664 p_filter->p_sys = NULL;
668 static block_t *Convert( filter_t *p_filter, block_t *p_block )
670 aout_filter_t aout_filter;
671 aout_buffer_t in_buf, out_buf;
675 if( !p_block || !p_block->i_samples )
677 if( p_block ) p_block->pf_release( p_block );
681 i_out_size = p_block->i_samples *
682 p_filter->fmt_out.audio.i_bitspersample/8 *
683 aout_FormatNbChannels( &(p_filter->fmt_out.audio) );
685 p_out = p_filter->pf_audio_buffer_new( p_filter, i_out_size );
688 msg_Warn( p_filter, "can't get output buffer" );
689 if( p_block ) p_block->pf_release( p_block );
693 p_out->i_samples = p_block->i_samples;
694 p_out->i_dts = p_block->i_dts;
695 p_out->i_pts = p_block->i_pts;
696 p_out->i_length = p_block->i_length;
698 aout_filter.p_sys = (struct aout_filter_sys_t *)p_filter->p_sys;
699 aout_filter.input = p_filter->fmt_in.audio;
700 aout_filter.input.i_format = p_filter->fmt_in.i_codec;
701 aout_filter.output = p_filter->fmt_out.audio;
702 aout_filter.output.i_format = p_filter->fmt_out.i_codec;
703 aout_filter.b_in_place = 0;
705 in_buf.p_buffer = p_block->p_buffer;
706 in_buf.i_nb_bytes = p_block->i_buffer;
707 in_buf.i_nb_samples = p_block->i_samples;
708 out_buf.p_buffer = p_out->p_buffer;
709 out_buf.i_nb_bytes = p_out->i_buffer;
710 out_buf.i_nb_samples = p_out->i_samples;
712 DoWork( (aout_instance_t *)p_filter, &aout_filter, &in_buf, &out_buf );
714 p_out->i_buffer = out_buf.i_nb_bytes;
715 p_out->i_samples = out_buf.i_nb_samples;
717 if( p_block ) p_block->pf_release( p_block );