本文整理汇总了Java中net.sourceforge.subsonic.service.TranscodingService类的典型用法代码示例。如果您正苦于以下问题:Java TranscodingService类的具体用法?Java TranscodingService怎么用?Java TranscodingService使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TranscodingService类属于net.sourceforge.subsonic.service包,在下文中一共展示了TranscodingService类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getFileLength
import net.sourceforge.subsonic.service.TranscodingService; //导入依赖的package包/类
private long getFileLength(TranscodingService.Parameters parameters) {
MediaFile file = parameters.getMediaFile();
if (!parameters.isDownsample() && !parameters.isTranscode()) {
return file.getFileSize();
}
Integer duration = file.getDurationSeconds();
Integer maxBitRate = parameters.getMaxBitRate();
if (duration == null) {
LOG.warn("Unknown duration for " + file + ". Unable to estimate transcoded size.");
return file.getFileSize();
}
if (maxBitRate == null) {
LOG.error("Unknown bit rate for " + file + ". Unable to estimate transcoded size.");
return file.getFileSize();
}
return duration * maxBitRate * 1000L / 8L;
}
示例2: getImageInputStreamForVideo
import net.sourceforge.subsonic.service.TranscodingService; //导入依赖的package包/类
private InputStream getImageInputStreamForVideo(MediaFile mediaFile, int width, int height, int offset) throws Exception {
VideoTranscodingSettings videoSettings = new VideoTranscodingSettings(width, height, offset, 0, false);
TranscodingService.Parameters parameters = new TranscodingService.Parameters(mediaFile, videoSettings);
String command = settingsService.getVideoImageCommand();
parameters.setTranscoding(new Transcoding(null, null, null, null, command, null, null, false));
return transcodingService.getTranscodedInputStream(parameters);
}
示例3: createResourceForSong
import net.sourceforge.subsonic.service.TranscodingService; //导入依赖的package包/类
protected Res createResourceForSong(MediaFile song) {
Player player = playerService.getGuestPlayer(null);
String url = getBaseUrl() + "stream?id=" + song.getId() + "&player=" + player.getId();
if (song.isVideo()) {
url += "&format=" + TranscodingService.FORMAT_RAW;
}
String suffix = song.isVideo() ? FilenameUtils.getExtension(song.getPath()) : transcodingService.getSuffix(player, song, null);
String mimeTypeString = StringUtil.getMimeType(suffix);
MimeType mimeType = mimeTypeString == null ? null : MimeType.valueOf(mimeTypeString);
Res res = new Res(mimeType, null, url);
res.setDuration(formatDuration(song.getDurationSeconds()));
return res;
}
示例4: PlayQueueInputStream
import net.sourceforge.subsonic.service.TranscodingService; //导入依赖的package包/类
public PlayQueueInputStream(Player player, TransferStatus status, Integer maxBitRate, String preferredTargetFormat,
VideoTranscodingSettings videoTranscodingSettings, TranscodingService transcodingService,
AudioScrobblerService audioScrobblerService, MediaFileService mediaFileService, SearchService searchService) {
this.player = player;
this.status = status;
this.maxBitRate = maxBitRate;
this.preferredTargetFormat = preferredTargetFormat;
this.videoTranscodingSettings = videoTranscodingSettings;
this.transcodingService = transcodingService;
this.audioScrobblerService = audioScrobblerService;
this.mediaFileService = mediaFileService;
this.searchService = searchService;
}
示例5: prepare
import net.sourceforge.subsonic.service.TranscodingService; //导入依赖的package包/类
private void prepare() throws IOException {
PlayQueue playQueue = player.getPlayQueue();
// If playlist is in auto-random mode, populate it with new random songs.
if (playQueue.getIndex() == -1 && playQueue.getRandomSearchCriteria() != null) {
populateRandomPlaylist(playQueue);
}
MediaFile result;
synchronized (playQueue) {
result = playQueue.getCurrentFile();
}
MediaFile file = result;
if (file == null) {
close();
} else if (!file.equals(currentFile)) {
close();
LOG.info(player.getUsername() + " listening to \"" + FileUtil.getShortPath(file.getFile()) + "\"");
mediaFileService.incrementPlayCount(file);
// Don't scrobble REST players (except Sonos)
if (player.getClientId() == null || player.getClientId().equals(SonosHelper.SUBSONIC_CLIENT_ID)) {
audioScrobblerService.register(file, player.getUsername(), false, null);
}
TranscodingService.Parameters parameters = transcodingService.getParameters(file, player, maxBitRate, preferredTargetFormat, videoTranscodingSettings);
currentInputStream = transcodingService.getTranscodedInputStream(parameters);
currentFile = file;
status.setFile(currentFile.getFile());
}
}
示例6: prepare
import net.sourceforge.subsonic.service.TranscodingService; //导入依赖的package包/类
private void prepare() throws IOException {
PlayQueue playQueue = player.getPlayQueue();
// If playlist is in auto-random mode, populate it with new random songs.
if (playQueue.getIndex() == -1 && playQueue.getRandomSearchCriteria() != null) {
populateRandomPlaylist(playQueue);
}
MediaFile result;
synchronized (playQueue) {
result = playQueue.getCurrentFile();
}
MediaFile file = result;
if (file == null) {
close();
} else if (!file.equals(currentFile)) {
close();
LOG.info(player.getUsername() + " listening to \"" + FileUtil.getShortPath(file.getFile()) + "\"");
mediaFileService.incrementPlayCount(file);
mediaFileService.updateStatisticsUser(player.getUsername(), file);
if (player.getClientId() == null) { // Don't scrobble REST players.
audioScrobblerService.register(file, player.getUsername(), false, null);
}
TranscodingService.Parameters parameters = transcodingService.getParameters(file, player, maxBitRate, preferredTargetFormat, videoTranscodingSettings, true);
currentInputStream = transcodingService.getTranscodedInputStream(parameters);
currentFile = file;
status.setFile(currentFile.getFile());
}
}
示例7: setTranscodingService
import net.sourceforge.subsonic.service.TranscodingService; //导入依赖的package包/类
public void setTranscodingService(TranscodingService transcodingService) {
this.transcodingService = transcodingService;
}