mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	sample-util: add pa_convert_size() call for converting sizes between two sample specs
This commit is contained in:
		
							parent
							
								
									c2f1994968
								
							
						
					
					
						commit
						1f0904b800
					
				
					 2 changed files with 12 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -1056,3 +1056,13 @@ void pa_memchunk_sine(pa_memchunk *c, pa_mempool *pool, unsigned rate, unsigned
 | 
			
		|||
    calc_sine(p, c->length, freq * l / rate);
 | 
			
		||||
    pa_memblock_release(c->memblock);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
size_t pa_convert_size(size_t size, const pa_sample_spec *from, const pa_sample_spec *to) {
 | 
			
		||||
    pa_usec_t usec;
 | 
			
		||||
 | 
			
		||||
    pa_assert(from);
 | 
			
		||||
    pa_assert(to);
 | 
			
		||||
 | 
			
		||||
    usec = pa_bytes_to_usec_round_up(size, from);
 | 
			
		||||
    return pa_usec_to_bytes_round_up(usec, to);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -91,6 +91,8 @@ typedef void (*pa_do_volume_func_t) (void *samples, void *volumes, unsigned chan
 | 
			
		|||
pa_do_volume_func_t pa_get_volume_func(pa_sample_format_t f);
 | 
			
		||||
void pa_set_volume_func(pa_sample_format_t f, pa_do_volume_func_t func);
 | 
			
		||||
 | 
			
		||||
size_t pa_convert_size(size_t size, const pa_sample_spec *from, const pa_sample_spec *to);
 | 
			
		||||
 | 
			
		||||
#define PA_CHANNEL_POSITION_MASK_LEFT                                   \
 | 
			
		||||
    (PA_CHANNEL_POSITION_MASK(PA_CHANNEL_POSITION_FRONT_LEFT)           \
 | 
			
		||||
     | PA_CHANNEL_POSITION_MASK(PA_CHANNEL_POSITION_REAR_LEFT)          \
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue