Outlining MPV support, shifting to Drone CI
This commit is contained in:
parent
d9ccb3a90a
commit
77f31dfb50
9 changed files with 127 additions and 53 deletions
18
.drone.yml
Normal file
18
.drone.yml
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: default
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: test
|
||||||
|
image: maven:3-jdk-11
|
||||||
|
commands:
|
||||||
|
- mvn -B -DskipTests clean package
|
||||||
|
- mvn test -B
|
||||||
|
volumes:
|
||||||
|
- name: m2
|
||||||
|
path: /root/.m2
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
- name: m2
|
||||||
|
host:
|
||||||
|
path: /m2
|
|
@ -1,6 +1,6 @@
|
||||||
# mplayer4anime
|
# mplayer4anime
|
||||||
|
|
||||||
![License](https://img.shields.io/badge/License-GPLv3-blue.svg) ![Releases](https://img.shields.io/github/downloads/developersu/mplayer4anime/total.svg) ![CI](https://img.shields.io/jenkins/build?jobUrl=https%3A%2F%2Fredrise.ru%2Fjen%2Fjob%2Fmplayer4anime%2Fjob%2Fmaster%2F)
|
![License](https://img.shields.io/badge/License-GPLv3-blue.svg) ![Releases](https://img.shields.io/github/downloads/developersu/mplayer4anime/total.svg) [![Build Status](https://ci.redrise.ru/api/badges/desu/mplayer4anime/status.svg)](https://ci.redrise.ru/desu/mplayer4anime)
|
||||||
|
|
||||||
mplayer4anime is mplayer launcher to play video file with audio layer and/or subtitles (.ass, .srt, etc.) at once.
|
mplayer4anime is mplayer launcher to play video file with audio layer and/or subtitles (.ass, .srt, etc.) at once.
|
||||||
|
|
||||||
|
|
|
@ -20,54 +20,21 @@ package mplayer4anime.mpv;
|
||||||
|
|
||||||
import com.sun.jna.ptr.IntByReference;
|
import com.sun.jna.ptr.IntByReference;
|
||||||
import mplayer4anime.ui.ServiceWindow;
|
import mplayer4anime.ui.ServiceWindow;
|
||||||
|
import static mplayer4anime.mpv.Mpv_Events.*;
|
||||||
|
import static mplayer4anime.mpv.Mpv_Format.*;
|
||||||
|
|
||||||
public class MpvProcess implements Runnable{
|
public class MpvProcess implements Runnable{
|
||||||
private String videoFilename;
|
private final String videoFilename;
|
||||||
|
private final String audioFilename;
|
||||||
|
private final String subsFilename;
|
||||||
|
|
||||||
private final LibC libC = LibC.INSTANCE;
|
private final LibC libC = LibC.INSTANCE;
|
||||||
private final LibMpv libMpv = LibMpv.INSTANCE;
|
private final LibMpv libMpv = LibMpv.INSTANCE;
|
||||||
|
|
||||||
/** MPV_FORMAT*/
|
MpvProcess(String videoFilename, String audioFilename, String subsFilename){
|
||||||
private final int MPV_FORMAT_NONE = 0;
|
this.videoFilename = videoFilename;
|
||||||
private final int MPV_FORMAT_STRING = 1;
|
this.audioFilename = audioFilename;
|
||||||
private final int MPV_FORMAT_OSD_STRING = 2;
|
this.subsFilename = subsFilename;
|
||||||
private final int MPV_FORMAT_FLAG = 3;
|
|
||||||
private final int MPV_FORMAT_INT64 = 4;
|
|
||||||
private final int MPV_FORMAT_DOUBLE = 5;
|
|
||||||
private final int MPV_FORMAT_NODE = 6;
|
|
||||||
private final int MPV_FORMAT_NODE_ARRAY = 7;
|
|
||||||
private final int MPV_FORMAT_NODE_MAP = 8;
|
|
||||||
private final int MPV_FORMAT_BYTE_ARRAY = 9;
|
|
||||||
|
|
||||||
/** mpv_event_id */
|
|
||||||
private final int MPV_EVENT_NONE = 0;
|
|
||||||
private final int MPV_EVENT_SHUTDOWN = 1;
|
|
||||||
private final int MPV_EVENT_LOG_MESSAGE = 2;
|
|
||||||
private final int MPV_EVENT_GET_PROPERTY_REPLY = 3;
|
|
||||||
private final int MPV_EVENT_SET_PROPERTY_REPLY = 4;
|
|
||||||
private final int MPV_EVENT_COMMAND_REPLY = 5;
|
|
||||||
private final int MPV_EVENT_START_FILE = 6;
|
|
||||||
private final int MPV_EVENT_END_FILE = 7;
|
|
||||||
private final int MPV_EVENT_FILE_LOADED = 8;
|
|
||||||
private final int MPV_EVENT_TRACKS_CHANGED = 9;//DEPRECATED
|
|
||||||
private final int MPV_EVENT_TRACK_SWITCHED = 10;//DEPRECATED
|
|
||||||
private final int MPV_EVENT_IDLE = 11;//DEPRECATED
|
|
||||||
private final int MPV_EVENT_PAUSE = 12;//DEPRECATED
|
|
||||||
private final int MPV_EVENT_UNPAUSE = 13;//DEPRECATED
|
|
||||||
private final int MPV_EVENT_TICK = 14;//DEPRECATED
|
|
||||||
private final int MPV_EVENT_SCRIPT_INPUT_DISPATCH = 15;//DEPRECATED
|
|
||||||
private final int MPV_EVENT_CLIENT_MESSAGE = 16;
|
|
||||||
private final int MPV_EVENT_VIDEO_RECONFIG = 17;
|
|
||||||
private final int MPV_EVENT_AUDIO_RECONFIG = 18;
|
|
||||||
private final int MPV_EVENT_METADATA_UPDATE = 19;//DEPRECATED
|
|
||||||
private final int MPV_EVENT_SEEK = 20;
|
|
||||||
private final int MPV_EVENT_PLAYBACK_RESTART = 21;
|
|
||||||
private final int MPV_EVENT_PROPERTY_CHANGE = 22;
|
|
||||||
private final int MPV_EVENT_CHAPTER_CHANGE = 23;//DEPRECATED
|
|
||||||
private final int MPV_EVENT_QUEUE_OVERFLOW = 24;
|
|
||||||
private final int MPV_EVENT_HOOK = 25;
|
|
||||||
|
|
||||||
MpvProcess(String filename){
|
|
||||||
this.videoFilename = filename;
|
|
||||||
libC.setlocale(LibC.LC_NUMERIC, "C"); //Somehow it's important
|
libC.setlocale(LibC.LC_NUMERIC, "C"); //Somehow it's important
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,14 +48,20 @@ public class MpvProcess implements Runnable{
|
||||||
libMpv.mpv_set_option_string(ctx, "input-default-bindings", "yes");
|
libMpv.mpv_set_option_string(ctx, "input-default-bindings", "yes");
|
||||||
libMpv.mpv_set_option_string(ctx, "input-vo-keyboard", "yes");
|
libMpv.mpv_set_option_string(ctx, "input-vo-keyboard", "yes");
|
||||||
IntByReference value = new IntByReference(1);
|
IntByReference value = new IntByReference(1);
|
||||||
libMpv.mpv_set_option(ctx, "osc", MPV_FORMAT_FLAG, value);
|
libMpv.mpv_set_option(ctx, "osc", MPV_FORMAT_FLAG.ordinal(), value);
|
||||||
libMpv.mpv_initialize(ctx);
|
libMpv.mpv_initialize(ctx);
|
||||||
libMpv.mpv_command(ctx, new String[]{"loadfile", videoFilename, null});
|
|
||||||
|
libMpv.mpv_command(ctx, new String[]{"loadfile", videoFilename});
|
||||||
|
//libMpv.mpv_command(ctx, new String[]{"audio-add", audioFilename});
|
||||||
|
//libMpv.mpv_command(ctx, new String[]{"subs-add", subsFilename});
|
||||||
while (true){
|
while (true){
|
||||||
mpv_event event = libMpv.mpv_wait_event(ctx, 10000);
|
mpv_event event = libMpv.mpv_wait_event(ctx, 10000);
|
||||||
if (event.event_id == MPV_EVENT_SHUTDOWN)
|
if (event.event_id == MPV_EVENT_SHUTDOWN.ordinal())
|
||||||
break;
|
break;
|
||||||
System.out.println(event.event_id);
|
System.out.println(Mpv_Events.values()[event.event_id].name());
|
||||||
|
|
||||||
|
if (event.event_id == MPV_EVENT_START_FILE.ordinal())
|
||||||
|
libMpv.mpv_command(ctx, new String[]{"audio-add", audioFilename});
|
||||||
}
|
}
|
||||||
libMpv.mpv_terminate_destroy(ctx);
|
libMpv.mpv_terminate_destroy(ctx);
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,7 @@ public class MpvSlave implements ISlaveModeAppOrchestration {
|
||||||
boolean subtitlesHidden,
|
boolean subtitlesHidden,
|
||||||
boolean isFullscreen) {
|
boolean isFullscreen) {
|
||||||
//TODO: fix
|
//TODO: fix
|
||||||
Thread thread = new Thread(new MpvProcess(VideoFile));
|
Thread thread = new Thread(new MpvProcess(VideoFile, AudioFile, SubtitlesFile));
|
||||||
thread.start();
|
thread.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
48
src/main/java/mplayer4anime/mpv/Mpv_Events.java
Normal file
48
src/main/java/mplayer4anime/mpv/Mpv_Events.java
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
/*
|
||||||
|
Copyright 2018-2021 Dmitry Isaenko
|
||||||
|
|
||||||
|
This file is part of mplayer4anime.
|
||||||
|
|
||||||
|
mplayer4anime is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
mplayer4anime is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with mplayer4anime. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package mplayer4anime.mpv;
|
||||||
|
|
||||||
|
public enum Mpv_Events {
|
||||||
|
MPV_EVENT_NONE,//0
|
||||||
|
MPV_EVENT_SHUTDOWN,//1
|
||||||
|
MPV_EVENT_LOG_MESSAGE,//2
|
||||||
|
MPV_EVENT_GET_PROPERTY_REPLY,//3
|
||||||
|
MPV_EVENT_SET_PROPERTY_REPLY,//4
|
||||||
|
MPV_EVENT_COMMAND_REPLY,//5
|
||||||
|
MPV_EVENT_START_FILE,//6
|
||||||
|
MPV_EVENT_END_FILE,//7
|
||||||
|
MPV_EVENT_FILE_LOADED,//8
|
||||||
|
MPV_EVENT_TRACKS_CHANGED,//9 DEPRECATED
|
||||||
|
MPV_EVENT_TRACK_SWITCHED,//10 DEPRECATED
|
||||||
|
MPV_EVENT_IDLE,//11 DEPRECATED
|
||||||
|
MPV_EVENT_PAUSE,//12 DEPRECATED
|
||||||
|
MPV_EVENT_UNPAUSE,//13 DEPRECATED
|
||||||
|
MPV_EVENT_TICK,//14 DEPRECATED
|
||||||
|
MPV_EVENT_SCRIPT_INPUT_DISPATCH,//15 DEPRECATED
|
||||||
|
MPV_EVENT_CLIENT_MESSAGE,//16
|
||||||
|
MPV_EVENT_VIDEO_RECONFIG,//17
|
||||||
|
MPV_EVENT_AUDIO_RECONFIG,//18
|
||||||
|
MPV_EVENT_METADATA_UPDATE,//19 DEPRECATED
|
||||||
|
MPV_EVENT_SEEK,//20
|
||||||
|
MPV_EVENT_PLAYBACK_RESTART,//21
|
||||||
|
MPV_EVENT_PROPERTY_CHANGE,//22
|
||||||
|
MPV_EVENT_CHAPTER_CHANGE,//23 DEPRECATED
|
||||||
|
MPV_EVENT_QUEUE_OVERFLOW,//24
|
||||||
|
MPV_EVENT_HOOK,//25 ;
|
||||||
|
}
|
32
src/main/java/mplayer4anime/mpv/Mpv_Format.java
Normal file
32
src/main/java/mplayer4anime/mpv/Mpv_Format.java
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
/*
|
||||||
|
Copyright 2018-2021 Dmitry Isaenko
|
||||||
|
|
||||||
|
This file is part of mplayer4anime.
|
||||||
|
|
||||||
|
mplayer4anime is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
mplayer4anime is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with mplayer4anime. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package mplayer4anime.mpv;
|
||||||
|
|
||||||
|
public enum Mpv_Format {
|
||||||
|
MPV_FORMAT_NONE, //0;
|
||||||
|
MPV_FORMAT_STRING, //1;
|
||||||
|
MPV_FORMAT_OSD_STRING, //2;
|
||||||
|
MPV_FORMAT_FLAG, //3;
|
||||||
|
MPV_FORMAT_INT64, //4;
|
||||||
|
MPV_FORMAT_DOUBLE, //5;
|
||||||
|
MPV_FORMAT_NODE, //6;
|
||||||
|
MPV_FORMAT_NODE_ARRAY, //7;
|
||||||
|
MPV_FORMAT_NODE_MAP, //8;
|
||||||
|
MPV_FORMAT_BYTE_ARRAY; //9;
|
||||||
|
}
|
|
@ -90,8 +90,8 @@ public class Playlists {
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Interface for Opening playlists via FileChooser
|
* Interface for Opening playlists via FileChooser
|
||||||
* */
|
**/
|
||||||
public static JsonStorage Read(ResourceBundle resourceBundle){
|
public static JsonStorage OpenPlaylistFileChooser(ResourceBundle resourceBundle){
|
||||||
File playlistFile;
|
File playlistFile;
|
||||||
FileChooser fileChooser = new FileChooser();
|
FileChooser fileChooser = new FileChooser();
|
||||||
|
|
||||||
|
|
|
@ -108,6 +108,9 @@ public class LandingController implements Initializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
playerToolbarController.initializeMainUiController(this);
|
playerToolbarController.initializeMainUiController(this);
|
||||||
|
/*
|
||||||
|
Playlists.ReadByPath(resourceBundle, playListFile);
|
||||||
|
* */
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHostServices(HostServices hostServices) {
|
public void setHostServices(HostServices hostServices) {
|
||||||
|
@ -167,7 +170,7 @@ public class LandingController implements Initializable {
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private void openBtn() {
|
private void openBtn() {
|
||||||
JsonStorage jsonStorage = Playlists.Read(resourceBundle);
|
JsonStorage jsonStorage = Playlists.OpenPlaylistFileChooser(resourceBundle);
|
||||||
setAllLists(jsonStorage);
|
setAllLists(jsonStorage);
|
||||||
}
|
}
|
||||||
private void setAllLists(JsonStorage jsonStorage){
|
private void setAllLists(JsonStorage jsonStorage){
|
||||||
|
|
|
@ -151,7 +151,7 @@ public class ControllerPane implements Initializable {
|
||||||
lowerAndUpperExts.add(s);
|
lowerAndUpperExts.add(s);
|
||||||
lowerAndUpperExts.add(s.toUpperCase());
|
lowerAndUpperExts.add(s.toUpperCase());
|
||||||
}
|
}
|
||||||
String[] filesExtension = lowerAndUpperExts.toArray(new String[lowerAndUpperExts.size()]);
|
String[] filesExtension = lowerAndUpperExts.toArray(new String[0]);
|
||||||
|
|
||||||
File directoryReceived; // Store files (folder) received from selector
|
File directoryReceived; // Store files (folder) received from selector
|
||||||
DirectoryChooser dirSelect;
|
DirectoryChooser dirSelect;
|
||||||
|
|
Loading…
Reference in a new issue