Class LocalAudioSourceManager
- java.lang.Object
-
- com.sedmelluq.discord.lavaplayer.source.ProbingAudioSourceManager
-
- com.sedmelluq.discord.lavaplayer.source.local.LocalAudioSourceManager
-
- All Implemented Interfaces:
AudioSourceManager
public class LocalAudioSourceManager extends ProbingAudioSourceManager
Audio source manager that implements finding audio files from the local file system.
-
-
Field Summary
-
Fields inherited from class com.sedmelluq.discord.lavaplayer.source.ProbingAudioSourceManager
containerRegistry
-
-
Constructor Summary
Constructors Constructor Description LocalAudioSourceManager()LocalAudioSourceManager(MediaContainerRegistry containerRegistry)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected AudioTrackcreateTrack(AudioTrackInfo trackInfo, MediaContainerDescriptor containerTrackFactory)AudioTrackdecodeTrack(AudioTrackInfo trackInfo, java.io.DataInput input)Decodes an audio track from the encoded format encoded with encodeTrack().voidencodeTrack(AudioTrack track, java.io.DataOutput output)Encodes an audio track into the specified output.java.lang.StringgetSourceName()Every source manager implementation should have its unique name as it is used to determine which source manager should be able to decode a serialized audio track.booleanisTrackEncodable(AudioTrack track)Returns whether the specified track can be encoded.AudioItemloadItem(AudioPlayerManager manager, AudioReference reference)Returns an audio track for the input string.voidshutdown()Shut down the source manager, freeing all associated resources and threads.-
Methods inherited from class com.sedmelluq.discord.lavaplayer.source.ProbingAudioSourceManager
decodeTrackFactory, encodeTrackFactory, handleLoadResult
-
-
-
-
Constructor Detail
-
LocalAudioSourceManager
public LocalAudioSourceManager()
-
LocalAudioSourceManager
public LocalAudioSourceManager(MediaContainerRegistry containerRegistry)
-
-
Method Detail
-
getSourceName
public java.lang.String getSourceName()
Description copied from interface:AudioSourceManagerEvery source manager implementation should have its unique name as it is used to determine which source manager should be able to decode a serialized audio track.- Returns:
- The name of this source manager
-
loadItem
public AudioItem loadItem(AudioPlayerManager manager, AudioReference reference)
Description copied from interface:AudioSourceManagerReturns an audio track for the input string. It should return null if it can immediately detect that there is no track for this identifier for this source. If checking that requires more expensive operations, then it should return a track instance and check that in InternalAudioTrack#loadTrackInfo.- Parameters:
manager- The audio manager to attach to the loaded tracksreference- The reference with the identifier which the source manager should find the track with- Returns:
- The loaded item or null on unrecognized identifier
-
createTrack
protected AudioTrack createTrack(AudioTrackInfo trackInfo, MediaContainerDescriptor containerTrackFactory)
- Specified by:
createTrackin classProbingAudioSourceManager
-
isTrackEncodable
public boolean isTrackEncodable(AudioTrack track)
Description copied from interface:AudioSourceManagerReturns whether the specified track can be encoded. The argument is always a track created by this manager. Being encodable also means that it must be possible to play this track on a different node, so it should not depend on any resources that are only available on the current system.- Parameters:
track- The track to check- Returns:
- True if it is encodable
-
encodeTrack
public void encodeTrack(AudioTrack track, java.io.DataOutput output) throws java.io.IOException
Description copied from interface:AudioSourceManagerEncodes an audio track into the specified output. The contents of AudioTrackInfo do not have to be included since they are written to the output already before this call. This will only be called for tracks which were loaded by this source manager and for which isEncodable() returns true.- Parameters:
track- The track to encodeoutput- Output where to write the decoded format to- Throws:
java.io.IOException- On write error.
-
decodeTrack
public AudioTrack decodeTrack(AudioTrackInfo trackInfo, java.io.DataInput input) throws java.io.IOException
Description copied from interface:AudioSourceManagerDecodes an audio track from the encoded format encoded with encodeTrack().- Parameters:
trackInfo- The track infoinput- The input where to read the bytes of the encoded format- Returns:
- The decoded track
- Throws:
java.io.IOException- On read error.
-
shutdown
public void shutdown()
Description copied from interface:AudioSourceManagerShut down the source manager, freeing all associated resources and threads. A source manager is not responsible for terminating the tracks that it has created.
-
-