diff --git a/src/Lib/AbstractMediaContext.hh b/src/Lib/AbstractMediaContext.hh index 4bdd3d32256f9dca96a3cbbd2ddcb38f2e8f1327..94d8f815b6da300e3411dd171709d28f458131e7 100644 --- a/src/Lib/AbstractMediaContext.hh +++ b/src/Lib/AbstractMediaContext.hh @@ -58,7 +58,7 @@ protected: using Super = AbstractMediaStream<AVMEDIA_TYPE>; protected: - AbstractMediaStream(AVCodec *streamCodec, AVFormatContext *formatArg, AVStream *streamArg, + AbstractMediaStream(const AVCodec *streamCodec, AVFormatContext *formatArg, AVStream *streamArg, int index) : codecId(streamArg->codecpar->codec_id) , codec(streamCodec) @@ -109,7 +109,7 @@ public: protected: // Codec related informations AVCodecID codecId{ AV_CODEC_ID_NONE }; - AVCodec *codec{ nullptr }; + const AVCodec *codec{ nullptr }; AVCodecParameters *codecParams{ nullptr }; AVCodecContextPtr codecContext{ nullptr }; AVFormatContext *dataFormat{ nullptr }; @@ -159,7 +159,7 @@ public: for (uint i = 0; i < format->nb_streams; ++i) { AVStream *itFmt = format->streams[i]; 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) audioStreams.insert(i, std::make_shared<Stream>(streamCodec, formatPtr, itFmt, i)); } diff --git a/src/Lib/Audio.cc b/src/Lib/Audio.cc index 15521c875b42191e229dbf5648974bf9553a0247..2842e53853fa134f04247b0283c4b5fd66661fae 100644 --- a/src/Lib/Audio.cc +++ b/src/Lib/Audio.cc @@ -25,7 +25,7 @@ AudioContext::getProperties() const noexcept // AudioStream class implementation // Constructor, need an AVFormat and an AVStream -AudioStream::AudioStream(AVCodec *streamCodec, AVFormatContext *formatPtr, AVStream *streamArg, +AudioStream::AudioStream(const AVCodec *streamCodec, AVFormatContext *formatPtr, AVStream *streamArg, int index) : Super(streamCodec, formatPtr, streamArg, index) { diff --git a/src/Lib/Audio.hh b/src/Lib/Audio.hh index 2bf00f7ea8ace4f39fd21912988468ae8414895e..bc6ae3815c168cf253d3ef4fde0b8c9ea2acfa5e 100644 --- a/src/Lib/Audio.hh +++ b/src/Lib/Audio.hh @@ -16,7 +16,7 @@ class AudioStream final : public AbstractMediaStream<AVMEDIA_TYPE_AUDIO> { VIVY_UNMOVABLE_OBJECT(AudioStream) public: - AudioStream(AVCodec *, AVFormatContext *, AVStream *, int index); + AudioStream(const AVCodec *, AVFormatContext *, AVStream *, int index); ~AudioStream() noexcept override; // Decode the stream diff --git a/src/Lib/Video.cc b/src/Lib/Video.cc index 72d894f4b230bd4e616e39bb85f11bbeddafe570..7845548606956b97f4061399bb679ba611c6fd9d 100644 --- a/src/Lib/Video.cc +++ b/src/Lib/Video.cc @@ -3,7 +3,7 @@ using namespace Vivy; -VideoStream::VideoStream(AVCodec *streamCodec, AVFormatContext *formatArg, AVStream *streamArg, +VideoStream::VideoStream(const AVCodec *streamCodec, AVFormatContext *formatArg, AVStream *streamArg, int index) : Super(streamCodec, formatArg, streamArg, index) { diff --git a/src/Lib/Video.hh b/src/Lib/Video.hh index 4092908f7518284eae122a64eb950d608daff14f..79ac20cebf4fcaced2e236087855d82f07126135 100644 --- a/src/Lib/Video.hh +++ b/src/Lib/Video.hh @@ -14,7 +14,7 @@ class VideoStream final : public AbstractMediaStream<AVMEDIA_TYPE_VIDEO> { VIVY_UNMOVABLE_OBJECT(VideoStream) public: - VideoStream(AVCodec *, AVFormatContext *, AVStream *, int index); + VideoStream(const AVCodec *, AVFormatContext *, AVStream *, int index); ~VideoStream() noexcept override = default; int getWidth() const noexcept;