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
7b6182b0
Vérifiée
Valider
7b6182b0
rédigé
Il y a 4 ans
par
Kubat
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
AUDIO: Create the audio context and its streams
parent
a677649c
Branches
Branches contenant la validation
Aucune étiquette associée trouvée
1 requête de fusion
!5
Add AudioContext to AudioSubDocument
Modifications
2
Afficher les modifications d'espaces
En ligne
Côte à côte
Affichage de
2 fichiers modifiés
src/Audio.cc
+35
-0
35 ajouts, 0 suppression
src/Audio.cc
src/Audio.hh
+2
-2
2 ajouts, 2 suppressions
src/Audio.hh
avec
37 ajouts
et
2 suppressions
src/Audio.cc
+
35
−
0
Voir le fichier @
7b6182b0
...
@@ -2,6 +2,41 @@
...
@@ -2,6 +2,41 @@
using
namespace
Vivy
;
using
namespace
Vivy
;
// AudioContext class implementation
// Create an audio contecxt from a file
AudioContext
::
AudioContext
(
const
QString
&
path
)
:
filePath
(
path
)
{
if
(
!
format
)
throw
std
::
runtime_error
(
"out of memory, can't create allocate the AVFormatContext"
);
const
std
::
string
filePathStdHolder
=
filePath
.
toStdString
();
const
char
*
filename
=
filePathStdHolder
.
c_str
();
AVFormatContext
*
formatPtr
=
format
.
get
();
// Get the format from the audio file
if
(
avformat_open_input
(
&
formatPtr
,
filename
,
NULL
,
NULL
)
!=
0
)
{
[[
maybe_unused
]]
void
*
relatedOnFailure
=
format
.
release
();
// freed by avformat_open_input
throw
std
::
runtime_error
(
"failed to open file"
);
}
if
(
avformat_find_stream_info
(
formatPtr
,
NULL
)
<
0
)
{
throw
std
::
runtime_error
(
"failed to get audio stream info"
);
}
// Populate all the stream indexes
for
(
uint
i
=
0
;
i
<
format
->
nb_streams
;
++
i
)
{
AVStream
*
itFormat
=
format
->
streams
[
i
];
AVCodecParameters
*
params
=
itFormat
->
codecpar
;
AVCodec
*
streamCodec
=
avcodec_find_decoder
(
params
->
codec_id
);
if
(
streamCodec
&&
streamCodec
->
type
==
AVMEDIA_TYPE_AUDIO
)
{
audioStreamIndexes
.
push_back
(
i
);
audioCodecs
.
insert
(
i
,
std
::
make_shared
<
Stream
>
(
formatPtr
,
itFormat
));
}
}
}
// AudioContext::Stream class implementation
// AudioContext::Stream class implementation
// Constructor, need an AVFormat and an AVStream
// Constructor, need an AVFormat and an AVStream
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
src/Audio.hh
+
2
−
2
Voir le fichier @
7b6182b0
...
@@ -113,7 +113,7 @@ public:
...
@@ -113,7 +113,7 @@ public:
public
:
public
:
AudioContext
(
const
QString
&
path
);
AudioContext
(
const
QString
&
path
);
~
AudioContext
()
noexcept
;
~
AudioContext
()
noexcept
=
default
;
int
getStreamCount
()
const
noexcept
;
int
getStreamCount
()
const
noexcept
;
StreamWeakPtr
getStream
(
int
)
const
noexcept
;
StreamWeakPtr
getStream
(
int
)
const
noexcept
;
...
@@ -126,7 +126,7 @@ private:
...
@@ -126,7 +126,7 @@ private:
avformat_free_context
(
ptr
);
avformat_free_context
(
ptr
);
};
};
using
AVFormatContextPtr
=
std
::
unique_ptr
<
AVFormatContext
,
decltype
(
avFormatContextDeleter
)
>
;
using
AVFormatContextPtr
=
std
::
unique_ptr
<
AVFormatContext
,
decltype
(
avFormatContextDeleter
)
>
;
AVFormatContextPtr
format
{
nullptr
};
AVFormatContextPtr
format
{
avformat_alloc_context
()
};
/* Usefull information */
/* Usefull information */
QString
filePath
;
QString
filePath
;
...
...
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