Skip to content
GitLab
Explorer
Connexion
Navigation principale
Rechercher ou aller à…
Projet
Vivy
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Wiki
Wiki externe
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Compilation
Pipelines
Jobs
Planifications de pipeline
Artéfacts
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté GitLab
Contribuer à GitLab
Donner votre avis
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
Elliu
Vivy
Validations
1c895ed5
Vérifiée
Valider
1c895ed5
rédigé
Il y a 3 ans
par
Kubat
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
MPV: The video is now correctly loading when loading a document!
parent
0959953b
Aucune branche associée trouvée
Aucune étiquette associée trouvée
1 requête de fusion
!18
Implement the VivyDocument specification
Modifications
2
Afficher les modifications d'espaces
En ligne
Côte à côte
Affichage de
2 fichiers modifiés
src/UI/DocumentViews/MpvContainer.cc
+9
-8
9 ajouts, 8 suppressions
src/UI/DocumentViews/MpvContainer.cc
src/UI/DocumentViews/MpvContainer.hh
+4
-3
4 ajouts, 3 suppressions
src/UI/DocumentViews/MpvContainer.hh
avec
13 ajouts
et
11 suppressions
src/UI/DocumentViews/MpvContainer.cc
+
9
−
8
Voir le fichier @
1c895ed5
...
@@ -77,7 +77,7 @@ MpvContainer::closeMpv() noexcept
...
@@ -77,7 +77,7 @@ MpvContainer::closeMpv() noexcept
MpvContainer
::~
MpvContainer
()
noexcept
{
closeMpv
();
}
MpvContainer
::~
MpvContainer
()
noexcept
{
closeMpv
();
}
void
void
MpvContainer
::
handleMpvEvent
(
mpv_event
*
event
)
noexcept
MpvContainer
::
handleMpvEvent
(
const
mpv_event
*
const
event
)
noexcept
{
{
// Declare here variables that can be used in the switch-case statements
// Declare here variables that can be used in the switch-case statements
qint64
w
,
h
;
qint64
w
,
h
;
...
@@ -88,8 +88,8 @@ MpvContainer::handleMpvEvent(mpv_event *event) noexcept
...
@@ -88,8 +88,8 @@ MpvContainer::handleMpvEvent(mpv_event *event) noexcept
mpv_event_property
*
prop
;
mpv_event_property
*
prop
;
};
};
auto
checkProp
=
[](
mpv_event_property
*
prop_
,
const
std
::
string
&
str
,
auto
checkProp
=
[](
const
mpv_event_property
*
const
prop_
,
const
std
::
string
_view
str
,
int
format
)
noexcept
->
bool
{
const
int
format
)
noexcept
->
bool
{
return
(
prop_
->
name
==
str
)
&&
(
prop_
->
format
==
format
);
return
(
prop_
->
name
==
str
)
&&
(
prop_
->
format
==
format
);
};
};
...
@@ -114,17 +114,17 @@ MpvContainer::handleMpvEvent(mpv_event *event) noexcept
...
@@ -114,17 +114,17 @@ MpvContainer::handleMpvEvent(mpv_event *event) noexcept
case
MPV_EVENT_PROPERTY_CHANGE
:
case
MPV_EVENT_PROPERTY_CHANGE
:
prop
=
reinterpret_cast
<
mpv_event_property
*>
(
event
->
data
);
prop
=
reinterpret_cast
<
mpv_event_property
*>
(
event
->
data
);
if
(
checkProp
(
prop
,
"time-pos"
s
,
MPV_FORMAT_DOUBLE
)
&&
mpvTimeCallback
)
{
if
(
checkProp
(
prop
,
"time-pos"
,
MPV_FORMAT_DOUBLE
)
&&
mpvTimeCallback
)
{
time
=
*
reinterpret_cast
<
double
*>
(
prop
->
data
);
time
=
*
reinterpret_cast
<
double
*>
(
prop
->
data
);
mpvTimeCallback
(
time
);
mpvTimeCallback
(
time
);
}
}
else
if
(
checkProp
(
prop
,
"duration"
s
,
MPV_FORMAT_DOUBLE
)
&&
mpvDurationCallback
)
{
else
if
(
checkProp
(
prop
,
"duration"
,
MPV_FORMAT_DOUBLE
)
&&
mpvDurationCallback
)
{
time
=
*
reinterpret_cast
<
double
*>
(
prop
->
data
);
time
=
*
reinterpret_cast
<
double
*>
(
prop
->
data
);
mpvDurationCallback
(
time
);
mpvDurationCallback
(
time
);
}
}
else
if
(
checkProp
(
prop
,
"pause"
s
,
MPV_FORMAT_FLAG
))
{
else
if
(
checkProp
(
prop
,
"pause"
,
MPV_FORMAT_FLAG
))
{
isPlaybackPaused
=
*
reinterpret_cast
<
bool
*>
(
prop
->
data
);
isPlaybackPaused
=
*
reinterpret_cast
<
bool
*>
(
prop
->
data
);
emit
mpvPlaybackToggled
(
!
isPlaybackPaused
);
emit
mpvPlaybackToggled
(
!
isPlaybackPaused
);
qDebug
()
<<
"MPV -> set to"
<<
(
isPlaybackPaused
?
"pause"
:
"play"
);
qDebug
()
<<
"MPV -> set to"
<<
(
isPlaybackPaused
?
"pause"
:
"play"
);
...
@@ -220,7 +220,7 @@ void
...
@@ -220,7 +220,7 @@ void
MpvContainer
::
onMpvEvent
()
noexcept
MpvContainer
::
onMpvEvent
()
noexcept
{
{
while
(
mpv
)
{
while
(
mpv
)
{
mpv_event
*
event
=
mpv_wait_event
(
mpv
,
0
);
const
mpv_event
*
const
event
=
mpv_wait_event
(
mpv
,
0
);
if
(
event
==
nullptr
||
event
->
event_id
==
MPV_EVENT_NONE
)
if
(
event
==
nullptr
||
event
->
event_id
==
MPV_EVENT_NONE
)
break
;
break
;
handleMpvEvent
(
event
);
handleMpvEvent
(
event
);
...
@@ -234,7 +234,8 @@ MpvContainer::onMpvEvent() noexcept
...
@@ -234,7 +234,8 @@ MpvContainer::onMpvEvent() noexcept
void
void
MpvContainer
::
loadFile
(
const
QString
&
filename
)
noexcept
MpvContainer
::
loadFile
(
const
QString
&
filename
)
noexcept
{
{
if
(
filename
.
isEmpty
())
qDebug
()
<<
"Loading file"
<<
filename
;
if
(
filename
.
size
()
==
0
)
return
;
return
;
const
QByteArray
cFileName
=
filename
.
toUtf8
();
const
QByteArray
cFileName
=
filename
.
toUtf8
();
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
src/UI/DocumentViews/MpvContainer.hh
+
4
−
3
Voir le fichier @
1c895ed5
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
#include
<functional>
#include
<functional>
#include
<initializer_list>
#include
<initializer_list>
#include
<QThread>
extern
"C"
{
extern
"C"
{
struct
mpv_handle
;
struct
mpv_handle
;
...
@@ -27,12 +28,12 @@ class MpvContainer final : public QWidget {
...
@@ -27,12 +28,12 @@ class MpvContainer final : public QWidget {
ReloadAss
,
ReloadAss
,
UnloadAss
,
UnloadAss
,
SeekTime
,
SeekTime
,
TogglePlayback
,
TogglePlayback
};
};
private
:
private
:
bool
isPlaybackPaused
{
true
};
bool
isPlaybackPaused
{
true
};
mpv_handle
*
mpv
{
nullptr
};
mpv_handle
*
volatile
mpv
{
nullptr
};
qint64
sid
{
-
1
};
qint64
sid
{
-
1
};
std
::
function
<
void
(
double
)
>
mpvTimeCallback
{
nullptr
};
std
::
function
<
void
(
double
)
>
mpvTimeCallback
{
nullptr
};
std
::
function
<
void
(
double
)
>
mpvDurationCallback
{
nullptr
};
std
::
function
<
void
(
double
)
>
mpvDurationCallback
{
nullptr
};
...
@@ -53,7 +54,7 @@ public:
...
@@ -53,7 +54,7 @@ public:
void
registerMpvDurationCallback
(
std
::
function
<
void
(
double
)
>
)
noexcept
;
void
registerMpvDurationCallback
(
std
::
function
<
void
(
double
)
>
)
noexcept
;
private
:
private
:
void
handleMpvEvent
(
mpv_event
*
)
noexcept
;
void
handleMpvEvent
(
const
mpv_event
*
const
)
noexcept
;
void
closeMpv
()
noexcept
;
void
closeMpv
()
noexcept
;
void
printMpvError
(
int
)
const
noexcept
;
void
printMpvError
(
int
)
const
noexcept
;
void
asyncCommand
(
const
AsyncCmdType
,
std
::
initializer_list
<
const
char
*>
)
noexcept
;
void
asyncCommand
(
const
AsyncCmdType
,
std
::
initializer_list
<
const
char
*>
)
noexcept
;
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
Aperçu
0%
Chargement en cours
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter