Merge pull request #8 from jellyfin/master

rebase to latest master
This commit is contained in:
LogicalPhallacy 2019-01-23 00:31:35 -08:00 committed by GitHub
commit 404bd04cbc
1813 changed files with 18620 additions and 35291 deletions

View file

@ -1,5 +1,10 @@
.git .git
.dockerignore .dockerignore
Dockerfile Dockerfile
Dockerfile.arm
Dockerfile.arm64
CONTRIBUTORS.md CONTRIBUTORS.md
README.md README.md
deployment/*/dist
deployment/*/pkg-dist
deployment/collect-dist/

View file

@ -9,4 +9,4 @@ steps:
- name: build - name: build
image: microsoft/dotnet:2-sdk image: microsoft/dotnet:2-sdk
commands: commands:
- dotnet publish --configuration release --output /release - dotnet publish --configuration release --output /release Jellyfin.Server

131
.editorconfig Normal file
View file

@ -0,0 +1,131 @@
# With more recent updates Visual Studio 2017 supports EditorConfig files out of the box
# Visual Studio Code needs an extension: https://github.com/editorconfig/editorconfig-vscode
# For emacs, vim, np++ and other editors, see here: https://github.com/editorconfig
###############################
# Core EditorConfig Options #
###############################
root = true
# All files
[*]
indent_style = space
indent_size = 4
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
end_of_line = lf
max_line_length = null
# XML indentation
[*.{csproj,xml}]
indent_size = 2
###############################
# .NET Coding Conventions #
###############################
[*.{cs,vb}]
# Organize usings
dotnet_sort_system_directives_first = true
# this. preferences
dotnet_style_qualification_for_field = false:silent
dotnet_style_qualification_for_property = false:silent
dotnet_style_qualification_for_method = false:silent
dotnet_style_qualification_for_event = false:silent
# Language keywords vs BCL types preferences
dotnet_style_predefined_type_for_locals_parameters_members = true:silent
dotnet_style_predefined_type_for_member_access = true:silent
# Parentheses preferences
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent
# Modifier preferences
dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent
dotnet_style_readonly_field = true:suggestion
# Expression-level preferences
dotnet_style_object_initializer = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_explicit_tuple_names = true:suggestion
dotnet_style_null_propagation = true:suggestion
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:silent
dotnet_prefer_inferred_tuple_names = true:suggestion
dotnet_prefer_inferred_anonymous_type_member_names = true:suggestion
dotnet_style_prefer_auto_properties = true:silent
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
dotnet_style_prefer_conditional_expression_over_return = true:silent
###############################
# Naming Conventions #
###############################
# Style Definitions
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
# Use PascalCase for constant fields
dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
dotnet_naming_symbols.constant_fields.applicable_kinds = field
dotnet_naming_symbols.constant_fields.applicable_accessibilities = *
dotnet_naming_symbols.constant_fields.required_modifiers = const
###############################
# C# Coding Conventions #
###############################
[*.cs]
# var preferences
csharp_style_var_for_built_in_types = true:silent
csharp_style_var_when_type_is_apparent = true:silent
csharp_style_var_elsewhere = true:silent
# Expression-bodied members
csharp_style_expression_bodied_methods = false:silent
csharp_style_expression_bodied_constructors = false:silent
csharp_style_expression_bodied_operators = false:silent
csharp_style_expression_bodied_properties = true:silent
csharp_style_expression_bodied_indexers = true:silent
csharp_style_expression_bodied_accessors = true:silent
# Pattern matching preferences
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
# Null-checking preferences
csharp_style_throw_expression = true:suggestion
csharp_style_conditional_delegate_call = true:suggestion
# Modifier preferences
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:suggestion
# Expression-level preferences
csharp_prefer_braces = true:silent
csharp_style_deconstructed_variable_declaration = true:suggestion
csharp_prefer_simple_default_expression = true:suggestion
csharp_style_pattern_local_over_anonymous_function = true:suggestion
csharp_style_inlined_variable_declaration = true:suggestion
###############################
# C# Formatting Rules #
###############################
# New line preferences
csharp_new_line_before_open_brace = all
csharp_new_line_before_else = true
csharp_new_line_before_catch = true
csharp_new_line_before_finally = true
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_members_in_anonymous_types = true
csharp_new_line_between_query_expression_clauses = true
# Indentation preferences
csharp_indent_case_contents = true
csharp_indent_switch_labels = true
csharp_indent_labels = flush_left
# Space preferences
csharp_space_after_cast = false
csharp_space_after_keywords_in_control_flow_statements = true
csharp_space_between_method_call_parameter_list_parentheses = false
csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_parentheses = false
csharp_space_before_colon_in_inheritance_clause = true
csharp_space_after_colon_in_inheritance_clause = true
csharp_space_around_binary_operators = before_and_after
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
csharp_space_between_method_call_name_and_opening_parenthesis = false
csharp_space_between_method_call_empty_parameter_list_parentheses = false
# Wrapping preferences
csharp_preserve_single_line_statements = true
csharp_preserve_single_line_blocks = true
###############################
# VB Coding Conventions #
###############################
[*.vb]
# Modifier preferences
visual_basic_preferred_modifier_order = Partial,Default,Private,Protected,Public,Friend,NotOverridable,Overridable,MustOverride,Overloads,Overrides,MustInherit,NotInheritable,Static,Shared,Shadows,ReadOnly,WriteOnly,Dim,Const,WithEvents,Widening,Narrowing,Custom,Async:suggestion

35
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View file

@ -0,0 +1,35 @@
---
name: Bug report
about: Create a bug report
title: ''
labels: bug
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Logs**
Please paste any log errors.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**System (please complete the following information):**
- OS: [e.g. Docker, Debian, Windows]
- Browser: [e.g. Firefox, Chrome, Safari]
- Jellyfin Version: [e.g. 10.0.1]
**Additional context**
Add any other context about the problem here.

View file

@ -0,0 +1,20 @@
---
name: Enhancement request
about: Suggest an modification to an existing feature
title: ''
labels: enhancement
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

View file

@ -0,0 +1,14 @@
---
name: Feature request
about: Suggest a new feature
title: ''
labels: feature
assignees: ''
---
**Describe the feature you'd like**
A clear and concise description of what you want to happen.
**Additional context**
Add any other context or screenshots about the feature request here.

9
.github/pull_request_template.md vendored Normal file
View file

@ -0,0 +1,9 @@
Ensure your title is short, descriptive, and in the imperative mood (Fix X, Change Y, instead of Fixed X, Changed Y).
For a good inspiration of what to write in commit messages and PRs please review https://chris.beams.io/posts/git-commit/ and our https://jellyfin.readthedocs.io/en/latest/developer-docs/contributing/ page.
**Changes**
Describe your changes here in 1-5 sentences.
**Issues**
Tag any issues that this PR solves here.
Fixes #

35
.gitignore vendored
View file

@ -1,5 +1,3 @@
!*
.directory .directory
################# #################
@ -49,6 +47,8 @@ ProgramData-UI*/
## Ignore Visual Studio temporary files, build results, and ## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons. ## files generated by popular Visual Studio add-ons.
.vs/
# User-specific files # User-specific files
*.suo *.suo
*.user *.user
@ -204,7 +204,6 @@ $RECYCLE.BIN/
# Mac crap # Mac crap
.DS_Store .DS_Store
############# #############
## Python ## Python
############# #############
@ -234,22 +233,34 @@ pip-log.txt
#Mr Developer #Mr Developer
.mr.developer.cfg .mr.developer.cfg
MediaBrowser.WebDashboard/dashboard-ui/.idea/
/.vs
########## ##########
# Rider # Rider
########## ##########
.idea/ .idea/
##########
# Visual Studio Code
##########
.vscode/
######################### #########################
# Debian build artifacts # Build artifacts
######################### #########################
debian/.debhelper/ # Artifacts for debian-x64
debian/files deployment/debian-package-x64/pkg-src/.debhelper/
debian/jellyfin.substvars deployment/debian-package-x64/pkg-src/*.debhelper
debian/jellyfin/ deployment/debian-package-x64/pkg-src/debhelper-build-stamp
deployment/debian-package-x64/pkg-src/files
deployment/debian-package-x64/pkg-src/jellyfin.substvars
deployment/debian-package-x64/pkg-src/jellyfin/
# Don't ignore the debian/bin folder # Don't ignore the debian/bin folder
!debian/bin/ !deployment/debian-package-x64/pkg-src/bin/
deployment/**/dist/
deployment/**/pkg-dist/
deployment/**/pkg-dist-tmp/
deployment/collect-dist/
jellyfin_version.ini

3
.gitmodules vendored
View file

@ -1,3 +1,6 @@
[submodule "ThirdParty/taglib-sharp"] [submodule "ThirdParty/taglib-sharp"]
path = ThirdParty/taglib-sharp path = ThirdParty/taglib-sharp
url = https://github.com/mono/taglib-sharp.git url = https://github.com/mono/taglib-sharp.git
[submodule "MediaBrowser.WebDashboard/jellyfin-web"]
path = MediaBrowser.WebDashboard/jellyfin-web
url = https://github.com/jellyfin/jellyfin-web.git

View file

@ -1,4 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<Compile Include="..\SharedVersion.cs" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\MediaBrowser.Model\MediaBrowser.Model.csproj" /> <ProjectReference Include="..\MediaBrowser.Model\MediaBrowser.Model.csproj" />

View file

@ -1,105 +1,33 @@

namespace BDInfo namespace BDInfo
{ {
class BDInfoSettings class BDInfoSettings
{ {
public static bool GenerateStreamDiagnostics public static bool GenerateStreamDiagnostics => true;
{
get
{
return true;
}
}
public static bool EnableSSIF public static bool EnableSSIF => true;
{
get
{
return true;
}
}
public static bool AutosaveReport public static bool AutosaveReport => false;
{
get
{
return false;
}
}
public static bool GenerateFrameDataFile public static bool GenerateFrameDataFile => false;
{
get
{
return false;
}
}
public static bool FilterLoopingPlaylists public static bool FilterLoopingPlaylists => true;
{
get
{
return true;
}
}
public static bool FilterShortPlaylists public static bool FilterShortPlaylists => false;
{
get
{
return false;
}
}
public static int FilterShortPlaylistsValue public static int FilterShortPlaylistsValue => 0;
{
get
{
return 0;
}
}
public static bool UseImagePrefix public static bool UseImagePrefix => false;
{
get
{
return false;
}
}
public static string UseImagePrefixValue public static string UseImagePrefixValue => null;
{
get
{
return null;
}
}
/// <summary> /// <summary>
/// Setting this to false throws an IComparer error on some discs. /// Setting this to false throws an IComparer error on some discs.
/// </summary> /// </summary>
public static bool KeepStreamOrder public static bool KeepStreamOrder => true;
{
get
{
return true;
}
}
public static bool GenerateTextSummary public static bool GenerateTextSummary => false;
{
get
{
return false;
}
}
public static string LastPath public static string LastPath => string.Empty;
{
get
{
return string.Empty;
}
}
} }
} }

View file

@ -1,4 +1,4 @@
//============================================================================ //============================================================================
// BDInfo - Blu-ray Video and Audio Analysis Tool // BDInfo - Blu-ray Video and Audio Analysis Tool
// Copyright © 2010 Cinema Squid // Copyright © 2010 Cinema Squid
// //
@ -22,7 +22,6 @@ using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using MediaBrowser.Model.IO; using MediaBrowser.Model.IO;
using MediaBrowser.Model.Text;
namespace BDInfo namespace BDInfo
{ {
@ -72,12 +71,11 @@ namespace BDInfo
public event OnPlaylistFileScanError PlaylistFileScanError; public event OnPlaylistFileScanError PlaylistFileScanError;
public BDROM( public BDROM(string path, IFileSystem fileSystem)
string path, IFileSystem fileSystem, ITextEncoding textEncoding)
{ {
if (string.IsNullOrEmpty(path)) if (string.IsNullOrEmpty(path))
{ {
throw new ArgumentNullException("path"); throw new ArgumentNullException(nameof(path));
} }
_fileSystem = fileSystem; _fileSystem = fileSystem;
@ -164,17 +162,17 @@ namespace BDInfo
if (DirectoryPLAYLIST != null) if (DirectoryPLAYLIST != null)
{ {
FileSystemMetadata[] files = GetFiles(DirectoryPLAYLIST.FullName, ".mpls").ToArray(); FileSystemMetadata[] files = GetFiles(DirectoryPLAYLIST.FullName, ".mpls").ToArray();
foreach (FileSystemMetadata file in files) foreach (var file in files)
{ {
PlaylistFiles.Add( PlaylistFiles.Add(
file.Name.ToUpper(), new TSPlaylistFile(this, file, _fileSystem, textEncoding)); file.Name.ToUpper(), new TSPlaylistFile(this, file, _fileSystem));
} }
} }
if (DirectorySTREAM != null) if (DirectorySTREAM != null)
{ {
FileSystemMetadata[] files = GetFiles(DirectorySTREAM.FullName, ".m2ts").ToArray(); FileSystemMetadata[] files = GetFiles(DirectorySTREAM.FullName, ".m2ts").ToArray();
foreach (FileSystemMetadata file in files) foreach (var file in files)
{ {
StreamFiles.Add( StreamFiles.Add(
file.Name.ToUpper(), new TSStreamFile(file, _fileSystem)); file.Name.ToUpper(), new TSStreamFile(file, _fileSystem));
@ -184,17 +182,17 @@ namespace BDInfo
if (DirectoryCLIPINF != null) if (DirectoryCLIPINF != null)
{ {
FileSystemMetadata[] files = GetFiles(DirectoryCLIPINF.FullName, ".clpi").ToArray(); FileSystemMetadata[] files = GetFiles(DirectoryCLIPINF.FullName, ".clpi").ToArray();
foreach (FileSystemMetadata file in files) foreach (var file in files)
{ {
StreamClipFiles.Add( StreamClipFiles.Add(
file.Name.ToUpper(), new TSStreamClipFile(file, _fileSystem, textEncoding)); file.Name.ToUpper(), new TSStreamClipFile(file, _fileSystem));
} }
} }
if (DirectorySSIF != null) if (DirectorySSIF != null)
{ {
FileSystemMetadata[] files = GetFiles(DirectorySSIF.FullName, ".ssif").ToArray(); FileSystemMetadata[] files = GetFiles(DirectorySSIF.FullName, ".ssif").ToArray();
foreach (FileSystemMetadata file in files) foreach (var file in files)
{ {
InterleavedFiles.Add( InterleavedFiles.Add(
file.Name.ToUpper(), new TSInterleavedFile(file)); file.Name.ToUpper(), new TSInterleavedFile(file));
@ -214,8 +212,8 @@ namespace BDInfo
public void Scan() public void Scan()
{ {
List<TSStreamClipFile> errorStreamClipFiles = new List<TSStreamClipFile>(); var errorStreamClipFiles = new List<TSStreamClipFile>();
foreach (TSStreamClipFile streamClipFile in StreamClipFiles.Values) foreach (var streamClipFile in StreamClipFiles.Values)
{ {
try try
{ {
@ -235,11 +233,11 @@ namespace BDInfo
break; break;
} }
} }
else throw ex; else throw;
} }
} }
foreach (TSStreamFile streamFile in StreamFiles.Values) foreach (var streamFile in StreamFiles.Values)
{ {
string ssifName = Path.GetFileNameWithoutExtension(streamFile.Name) + ".SSIF"; string ssifName = Path.GetFileNameWithoutExtension(streamFile.Name) + ".SSIF";
if (InterleavedFiles.ContainsKey(ssifName)) if (InterleavedFiles.ContainsKey(ssifName))
@ -252,8 +250,8 @@ namespace BDInfo
StreamFiles.Values.CopyTo(streamFiles, 0); StreamFiles.Values.CopyTo(streamFiles, 0);
Array.Sort(streamFiles, CompareStreamFiles); Array.Sort(streamFiles, CompareStreamFiles);
List<TSPlaylistFile> errorPlaylistFiles = new List<TSPlaylistFile>(); var errorPlaylistFiles = new List<TSPlaylistFile>();
foreach (TSPlaylistFile playlistFile in PlaylistFiles.Values) foreach (var playlistFile in PlaylistFiles.Values)
{ {
try try
{ {
@ -273,19 +271,19 @@ namespace BDInfo
break; break;
} }
} }
else throw ex; else throw;
} }
} }
List<TSStreamFile> errorStreamFiles = new List<TSStreamFile>(); var errorStreamFiles = new List<TSStreamFile>();
foreach (TSStreamFile streamFile in streamFiles) foreach (var streamFile in streamFiles)
{ {
try try
{ {
List<TSPlaylistFile> playlists = new List<TSPlaylistFile>(); var playlists = new List<TSPlaylistFile>();
foreach (TSPlaylistFile playlist in PlaylistFiles.Values) foreach (var playlist in PlaylistFiles.Values)
{ {
foreach (TSStreamClip streamClip in playlist.StreamClips) foreach (var streamClip in playlist.StreamClips)
{ {
if (streamClip.Name == streamFile.Name) if (streamClip.Name == streamFile.Name)
{ {
@ -310,16 +308,16 @@ namespace BDInfo
break; break;
} }
} }
else throw ex; else throw;
} }
} }
foreach (TSPlaylistFile playlistFile in PlaylistFiles.Values) foreach (var playlistFile in PlaylistFiles.Values)
{ {
playlistFile.Initialize(); playlistFile.Initialize();
if (!Is50Hz) if (!Is50Hz)
{ {
foreach (TSVideoStream videoStream in playlistFile.VideoStreams) foreach (var videoStream in playlistFile.VideoStreams)
{ {
if (videoStream.FrameRate == TSFrameRate.FRAMERATE_25 || if (videoStream.FrameRate == TSFrameRate.FRAMERATE_25 ||
videoStream.FrameRate == TSFrameRate.FRAMERATE_50) videoStream.FrameRate == TSFrameRate.FRAMERATE_50)
@ -336,7 +334,7 @@ namespace BDInfo
{ {
if (string.IsNullOrEmpty(path)) if (string.IsNullOrEmpty(path))
{ {
throw new ArgumentNullException("path"); throw new ArgumentNullException(nameof(path));
} }
FileSystemMetadata dir = _fileSystem.GetDirectoryInfo(path); FileSystemMetadata dir = _fileSystem.GetDirectoryInfo(path);
@ -369,7 +367,7 @@ namespace BDInfo
if (dir != null) if (dir != null)
{ {
FileSystemMetadata[] children = _fileSystem.GetDirectories(dir.FullName).ToArray(); FileSystemMetadata[] children = _fileSystem.GetDirectories(dir.FullName).ToArray();
foreach (FileSystemMetadata child in children) foreach (var child in children)
{ {
if (string.Equals(child.Name, name, StringComparison.OrdinalIgnoreCase)) if (string.Equals(child.Name, name, StringComparison.OrdinalIgnoreCase))
{ {
@ -378,7 +376,7 @@ namespace BDInfo
} }
if (searchDepth > 0) if (searchDepth > 0)
{ {
foreach (FileSystemMetadata child in children) foreach (var child in children)
{ {
GetDirectory( GetDirectory(
name, child, searchDepth - 1); name, child, searchDepth - 1);
@ -395,7 +393,7 @@ namespace BDInfo
//if (!ExcludeDirs.Contains(directoryInfo.Name.ToUpper())) // TODO: Keep? //if (!ExcludeDirs.Contains(directoryInfo.Name.ToUpper())) // TODO: Keep?
{ {
FileSystemMetadata[] pathFiles = _fileSystem.GetFiles(directoryInfo.FullName).ToArray(); FileSystemMetadata[] pathFiles = _fileSystem.GetFiles(directoryInfo.FullName).ToArray();
foreach (FileSystemMetadata pathFile in pathFiles) foreach (var pathFile in pathFiles)
{ {
if (pathFile.Extension.ToUpper() == ".SSIF") if (pathFile.Extension.ToUpper() == ".SSIF")
{ {
@ -405,7 +403,7 @@ namespace BDInfo
} }
FileSystemMetadata[] pathChildren = _fileSystem.GetDirectories(directoryInfo.FullName).ToArray(); FileSystemMetadata[] pathChildren = _fileSystem.GetDirectories(directoryInfo.FullName).ToArray();
foreach (FileSystemMetadata pathChild in pathChildren) foreach (var pathChild in pathChildren)
{ {
size += GetDirectorySize(pathChild); size += GetDirectorySize(pathChild);
} }

View file

@ -1,4 +1,4 @@
//============================================================================ //============================================================================
// BDInfo - Blu-ray Video and Audio Analysis Tool // BDInfo - Blu-ray Video and Audio Analysis Tool
// Copyright © 2010 Cinema Squid // Copyright © 2010 Cinema Squid
// //

View file

@ -1,6 +1,5 @@
using System.Resources;
using System.Reflection; using System.Reflection;
using System.Runtime.CompilerServices; using System.Resources;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following
@ -9,21 +8,14 @@ using System.Runtime.InteropServices;
[assembly: AssemblyTitle("BDInfo")] [assembly: AssemblyTitle("BDInfo")]
[assembly: AssemblyDescription("")] [assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")] [assembly: AssemblyCompany("Jellyfin Project")]
[assembly: AssemblyProduct("BDInfo")] [assembly: AssemblyProduct("Jellyfin: The Free Software Media System")]
[assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyCopyright("Copyright © 2016 CinemaSquid. Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License Version 2")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")] [assembly: NeutralResourcesLanguage("en")]
// Version information for an assembly consists of the following four values: // Setting ComVisible to false makes the types in this assembly not visible
// // to COM components. If you need to access a type in this assembly from
// Major Version // COM, set the ComVisible attribute to true on that type.
// Minor Version [assembly: ComVisible(false)]
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.1")]

View file

@ -1,4 +1,4 @@
The source is taken from the BDRom folder of this project: The source is taken from the BDRom folder of this project:
http://www.cinemasquid.com/blu-ray/tools/bdinfo http://www.cinemasquid.com/blu-ray/tools/bdinfo

View file

@ -1,4 +1,4 @@
//============================================================================ //============================================================================
// BDInfo - Blu-ray Video and Audio Analysis Tool // BDInfo - Blu-ray Video and Audio Analysis Tool
// Copyright © 2010 Cinema Squid // Copyright © 2010 Cinema Squid
// //

View file

@ -1,4 +1,4 @@
//============================================================================ //============================================================================
// BDInfo - Blu-ray Video and Audio Analysis Tool // BDInfo - Blu-ray Video and Audio Analysis Tool
// Copyright © 2010 Cinema Squid // Copyright © 2010 Cinema Squid
// //

View file

@ -1,4 +1,4 @@
//============================================================================ //============================================================================
// BDInfo - Blu-ray Video and Audio Analysis Tool // BDInfo - Blu-ray Video and Audio Analysis Tool
// Copyright © 2010 Cinema Squid // Copyright © 2010 Cinema Squid
// //

View file

@ -1,4 +1,4 @@
//============================================================================ //============================================================================
// BDInfo - Blu-ray Video and Audio Analysis Tool // BDInfo - Blu-ray Video and Audio Analysis Tool
// Copyright © 2010 Cinema Squid // Copyright © 2010 Cinema Squid
// //
@ -211,7 +211,7 @@ namespace BDInfo
// TODO // TODO
if (stream.CoreStream != null) if (stream.CoreStream != null)
{ {
TSAudioStream coreStream = (TSAudioStream)stream.CoreStream; var coreStream = (TSAudioStream)stream.CoreStream;
if (coreStream.AudioMode == TSAudioMode.Extended && if (coreStream.AudioMode == TSAudioMode.Extended &&
stream.ChannelCount == 5) stream.ChannelCount == 5)
{ {

View file

@ -1,4 +1,4 @@
//============================================================================ //============================================================================
// BDInfo - Blu-ray Video and Audio Analysis Tool // BDInfo - Blu-ray Video and Audio Analysis Tool
// Copyright © 2010 Cinema Squid // Copyright © 2010 Cinema Squid
// //

View file

@ -1,4 +1,4 @@
//============================================================================ //============================================================================
// BDInfo - Blu-ray Video and Audio Analysis Tool // BDInfo - Blu-ray Video and Audio Analysis Tool
// Copyright © 2010 Cinema Squid // Copyright © 2010 Cinema Squid
// //

View file

@ -1,4 +1,4 @@
//============================================================================ //============================================================================
// BDInfo - Blu-ray Video and Audio Analysis Tool // BDInfo - Blu-ray Video and Audio Analysis Tool
// Copyright © 2010 Cinema Squid // Copyright © 2010 Cinema Squid
// //

View file

@ -1,4 +1,4 @@
//============================================================================ //============================================================================
// BDInfo - Blu-ray Video and Audio Analysis Tool // BDInfo - Blu-ray Video and Audio Analysis Tool
// Copyright © 2010 Cinema Squid // Copyright © 2010 Cinema Squid
// //

View file

@ -1,4 +1,4 @@
//============================================================================ //============================================================================
// BDInfo - Blu-ray Video and Audio Analysis Tool // BDInfo - Blu-ray Video and Audio Analysis Tool
// Copyright © 2010 Cinema Squid // Copyright © 2010 Cinema Squid
// //

View file

@ -1,4 +1,4 @@
//============================================================================ //============================================================================
// BDInfo - Blu-ray Video and Audio Analysis Tool // BDInfo - Blu-ray Video and Audio Analysis Tool
// Copyright © 2010 Cinema Squid // Copyright © 2010 Cinema Squid
// //
@ -17,7 +17,6 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//============================================================================= //=============================================================================
using System.IO;
using MediaBrowser.Model.IO; using MediaBrowser.Model.IO;
// TODO: Do more interesting things here... // TODO: Do more interesting things here...

View file

@ -23,14 +23,12 @@ using System.Collections.Generic;
using System.IO; using System.IO;
using System.Text; using System.Text;
using MediaBrowser.Model.IO; using MediaBrowser.Model.IO;
using MediaBrowser.Model.Text;
namespace BDInfo namespace BDInfo
{ {
public class TSPlaylistFile public class TSPlaylistFile
{ {
private readonly IFileSystem _fileSystem; private readonly IFileSystem _fileSystem;
private readonly ITextEncoding _textEncoding;
private FileSystemMetadata FileInfo = null; private FileSystemMetadata FileInfo = null;
public string FileType = null; public string FileType = null;
public bool IsInitialized = false; public bool IsInitialized = false;
@ -65,30 +63,26 @@ namespace BDInfo
public List<TSGraphicsStream> GraphicsStreams = public List<TSGraphicsStream> GraphicsStreams =
new List<TSGraphicsStream>(); new List<TSGraphicsStream>();
public TSPlaylistFile( public TSPlaylistFile(BDROM bdrom,
BDROM bdrom, FileSystemMetadata fileInfo, IFileSystem fileSystem)
FileSystemMetadata fileInfo, IFileSystem fileSystem, ITextEncoding textEncoding)
{ {
BDROM = bdrom; BDROM = bdrom;
FileInfo = fileInfo; FileInfo = fileInfo;
_fileSystem = fileSystem; _fileSystem = fileSystem;
_textEncoding = textEncoding;
Name = fileInfo.Name.ToUpper(); Name = fileInfo.Name.ToUpper();
} }
public TSPlaylistFile( public TSPlaylistFile(BDROM bdrom,
BDROM bdrom,
string name, string name,
List<TSStreamClip> clips, IFileSystem fileSystem, ITextEncoding textEncoding) List<TSStreamClip> clips, IFileSystem fileSystem)
{ {
BDROM = bdrom; BDROM = bdrom;
Name = name; Name = name;
_fileSystem = fileSystem; _fileSystem = fileSystem;
_textEncoding = textEncoding;
IsCustom = true; IsCustom = true;
foreach (TSStreamClip clip in clips) foreach (var clip in clips)
{ {
TSStreamClip newClip = new TSStreamClip( var newClip = new TSStreamClip(
clip.StreamFile, clip.StreamClipFile); clip.StreamFile, clip.StreamClipFile);
newClip.Name = clip.Name; newClip.Name = clip.Name;
@ -124,7 +118,7 @@ namespace BDInfo
get get
{ {
ulong size = 0; ulong size = 0;
foreach (TSStreamClip clip in StreamClips) foreach (var clip in StreamClips)
{ {
size += clip.InterleavedFileSize; size += clip.InterleavedFileSize;
} }
@ -136,7 +130,7 @@ namespace BDInfo
get get
{ {
ulong size = 0; ulong size = 0;
foreach (TSStreamClip clip in StreamClips) foreach (var clip in StreamClips)
{ {
size += clip.FileSize; size += clip.FileSize;
} }
@ -148,7 +142,7 @@ namespace BDInfo
get get
{ {
double length = 0; double length = 0;
foreach (TSStreamClip clip in StreamClips) foreach (var clip in StreamClips)
{ {
if (clip.AngleIndex == 0) if (clip.AngleIndex == 0)
{ {
@ -164,7 +158,7 @@ namespace BDInfo
get get
{ {
double length = 0; double length = 0;
foreach (TSStreamClip clip in StreamClips) foreach (var clip in StreamClips)
{ {
length += clip.Length; length += clip.Length;
} }
@ -177,7 +171,7 @@ namespace BDInfo
get get
{ {
ulong size = 0; ulong size = 0;
foreach (TSStreamClip clip in StreamClips) foreach (var clip in StreamClips)
{ {
if (clip.AngleIndex == 0) if (clip.AngleIndex == 0)
{ {
@ -193,7 +187,7 @@ namespace BDInfo
get get
{ {
ulong size = 0; ulong size = 0;
foreach (TSStreamClip clip in StreamClips) foreach (var clip in StreamClips)
{ {
size += clip.PacketSize; size += clip.PacketSize;
} }
@ -264,7 +258,7 @@ namespace BDInfo
int itemCount = ReadInt16(data, ref pos); int itemCount = ReadInt16(data, ref pos);
int subitemCount = ReadInt16(data, ref pos); int subitemCount = ReadInt16(data, ref pos);
List<TSStreamClip> chapterClips = new List<TSStreamClip>(); var chapterClips = new List<TSStreamClip>();
for (int itemIndex = 0; itemIndex < itemCount; itemIndex++) for (int itemIndex = 0; itemIndex < itemCount; itemIndex++)
{ {
int itemStart = pos; int itemStart = pos;
@ -311,7 +305,7 @@ namespace BDInfo
if (outTime < 0) outTime &= 0x7FFFFFFF; if (outTime < 0) outTime &= 0x7FFFFFFF;
double timeOut = (double)outTime / 45000; double timeOut = (double)outTime / 45000;
TSStreamClip streamClip = new TSStreamClip( var streamClip = new TSStreamClip(
streamFile, streamClipFile); streamFile, streamClipFile);
streamClip.Name = streamFileName; //TODO streamClip.Name = streamFileName; //TODO
@ -362,7 +356,7 @@ namespace BDInfo
FileInfo.Name, angleClipFileName)); FileInfo.Name, angleClipFileName));
} }
TSStreamClip angleClip = var angleClip =
new TSStreamClip(angleFile, angleClipFile); new TSStreamClip(angleFile, angleClipFile);
angleClip.AngleIndex = angle + 1; angleClip.AngleIndex = angle + 1;
angleClip.TimeIn = streamClip.TimeIn; angleClip.TimeIn = streamClip.TimeIn;
@ -395,33 +389,33 @@ namespace BDInfo
for (int i = 0; i < streamCountVideo; i++) for (int i = 0; i < streamCountVideo; i++)
{ {
TSStream stream = CreatePlaylistStream(data, ref pos); var stream = CreatePlaylistStream(data, ref pos);
if (stream != null) PlaylistStreams[stream.PID] = stream; if (stream != null) PlaylistStreams[stream.PID] = stream;
} }
for (int i = 0; i < streamCountAudio; i++) for (int i = 0; i < streamCountAudio; i++)
{ {
TSStream stream = CreatePlaylistStream(data, ref pos); var stream = CreatePlaylistStream(data, ref pos);
if (stream != null) PlaylistStreams[stream.PID] = stream; if (stream != null) PlaylistStreams[stream.PID] = stream;
} }
for (int i = 0; i < streamCountPG; i++) for (int i = 0; i < streamCountPG; i++)
{ {
TSStream stream = CreatePlaylistStream(data, ref pos); var stream = CreatePlaylistStream(data, ref pos);
if (stream != null) PlaylistStreams[stream.PID] = stream; if (stream != null) PlaylistStreams[stream.PID] = stream;
} }
for (int i = 0; i < streamCountIG; i++) for (int i = 0; i < streamCountIG; i++)
{ {
TSStream stream = CreatePlaylistStream(data, ref pos); var stream = CreatePlaylistStream(data, ref pos);
if (stream != null) PlaylistStreams[stream.PID] = stream; if (stream != null) PlaylistStreams[stream.PID] = stream;
} }
for (int i = 0; i < streamCountSecondaryAudio; i++) for (int i = 0; i < streamCountSecondaryAudio; i++)
{ {
TSStream stream = CreatePlaylistStream(data, ref pos); var stream = CreatePlaylistStream(data, ref pos);
if (stream != null) PlaylistStreams[stream.PID] = stream; if (stream != null) PlaylistStreams[stream.PID] = stream;
pos += 2; pos += 2;
} }
for (int i = 0; i < streamCountSecondaryVideo; i++) for (int i = 0; i < streamCountSecondaryVideo; i++)
{ {
TSStream stream = CreatePlaylistStream(data, ref pos); var stream = CreatePlaylistStream(data, ref pos);
if (stream != null) PlaylistStreams[stream.PID] = stream; if (stream != null) PlaylistStreams[stream.PID] = stream;
pos += 6; pos += 6;
} }
@ -446,7 +440,7 @@ namespace BDInfo
chapterIndex < chapterCount; chapterIndex < chapterCount;
chapterIndex++) chapterIndex++)
{ {
int chapterType = data[pos+1]; int chapterType = data[pos + 1];
if (chapterType == 1) if (chapterType == 1)
{ {
@ -459,7 +453,7 @@ namespace BDInfo
((long)data[pos + 6] << 8) + ((long)data[pos + 6] << 8) +
((long)data[pos + 7]); ((long)data[pos + 7]);
TSStreamClip streamClip = chapterClips[streamFileIndex]; var streamClip = chapterClips[streamFileIndex];
double chapterSeconds = (double)chapterTime / 45000; double chapterSeconds = (double)chapterTime / 45000;
@ -499,8 +493,8 @@ namespace BDInfo
{ {
LoadStreamClips(); LoadStreamClips();
Dictionary<string, List<double>> clipTimes = new Dictionary<string, List<double>>(); var clipTimes = new Dictionary<string, List<double>>();
foreach (TSStreamClip clip in StreamClips) foreach (var clip in StreamClips)
{ {
if (clip.AngleIndex == 0) if (clip.AngleIndex == 0)
{ {
@ -568,7 +562,7 @@ namespace BDInfo
int streamLength = data[pos++]; int streamLength = data[pos++];
int streamPos = pos; int streamPos = pos;
TSStreamType streamType = (TSStreamType)data[pos++]; var streamType = (TSStreamType)data[pos++];
switch (streamType) switch (streamType)
{ {
case TSStreamType.MVC_VIDEO: case TSStreamType.MVC_VIDEO:
@ -580,11 +574,11 @@ namespace BDInfo
case TSStreamType.MPEG2_VIDEO: case TSStreamType.MPEG2_VIDEO:
case TSStreamType.VC1_VIDEO: case TSStreamType.VC1_VIDEO:
TSVideoFormat videoFormat = (TSVideoFormat) var videoFormat = (TSVideoFormat)
(data[pos] >> 4); (data[pos] >> 4);
TSFrameRate frameRate = (TSFrameRate) var frameRate = (TSFrameRate)
(data[pos] & 0xF); (data[pos] & 0xF);
TSAspectRatio aspectRatio = (TSAspectRatio) var aspectRatio = (TSAspectRatio)
(data[pos + 1] >> 4); (data[pos + 1] >> 4);
stream = new TSVideoStream(); stream = new TSVideoStream();
@ -618,9 +612,9 @@ namespace BDInfo
int audioFormat = ReadByte(data, ref pos); int audioFormat = ReadByte(data, ref pos);
TSChannelLayout channelLayout = (TSChannelLayout) var channelLayout = (TSChannelLayout)
(audioFormat >> 4); (audioFormat >> 4);
TSSampleRate sampleRate = (TSSampleRate) var sampleRate = (TSSampleRate)
(audioFormat & 0xF); (audioFormat & 0xF);
string audioLanguage = ReadString(data, 3, ref pos); string audioLanguage = ReadString(data, 3, ref pos);
@ -713,7 +707,7 @@ namespace BDInfo
{ {
referenceClip = StreamClips[0]; referenceClip = StreamClips[0];
} }
foreach (TSStreamClip clip in StreamClips) foreach (var clip in StreamClips)
{ {
if (clip.StreamClipFile.Streams.Count > referenceClip.StreamClipFile.Streams.Count) if (clip.StreamClipFile.Streams.Count > referenceClip.StreamClipFile.Streams.Count)
{ {
@ -739,12 +733,12 @@ namespace BDInfo
} }
} }
foreach (TSStream clipStream foreach (var clipStream
in referenceClip.StreamClipFile.Streams.Values) in referenceClip.StreamClipFile.Streams.Values)
{ {
if (!Streams.ContainsKey(clipStream.PID)) if (!Streams.ContainsKey(clipStream.PID))
{ {
TSStream stream = clipStream.Clone(); var stream = clipStream.Clone();
Streams[clipStream.PID] = stream; Streams[clipStream.PID] = stream;
if (!IsCustom && !PlaylistStreams.ContainsKey(stream.PID)) if (!IsCustom && !PlaylistStreams.ContainsKey(stream.PID))
@ -780,7 +774,7 @@ namespace BDInfo
referenceClip.StreamFile.Streams.ContainsKey(4114) && referenceClip.StreamFile.Streams.ContainsKey(4114) &&
!Streams.ContainsKey(4114)) !Streams.ContainsKey(4114))
{ {
TSStream stream = referenceClip.StreamFile.Streams[4114].Clone(); var stream = referenceClip.StreamFile.Streams[4114].Clone();
Streams[4114] = stream; Streams[4114] = stream;
if (stream.IsVideoStream) if (stream.IsVideoStream)
{ {
@ -788,12 +782,12 @@ namespace BDInfo
} }
} }
foreach (TSStream clipStream foreach (var clipStream
in referenceClip.StreamFile.Streams.Values) in referenceClip.StreamFile.Streams.Values)
{ {
if (Streams.ContainsKey(clipStream.PID)) if (Streams.ContainsKey(clipStream.PID))
{ {
TSStream stream = Streams[clipStream.PID]; var stream = Streams[clipStream.PID];
if (stream.StreamType != clipStream.StreamType) continue; if (stream.StreamType != clipStream.StreamType) continue;
@ -812,8 +806,8 @@ namespace BDInfo
else if (stream.IsAudioStream && else if (stream.IsAudioStream &&
clipStream.IsAudioStream) clipStream.IsAudioStream)
{ {
TSAudioStream audioStream = (TSAudioStream)stream; var audioStream = (TSAudioStream)stream;
TSAudioStream clipAudioStream = (TSAudioStream)clipStream; var clipAudioStream = (TSAudioStream)clipStream;
if (clipAudioStream.ChannelCount > audioStream.ChannelCount) if (clipAudioStream.ChannelCount > audioStream.ChannelCount)
{ {
@ -864,7 +858,7 @@ namespace BDInfo
SortedStreams.Add(stream); SortedStreams.Add(stream);
for (int i = 0; i < AngleCount; i++) for (int i = 0; i < AngleCount; i++)
{ {
TSStream angleStream = stream.Clone(); var angleStream = stream.Clone();
angleStream.AngleIndex = i + 1; angleStream.AngleIndex = i + 1;
AngleStreams[i][angleStream.PID] = angleStream; AngleStreams[i][angleStream.PID] = angleStream;
SortedStreams.Add(angleStream); SortedStreams.Add(angleStream);
@ -901,7 +895,7 @@ namespace BDInfo
public void ClearBitrates() public void ClearBitrates()
{ {
foreach (TSStreamClip clip in StreamClips) foreach (var clip in StreamClips)
{ {
clip.PayloadBytes = 0; clip.PayloadBytes = 0;
clip.PacketCount = 0; clip.PacketCount = 0;
@ -909,7 +903,7 @@ namespace BDInfo
if (clip.StreamFile != null) if (clip.StreamFile != null)
{ {
foreach (TSStream stream in clip.StreamFile.Streams.Values) foreach (var stream in clip.StreamFile.Streams.Values)
{ {
stream.PayloadBytes = 0; stream.PayloadBytes = 0;
stream.PacketCount = 0; stream.PacketCount = 0;
@ -924,7 +918,7 @@ namespace BDInfo
} }
} }
foreach (TSStream stream in SortedStreams) foreach (var stream in SortedStreams)
{ {
stream.PayloadBytes = 0; stream.PayloadBytes = 0;
stream.PacketCount = 0; stream.PacketCount = 0;
@ -1246,8 +1240,7 @@ namespace BDInfo
int count, int count,
ref int pos) ref int pos)
{ {
string val = string val = Encoding.ASCII.GetString(data, pos, count);
_textEncoding.GetASCIIEncoding().GetString(data, pos, count);
pos += count; pos += count;

View file

@ -1,4 +1,4 @@
//============================================================================ //============================================================================
// BDInfo - Blu-ray Video and Audio Analysis Tool // BDInfo - Blu-ray Video and Audio Analysis Tool
// Copyright © 2010 Cinema Squid // Copyright © 2010 Cinema Squid
// //
@ -109,7 +109,7 @@ namespace BDInfo
public TSDescriptor Clone() public TSDescriptor Clone()
{ {
TSDescriptor descriptor = var descriptor =
new TSDescriptor(Name, (byte)Value.Length); new TSDescriptor(Name, (byte)Value.Length);
Value.CopyTo(descriptor.Value, 0); Value.CopyTo(descriptor.Value, 0);
return descriptor; return descriptor;
@ -142,21 +142,12 @@ namespace BDInfo
public double PacketSeconds = 0; public double PacketSeconds = 0;
public int AngleIndex = 0; public int AngleIndex = 0;
public ulong PacketSize public ulong PacketSize => PacketCount * 192;
{
get
{
return PacketCount * 192;
}
}
private string _LanguageCode; private string _LanguageCode;
public string LanguageCode public string LanguageCode
{ {
get get => _LanguageCode;
{
return _LanguageCode;
}
set set
{ {
_LanguageCode = value; _LanguageCode = value;
@ -398,13 +389,7 @@ namespace BDInfo
} }
} }
public virtual string Description public virtual string Description => "";
{
get
{
return "";
}
}
public abstract TSStream Clone(); public abstract TSStream Clone();
@ -419,7 +404,7 @@ namespace BDInfo
if (Descriptors != null) if (Descriptors != null)
{ {
stream.Descriptors = new List<TSDescriptor>(); stream.Descriptors = new List<TSDescriptor>();
foreach (TSDescriptor descriptor in Descriptors) foreach (var descriptor in Descriptors)
{ {
stream.Descriptors.Add(descriptor.Clone()); stream.Descriptors.Add(descriptor.Clone());
} }
@ -444,10 +429,7 @@ namespace BDInfo
private TSVideoFormat _VideoFormat; private TSVideoFormat _VideoFormat;
public TSVideoFormat VideoFormat public TSVideoFormat VideoFormat
{ {
get get => _VideoFormat;
{
return _VideoFormat;
}
set set
{ {
_VideoFormat = value; _VideoFormat = value;
@ -488,10 +470,7 @@ namespace BDInfo
private TSFrameRate _FrameRate; private TSFrameRate _FrameRate;
public TSFrameRate FrameRate public TSFrameRate FrameRate
{ {
get get => _FrameRate;
{
return _FrameRate;
}
set set
{ {
_FrameRate = value; _FrameRate = value;
@ -574,7 +553,7 @@ namespace BDInfo
public override TSStream Clone() public override TSStream Clone()
{ {
TSVideoStream stream = new TSVideoStream(); var stream = new TSVideoStream();
CopyTo(stream); CopyTo(stream);
stream.VideoFormat = _VideoFormat; stream.VideoFormat = _VideoFormat;
@ -748,7 +727,7 @@ namespace BDInfo
public override TSStream Clone() public override TSStream Clone()
{ {
TSAudioStream stream = new TSAudioStream(); var stream = new TSAudioStream();
CopyTo(stream); CopyTo(stream);
stream.SampleRate = SampleRate; stream.SampleRate = SampleRate;
@ -777,7 +756,7 @@ namespace BDInfo
public override TSStream Clone() public override TSStream Clone()
{ {
TSGraphicsStream stream = new TSGraphicsStream(); var stream = new TSGraphicsStream();
CopyTo(stream); CopyTo(stream);
return stream; return stream;
} }
@ -793,7 +772,7 @@ namespace BDInfo
public override TSStream Clone() public override TSStream Clone()
{ {
TSTextStream stream = new TSTextStream(); var stream = new TSTextStream();
CopyTo(stream); CopyTo(stream);
return stream; return stream;
} }

View file

@ -1,4 +1,4 @@
//============================================================================ //============================================================================
// BDInfo - Blu-ray Video and Audio Analysis Tool // BDInfo - Blu-ray Video and Audio Analysis Tool
// Copyright © 2010 Cinema Squid // Copyright © 2010 Cinema Squid
// //
@ -37,21 +37,9 @@ namespace BDInfo
Stream = new MemoryStream(Buffer); Stream = new MemoryStream(Buffer);
} }
public long Length public long Length => (long)BufferLength;
{
get
{
return (long)BufferLength;
}
}
public long Position public long Position => Stream.Position;
{
get
{
return Stream.Position;
}
}
public void Add( public void Add(
byte[] buffer, byte[] buffer,
@ -123,7 +111,7 @@ namespace BDInfo
data += (Stream.ReadByte() << shift); data += (Stream.ReadByte() << shift);
shift -= 8; shift -= 8;
} }
BitVector32 vector = new BitVector32(data); var vector = new BitVector32(data);
int value = 0; int value = 0;
for (int i = SkipBits; i < SkipBits + bits; i++) for (int i = SkipBits; i < SkipBits + bits; i++)

View file

@ -1,4 +1,4 @@
//============================================================================ //============================================================================
// BDInfo - Blu-ray Video and Audio Analysis Tool // BDInfo - Blu-ray Video and Audio Analysis Tool
// Copyright © 2010 Cinema Squid // Copyright © 2010 Cinema Squid
// //
@ -74,13 +74,7 @@ namespace BDInfo
} }
} }
public ulong PacketSize public ulong PacketSize => PacketCount * 192;
{
get
{
return PacketCount * 192;
}
}
public ulong PacketBitRate public ulong PacketBitRate
{ {
@ -96,11 +90,11 @@ namespace BDInfo
public bool IsCompatible(TSStreamClip clip) public bool IsCompatible(TSStreamClip clip)
{ {
foreach (TSStream stream1 in StreamFile.Streams.Values) foreach (var stream1 in StreamFile.Streams.Values)
{ {
if (clip.StreamFile.Streams.ContainsKey(stream1.PID)) if (clip.StreamFile.Streams.ContainsKey(stream1.PID))
{ {
TSStream stream2 = clip.StreamFile.Streams[stream1.PID]; var stream2 = clip.StreamFile.Streams[stream1.PID];
if (stream1.StreamType != stream2.StreamType) if (stream1.StreamType != stream2.StreamType)
{ {
return false; return false;

View file

@ -23,28 +23,24 @@ using System.Collections.Generic;
using System.IO; using System.IO;
using System.Text; using System.Text;
using MediaBrowser.Model.IO; using MediaBrowser.Model.IO;
using MediaBrowser.Model.Text;
namespace BDInfo namespace BDInfo
{ {
public class TSStreamClipFile public class TSStreamClipFile
{ {
private readonly IFileSystem _fileSystem; private readonly IFileSystem _fileSystem;
private readonly ITextEncoding _textEncoding;
public FileSystemMetadata FileInfo = null; public FileSystemMetadata FileInfo = null;
public string FileType = null; public string FileType = null;
public bool IsValid = false; public bool IsValid = false;
public string Name = null; public string Name = null;
public Dictionary<ushort, TSStream> Streams = public Dictionary<ushort, TSStream> Streams =
new Dictionary<ushort,TSStream>(); new Dictionary<ushort, TSStream>();
public TSStreamClipFile( public TSStreamClipFile(FileSystemMetadata fileInfo, IFileSystem fileSystem)
FileSystemMetadata fileInfo, IFileSystem fileSystem, ITextEncoding textEncoding)
{ {
FileInfo = fileInfo; FileInfo = fileInfo;
_fileSystem = fileSystem; _fileSystem = fileSystem;
_textEncoding = textEncoding;
Name = fileInfo.Name.ToUpper(); Name = fileInfo.Name.ToUpper();
} }
@ -70,7 +66,7 @@ namespace BDInfo
byte[] fileType = new byte[8]; byte[] fileType = new byte[8];
Array.Copy(data, 0, fileType, 0, fileType.Length); Array.Copy(data, 0, fileType, 0, fileType.Length);
FileType = _textEncoding.GetASCIIEncoding().GetString(fileType, 0, fileType.Length); FileType = Encoding.ASCII.GetString(fileType, 0, fileType.Length);
if (FileType != "HDMV0100" && if (FileType != "HDMV0100" &&
FileType != "HDMV0200") FileType != "HDMV0200")
{ {
@ -115,7 +111,7 @@ namespace BDInfo
streamOffset += 2; streamOffset += 2;
TSStreamType streamType = (TSStreamType) var streamType = (TSStreamType)
clipData[streamOffset + 1]; clipData[streamOffset + 1];
switch (streamType) switch (streamType)
{ {
@ -128,11 +124,11 @@ namespace BDInfo
case TSStreamType.MPEG2_VIDEO: case TSStreamType.MPEG2_VIDEO:
case TSStreamType.VC1_VIDEO: case TSStreamType.VC1_VIDEO:
{ {
TSVideoFormat videoFormat = (TSVideoFormat) var videoFormat = (TSVideoFormat)
(clipData[streamOffset + 2] >> 4); (clipData[streamOffset + 2] >> 4);
TSFrameRate frameRate = (TSFrameRate) var frameRate = (TSFrameRate)
(clipData[streamOffset + 2] & 0xF); (clipData[streamOffset + 2] & 0xF);
TSAspectRatio aspectRatio = (TSAspectRatio) var aspectRatio = (TSAspectRatio)
(clipData[streamOffset + 3] >> 4); (clipData[streamOffset + 3] >> 4);
stream = new TSVideoStream(); stream = new TSVideoStream();
@ -166,12 +162,11 @@ namespace BDInfo
byte[] languageBytes = new byte[3]; byte[] languageBytes = new byte[3];
Array.Copy(clipData, streamOffset + 3, Array.Copy(clipData, streamOffset + 3,
languageBytes, 0, languageBytes.Length); languageBytes, 0, languageBytes.Length);
string languageCode = string languageCode = Encoding.ASCII.GetString(languageBytes, 0, languageBytes.Length);
_textEncoding.GetASCIIEncoding().GetString(languageBytes, 0, languageBytes.Length);
TSChannelLayout channelLayout = (TSChannelLayout) var channelLayout = (TSChannelLayout)
(clipData[streamOffset + 2] >> 4); (clipData[streamOffset + 2] >> 4);
TSSampleRate sampleRate = (TSSampleRate) var sampleRate = (TSSampleRate)
(clipData[streamOffset + 2] & 0xF); (clipData[streamOffset + 2] & 0xF);
stream = new TSAudioStream(); stream = new TSAudioStream();
@ -197,8 +192,7 @@ namespace BDInfo
byte[] languageBytes = new byte[3]; byte[] languageBytes = new byte[3];
Array.Copy(clipData, streamOffset + 2, Array.Copy(clipData, streamOffset + 2,
languageBytes, 0, languageBytes.Length); languageBytes, 0, languageBytes.Length);
string languageCode = string languageCode = Encoding.ASCII.GetString(languageBytes, 0, languageBytes.Length);
_textEncoding.GetASCIIEncoding().GetString(languageBytes, 0, languageBytes.Length);
stream = new TSGraphicsStream(); stream = new TSGraphicsStream();
stream.LanguageCode = languageCode; stream.LanguageCode = languageCode;
@ -217,8 +211,7 @@ namespace BDInfo
byte[] languageBytes = new byte[3]; byte[] languageBytes = new byte[3];
Array.Copy(clipData, streamOffset + 3, Array.Copy(clipData, streamOffset + 3,
languageBytes, 0, languageBytes.Length); languageBytes, 0, languageBytes.Length);
string languageCode = string languageCode = Encoding.ASCII.GetString(languageBytes, 0, languageBytes.Length);
_textEncoding.GetASCIIEncoding().GetString(languageBytes, 0, languageBytes.Length);
#if DEBUG #if DEBUG
Debug.WriteLine(string.Format( Debug.WriteLine(string.Format(
"\t{0} {1} {2}", "\t{0} {1} {2}",

View file

@ -1,4 +1,4 @@
//============================================================================ //============================================================================
// BDInfo - Blu-ray Video and Audio Analysis Tool // BDInfo - Blu-ray Video and Audio Analysis Tool
// Copyright © 2010 Cinema Squid // Copyright © 2010 Cinema Squid
// //
@ -283,7 +283,7 @@ namespace BDInfo
bool isAVC = false; bool isAVC = false;
bool isMVC = false; bool isMVC = false;
foreach (TSStream finishedStream in Streams.Values) foreach (var finishedStream in Streams.Values)
{ {
if (!finishedStream.IsInitialized) if (!finishedStream.IsInitialized)
{ {
@ -327,10 +327,10 @@ namespace BDInfo
UpdateStreamBitrate(PID, PTSPID, PTS, PTSDiff); UpdateStreamBitrate(PID, PTSPID, PTS, PTSDiff);
} }
foreach (TSPlaylistFile playlist in Playlists) foreach (var playlist in Playlists)
{ {
double packetSeconds = 0; double packetSeconds = 0;
foreach (TSStreamClip clip in playlist.StreamClips) foreach (var clip in playlist.StreamClips)
{ {
if (clip.AngleIndex == 0) if (clip.AngleIndex == 0)
{ {
@ -339,7 +339,7 @@ namespace BDInfo
} }
if (packetSeconds > 0) if (packetSeconds > 0)
{ {
foreach (TSStream playlistStream in playlist.SortedStreams) foreach (var playlistStream in playlist.SortedStreams)
{ {
if (playlistStream.IsVBR) if (playlistStream.IsVBR)
{ {
@ -366,14 +366,14 @@ namespace BDInfo
{ {
if (Playlists == null) return; if (Playlists == null) return;
TSStreamState streamState = StreamStates[PID]; var streamState = StreamStates[PID];
double streamTime = (double)PTS / 90000; double streamTime = (double)PTS / 90000;
double streamInterval = (double)PTSDiff / 90000; double streamInterval = (double)PTSDiff / 90000;
double streamOffset = streamTime + streamInterval; double streamOffset = streamTime + streamInterval;
foreach (TSPlaylistFile playlist in Playlists) foreach (var playlist in Playlists)
{ {
foreach (TSStreamClip clip in playlist.StreamClips) foreach (var clip in playlist.StreamClips)
{ {
if (clip.Name != this.Name) continue; if (clip.Name != this.Name) continue;
@ -390,7 +390,7 @@ namespace BDInfo
clip.PacketSeconds = streamOffset - clip.TimeIn; clip.PacketSeconds = streamOffset - clip.TimeIn;
} }
Dictionary<ushort, TSStream> playlistStreams = playlist.Streams; var playlistStreams = playlist.Streams;
if (clip.AngleIndex > 0 && if (clip.AngleIndex > 0 &&
clip.AngleIndex < playlist.AngleStreams.Count + 1) clip.AngleIndex < playlist.AngleStreams.Count + 1)
{ {
@ -398,7 +398,7 @@ namespace BDInfo
} }
if (playlistStreams.ContainsKey(PID)) if (playlistStreams.ContainsKey(PID))
{ {
TSStream stream = playlistStreams[PID]; var stream = playlistStreams[PID];
stream.PayloadBytes += streamState.WindowBytes; stream.PayloadBytes += streamState.WindowBytes;
stream.PacketCount += streamState.WindowPackets; stream.PacketCount += streamState.WindowPackets;
@ -425,13 +425,13 @@ namespace BDInfo
if (Streams.ContainsKey(PID)) if (Streams.ContainsKey(PID))
{ {
TSStream stream = Streams[PID]; var stream = Streams[PID];
stream.PayloadBytes += streamState.WindowBytes; stream.PayloadBytes += streamState.WindowBytes;
stream.PacketCount += streamState.WindowPackets; stream.PacketCount += streamState.WindowPackets;
if (stream.IsVideoStream) if (stream.IsVideoStream)
{ {
TSStreamDiagnostics diag = new TSStreamDiagnostics(); var diag = new TSStreamDiagnostics();
diag.Marker = (double)PTS / 90000; diag.Marker = (double)PTS / 90000;
diag.Interval = (double)PTSDiff / 90000; diag.Interval = (double)PTSDiff / 90000;
diag.Bytes = streamState.WindowBytes; diag.Bytes = streamState.WindowBytes;
@ -482,7 +482,7 @@ namespace BDInfo
StreamStates.Clear(); StreamStates.Clear();
StreamDiagnostics.Clear(); StreamDiagnostics.Clear();
TSPacketParser parser = var parser =
new TSPacketParser(); new TSPacketParser();
long fileLength = (uint)fileStream.Length; long fileLength = (uint)fileStream.Length;
@ -670,7 +670,8 @@ namespace BDInfo
parser.PAT[parser.PATOffset++] = buffer[i++]; parser.PAT[parser.PATOffset++] = buffer[i++];
parser.PATSectionLength--; parser.PATSectionLength--;
parser.PacketLength--; parser.PacketLength--;
} --i; }
--i;
if (parser.PATSectionLength == 0) if (parser.PATSectionLength == 0)
{ {
@ -801,7 +802,8 @@ namespace BDInfo
PMT[parser.PMTOffset++] = buffer[i++]; PMT[parser.PMTOffset++] = buffer[i++];
--parser.PMTSectionLength; --parser.PMTSectionLength;
--parser.PacketLength; --parser.PacketLength;
} --i; }
--i;
if (parser.PMTSectionLength == 0) if (parser.PMTSectionLength == 0)
{ {
@ -837,7 +839,7 @@ namespace BDInfo
if (!Streams.ContainsKey(streamPID)) if (!Streams.ContainsKey(streamPID))
{ {
List<TSDescriptor> streamDescriptors = var streamDescriptors =
new List<TSDescriptor>(); new List<TSDescriptor>();
/* /*
@ -994,7 +996,7 @@ namespace BDInfo
{ {
--parser.PMTProgramDescriptorLength; --parser.PMTProgramDescriptorLength;
TSDescriptor descriptor = parser.PMTProgramDescriptors[ var descriptor = parser.PMTProgramDescriptors[
parser.PMTProgramDescriptors.Count - 1]; parser.PMTProgramDescriptors.Count - 1];
int valueIndex = int valueIndex =
@ -1024,8 +1026,8 @@ namespace BDInfo
parser.StreamState != null && parser.StreamState != null &&
parser.TransportScramblingControl == 0) parser.TransportScramblingControl == 0)
{ {
TSStream stream = parser.Stream; var stream = parser.Stream;
TSStreamState streamState = parser.StreamState; var streamState = parser.StreamState;
streamState.Parse = streamState.Parse =
(streamState.Parse << 8) + buffer[i]; (streamState.Parse << 8) + buffer[i];
@ -1459,7 +1461,7 @@ namespace BDInfo
ulong PTSLast = 0; ulong PTSLast = 0;
ulong PTSDiff = 0; ulong PTSDiff = 0;
foreach (TSStream stream in Streams.Values) foreach (var stream in Streams.Values)
{ {
if (!stream.IsVideoStream) continue; if (!stream.IsVideoStream) continue;

View file

@ -10,7 +10,11 @@
- [Bond_009](https://github.com/Bond-009) - [Bond_009](https://github.com/Bond-009)
- [AnthonyLavado](https://github.com/anthonylavado) - [AnthonyLavado](https://github.com/anthonylavado)
- [sparky8251](https://github.com/sparky8251) - [sparky8251](https://github.com/sparky8251)
- [LeoVerto](https://github.com/LeoVerto] - [LeoVerto](https://github.com/LeoVerto)
- [grafixeyehero](https://github.com/grafixeyehero)
- [cvium](https://github.com/cvium)
- [wtayl0r](https://github.com/wtayl0r)
- [TtheCreator](https://github.com/Tthecreator)
# Emby Contributors # Emby Contributors

View file

@ -1,24 +1,37 @@
ARG DOTNET_VERSION=2 ARG DOTNET_VERSION=2
# Download ffmpeg first to allow quicker rebuild of other layers
FROM alpine as ffmpeg
ARG FFMPEG_URL=https://www.johnvansickle.com/ffmpeg/old-releases/ffmpeg-4.0.3-64bit-static.tar.xz
RUN wget ${FFMPEG_URL} -O - | tar Jxf - \
&& mkdir ffmpeg-bin \
&& mv ffmpeg*/ffmpeg ffmpeg-bin \
&& mv ffmpeg*/ffprobe ffmpeg-bin
FROM microsoft/dotnet:${DOTNET_VERSION}-sdk as builder FROM microsoft/dotnet:${DOTNET_VERSION}-sdk as builder
WORKDIR /repo WORKDIR /repo
COPY . . COPY . .
RUN export DOTNET_CLI_TELEMETRY_OPTOUT=1 \ RUN export DOTNET_CLI_TELEMETRY_OPTOUT=1 \
&& dotnet clean \ && dotnet clean \
&& dotnet publish --configuration release --output /jellyfin && dotnet publish \
--configuration release \
--output /jellyfin \
Jellyfin.Server
FROM microsoft/dotnet:${DOTNET_VERSION}-runtime FROM microsoft/dotnet:${DOTNET_VERSION}-runtime
COPY --from=builder /jellyfin /jellyfin COPY --from=builder /jellyfin /jellyfin
COPY --from=ffmpeg /ffmpeg-bin/* /usr/bin/
EXPOSE 8096 EXPOSE 8096
VOLUME /config /media VOLUME /config /media
ARG FFMPEG_URL=https://www.johnvansickle.com/ffmpeg/old-releases/ffmpeg-4.0.3-64bit-static.tar.xz # libfontconfig1 is required for Skia
RUN apt update \ RUN apt-get update \
&& apt install -y xz-utils \ && apt-get install --no-install-recommends --no-install-suggests -y \
&& curl ${FFMPEG_URL} | tar Jxf - -C /usr/bin --wildcards --strip-components=1 ffmpeg*/ffmpeg ffmpeg*/ffprobe \ libfontconfig1 \
&& apt remove -y xz-utils && apt-get clean autoclean \
&& apt-get autoremove \
ENTRYPOINT if [ -n "$PUID$PGUID" ]; \ && rm -rf /var/lib/{apt,dpkg,cache,log}
then echo "PUID/PGID are deprecated. Use Docker user param." >&2; exit 1; \ ENTRYPOINT dotnet /jellyfin/jellyfin.dll -programdata /config
else dotnet /jellyfin/jellyfin.dll -programdata /config; fi

View file

@ -1,17 +0,0 @@
ARG DOTNET_VERSION=3.0
FROM microsoft/dotnet:${DOTNET_VERSION}-sdk as builder
WORKDIR /repo
COPY . .
RUN export DOTNET_CLI_TELEMETRY_OPTOUT=1 \
&& find . -type f -exec sed -i 's/netcoreapp2.1/netcoreapp3.0/g' {} \; \
&& dotnet clean \
&& dotnet publish --configuration release --output /jellyfin
FROM microsoft/dotnet:${DOTNET_VERSION}-runtime
COPY --from=builder /jellyfin /jellyfin
EXPOSE 8096
RUN apt update \
&& apt install -y ffmpeg
VOLUME /config /media
ENTRYPOINT dotnet /jellyfin/jellyfin.dll -programdata /config

24
Dockerfile.arm Normal file
View file

@ -0,0 +1,24 @@
ARG DOTNET_VERSION=3.0
FROM microsoft/dotnet:${DOTNET_VERSION}-sdk-stretch-arm32v7 as builder
WORKDIR /repo
COPY . .
#TODO Remove or update the sed line when we update dotnet version.
RUN export DOTNET_CLI_TELEMETRY_OPTOUT=1 \
&& find . -type f -exec sed -i 's/netcoreapp2.1/netcoreapp3.0/g' {} \; \
&& dotnet clean -maxcpucount:1 \
&& dotnet publish \
-maxcpucount:1 \
--configuration release \
--output /jellyfin \
Jellyfin.Server
FROM microsoft/dotnet:${DOTNET_VERSION}-runtime-stretch-slim-arm32v7
COPY --from=builder /jellyfin /jellyfin
EXPOSE 8096
RUN apt-get update \
&& apt-get install -y ffmpeg
VOLUME /config /media
ENTRYPOINT dotnet /jellyfin/jellyfin.dll -programdata /config

33
Dockerfile.arm64 Normal file
View file

@ -0,0 +1,33 @@
# Requires binfm_misc registration for aarch64
# https://github.com/multiarch/qemu-user-static#binfmt_misc-register
ARG DOTNET_VERSION=3.0
FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu
FROM alpine as qemu_extract
COPY --from=qemu /usr/bin qemu_user_static.tgz
RUN tar -xzvf qemu_user_static.tgz
FROM microsoft/dotnet:${DOTNET_VERSION}-sdk-stretch-arm64v8 as builder
COPY --from=qemu_extract qemu-* /usr/bin
WORKDIR /repo
COPY . .
#TODO Remove or update the sed line when we update dotnet version.
RUN export DOTNET_CLI_TELEMETRY_OPTOUT=1 \
&& find . -type f -exec sed -i 's/netcoreapp2.1/netcoreapp3.0/g' {} \; \
&& dotnet clean \
&& dotnet publish \
--configuration release \
--output /jellyfin \
Jellyfin.Server
FROM microsoft/dotnet:${DOTNET_VERSION}-runtime-stretch-slim-arm64v8
COPY --from=qemu_extract qemu-* /usr/bin
COPY --from=builder /jellyfin /jellyfin
EXPOSE 8096
RUN apt-get update \
&& apt-get install -y ffmpeg
VOLUME /config /media
ENTRYPOINT dotnet /jellyfin/jellyfin.dll -programdata /config

View file

@ -1,7 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO; using System.IO;
namespace DvdLib namespace DvdLib

View file

@ -1,4 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<Compile Include="..\SharedVersion.cs" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\MediaBrowser.Model\MediaBrowser.Model.csproj" /> <ProjectReference Include="..\MediaBrowser.Model\MediaBrowser.Model.csproj" />

View file

@ -1,8 +1,3 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DvdLib.Ifo namespace DvdLib.Ifo
{ {
public enum AudioCodec public enum AudioCodec

View file

@ -1,7 +1,3 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO; using System.IO;
namespace DvdLib.Ifo namespace DvdLib.Ifo

View file

@ -1,7 +1,3 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO; using System.IO;
namespace DvdLib.Ifo namespace DvdLib.Ifo

View file

@ -1,7 +1,3 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO; using System.IO;
namespace DvdLib.Ifo namespace DvdLib.Ifo

View file

@ -1,8 +1,3 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DvdLib.Ifo namespace DvdLib.Ifo
{ {
public class Chapter public class Chapter

View file

@ -1,9 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO; using System.IO;
using System.Diagnostics; using System.Linq;
using MediaBrowser.Model.IO; using MediaBrowser.Model.IO;
namespace DvdLib.Ifo namespace DvdLib.Ifo
@ -33,10 +31,9 @@ namespace DvdLib.Ifo
foreach (var ifo in allIfos) foreach (var ifo in allIfos)
{ {
var num = ifo.Name.Split('_').ElementAtOrDefault(1); var num = ifo.Name.Split('_').ElementAtOrDefault(1);
ushort ifoNumber;
var numbersRead = new List<ushort>(); var numbersRead = new List<ushort>();
if (!string.IsNullOrEmpty(num) && ushort.TryParse(num, out ifoNumber) && !numbersRead.Contains(ifoNumber)) if (!string.IsNullOrEmpty(num) && ushort.TryParse(num, out var ifoNumber) && !numbersRead.Contains(ifoNumber))
{ {
ReadVTS(ifoNumber, ifo.FullName); ReadVTS(ifoNumber, ifo.FullName);
numbersRead.Add(ifoNumber); numbersRead.Add(ifoNumber);
@ -47,7 +44,7 @@ namespace DvdLib.Ifo
{ {
using (var vmgFs = _fileSystem.GetFileStream(vmgPath.FullName, FileOpenMode.Open, FileAccessMode.Read, FileShareMode.Read)) using (var vmgFs = _fileSystem.GetFileStream(vmgPath.FullName, FileOpenMode.Open, FileAccessMode.Read, FileShareMode.Read))
{ {
using (BigEndianBinaryReader vmgRead = new BigEndianBinaryReader(vmgFs)) using (var vmgRead = new BigEndianBinaryReader(vmgFs))
{ {
vmgFs.Seek(0x3E, SeekOrigin.Begin); vmgFs.Seek(0x3E, SeekOrigin.Begin);
_titleSetCount = vmgRead.ReadUInt16(); _titleSetCount = vmgRead.ReadUInt16();
@ -73,7 +70,7 @@ namespace DvdLib.Ifo
read.BaseStream.Seek(6, SeekOrigin.Current); read.BaseStream.Seek(6, SeekOrigin.Current);
for (uint titleNum = 1; titleNum <= _titleCount; titleNum++) for (uint titleNum = 1; titleNum <= _titleCount; titleNum++)
{ {
Title t = new Title(titleNum); var t = new Title(titleNum);
t.ParseTT_SRPT(read); t.ParseTT_SRPT(read);
Titles.Add(t); Titles.Add(t);
} }
@ -81,7 +78,7 @@ namespace DvdLib.Ifo
private void ReadVTS(ushort vtsNum, List<FileSystemMetadata> allFiles) private void ReadVTS(ushort vtsNum, List<FileSystemMetadata> allFiles)
{ {
var filename = String.Format("VTS_{0:00}_0.IFO", vtsNum); var filename = string.Format("VTS_{0:00}_0.IFO", vtsNum);
var vtsPath = allFiles.FirstOrDefault(i => string.Equals(i.Name, filename, StringComparison.OrdinalIgnoreCase)) ?? var vtsPath = allFiles.FirstOrDefault(i => string.Equals(i.Name, filename, StringComparison.OrdinalIgnoreCase)) ??
allFiles.FirstOrDefault(i => string.Equals(i.Name, Path.ChangeExtension(filename, ".bup"), StringComparison.OrdinalIgnoreCase)); allFiles.FirstOrDefault(i => string.Equals(i.Name, Path.ChangeExtension(filename, ".bup"), StringComparison.OrdinalIgnoreCase));
@ -100,7 +97,7 @@ namespace DvdLib.Ifo
using (var vtsFs = _fileSystem.GetFileStream(vtsPath, FileOpenMode.Open, FileAccessMode.Read, FileShareMode.Read)) using (var vtsFs = _fileSystem.GetFileStream(vtsPath, FileOpenMode.Open, FileAccessMode.Read, FileShareMode.Read))
{ {
using (BigEndianBinaryReader vtsRead = new BigEndianBinaryReader(vtsFs)) using (var vtsRead = new BigEndianBinaryReader(vtsFs))
{ {
// Read VTS_PTT_SRPT // Read VTS_PTT_SRPT
vtsFs.Seek(0xC8, SeekOrigin.Begin); vtsFs.Seek(0xC8, SeekOrigin.Begin);
@ -121,7 +118,7 @@ namespace DvdLib.Ifo
{ {
uint chapNum = 1; uint chapNum = 1;
vtsFs.Seek(baseAddr + offsets[titleNum], SeekOrigin.Begin); vtsFs.Seek(baseAddr + offsets[titleNum], SeekOrigin.Begin);
Title t = Titles.FirstOrDefault(vtst => vtst.IsVTSTitle(vtsNum, titleNum + 1)); var t = Titles.FirstOrDefault(vtst => vtst.IsVTSTitle(vtsNum, titleNum + 1));
if (t == null) continue; if (t == null) continue;
do do
@ -151,7 +148,7 @@ namespace DvdLib.Ifo
vtsFs.Seek(3, SeekOrigin.Current); vtsFs.Seek(3, SeekOrigin.Current);
uint vtsPgcOffset = vtsRead.ReadUInt32(); uint vtsPgcOffset = vtsRead.ReadUInt32();
Title t = Titles.FirstOrDefault(vtst => vtst.IsVTSTitle(vtsNum, titleNum)); var t = Titles.FirstOrDefault(vtst => vtst.IsVTSTitle(vtsNum, titleNum));
if (t != null) t.AddPgc(vtsRead, startByte + vtsPgcOffset, entryPgc, pgcNum); if (t != null) t.AddPgc(vtsRead, startByte + vtsPgcOffset, entryPgc, pgcNum);
} }
} }

View file

@ -1,7 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DvdLib.Ifo namespace DvdLib.Ifo
{ {
@ -20,7 +17,7 @@ namespace DvdLib.Ifo
else if ((data[3] & 0x40) != 0) FrameRate = 25; else if ((data[3] & 0x40) != 0) FrameRate = 25;
} }
private byte GetBCDValue(byte data) private static byte GetBCDValue(byte data)
{ {
return (byte)((((data & 0xF0) >> 4) * 10) + (data & 0x0F)); return (byte)((((data & 0xF0) >> 4) * 10) + (data & 0x0F));
} }

View file

@ -1,7 +1,4 @@
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DvdLib.Ifo namespace DvdLib.Ifo
{ {

View file

@ -1,7 +1,4 @@
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DvdLib.Ifo namespace DvdLib.Ifo
{ {

View file

@ -1,8 +1,6 @@
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO; using System.IO;
using System.Linq;
namespace DvdLib.Ifo namespace DvdLib.Ifo
{ {
@ -89,7 +87,7 @@ namespace DvdLib.Ifo
br.BaseStream.Seek(startPos + _cellPositionOffset, SeekOrigin.Begin); br.BaseStream.Seek(startPos + _cellPositionOffset, SeekOrigin.Begin);
for (int cellNum = 0; cellNum < _cellCount; cellNum++) for (int cellNum = 0; cellNum < _cellCount; cellNum++)
{ {
Cell c = new Cell(); var c = new Cell();
c.ParsePosition(br); c.ParsePosition(br);
Cells.Add(c); Cells.Add(c);
} }
@ -101,12 +99,12 @@ namespace DvdLib.Ifo
} }
br.BaseStream.Seek(startPos + _programMapOffset, SeekOrigin.Begin); br.BaseStream.Seek(startPos + _programMapOffset, SeekOrigin.Begin);
List<int> cellNumbers = new List<int>(); var cellNumbers = new List<int>();
for (int progNum = 0; progNum < _programCount; progNum++) cellNumbers.Add(br.ReadByte() - 1); for (int progNum = 0; progNum < _programCount; progNum++) cellNumbers.Add(br.ReadByte() - 1);
for (int i = 0; i < cellNumbers.Count; i++) for (int i = 0; i < cellNumbers.Count; i++)
{ {
int max = (i + 1 == cellNumbers.Count) ? _cellCount : cellNumbers[i+1]; int max = (i + 1 == cellNumbers.Count) ? _cellCount : cellNumbers[i + 1];
Programs.Add(new Program(Cells.Where((c, idx) => idx >= cellNumbers[i] && idx < max).ToList())); Programs.Add(new Program(Cells.Where((c, idx) => idx >= cellNumbers[i] && idx < max).ToList()));
} }
} }

View file

@ -1,7 +1,4 @@
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO; using System.IO;
namespace DvdLib.Ifo namespace DvdLib.Ifo
@ -53,7 +50,7 @@ namespace DvdLib.Ifo
long curPos = br.BaseStream.Position; long curPos = br.BaseStream.Position;
br.BaseStream.Seek(startByte, SeekOrigin.Begin); br.BaseStream.Seek(startByte, SeekOrigin.Begin);
ProgramChain pgc = new ProgramChain(pgcNum); var pgc = new ProgramChain(pgcNum);
pgc.ParseHeader(br); pgc.ParseHeader(br);
ProgramChains.Add(pgc); ProgramChains.Add(pgc);
if (entryPgc) EntryProgramChain = pgc; if (entryPgc) EntryProgramChain = pgc;

View file

@ -1,7 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DvdLib.Ifo namespace DvdLib.Ifo
{ {

View file

@ -1,8 +1,3 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DvdLib.Ifo namespace DvdLib.Ifo
{ {
public enum VideoCodec public enum VideoCodec

View file

@ -1,6 +1,5 @@
using System.Resources;
using System.Reflection; using System.Reflection;
using System.Runtime.CompilerServices; using System.Resources;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following
@ -9,21 +8,14 @@ using System.Runtime.InteropServices;
[assembly: AssemblyTitle("DvdLib")] [assembly: AssemblyTitle("DvdLib")]
[assembly: AssemblyDescription("")] [assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")] [assembly: AssemblyCompany("Jellyfin Project")]
[assembly: AssemblyProduct("DvdLib")] [assembly: AssemblyProduct("Jellyfin: The Free Software Media System")]
[assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyCopyright("Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License Version 2")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")] [assembly: NeutralResourcesLanguage("en")]
// Version information for an assembly consists of the following four values: // Setting ComVisible to false makes the types in this assembly not visible
// // to COM components. If you need to access a type in this assembly from
// Major Version // COM, set the ComVisible attribute to true on that type.
// Minor Version [assembly: ComVisible(false)]
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.1")]

View file

@ -1,14 +1,14 @@
using MediaBrowser.Controller.Dlna;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Threading.Tasks;
using MediaBrowser.Model.Services;
using MediaBrowser.Common.Extensions;
using System.Text;
using MediaBrowser.Controller.Net;
using System.Linq; using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Emby.Dlna.Main; using Emby.Dlna.Main;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Dlna;
using MediaBrowser.Controller.Net;
using MediaBrowser.Model.Services;
namespace Emby.Dlna.Api namespace Emby.Dlna.Api
{ {
@ -115,29 +115,11 @@ namespace Emby.Dlna.Api
public IRequest Request { get; set; } public IRequest Request { get; set; }
private IHttpResultFactory _resultFactory; private IHttpResultFactory _resultFactory;
private IContentDirectory ContentDirectory private IContentDirectory ContentDirectory => DlnaEntryPoint.Current.ContentDirectory;
{
get
{
return DlnaEntryPoint.Current.ContentDirectory;
}
}
private IConnectionManager ConnectionManager private IConnectionManager ConnectionManager => DlnaEntryPoint.Current.ConnectionManager;
{
get
{
return DlnaEntryPoint.Current.ConnectionManager;
}
}
private IMediaReceiverRegistrar MediaReceiverRegistrar private IMediaReceiverRegistrar MediaReceiverRegistrar => DlnaEntryPoint.Current.MediaReceiverRegistrar;
{
get
{
return DlnaEntryPoint.Current.MediaReceiverRegistrar;
}
}
public DlnaServerService(IDlnaManager dlnaManager, IHttpResultFactory httpResultFactory) public DlnaServerService(IDlnaManager dlnaManager, IHttpResultFactory httpResultFactory)
{ {
@ -227,7 +209,7 @@ namespace Emby.Dlna.Api
// TODO: Work out what this is doing. // TODO: Work out what this is doing.
if (string.Equals(first, "mediabrowser", StringComparison.OrdinalIgnoreCase) || if (string.Equals(first, "mediabrowser", StringComparison.OrdinalIgnoreCase) ||
string.Equals(first, "emby", StringComparison.OrdinalIgnoreCase) || string.Equals(first, "emby", StringComparison.OrdinalIgnoreCase) ||
string.Equals(first, "jellyfin", StringComparison.OrdinalIgnoreCase )) string.Equals(first, "jellyfin", StringComparison.OrdinalIgnoreCase))
{ {
index++; index++;
} }
@ -259,7 +241,7 @@ namespace Emby.Dlna.Api
var cacheLength = TimeSpan.FromDays(365); var cacheLength = TimeSpan.FromDays(365);
var cacheKey = Request.RawUrl.GetMD5(); var cacheKey = Request.RawUrl.GetMD5();
return _resultFactory.GetStaticResult(Request, cacheKey, null, cacheLength, contentType, () => Task.FromResult<Stream>(_dlnaManager.GetIcon(request.Filename).Stream)); return _resultFactory.GetStaticResult(Request, cacheKey, null, cacheLength, contentType, () => Task.FromResult(_dlnaManager.GetIcon(request.Filename).Stream));
} }
public object Subscribe(ProcessContentDirectoryEventRequest request) public object Subscribe(ProcessContentDirectoryEventRequest request)

View file

@ -1,4 +1,4 @@
using System.Linq; using System.Linq;
using MediaBrowser.Controller.Dlna; using MediaBrowser.Controller.Dlna;
using MediaBrowser.Controller.Net; using MediaBrowser.Controller.Net;
using MediaBrowser.Model.Dlna; using MediaBrowser.Model.Dlna;

View file

@ -1,4 +1,4 @@

namespace Emby.Dlna.Common namespace Emby.Dlna.Common
{ {
public class Argument public class Argument

View file

@ -1,4 +1,4 @@

namespace Emby.Dlna.Common namespace Emby.Dlna.Common
{ {
public class DeviceIcon public class DeviceIcon

View file

@ -1,4 +1,4 @@

namespace Emby.Dlna.Common namespace Emby.Dlna.Common
{ {
public class DeviceService public class DeviceService

View file

@ -1,4 +1,4 @@
using System.Collections.Generic; using System.Collections.Generic;
namespace Emby.Dlna.Common namespace Emby.Dlna.Common
{ {

View file

@ -1,4 +1,3 @@
using System.Collections.Generic;
using System; using System;
namespace Emby.Dlna.Common namespace Emby.Dlna.Common

View file

@ -1,4 +1,4 @@

namespace Emby.Dlna.Configuration namespace Emby.Dlna.Configuration
{ {
public class DlnaOptions public class DlnaOptions

View file

@ -1,6 +1,6 @@
using MediaBrowser.Common.Configuration;
using Emby.Dlna.Configuration;
using System.Collections.Generic; using System.Collections.Generic;
using Emby.Dlna.Configuration;
using MediaBrowser.Common.Configuration;
namespace Emby.Dlna namespace Emby.Dlna
{ {

View file

@ -1,8 +1,8 @@
using MediaBrowser.Common.Net; using System.Collections.Generic;
using Emby.Dlna.Service;
using MediaBrowser.Common.Net;
using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Dlna; using MediaBrowser.Controller.Dlna;
using Emby.Dlna.Service;
using System.Collections.Generic;
using MediaBrowser.Model.Xml; using MediaBrowser.Model.Xml;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;

View file

@ -1,6 +1,6 @@
using Emby.Dlna.Common;
using Emby.Dlna.Service;
using System.Collections.Generic; using System.Collections.Generic;
using Emby.Dlna.Common;
using Emby.Dlna.Service;
namespace Emby.Dlna.ConnectionManager namespace Emby.Dlna.ConnectionManager
{ {
@ -11,7 +11,7 @@ namespace Emby.Dlna.ConnectionManager
return new ServiceXmlBuilder().GetXml(new ServiceActionListBuilder().GetActions(), GetStateVariables()); return new ServiceXmlBuilder().GetXml(new ServiceActionListBuilder().GetActions(), GetStateVariables());
} }
private IEnumerable<StateVariable> GetStateVariables() private static IEnumerable<StateVariable> GetStateVariables()
{ {
var list = new List<StateVariable>(); var list = new List<StateVariable>();

View file

@ -1,12 +1,11 @@
using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Configuration;
using Emby.Dlna.Server;
using Emby.Dlna.Service;
using MediaBrowser.Model.Dlna;
using Microsoft.Extensions.Logging;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Emby.Dlna.Service;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Model.Dlna;
using MediaBrowser.Model.Xml; using MediaBrowser.Model.Xml;
using Microsoft.Extensions.Logging;
namespace Emby.Dlna.ConnectionManager namespace Emby.Dlna.ConnectionManager
{ {

View file

@ -1,5 +1,5 @@
using Emby.Dlna.Common;
using System.Collections.Generic; using System.Collections.Generic;
using Emby.Dlna.Common;
namespace Emby.Dlna.ConnectionManager namespace Emby.Dlna.ConnectionManager
{ {
@ -19,7 +19,7 @@ namespace Emby.Dlna.ConnectionManager
return list; return list;
} }
private ServiceAction PrepareForConnection() private static ServiceAction PrepareForConnection()
{ {
var action = new ServiceAction var action = new ServiceAction
{ {
@ -78,7 +78,7 @@ namespace Emby.Dlna.ConnectionManager
return action; return action;
} }
private ServiceAction GetCurrentConnectionInfo() private static ServiceAction GetCurrentConnectionInfo()
{ {
var action = new ServiceAction var action = new ServiceAction
{ {

View file

@ -1,18 +1,18 @@
using MediaBrowser.Common.Net; using System;
using System.Collections.Generic;
using Emby.Dlna.Service;
using MediaBrowser.Common.Net;
using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Dlna; using MediaBrowser.Controller.Dlna;
using MediaBrowser.Controller.Drawing; using MediaBrowser.Controller.Drawing;
using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Library;
using Emby.Dlna.Service;
using MediaBrowser.Model.Dlna;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using MediaBrowser.Controller.MediaEncoding; using MediaBrowser.Controller.MediaEncoding;
using MediaBrowser.Controller.TV; using MediaBrowser.Controller.TV;
using MediaBrowser.Model.Dlna;
using MediaBrowser.Model.Globalization; using MediaBrowser.Model.Globalization;
using MediaBrowser.Model.Xml; using MediaBrowser.Model.Xml;
using Microsoft.Extensions.Logging;
namespace Emby.Dlna.ContentDirectory namespace Emby.Dlna.ContentDirectory
{ {

View file

@ -1,6 +1,6 @@
using Emby.Dlna.Common;
using Emby.Dlna.Service;
using System.Collections.Generic; using System.Collections.Generic;
using Emby.Dlna.Common;
using Emby.Dlna.Service;
namespace Emby.Dlna.ContentDirectory namespace Emby.Dlna.ContentDirectory
{ {
@ -12,7 +12,7 @@ namespace Emby.Dlna.ContentDirectory
GetStateVariables()); GetStateVariables());
} }
private IEnumerable<StateVariable> GetStateVariables() private static IEnumerable<StateVariable> GetStateVariables()
{ {
var list = new List<StateVariable>(); var list = new List<StateVariable>();

View file

@ -1,19 +1,3 @@
using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Channels;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Drawing;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Movies;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Library;
using Emby.Dlna.Didl;
using Emby.Dlna.Server;
using Emby.Dlna.Service;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Dlna;
using MediaBrowser.Model.Entities;
using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Querying;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization; using System.Globalization;
@ -21,17 +5,28 @@ using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks;
using System.Xml; using System.Xml;
using Emby.Dlna.Didl;
using Emby.Dlna.Service;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Drawing;
using MediaBrowser.Controller.Dto; using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Audio; using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Controller.Entities.Movies;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.LiveTv;
using MediaBrowser.Controller.MediaEncoding; using MediaBrowser.Controller.MediaEncoding;
using MediaBrowser.Controller.Playlists; using MediaBrowser.Controller.Playlists;
using MediaBrowser.Controller.TV; using MediaBrowser.Controller.TV;
using MediaBrowser.Model.Dlna;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Globalization; using MediaBrowser.Model.Globalization;
using MediaBrowser.Model.Querying;
using MediaBrowser.Model.Xml; using MediaBrowser.Model.Xml;
using MediaBrowser.Model.Extensions; using Microsoft.Extensions.Logging;
using MediaBrowser.Controller.LiveTv;
namespace Emby.Dlna.ContentDirectory namespace Emby.Dlna.ContentDirectory
{ {
@ -197,9 +192,7 @@ namespace Emby.Dlna.ContentDirectory
public string GetValueOrDefault(IDictionary<string, string> sparams, string key, string defaultValue) public string GetValueOrDefault(IDictionary<string, string> sparams, string key, string defaultValue)
{ {
string val; if (sparams.TryGetValue(key, out string val))
if (sparams.TryGetValue(key, out val))
{ {
return val; return val;
} }
@ -221,14 +214,12 @@ namespace Emby.Dlna.ContentDirectory
int? requestedCount = null; int? requestedCount = null;
int? start = 0; int? start = 0;
int requestedVal; if (sparams.ContainsKey("RequestedCount") && int.TryParse(sparams["RequestedCount"], out var requestedVal) && requestedVal > 0)
if (sparams.ContainsKey("RequestedCount") && int.TryParse(sparams["RequestedCount"], out requestedVal) && requestedVal > 0)
{ {
requestedCount = requestedVal; requestedCount = requestedVal;
} }
int startVal; if (sparams.ContainsKey("StartingIndex") && int.TryParse(sparams["StartingIndex"], out var startVal) && startVal > 0)
if (sparams.ContainsKey("StartingIndex") && int.TryParse(sparams["StartingIndex"], out startVal) && startVal > 0)
{ {
start = startVal; start = startVal;
} }
@ -247,7 +238,7 @@ namespace Emby.Dlna.ContentDirectory
var dlnaOptions = _config.GetDlnaConfiguration(); var dlnaOptions = _config.GetDlnaConfiguration();
using (XmlWriter writer = XmlWriter.Create(builder, settings)) using (var writer = XmlWriter.Create(builder, settings))
{ {
//writer.WriteStartDocument(); //writer.WriteStartDocument();
@ -311,7 +302,7 @@ namespace Emby.Dlna.ContentDirectory
var resXML = builder.ToString(); var resXML = builder.ToString();
return new [] return new[]
{ {
new KeyValuePair<string,string>("Result", resXML), new KeyValuePair<string,string>("Result", resXML),
new KeyValuePair<string,string>("NumberReturned", provided.ToString(_usCulture)), new KeyValuePair<string,string>("NumberReturned", provided.ToString(_usCulture)),
@ -339,14 +330,12 @@ namespace Emby.Dlna.ContentDirectory
int? requestedCount = null; int? requestedCount = null;
int? start = 0; int? start = 0;
int requestedVal; if (sparams.ContainsKey("RequestedCount") && int.TryParse(sparams["RequestedCount"], out var requestedVal) && requestedVal > 0)
if (sparams.ContainsKey("RequestedCount") && int.TryParse(sparams["RequestedCount"], out requestedVal) && requestedVal > 0)
{ {
requestedCount = requestedVal; requestedCount = requestedVal;
} }
int startVal; if (sparams.ContainsKey("StartingIndex") && int.TryParse(sparams["StartingIndex"], out var startVal) && startVal > 0)
if (sparams.ContainsKey("StartingIndex") && int.TryParse(sparams["StartingIndex"], out startVal) && startVal > 0)
{ {
start = startVal; start = startVal;
} }
@ -363,7 +352,7 @@ namespace Emby.Dlna.ContentDirectory
int totalCount = 0; int totalCount = 0;
int provided = 0; int provided = 0;
using (XmlWriter writer = XmlWriter.Create(builder, settings)) using (var writer = XmlWriter.Create(builder, settings))
{ {
//writer.WriteStartDocument(); //writer.WriteStartDocument();
@ -1144,7 +1133,7 @@ namespace Emby.Dlna.ContentDirectory
StartIndex = query.StartIndex, StartIndex = query.StartIndex,
UserId = query.User.Id UserId = query.User.Id
}, new [] { parent }, query.DtoOptions); }, new[] { parent }, query.DtoOptions);
return ToResult(result); return ToResult(result);
} }
@ -1298,7 +1287,6 @@ namespace Emby.Dlna.ContentDirectory
private ServerItem ParseItemId(string id, User user) private ServerItem ParseItemId(string id, User user)
{ {
Guid itemId;
StubType? stubType = null; StubType? stubType = null;
// After using PlayTo, MediaMonkey sends a request to the server trying to get item info // After using PlayTo, MediaMonkey sends a request to the server trying to get item info
@ -1324,7 +1312,7 @@ namespace Emby.Dlna.ContentDirectory
} }
} }
if (Guid.TryParse(id, out itemId)) if (Guid.TryParse(id, out var itemId))
{ {
var item = _libraryManager.GetItemById(itemId); var item = _libraryManager.GetItemById(itemId);

View file

@ -1,5 +1,5 @@
using Emby.Dlna.Common;
using System.Collections.Generic; using System.Collections.Generic;
using Emby.Dlna.Common;
namespace Emby.Dlna.ContentDirectory namespace Emby.Dlna.ContentDirectory
{ {
@ -7,7 +7,7 @@ namespace Emby.Dlna.ContentDirectory
{ {
public IEnumerable<ServiceAction> GetActions() public IEnumerable<ServiceAction> GetActions()
{ {
return new [] return new[]
{ {
GetSearchCapabilitiesAction(), GetSearchCapabilitiesAction(),
GetSortCapabilitiesAction(), GetSortCapabilitiesAction(),
@ -20,7 +20,7 @@ namespace Emby.Dlna.ContentDirectory
}; };
} }
private ServiceAction GetGetSystemUpdateIDAction() private static ServiceAction GetGetSystemUpdateIDAction()
{ {
var action = new ServiceAction var action = new ServiceAction
{ {
@ -37,7 +37,7 @@ namespace Emby.Dlna.ContentDirectory
return action; return action;
} }
private ServiceAction GetSearchCapabilitiesAction() private static ServiceAction GetSearchCapabilitiesAction()
{ {
var action = new ServiceAction var action = new ServiceAction
{ {
@ -54,7 +54,7 @@ namespace Emby.Dlna.ContentDirectory
return action; return action;
} }
private ServiceAction GetSortCapabilitiesAction() private static ServiceAction GetSortCapabilitiesAction()
{ {
var action = new ServiceAction var action = new ServiceAction
{ {
@ -71,7 +71,7 @@ namespace Emby.Dlna.ContentDirectory
return action; return action;
} }
private ServiceAction GetX_GetFeatureListAction() private static ServiceAction GetX_GetFeatureListAction()
{ {
var action = new ServiceAction var action = new ServiceAction
{ {
@ -88,7 +88,7 @@ namespace Emby.Dlna.ContentDirectory
return action; return action;
} }
private ServiceAction GetSearchAction() private static ServiceAction GetSearchAction()
{ {
var action = new ServiceAction var action = new ServiceAction
{ {

View file

@ -1,4 +1,4 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
namespace Emby.Dlna namespace Emby.Dlna

View file

@ -1,4 +1,4 @@
using System.Collections.Generic; using System.Collections.Generic;
namespace Emby.Dlna namespace Emby.Dlna
{ {

View file

@ -1,4 +1,11 @@
using MediaBrowser.Model.Extensions; using System;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Xml;
using Emby.Dlna.Configuration;
using Emby.Dlna.ContentDirectory;
using MediaBrowser.Controller.Channels; using MediaBrowser.Controller.Channels;
using MediaBrowser.Controller.Drawing; using MediaBrowser.Controller.Drawing;
using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities;
@ -6,23 +13,15 @@ using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Controller.Entities.Movies; using MediaBrowser.Controller.Entities.Movies;
using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.MediaEncoding;
using MediaBrowser.Controller.Playlists; using MediaBrowser.Controller.Playlists;
using Emby.Dlna.ContentDirectory;
using MediaBrowser.Model.Dlna; using MediaBrowser.Model.Dlna;
using MediaBrowser.Model.Drawing; using MediaBrowser.Model.Drawing;
using MediaBrowser.Model.Entities; using MediaBrowser.Model.Entities;
using Microsoft.Extensions.Logging; using MediaBrowser.Model.Extensions;
using MediaBrowser.Model.Net;
using System;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using MediaBrowser.Controller.MediaEncoding;
using Emby.Dlna.Configuration;
using MediaBrowser.Model.Globalization; using MediaBrowser.Model.Globalization;
using MediaBrowser.Model.Net;
using Microsoft.Extensions.Logging;
namespace Emby.Dlna.Didl namespace Emby.Dlna.Didl
{ {
@ -79,7 +78,7 @@ namespace Emby.Dlna.Didl
using (StringWriter builder = new StringWriterWithEncoding(Encoding.UTF8)) using (StringWriter builder = new StringWriterWithEncoding(Encoding.UTF8))
{ {
using (XmlWriter writer = XmlWriter.Create(builder, settings)) using (var writer = XmlWriter.Create(builder, settings))
{ {
//writer.WriteStartDocument(); //writer.WriteStartDocument();
@ -375,7 +374,7 @@ namespace Emby.Dlna.Didl
? GetMimeType(filename) ? GetMimeType(filename)
: mediaProfile.MimeType; : mediaProfile.MimeType;
writer.WriteAttributeString("protocolInfo", String.Format( writer.WriteAttributeString("protocolInfo", string.Format(
"http-get:*:{0}:{1}", "http-get:*:{0}:{1}",
mimeType, mimeType,
contentFeatures contentFeatures
@ -573,7 +572,7 @@ namespace Emby.Dlna.Didl
streamInfo.RunTimeTicks ?? 0, streamInfo.RunTimeTicks ?? 0,
streamInfo.TranscodeSeekInfo); streamInfo.TranscodeSeekInfo);
writer.WriteAttributeString("protocolInfo", String.Format( writer.WriteAttributeString("protocolInfo", string.Format(
"http-get:*:{0}:{1}", "http-get:*:{0}:{1}",
mimeType, mimeType,
contentFeatures contentFeatures
@ -1017,7 +1016,7 @@ namespace Emby.Dlna.Didl
var contentFeatures = new ContentFeatureBuilder(_profile) var contentFeatures = new ContentFeatureBuilder(_profile)
.BuildImageHeader(format, width, height, imageInfo.IsDirectStream, org_Pn); .BuildImageHeader(format, width, height, imageInfo.IsDirectStream, org_Pn);
writer.WriteAttributeString("protocolInfo", String.Format( writer.WriteAttributeString("protocolInfo", string.Format(
"http-get:*:{0}:{1}", "http-get:*:{0}:{1}",
GetMimeType("file." + format), GetMimeType("file." + format),
contentFeatures contentFeatures

View file

@ -1,6 +1,5 @@
using MediaBrowser.Model.Extensions;
using System; using System;
using System.Collections.Generic; using MediaBrowser.Model.Extensions;
namespace Emby.Dlna.Didl namespace Emby.Dlna.Didl
{ {

View file

@ -1,8 +1,6 @@
using System; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Text; using System.Text;
using System.Threading.Tasks;
namespace Emby.Dlna.Didl namespace Emby.Dlna.Didl
{ {
@ -53,9 +51,6 @@ namespace Emby.Dlna.Didl
_encoding = encoding; _encoding = encoding;
} }
public override Encoding Encoding public override Encoding Encoding => (null == _encoding) ? base.Encoding : _encoding;
{
get { return (null == _encoding) ? base.Encoding : _encoding; }
}
} }
} }

View file

@ -1,24 +1,22 @@
using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller;
using MediaBrowser.Controller.Dlna;
using MediaBrowser.Controller.Drawing;
using MediaBrowser.Controller.Plugins;
using Emby.Dlna.Profiles;
using Emby.Dlna.Server;
using MediaBrowser.Model.Dlna;
using MediaBrowser.Model.Drawing;
using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Serialization;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using Emby.Dlna.Profiles;
using Emby.Dlna.Server;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller;
using MediaBrowser.Controller.Dlna;
using MediaBrowser.Controller.Drawing;
using MediaBrowser.Model.Dlna;
using MediaBrowser.Model.Drawing;
using MediaBrowser.Model.IO; using MediaBrowser.Model.IO;
using MediaBrowser.Model.Reflection; using MediaBrowser.Model.Reflection;
using MediaBrowser.Model.Extensions; using MediaBrowser.Model.Serialization;
using Microsoft.Extensions.Logging;
namespace Emby.Dlna namespace Emby.Dlna
{ {
@ -34,16 +32,17 @@ namespace Emby.Dlna
private readonly Dictionary<string, Tuple<InternalProfileInfo, DeviceProfile>> _profiles = new Dictionary<string, Tuple<InternalProfileInfo, DeviceProfile>>(StringComparer.Ordinal); private readonly Dictionary<string, Tuple<InternalProfileInfo, DeviceProfile>> _profiles = new Dictionary<string, Tuple<InternalProfileInfo, DeviceProfile>>(StringComparer.Ordinal);
public DlnaManager(IXmlSerializer xmlSerializer, public DlnaManager(
IXmlSerializer xmlSerializer,
IFileSystem fileSystem, IFileSystem fileSystem,
IApplicationPaths appPaths, IApplicationPaths appPaths,
ILogger logger, ILoggerFactory loggerFactory,
IJsonSerializer jsonSerializer, IServerApplicationHost appHost, IAssemblyInfo assemblyInfo) IJsonSerializer jsonSerializer, IServerApplicationHost appHost, IAssemblyInfo assemblyInfo)
{ {
_xmlSerializer = xmlSerializer; _xmlSerializer = xmlSerializer;
_fileSystem = fileSystem; _fileSystem = fileSystem;
_appPaths = appPaths; _appPaths = appPaths;
_logger = logger; _logger = loggerFactory.CreateLogger("Dlna");
_jsonSerializer = jsonSerializer; _jsonSerializer = jsonSerializer;
_appHost = appHost; _appHost = appHost;
_assemblyInfo = assemblyInfo; _assemblyInfo = assemblyInfo;
@ -95,7 +94,7 @@ namespace Emby.Dlna
{ {
if (deviceInfo == null) if (deviceInfo == null)
{ {
throw new ArgumentNullException("deviceInfo"); throw new ArgumentNullException(nameof(deviceInfo));
} }
var profile = GetProfiles() var profile = GetProfiles()
@ -207,7 +206,7 @@ namespace Emby.Dlna
{ {
if (headers == null) if (headers == null)
{ {
throw new ArgumentNullException("headers"); throw new ArgumentNullException(nameof(headers));
} }
// Convert to case insensitive // Convert to case insensitive
@ -241,9 +240,7 @@ namespace Emby.Dlna
return false; return false;
} }
string value; if (headers.TryGetValue(header.Name, out string value))
if (headers.TryGetValue(header.Name, out value))
{ {
switch (header.Match) switch (header.Match)
{ {
@ -263,21 +260,9 @@ namespace Emby.Dlna
return false; return false;
} }
private string UserProfilesPath private string UserProfilesPath => Path.Combine(_appPaths.ConfigurationDirectoryPath, "dlna", "user");
{
get
{
return Path.Combine(_appPaths.ConfigurationDirectoryPath, "dlna", "user");
}
}
private string SystemProfilesPath private string SystemProfilesPath => Path.Combine(_appPaths.ConfigurationDirectoryPath, "dlna", "system");
{
get
{
return Path.Combine(_appPaths.ConfigurationDirectoryPath, "dlna", "system");
}
}
private IEnumerable<DeviceProfile> GetProfiles(string path, DeviceProfileType type) private IEnumerable<DeviceProfile> GetProfiles(string path, DeviceProfileType type)
{ {
@ -302,8 +287,7 @@ namespace Emby.Dlna
{ {
lock (_profiles) lock (_profiles)
{ {
Tuple<InternalProfileInfo, DeviceProfile> profileTuple; if (_profiles.TryGetValue(path, out Tuple<InternalProfileInfo, DeviceProfile> profileTuple))
if (_profiles.TryGetValue(path, out profileTuple))
{ {
return profileTuple.Item2; return profileTuple.Item2;
} }
@ -335,7 +319,7 @@ namespace Emby.Dlna
{ {
if (string.IsNullOrEmpty(id)) if (string.IsNullOrEmpty(id))
{ {
throw new ArgumentNullException("id"); throw new ArgumentNullException(nameof(id));
} }
var info = GetProfileInfosInternal().First(i => string.Equals(i.Info.Id, id, StringComparison.OrdinalIgnoreCase)); var info = GetProfileInfosInternal().First(i => string.Equals(i.Info.Id, id, StringComparison.OrdinalIgnoreCase));

View file

@ -1,4 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<Compile Include="..\SharedVersion.cs" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\MediaBrowser.Model\MediaBrowser.Model.csproj" /> <ProjectReference Include="..\MediaBrowser.Model\MediaBrowser.Model.csproj" />

View file

@ -1,4 +1,4 @@
using System.Collections.Generic; using System.Collections.Generic;
namespace Emby.Dlna namespace Emby.Dlna
{ {

View file

@ -1,7 +1,3 @@
using MediaBrowser.Common.Extensions;
using MediaBrowser.Common.Net;
using MediaBrowser.Controller.Dlna;
using Microsoft.Extensions.Logging;
using System; using System;
using System.Collections.Concurrent; using System.Collections.Concurrent;
using System.Collections.Generic; using System.Collections.Generic;
@ -9,6 +5,9 @@ using System.Globalization;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Common.Net;
using Microsoft.Extensions.Logging;
namespace Emby.Dlna.Eventing namespace Emby.Dlna.Eventing
{ {
@ -83,9 +82,7 @@ namespace Emby.Dlna.Eventing
// Starts with SECOND- // Starts with SECOND-
header = header.Split('-').Last(); header = header.Split('-').Last();
int val; if (int.TryParse(header, NumberStyles.Integer, _usCulture, out var val))
if (int.TryParse(header, NumberStyles.Integer, _usCulture, out val))
{ {
return val; return val;
} }
@ -98,8 +95,7 @@ namespace Emby.Dlna.Eventing
{ {
_logger.LogDebug("Cancelling event subscription {0}", subscriptionId); _logger.LogDebug("Cancelling event subscription {0}", subscriptionId);
EventSubscription sub; _subscriptions.TryRemove(subscriptionId, out EventSubscription sub);
_subscriptions.TryRemove(subscriptionId, out sub);
return new EventSubscriptionResponse return new EventSubscriptionResponse
{ {
@ -130,9 +126,7 @@ namespace Emby.Dlna.Eventing
private EventSubscription GetSubscription(string id, bool throwOnMissing) private EventSubscription GetSubscription(string id, bool throwOnMissing)
{ {
EventSubscription e; if (!_subscriptions.TryGetValue(id, out EventSubscription e) && throwOnMissing)
if (!_subscriptions.TryGetValue(id, out e) && throwOnMissing)
{ {
throw new ResourceNotFoundException("Event with Id " + id + " not found."); throw new ResourceNotFoundException("Event with Id " + id + " not found.");
} }

View file

@ -1,4 +1,4 @@
using System; using System;
namespace Emby.Dlna.Eventing namespace Emby.Dlna.Eventing
{ {
@ -23,12 +23,6 @@ namespace Emby.Dlna.Eventing
TriggerCount++; TriggerCount++;
} }
public bool IsExpired public bool IsExpired => SubscriptionTime.AddSeconds(TimeoutSeconds) >= DateTime.UtcNow;
{
get
{
return SubscriptionTime.AddSeconds(TimeoutSeconds) >= DateTime.UtcNow;
}
}
} }
} }

View file

@ -1,4 +1,4 @@

namespace Emby.Dlna namespace Emby.Dlna
{ {
public interface IConnectionManager : IEventManager, IUpnpService public interface IConnectionManager : IEventManager, IUpnpService

View file

@ -1,4 +1,4 @@

namespace Emby.Dlna namespace Emby.Dlna
{ {
public interface IContentDirectory : IEventManager, IUpnpService public interface IContentDirectory : IEventManager, IUpnpService

View file

@ -1,4 +1,4 @@

namespace Emby.Dlna namespace Emby.Dlna
{ {
public interface IEventManager public interface IEventManager

View file

@ -1,4 +1,4 @@

namespace Emby.Dlna namespace Emby.Dlna
{ {
public interface IMediaReceiverRegistrar : IEventManager, IUpnpService public interface IMediaReceiverRegistrar : IEventManager, IUpnpService

View file

@ -1,4 +1,4 @@
using System.Collections.Generic; using System.Collections.Generic;
namespace Emby.Dlna namespace Emby.Dlna
{ {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 932 B

After

Width:  |  Height:  |  Size: 2.5 KiB

View file

@ -1,4 +1,10 @@
using MediaBrowser.Common.Configuration; using System;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Emby.Dlna.PlayTo;
using Emby.Dlna.Ssdp;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Extensions; using MediaBrowser.Common.Extensions;
using MediaBrowser.Common.Net; using MediaBrowser.Common.Net;
using MediaBrowser.Controller; using MediaBrowser.Controller;
@ -6,25 +12,19 @@ using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Dlna; using MediaBrowser.Controller.Dlna;
using MediaBrowser.Controller.Drawing; using MediaBrowser.Controller.Drawing;
using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.MediaEncoding;
using MediaBrowser.Controller.Plugins; using MediaBrowser.Controller.Plugins;
using MediaBrowser.Controller.Session; using MediaBrowser.Controller.Session;
using MediaBrowser.Controller.TV; using MediaBrowser.Controller.TV;
using Emby.Dlna.PlayTo;
using Emby.Dlna.Ssdp;
using Microsoft.Extensions.Logging;
using System;
using System.Linq;
using System.Threading.Tasks;
using MediaBrowser.Controller.MediaEncoding;
using MediaBrowser.Model.Dlna; using MediaBrowser.Model.Dlna;
using MediaBrowser.Model.Globalization; using MediaBrowser.Model.Globalization;
using MediaBrowser.Model.Net; using MediaBrowser.Model.Net;
using MediaBrowser.Model.System; using MediaBrowser.Model.System;
using MediaBrowser.Model.Threading; using MediaBrowser.Model.Threading;
using MediaBrowser.Model.Xml; using MediaBrowser.Model.Xml;
using Microsoft.Extensions.Logging;
using Rssdp; using Rssdp;
using Rssdp.Infrastructure; using Rssdp.Infrastructure;
using System.Threading;
namespace Emby.Dlna.Main namespace Emby.Dlna.Main
{ {
@ -282,7 +282,7 @@ namespace Emby.Dlna.Main
SetProperies(device, fullService); SetProperies(device, fullService);
_Publisher.AddDevice(device); _Publisher.AddDevice(device);
var embeddedDevices = new [] var embeddedDevices = new[]
{ {
"urn:schemas-upnp-org:service:ContentDirectory:1", "urn:schemas-upnp-org:service:ContentDirectory:1",
"urn:schemas-upnp-org:service:ConnectionManager:1", "urn:schemas-upnp-org:service:ConnectionManager:1",
@ -308,8 +308,7 @@ namespace Emby.Dlna.Main
private string CreateUuid(string text) private string CreateUuid(string text)
{ {
Guid guid; if (!Guid.TryParse(text, out var guid))
if (!Guid.TryParse(text, out guid))
{ {
guid = text.GetMD5(); guid = text.GetMD5();
} }

View file

@ -1,11 +1,10 @@
using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Configuration;
using Emby.Dlna.Server;
using Emby.Dlna.Service;
using Microsoft.Extensions.Logging;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Emby.Dlna.Service;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Model.Xml; using MediaBrowser.Model.Xml;
using Microsoft.Extensions.Logging;
namespace Emby.Dlna.MediaReceiverRegistrar namespace Emby.Dlna.MediaReceiverRegistrar
{ {
@ -21,7 +20,7 @@ namespace Emby.Dlna.MediaReceiverRegistrar
throw new ResourceNotFoundException("Unexpected control request name: " + methodName); throw new ResourceNotFoundException("Unexpected control request name: " + methodName);
} }
private IEnumerable<KeyValuePair<string, string>> HandleIsAuthorized() private static IEnumerable<KeyValuePair<string, string>> HandleIsAuthorized()
{ {
return new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase) return new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
{ {
@ -29,7 +28,7 @@ namespace Emby.Dlna.MediaReceiverRegistrar
}; };
} }
private IEnumerable<KeyValuePair<string, string>> HandleIsValidated() private static IEnumerable<KeyValuePair<string, string>> HandleIsValidated()
{ {
return new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase) return new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
{ {

View file

@ -1,11 +1,9 @@
using MediaBrowser.Common.Net;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Dlna;
using Emby.Dlna.Service;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using Emby.Dlna.Service;
using MediaBrowser.Common.Net;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Model.Xml; using MediaBrowser.Model.Xml;
using Microsoft.Extensions.Logging;
namespace Emby.Dlna.MediaReceiverRegistrar namespace Emby.Dlna.MediaReceiverRegistrar
{ {

View file

@ -1,6 +1,6 @@
using Emby.Dlna.Common;
using Emby.Dlna.Service;
using System.Collections.Generic; using System.Collections.Generic;
using Emby.Dlna.Common;
using Emby.Dlna.Service;
namespace Emby.Dlna.MediaReceiverRegistrar namespace Emby.Dlna.MediaReceiverRegistrar
{ {
@ -12,7 +12,7 @@ namespace Emby.Dlna.MediaReceiverRegistrar
GetStateVariables()); GetStateVariables());
} }
private IEnumerable<StateVariable> GetStateVariables() private static IEnumerable<StateVariable> GetStateVariables()
{ {
var list = new List<StateVariable>(); var list = new List<StateVariable>();

View file

@ -1,5 +1,5 @@
using Emby.Dlna.Common;
using System.Collections.Generic; using System.Collections.Generic;
using Emby.Dlna.Common;
namespace Emby.Dlna.MediaReceiverRegistrar namespace Emby.Dlna.MediaReceiverRegistrar
{ {
@ -7,7 +7,7 @@ namespace Emby.Dlna.MediaReceiverRegistrar
{ {
public IEnumerable<ServiceAction> GetActions() public IEnumerable<ServiceAction> GetActions()
{ {
return new [] return new[]
{ {
GetIsValidated(), GetIsValidated(),
GetIsAuthorized(), GetIsAuthorized(),
@ -19,7 +19,7 @@ namespace Emby.Dlna.MediaReceiverRegistrar
}; };
} }
private ServiceAction GetIsValidated() private static ServiceAction GetIsValidated()
{ {
var action = new ServiceAction var action = new ServiceAction
{ {
@ -41,7 +41,7 @@ namespace Emby.Dlna.MediaReceiverRegistrar
return action; return action;
} }
private ServiceAction GetIsAuthorized() private static ServiceAction GetIsAuthorized()
{ {
var action = new ServiceAction var action = new ServiceAction
{ {
@ -63,7 +63,7 @@ namespace Emby.Dlna.MediaReceiverRegistrar
return action; return action;
} }
private ServiceAction GetRegisterDevice() private static ServiceAction GetRegisterDevice()
{ {
var action = new ServiceAction var action = new ServiceAction
{ {
@ -85,7 +85,7 @@ namespace Emby.Dlna.MediaReceiverRegistrar
return action; return action;
} }
private ServiceAction GetGetValidationSucceededUpdateID() private static ServiceAction GetGetValidationSucceededUpdateID()
{ {
var action = new ServiceAction var action = new ServiceAction
{ {

View file

@ -1,4 +1,4 @@
using System; using System;
namespace Emby.Dlna.PlayTo namespace Emby.Dlna.PlayTo
{ {

View file

@ -1,21 +1,17 @@
using MediaBrowser.Common.Net;
using MediaBrowser.Controller.Configuration;
using Emby.Dlna.Common;
using Emby.Dlna.Ssdp;
using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Net;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.Linq; using System.Linq;
using System.Net;
using System.Security;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Xml.Linq; using System.Xml.Linq;
using Emby.Dlna.Common;
using Emby.Dlna.Server; using Emby.Dlna.Server;
using Emby.Dlna.Ssdp;
using MediaBrowser.Common.Net;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Model.Threading; using MediaBrowser.Model.Threading;
using MediaBrowser.Model.Extensions; using Microsoft.Extensions.Logging;
namespace Emby.Dlna.PlayTo namespace Emby.Dlna.PlayTo
{ {
@ -39,10 +35,7 @@ namespace Emby.Dlna.PlayTo
RefreshVolumeIfNeeded(); RefreshVolumeIfNeeded();
return _volume; return _volume;
} }
set set => _volume = value;
{
_volume = value;
}
} }
public TimeSpan? Duration { get; set; } public TimeSpan? Duration { get; set; }
@ -50,41 +43,17 @@ namespace Emby.Dlna.PlayTo
private TimeSpan _position = TimeSpan.FromSeconds(0); private TimeSpan _position = TimeSpan.FromSeconds(0);
public TimeSpan Position public TimeSpan Position
{ {
get get => _position;
{ set => _position = value;
return _position;
}
set
{
_position = value;
}
} }
public TRANSPORTSTATE TransportState { get; private set; } public TRANSPORTSTATE TransportState { get; private set; }
public bool IsPlaying public bool IsPlaying => TransportState == TRANSPORTSTATE.PLAYING;
{
get
{
return TransportState == TRANSPORTSTATE.PLAYING;
}
}
public bool IsPaused public bool IsPaused => TransportState == TRANSPORTSTATE.PAUSED || TransportState == TRANSPORTSTATE.PAUSED_PLAYBACK;
{
get
{
return TransportState == TRANSPORTSTATE.PAUSED || TransportState == TRANSPORTSTATE.PAUSED_PLAYBACK;
}
}
public bool IsStopped public bool IsStopped => TransportState == TRANSPORTSTATE.STOPPED;
{
get
{
return TransportState == TRANSPORTSTATE.STOPPED;
}
}
#endregion #endregion
@ -311,7 +280,7 @@ namespace Emby.Dlna.PlayTo
throw new InvalidOperationException("Unable to find service"); throw new InvalidOperationException("Unable to find service");
} }
await new SsdpHttpClient(_httpClient, _config).SendCommandAsync(Properties.BaseUrl, service, command.Name, avCommands.BuildPost(command, service.ServiceType, String.Format("{0:hh}:{0:mm}:{0:ss}", value), "REL_TIME")) await new SsdpHttpClient(_httpClient, _config).SendCommandAsync(Properties.BaseUrl, service, command.Name, avCommands.BuildPost(command, service.ServiceType, string.Format("{0:hh}:{0:mm}:{0:ss}", value), "REL_TIME"))
.ConfigureAwait(false); .ConfigureAwait(false);
RestartTimer(true); RestartTimer(true);
@ -364,7 +333,7 @@ namespace Emby.Dlna.PlayTo
private string CreateDidlMeta(string value) private string CreateDidlMeta(string value)
{ {
if (string.IsNullOrEmpty(value)) if (string.IsNullOrEmpty(value))
return String.Empty; return string.Empty;
return DescriptionXmlBuilder.Escape(value); return DescriptionXmlBuilder.Escape(value);
} }
@ -620,9 +589,7 @@ namespace Emby.Dlna.PlayTo
if (transportStateValue != null) if (transportStateValue != null)
{ {
TRANSPORTSTATE state; if (Enum.TryParse(transportStateValue, true, out TRANSPORTSTATE state))
if (Enum.TryParse(transportStateValue, true, out state))
{ {
return state; return state;
} }
@ -783,7 +750,7 @@ namespace Emby.Dlna.PlayTo
{ {
if (container == null) if (container == null)
{ {
throw new ArgumentNullException("container"); throw new ArgumentNullException(nameof(container));
} }
var url = container.GetValue(uPnpNamespaces.Res); var url = container.GetValue(uPnpNamespaces.Res);
@ -810,7 +777,7 @@ namespace Emby.Dlna.PlayTo
{ {
if (container == null) if (container == null)
{ {
throw new ArgumentNullException("container"); throw new ArgumentNullException(nameof(container));
} }
var resElement = container.Element(uPnpNamespaces.Res); var resElement = container.Element(uPnpNamespaces.Res);
@ -979,7 +946,7 @@ namespace Emby.Dlna.PlayTo
if (modelDescription != null) if (modelDescription != null)
deviceProperties.ModelDescription = modelDescription.Value; deviceProperties.ModelDescription = modelDescription.Value;
deviceProperties.BaseUrl = String.Format("http://{0}:{1}", url.Host, url.Port); deviceProperties.BaseUrl = string.Format("http://{0}:{1}", url.Host, url.Port);
var icon = document.Descendants(uPnpNamespaces.ud.GetName("icon")).FirstOrDefault(); var icon = document.Descendants(uPnpNamespaces.ud.GetName("icon")).FirstOrDefault();
@ -1021,7 +988,7 @@ namespace Emby.Dlna.PlayTo
{ {
if (element == null) if (element == null)
{ {
throw new ArgumentNullException("element"); throw new ArgumentNullException(nameof(element));
} }
var mimeType = element.GetDescendantValue(uPnpNamespaces.ud.GetName("mimetype")); var mimeType = element.GetDescendantValue(uPnpNamespaces.ud.GetName("mimetype"));
@ -1173,7 +1140,7 @@ namespace Emby.Dlna.PlayTo
public override string ToString() public override string ToString()
{ {
return String.Format("{0} - {1}", Properties.Name, Properties.BaseUrl); return string.Format("{0} - {1}", Properties.Name, Properties.BaseUrl);
} }
} }
} }

View file

@ -1,6 +1,6 @@
using Emby.Dlna.Common;
using MediaBrowser.Model.Dlna;
using System.Collections.Generic; using System.Collections.Generic;
using Emby.Dlna.Common;
using MediaBrowser.Model.Dlna;
namespace Emby.Dlna.PlayTo namespace Emby.Dlna.PlayTo
{ {
@ -34,26 +34,14 @@ namespace Emby.Dlna.PlayTo
private string _baseUrl = string.Empty; private string _baseUrl = string.Empty;
public string BaseUrl public string BaseUrl
{ {
get get => _baseUrl;
{ set => _baseUrl = value;
return _baseUrl;
}
set
{
_baseUrl = value;
}
} }
public DeviceIcon Icon { get; set; } public DeviceIcon Icon { get; set; }
private readonly List<DeviceService> _services = new List<DeviceService>(); private readonly List<DeviceService> _services = new List<DeviceService>();
public List<DeviceService> Services public List<DeviceService> Services => _services;
{
get
{
return _services;
}
}
public DeviceIdentification ToDeviceIdentification() public DeviceIdentification ToDeviceIdentification()
{ {

View file

@ -1,28 +1,25 @@
using MediaBrowser.Controller.Dlna;
using MediaBrowser.Controller.Drawing;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Session;
using Emby.Dlna.Didl;
using MediaBrowser.Model.Dlna;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Session;
using MediaBrowser.Model.System;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Emby.Dlna.Didl;
using MediaBrowser.Common.Configuration; using MediaBrowser.Common.Configuration;
using MediaBrowser.Controller.Dlna;
using MediaBrowser.Controller.Drawing;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.MediaEncoding; using MediaBrowser.Controller.MediaEncoding;
using MediaBrowser.Controller.Session;
using MediaBrowser.Model.Dlna;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Events; using MediaBrowser.Model.Events;
using MediaBrowser.Model.Globalization; using MediaBrowser.Model.Globalization;
using MediaBrowser.Model.Extensions;
using System.Net.Http;
using MediaBrowser.Model.Services; using MediaBrowser.Model.Services;
using MediaBrowser.Model.Session;
using Microsoft.Extensions.Logging;
namespace Emby.Dlna.PlayTo namespace Emby.Dlna.PlayTo
{ {
@ -47,18 +44,9 @@ namespace Emby.Dlna.PlayTo
private readonly string _accessToken; private readonly string _accessToken;
private readonly DateTime _creationTime; private readonly DateTime _creationTime;
public bool IsSessionActive public bool IsSessionActive => !_disposed && _device != null;
{
get
{
return !_disposed && _device != null;
}
}
public bool SupportsMediaControl public bool SupportsMediaControl => IsSessionActive;
{
get { return IsSessionActive; }
}
public PlayToController(SessionInfo session, ISessionManager sessionManager, ILibraryManager libraryManager, ILogger logger, IDlnaManager dlnaManager, IUserManager userManager, IImageProcessor imageProcessor, string serverAddress, string accessToken, IDeviceDiscovery deviceDiscovery, IUserDataManager userDataManager, ILocalizationManager localization, IMediaSourceManager mediaSourceManager, IConfigurationManager config, IMediaEncoder mediaEncoder) public PlayToController(SessionInfo session, ISessionManager sessionManager, ILibraryManager libraryManager, ILogger logger, IDlnaManager dlnaManager, IUserManager userManager, IImageProcessor imageProcessor, string serverAddress, string accessToken, IDeviceDiscovery deviceDiscovery, IUserDataManager userDataManager, ILocalizationManager localization, IMediaSourceManager mediaSourceManager, IConfigurationManager config, IMediaEncoder mediaEncoder)
{ {
@ -110,14 +98,11 @@ namespace Emby.Dlna.PlayTo
{ {
var info = e.Argument; var info = e.Argument;
string nts; info.Headers.TryGetValue("NTS", out string nts);
info.Headers.TryGetValue("NTS", out nts);
string usn; if (!info.Headers.TryGetValue("USN", out string usn)) usn = string.Empty;
if (!info.Headers.TryGetValue("USN", out usn)) usn = String.Empty;
string nt; if (!info.Headers.TryGetValue("NT", out string nt)) nt = string.Empty;
if (!info.Headers.TryGetValue("NT", out nt)) nt = String.Empty;
if (usn.IndexOf(_device.Properties.UUID, StringComparison.OrdinalIgnoreCase) != -1 && if (usn.IndexOf(_device.Properties.UUID, StringComparison.OrdinalIgnoreCase) != -1 &&
!_disposed) !_disposed)
@ -439,13 +424,7 @@ namespace Emby.Dlna.PlayTo
private int _currentPlaylistIndex; private int _currentPlaylistIndex;
private readonly List<PlaylistItem> _playlist = new List<PlaylistItem>(); private readonly List<PlaylistItem> _playlist = new List<PlaylistItem>();
private List<PlaylistItem> Playlist private List<PlaylistItem> Playlist => _playlist;
{
get
{
return _playlist;
}
}
private void AddItemFromId(Guid id, List<BaseItem> list) private void AddItemFromId(Guid id, List<BaseItem> list)
{ {
@ -641,9 +620,7 @@ namespace Emby.Dlna.PlayTo
private Task SendGeneralCommand(GeneralCommand command, CancellationToken cancellationToken) private Task SendGeneralCommand(GeneralCommand command, CancellationToken cancellationToken)
{ {
GeneralCommandType commandType; if (Enum.TryParse(command.Name, true, out GeneralCommandType commandType))
if (Enum.TryParse(command.Name, true, out commandType))
{ {
switch (commandType) switch (commandType)
{ {
@ -659,13 +636,9 @@ namespace Emby.Dlna.PlayTo
return _device.ToggleMute(cancellationToken); return _device.ToggleMute(cancellationToken);
case GeneralCommandType.SetAudioStreamIndex: case GeneralCommandType.SetAudioStreamIndex:
{ {
string arg; if (command.Arguments.TryGetValue("Index", out string arg))
if (command.Arguments.TryGetValue("Index", out arg))
{ {
int val; if (int.TryParse(arg, NumberStyles.Integer, _usCulture, out var val))
if (int.TryParse(arg, NumberStyles.Integer, _usCulture, out val))
{ {
return SetAudioStreamIndex(val); return SetAudioStreamIndex(val);
} }
@ -677,13 +650,9 @@ namespace Emby.Dlna.PlayTo
} }
case GeneralCommandType.SetSubtitleStreamIndex: case GeneralCommandType.SetSubtitleStreamIndex:
{ {
string arg; if (command.Arguments.TryGetValue("Index", out string arg))
if (command.Arguments.TryGetValue("Index", out arg))
{ {
int val; if (int.TryParse(arg, NumberStyles.Integer, _usCulture, out var val))
if (int.TryParse(arg, NumberStyles.Integer, _usCulture, out val))
{ {
return SetSubtitleStreamIndex(val); return SetSubtitleStreamIndex(val);
} }
@ -695,13 +664,9 @@ namespace Emby.Dlna.PlayTo
} }
case GeneralCommandType.SetVolume: case GeneralCommandType.SetVolume:
{ {
string arg; if (command.Arguments.TryGetValue("Volume", out string arg))
if (command.Arguments.TryGetValue("Volume", out arg))
{ {
int volume; if (int.TryParse(arg, NumberStyles.Integer, _usCulture, out var volume))
if (int.TryParse(arg, NumberStyles.Integer, _usCulture, out volume))
{ {
return _device.SetVolume(volume, cancellationToken); return _device.SetVolume(volume, cancellationToken);
} }
@ -829,7 +794,7 @@ namespace Emby.Dlna.PlayTo
{ {
if (string.IsNullOrEmpty(url)) if (string.IsNullOrEmpty(url))
{ {
throw new ArgumentNullException("url"); throw new ArgumentNullException(nameof(url));
} }
var parts = url.Split('/'); var parts = url.Split('/');
@ -855,7 +820,7 @@ namespace Emby.Dlna.PlayTo
{ {
if (string.IsNullOrEmpty(url)) if (string.IsNullOrEmpty(url))
{ {
throw new ArgumentNullException("url"); throw new ArgumentNullException(nameof(url));
} }
var request = new StreamParams var request = new StreamParams
@ -896,8 +861,7 @@ namespace Emby.Dlna.PlayTo
{ {
var value = values.Get(name); var value = values.Get(name);
int result; if (int.TryParse(value, NumberStyles.Integer, CultureInfo.InvariantCulture, out var result))
if (int.TryParse(value, NumberStyles.Integer, CultureInfo.InvariantCulture, out result))
{ {
return result; return result;
} }
@ -909,8 +873,7 @@ namespace Emby.Dlna.PlayTo
{ {
var value = values.Get(name); var value = values.Get(name);
long result; if (long.TryParse(value, NumberStyles.Integer, CultureInfo.InvariantCulture, out var result))
if (long.TryParse(value, NumberStyles.Integer, CultureInfo.InvariantCulture, out result))
{ {
return result; return result;
} }

View file

@ -1,26 +1,23 @@
using MediaBrowser.Common.Net; using System;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Common.Net;
using MediaBrowser.Controller; using MediaBrowser.Controller;
using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Dlna; using MediaBrowser.Controller.Dlna;
using MediaBrowser.Controller.Drawing; using MediaBrowser.Controller.Drawing;
using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Session;
using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Session;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using MediaBrowser.Controller.MediaEncoding; using MediaBrowser.Controller.MediaEncoding;
using MediaBrowser.Controller.Session;
using MediaBrowser.Model.Dlna; using MediaBrowser.Model.Dlna;
using MediaBrowser.Model.Events; using MediaBrowser.Model.Events;
using MediaBrowser.Model.Globalization; using MediaBrowser.Model.Globalization;
using MediaBrowser.Model.Net; using MediaBrowser.Model.Net;
using MediaBrowser.Model.Session;
using MediaBrowser.Model.Threading; using MediaBrowser.Model.Threading;
using System.Threading; using Microsoft.Extensions.Logging;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Devices;
namespace Emby.Dlna.PlayTo namespace Emby.Dlna.PlayTo
{ {
@ -81,11 +78,9 @@ namespace Emby.Dlna.PlayTo
var info = e.Argument; var info = e.Argument;
string usn; if (!info.Headers.TryGetValue("USN", out string usn)) usn = string.Empty;
if (!info.Headers.TryGetValue("USN", out usn)) usn = string.Empty;
string nt; if (!info.Headers.TryGetValue("NT", out string nt)) nt = string.Empty;
if (!info.Headers.TryGetValue("NT", out nt)) nt = string.Empty;
string location = info.Location.ToString(); string location = info.Location.ToString();
@ -158,8 +153,7 @@ namespace Emby.Dlna.PlayTo
_logger.LogDebug("Attempting to create PlayToController from location {0}", location); _logger.LogDebug("Attempting to create PlayToController from location {0}", location);
_logger.LogDebug("Logging session activity from location {0}", location); _logger.LogDebug("Logging session activity from location {0}", location);
string uuid; if (info.Headers.TryGetValue("USN", out string uuid))
if (info.Headers.TryGetValue("USN", out uuid))
{ {
uuid = GetUuid(uuid); uuid = GetUuid(uuid);
} }
@ -170,7 +164,7 @@ namespace Emby.Dlna.PlayTo
string deviceName = null; string deviceName = null;
var sessionInfo = _sessionManager.LogSessionActivity("DLNA", _appHost.ApplicationVersion.ToString(), uuid, deviceName, uri.OriginalString, null); var sessionInfo = _sessionManager.LogSessionActivity("DLNA", _appHost.ApplicationVersion, uuid, deviceName, uri.OriginalString, null);
var controller = sessionInfo.SessionControllers.OfType<PlayToController>().FirstOrDefault(); var controller = sessionInfo.SessionControllers.OfType<PlayToController>().FirstOrDefault();

Some files were not shown because too many files have changed in this diff Show more