mirror of
				https://github.com/alsa-project/alsa-lib.git
				synced 2025-11-03 09:01:52 -05:00 
			
		
		
		
	pcm: rate: add rewindable and forwardable callbacks
This commit does not fix nonsense values returned by the rewind and forward callbacks. E.g., with period_size = 1024 and buffer_size = 4096, an attempt to rewind 1024 samples from the nearly-full buffer returns 4090. Due to these nonsense values, the current rate plugin should be treated as non-rewindable. That's why the new callbacks return 0. Signed-off-by: Alexander E. Patrakov <patrakov@gmail.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
		
							parent
							
								
									9c3086fb74
								
							
						
					
					
						commit
						614a66bb2a
					
				
					 1 changed files with 12 additions and 0 deletions
				
			
		| 
						 | 
					@ -689,6 +689,16 @@ static int snd_pcm_rate_reset(snd_pcm_t *pcm)
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static snd_pcm_sframes_t snd_pcm_rate_rewindable(snd_pcm_t *pcm ATTRIBUTE_UNUSED)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						return 0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static snd_pcm_sframes_t snd_pcm_rate_forwardable(snd_pcm_t *pcm ATTRIBUTE_UNUSED)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						return 0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static snd_pcm_sframes_t snd_pcm_rate_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
 | 
					static snd_pcm_sframes_t snd_pcm_rate_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	snd_pcm_rate_t *rate = pcm->private_data;
 | 
						snd_pcm_rate_t *rate = pcm->private_data;
 | 
				
			||||||
| 
						 | 
					@ -1221,7 +1231,9 @@ static const snd_pcm_fast_ops_t snd_pcm_rate_fast_ops = {
 | 
				
			||||||
	.drop = snd_pcm_generic_drop,
 | 
						.drop = snd_pcm_generic_drop,
 | 
				
			||||||
	.drain = snd_pcm_rate_drain,
 | 
						.drain = snd_pcm_rate_drain,
 | 
				
			||||||
	.pause = snd_pcm_generic_pause,
 | 
						.pause = snd_pcm_generic_pause,
 | 
				
			||||||
 | 
						.rewindable = snd_pcm_rate_rewindable,
 | 
				
			||||||
	.rewind = snd_pcm_rate_rewind,
 | 
						.rewind = snd_pcm_rate_rewind,
 | 
				
			||||||
 | 
						.forwardable = snd_pcm_rate_forwardable,
 | 
				
			||||||
	.forward = snd_pcm_rate_forward,
 | 
						.forward = snd_pcm_rate_forward,
 | 
				
			||||||
	.resume = snd_pcm_generic_resume,
 | 
						.resume = snd_pcm_generic_resume,
 | 
				
			||||||
	.writei = snd_pcm_mmap_writei,
 | 
						.writei = snd_pcm_mmap_writei,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue