update:decoder and recorder接口只读变量增加const

This commit is contained in:
Barry 2019-06-18 15:17:48 +08:00
parent 5c196d9569
commit 01121ff470
2 changed files with 5 additions and 5 deletions

View file

@ -28,7 +28,7 @@ void Recorder::setFormat(Recorder::RecorderFormat format)
m_format = format;
}
bool Recorder::open(AVCodec *inputCodec)
bool Recorder::open(const AVCodec* inputCodec)
{
QString formatName = recorderGetFormatName(m_format);
Q_ASSERT(!formatName.isEmpty());
@ -132,7 +132,7 @@ const AVOutputFormat *Recorder::findMuxer(const char* name)
return outFormat;
}
bool Recorder::recorderWriteHeader(AVPacket *packet)
bool Recorder::recorderWriteHeader(const AVPacket* packet)
{
AVStream *ostream = m_formatCtx->streams[0];
quint8* extradata = (quint8*)av_malloc(packet->size * sizeof(quint8));
@ -162,7 +162,7 @@ bool Recorder::recorderWriteHeader(AVPacket *packet)
return true;
}
void Recorder::recorderRescalePacket(AVPacket *packet)
void Recorder::recorderRescalePacket(AVPacket* packet)
{
AVStream *ostream = m_formatCtx->streams[0];
av_packet_rescale_ts(packet, SCRCPY_TIME_BASE, ostream->time_base);

View file

@ -22,13 +22,13 @@ public:
void setFrameSize(const QSize& declaredFrameSize);
void setFormat(Recorder::RecorderFormat format);
bool open(AVCodec* inputCodec);
bool open(const AVCodec* inputCodec);
void close();
bool write(AVPacket* packet);
private:
const AVOutputFormat* findMuxer(const char* name);
bool recorderWriteHeader(AVPacket* packet);
bool recorderWriteHeader(const AVPacket* packet);
void recorderRescalePacket(AVPacket *packet);
QString recorderGetFormatName(Recorder::RecorderFormat format);
RecorderFormat guessRecordFormat(const QString& fileName);