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é
Contribuer à GitLab
Donner votre avis
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
Elliu
Vivy
Validations
816d1c34
Vérifiée
Valider
816d1c34
rédigé
3 years ago
par
Kubat
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
LIB: Add the VideoContext to the VideoSubDocument
parent
f4e04ba8
Aucune branche associée trouvée
Aucune étiquette associée trouvée
1 requête de fusion
!18
Implement the VivyDocument specification
Modifications
2
Masquer les modifications d'espaces
En ligne
Côte à côte
Affichage de
2 fichiers modifiés
src/Lib/Document/CRTPSubDocument.hh
+7
-5
7 ajouts, 5 suppressions
src/Lib/Document/CRTPSubDocument.hh
src/Lib/Document/CRTPSubDocument/VideoSubDocument.cc
+44
-2
44 ajouts, 2 suppressions
src/Lib/Document/CRTPSubDocument/VideoSubDocument.cc
avec
51 ajouts
et
7 suppressions
src/Lib/Document/CRTPSubDocument.hh
+
7
−
5
Voir le fichier @
816d1c34
...
...
@@ -7,6 +7,7 @@
#include
"../Utils.hh"
#include
"../Audio.hh"
#include
"../Video.hh"
#include
"../Ass/Ass.hh"
namespace
Vivy
...
...
@@ -52,17 +53,14 @@ public:
// Audio document
class
AudioSubDocument
final
:
public
CRTPSubDocument
<
AudioDocumentType
,
AudioSubDocument
>
{
private:
const
QStringList
&
suffixList
=
Vivy
::
Utils
::
audioFileSuffix
;
std
::
unique_ptr
<
AudioContext
>
contextPtr
{
nullptr
};
void
initFromPath
(
const
QString
&
);
explicit
AudioSubDocument
()
=
default
;
friend
CRTPSubDocument
<
AudioDocumentType
,
AudioSubDocument
>
;
private:
std
::
unique_ptr
<
AudioContext
>
contextPtr
;
public
:
int
getDefaultStreamIndex
()
const
noexcept
;
AudioContext
::
StreamPtr
getDefaultStream
()
const
noexcept
;
...
...
@@ -74,8 +72,8 @@ public:
// Video document
class
VideoSubDocument
final
:
public
CRTPSubDocument
<
VideoDocumentType
,
VideoSubDocument
>
{
private:
const
QStringList
&
suffixList
=
Vivy
::
Utils
::
videoFileSuffix
;
std
::
unique_ptr
<
VideoContext
>
contextPtr
{
nullptr
};
void
initFromPath
(
const
QString
&
);
...
...
@@ -83,6 +81,10 @@ private:
friend
CRTPSubDocument
<
VideoDocumentType
,
VideoSubDocument
>
;
public
:
int
getDefaultStreamIndex
()
const
noexcept
;
VideoContext
::
StreamPtr
getDefaultStream
()
const
noexcept
;
VideoContext
::
StreamPtr
getStream
(
int
index
)
const
noexcept
;
QString
getElementName
()
const
noexcept
;
QJsonDocument
getProperties
()
const
noexcept
;
};
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
src/Lib/Document/CRTPSubDocument/VideoSubDocument.cc
+
44
−
2
Voir le fichier @
816d1c34
...
...
@@ -2,10 +2,49 @@
using
namespace
Vivy
;
// Get the default stream index or -1 if not possible
int
VideoSubDocument
::
getDefaultStreamIndex
()
const
noexcept
{
if
(
auto
ptr
=
getDefaultStream
())
{
return
ptr
->
getStreamIndex
();
}
else
{
return
-
1
;
}
}
// Get a pointer to the default stream, nullptr if not possible
VideoContext
::
StreamPtr
VideoSubDocument
::
getDefaultStream
()
const
noexcept
{
if
(
auto
ptr
=
contextPtr
->
getDefaultStream
().
lock
())
{
return
ptr
;
}
else
{
qCritical
()
<<
"Document deleted!"
;
return
nullptr
;
}
}
// Get the stream asked for, nullptr if no stream or if the index is invalid
VideoContext
::
StreamPtr
VideoSubDocument
::
getStream
(
int
index
)
const
noexcept
{
if
(
auto
ptr
=
contextPtr
->
getStream
(
index
).
lock
())
{
return
ptr
;
}
else
{
return
nullptr
;
}
}
// Init a video sub-document from a file
void
VideoSubDocument
::
initFromPath
(
const
QString
&
)
VideoSubDocument
::
initFromPath
(
const
QString
&
path
)
{
if
(
contextPtr
)
qDebug
()
<<
"Replacing the video contetx by a new one for file"
<<
path
;
contextPtr
.
reset
(
new
VideoContext
(
path
));
// May throw
qDebug
()
<<
"Video OK for"
<<
path
;
}
QString
...
...
@@ -18,7 +57,10 @@ QJsonDocument
VideoSubDocument
::
getProperties
()
const
noexcept
{
QJsonDocument
ret
;
QJsonObject
object
;
QJsonObject
object
{
{
"Video context"
,
contextPtr
->
getProperties
().
object
()
},
{
"File"
,
filePath
},
};
ret
.
setObject
(
object
);
return
ret
;
}
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