Because LPCM is more generic than WAV (is required by DLNA standard) it should be default for audio transcoding. For non DLNA renderes, that supports WAV, not LPCM
TranscodeAudio=WAV
could be set.
This patch fix issue 457 http://code.google.com/p/ps3mediaserver/issues/detail?id=457, and some problems with other renderers (like Samsung)
- Code: Select all
Index: net/pms/configuration/RendererConfiguration.java
===================================================================
--- net/pms/configuration/RendererConfiguration.java (wersja 470)
+++ net/pms/configuration/RendererConfiguration.java (kopia robocza)
@@ -265,7 +265,8 @@
public static final String MPEGTSAC3 = "MPEGTSAC3";
public static final String WMV = "WMV";
- public static final String PCM = "PCM";
+ public static final String WAV = "WAV";
+ public static final String LPCM = "LPCM";
public static final String MP3 = "MP3";
private static final String TRANSCODE_AUDIO="TranscodeAudio";
@@ -424,9 +425,13 @@
return getAudioTranscode().startsWith(MP3);
}
- public boolean isTranscodeToPCM() {
- return getAudioTranscode().startsWith(PCM);
+ public boolean isTranscodeToLPCM() {
+ return getAudioTranscode().startsWith(LPCM);
}
+
+ public boolean isTranscodeToWAV() {
+ return getAudioTranscode().startsWith(WAV);
+ }
public boolean isTranscodeAudioTo441() {
return getBoolean(TRANSCODE_AUDIO_441KHZ, false);
@@ -447,14 +452,18 @@
public String getMimeType(String mimetype) {
if (isMediaParserV2()) {
if (mimetype != null && mimetype.equals(HTTPResource.VIDEO_TRANSCODE)) {
- if (isTranscodeToMPEGPSAC3())
- mimetype = getFormatConfiguration().match(FormatConfiguration.MPEGPS, FormatConfiguration.MPEG2, FormatConfiguration.AC3);
- else if (isTranscodeToMPEGTSAC3())
+ mimetype = getFormatConfiguration().match(FormatConfiguration.MPEGPS, FormatConfiguration.MPEG2, FormatConfiguration.AC3);
+ if (isTranscodeToMPEGTSAC3())
mimetype = getFormatConfiguration().match(FormatConfiguration.MPEGTS, FormatConfiguration.MPEG2, FormatConfiguration.AC3);
else if (isTranscodeToWMV())
mimetype = getFormatConfiguration().match(FormatConfiguration.WMV, FormatConfiguration.WMV, FormatConfiguration.WMA);
} else if (mimetype != null && mimetype.equals(HTTPResource.AUDIO_TRANSCODE)) {
- if (isTranscodeToPCM())
+ mimetype = getFormatConfiguration().match(FormatConfiguration.LPCM, null, null);
+ if (isTranscodeAudioTo441())
+ mimetype += ";rate=44100;channels=2";
+ else
+ mimetype += ";rate=48000;channels=2";
+ if (isTranscodeToWAV())
mimetype = getFormatConfiguration().match(FormatConfiguration.WAV, null, null);
else if (isTranscodeToMP3())
mimetype = getFormatConfiguration().match(FormatConfiguration.MP3, null, null);
@@ -466,9 +475,15 @@
if (isTranscodeToWMV())
mimetype = HTTPResource.WMV_TYPEMIME;
} else if (mimetype != null && mimetype.equals(HTTPResource.AUDIO_TRANSCODE)) {
- mimetype = HTTPResource.AUDIO_WAV_TYPEMIME;
+ mimetype = HTTPResource.AUDIO_LPCM_TYPEMIME;
+ if (isTranscodeAudioTo441())
+ mimetype += ";rate=44100;channels=2";
+ else
+ mimetype += ";rate=48000;channels=2";
if (isTranscodeToMP3())
mimetype = HTTPResource.AUDIO_MP3_TYPEMIME;
+ if (isTranscodeToWAV())
+ mimetype = HTTPResource.AUDIO_WAV_TYPEMIME;
}
if (mimes.containsKey(mimetype)) {
return mimes.get(mimetype);
@@ -583,7 +598,7 @@
else if (FormatConfiguration.MP3.equals(audioTranscoder))
return MP3;
}*/
- return getString(TRANSCODE_AUDIO, PCM);
+ return getString(TRANSCODE_AUDIO, LPCM);
}
public boolean isDefaultVBVSize() {
Index: net/pms/dlna/DLNAResource.java
===================================================================
--- net/pms/dlna/DLNAResource.java (wersja 470)
+++ net/pms/dlna/DLNAResource.java (kopia robocza)
@@ -898,7 +898,7 @@
dlnaspec = "DLNA.ORG_PN=JPEG_LRG";
else if (mime.equals("audio/mpeg"))
dlnaspec = "DLNA.ORG_PN=MP3";
- else if (mime.equals("audio/L16") || mime.equals("audio/wav"))
+ else if (mime.substring(0,9).equals("audio/L16") || mime.equals("audio/wav"))
dlnaspec = "DLNA.ORG_PN=LPCM";
}
Index: net/pms/encoders/FFMpegAudio.java
===================================================================
--- net/pms/encoders/FFMpegAudio.java (wersja 470)
+++ net/pms/encoders/FFMpegAudio.java (kopia robocza)
@@ -116,7 +116,7 @@
/*if (overridenArgs != null)
return overridenArgs;
else*/
- return new String [] { "-f", "wav", "-ar", "48000"}; //$NON-NLS-1$ //$NON-NLS-2$
+ return new String [] { "-f", "s16be", "-ar", "48000"}; //$NON-NLS-1$ //$NON-NLS-2$
}
@Override
@@ -138,6 +138,9 @@
if (params.mediaRenderer.isTranscodeToMP3()) {
args = new String [] { "-f", "mp3", "-ar", "48000", "-ab", "320000" };
}
+ if (params.mediaRenderer.isTranscodeToWAV()) {
+ args = new String [] { "-f", "wav", "-ar", "48000"};
+ }
if (params.mediaRenderer.isTranscodeAudioTo441())
args[3] = "44100";
if (!configuration.isAudioResample()) {
Index: net/pms/encoders/MPlayerAudio.java
===================================================================
--- net/pms/encoders/MPlayerAudio.java (wersja 470)
+++ net/pms/encoders/MPlayerAudio.java (kopia robocza)
@@ -90,7 +90,10 @@
params.maxBufferSize = PMS.getConfiguration().getMaxAudioBuffer();
PipeProcess audioP = new PipeProcess("mplayer_aud" + System.currentTimeMillis()); //$NON-NLS-1$
- String mPlayerdefaultAudioArgs [] = new String [] { PMS.getConfiguration().getMplayerPath(), fileName, "-prefer-ipv4", "-nocache", "-af", "channels=2", "-srate", "48000", "-vo", "null", "-ao", "pcm:waveheader:fast:file=" + audioP.getInputPipe(), "-quiet" }; //$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$
+ String mPlayerdefaultAudioArgs [] = new String [] { PMS.getConfiguration().getMplayerPath(), fileName, "-prefer-ipv4", "-nocache", "-af", "channels=2", "-srate", "48000", "-vo", "null", "-ao", "pcm:nowaveheader:fast:file=" + audioP.getInputPipe(), "-format", "s16be" }; //$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$
+ if (params.mediaRenderer.isTranscodeToWAV()) {
+ mPlayerdefaultAudioArgs[11] = "pcm:waveheader:fast:file=" + audioP.getInputPipe();
+ }
if (params.mediaRenderer.isTranscodeAudioTo441())
mPlayerdefaultAudioArgs[7] = "44100";
if (!configuration.isAudioResample()) {
Index: net/pms/network/HTTPResource.java
===================================================================
--- net/pms/network/HTTPResource.java (wersja 470)
+++ net/pms/network/HTTPResource.java (kopia robocza)
@@ -49,6 +49,7 @@
public static final String AUDIO_WMA_TYPEMIME = "audio/x-ms-wma";
public static final String AUDIO_FLAC_TYPEMIME = "audio/x-flac";
public static final String AUDIO_OGG_TYPEMIME = "audio/x-ogg";
+ public static final String AUDIO_LPCM_TYPEMIME = "audio/L16";
public static final String MPEG_TYPEMIME = "video/mpeg";
public static final String MP4_TYPEMIME = "video/mp4";
Index: renderers/Bravia4500.conf
===================================================================
--- renderers/Bravia4500.conf (wersja 470)
+++ renderers/Bravia4500.conf (kopia robocza)
@@ -11,7 +11,7 @@
Image=true
SeekByTime=false
TranscodeVideo=MPEGAC3
-TranscodeAudio=MP3
+TranscodeAudio=LPCM
DefaultVBVBufSize=true
MuxH264ToMpegTS=true
MuxDTSToMpeg=true
Index: renderers/Bravia5500.conf
===================================================================
--- renderers/Bravia5500.conf (wersja 470)
+++ renderers/Bravia5500.conf (kopia robocza)
@@ -11,7 +11,7 @@
Image=true
SeekByTime=true
TranscodeVideo=MPEGAC3
-TranscodeAudio=MP3
+TranscodeAudio=LPCM
DefaultVBVBufSize=true
MuxH264ToMpegTS=true
MuxDTSToMpeg=false
@@ -21,16 +21,16 @@
MaxVideoWidth=0
MaxVideoHeight=0
H264Level41Limited=true
-MimeTypesChanges=audio/wav=audio/L16|video/mp4=video/mpeg
+#MimeTypesChanges=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=
-
#Better/faster codec detection method ! true to enable it
#Need testing !
-MediaInfo=false
-Supported = f:mpegps|mpegts v:mpeg2|mp4|h264 a:ac3|lpcm|aac|mpa m:video/mpeg
+MediaInfo=true
+# temporary removed lpcm
+Supported = f:mpegps|mpegts v:mpeg2|h264 a:ac3|aac|mpa m:video/mpeg
Supported = f:mp3 m:audio/mpeg
-Supported = f:wav m:audio/L16
+Supported = f:lpcm m:audio/L16
Supported = f:jpg m:image/jpeg
\ No newline at end of file
Index: renderers/BraviaEX.conf
===================================================================
--- renderers/BraviaEX.conf (wersja 470)
+++ renderers/BraviaEX.conf (kopia robocza)
@@ -11,7 +11,7 @@
Image=true
SeekByTime=true
TranscodeVideo=MPEGAC3
-TranscodeAudio=MP3
+TranscodeAudio=LPCM
DefaultVBVBufSize=true
MuxH264ToMpegTS=true
MuxDTSToMpeg=false
Index: renderers/FreeboxHD.conf
===================================================================
--- renderers/FreeboxHD.conf (wersja 470)
+++ renderers/FreeboxHD.conf (kopia robocza)
@@ -12,7 +12,7 @@
TranscodeVideo=MPEGTSAC3
MimeTypesChanges=video/mpeg=video/mp2t
UseSameExtension=ts
-TranscodeAudio=PCM
+TranscodeAudio=WAV
DefaultVBVBufSize=true
MuxH264ToMpegTS=true
MuxDTSToMpeg=false
Index: renderers/FreecomMusicPal.conf
===================================================================
--- renderers/FreecomMusicPal.conf (wersja 470)
+++ renderers/FreecomMusicPal.conf (kopia robocza)
@@ -27,9 +27,9 @@
#
#Transcode codecs for video and audio engines
-#currently supported: MPEGAC3 or WMV for video, PCM or MP3 for audio
+#currently supported: MPEGAC3 or WMV for video, LPCM, WAV or MP3 for audio
TranscodeVideo=MPEGAC3
-TranscodeAudio=PCM
+TranscodeAudio=WAV
#Use default DVD buffer size: false = greater bitrate and faster encoding,
#but can generate incompatible videos, depends of your media renderer
Index: renderers/PS3.conf
===================================================================
--- renderers/PS3.conf (wersja 470)
+++ renderers/PS3.conf (kopia robocza)
@@ -35,9 +35,9 @@
#
#Transcode codecs for video and audio engines
-#currently supported: MPEGAC3, MPEGTSAC3 or WMV for video, PCM or MP3 for audio
+#currently supported: MPEGAC3, MPEGTSAC3 or WMV for video, LPCM, WAV or MP3 for audio
TranscodeVideo=MPEGAC3
-TranscodeAudio=PCM
+TranscodeAudio=WAV
#Use default DVD buffer size: false = greater bitrate and faster encoding,
#but can generate incompatible videos, depends of your media renderer
Index: renderers/Philips.conf
===================================================================
--- renderers/Philips.conf (wersja 470)
+++ renderers/Philips.conf (kopia robocza)
@@ -30,9 +30,9 @@
## Transcoding/Muxing capabilities
##Transcode codecs for video and audio engines #
-##currently supported: MPEGAC3 or WMV for video, PCM or MP3 for audio
+##currently supported: MPEGAC3 or WMV for video, LPCM, WAV or MP3 for audio
TranscodeVideo=MPEGAC3
-TranscodeAudio=PCM
+TranscodeAudio=LPCM
## TranscodeAudio=MP3
##Use default DVD buffer size: false = greater bitrate and faster encoding,
Index: renderers/PopcornHour.conf
===================================================================
--- renderers/PopcornHour.conf (wersja 470)
+++ renderers/PopcornHour.conf (kopia robocza)
@@ -9,7 +9,7 @@
Image=true
SeekByTime=false
TranscodeVideo=MPEGAC3
-TranscodeAudio=PCM
+TranscodeAudio=LPCM
DefaultVBVBufSize=true
MuxH264ToMpegTS=true
MuxDTSToMpeg=true
Index: renderers/Realtek.conf
===================================================================
--- renderers/Realtek.conf (wersja 470)
+++ renderers/Realtek.conf (kopia robocza)
@@ -36,9 +36,9 @@
#
#Transcode codecs for video and audio engines
-#currently supported: MPEGAC3 or WMV for video, PCM or MP3 for audio
+#currently supported: MPEGAC3 or WMV for video, LPCM, WAV or MP3 for audio
TranscodeVideo=MPEGAC3
-TranscodeAudio=PCM
+TranscodeAudio=LPCM
#Use default DVD buffer size: false = greater bitrate and faster encoding,
#but can generate incompatible videos, depends of your media renderer
Index: renderers/Samsung.conf
===================================================================
--- renderers/Samsung.conf (wersja 470)
+++ renderers/Samsung.conf (kopia robocza)
@@ -9,7 +9,7 @@
Image=true
SeekByTime=false
TranscodeVideo=MPEGAC3
-TranscodeAudio=PCM
+TranscodeAudio=LPCM
DefaultVBVBufSize=true
MuxH264ToMpegTS=true
MuxDTSToMpeg=true
Index: renderers/Streamium.conf
===================================================================
--- renderers/Streamium.conf (wersja 470)
+++ renderers/Streamium.conf (kopia robocza)
@@ -28,9 +28,9 @@
#
#Transcode codecs for video and audio engines
-#currently supported: MPEGAC3 or WMV for video, PCM or MP3 for audio
+#currently supported: MPEGAC3 or WMV for video, LPCM, WAV or MP3 for audio
TranscodeVideo=MPEGAC3
-TranscodeAudio=PCM
+TranscodeAudio=WAV
#Use default DVD buffer size: false = greater bitrate and faster encoding,
#but can generate incompatible videos, depends of your media renderer
Index: renderers/WDTVLive.conf
===================================================================
--- renderers/WDTVLive.conf (wersja 470)
+++ renderers/WDTVLive.conf (kopia robocza)
@@ -9,7 +9,7 @@
Image=true
SeekByTime=false
TranscodeVideo=MPEGAC3
-TranscodeAudio=PCM
+TranscodeAudio=WAV
DefaultVBVBufSize=false
MuxH264ToMpegTS=false
MuxDTSToMpeg=true
Index: renderers/XBMC.conf
===================================================================
--- renderers/XBMC.conf (wersja 470)
+++ renderers/XBMC.conf (kopia robocza)
@@ -9,7 +9,7 @@
Image=true
SeekByTime=false
TranscodeVideo=MPEGAC3
-TranscodeAudio=PCM
+TranscodeAudio=WAV
DefaultVBVBufSize=true
MuxH264ToMpegTS=true
MuxDTSToMpeg=true
