diff --git a/src/Lib/AbstractMediaContext.hh b/src/Lib/AbstractMediaContext.hh index 07e7fb40cb192d15436d9bcae4ef6329e6649819..8fbaff3dfa8c9ee430c779372a6840dcf9e58246 100644 --- a/src/Lib/AbstractMediaContext.hh +++ b/src/Lib/AbstractMediaContext.hh @@ -59,7 +59,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) @@ -103,7 +103,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 }; @@ -153,7 +153,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 290af8355b77c1e6fded3919c41e86b5a400ec9e..71cddce7a508caba2c0188bed94146ddcc9b8446 100644 --- a/src/Lib/Audio.cc +++ b/src/Lib/Audio.cc @@ -26,7 +26,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 0c478c67857f5cdc1378cec74ace08f4ad43fdec..689de303e0b7ab6286031472cc38a80e0f8773bd 100644 --- a/src/Lib/Audio.hh +++ b/src/Lib/Audio.hh @@ -17,7 +17,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 db1bd987416dfd2787a06a04ae0ae02f4ed50a8d..cc8d603167ea45840f74a8e5f3774672feabfdf2 100644 --- a/src/Lib/Video.cc +++ b/src/Lib/Video.cc @@ -4,7 +4,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 765f5691638d5bb2574f4ff94b54cab9fc1ba77e..f8da55e41e9e9d67332fbbf068b0e01c3569f605 100644 --- a/src/Lib/Video.hh +++ b/src/Lib/Video.hh @@ -15,7 +15,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;