Skip to content

Commit

Permalink
libmythtv: constify AVCodec, etc. part 1
Browse files Browse the repository at this point in the history
To satisfy -fpermissive
  • Loading branch information
ulmus-scott authored and bennettpeter committed Aug 25, 2022
1 parent 218240f commit 2aca744
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions mythtv/libs/libmythtv/io/mythavformatwriter.cpp
Expand Up @@ -61,7 +61,7 @@ MythAVFormatWriter::~MythAVFormatWriter()

bool MythAVFormatWriter::Init(void)
{
AVOutputFormat *fmt = av_guess_format(m_container.toLatin1().constData(), nullptr, nullptr);
const AVOutputFormat *fmt = av_guess_format(m_container.toLatin1().constData(), nullptr, nullptr);
if (!fmt)
{
LOG(VB_RECORD, LOG_ERR, LOC + QString("Init(): Unable to guess AVOutputFormat from container %1")
Expand Down Expand Up @@ -411,7 +411,7 @@ AVStream* MythAVFormatWriter::AddVideoStream(void)
stream->r_frame_rate.num = 0;
stream->r_frame_rate.den = 0;

AVCodec *codec = avcodec_find_encoder(m_ctx->oformat->video_codec);
const AVCodec *codec = avcodec_find_encoder(m_ctx->oformat->video_codec);
if (!codec)
{
LOG(VB_RECORD, LOG_ERR, LOC + "AddVideoStream(): avcodec_find_encoder() failed");
Expand Down Expand Up @@ -580,7 +580,7 @@ AVStream* MythAVFormatWriter::AddAudioStream(void)
return stream;
}

bool MythAVFormatWriter::FindAudioFormat(AVCodecContext *Ctx, AVCodec *Codec, AVSampleFormat Format)
bool MythAVFormatWriter::FindAudioFormat(AVCodecContext *Ctx, const AVCodec *Codec, AVSampleFormat Format)
{
if (Codec->sample_fmts)
{
Expand All @@ -601,7 +601,7 @@ bool MythAVFormatWriter::OpenAudio(void)
AVCodecContext *context = m_codecMap.GetCodecContext(m_audioStream);
context->strict_std_compliance = FF_COMPLIANCE_EXPERIMENTAL;

AVCodec *codec = avcodec_find_encoder(context->codec_id);
const AVCodec *codec = avcodec_find_encoder(context->codec_id);
if (!codec)
{
LOG(VB_RECORD, LOG_ERR, LOC + "OpenAudio(): avcodec_find_encoder() failed");
Expand Down
6 changes: 3 additions & 3 deletions mythtv/libs/libmythtv/io/mythavformatwriter.h
Expand Up @@ -43,17 +43,17 @@ class MTV_PUBLIC MythAVFormatWriter : public MythMediaWriter
AVFrame* AllocPicture (enum AVPixelFormat PixFmt);
void Cleanup (void);
AVRational GetCodecTimeBase (void);
static bool FindAudioFormat (AVCodecContext *Ctx, AVCodec *Codec, AVSampleFormat Format);
static bool FindAudioFormat (AVCodecContext *Ctx, const AVCodec *Codec, AVSampleFormat Format);

MythAVFormatBuffer *m_avfBuffer { nullptr };
MythMediaBuffer *m_buffer { nullptr };
AVOutputFormat m_fmt { };
AVFormatContext *m_ctx { nullptr };
MythCodecMap m_codecMap;
AVStream *m_videoStream { nullptr };
AVCodec *m_avVideoCodec { nullptr };
const AVCodec *m_avVideoCodec { nullptr };
AVStream *m_audioStream { nullptr };
AVCodec *m_avAudioCodec { nullptr };
const AVCodec *m_avAudioCodec { nullptr };
AVFrame *m_picture { nullptr };
AVFrame *m_audPicture { nullptr };
unsigned char *m_audioInBuf { nullptr };
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/mythavutil.cpp
Expand Up @@ -327,7 +327,7 @@ void MythCodecMap::FreeAllContexts()
MythStreamInfoList::MythStreamInfoList(const QString& filename)
{
const int probeBufferSize = 8 * 1024;
AVInputFormat *fmt = nullptr;
const AVInputFormat *fmt = nullptr;
AVProbeData probe;
memset(&probe, 0, sizeof(AVProbeData));
probe.filename = "";
Expand Down

0 comments on commit 2aca744

Please sign in to comment.