mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	Wrap strerror() in a function that makes it thread safe and converts the
output to UTF-8. git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@945 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
		
							parent
							
								
									bf09399d0e
								
							
						
					
					
						commit
						4e3dc7ce68
					
				
					 49 changed files with 337 additions and 169 deletions
				
			
		| 
						 | 
				
			
			@ -35,6 +35,7 @@
 | 
			
		|||
#include <unistd.h>
 | 
			
		||||
#include <limits.h>
 | 
			
		||||
 | 
			
		||||
#include <polyp/error.h>
 | 
			
		||||
#include <polyp/xmalloc.h>
 | 
			
		||||
 | 
			
		||||
#include <polypcore/iochannel.h>
 | 
			
		||||
| 
						 | 
				
			
			@ -146,7 +147,7 @@ static void do_write(struct userdata *u) {
 | 
			
		|||
        assert(memchunk->length);
 | 
			
		||||
        
 | 
			
		||||
        if ((r = pa_iochannel_write(u->io, (uint8_t*) memchunk->memblock->data + memchunk->index, memchunk->length)) < 0) {
 | 
			
		||||
            pa_log(__FILE__": write() failed: %s", strerror(errno));
 | 
			
		||||
            pa_log(__FILE__": write() failed: %s", pa_cstrerror(errno));
 | 
			
		||||
            break;
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
| 
						 | 
				
			
			@ -199,7 +200,7 @@ static void do_read(struct userdata *u) {
 | 
			
		|||
        if ((r = pa_iochannel_read(u->io, memchunk.memblock->data, memchunk.memblock->length)) < 0) {
 | 
			
		||||
            pa_memblock_unref(memchunk.memblock);
 | 
			
		||||
            if (errno != EAGAIN)
 | 
			
		||||
                pa_log(__FILE__": read() failed: %s", strerror(errno));
 | 
			
		||||
                pa_log(__FILE__": read() failed: %s", pa_cstrerror(errno));
 | 
			
		||||
            break;
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
| 
						 | 
				
			
			@ -234,7 +235,7 @@ static pa_usec_t sink_get_latency_cb(pa_sink *s) {
 | 
			
		|||
    assert(s && u && u->sink);
 | 
			
		||||
 | 
			
		||||
    if (ioctl(u->fd, SNDCTL_DSP_GETODELAY, &arg) < 0) {
 | 
			
		||||
        pa_log_info(__FILE__": device doesn't support SNDCTL_DSP_GETODELAY: %s", strerror(errno));
 | 
			
		||||
        pa_log_info(__FILE__": device doesn't support SNDCTL_DSP_GETODELAY: %s", pa_cstrerror(errno));
 | 
			
		||||
        s->get_latency = NULL;
 | 
			
		||||
        return 0;
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -270,7 +271,7 @@ static int sink_get_hw_volume(pa_sink *s) {
 | 
			
		|||
    struct userdata *u = s->userdata;
 | 
			
		||||
 | 
			
		||||
    if (pa_oss_get_pcm_volume(u->fd, &s->sample_spec, &s->hw_volume) < 0) {
 | 
			
		||||
        pa_log_info(__FILE__": device doesn't support reading mixer settings: %s", strerror(errno));
 | 
			
		||||
        pa_log_info(__FILE__": device doesn't support reading mixer settings: %s", pa_cstrerror(errno));
 | 
			
		||||
        s->get_hw_volume = NULL;
 | 
			
		||||
        return -1;
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -282,7 +283,7 @@ static int sink_set_hw_volume(pa_sink *s) {
 | 
			
		|||
    struct userdata *u = s->userdata;
 | 
			
		||||
 | 
			
		||||
    if (pa_oss_set_pcm_volume(u->fd, &s->sample_spec, &s->hw_volume) < 0) {
 | 
			
		||||
        pa_log_info(__FILE__": device doesn't support writing mixer settings: %s", strerror(errno));
 | 
			
		||||
        pa_log_info(__FILE__": device doesn't support writing mixer settings: %s", pa_cstrerror(errno));
 | 
			
		||||
        s->set_hw_volume = NULL;
 | 
			
		||||
        return -1;
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -294,7 +295,7 @@ static int source_get_hw_volume(pa_source *s) {
 | 
			
		|||
    struct userdata *u = s->userdata;
 | 
			
		||||
 | 
			
		||||
    if (pa_oss_get_input_volume(u->fd, &s->sample_spec, &s->hw_volume) < 0) {
 | 
			
		||||
        pa_log_info(__FILE__": device doesn't support reading mixer settings: %s", strerror(errno));
 | 
			
		||||
        pa_log_info(__FILE__": device doesn't support reading mixer settings: %s", pa_cstrerror(errno));
 | 
			
		||||
        s->get_hw_volume = NULL;
 | 
			
		||||
        return -1;
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -306,7 +307,7 @@ static int source_set_hw_volume(pa_source *s) {
 | 
			
		|||
    struct userdata *u = s->userdata;
 | 
			
		||||
 | 
			
		||||
    if (pa_oss_set_input_volume(u->fd, &s->sample_spec, &s->hw_volume) < 0) {
 | 
			
		||||
        pa_log_info(__FILE__": device doesn't support writing mixer settings: %s", strerror(errno));
 | 
			
		||||
        pa_log_info(__FILE__": device doesn't support writing mixer settings: %s", pa_cstrerror(errno));
 | 
			
		||||
        s->set_hw_volume = NULL;
 | 
			
		||||
        return -1;
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -380,7 +381,7 @@ int pa__init(pa_core *c, pa_module*m) {
 | 
			
		|||
        goto fail;
 | 
			
		||||
 | 
			
		||||
    if (ioctl(fd, SNDCTL_DSP_GETBLKSIZE, &frag_size) < 0) {
 | 
			
		||||
        pa_log(__FILE__": SNDCTL_DSP_GETBLKSIZE: %s", strerror(errno));
 | 
			
		||||
        pa_log(__FILE__": SNDCTL_DSP_GETBLKSIZE: %s", pa_cstrerror(errno));
 | 
			
		||||
        goto fail;
 | 
			
		||||
    }
 | 
			
		||||
    assert(frag_size);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue