Skip to content

Commit

Permalink
Initial commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
yuv420p10le committed Apr 29, 2024
0 parents commit 1230bb4
Show file tree
Hide file tree
Showing 10 changed files with 2,709 additions and 0 deletions.
227 changes: 227 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,227 @@
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
*.userprefs
mono_crash.*
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Ww][Ii][Nn]32/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
[Ll]ogs/
.vs/
Generated\ Files/
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
*.VisualState.xml
TestResult.xml
nunit-*.xml
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
BenchmarkDotNet.Artifacts/
project.lock.json
project.fragment.lock.json
artifacts/
ScaffoldingReadMe.txt
StyleCopReport.xml
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.tlog
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
_Chutzpah*
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
*.psess
*.vsp
*.vspx
*.sap
*.e2e
$tf/
*.gpState
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
_TeamCity*
*.dotCover
.axoCover/*
!.axoCover/settings.json
coverage*.json
coverage*.xml
coverage*.info
*.coverage
*.coveragexml
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
*.mm.*
AutoTest.Net/
.sass-cache/
[Ee]xpress/
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
publish/
*.[Pp]ublish.xml
*.azurePubxml
*.pubxml
*.publishproj
PublishScripts/
*.nupkg*.snupkg**/[Pp]ackages/*!**/[Pp]ackages/build/*.nuget.props
*.nuget.targets
csx/
*.build.csdef
ecf/
rcf/
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload*.[Cc]ache!?*.[Cc]ache/
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
Generated_Code/
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
*.mdf
*.ldf
*.ndf
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl
FakesAssemblies/
*.GhostDoc.xml
.ntvs_analysis.dat
node_modules/
*.plg
*.opt
*.vbw
*.vbp
*.dsw
*.dsp
*.ncb
*.aps
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
.paket/paket.exe
paket-files/
.fake/
.cr/personal
__pycache__/
*.pyc
*.tss
*.jmconfig
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
OpenCover/
ASALocalRun/
*.binlog
*.nvuser
.mfractor/
.localhistory/
.vshistory/
healthchecksdb
MigrationBackup/
.ionide/
FodyWeavers.xsd
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace
.history/
*.cab
*.msi
*.msix
*.msm
*.msp
*.sln.iml
*.d
*.slo
*.lo
*.o
*.obj
*.gch
*.pch
*.so
*.dylib
*.dll
*.mod
*.smod
*.lai
*.la
*.a
*.lib
*.exe
*.out
*.app
52 changes: 52 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# plex_loadfile_hook

[This commit on mpv](https://github.com/mpv-player/mpv/commit/c678033c1d60b48ae02fbbe4815869b9504a17f6) broke backwards compatbility with how Plex utilizes the `loadfile` command to play video.

Why is this an issue? Plex uses an incredibly old version of libmpv which lacks many new improvements, most notable one being Dolby Vision tonemapping (either to SDR/HDR) via the `gpu-next` video output driver. Other good reasons include improved support for graphic APIs, ASS performance improvements and the better `high-quality` preset being included.

## How this works

A detour is placed on `mpv_command_node` from `libmpv.dll`, reducing the `loadfile` command to only have 1 argument; the playback URL.
This release makes use of DLL proxying to inject `plex_loadfile_hook` when Plex loads Direct3D 11.

## Installation

Windows only. Binaries provided for x86_64, but it should work for 32-bit as well.

1. Download `d3d11.dll` from [the latest release](https://github.com/yuv420p10le/plex_loadfile_hook/releases/latest) and put it in your Plex installation folder. (e.g. `C:\Program Files\Plex\Plex`)
2. Grab the latest `libmpv` build from [shinchiro's provided builds](https://sourceforge.net/projects/mpv-player-windows/files/libmpv/), rename `libmpv-2.dll` to `mpv-2.dll`, and replace `mpv-2.dll` in the Plex installation folder with it.

## Use new settings

Open `%LOCALAPPDATA%\Plex` and start adding settings to `mpv.conf`.

I recommend the following as a basis:

```conf
# The new video output driver; allowing better color management and support for DV/HDR tonemapping.
vo=gpu-next
# A preset for higher quality playback.
profile=high-quality
# Refer to the manual; too long to elaborate. Replace with your own choice if needed, but this is a good generic option.
hwdec=auto-safe
# Allows for HDR passthrough & automatically setting the display to HDR mode, when using the Vulkan API.
target-colorspace-hint=yes
# Replace with gpu-api=d3d11 if you're having issues.
# vulkan will allow automatic switching to HDR when playing DV content, and will display DV tonemapped to HDR.
gpu-api=vulkan
# Replace with your display's bit depth. Will be 8 for most SDR displays, and 10/12 for most HDR/DV supporting ones.
dither-depth=10
```

Refer to the mpv manual (linked in resources) for additional settings.

### Resources

* [mpv manual](https://mpv.io/manual/stable/)
* [perfect-dll-proxy](https://github.com/mrexodia/perfect-dll-proxy)
* [MinHook](https://github.com/TsudaKageyu/minhook)
Loading

0 comments on commit 1230bb4

Please sign in to comment.