Ver código fonte

update param encoding

Luke Pulverenti 7 anos atrás
pai
commit
a0d82a02c8

+ 0 - 2
Emby.Server.Implementations/Emby.Server.Implementations.csproj

@@ -427,8 +427,6 @@
     <Compile Include="LiveTv\TunerHosts\HdHomerun\HdHomerunUdpStream.cs" />
     <Compile Include="LiveTv\TunerHosts\HdHomerun\HdHomerunUdpStream.cs" />
     <Compile Include="LiveTv\TunerHosts\M3uParser.cs" />
     <Compile Include="LiveTv\TunerHosts\M3uParser.cs" />
     <Compile Include="LiveTv\TunerHosts\M3UTunerHost.cs" />
     <Compile Include="LiveTv\TunerHosts\M3UTunerHost.cs" />
-    <Compile Include="LiveTv\TunerHosts\MulticastStream.cs" />
-    <Compile Include="LiveTv\TunerHosts\QueueStream.cs" />
     <Compile Include="Localization\LocalizationManager.cs" />
     <Compile Include="Localization\LocalizationManager.cs" />
     <Compile Include="Localization\TextLocalizer.cs" />
     <Compile Include="Localization\TextLocalizer.cs" />
     <Compile Include="Logging\ConsoleLogger.cs" />
     <Compile Include="Logging\ConsoleLogger.cs" />

+ 6 - 0
Emby.Server.Implementations/HttpServer/HttpListenerHost.cs

@@ -731,6 +731,12 @@ namespace Emby.Server.Implementations.HttpServer
 
 
         public object DeserializeJson(Type type, Stream stream)
         public object DeserializeJson(Type type, Stream stream)
         {
         {
+            //using (var reader = new StreamReader(stream))
+            //{
+            //    var json = reader.ReadToEnd();
+            //    Logger.Info(json);
+            //    return _jsonSerializer.DeserializeFromString(json, type);
+            //}
             return _jsonSerializer.DeserializeFromStream(stream, type);
             return _jsonSerializer.DeserializeFromStream(stream, type);
         }
         }
 
 

+ 3 - 2
Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHttpStream.cs

@@ -39,7 +39,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
             _tempFilePath = Path.Combine(appPaths.TranscodingTempPath, UniqueId + ".ts");
             _tempFilePath = Path.Combine(appPaths.TranscodingTempPath, UniqueId + ".ts");
         }
         }
 
 
-        protected override async Task OpenInternal(CancellationToken openCancellationToken)
+        protected override  Task OpenInternal(CancellationToken openCancellationToken)
         {
         {
             _liveStreamCancellationTokenSource.Token.ThrowIfCancellationRequested();
             _liveStreamCancellationTokenSource.Token.ThrowIfCancellationRequested();
 
 
@@ -66,7 +66,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
             //OpenedMediaSource.SupportsDirectStream = true;
             //OpenedMediaSource.SupportsDirectStream = true;
             //OpenedMediaSource.SupportsTranscoding = true;
             //OpenedMediaSource.SupportsTranscoding = true;
 
 
-            await taskCompletionSource.Task.ConfigureAwait(false);
+            return taskCompletionSource.Task;
 
 
             //await Task.Delay(5000).ConfigureAwait(false);
             //await Task.Delay(5000).ConfigureAwait(false);
         }
         }
@@ -160,6 +160,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
                 while (!cancellationToken.IsCancellationRequested)
                 while (!cancellationToken.IsCancellationRequested)
                 {
                 {
                     StreamHelper.CopyTo(inputStream, stream, 81920, cancellationToken);
                     StreamHelper.CopyTo(inputStream, stream, 81920, cancellationToken);
+                    //await inputStream.CopyToAsync(stream, 81920, cancellationToken).ConfigureAwait(false);
 
 
                     //var position = fs.Position;
                     //var position = fs.Position;
                     //_logger.Debug("Streamed {0} bytes to position {1} from file {2}", bytesRead, position, path);
                     //_logger.Debug("Streamed {0} bytes to position {1} from file {2}", bytesRead, position, path);

+ 0 - 81
Emby.Server.Implementations/LiveTv/TunerHosts/MulticastStream.cs

@@ -1,81 +0,0 @@
-using System;
-using System.Collections.Concurrent;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Text;
-using System.Threading;
-using System.Threading.Tasks;
-using MediaBrowser.Model.Logging;
-using MediaBrowser.Model.Net;
-
-namespace Emby.Server.Implementations.LiveTv.TunerHosts
-{
-    public class MulticastStream
-    {
-        private readonly ConcurrentDictionary<Guid, QueueStream> _outputStreams = new ConcurrentDictionary<Guid, QueueStream>();
-        private const int BufferSize = 81920;
-        private readonly ILogger _logger;
-
-        public MulticastStream(ILogger logger)
-        {
-            _logger = logger;
-        }
-
-        public async Task CopyUntilCancelled(Stream source, Action onStarted, CancellationToken cancellationToken)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException("source");
-            }
-
-            while (true)
-            {
-                cancellationToken.ThrowIfCancellationRequested();
-
-                byte[] buffer = new byte[BufferSize];
-
-                var bytesRead = source.Read(buffer, 0, buffer.Length);
-
-                if (bytesRead > 0)
-                {
-                    foreach (var stream in _outputStreams)
-                    {
-                        stream.Value.Queue(buffer, 0, bytesRead);
-                    }
-
-                    if (onStarted != null)
-                    {
-                        var onStartedCopy = onStarted;
-                        onStarted = null;
-                        Task.Run(onStartedCopy);
-                    }
-                }
-
-                else
-                {
-                    await Task.Delay(100).ConfigureAwait(false);
-                }
-            }
-        }
-
-        public Task CopyToAsync(Stream stream, CancellationToken cancellationToken)
-        {
-            var queueStream = new QueueStream(stream, _logger);
-
-            _outputStreams.TryAdd(queueStream.Id, queueStream);
-
-            try
-            {
-                queueStream.Start(cancellationToken);
-            }
-            finally
-            {
-                _outputStreams.TryRemove(queueStream.Id, out queueStream);
-                GC.Collect();
-            }
-
-            return Task.FromResult(true);
-        }
-    }
-}

+ 0 - 45
Emby.Server.Implementations/LiveTv/TunerHosts/QueueStream.cs

@@ -1,45 +0,0 @@
-using System;
-using System.Collections.Concurrent;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Text;
-using System.Threading;
-using System.Threading.Tasks;
-using MediaBrowser.Model.Logging;
-
-namespace Emby.Server.Implementations.LiveTv.TunerHosts
-{
-    public class QueueStream
-    {
-        private readonly Stream _outputStream;
-        private readonly BlockingCollection<Tuple<byte[], int, int>> _queue = new BlockingCollection<Tuple<byte[], int, int>>();
-
-        private readonly ILogger _logger;
-        public Guid Id = Guid.NewGuid();
-
-        public QueueStream(Stream outputStream, ILogger logger)
-        {
-            _outputStream = outputStream;
-            _logger = logger;
-        }
-
-        public void Queue(byte[] bytes, int offset, int count)
-        {
-            _queue.Add(new Tuple<byte[], int, int>(bytes, offset, count));
-        }
-
-        public void Start(CancellationToken cancellationToken)
-        {
-            while (true)
-            {
-                foreach (var result in _queue.GetConsumingEnumerable())
-                {
-                    cancellationToken.ThrowIfCancellationRequested();
-
-                    _outputStream.Write(result.Item1, result.Item2, result.Item3);
-                }
-            }
-        }
-    }
-}

+ 3 - 1
MediaBrowser.Model/Dlna/StreamInfo.cs

@@ -169,7 +169,9 @@ namespace MediaBrowser.Model.Dlna
                     continue;
                     continue;
                 }
                 }
 
 
-                list.Add(string.Format("{0}={1}", pair.Name, pair.Value));
+                var encodedValue = pair.Value.Replace(" ", "%20");
+
+                list.Add(string.Format("{0}={1}", pair.Name, encodedValue));
             }
             }
 
 
             string queryString = string.Join("&", list.ToArray(list.Count));
             string queryString = string.Join("&", list.ToArray(list.Count));

+ 1 - 1
SharedVersion.cs

@@ -1,3 +1,3 @@
 using System.Reflection;
 using System.Reflection;
 
 
-[assembly: AssemblyVersion("3.2.32.7")]
+[assembly: AssemblyVersion("3.2.32.8")]