Flesh out a few more PCM methods, still incomplete. Re-vision PCM structure definition

This commit is contained in:
Gregory Nutt 2014-07-22 19:23:05 -06:00
parent f9386e6b64
commit 6e4aebcf99

View File

@ -166,7 +166,7 @@ static int nxplayer_opendevice(FAR struct nxplayer_s *pPlayer, int format,
{ {
/* Format not supported by the device */ /* 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; return -ENODEV;
} }
@ -200,7 +200,7 @@ static int nxplayer_opendevice(FAR struct nxplayer_s *pPlayer, int format,
FAR struct dirent *pDevice; FAR struct dirent *pDevice;
FAR DIR *dirp; FAR DIR *dirp;
char path[64]; char path[64];
uint8_t supported = TRUE; uint8_t supported = true;
uint8_t x; uint8_t x;
/* Search for a device in the audio device directory */ /* 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 */ /* Test if this device supports the format we want */
int ac_format = caps.ac_format[0] | (caps.ac_format[1] << 8); int ac_format = caps.ac_format[0] | (caps.ac_format[1] << 8);
if (((ac_format & (1 << (format - 1))) != 0) && if (((ac_format & (1 << (format - 1))) != 0) &&
(caps.ac_controls[0] & AUDIO_TYPE_OUTPUT)) (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_subtype = format;
caps.ac_format[0] = 0; caps.ac_format[0] = 0;
while (ioctl(pPlayer->devFd, AUDIOIOC_GETCAPS, while (ioctl(pPlayer->devFd, AUDIOIOC_GETCAPS,
(unsigned long) &caps) == caps.ac_len) (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 */ /* Sub format not supported */
supported = FALSE; supported = false;
break; break;
} }
} }
@ -537,8 +539,8 @@ static void *nxplayer_playthread(pthread_addr_t pvarg)
struct audio_buf_desc_s buf_desc; struct audio_buf_desc_s buf_desc;
int prio; int prio;
ssize_t size; ssize_t size;
uint8_t running = TRUE; uint8_t running = true;
uint8_t playing = TRUE; uint8_t playing = true;
int x, ret; int x, ret;
#ifdef CONFIG_AUDIO_DRIVER_SPECIFIC_BUFFERS #ifdef CONFIG_AUDIO_DRIVER_SPECIFIC_BUFFERS
struct ap_buffer_info_s buf_info; 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! */ /* Error allocating memory for buffer storage! */
ret = -ENOMEM; ret = -ENOMEM;
running = FALSE; running = false;
goto err_out; goto err_out;
} }
@ -604,7 +606,7 @@ static void *nxplayer_playthread(pthread_addr_t pvarg)
/* Buffer alloc Operation not supported or error allocating! */ /* Buffer alloc Operation not supported or error allocating! */
auddbg("nxplayer_playthread: can't alloc buffer %d\n", x); auddbg("nxplayer_playthread: can't alloc buffer %d\n", x);
running = FALSE; running = false;
goto err_out; goto err_out;
} }
} }
@ -625,9 +627,9 @@ static void *nxplayer_playthread(pthread_addr_t pvarg)
/* Error encoding initial buffers or file is small */ /* Error encoding initial buffers or file is small */
if (x == 0) if (x == 0)
running = FALSE; running = false;
else else
playing = FALSE; playing = false;
break; break;
} }
@ -645,7 +647,7 @@ static void *nxplayer_playthread(pthread_addr_t pvarg)
{ {
/* Error starting the audio stream! */ /* Error starting the audio stream! */
running = FALSE; running = false;
} }
/* Indicate we are playing a file */ /* Indicate we are playing a file */
@ -706,7 +708,7 @@ static void *nxplayer_playthread(pthread_addr_t pvarg)
* trying to play more data. * trying to play more data.
*/ */
playing = FALSE; playing = false;
} }
} }
break; break;
@ -723,15 +725,15 @@ static void *nxplayer_playthread(pthread_addr_t pvarg)
#else #else
ioctl(pPlayer->devFd, AUDIOIOC_STOP, 0); ioctl(pPlayer->devFd, AUDIOIOC_STOP, 0);
#endif #endif
playing = FALSE; playing = false;
running = FALSE; running = false;
break; break;
/* Message indicating the playback is complete */ /* Message indicating the playback is complete */
case AUDIO_MSG_COMPLETE: case AUDIO_MSG_COMPLETE:
running = FALSE; running = false;
break; break;
/* Unknown / unsupported message ID */ /* Unknown / unsupported message ID */