Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
445d807b
Commit
445d807b
authored
Mar 21, 2004
by
Warren Dukes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
streamline ls.c code
remove dontUpSampleSBR, not in faad2 rc3 git-svn-id:
https://svn.musicpd.org/mpd/trunk@330
09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent
6436b0ac
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
79 additions
and
156 deletions
+79
-156
ls.c
src/ls.c
+75
-155
ls.h
src/ls.h
+2
-0
mp4_decode.c
src/mp4_decode.c
+2
-1
No files found.
src/ls.c
View file @
445d807b
...
@@ -110,59 +110,7 @@ int lsPlaylists(FILE * fp, char * utf8path) {
...
@@ -110,59 +110,7 @@ int lsPlaylists(FILE * fp, char * utf8path) {
return
0
;
return
0
;
}
}
int
isMusic
(
char
*
utf8file
,
time_t
*
mtime
)
{
int
isFile
(
char
*
utf8file
,
time_t
*
mtime
)
{
int
ret
=
0
;
#ifdef HAVE_OGG
if
((
ret
=
isOgg
(
utf8file
,
mtime
)))
return
ret
;
#endif
#ifdef HAVE_FLAC
if
((
ret
=
isFlac
(
utf8file
,
mtime
)))
return
ret
;
#endif
#ifdef HAVE_MAD
if
((
ret
=
isMp3
(
utf8file
,
mtime
)))
return
ret
;
#endif
#ifdef HAVE_AUDIOFILE
if
((
ret
=
isWave
(
utf8file
,
mtime
)))
return
ret
;
#endif
#ifdef HAVE_FAAD
if
((
ret
=
isMp4
(
utf8file
,
mtime
)))
return
ret
;
#endif
return
ret
;
}
int
isPlaylist
(
char
*
utf8file
)
{
struct
stat
st
;
char
*
file
=
utf8ToFsCharset
(
utf8file
);
char
*
actualFile
=
file
;
char
*
temp
=
NULL
;
if
(
actualFile
[
0
]
!=
'/'
)
actualFile
=
rpp2app
(
file
);
if
(
stat
(
actualFile
,
&
st
)
==
0
)
{
if
(
S_ISREG
(
st
.
st_mode
))
{
char
*
dup
;
char
*
cLast
;
char
*
cNext
;
int
ret
=
0
;
dup
=
strdup
(
file
);
cNext
=
cLast
=
strtok
(
dup
,
"."
);
while
((
cNext
=
strtok
(
NULL
,
"."
)))
cLast
=
cNext
;
if
(
cLast
&&
0
==
strcmp
(
cLast
,
PLAYLIST_FILE_SUFFIX
))
{
ret
=
1
;
}
free
(
dup
);
if
(
temp
)
free
(
temp
);
return
ret
;
}
}
if
(
temp
)
free
(
temp
);
return
0
;
}
int
isWave
(
char
*
utf8file
,
time_t
*
mtime
)
{
struct
stat
st
;
struct
stat
st
;
char
*
file
=
utf8ToFsCharset
(
utf8file
);
char
*
file
=
utf8ToFsCharset
(
utf8file
);
char
*
actualFile
=
file
;
char
*
actualFile
=
file
;
...
@@ -171,19 +119,8 @@ int isWave(char * utf8file, time_t * mtime) {
...
@@ -171,19 +119,8 @@ int isWave(char * utf8file, time_t * mtime) {
if
(
stat
(
actualFile
,
&
st
)
==
0
)
{
if
(
stat
(
actualFile
,
&
st
)
==
0
)
{
if
(
S_ISREG
(
st
.
st_mode
))
{
if
(
S_ISREG
(
st
.
st_mode
))
{
char
*
dup
;
char
*
cLast
;
char
*
cNext
;
int
ret
=
0
;
dup
=
strdup
(
file
);
cNext
=
cLast
=
strtok
(
dup
,
"."
);
while
((
cNext
=
strtok
(
NULL
,
"."
)))
cLast
=
cNext
;
if
(
cLast
&&
0
==
strcasecmp
(
cLast
,
"wav"
))
{
if
(
mtime
)
*
mtime
=
st
.
st_mtime
;
if
(
mtime
)
*
mtime
=
st
.
st_mtime
;
ret
=
1
;
return
1
;
}
free
(
dup
);
return
ret
;
}
}
else
return
0
;
else
return
0
;
}
}
...
@@ -191,121 +128,80 @@ int isWave(char * utf8file, time_t * mtime) {
...
@@ -191,121 +128,80 @@ int isWave(char * utf8file, time_t * mtime) {
return
0
;
return
0
;
}
}
int
isFlac
(
char
*
utf8file
,
time_t
*
mtime
)
{
int
hasSuffix
(
char
*
utf8file
,
char
*
suffix
)
{
struct
stat
st
;
char
*
file
=
utf8ToFsCharset
(
utf8file
);
char
*
file
=
utf8ToFsCharset
(
utf8file
);
char
*
actualFile
=
file
;
char
*
dup
=
strdup
(
file
);;
if
(
actualFile
[
0
]
!=
'/'
)
actualFile
=
rmp2amp
(
file
);
if
(
stat
(
actualFile
,
&
st
)
==
0
)
{
if
(
S_ISREG
(
st
.
st_mode
))
{
char
*
dup
;
char
*
cLast
;
char
*
cLast
;
char
*
cNext
;
char
*
cNext
=
cLast
=
strtok
(
dup
,
"."
)
;
int
ret
=
0
;
int
ret
=
0
;
dup
=
strdup
(
file
);
cNext
=
cLast
=
strtok
(
dup
,
"."
);
while
((
cNext
=
strtok
(
NULL
,
"."
)))
cLast
=
cNext
;
while
((
cNext
=
strtok
(
NULL
,
"."
)))
cLast
=
cNext
;
if
(
cLast
&&
0
==
strcasecmp
(
cLast
,
"flac"
))
{
if
(
cLast
&&
0
==
strcasecmp
(
cLast
,
suffix
))
ret
=
1
;
if
(
mtime
)
*
mtime
=
st
.
st_mtime
;
ret
=
1
;
}
free
(
dup
);
free
(
dup
);
return
ret
;
return
ret
;
}
}
else
return
0
;
}
int
isPlaylist
(
char
*
utf8file
)
{
if
(
isFile
(
utf8file
,
NULL
))
{
return
hasSuffix
(
utf8file
,
PLAYLIST_FILE_SUFFIX
);
}
return
0
;
return
0
;
}
}
int
isOgg
(
char
*
utf8file
,
time_t
*
mtime
)
{
int
hasWaveSuffix
(
char
*
utf8file
)
{
struct
stat
st
;
return
hasSuffix
(
utf8file
,
"wav"
);
char
*
file
=
utf8ToFsCharset
(
utf8file
);
}
char
*
actualFile
=
file
;
if
(
actualFile
[
0
]
!=
'/'
)
actualFile
=
rmp2amp
(
file
);
int
isWave
(
char
*
utf8file
,
time_t
*
mtime
)
{
if
(
isFile
(
utf8file
,
mtime
))
return
hasWaveSuffix
(
utf8file
);
return
0
;
}
if
(
stat
(
actualFile
,
&
st
)
==
0
)
{
int
hasFlacSuffix
(
char
*
utf8file
)
{
if
(
S_ISREG
(
st
.
st_mode
))
{
return
hasSuffix
(
utf8file
,
"flac"
);
char
*
dup
;
}
char
*
cLast
;
char
*
cNext
;
int
ret
=
0
;
dup
=
strdup
(
file
);
cNext
=
cLast
=
strtok
(
dup
,
"."
);
while
((
cNext
=
strtok
(
NULL
,
"."
)))
cLast
=
cNext
;
if
(
cLast
&&
0
==
strcasecmp
(
cLast
,
"ogg"
))
{
if
(
mtime
)
*
mtime
=
st
.
st_mtime
;
ret
=
1
;
}
free
(
dup
);
return
ret
;
}
else
return
0
;
}
int
isFlac
(
char
*
utf8file
,
time_t
*
mtime
)
{
if
(
isFile
(
utf8file
,
mtime
))
return
hasFlacSuffix
(
utf8file
);
return
0
;
return
0
;
}
}
int
isMp4
(
char
*
utf8file
,
time_t
*
mtime
)
{
int
hasOggSuffix
(
char
*
utf8file
)
{
struct
stat
st
;
return
hasSuffix
(
utf8file
,
"ogg"
);
char
*
file
=
utf8ToFsCharset
(
utf8file
);
}
char
*
actualFile
=
file
;
if
(
actualFile
[
0
]
!=
'/'
)
actualFile
=
rmp2amp
(
file
);
int
isOgg
(
char
*
utf8file
,
time_t
*
mtime
)
{
if
(
isFile
(
utf8file
,
mtime
))
return
hasOggSuffix
(
utf8file
);
return
0
;
}
if
(
stat
(
actualFile
,
&
st
)
==
0
)
{
int
hasAacSuffix
(
char
*
utf8file
)
{
if
(
S_ISREG
(
st
.
st_mode
))
{
return
hasSuffix
(
utf8file
,
"aac"
);
char
*
dup
;
}
char
*
cLast
;
char
*
cNext
;
int
ret
=
0
;
dup
=
strdup
(
file
);
cNext
=
cLast
=
strtok
(
dup
,
"."
);
while
((
cNext
=
strtok
(
NULL
,
"."
)))
cLast
=
cNext
;
if
(
cLast
&&
(
0
==
strcasecmp
(
cLast
,
"m4a"
)
||
0
==
strcasecmp
(
cLast
,
"mp4"
)))
{
if
(
mtime
)
*
mtime
=
st
.
st_mtime
;
ret
=
1
;
}
free
(
dup
);
return
ret
;
}
else
return
0
;
}
int
isAac
(
char
*
utf8file
,
time_t
*
mtime
)
{
if
(
isFile
(
utf8file
,
mtime
))
return
hasAacSuffix
(
utf8file
);
return
0
;
return
0
;
}
}
int
isMp3
(
char
*
utf8file
,
time_t
*
mtime
)
{
int
hasMp4Suffix
(
char
*
utf8file
)
{
struct
stat
st
;
if
(
hasSuffix
(
utf8file
,
"mp4"
))
return
1
;
char
*
file
=
utf8ToFsCharset
(
utf8file
);
if
(
hasSuffix
(
utf8file
,
"m4a"
))
return
1
;
char
*
actualFile
=
file
;
return
0
;
}
if
(
actualFile
[
0
]
!=
'/'
)
actualFile
=
rmp2amp
(
file
);
int
isMp4
(
char
*
utf8file
,
time_t
*
mtime
)
{
if
(
isFile
(
utf8file
,
mtime
))
return
hasMp4Suffix
(
utf8file
);
return
0
;
}
if
(
stat
(
actualFile
,
&
st
)
==
0
)
{
int
hasMp3Suffix
(
char
*
utf8file
)
{
if
(
S_ISREG
(
st
.
st_mode
))
{
return
hasSuffix
(
utf8file
,
"mp3"
);
char
*
dup
;
}
char
*
cLast
;
char
*
cNext
;
int
ret
=
0
;
dup
=
strdup
(
file
);
cNext
=
cLast
=
strtok
(
dup
,
"."
);
while
((
cNext
=
strtok
(
NULL
,
"."
)))
cLast
=
cNext
;
if
(
cLast
&&
0
==
strcasecmp
(
cLast
,
"mp3"
))
{
if
(
mtime
)
*
mtime
=
st
.
st_mtime
;
ret
=
1
;
}
free
(
dup
);
return
ret
;
}
else
return
0
;
}
int
isMp3
(
char
*
utf8file
,
time_t
*
mtime
)
{
if
(
isFile
(
utf8file
,
mtime
))
return
hasMp3Suffix
(
utf8file
);
return
0
;
return
0
;
}
}
...
@@ -325,3 +221,27 @@ int isDir(char * utf8name, time_t * mtime) {
...
@@ -325,3 +221,27 @@ int isDir(char * utf8name, time_t * mtime) {
return
0
;
return
0
;
}
}
int
isMusic
(
char
*
utf8file
,
time_t
*
mtime
)
{
if
(
isFile
(
utf8file
,
mtime
))
{
#ifdef HAVE_OGG
if
(
hasOggSuffix
(
utf8file
))
return
1
;
#endif
#ifdef HAVE_FLAC
if
(
hasFlacSuffix
(
utf8file
))
return
1
;
#endif
#ifdef HAVE_MAD
if
(
hasMp3Suffix
(
utf8file
))
return
1
;
#endif
#ifdef HAVE_AUDIOFILE
if
(
hasWaveSuffix
(
utf8file
))
return
1
;
#endif
#ifdef HAVE_FAAD
if
(
hasMp4Suffix
(
utf8file
))
return
1
;
if
(
hasAacSuffix
(
utf8file
))
return
1
;
}
#endif
return
0
;
}
src/ls.h
View file @
445d807b
...
@@ -28,6 +28,8 @@ int lsPlaylists(FILE * fp, char * utf8path);
...
@@ -28,6 +28,8 @@ int lsPlaylists(FILE * fp, char * utf8path);
int
isMp3
(
char
*
utf8file
,
time_t
*
mtime
);
int
isMp3
(
char
*
utf8file
,
time_t
*
mtime
);
int
isAac
(
char
*
utf8file
,
time_t
*
mtime
);
int
isMp4
(
char
*
utf8file
,
time_t
*
mtime
);
int
isMp4
(
char
*
utf8file
,
time_t
*
mtime
);
int
isOgg
(
char
*
utf8file
,
time_t
*
mtime
);
int
isOgg
(
char
*
utf8file
,
time_t
*
mtime
);
...
...
src/mp4_decode.c
View file @
445d807b
...
@@ -133,7 +133,8 @@ int mp4_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc) {
...
@@ -133,7 +133,8 @@ int mp4_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc) {
config
=
faacDecGetCurrentConfiguration
(
decoder
);
config
=
faacDecGetCurrentConfiguration
(
decoder
);
config
->
outputFormat
=
FAAD_FMT_16BIT
;
config
->
outputFormat
=
FAAD_FMT_16BIT
;
config
->
downMatrix
=
1
;
config
->
downMatrix
=
1
;
config
->
dontUpSampleImplicitSBR
=
1
;
/*comment this out, its not in faad2 2.0 rc2*/
/*config->dontUpSampleImplicitSBR = 0;*/
faacDecSetConfiguration
(
decoder
,
config
);
faacDecSetConfiguration
(
decoder
,
config
);
af
->
bits
=
16
;
af
->
bits
=
16
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment