mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	resampler: Add a choose_auto_resampler function
This function returns our preferred resampler if the user choose the auto (or if he has chosen an unsupported) resampler.
This commit is contained in:
		
							parent
							
								
									8ab6c37e10
								
							
						
					
					
						commit
						9a590dd3f2
					
				
					 1 changed files with 15 additions and 10 deletions
				
			
		| 
						 | 
					@ -176,6 +176,19 @@ static int (* const init_table[])(pa_resampler*r) = {
 | 
				
			||||||
    [PA_RESAMPLER_PEAKS]                   = peaks_init,
 | 
					    [PA_RESAMPLER_PEAKS]                   = peaks_init,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static pa_resample_method_t choose_auto_resampler(pa_resample_flags_t flags) {
 | 
				
			||||||
 | 
					    pa_resample_method_t method;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (pa_resample_method_supported(PA_RESAMPLER_SPEEX_FLOAT_BASE + 1))
 | 
				
			||||||
 | 
					        method = PA_RESAMPLER_SPEEX_FLOAT_BASE + 1;
 | 
				
			||||||
 | 
					    else if (flags & PA_RESAMPLER_VARIABLE_RATE)
 | 
				
			||||||
 | 
					        method = PA_RESAMPLER_TRIVIAL;
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					        method = PA_RESAMPLER_FFMPEG;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return method;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static pa_resample_method_t pa_resampler_fix_method(
 | 
					static pa_resample_method_t pa_resampler_fix_method(
 | 
				
			||||||
                pa_resample_flags_t flags,
 | 
					                pa_resample_flags_t flags,
 | 
				
			||||||
                pa_resample_method_t method,
 | 
					                pa_resample_method_t method,
 | 
				
			||||||
| 
						 | 
					@ -224,16 +237,8 @@ static pa_resample_method_t pa_resampler_fix_method(
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (method == PA_RESAMPLER_AUTO) {
 | 
					    if (method == PA_RESAMPLER_AUTO)
 | 
				
			||||||
#ifdef HAVE_SPEEX
 | 
					        method = choose_auto_resampler(flags);
 | 
				
			||||||
        method = PA_RESAMPLER_SPEEX_FLOAT_BASE + 1;
 | 
					 | 
				
			||||||
#else
 | 
					 | 
				
			||||||
        if (flags & PA_RESAMPLER_VARIABLE_RATE)
 | 
					 | 
				
			||||||
            method = PA_RESAMPLER_TRIVIAL;
 | 
					 | 
				
			||||||
        else
 | 
					 | 
				
			||||||
            method = PA_RESAMPLER_FFMPEG;
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return method;
 | 
					    return method;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue