Added IPMPV_HWDEC env var, better error checking, 512k buffer when high latency
This commit is contained in:
parent
2c9059d4e6
commit
a6045ba9ce
BIN
__pycache__/channels.cpython-313.pyc
Normal file
BIN
__pycache__/channels.cpython-313.pyc
Normal file
Binary file not shown.
BIN
__pycache__/osd.cpython-313.pyc
Normal file
BIN
__pycache__/osd.cpython-313.pyc
Normal file
Binary file not shown.
BIN
__pycache__/player.cpython-313.pyc
Normal file
BIN
__pycache__/player.cpython-313.pyc
Normal file
Binary file not shown.
BIN
__pycache__/qt_process.cpython-313.pyc
Normal file
BIN
__pycache__/qt_process.cpython-313.pyc
Normal file
Binary file not shown.
BIN
__pycache__/server.cpython-313.pyc
Normal file
BIN
__pycache__/server.cpython-313.pyc
Normal file
Binary file not shown.
BIN
__pycache__/utils.cpython-313.pyc
Normal file
BIN
__pycache__/utils.cpython-313.pyc
Normal file
Binary file not shown.
BIN
__pycache__/volume.cpython-313.pyc
Normal file
BIN
__pycache__/volume.cpython-313.pyc
Normal file
Binary file not shown.
BIN
__pycache__/volume_osd.cpython-313.pyc
Normal file
BIN
__pycache__/volume_osd.cpython-313.pyc
Normal file
Binary file not shown.
@ -5,6 +5,7 @@ import mpv
|
|||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
import traceback
|
import traceback
|
||||||
|
from utils import hwdec
|
||||||
|
|
||||||
class Player:
|
class Player:
|
||||||
"""MPV player wrapper with IPMPV-specific functionality."""
|
"""MPV player wrapper with IPMPV-specific functionality."""
|
||||||
@ -15,7 +16,7 @@ class Player:
|
|||||||
self.player = mpv.MPV(
|
self.player = mpv.MPV(
|
||||||
log_handler=self.error_check,
|
log_handler=self.error_check,
|
||||||
vo='gpu',
|
vo='gpu',
|
||||||
hwdec='auto-safe',
|
hwdec=hwdec if hwdec is not None else 'auto-safe',
|
||||||
demuxer_lavf_o='reconnect=1',
|
demuxer_lavf_o='reconnect=1',
|
||||||
deinterlace='no',
|
deinterlace='no',
|
||||||
keepaspect='no',
|
keepaspect='no',
|
||||||
@ -44,7 +45,7 @@ class Player:
|
|||||||
def error_check(self, loglevel, component, message):
|
def error_check(self, loglevel, component, message):
|
||||||
"""Check for errors in MPV logs."""
|
"""Check for errors in MPV logs."""
|
||||||
print(f"[{loglevel}] {component}: {message}")
|
print(f"[{loglevel}] {component}: {message}")
|
||||||
if loglevel == 'error' and (component == 'ffmpeg' or component == 'cplayer') and 'Failed' in message:
|
if loglevel == 'error' and (component == 'ffmpeg' or component == 'cplayer') and 'Failed to recognize file format' in message:
|
||||||
self.player.loadfile("./nosignal.png")
|
self.player.loadfile("./nosignal.png")
|
||||||
self.to_qt_queue.put({
|
self.to_qt_queue.put({
|
||||||
'action': 'start_close'
|
'action': 'start_close'
|
||||||
@ -142,7 +143,7 @@ class Player:
|
|||||||
self.player['video-sync'] = 'audio'
|
self.player['video-sync'] = 'audio'
|
||||||
self.player['interpolation'] = 'no'
|
self.player['interpolation'] = 'no'
|
||||||
self.player['video-latency-hacks'] = 'yes' if self.low_latency else 'no'
|
self.player['video-latency-hacks'] = 'yes' if self.low_latency else 'no'
|
||||||
self.player['stream-buffer-size'] = '4k' if self.low_latency else '128k'
|
self.player['stream-buffer-size'] = '4k' if self.low_latency else '512k'
|
||||||
return self.low_latency
|
return self.low_latency
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
|
|||||||
1
utils.py
1
utils.py
@ -10,6 +10,7 @@ is_wayland = "WAYLAND_DISPLAY" in os.environ
|
|||||||
osd_corner_radius = os.environ.get("IPMPV_CORNER_RADIUS")
|
osd_corner_radius = os.environ.get("IPMPV_CORNER_RADIUS")
|
||||||
ipmpv_retroarch_cmd = os.environ.get("IPMPV_RETROARCH_CMD")
|
ipmpv_retroarch_cmd = os.environ.get("IPMPV_RETROARCH_CMD")
|
||||||
m3u_url = os.environ.get('IPMPV_M3U_URL')
|
m3u_url = os.environ.get('IPMPV_M3U_URL')
|
||||||
|
hwdec = os.environ.get('IPMPV_HWDEC')
|
||||||
|
|
||||||
def setup_environment():
|
def setup_environment():
|
||||||
"""Set up environment variables."""
|
"""Set up environment variables."""
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user