Skip to content
Extraits de code Groupes Projets

Video playback with mpv

Fusionnées Kubat a demandé de fusionner mpv vers master
2 files
+ 25
4
Comparer les modifications
  • Côte à côte
  • En ligne

Fichiers

+ 19
4
@@ -104,7 +104,7 @@ MpvContainer::handleMpvEvent(mpv_event *event) noexcept
@@ -104,7 +104,7 @@ MpvContainer::handleMpvEvent(mpv_event *event) noexcept
case MPV_EVENT_LOG_MESSAGE:
case MPV_EVENT_LOG_MESSAGE:
msg = reinterpret_cast<mpv_event_log_message *>(event->data);
msg = reinterpret_cast<mpv_event_log_message *>(event->data);
qDebug() << "MPV message: [" << msg->prefix << "]" << msg->level << ":" << msg->text;
qDebug("MPV - MSG [%s] %s: %s", msg->prefix, msg->level, msg->text);
break;
break;
case MPV_EVENT_PROPERTY_CHANGE:
case MPV_EVENT_PROPERTY_CHANGE:
@@ -142,11 +142,26 @@ MpvContainer::handleMpvEvent(mpv_event *event) noexcept
@@ -142,11 +142,26 @@ MpvContainer::handleMpvEvent(mpv_event *event) noexcept
qDebug() << "MPV: Reached end of file!";
qDebug() << "MPV: Reached end of file!";
break;
break;
 
case MPV_EVENT_COMMAND_REPLY:
 
qDebug() << "Got return of" << event->reply_userdata;
 
switch (static_cast<AsyncCmdType>(event->reply_userdata)) {
 
case AsyncCmdType::None:
 
break;
 
 
case AsyncCmdType::LoadFile:
 
qDebug() << "MPV - CMD: File loaded by mpv";
 
break;
 
 
case AsyncCmdType::TogglePlayback:
 
qDebug() << "MPV - CMD: Playback was toggled";
 
break;
 
}
 
break;
 
// Explicitly ignored
// Explicitly ignored
case MPV_EVENT_NONE:
case MPV_EVENT_NONE:
case MPV_EVENT_GET_PROPERTY_REPLY:
case MPV_EVENT_GET_PROPERTY_REPLY:
case MPV_EVENT_SET_PROPERTY_REPLY:
case MPV_EVENT_SET_PROPERTY_REPLY:
case MPV_EVENT_COMMAND_REPLY:
case MPV_EVENT_FILE_LOADED:
case MPV_EVENT_FILE_LOADED:
case MPV_EVENT_TRACKS_CHANGED:
case MPV_EVENT_TRACKS_CHANGED:
case MPV_EVENT_TRACK_SWITCHED:
case MPV_EVENT_TRACK_SWITCHED:
@@ -184,7 +199,7 @@ MpvContainer::loadFile(const QString &filename) noexcept
@@ -184,7 +199,7 @@ MpvContainer::loadFile(const QString &filename) noexcept
const QByteArray c_filename = filename.toUtf8();
const QByteArray c_filename = filename.toUtf8();
const char *args[] = { "loadfile", c_filename.data(), nullptr };
const char *args[] = { "loadfile", c_filename.data(), nullptr };
printMpvError(mpv_command_async(mpv, 0, args));
printMpvError(mpv_command_async(mpv, AsyncCmdType::LoadFile, args));
}
}
void
void
@@ -214,5 +229,5 @@ void
@@ -214,5 +229,5 @@ void
MpvContainer::mpvTogglePlayback() noexcept
MpvContainer::mpvTogglePlayback() noexcept
{
{
const char *cmd[] = { "cycle", "pause", "up", nullptr };
const char *cmd[] = { "cycle", "pause", "up", nullptr };
printMpvError(mpv_command_async(mpv, 0, cmd));
printMpvError(mpv_command_async(mpv, AsyncCmdType::TogglePlayback, cmd));
}
}
Chargement en cours