Sony BDP-S370 (DLNA-compatible with new firmware M03.R.567)

Discuss alternative media renderers (not PS3) supported by PS3 Media Server (like Xbox 360 and TV's)

Re: Sony BDP-S370 (DLNA-compatible with new firmware M03.R.5

Postby patters » Sun Oct 10, 2010 10:36 am

Just to let you guys know, I've jumped ship over to Serviio which is far more functionally complete for Sony BDP users, and at least under active development. I've fixed up a profile that applies most of what we learned here with PS3MS regarding DLNA media / Mime types:
http://forum.serviio.org/viewtopic.php? ... 3659#p3655
patters
 
Posts: 97
Joined: Sun Apr 11, 2010 11:06 am
Top

Re: Sony BDP-S370 (DLNA-compatible with new firmware M03.R.5

Postby grolschie » Sun Oct 10, 2010 8:28 pm

Hi. Out of interest, does it stream internet tv and radio?
grolschie
 
Posts: 75
Joined: Thu Jun 10, 2010 6:05 am
Top

Re: Sony BDP-S370 (DLNA-compatible with new firmware M03.R.5

Postby patters » Mon Oct 11, 2010 4:52 pm

Not at the moment, however for saved video files it plays most types ok (one or two minor issues which are being fixed), transcodes with working ffwd/rew, will display photos with thumbnails correctly, and one major improvement over PS3MS is its media library which will sort out the naming of films and TV series for you. It also keeps a marker of which file and which season of a TV show was last played. I haven't had much of a look at the audio side of things, but I don't use my Bluray player for that.
patters
 
Posts: 97
Joined: Sun Apr 11, 2010 11:06 am
Top

Re: Sony BDP-S370 (DLNA-compatible with new firmware M03.R.5

Postby grolschie » Fri Oct 15, 2010 12:04 am

Here is a patch which incorporates WorldOfHurt's Content Range and Content Length patches, but also works for internet tv streaming via pmsencoder 1.1.0:

Code: Select all
--- 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) {



It should work with a fresh install of 410, 411 and 412. However, my code tweaks are hacks which may break things for other DLNA players. PMS.conf needs: "http_engine_v2=true".

A simple config modified from Patters' config:
Code: Select all
# ps3mediaserver renderer profile for Sony Bluray Disc Players (2010 Bravia Internet Video-enabled models)
# Refer to PS3.conf for help
RendererName=Sony Bluray BDP-Sx70
RendererIcon=bravia.png
UserAgentSearch=UPnP/1.0 DLNADOC/1.50
UserAgentAdditionalHeader=X-AV-Client-Info
UserAgentAdditionalHeaderSearch=(cn="Sony Corporation"; mn="Blu-ray Disc Player")
Video=true
Audio=true
Image=true
SeekByTime=true
TranscodeVideo=MPEGAC3
TranscodeAudio=LPCM
DefaultVBVBufSize=true
MuxH264ToMpegTS=true
MuxDTSToMpeg=false
WrapDTSIntoPCM=false
MuxLPCMToMpeg=false
MaxVideoBitrateMbps=0
MaxVideoWidth=0
MaxVideoHeight=0
H264Level41Limited=true
MimeTypesChanges=audio/wav=audio/mpeg|audio/mp3=audio/mpeg|video/x-matroska=video/avi|video/mpeg=video/avi|video/mp4=video/avi|video/x-ms-wmv=video/avi|video/wmv=video/avi
DLNALocalizationRequired=true
StreamExtensions=mp3,avi,divx,mpeg,jpg,mpg


It seems to play most things nicely so far.
grolschie
 
Posts: 75
Joined: Thu Jun 10, 2010 6:05 am
Top

Re: Sony BDP-S370 (DLNA-compatible with new firmware M03.R.5

Postby lance713 » Tue Oct 26, 2010 9:39 pm

I recently bought a BDV E570. Been using PMS for my PS3/360 without a problem.

I have been trying to get PSM to work with my new HTIB but I just can't get it to work... PSM shows up in the server list but every time I click a folder I get "There is no playable file."

I've read over this thread about patches and fixes, but I have no idea how to install them. Is there a step-by-step guide someone can point me to?
lance713
 
Posts: 1
Joined: Tue Oct 26, 2010 9:32 pm
Top

Re: Sony BDP-S370 (DLNA-compatible with new firmware M03.R.5

Postby grolschie » Tue Oct 26, 2010 9:59 pm

Compiling:
viewtopic.php?f=6&t=3507&p=17364&hilit=apache+ant#p17364
viewtopic.php?f=2&t=392&p=1874
viewtopic.php?f=12&t=4449&p=25919&hilit=apache+ant#p25919

Patching:
viewtopic.php?f=15&t=6930&p=35194&hilit=patch.exe+p0#p35194

In brief:
1). Install Apache Ant
2). Make sure the folder with the Ant executable (e.g. C:\Program Files\apache-ant-1.8.1\bin) is in your PATH enviroment variable.
3). Install an SVN client.
4). Create a new folder
5). Check out a fresh copy of the source code into the folder using SVN.
6). From the command line, change to the root of the new folder
7). Compile with the command "ant".

If no problems, continue on with patching.
1). Download the patch file into the root of the folder.
2). Download patch.exe into the root of the folder.
3). Patch with the command "patch -p0 < filename.patch
4). Compile with the command "ant".
grolschie
 
Posts: 75
Joined: Thu Jun 10, 2010 6:05 am
Top

Previous

Return to Alternative Media Renderers

Who is online

Users browsing this forum: Alexa [Bot] and 3 guests