mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Allow line terminators in ICY metadata
Issue: #5876 PiperOrigin-RevId: 247935822
This commit is contained in:
parent
a849f43e6d
commit
0612d9f6d5
3 changed files with 14 additions and 1 deletions
|
|
@ -4,6 +4,8 @@
|
||||||
|
|
||||||
* Fix NPE when using HLS chunkless preparation
|
* Fix NPE when using HLS chunkless preparation
|
||||||
([#5868](https://github.com/google/ExoPlayer/issues/5868)).
|
([#5868](https://github.com/google/ExoPlayer/issues/5868)).
|
||||||
|
* Fix handling of line terminators in SHOUTcast ICY metadata
|
||||||
|
([#5876](https://github.com/google/ExoPlayer/issues/5876)).
|
||||||
* Offline: Add option to remove all downloads.
|
* Offline: Add option to remove all downloads.
|
||||||
* Decoders:
|
* Decoders:
|
||||||
* Prefer codecs that advertise format support over ones that do not, even if
|
* Prefer codecs that advertise format support over ones that do not, even if
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ public final class IcyDecoder implements MetadataDecoder {
|
||||||
|
|
||||||
private static final String TAG = "IcyDecoder";
|
private static final String TAG = "IcyDecoder";
|
||||||
|
|
||||||
private static final Pattern METADATA_ELEMENT = Pattern.compile("(.+?)='(.+?)';");
|
private static final Pattern METADATA_ELEMENT = Pattern.compile("(.+?)='(.+?)';", Pattern.DOTALL);
|
||||||
private static final String STREAM_KEY_NAME = "streamtitle";
|
private static final String STREAM_KEY_NAME = "streamtitle";
|
||||||
private static final String STREAM_KEY_URL = "streamurl";
|
private static final String STREAM_KEY_URL = "streamurl";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,17 @@ public final class IcyDecoderTest {
|
||||||
assertThat(streamInfo.url).isEqualTo("test_url");
|
assertThat(streamInfo.url).isEqualTo("test_url");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void decode_lineTerminatorInTitle() {
|
||||||
|
IcyDecoder decoder = new IcyDecoder();
|
||||||
|
Metadata metadata = decoder.decode("StreamTitle='test\r\ntitle';StreamURL='test_url';");
|
||||||
|
|
||||||
|
assertThat(metadata.length()).isEqualTo(1);
|
||||||
|
IcyInfo streamInfo = (IcyInfo) metadata.get(0);
|
||||||
|
assertThat(streamInfo.title).isEqualTo("test\r\ntitle");
|
||||||
|
assertThat(streamInfo.url).isEqualTo("test_url");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void decode_notIcy() {
|
public void decode_notIcy() {
|
||||||
IcyDecoder decoder = new IcyDecoder();
|
IcyDecoder decoder = new IcyDecoder();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue