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
795a1e93
Commit
795a1e93
authored
Mar 31, 2004
by
Warren Dukes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lets cleanup some file type detection and not call stat() so much
git-svn-id:
https://svn.musicpd.org/mpd/trunk@575
09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent
995a5deb
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
60 deletions
+32
-60
ls.c
src/ls.c
+0
-30
ls.h
src/ls.h
+11
-9
player.c
src/player.c
+7
-7
song.c
src/song.c
+14
-14
No files found.
src/ls.c
View file @
795a1e93
...
...
@@ -155,58 +155,28 @@ int hasWaveSuffix(char * utf8file) {
return
hasSuffix
(
utf8file
,
"wav"
);
}
int
isWave
(
char
*
utf8file
,
time_t
*
mtime
)
{
if
(
isFile
(
utf8file
,
mtime
))
return
hasWaveSuffix
(
utf8file
);
return
0
;
}
int
hasFlacSuffix
(
char
*
utf8file
)
{
return
hasSuffix
(
utf8file
,
"flac"
);
}
int
isFlac
(
char
*
utf8file
,
time_t
*
mtime
)
{
if
(
isFile
(
utf8file
,
mtime
))
return
hasFlacSuffix
(
utf8file
);
return
0
;
}
int
hasOggSuffix
(
char
*
utf8file
)
{
return
hasSuffix
(
utf8file
,
"ogg"
);
}
int
isOgg
(
char
*
utf8file
,
time_t
*
mtime
)
{
if
(
isFile
(
utf8file
,
mtime
))
return
hasOggSuffix
(
utf8file
);
return
0
;
}
int
hasAacSuffix
(
char
*
utf8file
)
{
return
hasSuffix
(
utf8file
,
"aac"
);
}
int
isAac
(
char
*
utf8file
,
time_t
*
mtime
)
{
if
(
isFile
(
utf8file
,
mtime
))
return
hasAacSuffix
(
utf8file
);
return
0
;
}
int
hasMp4Suffix
(
char
*
utf8file
)
{
if
(
hasSuffix
(
utf8file
,
"mp4"
))
return
1
;
if
(
hasSuffix
(
utf8file
,
"m4a"
))
return
1
;
return
0
;
}
int
isMp4
(
char
*
utf8file
,
time_t
*
mtime
)
{
if
(
isFile
(
utf8file
,
mtime
))
return
hasMp4Suffix
(
utf8file
);
return
0
;
}
int
hasMp3Suffix
(
char
*
utf8file
)
{
return
hasSuffix
(
utf8file
,
"mp3"
);
}
int
isMp3
(
char
*
utf8file
,
time_t
*
mtime
)
{
if
(
isFile
(
utf8file
,
mtime
))
return
hasMp3Suffix
(
utf8file
);
return
0
;
}
int
isDir
(
char
*
utf8name
,
time_t
*
mtime
)
{
struct
stat
st
;
...
...
src/ls.h
View file @
795a1e93
...
...
@@ -26,23 +26,25 @@
int
lsPlaylists
(
FILE
*
fp
,
char
*
utf8path
);
int
is
Mp3
(
char
*
utf8file
,
time_t
*
mtime
);
int
is
File
(
char
*
utf8file
,
time_t
*
mtime
);
int
is
Aac
(
char
*
utf8fil
e
,
time_t
*
mtime
);
int
is
Dir
(
char
*
utf8nam
e
,
time_t
*
mtime
);
int
is
Mp4
(
char
*
utf8file
,
time_t
*
mtim
e
);
int
is
Playlist
(
char
*
utf8fil
e
);
int
is
Ogg
(
char
*
utf8file
,
time_t
*
mtime
);
int
is
Music
(
char
*
utf8file
,
time_t
*
mtime
);
int
isFlac
(
char
*
utf8file
,
time_t
*
mtim
e
);
int
hasWaveSuffix
(
char
*
utf8fil
e
);
int
isWave
(
char
*
utf8file
,
time_t
*
mtim
e
);
int
hasMp3Suffix
(
char
*
utf8fil
e
);
int
isMusic
(
char
*
utf8file
,
time_t
*
mtim
e
);
int
hasAacSuffix
(
char
*
utf8fil
e
);
int
isDir
(
char
*
utf8name
,
time_t
*
mtim
e
);
int
hasMp4Suffix
(
char
*
utf8fil
e
);
int
isPlaylist
(
char
*
utf8file
);
int
hasOggSuffix
(
char
*
utf8file
);
int
hasFlacSuffix
(
char
*
utf8file
);
char
*
dupAndStripPlaylistSuffix
(
char
*
file
);
...
...
src/player.c
View file @
795a1e93
...
...
@@ -150,22 +150,22 @@ int playerInit() {
}
int
playerGetDecodeType
(
char
*
utf8file
)
{
if
(
0
);
if
(
!
isFile
(
utf8file
,
NULL
)
);
#ifdef HAVE_MAD
if
(
isMp3
(
utf8file
,
NULL
))
return
DECODE_TYPE_MP3
;
else
if
(
hasMp3Suffix
(
utf8file
))
return
DECODE_TYPE_MP3
;
#endif
#ifdef HAVE_OGG
if
(
isOgg
(
utf8file
,
NULL
))
return
DECODE_TYPE_OGG
;
else
if
(
hasOggSuffix
(
utf8file
))
return
DECODE_TYPE_OGG
;
#endif
#ifdef HAVE_FLAC
if
(
isFlac
(
utf8file
,
NULL
))
return
DECODE_TYPE_FLAC
;
else
if
(
hasFlacSuffix
(
utf8file
))
return
DECODE_TYPE_FLAC
;
#endif
#ifdef HAVE_AUDIOFILE
if
(
isWave
(
utf8file
,
NULL
))
return
DECODE_TYPE_AUDIOFILE
;
else
if
(
hasWaveSuffix
(
utf8file
))
return
DECODE_TYPE_AUDIOFILE
;
#endif
#ifdef HAVE_FAAD
if
(
isAac
(
utf8file
,
NULL
))
return
DECODE_TYPE_AAC
;
if
(
isMp4
(
utf8file
,
NULL
))
return
DECODE_TYPE_MP4
;
else
if
(
hasAacSuffix
(
utf8file
))
return
DECODE_TYPE_AAC
;
else
if
(
hasMp4Suffix
(
utf8file
))
return
DECODE_TYPE_MP4
;
#endif
return
-
1
;
}
...
...
src/song.c
View file @
795a1e93
...
...
@@ -57,32 +57,32 @@ Song * newSong(char * utf8file) {
song
->
utf8file
=
strdup
(
utf8file
);
if
(
0
);
if
(
!
isFile
(
utf8file
,
&
(
song
->
mtime
))
);
#ifdef HAVE_OGG
else
if
(
isOgg
(
utf8file
,
&
(
song
->
mtime
)
))
{
else
if
(
hasOggSuffix
(
utf8file
))
{
song
->
tag
=
oggTagDup
(
utf8file
);
}
#endif
#ifdef HAVE_FLAC
else
if
((
isFlac
(
utf8file
,
&
(
song
->
mtime
)
)))
{
else
if
((
hasFlacSuffix
(
utf8file
)))
{
song
->
tag
=
flacTagDup
(
utf8file
);
}
#endif
#ifdef HAVE_MAD
else
if
(
isMp3
(
utf8file
,
&
(
song
->
mtime
)
))
{
else
if
(
hasMp3Suffix
(
utf8file
))
{
song
->
tag
=
mp3TagDup
(
utf8file
);
}
#endif
#ifdef HAVE_AUDIOFILE
else
if
(
isWave
(
utf8file
,
&
(
song
->
mtime
)
))
{
else
if
(
hasWaveSuffix
(
utf8file
))
{
song
->
tag
=
audiofileTagDup
(
utf8file
);
}
#endif
#ifdef HAVE_FAAD
else
if
(
isAac
(
utf8file
,
&
(
song
->
mtime
)
))
{
else
if
(
hasAacSuffix
(
utf8file
))
{
song
->
tag
=
aacTagDup
(
utf8file
);
}
else
if
(
isMp4
(
utf8file
,
&
(
song
->
mtime
)
))
{
else
if
(
hasMp4Suffix
(
utf8file
))
{
song
->
tag
=
mp4TagDup
(
utf8file
);
}
#endif
...
...
@@ -227,32 +227,32 @@ int updateSongInfo(Song * song) {
song
->
tag
=
NULL
;
if
(
0
);
if
(
!
isFile
(
utf8file
,
&
(
song
->
mtime
))
);
#ifdef HAVE_OGG
else
if
(
isOgg
(
utf8file
,
&
(
song
->
mtime
)
))
{
else
if
(
hasOggSuffix
(
utf8file
))
{
song
->
tag
=
oggTagDup
(
utf8file
);
}
#endif
#ifdef HAVE_FLAC
else
if
((
isFlac
(
utf8file
,
&
(
song
->
mtime
)
)))
{
else
if
((
hasFlacSuffix
(
utf8file
)))
{
song
->
tag
=
flacTagDup
(
utf8file
);
}
#endif
#ifdef HAVE_MAD
else
if
(
isMp3
(
utf8file
,
&
(
song
->
mtime
)
))
{
else
if
(
hasMp3Suffix
(
utf8file
))
{
song
->
tag
=
mp3TagDup
(
utf8file
);
}
#endif
#ifdef HAVE_AUDIOFILE
else
if
(
isWave
(
utf8file
,
&
(
song
->
mtime
)
))
{
else
if
(
hasWaveSuffix
(
utf8file
))
{
song
->
tag
=
audiofileTagDup
(
utf8file
);
}
#endif
#ifdef HAVE_FAAD
else
if
(
isAac
(
utf8file
,
&
(
song
->
mtime
)
))
{
else
if
(
hasAacSuffix
(
utf8file
))
{
song
->
tag
=
aacTagDup
(
utf8file
);
}
else
if
(
isMp4
(
utf8file
,
&
(
song
->
mtime
)
))
{
else
if
(
hasMp4Suffix
(
utf8file
))
{
song
->
tag
=
mp4TagDup
(
utf8file
);
}
#endif
...
...
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