Skip to content

Commit

Permalink
backlog:
Browse files Browse the repository at this point in the history
- Double check for Mplayer existence and font generation (useful for latest Sherpya's revisions)
- Ability to shutdown DLNAorgPN automatic support for a given renderer (see DLNAOrgPN attribute in the renderer conf file)
- Some hack stuff for mpeg2 remux on Bravia TVs
- RAW generation fixed
- Custom mencoder quality settings for a given renderer
  • Loading branch information
shagr4th committed Sep 29, 2010
1 parent d26d03d commit 562fdb8
Show file tree
Hide file tree
Showing 13 changed files with 188 additions and 14 deletions.
13 changes: 8 additions & 5 deletions ps3mediaserver/net/pms/PMS.java
Expand Up @@ -208,11 +208,14 @@ public WinUtils getRegistry() {
return registry;
}

private boolean checkProcessExistence(String name, boolean error, String...params) throws Exception {
private boolean checkProcessExistence(String name, boolean error, File workDir, String...params) throws Exception {
PMS.info("launching: " + params[0]); //$NON-NLS-1$

try {
final Process process = Runtime.getRuntime().exec(params);
ProcessBuilder pb = new ProcessBuilder(params);
if (workDir != null)
pb.directory(workDir);
final Process process = pb.start();

OutputTextConsumer stderrConsumer = new OutputTextConsumer(process.getErrorStream(), false);
stderrConsumer.start();
Expand All @@ -238,8 +241,7 @@ public void run() {
return true;
if (params[0].equals("ffmpeg") && stderrConsumer.getResults().get(0).startsWith("FF")) //$NON-NLS-1$ //$NON-NLS-2$
return true;
int exit = 0;
process.exitValue();
int exit = process.exitValue();
if (exit != 0) {
if (error)
PMS.minimal("[" + exit + "] Cannot launch " + name + " / Check the presence of " + new File(params[0]).getAbsolutePath() + " ..."); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
Expand Down Expand Up @@ -328,7 +330,8 @@ private boolean init () throws Exception {
//System.out.println(System.getProperties().toString().replace(',', '\n'));

PMS.minimal("Checking font cache... launching simple instance of MPlayer... You may have to wait 60 seconds !");
checkProcessExistence("MPlayer", true, configuration.getMplayerPath(), "dummy");
checkProcessExistence("MPlayer", true, null, configuration.getMplayerPath(), "dummy");
checkProcessExistence("MPlayer", true, PMS.getConfiguration().getTempFolder(), configuration.getMplayerPath(), "dummy");
PMS.minimal("Done!");
/*
if (!checkProcessExistence("FFmpeg", true, configuration.getFfmpegPath(), "-h")) //$NON-NLS-1$ //$NON-NLS-2$
Expand Down
4 changes: 2 additions & 2 deletions ps3mediaserver/net/pms/configuration/PmsConfiguration.java
Expand Up @@ -438,9 +438,9 @@ public String getMencoderAudioLanguages() {

private String getDefaultLanguages() {
if ("fr".equals(getLanguage())) {
return "fre,jpn,ger,eng";
return "fre,jpn,ger,eng,und";
} else {
return "eng,fre,jpn,ger";
return "eng,fre,jpn,ger,und";
}
}

Expand Down
10 changes: 10 additions & 0 deletions ps3mediaserver/net/pms/configuration/RendererConfiguration.java
Expand Up @@ -278,10 +278,12 @@ public boolean isBRAVIA() {
private static final String DLNA_PN_CHANGES="DLNAProfileChanges";
private static final String TRANSCODE_FAST_START="TranscodeFastStart";
private static final String AUTO_EXIF_ROTATE="AutoExifRotate";
private static final String DLNA_ORGPN_USE="DLNAOrgPN";
private static final String DLNA_LOCALIZATION_REQUIRED="DLNALocalizationRequired";
private static final String MEDIAPARSERV2="MediaInfo";
private static final String MEDIAPARSERV2_THUMB="MediaParserV2_ThumbnailGeneration";
private static final String SUPPORTED="Supported";
private static final String CUSTOM_MENCODER_QUALITYSETTINGS="CustomMencoderQualitySettings";

// Ditlew
private static final String SHOW_DVD_TITLE_DURATION="ShowDVDTitleDuration";
Expand Down Expand Up @@ -582,6 +584,10 @@ public String getMaxVideoBitrate() {
return getString(MAX_VIDEO_BITRATE, null);
}

public String getCustomMencoderQualitySettings() {
return getString(CUSTOM_MENCODER_QUALITYSETTINGS, null);
}

public int getMaxVideoWidth() {
return getInt(MAX_VIDEO_WIDTH, 0);
}
Expand All @@ -594,6 +600,10 @@ public boolean isVideoRescale() {
return getMaxVideoWidth() > 0 && getMaxVideoHeight() > 0;
}

public boolean isDLNAOrgPNUsed() {
return getBoolean(DLNA_ORGPN_USE, true);
}

public String getTranscodedExtensions() {
return getString(TRANSCODE_EXT, "");
}
Expand Down
15 changes: 14 additions & 1 deletion ps3mediaserver/net/pms/dlna/DLNAMediaInfo.java
Expand Up @@ -38,6 +38,7 @@
import javax.imageio.ImageIO;

import net.pms.PMS;
import net.pms.configuration.RendererConfiguration;
import net.pms.formats.AudioAsVideo;
import net.pms.formats.Format;
import net.pms.io.OutputParams;
Expand Down Expand Up @@ -99,10 +100,22 @@ public class DLNAMediaInfo implements Cloneable {
private boolean ffmpeg_failure;
//private boolean mplayer_thumb_failure;
private boolean ffmpeg_annexb_failure;
public boolean muxable;
private boolean muxable;
private Map<String, String> extras;
public boolean encrypted;

public boolean isMuxable(RendererConfiguration mediaRenderer) {
// temporary fix, MediaInfo support will take care of that in the future

// for now, http://ps3mediaserver.org/forum/viewtopic.php?f=11&t=6361&start=0
if (mediaRenderer.isBRAVIA() && codecV != null && codecV.startsWith("mpeg2"))
muxable = true;
if (mediaRenderer.isBRAVIA() && height < 288) // not supported for these small heights
muxable = false;

return muxable;
}

public Map<String, String> getExtras() {
return extras;
}
Expand Down
7 changes: 5 additions & 2 deletions ps3mediaserver/net/pms/dlna/DLNAResource.java
Expand Up @@ -709,12 +709,12 @@ else if (mime.equals("video/x-ms-wmv") && media != null && media.height > 700)
// do we have some mpegts to offer ?
boolean mpegTsMux = TSMuxerVideo.ID.equals(player.id()) || VideoLanVideoStreaming.ID.equals(player.id());
if (!mpegTsMux) { // maybe, like the ps3, mencoder can launch tsmuxer if this a compatible H264 video
mpegTsMux = MEncoderVideo.ID.equals(player.id()) && ((media_subtitle == null && media != null && media.dvdtrack == 0 && media.muxable
mpegTsMux = MEncoderVideo.ID.equals(player.id()) && ((media_subtitle == null && media != null && media.dvdtrack == 0 && media.isMuxable(mediaRenderer)
&& PMS.getConfiguration().isMencoderMuxWhenCompatible() && mediaRenderer.isMuxH264MpegTS())
|| mediaRenderer.isTranscodeToMPEGTSAC3());
}
if (mpegTsMux)
dlnaspec = media.isH264()&&!VideoLanVideoStreaming.ID.equals(player.id())&&media.muxable?"DLNA.ORG_PN=AVC_TS_HD_24_AC3_ISO":"DLNA.ORG_PN=" + getMPEG_TS_SD_EU_ISOLocalizedValue(c);
dlnaspec = media.isH264()&&!VideoLanVideoStreaming.ID.equals(player.id())&&media.isMuxable(mediaRenderer)?"DLNA.ORG_PN=AVC_TS_HD_24_AC3_ISO":"DLNA.ORG_PN=" + getMPEG_TS_SD_EU_ISOLocalizedValue(c);
else
dlnaspec = "DLNA.ORG_PN=" + getMPEG_PS_PALLocalizedValue(c);
} else if(media != null){
Expand All @@ -736,6 +736,9 @@ else if (mime.equals("audio/L16") || mime.equals("audio/wav"))
if(dlnaspec != null)
dlnaspec = "DLNA.ORG_PN=" + mediaRenderer.getDLNAPN(dlnaspec.substring(12));

if (!mediaRenderer.isDLNAOrgPNUsed())
dlnaspec = null;

addAttribute(sb, "protocolInfo", "http-get:*:" + mime + ":" + (dlnaspec!=null?(dlnaspec + ";"):"") + flags);


Expand Down
4 changes: 3 additions & 1 deletion ps3mediaserver/net/pms/encoders/MEncoderVideo.java
Expand Up @@ -1011,7 +1011,7 @@ public ProcessWrapper launchTranscode(String fileName, DLNAMediaInfo media, Outp
dvd = true;

ovccopy = false;
if (params.sid == null && !dvd && !avisynth() && media != null && (media.isVideoPS3Compatible(newInput) || !params.mediaRenderer.isH264Level41Limited()) && configuration.isMencoderMuxWhenCompatible() && params.mediaRenderer.isMuxH264MpegTS()) {
if (params.sid == null && !dvd && !avisynth() && media != null && (media.isVideoPS3Compatible(newInput) || !params.mediaRenderer.isH264Level41Limited()) && media.isMuxable(params.mediaRenderer) && configuration.isMencoderMuxWhenCompatible() && params.mediaRenderer.isMuxH264MpegTS()) {
String sArgs [] = getSpecificCodecOptions(PMS.getConfiguration().getCodecSpecificConfig(), media, params, fileName, subString, PMS.getConfiguration().isMencoderIntelligentSync(), false);
boolean nomux = false;
for(String s:sArgs) {
Expand Down Expand Up @@ -1117,6 +1117,8 @@ public ProcessWrapper launchTranscode(String fileName, DLNAMediaInfo media, Outp
//}
if (configuration.getMencoderMainSettings() != null) {
String mainConfig = configuration.getMencoderMainSettings();
if (params.mediaRenderer.getCustomMencoderQualitySettings() != null)
mainConfig = params.mediaRenderer.getCustomMencoderQualitySettings();
if (mainConfig.contains("/*")) // in case of //$NON-NLS-1$
mainConfig = mainConfig.substring(mainConfig.indexOf("/*")); //$NON-NLS-1$

Expand Down
2 changes: 1 addition & 1 deletion ps3mediaserver/net/pms/encoders/TSMuxerVideo.java
Expand Up @@ -200,7 +200,7 @@ public ProcessWrapper launchTranscode(String fileName, DLNAMediaInfo media, Outp
if (media != null && media.getFirstAudioTrack().bitsperSample >=24)
depth = "pcm_s24le"; //$NON-NLS-1$
if (media != null && media.getFirstAudioTrack().getSampleRate() >48000)
rate = "96000"; //$NON-NLS-1$
rate = "" + media.getFirstAudioTrack().getSampleRate(); //$NON-NLS-1$
String flacCmd [] = new String [] { configuration.getFfmpegPath(), "-ar", rate, "-i", fileName , "-f", "wav", "-acodec", depth, "-y", ffAudioPipe[0].getInputPipe() }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$

ffparams = new OutputParams(PMS.getConfiguration());
Expand Down
2 changes: 1 addition & 1 deletion ps3mediaserver/net/pms/formats/MKV.java
Expand Up @@ -25,7 +25,7 @@ public boolean ps3compatible() {
}

public String [] getId() {
return new String [] { "mkv", "dv", "ty", "mov", "ogm", "hdmov", "hdm", "rmv", "rmvb", "rm", "asf", "evo", "asx", "flv", "m2v" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$
return new String [] { "mkv", "dv", "ty", "mov", "ogm", "ogv", "hdmov", "hdm", "rmv", "rmvb", "rm", "asf", "evo", "asx", "flv", "m2v" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$
}

}
9 changes: 9 additions & 0 deletions ps3mediaserver/net/pms/formats/RAW.java
Expand Up @@ -92,5 +92,14 @@ public void parse(DLNAMediaInfo media, InputFile file, int type, RendererConfigu


}

/*
* Force this format to be transcoded (RAW support broken in rev 409 and earlier)
* @see net.pms.formats.Format#skip(java.lang.String, java.lang.String)
*/
@Override
public boolean skip(String extensions, String anotherSetOfExtensions) {
return true;
}

}
2 changes: 1 addition & 1 deletion ps3mediaserver/renderers/Bravia5500.conf
Expand Up @@ -5,7 +5,7 @@ RendererName=Sony Bravia 5500 Series
RendererIcon=bravia.png
UserAgentSearch=notusedhere
UserAgentAdditionalHeader=X-AV-Client-Info
UserAgentAdditionalHeaderSearch=(BRAVIA KDL.+5[0-9]{3})|(BRAVIA KDL.+WE5)|(BRAVIA KDL-[0-9]{2}XBR9)|(BRAVIA KDL.+EX5)
UserAgentAdditionalHeaderSearch=(BRAVIA KDL.+5[0-9]{3})|(BRAVIA KDL.+WE5)|(BRAVIA KDL-[0-9]{2}XBR9)
Video=true
Audio=true
Image=true
Expand Down
51 changes: 51 additions & 0 deletions ps3mediaserver/renderers/BraviaEX.conf
@@ -0,0 +1,51 @@
# ps3mediaserver renderer profile for Sony Bravia EX500/EX700 series
# Refer to PS3.conf for help

RendererName=Sony Bravia EX Series
RendererIcon=bravia.png
UserAgentSearch=notusedhere
UserAgentAdditionalHeader=X-AV-Client-Info
UserAgentAdditionalHeaderSearch=(BRAVIA KDL.+EX5)|(BRAVIA KDL.+EX7)|(BRAVIA KDL.+NX7)
Video=true
Audio=true
Image=true
SeekByTime=true
TranscodeVideo=MPEGAC3
TranscodeAudio=MP3
DefaultVBVBufSize=true
MuxH264ToMpegTS=true
MuxDTSToMpeg=false
WrapDTSIntoPCM=false
MuxLPCMToMpeg=false
MaxVideoBitrateMbps=0
MaxVideoWidth=0
MaxVideoHeight=0
H264Level41Limited=true
MimeTypesChanges=audio/wav=audio/L16|video/mp4=video/mpeg
DLNALocalizationRequired=true
TranscodeExtensions=dvr-ms,dvr,mkv,dv,ty,mov,ogm,hdmov,hdm,rmv,rmvb,rm,asf,evo,asx,flv,m2v,mpe,mod,tivo,ty,tmf,ts,tp,m2p,mp4,m4v,avi,wmv,wm,divx,div,flac,mlp,fla,wma,m4a,aac,dts,mka,ape,ogg,shn,mpc,ra,mp2,wv,oma,aa3,gif,png,arw,cr2,crw,dng,raf,mrw,nef,pef,tif,tiff
StreamExtensions=


MediaInfo=true
# [Supported video formats]:
# Here we declare support (or lack) of DTS (here, none of the entries declare dts as a supported audio codec)
Supported = f:mpegps|mpegts v:mpeg1|mpeg2|mp4|h264 a:ac3|lpcm|aac|mpa m:video/mpeg
# No H264 for AVI files, plus specific mediainfo attributes, for better auto detection (qpel and gmc are not supported here)
Supported = f:avi|divx v:mp4|divx|mjpeg a:mp3|lpcm|mpa|ac3 m:video/x-divx qpel:no gmc:0
Supported = f:mp4 v:mp4|h264 a:ac3|aac m:video/mp4
# WMV files are supported, but not with 5.1 audio: (hence the n:2)
Supported = f:wmv v:wmv|vc1 a:wma n:2 m:video/x-ms-wmv
# [Supported audio formats]:
Supported = f:wav a:dts|lpcm n:6 s:48000 m:audio/wav
Supported = f:wav n:2 s:48000 m:audio/wav
Supported = f:mp3 n:2 m:audio/mpeg
# Apple lossless not supported
Supported = f:aac n:2 a:(?!alac).+ m:audio/x-m4a
Supported = f:wma n:2 m:audio/x-ms-wma
Supported = f:atrac n:2 m:audio/x-oma
# [Supported image formats]
Supported = f:jpg m:image/jpeg
Supported = f:png m:image/png
Supported = f:gif m:image/gif
Supported = f:tiff m:image/tiff
83 changes: 83 additions & 0 deletions ps3mediaserver/renderers/FreecomMusicPal.conf
@@ -0,0 +1,83 @@
#------------------------------------------------------------
# ps3mediaserver profile for the Freecom MusicPal webradio client
# DO NOT MODIFY THIS (OR AT YOUR OWN RISK)

#------------------------------------------------------------
# General informations / detection

RendererName=Freecom MusicPal
RendererIcon=musicpal.png

#UserAgent: regular expression to detect the connected renderer
UserAgentSearch=pvConnect DLNADOC/1.50

#Basic capabilities
Video=false
Audio=true
Image=false

#------------------------------------------------------------
# DLNA settings

#Use the DLNA feature seek by time and not by range
SeekByTime=false

#------------------------------------------------------------
# Transcoding/Muxing capabilities
#

#Transcode codecs for video and audio engines
#currently supported: MPEGAC3 or WMV for video, PCM or MP3 for audio
TranscodeVideo=MPEGAC3
TranscodeAudio=PCM

#Use default DVD buffer size: false = greater bitrate and faster encoding,
#but can generate incompatible videos, depends of your media renderer
DefaultVBVBufSize=false

#Muxing capabilities: Does the media renderer supports H264 and MPEG2 in a mpegts file ?
MuxH264ToMpegTS=true

#Does the media renderer supports DTS in a mpeg file ?
MuxDTSToMpeg=false

#Does the media renderer supports DTS wrapped into LPCM in a mpeg file ?
WrapDTSIntoPCM=true

#Does the media renderer supports LPCM in a mpeg file ?
MuxLPCMToMpeg=true

#Maximum bitrate supported by the media renderer (0=unlimited)
MaxVideoBitrateMbps=0

#Max Width and Height supported by the media renderer (0=unlimited)
MaxVideoWidth=0
MaxVideoHeight=0

#Does the media renderer supports only H264 L4.1 at most ?
H264Level41Limited=true

#Does music files need to be resampled at 44.1kHz?
TranscodeAudioTo441kHz=false

#Does the client need to receive transcoded video with minimal delay ? (Useful when the client has a small timeout delay)
TranscodeFastStart=false

#Size of the transcoded file (unknown length) sent to the renderer (could determine browsing failure/success)
#Possible values:
# -1: Specific value working with the PS3, means perfect transcoding and copying support (it's against the dlna spec though)
# 0: size attribute is NOT sent to the renderer (defaut value if this parameter isn't used)
# 100000000000: 100Gb, if you want to be sure that the media file is not cutted before the end ?
TranscodedVideoFileSize=-1

#------------------------------------------------------------
# Misc Files

# Mime types transforms (oldmime=newmime|olemime2=newmime2|...)
MimeTypesChanges=video/avi=video/x-divx

# Extensions management: no need to put something here, as the server's default configuration is tuned for ps3
# What extensions are forcefully transcoded
TranscodeExtensions=
# What extensions are forcefully streamed as is (and not transcoded)
StreamExtensions=
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 562fdb8

Please sign in to comment.