瀏覽代碼

fix dlna flag values

Luke Pulverenti 11 年之前
父節點
當前提交
73b771f9c5
共有 2 個文件被更改,包括 14 次插入2 次删除
  1. 8 2
      MediaBrowser.Model/Dlna/ContentFeatureBuilder.cs
  2. 6 0
      MediaBrowser.Model/Dlna/Filter.cs

+ 8 - 2
MediaBrowser.Model/Dlna/ContentFeatureBuilder.cs

@@ -39,8 +39,8 @@ namespace MediaBrowser.Model.Dlna
                 //flagValue = flagValue | DlnaFlags.DLNA_ORG_FLAG_TIME_BASED_SEEK;
                 //flagValue = flagValue | DlnaFlags.DLNA_ORG_FLAG_TIME_BASED_SEEK;
             }
             }
 
 
-            var dlnaflags = string.Format(";DLNA.ORG_FLAGS={0}000000000000000000000000",
-             Enum.Format(typeof(DlnaFlags), flagValue, "x"));
+            var dlnaflags = string.Format(";DLNA.ORG_FLAGS={0}",
+             FlagsToString(flagValue));
 
 
             var mediaProfile = _profile.GetAudioMediaProfile(container, audioCodec);
             var mediaProfile = _profile.GetAudioMediaProfile(container, audioCodec);
 
 
@@ -56,6 +56,12 @@ namespace MediaBrowser.Model.Dlna
             return (contentFeatures + orgOp + orgCi + dlnaflags).Trim(';');
             return (contentFeatures + orgOp + orgCi + dlnaflags).Trim(';');
         }
         }
 
 
+        private static string FlagsToString(DlnaFlags flags)
+        {
+            //return Enum.Format(typeof(DlnaFlags), flags, "x");
+            return string.Format("{0:X8}{1:D24}", (ulong)flags, 0);
+        }
+
         public string BuildVideoHeader(string container, 
         public string BuildVideoHeader(string container, 
             string videoCodec, 
             string videoCodec, 
             string audioCodec, 
             string audioCodec, 

+ 6 - 0
MediaBrowser.Model/Dlna/Filter.cs

@@ -9,6 +9,12 @@ namespace MediaBrowser.Model.Dlna
         private readonly List<string> _fields;
         private readonly List<string> _fields;
         private readonly bool _all;
         private readonly bool _all;
 
 
+        public Filter()
+            : this("*")
+        {
+
+        }
+
         public Filter(string filter)
         public Filter(string filter)
         {
         {
             _all = string.Equals(filter, "*", StringComparison.OrdinalIgnoreCase);
             _all = string.Equals(filter, "*", StringComparison.OrdinalIgnoreCase);