Skip to content

Commit

Permalink
tidy: Rename MAX_SIZE_BUFFER to kMaxSizeBuffer.
Browse files Browse the repository at this point in the history
The clang-tidy "identifier naming" checker pointed out a number of
places where class member variables don't use the convention of
starting with "m_".  Fix these for naming consistency across the code
base.

Remove second instance of this variable from AudioOutputUtils and have
all callers use the instance in AudioOUtput.

https://clang.llvm.org/extra/clang-tidy/checks/readability-identifier-naming.html
  • Loading branch information
linuxdude42 committed Dec 10, 2019
1 parent db5d626 commit ee93032
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 13 deletions.
2 changes: 1 addition & 1 deletion mythplugins/mythmusic/mythmusic/avfdecoder.cpp
Expand Up @@ -241,7 +241,7 @@ avfDecoder::avfDecoder(const QString &file, DecoderFactory *d, AudioOutput *o) :
setURL(file);

m_outputBuffer =
(uint8_t *)av_malloc(AudioOutput::MAX_SIZE_BUFFER);
(uint8_t *)av_malloc(AudioOutput::kMaxSizeBuffer);

bool debug = VERBOSE_LEVEL_CHECK(VB_LIBAV, LOG_ANY);
av_log_set_level((debug) ? AV_LOG_DEBUG : AV_LOG_ERROR);
Expand Down
4 changes: 2 additions & 2 deletions mythtv/libs/libmyth/audio/audiooutput.h
Expand Up @@ -187,9 +187,9 @@ class MPUBLIC AudioOutput : public VolumeBase, public OutputListeners
uint8_t *buffer, int &data_size,
const AVPacket *pkt);
/**
* MAX_SIZE_BUFFER is the maximum size of a buffer to be used with DecodeAudio
* kMaxSizeBuffer is the maximum size of a buffer to be used with DecodeAudio
*/
static const int MAX_SIZE_BUFFER = 384000;
static const int kMaxSizeBuffer = 384000;

protected:
void Error(const QString &msg);
Expand Down
4 changes: 0 additions & 4 deletions mythtv/libs/libmyth/audio/audiooutpututil.h
Expand Up @@ -22,10 +22,6 @@ class MPUBLIC AudioOutputUtil
static int DecodeAudio(AVCodecContext *ctx,
uint8_t *buffer, int &data_size,
const AVPacket *pkt);
/**
* MAX_SIZE_BUFFER is the maximum size of a buffer to be used with DecodeAudio
*/
static const int MAX_SIZE_BUFFER = 192000;

// Actually now in AudioConvert class, kept here for compatibility
static int toFloat(AudioFormat format, void *out, const void *in, int bytes);
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmyth/audio/spdifencoder.h
Expand Up @@ -31,7 +31,7 @@ class MPUBLIC SPDIFEncoder
private:
bool m_complete {false};
AVFormatContext *m_oc {nullptr};
unsigned char m_buffer[AudioOutput::MAX_SIZE_BUFFER] {0};
unsigned char m_buffer[AudioOutput::kMaxSizeBuffer] {0};
long m_size {0};
};

Expand Down
4 changes: 2 additions & 2 deletions mythtv/libs/libmythtv/AirPlay/mythraopconnection.cpp
Expand Up @@ -627,7 +627,7 @@ uint32_t MythRAOPConnection::decodeAudioPacket(uint8_t type,
tmp_pkt.size = len;

uint32_t frames_added = 0;
auto *samples = (uint8_t *)av_mallocz(AudioOutput::MAX_SIZE_BUFFER);
auto *samples = (uint8_t *)av_mallocz(AudioOutput::kMaxSizeBuffer);
while (tmp_pkt.size > 0)
{
int data_size;
Expand Down Expand Up @@ -1734,7 +1734,7 @@ int64_t MythRAOPConnection::AudioCardLatency(void)
if (!m_audio)
return 0;

auto *samples = (int16_t *)av_mallocz(AudioOutput::MAX_SIZE_BUFFER);
auto *samples = (int16_t *)av_mallocz(AudioOutput::kMaxSizeBuffer);
int frames = AUDIOCARD_BUFFER * m_frameRate / 1000;
m_audio->AddData((char *)samples,
frames * (m_sampleSize>>3) * m_channels,
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/decoders/avformatdecoder.cpp
Expand Up @@ -345,7 +345,7 @@ AvFormatDecoder::AvFormatDecoder(MythPlayer *parent,
m_ccd708(new CC708Decoder(parent->GetCC708Reader())),
m_ttd(new TeletextDecoder(parent->GetTeletextReader()))
{
m_audioSamples = (uint8_t *)av_mallocz(AudioOutput::MAX_SIZE_BUFFER);
m_audioSamples = (uint8_t *)av_mallocz(AudioOutput::kMaxSizeBuffer);
m_ccd608->SetIgnoreTimecode(true);

av_log_set_callback(myth_av_log);
Expand Down
4 changes: 2 additions & 2 deletions mythtv/libs/libmythtv/decoders/nuppeldecoder.cpp
Expand Up @@ -21,7 +21,7 @@ using namespace std;
#include "mythavutil.h"
#include "fourcc.h"
#include "RTjpegN.h"
#include "audiooutpututil.h" // for RTjpeg, RTJ_YUV420
#include "audiooutput.h" // for RTjpeg, RTJ_YUV420
#include "audiooutputsettings.h" // for ::FORMAT_NONE, ::FORMAT_S16, etc
#include "audioplayer.h" // for AudioPlayer
#include "cc608reader.h" // for CC608Reader
Expand All @@ -46,7 +46,7 @@ NuppelDecoder::NuppelDecoder(MythPlayer *parent,
memset(&m_frameheader, 0, sizeof(rtframeheader));
memset(&m_extradata, 0, sizeof(extendeddata));
m_planes[0] = m_planes[1] = m_planes[2] = nullptr;
m_audioSamples = (uint8_t *)av_mallocz(AudioOutputUtil::MAX_SIZE_BUFFER);
m_audioSamples = (uint8_t *)av_mallocz(AudioOutput::kMaxSizeBuffer);

// set parent class variables
m_positionMapType = MARK_KEYFRAME;
Expand Down

0 comments on commit ee93032

Please sign in to comment.