use of com.sedmelluq.discord.lavaplayer.container.MediaContainerDescriptor in project lavaplayer by sedmelluq.
the class ProbingAudioSourceManager method decodeTrackFactory.
protected MediaContainerDescriptor decodeTrackFactory(DataInput input) throws IOException {
String probeInfo = input.readUTF();
int separatorPosition = probeInfo.indexOf(PARAMETERS_SEPARATOR);
String probeName = separatorPosition < 0 ? probeInfo : probeInfo.substring(0, separatorPosition);
String parameters = separatorPosition < 0 ? null : probeInfo.substring(separatorPosition + 1);
MediaContainerProbe probe = containerRegistry.find(probeName);
if (probe != null) {
return new MediaContainerDescriptor(probe, parameters);
}
return null;
}
use of com.sedmelluq.discord.lavaplayer.container.MediaContainerDescriptor in project lavaplayer by sedmelluq.
the class M3uPlaylistContainerProbe method probe.
@Override
public MediaContainerDetectionResult probe(AudioReference reference, SeekableInputStream inputStream) throws IOException {
if (!checkNextBytes(inputStream, M3U_HEADER_TAG) && !checkNextBytes(inputStream, M3U_ENTRY_TAG)) {
return null;
}
log.debug("Track {} is an M3U playlist file.", reference.identifier);
String[] lines = DataFormatTools.streamToLines(inputStream, StandardCharsets.UTF_8);
String hlsStreamUrl = HlsStreamSegmentUrlProvider.findHlsEntryUrl(lines);
if (hlsStreamUrl != null) {
AudioTrackInfoBuilder infoBuilder = AudioTrackInfoBuilder.create(reference, inputStream);
AudioReference httpReference = HttpAudioSourceManager.getAsHttpReference(reference);
if (httpReference != null) {
return supportedFormat(this, TYPE_HLS_OUTER, infoBuilder.setIdentifier(httpReference.identifier).build());
} else {
return refer(this, new AudioReference(hlsStreamUrl, infoBuilder.getTitle(), new MediaContainerDescriptor(this, TYPE_HLS_INNER)));
}
}
MediaContainerDetectionResult result = loadSingleItemPlaylist(lines);
if (result != null) {
return result;
}
return unsupportedFormat(this, "The playlist file contains no links.");
}
Aggregations