Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
nuttx-apps
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
f4grx
nuttx-apps
Commits
a33d316c
Commit
a33d316c
authored
10 years ago
by
Gregory Nutt
Browse files
Options
Downloads
Patches
Plain Diff
Changes to integrate with Ken's NxWM::CMediaPlayer
parent
1a31ee3e
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
NxWidgets/Kconfig
+2
-2
2 additions, 2 deletions
NxWidgets/Kconfig
include/nxplayer.h
+6
-4
6 additions, 4 deletions
include/nxplayer.h
system/nxplayer/nxplayer.c
+29
-18
29 additions, 18 deletions
system/nxplayer/nxplayer.c
with
37 additions
and
24 deletions
NxWidgets/Kconfig
+
2
−
2
View file @
a33d316c
...
@@ -1154,7 +1154,7 @@ config NXWM_MEDIAPLAYER_MEDIAPATH
...
@@ -1154,7 +1154,7 @@ config NXWM_MEDIAPLAYER_MEDIAPATH
containing all of the media files accessible by the media player.
containing all of the media files accessible by the media player.
config NXWM_MEDIAPLAYER_NOFILTER
config NXWM_MEDIAPLAYER_NOFILTER
bool "Disable filtering by file name extension
bool "Disable filtering by file name extension
"
default y
default y
config NXWM_MEDIAPLAYER_FILTER
config NXWM_MEDIAPLAYER_FILTER
...
@@ -1180,7 +1180,7 @@ config NXWM_MEDIAPLAYER_FILTER_WAV
...
@@ -1180,7 +1180,7 @@ config NXWM_MEDIAPLAYER_FILTER_WAV
config NXWM_MEDIAPLAYER_FILTER_PCM
config NXWM_MEDIAPLAYER_FILTER_PCM
bool "Accept .pcm extension"
bool "Accept .pcm extension"
default
y
default
n
select NXWM_MEDIAPLAYER_FILTER
select NXWM_MEDIAPLAYER_FILTER
config NXWM_MEDIAPLAYER_FILTER_MP3
config NXWM_MEDIAPLAYER_FILTER_MP3
...
...
This diff is collapsed.
Click to expand it.
include/nxplayer.h
+
6
−
4
View file @
a33d316c
...
@@ -193,7 +193,8 @@ void nxplayer_reference(FAR struct nxplayer_s *pPlayer);
...
@@ -193,7 +193,8 @@ void nxplayer_reference(FAR struct nxplayer_s *pPlayer);
*
*
**************************************************************************/
**************************************************************************/
int
nxplayer_setdevice
(
FAR
struct
nxplayer_s
*
pPlayer
,
FAR
const
char
*
device
);
int
nxplayer_setdevice
(
FAR
struct
nxplayer_s
*
pPlayer
,
FAR
const
char
*
device
);
/****************************************************************************
/****************************************************************************
* Name: nxplayer_playfile
* Name: nxplayer_playfile
...
@@ -216,8 +217,8 @@ int nxplayer_setdevice(FAR struct nxplayer_s *pPlayer, FAR const char *device);
...
@@ -216,8 +217,8 @@ int nxplayer_setdevice(FAR struct nxplayer_s *pPlayer, FAR const char *device);
*
*
**************************************************************************/
**************************************************************************/
int
nxplayer_playfile
(
FAR
struct
nxplayer_s
*
pPlayer
,
FAR
char
*
filename
,
int
nxplayer_playfile
(
FAR
struct
nxplayer_s
*
pPlayer
,
int
filefmt
,
int
subfmt
);
FAR
const
char
*
filename
,
int
filefmt
,
int
subfmt
);
/****************************************************************************
/****************************************************************************
* Name: nxplayer_stop
* Name: nxplayer_stop
...
@@ -397,7 +398,8 @@ int nxplayer_setbalance(FAR struct nxplayer_s *pPlayer, uint16_t balance);
...
@@ -397,7 +398,8 @@ int nxplayer_setbalance(FAR struct nxplayer_s *pPlayer, uint16_t balance);
*
*
**************************************************************************/
**************************************************************************/
void
nxplayer_setmediadir
(
FAR
struct
nxplayer_s
*
pPlayer
,
FAR
char
*
mediadir
);
void
nxplayer_setmediadir
(
FAR
struct
nxplayer_s
*
pPlayer
,
FAR
const
char
*
mediadir
);
/****************************************************************************
/****************************************************************************
* Name: nxplayer_setequalization
* Name: nxplayer_setequalization
...
...
This diff is collapsed.
Click to expand it.
system/nxplayer/nxplayer.c
+
29
−
18
View file @
a33d316c
...
@@ -386,7 +386,8 @@ int nxplayer_getmidisubformat(FAR FILE *fd)
...
@@ -386,7 +386,8 @@ int nxplayer_getmidisubformat(FAR FILE *fd)
#ifdef CONFIG_NXPLAYER_FMT_FROM_EXT
#ifdef CONFIG_NXPLAYER_FMT_FROM_EXT
static
inline
int
nxplayer_fmtfromextension
(
FAR
struct
nxplayer_s
*
pPlayer
,
static
inline
int
nxplayer_fmtfromextension
(
FAR
struct
nxplayer_s
*
pPlayer
,
char
*
pFilename
,
int
*
subfmt
)
FAR
const
char
*
pFilename
,
FAR
int
*
subfmt
)
{
{
const
char
*
pExt
;
const
char
*
pExt
;
uint8_t
x
;
uint8_t
x
;
...
@@ -414,7 +415,6 @@ static inline int nxplayer_fmtfromextension(FAR struct nxplayer_s *pPlayer,
...
@@ -414,7 +415,6 @@ static inline int nxplayer_fmtfromextension(FAR struct nxplayer_s *pPlayer,
if
(
subfmt
&&
g_known_ext
[
c
].
getsubformat
)
if
(
subfmt
&&
g_known_ext
[
c
].
getsubformat
)
{
{
*
subfmt
=
g_known_ext
[
c
].
getsubformat
(
pPlayer
->
fileFd
);
*
subfmt
=
g_known_ext
[
c
].
getsubformat
(
pPlayer
->
fileFd
);
}
}
...
@@ -428,7 +428,9 @@ static inline int nxplayer_fmtfromextension(FAR struct nxplayer_s *pPlayer,
...
@@ -428,7 +428,9 @@ static inline int nxplayer_fmtfromextension(FAR struct nxplayer_s *pPlayer,
/* Stop if we find a '/' */
/* Stop if we find a '/' */
if
(
pFilename
[
x
]
==
'/'
)
if
(
pFilename
[
x
]
==
'/'
)
break
;
{
break
;
}
x
--
;
x
--
;
}
}
...
@@ -463,8 +465,8 @@ static int nxplayer_fmtfromheader(FAR struct nxplayer_s *pPlayer)
...
@@ -463,8 +465,8 @@ static int nxplayer_fmtfromheader(FAR struct nxplayer_s *pPlayer)
#if defined(CONFIG_NXPLAYER_MEDIA_SEARCH) && defined(CONFIG_NXPLAYER_INCLUDE_MEDIADIR)
#if defined(CONFIG_NXPLAYER_MEDIA_SEARCH) && defined(CONFIG_NXPLAYER_INCLUDE_MEDIADIR)
static
int
nxplayer_mediasearch
(
FAR
struct
nxplayer_s
*
pPlayer
,
static
int
nxplayer_mediasearch
(
FAR
struct
nxplayer_s
*
pPlayer
,
FAR
char
*
pFilename
,
FAR
char
*
path
,
FAR
const
char
*
pFilename
,
int
pathmax
)
FAR
const
char
*
path
,
int
pathmax
)
{
{
return
-
ENOENT
;
return
-
ENOENT
;
}
}
...
@@ -484,8 +486,6 @@ static int nxplayer_enqueuebuffer(FAR struct nxplayer_s *pPlayer,
...
@@ -484,8 +486,6 @@ static int nxplayer_enqueuebuffer(FAR struct nxplayer_s *pPlayer,
struct
audio_buf_desc_s
bufdesc
;
struct
audio_buf_desc_s
bufdesc
;
int
ret
;
int
ret
;
//auddbg("Entry: %p\n", pBuf);
/* Validate the file is still open */
/* Validate the file is still open */
if
(
pPlayer
->
fileFd
==
NULL
)
if
(
pPlayer
->
fileFd
==
NULL
)
...
@@ -564,17 +564,18 @@ static void *nxplayer_playthread(pthread_addr_t pvarg)
...
@@ -564,17 +564,18 @@ static void *nxplayer_playthread(pthread_addr_t pvarg)
struct
nxplayer_s
*
pPlayer
=
(
struct
nxplayer_s
*
)
pvarg
;
struct
nxplayer_s
*
pPlayer
=
(
struct
nxplayer_s
*
)
pvarg
;
struct
audio_msg_s
msg
;
struct
audio_msg_s
msg
;
struct
audio_buf_desc_s
buf_desc
;
struct
audio_buf_desc_s
buf_desc
;
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
;
#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
;
FAR
struct
ap_buffer_s
**
pBuffers
;
FAR
struct
ap_buffer_s
**
pBuffers
;
#else
#else
FAR
struct
ap_buffer_s
*
pBuffers
[
CONFIG_AUDIO_NUM_BUFFERS
];
FAR
struct
ap_buffer_s
*
pBuffers
[
CONFIG_AUDIO_NUM_BUFFERS
];
#endif
#endif
int
prio
;
int
x
;
int
ret
;
auddbg
(
"Entry
\n
"
);
auddbg
(
"Entry
\n
"
);
...
@@ -688,7 +689,7 @@ static void *nxplayer_playthread(pthread_addr_t pvarg)
...
@@ -688,7 +689,7 @@ static void *nxplayer_playthread(pthread_addr_t pvarg)
/* Set parameters such as volume, bass, etc. */
/* Set parameters such as volume, bass, etc. */
#ifndef CONFIG_AUDIO_EXCLUDE_VOLUME
#ifndef CONFIG_AUDIO_EXCLUDE_VOLUME
nxplayer_setvolume
(
pPlayer
,
pPlayer
->
volume
);
(
void
)
nxplayer_setvolume
(
pPlayer
,
pPlayer
->
volume
);
#endif
#endif
#ifndef CONFIG_AUDIO_EXCLUDE_BALANCE
#ifndef CONFIG_AUDIO_EXCLUDE_BALANCE
nxplayer_setbalance
(
pPlayer
,
pPlayer
->
balance
);
nxplayer_setbalance
(
pPlayer
,
pPlayer
->
balance
);
...
@@ -866,6 +867,7 @@ err_out:
...
@@ -866,6 +867,7 @@ err_out:
int
nxplayer_setvolume
(
FAR
struct
nxplayer_s
*
pPlayer
,
uint16_t
volume
)
int
nxplayer_setvolume
(
FAR
struct
nxplayer_s
*
pPlayer
,
uint16_t
volume
)
{
{
struct
audio_caps_desc_s
cap_desc
;
struct
audio_caps_desc_s
cap_desc
;
int
ret
;
/* Thread sync using the semaphore */
/* Thread sync using the semaphore */
...
@@ -889,16 +891,23 @@ int nxplayer_setvolume(FAR struct nxplayer_s *pPlayer, uint16_t volume)
...
@@ -889,16 +891,23 @@ int nxplayer_setvolume(FAR struct nxplayer_s *pPlayer, uint16_t volume)
cap_desc
.
caps
.
ac_type
=
AUDIO_TYPE_FEATURE
;
cap_desc
.
caps
.
ac_type
=
AUDIO_TYPE_FEATURE
;
cap_desc
.
caps
.
ac_format
.
hw
=
AUDIO_FU_VOLUME
;
cap_desc
.
caps
.
ac_format
.
hw
=
AUDIO_FU_VOLUME
;
cap_desc
.
caps
.
ac_controls
.
hw
[
0
]
=
volume
;
cap_desc
.
caps
.
ac_controls
.
hw
[
0
]
=
volume
;
ioctl
(
pPlayer
->
devFd
,
AUDIOIOC_CONFIGURE
,
(
unsigned
long
)
&
cap_desc
);
ret
=
ioctl
(
pPlayer
->
devFd
,
AUDIOIOC_CONFIGURE
,
(
unsigned
long
)
&
cap_desc
);
if
(
ret
<
0
)
{
int
errcode
=
errno
;
DEBUGASSERT
(
errcode
>
0
);
auddbg
(
"ERROR: AUDIOIOC_CONFIGURE ioctl failed: %d
\n
"
,
errcode
);
return
-
errcode
;
}
}
}
/* Store the volume setting */
/* Store the volume setting */
pPlayer
->
volume
=
volume
;
pPlayer
->
volume
=
volume
;
sem_post
(
&
pPlayer
->
sem
);
sem_post
(
&
pPlayer
->
sem
);
return
-
ENOENT
;
return
OK
;
}
}
#endif
/* CONFIG_AUDIO_EXCLUDE_VOLUME */
#endif
/* CONFIG_AUDIO_EXCLUDE_VOLUME */
...
@@ -1341,17 +1350,18 @@ int nxplayer_stop(FAR struct nxplayer_s *pPlayer)
...
@@ -1341,17 +1350,18 @@ int nxplayer_stop(FAR struct nxplayer_s *pPlayer)
*
*
****************************************************************************/
****************************************************************************/
int
nxplayer_playfile
(
FAR
struct
nxplayer_s
*
pPlayer
,
FAR
char
*
pFilename
,
int
nxplayer_playfile
(
FAR
struct
nxplayer_s
*
pPlayer
,
int
filefmt
,
int
subfmt
)
FAR
const
char
*
pFilename
,
int
filefmt
,
int
subfmt
)
{
{
int
ret
,
tmpsubfmt
=
AUDIO_FMT_UNDEF
;
struct
mq_attr
attr
;
struct
mq_attr
attr
;
struct
sched_param
sparam
;
struct
sched_param
sparam
;
pthread_attr_t
tattr
;
pthread_attr_t
tattr
;
void
*
value
;
void
*
value
;
#ifdef CONFIG_NXPLAYER_INCLUDE_MEDIADIR
#ifdef CONFIG_NXPLAYER_INCLUDE_MEDIADIR
char
path
[
128
];
char
path
[
128
];
#endif
#endif
int
tmpsubfmt
=
AUDIO_FMT_UNDEF
;
int
ret
;
DEBUGASSERT
(
pPlayer
!=
NULL
);
DEBUGASSERT
(
pPlayer
!=
NULL
);
DEBUGASSERT
(
pFilename
!=
NULL
);
DEBUGASSERT
(
pFilename
!=
NULL
);
...
@@ -1542,7 +1552,8 @@ err_out_nodev:
...
@@ -1542,7 +1552,8 @@ err_out_nodev:
****************************************************************************/
****************************************************************************/
#ifdef CONFIG_NXPLAYER_INCLUDE_MEDIADIR
#ifdef CONFIG_NXPLAYER_INCLUDE_MEDIADIR
void
nxplayer_setmediadir
(
FAR
struct
nxplayer_s
*
pPlayer
,
char
*
mediadir
)
void
nxplayer_setmediadir
(
FAR
struct
nxplayer_s
*
pPlayer
,
FAR
const
char
*
mediadir
)
{
{
strncpy
(
pPlayer
->
mediadir
,
mediadir
,
sizeof
(
pPlayer
->
mediadir
));
strncpy
(
pPlayer
->
mediadir
,
mediadir
,
sizeof
(
pPlayer
->
mediadir
));
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment