當前位置: 首頁>>代碼示例>>Java>>正文


Java TranscodingService.Parameters方法代碼示例

本文整理匯總了Java中net.sourceforge.subsonic.service.TranscodingService.Parameters方法的典型用法代碼示例。如果您正苦於以下問題:Java TranscodingService.Parameters方法的具體用法?Java TranscodingService.Parameters怎麽用?Java TranscodingService.Parameters使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.sourceforge.subsonic.service.TranscodingService的用法示例。


在下文中一共展示了TranscodingService.Parameters方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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;
}
 
開發者ID:sindremehus,項目名稱:subsonic,代碼行數:22,代碼來源:StreamController.java

示例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);
}
 
開發者ID:sindremehus,項目名稱:subsonic,代碼行數:8,代碼來源:CoverArtController.java

示例3: 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());
    }
}
 
開發者ID:sindremehus,項目名稱:subsonic,代碼行數:32,代碼來源:PlayQueueInputStream.java

示例4: 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());
    }
}
 
開發者ID:FutureSonic,項目名稱:FutureSonic-Server,代碼行數:32,代碼來源:PlayQueueInputStream.java


注:本文中的net.sourceforge.subsonic.service.TranscodingService.Parameters方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。