muhku / FreeStreamer

A low-memory footprint streaming audio player for iOS and OS X
http://muhku.github.io/FreeStreamer/
Other
2.11k stars 436 forks source link

Metadata missing letters #12

Closed karma88 closed 10 years ago

karma88 commented 10 years ago

The metadata from the songs does not support the following letters: Ü,Ä Ö

Leandros commented 10 years ago

You got any stream for testing purposes?

muhku commented 10 years ago

Yep, currently non-ASCII data is ignored by the ICY metadata parser, see: https://github.com/muhku/FreeStreamer/blob/master/astreamer/http_stream.cpp#L410

karma88 commented 10 years ago

How can i activating this for support it ..?

muhku commented 10 years ago

@karma88: You could try removing the following lines from the code, which filter out the non-ASCII characters. So beginning from line 426, https://github.com/muhku/FreeStreamer/blob/master/astreamer/http_stream.cpp#L426

Remove this block:

if (c < 32 || c > 126) {
    continue;
}
karma88 commented 10 years ago

when i remove this block the text label leave blank...

muhku commented 10 years ago

Right, then there are probably some bytes, which break the string encoding. Any zero bytes will truncate the string at least. To debug this further, put a breakpoint to the previously mentioned point and output the metadata bytes.

muhku commented 10 years ago

I got the issue reproduced with the following stream: http://www.voice.fi/nettiradio/voice.m3u

Ü,Ä Ö etc. are missing. Removing the ASCII filtering breaks the string encoding so a bit more effort would be needed to handle this correctly.

Leandros commented 10 years ago

I'am on it.

Leandros commented 10 years ago

See https://github.com/muhku/FreeStreamer/pull/18

muhku commented 10 years ago

Closing this due to @Leandros' pull request #18 merged to master.

@karma88: Please make sure your tree of FreeStreamer has the commit 0061300fa815eb9567fc070ab3249a8cde3cede7

muhku commented 10 years ago

One more commit needed for the encoding to work: 20bf211c1c40b41473aa75816e7cd503109a7dab

Please notice that the metadata encoding is not probed, so we assume now that the metadata is always encoded in UTF8. See: https://github.com/muhku/FreeStreamer/blob/master/astreamer/http_stream.cpp#L406 This is not ideal but seems to work well enough in practice.

Note that from now on, I would prefer to use CFString instead of std::string (though no hurry for any quick changes).

Leandros commented 10 years ago

It does work perfectly with wide string. Though, as I said in the request, it isn't the most elegant solution.

However, any non UTF-8 string will return NULL. Checking for that could be a good idea.

muhku commented 10 years ago

@Leandros This is what I got with std::wstring and UTF8 encoded metadata: https://dl.dropboxusercontent.com/u/995250/Screen%20Shot%202013-12-10%20at%2010.18.24.png

This is how it looks like after doing the encoding with CFStringCreateWithBytes(): https://dl.dropboxusercontent.com/u/995250/Screen%20Shot%202013-12-10%20at%2013.43.00.png

So for some reason CFStringCreateWithBytes() resulted the correct encoding with the stream I was testing with.

I have some ideas for probing the metadata encoding so let's see if that is needed at some point. Feel free to share if you have some ideas related to that. :-)