summaryrefslogtreecommitdiff
path: root/src/core.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core.cpp')
-rw-r--r--src/core.cpp65
1 files changed, 46 insertions, 19 deletions
diff --git a/src/core.cpp b/src/core.cpp
index 551ed2b..2ff79de 100644
--- a/src/core.cpp
+++ b/src/core.cpp
@@ -69,8 +69,6 @@
#define PREF_YT_ENABLED pref->streaming_type == Preferences::StreamingYT || pref->streaming_type == Preferences::StreamingAuto
#endif
-//#define SIMPLE_TRACK_SELECTION
-
using namespace Global;
Core::Core( MplayerWindow *mpw, QWidget* parent )
@@ -1966,9 +1964,14 @@ void Core::startMplayer( QString file, double seek ) {
}
}
- #ifdef SIMPLE_TRACK_SELECTION
+ #if SIMPLE_TRACK_SELECTION
+ #ifdef MPV_SUPPORT
if (proc->isMPV()) {
- // Not working: no info about tracks
+ // Check if the user doesn't want to auto load any subtitle
+ if (!pref->autoload_sub && mset.current_subtitle_track == MediaSettings::NoneSelected) {
+ proc->setOption("sid", "-1");
+ }
+ else
if (mset.current_subtitle_track != MediaSettings::NoneSelected) {
int real_id = mset.subs.IDAt(mset.current_subtitle_track);
proc->setOption("sid", QString::number(real_id));
@@ -1979,7 +1982,10 @@ void Core::startMplayer( QString file, double seek ) {
proc->setOption("secondary-sid", QString::number(real_id));
}
}
- #endif
+ #endif // MPV_SUPPORT
+ if (!pref->alang.isEmpty()) proc->setOption("alang", pref->alang);
+ if (!pref->slang.isEmpty()) proc->setOption("slang", pref->slang);
+ #endif // SIMPLE_TRACK_SELECTION
#endif
#if PROGRAM_SWITCH
@@ -2155,13 +2161,16 @@ void Core::startMplayer( QString file, double seek ) {
if (mdat.type != TYPE_TV) {
// Play A - B
if ((mset.A_marker > -1) && (mset.B_marker > mset.A_marker)) {
- if (proc->isMPV()) {
+ #ifdef MPV_SUPPORT
+ if (proc->isMPV() && !pref->emulate_mplayer_ab_section) {
if (mset.loop) {
proc->setOption("ab-loop-a", QString::number(mset.A_marker));
proc->setOption("ab-loop-b", QString::number(mset.B_marker));
}
proc->setOption("ss", QString::number(seek));
- } else {
+ } else
+ #endif
+ {
proc->setOption("ss", QString::number(mset.A_marker));
proc->setOption("endpos", QString::number(mset.B_marker - mset.A_marker));
}
@@ -2777,9 +2786,12 @@ void Core::setAMarker(int sec) {
mset.A_marker = sec;
displayMessage( tr("\"A\" marker set to %1").arg(Helper::formatTime(sec)) );
- if (proc->isMPV()) {
+ #ifdef MPV_SUPPORT
+ if (proc->isMPV() && !pref->emulate_mplayer_ab_section) {
if (mset.loop) proc->setAMarker(sec);
- } else {
+ } else
+ #endif
+ {
// MPlayer
if (mset.B_marker > mset.A_marker) {
if (proc->isRunning()) restartPlay();
@@ -2799,9 +2811,12 @@ void Core::setBMarker(int sec) {
mset.B_marker = sec;
displayMessage( tr("\"B\" marker set to %1").arg(Helper::formatTime(sec)) );
- if (proc->isMPV()) {
+ #ifdef MPV_SUPPORT
+ if (proc->isMPV() && !pref->emulate_mplayer_ab_section) {
if (mset.loop) proc->setBMarker(sec);
- } else {
+ } else
+ #endif
+ {
// MPlayer
if ((mset.A_marker > -1) && (mset.A_marker < mset.B_marker)) {
if (proc->isRunning()) restartPlay();
@@ -2818,9 +2833,12 @@ void Core::clearABMarkers() {
mset.A_marker = -1;
mset.B_marker = -1;
displayMessage( tr("A-B markers cleared") );
- if (proc->isMPV()) {
+ #ifdef MPV_SUPPORT
+ if (proc->isMPV() && !pref->emulate_mplayer_ab_section) {
proc->clearABMarkers();
- } else {
+ } else
+ #endif
+ {
// MPlayer
if (proc->isRunning()) restartPlay();
}
@@ -2842,7 +2860,8 @@ void Core::toggleRepeat(bool b) {
// Use slave command
int v = -1; // no loop
if (mset.loop) v = 0; // infinite loop
- if (proc->isMPV()) {
+ #ifdef MPV_SUPPORT
+ if (proc->isMPV() && !pref->emulate_mplayer_ab_section) {
// Enable A-B markers
proc->clearABMarkers();
if (b) {
@@ -2850,6 +2869,7 @@ void Core::toggleRepeat(bool b) {
if (mset.B_marker > -1) proc->setBMarker(mset.B_marker);
}
}
+ #endif
proc->setLoop(v);
} else {
// Restart mplayer
@@ -4368,7 +4388,7 @@ void Core::decZoom() {
void Core::showFilenameOnOSD() {
qDebug("Core::showFilenameOnOSD");
- proc->showFilenameOnOSD();
+ proc->showFilenameOnOSD(pref->osd_show_filename_duration);
}
void Core::showMediaInfoOnOSD() {
@@ -4695,7 +4715,7 @@ void Core::initVideoTrack(const Tracks & videos, int selected_id) {
}
#endif
-#ifdef SIMPLE_TRACK_SELECTION
+#if SIMPLE_TRACK_SELECTION
#if NOTIFY_AUDIO_CHANGES
void Core::initAudioTrack(const Tracks & audios, int selected_id) {
@@ -4709,6 +4729,7 @@ void Core::initAudioTrack(const Tracks & audios, int selected_id) {
initializeMenus();
updateWidgets();
+ emit audioTracksChanged();
}
#endif // NOTIFY_AUDIO_CHANGES
@@ -4721,9 +4742,15 @@ void Core::initSubtitleTrack(const SubTracks & subs, int selected_id) {
mset.subs.list();
if (proc->isMPlayer()) {
- bool restore_subs = ((mset.subs.numItems() > 0) ||
- (mset.current_subtitle_track != MediaSettings::NoneSelected));
- if (restore_subs) changeSubtitle(mset.current_subtitle_track);
+ qDebug() << "Core::initSubtitleTrack: current_subtitle_track:" << mset.current_subtitle_track;
+ bool restore_subs = (mset.current_subtitle_track != MediaSettings::NoneSelected);
+ if (restore_subs) {
+ changeSubtitle(mset.current_subtitle_track);
+ } else {
+ if (!pref->autoload_sub) {
+ changeSubtitle(MediaSettings::SubNone);
+ }
+ }
} else {
// MPV
if (selected_id != -1) {