Skip to content
GitLab
Explorer
Connexion
Navigation principale
Rechercher ou aller à…
Projet
Aegisub
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Wiki
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Extraits de code
Déploiement
Releases
Registre de paquets
Registre de conteneurs
Registre de modèles
Opération
Modules Terraform
Surveillance
Incidents
Analyse
Données d'analyse des chaînes de valeur
Analyse des contributeurs
Données d'analyse du dépôt
Expériences du modèle
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
Ce projet est archivé. Le dépôt et les autres ressources du projet sont en lecture seule.
Afficher davantage de fils d'Ariane
Kubat
Aegisub
Validations
1655f97a
Valider
1655f97a
rédigé
Il y a 16 ans
par
Karl Blomster
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
add a progress dialog to the ffmpegsource video provider's indexing process
Originally committed to SVN as r2318.
parent
7fb0d975
Branches
Branches contenant la validation
Étiquettes
Étiquettes contenant la validation
Aucune requête de fusion associée trouvée
Modifications
2
Afficher les modifications d'espaces
En ligne
Côte à côte
Affichage de
2 fichiers modifiés
aegisub/video_provider_ffmpegsource.cpp
+33
-8
33 ajouts, 8 suppressions
aegisub/video_provider_ffmpegsource.cpp
aegisub/video_provider_ffmpegsource.h
+11
-1
11 ajouts, 1 suppression
aegisub/video_provider_ffmpegsource.h
avec
44 ajouts
et
9 suppressions
aegisub/video_provider_ffmpegsource.cpp
+
33
−
8
Voir le fichier @
1655f97a
...
@@ -39,9 +39,8 @@
...
@@ -39,9 +39,8 @@
// Headers
// Headers
#include
"video_provider_ffmpegsource.h"
#include
"video_provider_ffmpegsource.h"
#include
<ffms.h>
#include
<ffms.h>
#include
"vfr.h"
#include
"video_context.h"
#include
"video_context.h"
#include
"options.h"
// for later use
#include
"options.h"
///////////////
///////////////
...
@@ -81,15 +80,25 @@ void FFmpegSourceVideoProvider::LoadVideo(Aegisub::String filename, double fps)
...
@@ -81,15 +80,25 @@ void FFmpegSourceVideoProvider::LoadVideo(Aegisub::String filename, double fps)
wxString
CacheName
(
filename
.
c_str
());
wxString
CacheName
(
filename
.
c_str
());
CacheName
.
append
(
_T
(
".ffindex"
));
CacheName
.
append
(
_T
(
".ffindex"
));
// initialize index object
FrameIndex
*
Index
;
FrameIndex
*
Index
=
FFMS_CreateFrameIndex
();
// try to read index (these index functions all return 0 on success)
// try to read index
if
(
FFMS_ReadIndex
(
CacheName
.
char_str
(),
Index
,
FFMSErrorMessage
,
MessageSize
))
{
Index
=
FFMS_ReadIndex
(
CacheName
.
char_str
(),
FFMSErrorMessage
,
MessageSize
);
if
(
Index
==
NULL
)
{
// reading failed, create index
// reading failed, create index
if
(
FFMS_MakeIndex
(
FileNameWX
.
char_str
(),
Index
,
0
,
NULL
,
NULL
,
FFMSErrorMessage
,
MessageSize
))
{
// prepare stuff for callback
IndexingProgressDialog
Progress
;
Progress
.
IndexingCanceled
=
false
;
Progress
.
ProgressDialog
=
new
DialogProgress
(
NULL
,
_
(
"Indexing"
),
&
Progress
.
IndexingCanceled
,
_
(
"Reading keyframes and timecodes from video"
),
0
,
1
);
Progress
.
ProgressDialog
->
Show
();
Progress
.
ProgressDialog
->
SetProgress
(
0
,
1
);
Index
=
FFMS_MakeIndex
(
FileNameWX
.
char_str
(),
0
,
""
,
FFmpegSourceVideoProvider
::
UpdateIndexingProgress
,
&
Progress
,
FFMSErrorMessage
,
MessageSize
);
if
(
Index
==
NULL
)
{
ErrorMsg
.
Printf
(
_T
(
"FFmpegSource video provider: %s"
),
FFMSErrorMessage
);
ErrorMsg
.
Printf
(
_T
(
"FFmpegSource video provider: %s"
),
FFMSErrorMessage
);
throw
ErrorMsg
;
throw
ErrorMsg
;
}
}
Progress
.
ProgressDialog
->
Destroy
();
// write it to disk
// write it to disk
if
(
FFMS_WriteIndex
(
CacheName
.
char_str
(),
Index
,
FFMSErrorMessage
,
MessageSize
))
{
if
(
FFMS_WriteIndex
(
CacheName
.
char_str
(),
Index
,
FFMSErrorMessage
,
MessageSize
))
{
ErrorMsg
.
Printf
(
_T
(
"FFmpegSource video provider: %s"
),
FFMSErrorMessage
);
ErrorMsg
.
Printf
(
_T
(
"FFmpegSource video provider: %s"
),
FFMSErrorMessage
);
...
@@ -194,6 +203,20 @@ void FFmpegSourceVideoProvider::Close() {
...
@@ -194,6 +203,20 @@ void FFmpegSourceVideoProvider::Close() {
FrameNumber
=
-
1
;
FrameNumber
=
-
1
;
}
}
///////////////
// Update indexing progress
int
__stdcall
FFmpegSourceVideoProvider
::
UpdateIndexingProgress
(
int
State
,
int64_t
Current
,
int64_t
Total
,
void
*
Private
)
{
IndexingProgressDialog
*
Progress
=
(
IndexingProgressDialog
*
)
Private
;
Progress
->
ProgressDialog
->
SetProgress
(
int
(
Current
),
int
(
Total
));
if
(
Progress
->
IndexingCanceled
)
{
// Close();
return
1
;
}
else
{
return
0
;
}
}
///////////////
///////////////
// Get frame
// Get frame
const
AegiVideoFrame
FFmpegSourceVideoProvider
::
GetFrame
(
int
_n
,
int
FormatType
)
{
const
AegiVideoFrame
FFmpegSourceVideoProvider
::
GetFrame
(
int
_n
,
int
FormatType
)
{
...
@@ -289,4 +312,6 @@ double FFmpegSourceVideoProvider::GetFPS() {
...
@@ -289,4 +312,6 @@ double FFmpegSourceVideoProvider::GetFPS() {
}
}
#endif
/* WITH_FFMPEGSOURCE */
#endif
/* WITH_FFMPEGSOURCE */
Ce diff est replié.
Cliquez pour l'agrandir.
aegisub/video_provider_ffmpegsource.h
+
11
−
1
Voir le fichier @
1655f97a
...
@@ -42,6 +42,8 @@
...
@@ -42,6 +42,8 @@
#endif
/* WIN32 */
#endif
/* WIN32 */
#include
"include/aegisub/video_provider.h"
#include
"include/aegisub/video_provider.h"
#include
"include/aegisub/aegisub.h"
#include
"include/aegisub/aegisub.h"
#include
"dialog_progress.h"
#include
"vfr.h"
extern
"C"
{
extern
"C"
{
#include
<libavformat/avformat.h>
#include
<libavformat/avformat.h>
#include
<libavcodec/avcodec.h>
#include
<libavcodec/avcodec.h>
...
@@ -75,9 +77,16 @@ private:
...
@@ -75,9 +77,16 @@ private:
unsigned
MessageSize
;
unsigned
MessageSize
;
wxString
ErrorMsg
;
wxString
ErrorMsg
;
struct
IndexingProgressDialog
{
volatile
bool
IndexingCanceled
;
DialogProgress
*
ProgressDialog
;
};
void
LoadVideo
(
Aegisub
::
String
filename
,
double
fps
);
void
LoadVideo
(
Aegisub
::
String
filename
,
double
fps
);
void
Close
();
void
Close
();
static
int
__stdcall
FFmpegSourceVideoProvider
::
UpdateIndexingProgress
(
int
State
,
int64_t
Current
,
int64_t
Total
,
void
*
Private
);
protected
:
protected
:
public
:
public
:
...
@@ -108,4 +117,5 @@ public:
...
@@ -108,4 +117,5 @@ public:
VideoProvider
*
CreateProvider
(
Aegisub
::
String
video
,
double
fps
=
0.0
)
{
return
new
FFmpegSourceVideoProvider
(
video
,
fps
);
}
VideoProvider
*
CreateProvider
(
Aegisub
::
String
video
,
double
fps
=
0.0
)
{
return
new
FFmpegSourceVideoProvider
(
video
,
fps
);
}
};
};
#endif
/* WITH_FFMPEGSOURCE */
#endif
/* WITH_FFMPEGSOURCE */
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