mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	print the device capabilities after opening the device
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1220 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
		
							parent
							
								
									fbeeb8b70d
								
							
						
					
					
						commit
						3cfed301d9
					
				
					 1 changed files with 50 additions and 5 deletions
				
			
		| 
						 | 
				
			
			@ -42,8 +42,13 @@
 | 
			
		|||
 | 
			
		||||
int pa_oss_open(const char *device, int *mode, int* pcaps) {
 | 
			
		||||
    int fd = -1;
 | 
			
		||||
    int caps;
 | 
			
		||||
 | 
			
		||||
    assert(device && mode && (*mode == O_RDWR || *mode == O_RDONLY || *mode == O_WRONLY));
 | 
			
		||||
 | 
			
		||||
    if(!pcaps)
 | 
			
		||||
        pcaps = ∩︀
 | 
			
		||||
    
 | 
			
		||||
    if (*mode == O_RDWR) {
 | 
			
		||||
        if ((fd = open(device, O_RDWR|O_NDELAY)) >= 0) {
 | 
			
		||||
            int dcaps, *tcaps;
 | 
			
		||||
| 
						 | 
				
			
			@ -79,13 +84,53 @@ int pa_oss_open(const char *device, int *mode, int* pcaps) {
 | 
			
		|||
 | 
			
		||||
success:
 | 
			
		||||
 | 
			
		||||
    if (pcaps) {
 | 
			
		||||
        if (ioctl(fd, SNDCTL_DSP_GETCAPS, pcaps) < 0) {
 | 
			
		||||
            pa_log(__FILE__": SNDCTL_DSP_GETCAPS: %s", pa_cstrerror(errno));
 | 
			
		||||
            goto fail;
 | 
			
		||||
        }
 | 
			
		||||
    *pcaps = 0;
 | 
			
		||||
    
 | 
			
		||||
    if (ioctl(fd, SNDCTL_DSP_GETCAPS, pcaps) < 0) {
 | 
			
		||||
        pa_log(__FILE__": SNDCTL_DSP_GETCAPS: %s", pa_cstrerror(errno));
 | 
			
		||||
        goto fail;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    pa_log_debug(__FILE__": capabilities:%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
 | 
			
		||||
                 *pcaps & DSP_CAP_BATCH ? " BATCH" : "",
 | 
			
		||||
                 *pcaps & DSP_CAP_BIND ? " BIND" : "",
 | 
			
		||||
                 *pcaps & DSP_CAP_COPROC ? " COPROC" : "",
 | 
			
		||||
                 *pcaps & DSP_CAP_DUPLEX ? " DUPLEX" : "",
 | 
			
		||||
#ifdef DSP_CAP_FREERATE                     
 | 
			
		||||
                 *pcaps & DSP_CAP_FREERATE ? " FREERATE" : "",
 | 
			
		||||
#else
 | 
			
		||||
                 "",
 | 
			
		||||
#endif
 | 
			
		||||
#ifdef DSP_CAP_INPUT
 | 
			
		||||
                 *pcaps & DSP_CAP_INPUT ? " INPUT" : "",
 | 
			
		||||
#else
 | 
			
		||||
                 "",
 | 
			
		||||
#endif
 | 
			
		||||
                 *pcaps & DSP_CAP_MMAP ? " MMAP" : "",
 | 
			
		||||
#ifdef DSP_CAP_MODEM
 | 
			
		||||
                 *pcaps & DSP_CAP_MODEM ? " MODEM" : "",
 | 
			
		||||
#else
 | 
			
		||||
                 "",
 | 
			
		||||
#endif
 | 
			
		||||
                 *pcaps & DSP_CAP_MULTI ? " MULTI" : "",
 | 
			
		||||
#ifdef DSP_CAP_OUTPUT
 | 
			
		||||
                 *pcaps & DSP_CAP_OUTPUT ? " OUTPUT" : "",
 | 
			
		||||
#else
 | 
			
		||||
                 "",
 | 
			
		||||
#endif
 | 
			
		||||
                 *pcaps & DSP_CAP_REALTIME ? " REALTIME" : "",
 | 
			
		||||
#ifdef DSP_CAP_SHADOW
 | 
			
		||||
                 *pcaps & DSP_CAP_SHADOW ? " SHADOW" : "",
 | 
			
		||||
#else
 | 
			
		||||
                 "",
 | 
			
		||||
#endif
 | 
			
		||||
#ifdef DSP_CAP_VIRTUAL
 | 
			
		||||
                 *pcaps & DSP_CAP_VIRTUAL ? " VIRTUAL" : "",
 | 
			
		||||
#else
 | 
			
		||||
                 "",
 | 
			
		||||
#endif
 | 
			
		||||
                 *pcaps & DSP_CAP_TRIGGER ? " TRIGGER" : "");
 | 
			
		||||
 | 
			
		||||
    pa_fd_set_cloexec(fd, 1);
 | 
			
		||||
    
 | 
			
		||||
    return fd;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue