grolschie wrote:The patch is here:
viewtopic.php?f=15&t=6930&start=180#p38045
It's a source code patch, so it needs the entire source tree downloaded, not that .exe file.
thanks a lot !
grolschie wrote:The patch is here:
viewtopic.php?f=15&t=6930&start=180#p38045
It's a source code patch, so it needs the entire source tree downloaded, not that .exe file.
--- net/pms/configuration/RendererConfiguration.java 2010-10-06 11:52:33.968750000 +1300
+++ net/pms/configuration/RendererConfiguration.java 2010-10-03 08:47:26.515625000 +1300
@@ -305,6 +305,12 @@ public class RendererConfiguration {
return getBoolean(SHOW_DVD_TITLE_DURATION, false);
}
+ private static final String CUSTOM_MENCODER_OPTIONS="CustomMencoderOptions";
+
+ public String getCustomMencoderOptions() {
+ return getString(CUSTOM_MENCODER_OPTIONS, null);
+ }
+
private RendererConfiguration() throws ConfigurationException {
this(null);
}
--- net/pms/dlna/DLNAMediaInfo.java 2010-10-06 11:52:35.515625000 +1300
+++ net/pms/dlna/DLNAMediaInfo.java 2010-10-06 11:59:02.734375000 +1300
@@ -68,7 +68,8 @@ import org.jaudiotagger.tag.Tag;
public class DLNAMediaInfo implements Cloneable {
public static final long ENDFILE_POS = 99999475712L;
- public static final long TRANS_SIZE = 100000000000L;
+ public static long TRANS_SIZE = 100000000000L;
+
//private static SimpleDateFormat sdfExif = new SimpleDateFormat("yyyy:MM:dd HH:mm:ss");
// stored in database
--- net/pms/dlna/DLNAResource.java 2010-10-06 11:52:35.453125000 +1300
+++ net/pms/dlna/DLNAResource.java 2010-10-01 18:51:46.265625000 +1300
@@ -48,6 +48,7 @@ import net.pms.external.StartStopListene
import net.pms.formats.Format;
import net.pms.io.OutputParams;
import net.pms.io.ProcessWrapper;
+import net.pms.io.SizeLimitInputStream;
import net.pms.network.HTTPResource;
import net.pms.util.FileUtil;
import net.pms.util.ImagesUtil;
@@ -725,7 +726,12 @@ public abstract class DLNAResource exten
}
else
dlnaspec = "DLNA.ORG_PN=" + getMPEG_PS_PALLocalizedValue(c);
- } else if (mime.equals("image/jpeg"))
+ }
+ //**HACK**
+ else if (mime.equals("video/vnd.dlna.mpeg-tts"))
+ dlnaspec = "DLNA.ORG_PN=" + getMPEG_TS_SD_EULocalizedValue(c);
+ //**HACK**
+ else if (mime.equals("image/jpeg"))
dlnaspec = "DLNA.ORG_PN=JPEG_LRG";
else if (mime.equals("audio/mpeg"))
dlnaspec = "DLNA.ORG_PN=MP3";
@@ -935,6 +941,16 @@ public abstract class DLNAResource exten
((IPushOutput) this).push(out);
if (low > 0 && fis != null)
fis.skip(low);
+ // WoH
+ if(high > low && fis != null)
+ {
+ long bytes = (high - (low < 0 ? 0 : low)) + 1;
+
+ PMS.debug("Using size-limiting stream (" + bytes + " bytes)");
+ SizeLimitInputStream slis = new SizeLimitInputStream(fis, bytes);
+ return slis;
+ }
+ // /WoH
return fis;
}
@@ -948,6 +964,15 @@ public abstract class DLNAResource exten
fis = getInputStream();
if (low > 0 && fis != null)
fis.skip(low);
+ // WoH
+ if(high > low && fis != null)
+ {
+ long bytes = (high - (low < 0 ? 0 : low)) + 1;
+
+ PMS.debug("Using size-limiting stream (" + bytes + " bytes)");
+ fis = new SizeLimitInputStream(fis, bytes);
+ }
+ // /WoH
if (timeseek != 0 && this instanceof RealFile)
fis.skip(MpegUtil.getPossitionForTimeInMpeg(((RealFile)this).file, (int) timeseek));
return fis;
--- net/pms/dlna/RealFile.java 2010-10-06 11:52:35.437500000 +1300
+++ net/pms/dlna/RealFile.java 2010-10-06 11:57:46.359375000 +1300
@@ -273,6 +273,16 @@ public class RealFile extends DLNAResour
}
public long length() {
+
+ String fileName = file.getName().toLowerCase();
+
+ if (fileName.endsWith(".avi") || fileName.endsWith(".divx") || fileName.endsWith(".mpeg")
+ || fileName.endsWith(".mpg") || fileName.endsWith(".mp3")){
+ DLNAMediaInfo.TRANS_SIZE = 100000000000L;
+ } else {
+ DLNAMediaInfo.TRANS_SIZE = -1L;
+ }
+
if (player != null && player.type() != Format.IMAGE)
return DLNAMediaInfo.TRANS_SIZE;
else if (media != null && media.mediaparsed)
--- net/pms/dlna/WebStream.java 2010-10-06 11:52:35.500000000 +1300
+++ net/pms/dlna/WebStream.java 2010-10-06 12:00:18.953125000 +1300
@@ -54,6 +53,7 @@ public class WebStream extends DLNAResou
}
public long length() {
+ DLNAMediaInfo.TRANS_SIZE = -1L;
return DLNAMediaInfo.TRANS_SIZE;
}
--- net/pms/encoders/MEncoderVideo.java 2010-10-06 11:52:33.468750000 +1300
+++ net/pms/encoders/MEncoderVideo.java 2010-10-03 08:55:28.500000000 +1300
@@ -1080,9 +1080,13 @@ private JTextField mencoder_ass_scale;
}
String add = ""; //$NON-NLS-1$
- if (configuration.getMencoderDecode() == null || configuration.getMencoderDecode().indexOf("-lavdopts") == -1) { //$NON-NLS-1$
+ if (params.mediaRenderer.getCustomMencoderOptions() != null) {
+ if (params.mediaRenderer.getCustomMencoderOptions().indexOf("-lavdopts") == -1) //$NON-NLS-1$
+ add = " -lavdopts debug=0"; //$NON-NLS-1$
+ }
+ else if (configuration.getMencoderDecode() == null || configuration.getMencoderDecode().indexOf("-lavdopts") == -1) //$NON-NLS-1$
add = " -lavdopts debug=0"; //$NON-NLS-1$
- }
+
String alternativeCodec = "";//"-ac ffac3,ffdca, "; //$NON-NLS-1$
if (dvd)
@@ -1093,7 +1097,8 @@ private JTextField mencoder_ass_scale;
channels = wmv?2:CodecUtil.getRealChannelCount(configuration, params.aid);
PMS.debug("channels=" + channels);
- StringTokenizer st = new StringTokenizer(alternativeCodec + "-channels " + channels + " " + configuration.getMencoderDecode() + add, " "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ StringTokenizer st = new StringTokenizer(alternativeCodec + "-channels " + channels + " " + ((params.mediaRenderer.getCustomMencoderOptions()!=null)?(params.mediaRenderer.getCustomMencoderOptions()):configuration.getMencoderDecode()) + add, " "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+
overridenMainArgs = new String [st.countTokens()];
int i = 0;
boolean next = false;
--- net/pms/io/SizeLimitInputStream.java 1970-01-01 13:00:00.000000000 +1300
+++ net/pms/io/SizeLimitInputStream.java 2010-10-01 18:00:00.265625000 +1300
@@ -0,0 +1,252 @@
+package net.pms.io;
+
+/*
+ * Input stream wrapper with a byte limit.
+ * Copyright (C) 2004 Stephen Ostermiller
+ * http://ostermiller.org/contact.pl?regarding=Java+Utilities
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * See COPYING.TXT for details.
+ */
+
+import java.io.*;
+
+/**
+ * An input stream wrapper that will read only a set number of bytes from the
+ * underlying stream.
+ *
+ * @author Stephen Ostermiller
+ * http://ostermiller.org/contact.pl?regarding=Java+Utilities
+ * @since ostermillerutils 1.04.00
+ */
+public class SizeLimitInputStream extends InputStream {
+
+ /**
+ * The input stream that is being protected. All methods should be forwarded
+ * to it, after checking the size that has been read.
+ *
+ * @since ostermillerutils 1.04.00
+ */
+ protected InputStream in;
+
+ /**
+ * The number of bytes to read at most from this Stream. Read methods should
+ * check to ensure that bytesRead never exceeds maxBytesToRead.
+ *
+ * @since ostermillerutils 1.04.00
+ */
+ protected long maxBytesToRead = 0;
+
+ /**
+ * The number of bytes that have been read from this stream. Read methods
+ * should check to ensure that bytesRead never exceeds maxBytesToRead.
+ *
+ * @since ostermillerutils 1.04.00
+ */
+ protected long bytesRead = 0;
+
+ /**
+ * The number of bytes that have been read from this stream since mark() was
+ * called.
+ *
+ * @since ostermillerutils 1.04.00
+ */
+ protected long bytesReadSinceMark = 0;
+
+ /**
+ * The number of bytes the user has request to have been marked for reset.
+ *
+ * @since ostermillerutils 1.04.00
+ */
+ protected long markReadLimitBytes = -1;
+
+ /**
+ * Get the number of bytes actually read from this stream.
+ *
+ * @return number of bytes that have already been taken from this stream.
+ *
+ * @since ostermillerutils 1.04.00
+ */
+ public long getBytesRead() {
+ return bytesRead;
+ }
+
+ /**
+ * Get the maximum number of bytes left to read before the limit (set in the
+ * constructor) is reached.
+ *
+ * @return The number of bytes that (at a maximum) are left to be taken from
+ * this stream.
+ *
+ * @since ostermillerutils 1.04.00
+ */
+ public long getBytesLeft() {
+ return maxBytesToRead - bytesRead;
+ }
+
+ /**
+ * Tell whether the number of bytes specified in the constructor have been
+ * read yet.
+ *
+ * @return true iff the specified number of bytes have all been read.
+ *
+ * @since ostermillerutils 1.04.00
+ */
+ public boolean allBytesRead() {
+ return getBytesLeft() == 0;
+ }
+
+ /**
+ * Get the number of total bytes (including bytes already read) that can be
+ * read from this stream (as set in the constructor).
+ *
+ * @return Maximum bytes that can be read until the size limit runs out
+ *
+ * @since ostermillerutils 1.04.00
+ */
+ public long getMaxBytesToRead() {
+ return maxBytesToRead;
+ }
+
+ /**
+ * Create a new size limit input stream from another stream given a size
+ * limit.
+ *
+ * @param in
+ * The input stream.
+ * @param maxBytesToRead
+ * the max number of bytes to allow to be read from the
+ * underlying stream.
+ *
+ * @since ostermillerutils 1.04.00
+ */
+ public SizeLimitInputStream(InputStream in, long maxBytesToRead) {
+ this.in = in;
+ this.maxBytesToRead = maxBytesToRead;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public int read() throws IOException {
+ if (bytesRead >= maxBytesToRead) {
+ return -1;
+ }
+ int b = in.read();
+ if (b != -1) {
+ bytesRead++;
+ bytesReadSinceMark++;
+ }
+ return b;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public int read(byte[] b) throws IOException {
+ return this.read(b, 0, b.length);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public int read(byte[] b, int off, int len) throws IOException {
+ if (bytesRead >= maxBytesToRead) {
+ return -1;
+ }
+ long bytesLeft = getBytesLeft();
+ if (len > bytesLeft) {
+ len = (int) bytesLeft;
+ }
+ int bytesJustRead = in.read(b, off, len);
+ bytesRead += bytesJustRead;
+ bytesReadSinceMark += bytesJustRead;
+ return bytesJustRead;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public long skip(long n) throws IOException {
+ if (bytesRead >= maxBytesToRead) {
+ return -1;
+ }
+ long bytesLeft = getBytesLeft();
+ if (n > bytesLeft) {
+ n = bytesLeft;
+ }
+ return in.skip(n);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public int available() throws IOException {
+ int available = in.available();
+ long bytesLeft = getBytesLeft();
+ if (available > bytesLeft) {
+ available = (int) bytesLeft;
+ }
+ return available;
+ }
+
+ /**
+ * Close this stream and underlying streams. Calling this method may make
+ * data on the underlying stream unavailable.
+ * <p>
+ * Consider wrapping this stream in a NoCloseStream so that clients can call
+ * close() with no effect.
+ *
+ * @since ostermillerutils 1.04.00
+ */
+ @Override
+ public void close() throws IOException {
+ in.close();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void mark(int readlimit) {
+ if (in.markSupported()) {
+ markReadLimitBytes = readlimit;
+ bytesReadSinceMark = 0;
+ in.mark(readlimit);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void reset() throws IOException {
+ if (in.markSupported() && bytesReadSinceMark <= markReadLimitBytes) {
+ bytesRead -= bytesReadSinceMark;
+ in.reset();
+ bytesReadSinceMark = 0;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean markSupported() {
+ return in.markSupported();
+ }
+}
\ No newline at end of file
--- net/pms/network/RequestV2.java 2010-10-06 12:05:36.765625000 +1300
+++ net/pms/network/RequestV2.java 2010-10-06 12:12:34.406250000 +1300
@@ -227,6 +227,9 @@ public class RequestV2 extends HTTPResou
highRange = totalsize -1;
}
output.setHeader(HttpHeaders.Names.CONTENT_RANGE, "bytes " + lowRange + "-" + highRange + "/" +totalsize);
+ // WoH
+ CLoverride = totalsize;
+ // /WoH
}
if (contentFeatures != null)
output.setHeader("ContentFeatures.DLNA.ORG", files.get(0).getDlnaContentFeatures());
@@ -509,17 +512,17 @@ public class RequestV2 extends HTTPResou
}
} else if (inputStream != null) {
if (CLoverride > -1) {
- if (lowRange > 0 && highRange > 0) {
- output.setHeader(HttpHeaders.Names.CONTENT_LENGTH, "" + (highRange-lowRange+1));
+ if (true) {
+ output.setHeader(HttpHeaders.Names.CONTENT_LENGTH, "-1");//**HACK**
} else if (CLoverride != DLNAMediaInfo.TRANS_SIZE) // since 2.50, it's wiser not to send an arbitrary Content length,
// as the PS3 displays a network error and asks the last seconds of the transcoded video
// deprecated since the "-1" size sent anyway
- output.setHeader(HttpHeaders.Names.CONTENT_LENGTH, "" + CLoverride);
+ output.setHeader(HttpHeaders.Names.CONTENT_LENGTH, "-1");//**HACK**
}
else {
int cl = inputStream.available();
PMS.debug("Available Content-Length: " + cl);
- output.setHeader(HttpHeaders.Names.CONTENT_LENGTH, "" + cl);
+ output.setHeader(HttpHeaders.Names.CONTENT_LENGTH, "-1");//**HACK**
}
if (timeseek > 0 && dlna != null) {
Return to Alternative Media Renderers
Users browsing this forum: No registered users and 2 guests