Browse Source

PlayerComponent: normalize pcm codec names for web

Web-client wants a single "pcm" codec, instead of all sub-variants like
"pcm_s16le".

On the other hand, not all codecs that start with "pcm_" are in this
category. Exclude them explicitly (listing the exceptions is much
shorter than listing the "pcm" variants).
Vincent Lang 9 years ago
parent
commit
bb51947772
1 changed files with 12 additions and 1 deletions
  1. 12 1
      src/player/PlayerComponent.cpp

+ 12 - 1
src/player/PlayerComponent.cpp

@@ -996,11 +996,22 @@ QList<CodecDriver> PlayerComponent::installedCodecDrivers()
 QStringList PlayerComponent::installedDecoderCodecs()
 {
   QStringList formats;
+  bool has_pcm = false;
 
   for (auto driver : installedCodecDrivers())
   {
     if (driver.type == CodecType::Decoder && checkCodecSupport(driver.format))
-      formats.append(Codecs::plexNameFromFF(driver.format));
+    {
+      QString name = Codecs::plexNameFromFF(driver.format);
+      if (name.startsWith("pcm_") && name != "pcm_bluray" && name != "pcm_dvd")
+      {
+        if (has_pcm)
+          continue;
+        has_pcm = true;
+        name = "pcm";
+      }
+      formats.append(name);
+    }
   }
 
   return formats;