diff --git a/src/FFmpegReader.cpp b/src/FFmpegReader.cpp index 19d038bf..a0d4c183 100644 --- a/src/FFmpegReader.cpp +++ b/src/FFmpegReader.cpp @@ -241,10 +241,10 @@ void FFmpegReader::Open() { pStream = pFormatCtx->streams[videoStream]; // Find the codec ID from stream - AVCodecID codecId = AV_FIND_DECODER_CODEC_ID(pStream); + const AVCodecID codecId = AV_FIND_DECODER_CODEC_ID(pStream); // Get codec and codec context from stream - AVCodec *pCodec = avcodec_find_decoder(codecId); + const AVCodec *pCodec = avcodec_find_decoder(codecId); AVDictionary *opts = NULL; int retry_decode_open = 2; // If hw accel is selected but hardware cannot handle repeat with software decoding @@ -498,7 +498,7 @@ void FFmpegReader::Open() { AVCodecID codecId = AV_FIND_DECODER_CODEC_ID(aStream); // Get codec and codec context from stream - AVCodec *aCodec = avcodec_find_decoder(codecId); + const AVCodec *aCodec = avcodec_find_decoder(codecId); aCodecCtx = AV_GET_CODEC_CONTEXT(aStream, aCodec); // Set number of threads equal to number of processors (not to exceed 16) diff --git a/src/FFmpegWriter.cpp b/src/FFmpegWriter.cpp index a959fc4d..5662c271 100644 --- a/src/FFmpegWriter.cpp +++ b/src/FFmpegWriter.cpp @@ -151,7 +151,7 @@ void FFmpegWriter::initialize_streams() { void FFmpegWriter::SetVideoOptions(bool has_video, std::string codec, Fraction fps, int width, int height, Fraction pixel_ratio, bool interlaced, bool top_field_first, int bit_rate) { // Set the video options if (codec.length() > 0) { - AVCodec *new_codec; + const AVCodec *new_codec; // Check if the codec selected is a hardware accelerated codec #if USE_HW_ACCEL #if defined(__linux__) @@ -273,7 +273,7 @@ void FFmpegWriter::SetVideoOptions(std::string codec, int width, int height, Fr void FFmpegWriter::SetAudioOptions(bool has_audio, std::string codec, int sample_rate, int channels, ChannelLayout channel_layout, int bit_rate) { // Set audio options if (codec.length() > 0) { - AVCodec *new_codec = avcodec_find_encoder_by_name(codec.c_str()); + const AVCodec *new_codec = avcodec_find_encoder_by_name(codec.c_str()); if (new_codec == NULL) throw InvalidCodec("A valid audio codec could not be found for this file.", path); else { @@ -1033,7 +1033,7 @@ AVStream *FFmpegWriter::add_audio_stream() { AVStream *st; // Find the audio codec - AVCodec *codec = avcodec_find_encoder_by_name(info.acodec.c_str()); + const AVCodec *codec = avcodec_find_encoder_by_name(info.acodec.c_str()); if (codec == NULL) throw InvalidCodec("A valid audio codec could not be found for this file.", path); @@ -1118,7 +1118,7 @@ AVStream *FFmpegWriter::add_video_stream() { AVStream *st; // Find the video codec - AVCodec *codec = avcodec_find_encoder_by_name(info.vcodec.c_str()); + const AVCodec *codec = avcodec_find_encoder_by_name(info.vcodec.c_str()); if (codec == NULL) throw InvalidCodec("A valid video codec could not be found for this file.", path); @@ -1302,7 +1302,7 @@ AVStream *FFmpegWriter::add_video_stream() { // open audio codec void FFmpegWriter::open_audio(AVFormatContext *oc, AVStream *st) { - AVCodec *codec; + const AVCodec *codec; AV_GET_CODEC_FROM_STREAM(st, audio_codec_ctx) // Set number of threads equal to number of processors (not to exceed 16) @@ -1373,7 +1373,7 @@ void FFmpegWriter::open_audio(AVFormatContext *oc, AVStream *st) { // open video codec void FFmpegWriter::open_video(AVFormatContext *oc, AVStream *st) { - AVCodec *codec; + const AVCodec *codec; AV_GET_CODEC_FROM_STREAM(st, video_codec_ctx) // Set number of threads equal to number of processors (not to exceed 16)