diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2014-07-22 19:23:05 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2014-07-22 19:23:05 -0600 |
commit | 7fed0c8ab356408ac990c26d4470084e97f68431 (patch) | |
tree | 2b86d50da4ee6f987d503cbde6abae042f5d5d44 /apps/system/nxplayer/nxplayer.c | |
parent | f510fe6d8e15b4761eabcffe406ba237e0982380 (diff) | |
download | nuttx-7fed0c8ab356408ac990c26d4470084e97f68431.tar.gz nuttx-7fed0c8ab356408ac990c26d4470084e97f68431.tar.bz2 nuttx-7fed0c8ab356408ac990c26d4470084e97f68431.zip |
Flesh out a few more PCM methods, still incomplete. Re-vision PCM structure definition
Diffstat (limited to 'apps/system/nxplayer/nxplayer.c')
-rw-r--r-- | apps/system/nxplayer/nxplayer.c | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/apps/system/nxplayer/nxplayer.c b/apps/system/nxplayer/nxplayer.c index 64c8c93b6..514d6fdd8 100644 --- a/apps/system/nxplayer/nxplayer.c +++ b/apps/system/nxplayer/nxplayer.c @@ -166,7 +166,7 @@ static int nxplayer_opendevice(FAR struct nxplayer_s *pPlayer, int format, { /* Format not supported by the device */ - auddbg("ERROR: Format not supported by device: %d\n"); + auddbg("ERROR: Format not supported by device: %d\n", format); return -ENODEV; } @@ -200,7 +200,7 @@ static int nxplayer_opendevice(FAR struct nxplayer_s *pPlayer, int format, FAR struct dirent *pDevice; FAR DIR *dirp; char path[64]; - uint8_t supported = TRUE; + uint8_t supported = true; uint8_t x; /* Search for a device in the audio device directory */ @@ -256,6 +256,7 @@ static int nxplayer_opendevice(FAR struct nxplayer_s *pPlayer, int format, /* Test if this device supports the format we want */ int ac_format = caps.ac_format[0] | (caps.ac_format[1] << 8); + if (((ac_format & (1 << (format - 1))) != 0) && (caps.ac_controls[0] & AUDIO_TYPE_OUTPUT)) { @@ -267,6 +268,7 @@ static int nxplayer_opendevice(FAR struct nxplayer_s *pPlayer, int format, caps.ac_subtype = format; caps.ac_format[0] = 0; + while (ioctl(pPlayer->devFd, AUDIOIOC_GETCAPS, (unsigned long) &caps) == caps.ac_len) { @@ -284,7 +286,7 @@ static int nxplayer_opendevice(FAR struct nxplayer_s *pPlayer, int format, { /* Sub format not supported */ - supported = FALSE; + supported = false; break; } } @@ -537,8 +539,8 @@ static void *nxplayer_playthread(pthread_addr_t pvarg) struct audio_buf_desc_s buf_desc; int prio; ssize_t size; - uint8_t running = TRUE; - uint8_t playing = TRUE; + uint8_t running = true; + uint8_t playing = true; int x, ret; #ifdef CONFIG_AUDIO_DRIVER_SPECIFIC_BUFFERS struct ap_buffer_info_s buf_info; @@ -568,7 +570,7 @@ static void *nxplayer_playthread(pthread_addr_t pvarg) /* Error allocating memory for buffer storage! */ ret = -ENOMEM; - running = FALSE; + running = false; goto err_out; } @@ -604,7 +606,7 @@ static void *nxplayer_playthread(pthread_addr_t pvarg) /* Buffer alloc Operation not supported or error allocating! */ auddbg("nxplayer_playthread: can't alloc buffer %d\n", x); - running = FALSE; + running = false; goto err_out; } } @@ -625,9 +627,9 @@ static void *nxplayer_playthread(pthread_addr_t pvarg) /* Error encoding initial buffers or file is small */ if (x == 0) - running = FALSE; + running = false; else - playing = FALSE; + playing = false; break; } @@ -645,7 +647,7 @@ static void *nxplayer_playthread(pthread_addr_t pvarg) { /* Error starting the audio stream! */ - running = FALSE; + running = false; } /* Indicate we are playing a file */ @@ -706,7 +708,7 @@ static void *nxplayer_playthread(pthread_addr_t pvarg) * trying to play more data. */ - playing = FALSE; + playing = false; } } break; @@ -723,15 +725,15 @@ static void *nxplayer_playthread(pthread_addr_t pvarg) #else ioctl(pPlayer->devFd, AUDIOIOC_STOP, 0); #endif - playing = FALSE; - running = FALSE; + playing = false; + running = false; break; /* Message indicating the playback is complete */ case AUDIO_MSG_COMPLETE: - running = FALSE; + running = false; break; /* Unknown / unsupported message ID */ |