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
30424cb3
Commit
30424cb3
authored
May 31, 2004
by
Warren Dukes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
flac_plugin
git-svn-id:
https://svn.musicpd.org/mpd/trunk@1246
09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent
fd6aa253
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
155 additions
and
156 deletions
+155
-156
Makefile.am
src/Makefile.am
+4
-3
flac_decode.h
src/flac_decode.h
+0
-31
inputPlugin.c
src/inputPlugin.c
+2
-0
flac_plugin.c
src/inputPlugins/flac_plugin.c
+147
-8
mp3_plugin.c
src/inputPlugins/mp3_plugin.c
+1
-0
ogg_plugin.c
src/inputPlugins/ogg_plugin.c
+1
-0
tag.c
src/tag.c
+0
-114
No files found.
src/Makefile.am
View file @
30424cb3
bin_PROGRAMS
=
mpd
SUBDIRS
=
$(ID3_SUBDIR)
$(MAD_SUBDIR)
$(MP4FF_SUBDIR)
mpd_inputPlugins
=
inputPlugins/mp3_plugin.c inputPlugins/ogg_plugin.c
mpd_inputPlugins
=
inputPlugins/mp3_plugin.c inputPlugins/ogg_plugin.c
\
inputPlugins/flac_plugin.c
mpd_headers
=
buffer2array.h interface.h command.h playlist.h ls.h
\
song.h list.h directory.h tables.h utils.h path.h
\
tag.h player.h listen.h conf.h volume.h
flac_decode.h
\
tag.h player.h listen.h conf.h volume.h
\
audio.h playerData.h stats.h myfprintf.h sig_handlers.h decode.h log.h
\
audiofile_decode.h charConv.h permission.h mpd_types.h pcm_utils.h
\
mp4_decode.h aac_decode.h signal_check.h utf8.h inputStream.h
\
...
...
@@ -13,7 +14,7 @@ mpd_headers = buffer2array.h interface.h command.h playlist.h ls.h \
inputPlugin.h
mpd_SOURCES
=
main.c buffer2array.c interface.c command.c playlist.c ls.c
\
song.c list.c directory.c tables.c utils.c path.c
\
tag.c player.c listen.c conf.c volume.c
flac_decode.c
\
tag.c player.c listen.c conf.c volume.c
\
audio.c playerData.c stats.c myfprintf.c sig_handlers.c decode.c log.c
\
audiofile_decode.c charConv.c permission.c pcm_utils.c mp4_decode.c
\
aac_decode.c signal_check.c utf8.c inputStream.c outputBuffer.c
\
...
...
src/flac_decode.h
deleted
100644 → 0
View file @
fd6aa253
/* the Music Player Daemon (MPD)
* (c)2003-2004 by Warren Dukes (shank@mercury.chem.pitt.edu)
* This project's homepage is: http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef FLAC_DECODE_H
#define FLAC_DECODE_H
#include "../config.h"
#include "playerData.h"
#include <stdio.h>
int
flac_decode
(
OutputBuffer
*
cb
,
DecoderControl
*
dc
);
#endif
/* vim:set shiftwidth=8 tabstop=8 expandtab: */
src/inputPlugin.c
View file @
30424cb3
...
...
@@ -69,6 +69,7 @@ InputPlugin * getInputPluginFromName(char * name) {
extern
InputPlugin
mp3Plugin
;
extern
InputPlugin
oggPlugin
;
extern
InputPlugin
flacPlugin
;
void
initInputPlugins
()
{
inputPlugin_list
=
makeList
(
NULL
);
...
...
@@ -76,6 +77,7 @@ void initInputPlugins() {
/* load plugins here */
loadInputPlugin
(
&
mp3Plugin
);
loadInputPlugin
(
&
oggPlugin
);
loadInputPlugin
(
&
flacPlugin
);
}
void
finishInputPlugins
()
{
...
...
src/
flac_decode
.c
→
src/
inputPlugins/flac_plugin
.c
View file @
30424cb3
...
...
@@ -16,17 +16,18 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "
flac_decode
.h"
#include "
../inputPlugin
.h"
#ifdef HAVE_FLAC
#include "utils.h"
#include "log.h"
#include "pcm_utils.h"
#include "inputStream.h"
#include "outputBuffer.h"
#include "replayGain.h"
#include "audio.h"
#include "../utils.h"
#include "../log.h"
#include "../pcm_utils.h"
#include "../inputStream.h"
#include "../outputBuffer.h"
#include "../replayGain.h"
#include "../audio.h"
#include "../path.h"
#include <stdio.h>
#include <string.h>
...
...
@@ -437,5 +438,143 @@ FLAC__StreamDecoderWriteStatus flacWrite(const FLAC__SeekableStreamDecoder *dec,
return
FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE
;
}
MpdTag
*
flacMetadataDup
(
char
*
utf8file
,
int
*
vorbisCommentFound
)
{
MpdTag
*
ret
=
NULL
;
FLAC__Metadata_SimpleIterator
*
it
;
FLAC__StreamMetadata
*
block
=
NULL
;
int
offset
;
int
len
,
pos
;
*
vorbisCommentFound
=
0
;
it
=
FLAC__metadata_simple_iterator_new
();
if
(
!
FLAC__metadata_simple_iterator_init
(
it
,
rmp2amp
(
utf8ToFsCharset
(
utf8file
)),
1
,
0
))
{
FLAC__metadata_simple_iterator_delete
(
it
);
return
ret
;
}
do
{
block
=
FLAC__metadata_simple_iterator_get_block
(
it
);
if
(
!
block
)
break
;
if
(
block
->
type
==
FLAC__METADATA_TYPE_VORBIS_COMMENT
)
{
char
*
dup
;
offset
=
FLAC__metadata_object_vorbiscomment_find_entry_from
(
block
,
0
,
"artist"
);
if
(
offset
>=
0
)
{
*
vorbisCommentFound
=
1
;
if
(
!
ret
)
ret
=
newMpdTag
();
pos
=
strlen
(
"artist="
);
len
=
block
->
data
.
vorbis_comment
.
comments
[
offset
].
length
-
pos
;
if
(
len
>
0
)
{
dup
=
malloc
(
len
+
1
);
memcpy
(
dup
,
&
(
block
->
data
.
vorbis_comment
.
comments
[
offset
].
entry
[
pos
]),
len
);
dup
[
len
]
=
'\0'
;
stripReturnChar
(
dup
);
ret
->
artist
=
dup
;
}
}
offset
=
FLAC__metadata_object_vorbiscomment_find_entry_from
(
block
,
0
,
"album"
);
if
(
offset
>=
0
)
{
*
vorbisCommentFound
=
1
;
if
(
!
ret
)
ret
=
newMpdTag
();
pos
=
strlen
(
"album="
);
len
=
block
->
data
.
vorbis_comment
.
comments
[
offset
].
length
-
pos
;
if
(
len
>
0
)
{
dup
=
malloc
(
len
+
1
);
memcpy
(
dup
,
&
(
block
->
data
.
vorbis_comment
.
comments
[
offset
].
entry
[
pos
]),
len
);
dup
[
len
]
=
'\0'
;
stripReturnChar
(
dup
);
ret
->
album
=
dup
;
}
}
offset
=
FLAC__metadata_object_vorbiscomment_find_entry_from
(
block
,
0
,
"title"
);
if
(
offset
>=
0
)
{
*
vorbisCommentFound
=
1
;
if
(
!
ret
)
ret
=
newMpdTag
();
pos
=
strlen
(
"title="
);
len
=
block
->
data
.
vorbis_comment
.
comments
[
offset
].
length
-
pos
;
if
(
len
>
0
)
{
dup
=
malloc
(
len
+
1
);
memcpy
(
dup
,
&
(
block
->
data
.
vorbis_comment
.
comments
[
offset
].
entry
[
pos
]),
len
);
dup
[
len
]
=
'\0'
;
stripReturnChar
(
dup
);
ret
->
title
=
dup
;
}
}
offset
=
FLAC__metadata_object_vorbiscomment_find_entry_from
(
block
,
0
,
"tracknumber"
);
if
(
offset
>=
0
)
{
*
vorbisCommentFound
=
1
;
if
(
!
ret
)
ret
=
newMpdTag
();
pos
=
strlen
(
"tracknumber="
);
len
=
block
->
data
.
vorbis_comment
.
comments
[
offset
].
length
-
pos
;
if
(
len
>
0
)
{
dup
=
malloc
(
len
+
1
);
memcpy
(
dup
,
&
(
block
->
data
.
vorbis_comment
.
comments
[
offset
].
entry
[
pos
]),
len
);
dup
[
len
]
=
'\0'
;
stripReturnChar
(
dup
);
ret
->
track
=
dup
;
}
}
}
else
if
(
block
->
type
==
FLAC__METADATA_TYPE_STREAMINFO
)
{
if
(
!
ret
)
ret
=
newMpdTag
();
ret
->
time
=
((
float
)
block
->
data
.
stream_info
.
total_samples
)
/
block
->
data
.
stream_info
.
sample_rate
+
0
.
5
;
}
FLAC__metadata_object_delete
(
block
);
}
while
(
FLAC__metadata_simple_iterator_next
(
it
));
FLAC__metadata_simple_iterator_delete
(
it
);
return
ret
;
}
MpdTag
*
flacTagDup
(
char
*
utf8file
)
{
MpdTag
*
ret
=
NULL
;
int
foundVorbisComment
=
0
;
ret
=
flacMetadataDup
(
utf8file
,
&
foundVorbisComment
);
if
(
!
ret
)
return
NULL
;
if
(
!
foundVorbisComment
)
{
MpdTag
*
temp
=
id3Dup
(
utf8file
);
if
(
temp
)
{
temp
->
time
=
ret
->
time
;
freeMpdTag
(
ret
);
ret
=
temp
;
}
}
if
(
ret
)
validateUtf8Tag
(
ret
);
return
ret
;
}
char
*
flacSuffixes
[]
=
{
"flac"
,
NULL
};
InputPlugin
flacPlugin
=
{
"flac"
,
NULL
,
flac_decode
,
flacTagDup
,
INPUT_PLUGIN_STREAM_FILE
,
flacSuffixes
,
NULL
};
#else
InputPlugin
flacPlugin
=
{
NULL
,
NULL
,
NULL
,
NULL
,
0
,
NULL
,
NULL
,
};
#endif
/* vim:set shiftwidth=8 tabstop=8 expandtab: */
src/inputPlugins/mp3_plugin.c
View file @
30424cb3
...
...
@@ -651,6 +651,7 @@ InputPlugin mp3Plugin =
NULL
,
NULL
,
NULL
,
NULL
,
0
,
NULL
,
NULL
...
...
src/inputPlugins/ogg_plugin.c
View file @
30424cb3
...
...
@@ -356,6 +356,7 @@ InputPlugin oggPlugin =
NULL
,
NULL
,
NULL
,
NULL
,
0
,
NULL
,
NULL
...
...
src/tag.c
View file @
30424cb3
...
...
@@ -279,120 +279,6 @@ MpdTag * mp4TagDup(char * utf8file) {
}
#endif
#ifdef HAVE_FLAC
MpdTag
*
flacMetadataDup
(
char
*
utf8file
,
int
*
vorbisCommentFound
)
{
MpdTag
*
ret
=
NULL
;
FLAC__Metadata_SimpleIterator
*
it
;
FLAC__StreamMetadata
*
block
=
NULL
;
int
offset
;
int
len
,
pos
;
*
vorbisCommentFound
=
0
;
it
=
FLAC__metadata_simple_iterator_new
();
if
(
!
FLAC__metadata_simple_iterator_init
(
it
,
rmp2amp
(
utf8ToFsCharset
(
utf8file
)),
1
,
0
))
{
FLAC__metadata_simple_iterator_delete
(
it
);
return
ret
;
}
do
{
block
=
FLAC__metadata_simple_iterator_get_block
(
it
);
if
(
!
block
)
break
;
if
(
block
->
type
==
FLAC__METADATA_TYPE_VORBIS_COMMENT
)
{
char
*
dup
;
offset
=
FLAC__metadata_object_vorbiscomment_find_entry_from
(
block
,
0
,
"artist"
);
if
(
offset
>=
0
)
{
*
vorbisCommentFound
=
1
;
if
(
!
ret
)
ret
=
newMpdTag
();
pos
=
strlen
(
"artist="
);
len
=
block
->
data
.
vorbis_comment
.
comments
[
offset
].
length
-
pos
;
if
(
len
>
0
)
{
dup
=
malloc
(
len
+
1
);
memcpy
(
dup
,
&
(
block
->
data
.
vorbis_comment
.
comments
[
offset
].
entry
[
pos
]),
len
);
dup
[
len
]
=
'\0'
;
stripReturnChar
(
dup
);
ret
->
artist
=
dup
;
}
}
offset
=
FLAC__metadata_object_vorbiscomment_find_entry_from
(
block
,
0
,
"album"
);
if
(
offset
>=
0
)
{
*
vorbisCommentFound
=
1
;
if
(
!
ret
)
ret
=
newMpdTag
();
pos
=
strlen
(
"album="
);
len
=
block
->
data
.
vorbis_comment
.
comments
[
offset
].
length
-
pos
;
if
(
len
>
0
)
{
dup
=
malloc
(
len
+
1
);
memcpy
(
dup
,
&
(
block
->
data
.
vorbis_comment
.
comments
[
offset
].
entry
[
pos
]),
len
);
dup
[
len
]
=
'\0'
;
stripReturnChar
(
dup
);
ret
->
album
=
dup
;
}
}
offset
=
FLAC__metadata_object_vorbiscomment_find_entry_from
(
block
,
0
,
"title"
);
if
(
offset
>=
0
)
{
*
vorbisCommentFound
=
1
;
if
(
!
ret
)
ret
=
newMpdTag
();
pos
=
strlen
(
"title="
);
len
=
block
->
data
.
vorbis_comment
.
comments
[
offset
].
length
-
pos
;
if
(
len
>
0
)
{
dup
=
malloc
(
len
+
1
);
memcpy
(
dup
,
&
(
block
->
data
.
vorbis_comment
.
comments
[
offset
].
entry
[
pos
]),
len
);
dup
[
len
]
=
'\0'
;
stripReturnChar
(
dup
);
ret
->
title
=
dup
;
}
}
offset
=
FLAC__metadata_object_vorbiscomment_find_entry_from
(
block
,
0
,
"tracknumber"
);
if
(
offset
>=
0
)
{
*
vorbisCommentFound
=
1
;
if
(
!
ret
)
ret
=
newMpdTag
();
pos
=
strlen
(
"tracknumber="
);
len
=
block
->
data
.
vorbis_comment
.
comments
[
offset
].
length
-
pos
;
if
(
len
>
0
)
{
dup
=
malloc
(
len
+
1
);
memcpy
(
dup
,
&
(
block
->
data
.
vorbis_comment
.
comments
[
offset
].
entry
[
pos
]),
len
);
dup
[
len
]
=
'\0'
;
stripReturnChar
(
dup
);
ret
->
track
=
dup
;
}
}
}
else
if
(
block
->
type
==
FLAC__METADATA_TYPE_STREAMINFO
)
{
if
(
!
ret
)
ret
=
newMpdTag
();
ret
->
time
=
((
float
)
block
->
data
.
stream_info
.
total_samples
)
/
block
->
data
.
stream_info
.
sample_rate
+
0
.
5
;
}
FLAC__metadata_object_delete
(
block
);
}
while
(
FLAC__metadata_simple_iterator_next
(
it
));
FLAC__metadata_simple_iterator_delete
(
it
);
return
ret
;
}
MpdTag
*
flacTagDup
(
char
*
utf8file
)
{
MpdTag
*
ret
=
NULL
;
int
foundVorbisComment
=
0
;
ret
=
flacMetadataDup
(
utf8file
,
&
foundVorbisComment
);
if
(
!
ret
)
return
NULL
;
if
(
!
foundVorbisComment
)
{
MpdTag
*
temp
=
id3Dup
(
utf8file
);
if
(
temp
)
{
temp
->
time
=
ret
->
time
;
freeMpdTag
(
ret
);
ret
=
temp
;
}
}
if
(
ret
)
validateUtf8Tag
(
ret
);
return
ret
;
}
#endif
MpdTag
*
newMpdTag
()
{
MpdTag
*
ret
=
malloc
(
sizeof
(
MpdTag
));
ret
->
album
=
NULL
;
...
...
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