Search in sources :

Example 1 with DLNAMediaInfo

use of net.pms.dlna.DLNAMediaInfo in project UniversalMediaServer by UniversalMediaServer.

the class WebRender method getOutputOptions.

@Override
public boolean getOutputOptions(List<String> cmdList, DLNAResource resource, Player player, OutputParams params) {
    if (player instanceof FFMpegVideo) {
        if (resource.getFormat().isVideo()) {
            DLNAMediaInfo media = resource.getMedia();
            boolean flash = media != null && "video/flash".equals(media.getMimeType());
            if (flash) {
                ffFlashCmds(cmdList, media);
            } else {
                String mimeType = getVideoMimeType();
                switch(mimeType) {
                    case RemoteUtil.MIME_OGG:
                        ffOggCmd(cmdList);
                        break;
                    case RemoteUtil.MIME_MP4:
                        ffMp4Cmd(cmdList);
                        break;
                    case RemoteUtil.MIME_WEBM:
                        if (isChromeTrick()) {
                            ffChromeCmd(cmdList);
                        } else {
                        // nothing here yet
                        }
                        break;
                }
            }
            if (isLowBitrate()) {
                cmdList.addAll(((FFMpegVideo) player).getVideoBitrateOptions(resource, media, params));
            }
        } else {
        // nothing here yet
        }
        return true;
    // } else if (player instanceof MEncoderVideo) {
    // // nothing here yet
    }
    return false;
}
Also used : DLNAMediaInfo(net.pms.dlna.DLNAMediaInfo) FFMpegVideo(net.pms.encoders.FFMpegVideo)

Example 2 with DLNAMediaInfo

use of net.pms.dlna.DLNAMediaInfo in project UniversalMediaServer by UniversalMediaServer.

the class Issue1278 method dlnaMediaInfoDoubleParseWithDot.

@Test
public void dlnaMediaInfoDoubleParseWithDot() {
    DLNAMediaInfo info = new DLNAMediaInfo();
    info.setFrameRate("23.976");
    String validFps = info.getValidFps(true);
    assertNotNull("validFps", validFps);
    assertEquals("proper ratio", "24000/1001", validFps);
    validFps = info.getValidFps(false);
    assertNotNull("validFps", validFps);
    assertEquals("proper ratio", "23.976", validFps);
}
Also used : DLNAMediaInfo(net.pms.dlna.DLNAMediaInfo) Test(org.junit.Test)

Example 3 with DLNAMediaInfo

use of net.pms.dlna.DLNAMediaInfo in project UniversalMediaServer by UniversalMediaServer.

the class Issue1278 method testNullFrameRate.

@Test
public void testNullFrameRate() {
    DLNAMediaInfo info = new DLNAMediaInfo();
    assertNull("valid fps", info.getValidFps(true));
}
Also used : DLNAMediaInfo(net.pms.dlna.DLNAMediaInfo) Test(org.junit.Test)

Example 4 with DLNAMediaInfo

use of net.pms.dlna.DLNAMediaInfo in project UniversalMediaServer by UniversalMediaServer.

the class Issue1278 method dlnaMediaInfoDoubleParseWithComma.

@Test
public void dlnaMediaInfoDoubleParseWithComma() {
    DLNAMediaInfo info = new DLNAMediaInfo();
    info.setFrameRate("23,976");
    String validFps = info.getValidFps(true);
    assertNotNull("validFps", validFps);
    assertEquals("proper ratio", "24000/1001", validFps);
    validFps = info.getValidFps(false);
    assertNotNull("validFps", validFps);
    assertEquals("proper ratio", "23.976", validFps);
}
Also used : DLNAMediaInfo(net.pms.dlna.DLNAMediaInfo) Test(org.junit.Test)

Example 5 with DLNAMediaInfo

use of net.pms.dlna.DLNAMediaInfo in project UniversalMediaServer by UniversalMediaServer.

the class modAwareHashMap method parseMediaInfo.

/**
 * Parse media info from ffmpeg headers during playback
 */
public void parseMediaInfo(String filename, final DLNAResource dlna, final ProcessWrapperImpl pw) {
    if (dlna.getMedia() == null) {
        dlna.setMedia(new DLNAMediaInfo());
    } else if (dlna.getMedia().isFFmpegparsed()) {
        return;
    }
    final ArrayList<String> lines = new ArrayList<>();
    final String input = filename.length() > 200 ? filename.substring(0, 199) : filename;
    OutputTextLogger ffParser = new OutputTextLogger(null) {

        @Override
        public boolean filter(String line) {
            if (endOfHeader.reset(line).find()) {
                dlna.getMedia().parseFFmpegInfo(lines, input);
                LOGGER.trace("[{}] parsed media from headers: {}", ID, dlna.getMedia());
                dlna.getParent().updateChild(dlna);
                // done, stop filtering
                return false;
            }
            lines.add(line);
            // keep filtering
            return true;
        }
    };
    ffParser.setFiltered(true);
    pw.setStderrConsumer(ffParser);
}
Also used : DLNAMediaInfo(net.pms.dlna.DLNAMediaInfo) ArrayList(java.util.ArrayList) OutputTextLogger(net.pms.io.OutputTextLogger)

Aggregations

DLNAMediaInfo (net.pms.dlna.DLNAMediaInfo)10 Test (org.junit.Test)8 ArrayList (java.util.ArrayList)5 Format (net.pms.formats.Format)5 RendererConfiguration (net.pms.configuration.RendererConfiguration)4 DLNAMediaAudio (net.pms.dlna.DLNAMediaAudio)4 MPG (net.pms.formats.MPG)4 MP3 (net.pms.formats.audio.MP3)2 PmsConfiguration (net.pms.configuration.PmsConfiguration)1 FFMpegVideo (net.pms.encoders.FFMpegVideo)1 DVRMS (net.pms.formats.DVRMS)1 ISO (net.pms.formats.ISO)1 MKV (net.pms.formats.MKV)1 M4A (net.pms.formats.audio.M4A)1 OGA (net.pms.formats.audio.OGA)1 WAV (net.pms.formats.audio.WAV)1 RAW (net.pms.formats.image.RAW)1 OutputTextLogger (net.pms.io.OutputTextLogger)1 ConfigurationException (org.apache.commons.configuration.ConfigurationException)1