Remove trailing whitespace

This commit is contained in:
Gregory Nutt 2013-10-27 07:45:16 -06:00
parent 96a778cf46
commit 52464a4412
5 changed files with 74 additions and 74 deletions

View File

@ -96,12 +96,12 @@ typedef int (*nxplayer_func)(FAR struct nxplayer_s* pPlayer, char* pargs);
/****************************************************************************
* Name: nxplayer_create
*
* Allocates and Initializes a NxPlayer context that is passed to all
* nxplayer routines. The player MUST be destroyed using the
* Allocates and Initializes a NxPlayer context that is passed to all
* nxplayer routines. The player MUST be destroyed using the
* nxplayer_destroy() routine since the context is reference counted.
* The context can be used in a mode where the caller creates the
* context, starts a file playing, and then forgets about the context
* and it will self free. This is because the nxplayer_playfile
* and it will self free. This is because the nxplayer_playfile
* will also create a reference to the context, so the client calling
* nxplayer_destroy() won't actually de-allocate anything. The freeing
* will occur after the playthread has completed.
@ -150,10 +150,10 @@ void nxplayer_reference(FAR struct nxplayer_s *pPlayer);
/****************************************************************************
* Name: nxplayer_setdevice
*
* Sets the preferred Audio device to use with the instance of the
* Sets the preferred Audio device to use with the instance of the
* nxplayer. Without a preferred device set, the nxplayer will search
* the audio subsystem to find a suitable device depending on the
* type of audio operation requested (i.e. an MP3 decoder device when
* the audio subsystem to find a suitable device depending on the
* type of audio operation requested (i.e. an MP3 decoder device when
* playing an MP3 file, a WAV decoder device for a WAV file, etc.).
*
* Input Parameters:
@ -172,13 +172,13 @@ int nxplayer_setdevice(FAR struct nxplayer_s *pPlayer, char* device);
*
* Plays the specified media file (from the filesystem) using the
* Audio system. If a preferred device has been set, that device
* will be used for the playback, otherwise the first suitable device
* will be used for the playback, otherwise the first suitable device
* found in the /dev/audio directory will be used.
*
*
* Input Parameters:
* pPlayer - Pointer to the context to initialize
* filename - Pointer to pathname of the file to play
* filefmt - Format of audio in filename if known, AUDIO_FMT_UNDEF
* filefmt - Format of audio in filename if known, AUDIO_FMT_UNDEF
* to let nxplayer_playfile() determine automatically.
*
* Returned values:
@ -193,7 +193,7 @@ int nxplayer_playfile(FAR struct nxplayer_s *pPlayer, char* filename,
* Name: nxplayer_stop
*
* Stops current playback.
*
*
* Input Parameters:
* pPlayer - Pointer to the context to initialize
*
@ -210,7 +210,7 @@ int nxplayer_stop(FAR struct nxplayer_s *pPlayer);
* Name: nxplayer_pause
*
* Pauses current playback.
*
*
* Input Parameters:
* pPlayer - Pointer to the context to initialize
*
@ -227,7 +227,7 @@ int nxplayer_pause(FAR struct nxplayer_s *pPlayer);
* Name: nxplayer_resume
*
* Resuems current playback.
*
*
* Input Parameters:
* pPlayer - Pointer to the context to initialize
*
@ -245,8 +245,8 @@ int nxplayer_resume(FAR struct nxplayer_s *pPlayer);
*
* Sets the playback volume. The volume is represented in 1/10th of a
* percent increments, so the range is 0-1000. A value of 10 would mean
* 1%.
*
* 1%.
*
* Input Parameters:
* pPlayer - Pointer to the context to initialize
* volume - Volume level to set in 1/10th percent increments
@ -265,8 +265,8 @@ int nxplayer_setvolume(FAR struct nxplayer_s *pPlayer, uint16_t volume);
*
* Sets the playback balance. The balance is represented in 1/10th of a
* percent increments, so the range is 0-1000. A value of 10 would mean
* 1%.
*
* 1%.
*
* Input Parameters:
* pPlayer - Pointer to the context to initialize
* balance - Balance level to set in 1/10th percent increments
@ -300,8 +300,8 @@ inline void nxplayer_setmediadir(FAR struct nxplayer_s *pPlayer, char* mediadir)
* Name: nxplayer_setbass
*
* Sets the playback bass level. The bass is represented in one percent
* increments, so the range is 0-100.
*
* increments, so the range is 0-100.
*
* Input Parameters:
* pPlayer - Pointer to the context to initialize
* bass - Bass level to set in one percent increments
@ -319,8 +319,8 @@ int nxplayer_setbass(FAR struct nxplayer_s *pPlayer, uint8_t bass);
* Name: nxplayer_settreble
*
* Sets the playback treble level. The bass is represented in one percent
* increments, so the range is 0-100.
*
* increments, so the range is 0-100.
*
* Input Parameters:
* pPlayer - Pointer to the context to initialize
* treble - Treble level to set in one percent increments
@ -339,7 +339,7 @@ int nxplayer_settreble(FAR struct nxplayer_s *pPlayer, uint8_t treble);
*
* Performs an audio system reset, including a hardware reset on all
* registered audio devices.
*
*
* Input Parameters:
* pPlayer - Pointer to the context to initialize
*

View File

@ -55,7 +55,7 @@ config NXPLAYER_FMT_FROM_EXT
---help---
Compiles in extra code to determine audio format based
on the filename extension for known file types.
This feature is used if the format is not manually
This feature is used if the format is not manually
specified, and will take priority over the more lengthy
file content detection approach.

View File

@ -81,7 +81,7 @@ ROOTDEPPATH = --dep-path .
# Common build
VPATH =
VPATH =
all: .built
.PHONY: context depend clean distclean

View File

@ -53,7 +53,7 @@
#include <apps/nxplayer.h>
/****************************************************************************
* Pre-processor Definitions
* Pre-processor Definitions
****************************************************************************/
#define NXPLAYER_STATE_IDLE 0
@ -117,7 +117,7 @@ static const struct nxplayer_ext_fmt_s g_known_ext[] = {
{ "ogg", AUDIO_FMT_OGG_VORBIS }
#endif
};
static const int g_known_ext_count = sizeof(g_known_ext) /
static const int g_known_ext_count = sizeof(g_known_ext) /
sizeof(struct nxplayer_ext_fmt_s);
#endif /* CONFIG_NXPLAYER_FMT_FROM_EXT */
@ -156,7 +156,7 @@ static int nxplayer_opendevice(FAR struct nxplayer_s *pPlayer, int format)
* format is specified by the device
*/
if (((pPlayer->prefformat & format) == 0) ||
if (((pPlayer->prefformat & format) == 0) ||
((pPlayer->preftype & AUDIO_TYPE_OUTPUT) == 0))
{
/* Format not supported by the device */
@ -223,13 +223,13 @@ static int nxplayer_opendevice(FAR struct nxplayer_s *pPlayer, int format)
caps.ac_len = sizeof(caps);
caps.ac_type = AUDIO_TYPE_QUERY;
caps.ac_subtype = AUDIO_TYPE_QUERY;
if (ioctl(pPlayer->devFd, AUDIOIOC_GETCAPS, (unsigned long) &caps)
if (ioctl(pPlayer->devFd, AUDIOIOC_GETCAPS, (unsigned long) &caps)
== caps.ac_len)
{
/* Test if this device supports the format we want */
int ac_format = caps.ac_format[0] | (caps.ac_format[1] << 8);
if (((ac_format & format) != 0) &&
if (((ac_format & format) != 0) &&
(caps.ac_controls[0] & AUDIO_TYPE_OUTPUT))
{
/* Yes, it supports this format. Use this device */
@ -244,13 +244,13 @@ static int nxplayer_opendevice(FAR struct nxplayer_s *pPlayer, int format)
close(pPlayer->devFd);
}
}
/* Close the directory */
closedir(dirp);
}
#endif /* CONFIG_NXPLAYER_INCLUDE_DEVICE_SEARCH */
/* Device not found */
pPlayer->devFd = -1;
@ -293,11 +293,11 @@ static int nxplayer_fmtfromextension(char* pFilename)
return g_known_ext[c].format;
}
}
}
}
/* Stop if we find a '/' */
if (pFilename[x] == '/')
break;
@ -342,13 +342,13 @@ static int nxplayer_mediasearch(FAR struct nxplayer_s *pPlayer, char *pFilename,
/****************************************************************************
* Name: nxplayer_enqueuebuffer
*
*
* Reads the next block of data from the media file into the specified
* buffer and enqueues it to the audio device.
*
****************************************************************************/
static int nxplayer_enqueuebuffer(struct nxplayer_s *pPlayer,
static int nxplayer_enqueuebuffer(struct nxplayer_s *pPlayer,
struct ap_buffer_s* pBuf)
{
struct audio_buf_desc_s bufdesc;
@ -382,7 +382,7 @@ static int nxplayer_enqueuebuffer(struct nxplayer_s *pPlayer,
#endif
bufdesc.numbytes = pBuf->nbytes;
bufdesc.u.pBuffer = pBuf;
ret = ioctl(pPlayer->devFd, AUDIOIOC_ENQUEUEBUFFER, (unsigned long)
ret = ioctl(pPlayer->devFd, AUDIOIOC_ENQUEUEBUFFER, (unsigned long)
&bufdesc);
if (ret >= 0)
ret = OK;
@ -394,7 +394,7 @@ static int nxplayer_enqueuebuffer(struct nxplayer_s *pPlayer,
/****************************************************************************
* Name: nxplayer_thread_playthread
*
*
* This is the thread that reads the audio file file and enqueue's /
* dequeues buffers to the selected and opened audio device.
*
@ -467,7 +467,7 @@ static void *nxplayer_playthread(pthread_addr_t pvarg)
buf_desc.numbytes = CONFIG_AUDIO_BUFFER_NUMBYTES;
#endif
buf_desc.u.ppBuffer = &pBuffers[x];
ret = ioctl(pPlayer->devFd, AUDIOIOC_ALLOCBUFFER,
ret = ioctl(pPlayer->devFd, AUDIOIOC_ALLOCBUFFER,
(unsigned long) &buf_desc);
if (ret != sizeof(buf_desc))
{
@ -480,7 +480,7 @@ static void *nxplayer_playthread(pthread_addr_t pvarg)
}
/* Fill up the pipeline with enqueued buffers */
#ifdef CONFIG_AUDIO_DRIVER_SPECIFIC_BUFFERS
for (x = 0; x < buf_info.nbuffers; x++)
#else
@ -500,13 +500,13 @@ static void *nxplayer_playthread(pthread_addr_t pvarg)
playing = FALSE;
break;
}
}
}
/* Start the audio device */
#ifdef CONFIG_AUDIO_MULTI_SESSION
ret = ioctl(pPlayer->devFd, AUDIOIOC_START,
ret = ioctl(pPlayer->devFd, AUDIOIOC_START,
(unsigned long) pPlayer->session);
#else
ret = ioctl(pPlayer->devFd, AUDIOIOC_START, 0);
@ -562,7 +562,7 @@ static void *nxplayer_playthread(pthread_addr_t pvarg)
case AUDIO_MSG_DEQUEUE:
/* Read data from the file directly into this buffer
/* Read data from the file directly into this buffer
* and re-enqueue it.
*/
@ -573,7 +573,7 @@ static void *nxplayer_playthread(pthread_addr_t pvarg)
{
/* Out of data. Stay in the loop until the
* device sends us a COMPLETE message, but stop
* trying to play more data.
* trying to play more data.
*/
playing = FALSE;
@ -588,7 +588,7 @@ static void *nxplayer_playthread(pthread_addr_t pvarg)
/* Send a stop message to the device */
#ifdef CONFIG_AUDIO_MULTI_SESSION
ioctl(pPlayer->devFd, AUDIOIOC_STOP,
ioctl(pPlayer->devFd, AUDIOIOC_STOP,
(unsigned long) pPlayer->session);
#else
ioctl(pPlayer->devFd, AUDIOIOC_STOP, 0);
@ -618,9 +618,9 @@ err_out:
ioctl(pPlayer->devFd, AUDIOIOC_UNREGISTERMQ, (unsigned long) pPlayer->mq);
#ifdef CONFIG_AUDIO_MULTI_SESSION
ioctl(pPlayer->devFd, AUDIOIOC_RELEASE, (unsigned long) pPlayer->session);
ioctl(pPlayer->devFd, AUDIOIOC_RELEASE, (unsigned long) pPlayer->session);
#else
ioctl(pPlayer->devFd, AUDIOIOC_RELEASE, 0);
ioctl(pPlayer->devFd, AUDIOIOC_RELEASE, 0);
#endif
/* Cleanup */
@ -680,7 +680,7 @@ err_out:
* actually cause the context to be freed if the creator has already
* abandoned (released) the context too.
*/
nxplayer_release(pPlayer);
auddbg("Exit\n");
@ -905,7 +905,7 @@ int nxplayer_pause(FAR struct nxplayer_s *pPlayer)
if (pPlayer->state == NXPLAYER_STATE_PLAYING)
{
#ifdef CONFIG_AUDIO_MULTI_SESSION
ret = ioctl(pPlayer->devFd, AUDIOIOC_PAUSE,
ret = ioctl(pPlayer->devFd, AUDIOIOC_PAUSE,
(unsigned long) pPlayer->session);
#else
ret = ioctl(pPlayer->devFd, AUDIOIOC_PAUSE, 0);
@ -933,7 +933,7 @@ int nxplayer_resume(FAR struct nxplayer_s *pPlayer)
if (pPlayer->state == NXPLAYER_STATE_PAUSED)
{
#ifdef CONFIG_AUDIO_MULTI_SESSION
ret = ioctl(pPlayer->devFd, AUDIOIOC_RESUME,
ret = ioctl(pPlayer->devFd, AUDIOIOC_RESUME,
(unsigned long) pPlayer->session);
#else
ret = ioctl(pPlayer->devFd, AUDIOIOC_RESUME, 0);
@ -950,7 +950,7 @@ int nxplayer_resume(FAR struct nxplayer_s *pPlayer)
* Name: nxplayer_setdevice
*
* nxplayer_setdevice() sets the perferred audio device to use with the
* provided nxplayer context.
* provided nxplayer context.
*
****************************************************************************/
@ -972,7 +972,7 @@ int nxplayer_setdevice(FAR struct nxplayer_s *pPlayer, char* pDevice)
return -ENOENT;
}
/* Validate it's an Audio device by issuing an AUDIOIOC_GETCAPS ioctl */
caps.ac_len = sizeof(caps);
@ -981,7 +981,7 @@ int nxplayer_setdevice(FAR struct nxplayer_s *pPlayer, char* pDevice)
if (ioctl(tempFd, AUDIOIOC_GETCAPS, (unsigned long) &caps) != caps.ac_len)
{
/* Not an Audio device! */
close(tempFd);
return -ENODEV;
}
@ -1104,7 +1104,7 @@ int nxplayer_playfile(FAR struct nxplayer_s *pPlayer, char* pFilename, int filef
{
#ifdef CONFIG_NXPLAYER_MEDIA_SEARCH
/* File not found in the media dir. Do a search */
if (nxplayer_mediasearch(pPlayer, pFilename, path, sizeof(path)) != OK)
return -ENOENT;
#else
@ -1115,7 +1115,7 @@ int nxplayer_playfile(FAR struct nxplayer_s *pPlayer, char* pFilename, int filef
#else /* CONFIG_NXPLAYER_INCLUDE_MEDIADIR */
return -ENOENT;
#endif /* CONFIG_NXPLAYER_INCLUDE_MEDIADIR */
}
}
/* Try to determine the format of audio file based on the extension */
@ -1150,11 +1150,11 @@ int nxplayer_playfile(FAR struct nxplayer_s *pPlayer, char* pFilename, int filef
goto err_out_nodev;
}
/* Try to reserve the device */
#ifdef CONFIG_AUDIO_MULTI_SESSION
ret = ioctl(pPlayer->devFd, AUDIOIOC_RESERVE, (unsigned long)
ret = ioctl(pPlayer->devFd, AUDIOIOC_RESERVE, (unsigned long)
&pPlayer->session);
#else
ret = ioctl(pPlayer->devFd, AUDIOIOC_RESERVE, 0);
@ -1197,7 +1197,7 @@ int nxplayer_playfile(FAR struct nxplayer_s *pPlayer, char* pFilename, int filef
pthread_join(pPlayer->playId, &value);
}
/* Start the playfile thread to stream the media file to the
/* Start the playfile thread to stream the media file to the
* audio device.
*/
@ -1205,13 +1205,13 @@ int nxplayer_playfile(FAR struct nxplayer_s *pPlayer, char* pFilename, int filef
sparam.sched_priority = sched_get_priority_max(SCHED_FIFO) - 9;
pthread_attr_setschedparam(&tattr, &sparam);
/* Add a reference count to the player for the thread and start the
/* Add a reference count to the player for the thread and start the
* thread. We increment for the thread to avoid thread start-up
* race conditions.
*/
nxplayer_reference(pPlayer);
ret = pthread_create(&pPlayer->playId, &tattr, nxplayer_playthread,
ret = pthread_create(&pPlayer->playId, &tattr, nxplayer_playthread,
(pthread_addr_t) pPlayer);
if (ret != OK)
{
@ -1250,8 +1250,8 @@ void nxplayer_setmediadir(FAR struct nxplayer_s *pPlayer, char *mediadir)
/****************************************************************************
* Name: nxplayer_create
*
* nxplayer_create() allocates and initializes a nxplayer context for
* use by further nxplayer operations. This routine must be called before
* nxplayer_create() allocates and initializes a nxplayer context for
* use by further nxplayer operations. This routine must be called before
* to perform the create for proper reference counting.
*
* Input Parameters: None
@ -1305,7 +1305,7 @@ FAR struct nxplayer_s *nxplayer_create(void)
#endif
#ifdef CONFIG_NXPLAYER_INCLUDE_MEDIADIR
strncpy(pPlayer->mediadir, CONFIG_NXPLAYER_DEFAULT_MEDIADIR,
strncpy(pPlayer->mediadir, CONFIG_NXPLAYER_DEFAULT_MEDIADIR,
sizeof(pPlayer->mediadir));
#endif
sem_init(&pPlayer->sem, 0, 1);
@ -1316,7 +1316,7 @@ FAR struct nxplayer_s *nxplayer_create(void)
/****************************************************************************
* Name: nxplayer_release
*
* nxplayer_release() reduces the reference count by one and if it
* nxplayer_release() reduces the reference count by one and if it
* reaches zero, frees the context.
*
* Input Parameters:
@ -1341,7 +1341,7 @@ void nxplayer_release(FAR struct nxplayer_s* pPlayer)
return;
}
}
/* Check if there was a previous thread and join it if there was */
if (pPlayer->playId != 0)
@ -1396,7 +1396,7 @@ void nxplayer_reference(FAR struct nxplayer_s* pPlayer)
return;
}
}
/* Increment the reference count */
pPlayer->crefs++;
@ -1407,7 +1407,7 @@ void nxplayer_reference(FAR struct nxplayer_s* pPlayer)
* Name: nxplayer_detach
*
* nxplayer_detach() detaches from the playthread to make it independant
* so the caller can abandon the context while the file is still
* so the caller can abandon the context while the file is still
* being played.
*
* Input Parameters:
@ -1432,7 +1432,7 @@ void nxplayer_detach(FAR struct nxplayer_s* pPlayer)
return;
}
}
if (pPlayer->playId != NULL)
{
/* Do a pthread detach */

View File

@ -53,7 +53,7 @@
#include <apps/nxplayer.h>
/****************************************************************************
* Pre-processor Definitions
* Pre-processor Definitions
****************************************************************************/
#define NXPLAYER_VER "1.04"
@ -123,7 +123,7 @@ static int nxplayer_cmd_help(FAR struct nxplayer_s *pPlayer, char* parg);
* Private Data
****************************************************************************/
static struct mp_cmd_s g_nxplayer_cmds[] =
static struct mp_cmd_s g_nxplayer_cmds[] =
{
#ifndef CONFIG_AUDIO_EXCLUDE_VOLUME
#ifndef CONFIG_AUDIO_EXCLUDE_BALANCE
@ -213,7 +213,7 @@ static int nxplayer_cmd_play(FAR struct nxplayer_s *pPlayer, char* parg)
if (ret < 0)
{
return ret;
return ret;
}
/* File playing successfully */
@ -490,7 +490,7 @@ static int nxplayer_cmd_device(FAR struct nxplayer_s *pPlayer, char* parg)
if (ret < 0)
{
return ret;
return ret;
}
/* Device set successfully */
@ -564,8 +564,8 @@ static int nxplayer_cmd_help(FAR struct nxplayer_s *pPlayer, char* parg)
* nxplayer() reads in commands from the console using the readline
* system add-in and implemets a command-line based media player that
* uses the NuttX audio system to play media files read in from the
* file system. Commands are provided for setting volume, base and
* other audio features, as well as for pausing and stoping the
* file system. Commands are provided for setting volume, base and
* other audio features, as well as for pausing and stoping the
* playback.
*
* Input Parameters:
@ -602,7 +602,7 @@ int nxplayer_main(int argc, char *argv[])
}
/* Loop until the user exits */
running = TRUE;
while (running)
{
@ -638,7 +638,7 @@ int nxplayer_main(int argc, char *argv[])
if (strcmp(cmd, g_nxplayer_cmds[x].cmd) == 0)
{
/* Command found. Call it's handler if not NULL */
if (g_nxplayer_cmds[x].pFunc != NULL)
g_nxplayer_cmds[x].pFunc(pPlayer, arg);