Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MPV media player #225

Merged
merged 3 commits into from
Dec 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions board/batocera/fsoverlay/etc/init.d/S12populateshare
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ fi
# the user can delete the directory, it will recreate the structure
# the user can delete files, files will not be recreated
for FILE in music bios extractions kodi library saves screenshots recordings splash \
roms/mpv \
system/.config/lirc/lircd.conf \
system/configs/emulationstation/es_settings.cfg \
system/configs/emulationstation/about.info \
Expand Down
80 changes: 80 additions & 0 deletions board/batocera/fsoverlay/usr/share/evmapy/mpv.keys
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
{
"actions_player1": [
{
"trigger": "up",
"type": "key",
"target": "KEY_UP"
},
{
"trigger": "down",
"type": "key",
"target": "KEY_DOWN"
},
{
"trigger": "left",
"type": "key",
"target": "KEY_LEFT"
},
{
"trigger": "right",
"type": "key",
"target": "KEY_RIGHT"
},
{
"trigger": "select",
"type": "key",
"target": "KEY_ESC"
},
{
"trigger": "a",
"type": "key",
"target": "KEY_SPACE"
},
{
"trigger": [
"hotkey",
"start"
],
"type": "key",
"target": "KEY_Q"
},
{
"trigger": "b",
"type": "key",
"target": "KEY_O"
},
{
"trigger": "joystick1",
"type": "mouse"
},
{
"trigger": "joystick2",
"type": "mouse"
},
{
"trigger": "pagedown",
"type": "key",
"target": "KEY_PAGEUP"
},
{
"trigger": "pageup",
"type": "key",
"target": "KEY_PAGEDOWN"
},
{
"trigger": "l1",
"type": "key",
"target": ["KEY_LEFTSHIFT", "KEY_PAGEUP"]
},
{
"trigger": "l2",
"type": "key",
"target": ["KEY_LEFTSHIFT", "KEY_PAGEDOWN"]
},
{
"trigger": "x",
"type": "key",
"target": "KEY_J"
}
]
}
11 changes: 11 additions & 0 deletions configs/batocera-a133.board
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,19 @@ BR2_TARGET_ROOTFS_SQUASHFS4_GZIP=y
# batocera splash screen
BR2_PACKAGE_BATOCERA_SPLASH_MPV=y

BR2_PACKAGE_MPV=y

# Batocera system
BR2_PACKAGE_BATOCERA_KODI20=n
#BR2_PACKAGE_BATOCERA_KODI21=n
#BR2_PACKAGE_FLATBUFFERS=y
#BR2_PACKAGE_FSTRCMP=y
#BR2_PACKAGE_LIBASS=y
#BR2_PACKAGE_LIBCROSSGUID=y
#BR2_PACKAGE_LIBDRM=y
#BR2_PACKAGE_LIBPLIST=y
#BR2_PACKAGE_SPDLOG=y
#BR2_PACKAGE_TAGLIB=y

# Bootloader
#BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_VERSION=y
Expand Down
1 change: 1 addition & 0 deletions configs/batocera-h700.board
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ BR2_PACKAGE_BATOCERA_SPLASH_MPV=y

# Batocera system
BR2_PACKAGE_BATOCERA_KODI20=n
BR2_PACKAGE_MPV=y

# Bootloader
#BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_VERSION=y
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from __future__ import annotations

from pathlib import Path
from typing import TYPE_CHECKING

from ... import Command
from ...controller import generate_sdl_game_controller_config, write_sdl_controller_db
from ..Generator import Generator

if TYPE_CHECKING:
from ...types import HotkeysContext


class MpvGenerator(Generator):

def getHotkeysContext(self) -> HotkeysContext:
return {
"name": "shell",
"keys": { "exit": ["KEY_LEFTSHIFT", "KEY_Q"] }
}

def generate(self, system, rom, playersControllers, metadata, guns, wheels, gameResolution):
rom_path = Path(rom)

commandArray = [system.config["emulator"], rom_path, "--fs"]
return Command.Command(array=commandArray)

def getMouseMode(self, config, rom):
return True
Original file line number Diff line number Diff line change
Expand Up @@ -2370,6 +2370,57 @@ fmtowns:
tsugaru:
tsugaru: { requireAnyOf: [BR2_PACKAGE_TSUGARU], incompatible_extensions: [chd, toc, nrg, gdi, cdr, mfi, dfi, hfe, mfm, td0, imd, 1dd, cqm, cqi, dsk, zip, 7z] }

mpv:
name: mpv
manufacturer: Tools
release:
hardware: tool
extensions:
- webm
- mkv
- flv
- f4v
- f4p
- f4a
- f4b
- vob
- ogv
- ogg
- gif
- gifv
- mng
- avi
- mov
- qt
- wmv
- yuv
- rm
- rmvb
- viv
- asf
- mp4
- m4v
- m4p
- mpg
- mp2
- mpeg
- mpe
- mpv
- m2v
- m4v
- svi
- 3gp
- 3g2
- mxf
- roq
- nsv
manufacturer: Misc. System
path: mpv
command: emulatorlauncher %CONTROLLERSCONFIG% -system %SYSTEM% -rom %ROM% -gameinfoxml %GAMEINFOXML% -systemname %SYSTEMNAME% -emulator mpv
emulators:
sh:
sh: { requireAnyOf: [ BR2_PACKAGE_MPV ] }

ports:
name: Ports
manufacturer: Ports
Expand Down