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
cf9ee339
Commit
cf9ee339
authored
Aug 09, 2019
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
input/icy: support "charset" parameter in URI fragment
Closes
https://github.com/MusicPlayerDaemon/MPD/issues/616
parent
4a47bbd8
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
2 deletions
+38
-2
NEWS
NEWS
+1
-0
user.rst
doc/user.rst
+16
-0
IcyInputStream.cxx
src/input/IcyInputStream.cxx
+17
-1
IcyInputStream.hxx
src/input/IcyInputStream.hxx
+4
-1
No files found.
NEWS
View file @
cf9ee339
...
...
@@ -5,6 +5,7 @@ ver 0.22 (not yet released)
* tags
- new tags "Grouping" (for ID3 "TIT1") and "Work"
* input
- curl: support "charset" parameter in URI fragment
- ffmpeg: allow partial reads
* archive
- iso9660: support seeking
...
...
doc/user.rst
View file @
cf9ee339
...
...
@@ -985,6 +985,22 @@ is no way for :program:`MPD` to find out whether the DAC supports
it. DSD to PCM conversion is the fallback if DSD cannot be used
directly.
ICY-MetaData
------------
Some MP3 streams send information about the current song with a
protocol named `"ICY-MetaData"
<http://www.smackfu.com/stuff/programming/shoutcast.html>`_.
:program:`MPD` makes its ``StreamTitle`` value available as ``Title``
tag.
By default, :program:`MPD` assumes this tag is UTF-8-encoded. To tell
:program:`MPD` to assume a different character set, specify it in the
``charset`` URL fragment parameter, e.g.::
mpc add 'http://radio.example.com/stream#charset=cp1251'
Client Hacks
************
...
...
src/input/IcyInputStream.cxx
View file @
cf9ee339
...
...
@@ -20,11 +20,27 @@
#include "IcyInputStream.hxx"
#include "IcyMetaDataParser.hxx"
#include "tag/Tag.hxx"
#include "util/UriExtract.hxx"
#include "util/UriQueryParser.hxx"
#include "util/StringView.hxx"
#include <string>
IcyInputStream
::
IcyInputStream
(
InputStreamPtr
_input
,
std
::
shared_ptr
<
IcyMetaDataParser
>
_parser
)
noexcept
std
::
shared_ptr
<
IcyMetaDataParser
>
_parser
)
:
ProxyInputStream
(
std
::
move
(
_input
)),
parser
(
std
::
move
(
_parser
))
{
#ifdef HAVE_ICU_CONVERTER
const
char
*
fragment
=
uri_get_fragment
(
GetURI
());
if
(
fragment
!=
nullptr
)
{
const
auto
charset
=
UriFindRawQueryParameter
(
fragment
,
"charset"
);
if
(
charset
!=
nullptr
)
{
const
std
::
string
copy
(
charset
.
data
,
charset
.
size
);
parser
->
SetCharset
(
copy
.
c_str
());
}
}
#endif
}
IcyInputStream
::~
IcyInputStream
()
noexcept
=
default
;
...
...
src/input/IcyInputStream.hxx
View file @
cf9ee339
...
...
@@ -52,9 +52,12 @@ public:
* with our input; it needs to be shared because our input
* needs to feed parameters (e.g. from the "icy-metaint"
* header) into it
*
* Throws on error (e.g. if the charset converter specified by
* the URI fragment fails to initialize).
*/
IcyInputStream
(
InputStreamPtr
_input
,
std
::
shared_ptr
<
IcyMetaDataParser
>
_parser
)
noexcept
;
std
::
shared_ptr
<
IcyMetaDataParser
>
_parser
);
virtual
~
IcyInputStream
()
noexcept
;
IcyInputStream
(
const
IcyInputStream
&
)
=
delete
;
...
...
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