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
7fb36b06
Vérifiée
Valider
7fb36b06
rédigé
Il y a 4 ans
par
Kubat
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
AUDIO: Finish implementing the AudioContext
parent
7b6182b0
Aucune branche associée trouvée
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
+20
-1
20 ajouts, 1 suppression
src/Audio.cc
src/Audio.hh
+8
-4
8 ajouts, 4 suppressions
src/Audio.hh
avec
28 ajouts
et
5 suppressions
src/Audio.cc
+
20
−
1
Voir le fichier @
7fb36b06
...
@@ -32,11 +32,30 @@ AudioContext::AudioContext(const QString &path)
...
@@ -32,11 +32,30 @@ AudioContext::AudioContext(const QString &path)
AVCodec
*
streamCodec
=
avcodec_find_decoder
(
params
->
codec_id
);
AVCodec
*
streamCodec
=
avcodec_find_decoder
(
params
->
codec_id
);
if
(
streamCodec
&&
streamCodec
->
type
==
AVMEDIA_TYPE_AUDIO
)
{
if
(
streamCodec
&&
streamCodec
->
type
==
AVMEDIA_TYPE_AUDIO
)
{
audioStreamIndexes
.
push_back
(
i
);
audioStreamIndexes
.
push_back
(
i
);
audio
Codec
s
.
insert
(
i
,
std
::
make_shared
<
Stream
>
(
formatPtr
,
itFormat
));
audio
Stream
s
.
insert
(
i
,
std
::
make_shared
<
Stream
>
(
formatPtr
,
itFormat
));
}
}
}
}
}
}
// Get the number of audio streams in the audio context
int
AudioContext
::
getStreamCount
()
const
noexcept
{
return
audioStreamIndexes
.
size
();
}
// Get a specific audio stream, try to lock the weak pointer. if the index was
// not present the used_count will be 0 and you won't be able to lock it.
AudioContext
::
StreamWeakPtr
AudioContext
::
getStream
(
uint
index
)
const
noexcept
{
if
(
QMap
<
uint
,
StreamPtr
>::
const_iterator
found
=
audioStreams
.
find
(
index
);
found
!=
audioStreams
.
end
())
{
return
StreamWeakPtr
{
*
found
};
}
return
StreamWeakPtr
{
spareNullSreamPtr
};
}
// 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
+
8
−
4
Voir le fichier @
7fb36b06
...
@@ -116,10 +116,10 @@ public:
...
@@ -116,10 +116,10 @@ public:
~
AudioContext
()
noexcept
=
default
;
~
AudioContext
()
noexcept
=
default
;
int
getStreamCount
()
const
noexcept
;
int
getStreamCount
()
const
noexcept
;
StreamWeakPtr
getStream
(
int
)
const
noexcept
;
StreamWeakPtr
getStream
(
u
int
)
const
noexcept
;
private
:
private
:
/
*
Regarding the format
*/
/
/
Regarding the format
static
inline
constexpr
auto
avFormatContextDeleter
=
static
inline
constexpr
auto
avFormatContextDeleter
=
[](
AVFormatContext
*
ptr
)
noexcept
->
void
{
[](
AVFormatContext
*
ptr
)
noexcept
->
void
{
if
(
ptr
)
if
(
ptr
)
...
@@ -128,10 +128,14 @@ private:
...
@@ -128,10 +128,14 @@ private:
using
AVFormatContextPtr
=
std
::
unique_ptr
<
AVFormatContext
,
decltype
(
avFormatContextDeleter
)
>
;
using
AVFormatContextPtr
=
std
::
unique_ptr
<
AVFormatContext
,
decltype
(
avFormatContextDeleter
)
>
;
AVFormatContextPtr
format
{
avformat_alloc_context
()
};
AVFormatContextPtr
format
{
avformat_alloc_context
()
};
/
*
Usefull information
*/
/
/
Usefull information
QString
filePath
;
QString
filePath
;
QVector
<
uint
>
audioStreamIndexes
{};
QVector
<
uint
>
audioStreamIndexes
{};
QMap
<
uint
,
StreamPtr
>
audioCodecs
{};
QMap
<
uint
,
StreamPtr
>
audioStreams
{};
// Spare always null shared pointer, to be used when the audioStream[i] was
// not found.
StreamPtr
spareNullSreamPtr
{
nullptr
};
};
};
}
}
...
...
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