Skip to content
Extraits de code Groupes Projets
Vérifiée Valider 3225845f rédigé par Kubat's avatar Kubat
Parcourir les fichiers

FIX: Fix the abstract media context compilation

Some things where made const with a system upgrade, so take more things
as const structs and hop that everything will works.
parent 91a75ea5
Aucune branche associée trouvée
Aucune étiquette associée trouvée
1 requête de fusion!25Draft: New Vivy module spec
Pipeline #2875 en échec
...@@ -59,8 +59,8 @@ protected: ...@@ -59,8 +59,8 @@ protected:
using Super = AbstractMediaStream<AVMEDIA_TYPE>; using Super = AbstractMediaStream<AVMEDIA_TYPE>;
protected: protected:
AbstractMediaStream(AVCodec *streamCodec, AVFormatContext *formatArg, AVStream *streamArg, AbstractMediaStream(const AVCodec *streamCodec, AVFormatContext *formatArg,
int index) const AVStream *streamArg, int index)
: codecId(streamArg->codecpar->codec_id) : codecId(streamArg->codecpar->codec_id)
, codec(streamCodec) , codec(streamCodec)
, codecParams(streamArg->codecpar) , codecParams(streamArg->codecpar)
...@@ -102,14 +102,14 @@ public: ...@@ -102,14 +102,14 @@ public:
protected: protected:
// Codec related informations // Codec related informations
AVCodecID codecId{ AV_CODEC_ID_NONE }; const AVCodecID codecId = AV_CODEC_ID_NONE;
AVCodec *codec{ nullptr }; const AVCodec *codec = nullptr;
AVCodecParameters *codecParams{ nullptr }; const AVCodecParameters *codecParams = nullptr;
AVCodecContextPtr codecContext{ nullptr }; AVCodecContextPtr codecContext = nullptr;
AVFormatContext *dataFormat{ nullptr }; AVFormatContext *dataFormat = nullptr;
// Stream is held by AudioContext // Stream is held by AudioContext
AVStream *stream{ nullptr }; const AVStream *stream = nullptr;
// Store the index of this stream // Store the index of this stream
int streamIndexInContext; int streamIndexInContext;
...@@ -151,9 +151,9 @@ public: ...@@ -151,9 +151,9 @@ public:
// Populate all the stream indexes // Populate all the stream indexes
for (uint i = 0; i < format->nb_streams; ++i) { for (uint i = 0; i < format->nb_streams; ++i) {
AVStream *itFmt = format->streams[i]; const AVStream *itFmt = format->streams[i];
AVCodecParameters *params = itFmt->codecpar; const AVCodecParameters *params = itFmt->codecpar;
AVCodec *streamCodec = avcodec_find_decoder(params->codec_id); const AVCodec *streamCodec = avcodec_find_decoder(params->codec_id);
if (streamCodec && streamCodec->type == avMediaType) if (streamCodec && streamCodec->type == avMediaType)
audioStreams.insert(i, std::make_shared<Stream>(streamCodec, formatPtr, itFmt, i)); audioStreams.insert(i, std::make_shared<Stream>(streamCodec, formatPtr, itFmt, i));
} }
...@@ -218,12 +218,12 @@ private: ...@@ -218,12 +218,12 @@ private:
AVFormatContextPtr format{ avformat_alloc_context(), avFormatContextDeleter }; AVFormatContextPtr format{ avformat_alloc_context(), avFormatContextDeleter };
const QString filePath; // Usefull information const QString filePath; // Usefull information
QMap<uint, StreamPtr> audioStreams{}; // THe audio streams of the file QMap<uint, StreamPtr> audioStreams; // THe audio streams of the file
int defaultStreamIndex{ -1 }; int defaultStreamIndex = -1;
// Spare always null shared pointer, to be used when the audioStream[i] was // Spare always null shared pointer, to be used when the audioStream[i] was
// not found. // not found.
StreamPtr spareNullSreamPtr{ nullptr }; StreamPtr spareNullSreamPtr = nullptr;
}; };
} }
...@@ -26,8 +26,8 @@ AudioContext::getProperties() const noexcept ...@@ -26,8 +26,8 @@ AudioContext::getProperties() const noexcept
// AudioStream class implementation // AudioStream class implementation
// Constructor, need an AVFormat and an AVStream // Constructor, need an AVFormat and an AVStream
AudioStream::AudioStream(AVCodec *streamCodec, AVFormatContext *formatPtr, AVStream *streamArg, AudioStream::AudioStream(const AVCodec *streamCodec, AVFormatContext *formatPtr,
int index) const AVStream *streamArg, int index)
: Super(streamCodec, formatPtr, streamArg, index) : Super(streamCodec, formatPtr, streamArg, index)
{ {
SwrContext *s = dataSwrContext.get(); SwrContext *s = dataSwrContext.get();
......
...@@ -17,7 +17,7 @@ class AudioStream final : public AbstractMediaStream<AVMEDIA_TYPE_AUDIO> { ...@@ -17,7 +17,7 @@ class AudioStream final : public AbstractMediaStream<AVMEDIA_TYPE_AUDIO> {
VIVY_UNMOVABLE_OBJECT(AudioStream) VIVY_UNMOVABLE_OBJECT(AudioStream)
public: public:
AudioStream(AVCodec *, AVFormatContext *, AVStream *, int index); AudioStream(const AVCodec *, AVFormatContext *, const AVStream *, int index);
~AudioStream() noexcept override; ~AudioStream() noexcept override;
// Decode the stream // Decode the stream
......
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
using namespace Vivy; using namespace Vivy;
VideoStream::VideoStream(AVCodec *streamCodec, AVFormatContext *formatArg, AVStream *streamArg, VideoStream::VideoStream(const AVCodec *streamCodec, AVFormatContext *formatArg,
int index) const AVStream *streamArg, int index)
: Super(streamCodec, formatArg, streamArg, index) : Super(streamCodec, formatArg, streamArg, index)
{ {
} }
......
...@@ -15,7 +15,7 @@ class VideoStream final : public AbstractMediaStream<AVMEDIA_TYPE_VIDEO> { ...@@ -15,7 +15,7 @@ class VideoStream final : public AbstractMediaStream<AVMEDIA_TYPE_VIDEO> {
VIVY_UNMOVABLE_OBJECT(VideoStream) VIVY_UNMOVABLE_OBJECT(VideoStream)
public: public:
VideoStream(AVCodec *, AVFormatContext *, AVStream *, int index); VideoStream(const AVCodec *, AVFormatContext *, const AVStream *, int index);
~VideoStream() noexcept override = default; ~VideoStream() noexcept override = default;
int getWidth() const noexcept; int getWidth() const noexcept;
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter