Skip to content

Commit 2a1fe80

Browse files
authored
Merge pull request #352 from ferdnyc/clang-iwyu-fixes
Add fixes for Clang/IWYU building, correct juce:: namespacing
2 parents a3eb92e + ed908fa commit 2a1fe80

28 files changed

+117
-75
lines changed

include/AudioBufferSource.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,25 +54,25 @@ namespace openshot
5454
* The <a href="http://www.juce.com/">JUCE</a> library cannot play audio directly from an AudioSampleBuffer, so this class exposes
5555
* an AudioSampleBuffer as a AudioSource, so that JUCE can play the audio.
5656
*/
57-
class AudioBufferSource : public PositionableAudioSource
57+
class AudioBufferSource : public juce::PositionableAudioSource
5858
{
5959
private:
6060
int position;
6161
int start;
6262
bool repeat;
63-
AudioSampleBuffer *buffer;
63+
juce::AudioSampleBuffer *buffer;
6464

6565
public:
6666
/// @brief Default constructor
6767
/// @param audio_buffer This buffer contains the samples you want to play through JUCE.
68-
AudioBufferSource(AudioSampleBuffer *audio_buffer);
68+
AudioBufferSource(juce::AudioSampleBuffer *audio_buffer);
6969

7070
/// Destructor
7171
~AudioBufferSource();
7272

7373
/// @brief Get the next block of audio samples
7474
/// @param info This struct informs us of which samples are needed next.
75-
void getNextAudioBlock (const AudioSourceChannelInfo& info);
75+
void getNextAudioBlock (const juce::AudioSourceChannelInfo& info);
7676

7777
/// Prepare to play this audio source
7878
void prepareToPlay(int, double);
@@ -82,13 +82,13 @@ namespace openshot
8282

8383
/// @brief Set the next read position of this source
8484
/// @param newPosition The sample # to start reading from
85-
void setNextReadPosition (int64 newPosition);
85+
void setNextReadPosition (juce::int64 newPosition);
8686

8787
/// Get the next read position of this source
88-
int64 getNextReadPosition() const;
88+
juce::int64 getNextReadPosition() const;
8989

9090
/// Get the total length (in samples) of this audio source
91-
int64 getTotalLength() const;
91+
juce::int64 getTotalLength() const;
9292

9393
/// Determines if this audio source should repeat when it reaches the end
9494
bool isLooping() const;
@@ -98,7 +98,7 @@ namespace openshot
9898
void setLooping (bool shouldLoop);
9999

100100
/// Update the internal buffer used by this source
101-
void setBuffer (AudioSampleBuffer *audio_buffer);
101+
void setBuffer (juce::AudioSampleBuffer *audio_buffer);
102102
};
103103

104104
}

include/AudioReaderSource.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@ namespace openshot
5454
*
5555
* This allows any reader to play audio through JUCE (our audio framework).
5656
*/
57-
class AudioReaderSource : public PositionableAudioSource
57+
class AudioReaderSource : public juce::PositionableAudioSource
5858
{
5959
private:
6060
int position; /// The position of the audio source (index of buffer)
6161
bool repeat; /// Repeat the audio source when finished
6262
int size; /// The size of the internal buffer
63-
AudioSampleBuffer *buffer; /// The audio sample buffer
63+
juce::AudioSampleBuffer *buffer; /// The audio sample buffer
6464
int speed; /// The speed and direction to playback a reader (1=normal, 2=fast, 3=faster, -1=rewind, etc...)
6565

6666
ReaderBase *reader; /// The reader to pull samples from
@@ -90,7 +90,7 @@ namespace openshot
9090

9191
/// @brief Get the next block of audio samples
9292
/// @param info This struct informs us of which samples are needed next.
93-
void getNextAudioBlock (const AudioSourceChannelInfo& info);
93+
void getNextAudioBlock (const juce::AudioSourceChannelInfo& info);
9494

9595
/// Prepare to play this audio source
9696
void prepareToPlay(int, double);
@@ -100,13 +100,13 @@ namespace openshot
100100

101101
/// @brief Set the next read position of this source
102102
/// @param newPosition The sample # to start reading from
103-
void setNextReadPosition (int64 newPosition);
103+
void setNextReadPosition (juce::int64 newPosition);
104104

105105
/// Get the next read position of this source
106-
int64 getNextReadPosition() const;
106+
juce::int64 getNextReadPosition() const;
107107

108108
/// Get the total length (in samples) of this audio source
109-
int64 getTotalLength() const;
109+
juce::int64 getTotalLength() const;
110110

111111
/// Determines if this audio source should repeat when it reaches the end
112112
bool isLooping() const;
@@ -116,7 +116,7 @@ namespace openshot
116116
void setLooping (bool shouldLoop);
117117

118118
/// Update the internal buffer used by this source
119-
void setBuffer (AudioSampleBuffer *audio_buffer);
119+
void setBuffer (juce::AudioSampleBuffer *audio_buffer);
120120

121121
const ReaderInfo & getReaderInfo() const { return reader->info; }
122122

include/AudioResampler.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ namespace openshot {
5555
*/
5656
class AudioResampler {
5757
private:
58-
AudioSampleBuffer *buffer;
59-
AudioSampleBuffer *resampled_buffer;
58+
juce::AudioSampleBuffer *buffer;
59+
juce::AudioSampleBuffer *resampled_buffer;
6060
AudioBufferSource *buffer_source;
61-
ResamplingAudioSource *resample_source;
62-
AudioSourceChannelInfo resample_callback_buffer;
61+
juce::ResamplingAudioSource *resample_source;
62+
juce::AudioSourceChannelInfo resample_callback_buffer;
6363

6464
int num_of_samples;
6565
int new_num_of_samples;
@@ -78,15 +78,15 @@ namespace openshot {
7878
/// @param new_buffer The buffer of audio samples needing to be resampled
7979
/// @param sample_rate The original sample rate of the buffered samples
8080
/// @param new_sample_rate The requested sample rate you need
81-
void SetBuffer(AudioSampleBuffer *new_buffer, double sample_rate, double new_sample_rate);
81+
void SetBuffer(juce::AudioSampleBuffer *new_buffer, double sample_rate, double new_sample_rate);
8282

8383
/// @brief Sets the audio buffer and key settings
8484
/// @param new_buffer The buffer of audio samples needing to be resampled
8585
/// @param ratio The multiplier that needs to be applied to the sample rate (this is how resampling happens)
86-
void SetBuffer(AudioSampleBuffer *new_buffer, double ratio);
86+
void SetBuffer(juce::AudioSampleBuffer *new_buffer, double ratio);
8787

8888
/// Get the resampled audio buffer
89-
AudioSampleBuffer* GetResampledBuffer();
89+
juce::AudioSampleBuffer* GetResampledBuffer();
9090
};
9191

9292
}

include/CacheBase.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ namespace openshot {
5353
int64_t max_bytes; ///< This is the max number of bytes to cache (0 = no limit)
5454

5555
/// Section lock for multiple threads
56-
CriticalSection *cacheCriticalSection;
56+
juce::CriticalSection *cacheCriticalSection;
5757

5858

5959
public:

include/Clip.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,15 +103,15 @@ namespace openshot {
103103
class Clip : public ClipBase {
104104
protected:
105105
/// Section lock for multiple threads
106-
CriticalSection getFrameCriticalSection;
106+
juce::CriticalSection getFrameCriticalSection;
107107

108108
private:
109109
bool waveform; ///< Should a waveform be used instead of the clip's image
110-
list<EffectBase*> effects; ///<List of clips on this timeline
110+
std::list<EffectBase*> effects; ///<List of clips on this timeline
111111

112112
// Audio resampler (if time mapping)
113113
AudioResampler *resampler;
114-
AudioSampleBuffer *audio_cache;
114+
juce::AudioSampleBuffer *audio_cache;
115115

116116
// File Reader object
117117
ReaderBase* reader;
@@ -127,7 +127,7 @@ namespace openshot {
127127
std::shared_ptr<Frame> apply_effects(std::shared_ptr<Frame> frame);
128128

129129
/// Get file extension
130-
string get_file_extension(string path);
130+
std::string get_file_extension(std::string path);
131131

132132
/// Get a frame object or create a blank one
133133
std::shared_ptr<Frame> GetOrCreateFrame(int64_t number);

include/Frame.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@ namespace openshot
119119
std::shared_ptr<QImage> wave_image;
120120
std::shared_ptr<juce::AudioSampleBuffer> audio;
121121
std::shared_ptr<QApplication> previewApp;
122-
CriticalSection addingImageSection;
123-
CriticalSection addingAudioSection;
122+
juce::CriticalSection addingImageSection;
123+
juce::CriticalSection addingAudioSection;
124124
const unsigned char *qbuffer;
125125
Fraction pixel_ratio;
126126
int channels;

include/ReaderBase.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ namespace openshot
100100
{
101101
protected:
102102
/// Section lock for multiple threads
103-
CriticalSection getFrameCriticalSection;
104-
CriticalSection processingCriticalSection;
103+
juce::CriticalSection getFrameCriticalSection;
104+
juce::CriticalSection processingCriticalSection;
105105
ClipBase* parent;
106106

107107
public:

include/ZmqLogger.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ namespace openshot {
5555
*/
5656
class ZmqLogger {
5757
private:
58-
CriticalSection loggerCriticalSection;
58+
juce::CriticalSection loggerCriticalSection;
5959
std::string connection;
6060

6161
// Logfile related vars

src/AudioBufferSource.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ using namespace std;
3434
using namespace openshot;
3535

3636
// Default constructor
37-
AudioBufferSource::AudioBufferSource(AudioSampleBuffer *audio_buffer)
37+
AudioBufferSource::AudioBufferSource(juce::AudioSampleBuffer *audio_buffer)
3838
: position(0), start(0), repeat(false), buffer(audio_buffer)
3939
{ }
4040

@@ -46,7 +46,7 @@ AudioBufferSource::~AudioBufferSource()
4646
};
4747

4848
// Get the next block of audio samples
49-
void AudioBufferSource::getNextAudioBlock (const AudioSourceChannelInfo& info)
49+
void AudioBufferSource::getNextAudioBlock (const juce::AudioSourceChannelInfo& info)
5050
{
5151
int buffer_samples = buffer->getNumSamples();
5252
int buffer_channels = buffer->getNumChannels();
@@ -98,22 +98,22 @@ void AudioBufferSource::prepareToPlay(int, double) { }
9898
void AudioBufferSource::releaseResources() { }
9999

100100
// Set the next read position of this source
101-
void AudioBufferSource::setNextReadPosition (int64 newPosition)
101+
void AudioBufferSource::setNextReadPosition (juce::int64 newPosition)
102102
{
103103
// set position (if the new position is in range)
104104
if (newPosition >= 0 && newPosition < buffer->getNumSamples())
105105
position = newPosition;
106106
}
107107

108108
// Get the next read position of this source
109-
int64 AudioBufferSource::getNextReadPosition() const
109+
juce::int64 AudioBufferSource::getNextReadPosition() const
110110
{
111111
// return the next read position
112112
return position;
113113
}
114114

115115
// Get the total length (in samples) of this audio source
116-
int64 AudioBufferSource::getTotalLength() const
116+
juce::int64 AudioBufferSource::getTotalLength() const
117117
{
118118
// Get the length
119119
return buffer->getNumSamples();
@@ -134,7 +134,7 @@ void AudioBufferSource::setLooping (bool shouldLoop)
134134
}
135135

136136
// Use a different AudioSampleBuffer for this source
137-
void AudioBufferSource::setBuffer (AudioSampleBuffer *audio_buffer)
137+
void AudioBufferSource::setBuffer (juce::AudioSampleBuffer *audio_buffer)
138138
{
139139
buffer = audio_buffer;
140140
setNextReadPosition(0);

src/AudioReaderSource.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ juce::AudioSampleBuffer* AudioReaderSource::reverse_buffer(juce::AudioSampleBuff
152152
ZmqLogger::Instance()->AppendDebugMethod("AudioReaderSource::reverse_buffer", "number_of_samples", number_of_samples, "channels", channels);
153153

154154
// Reverse array (create new buffer to hold the reversed version)
155-
AudioSampleBuffer *reversed = new juce::AudioSampleBuffer(channels, number_of_samples);
155+
juce::AudioSampleBuffer *reversed = new juce::AudioSampleBuffer(channels, number_of_samples);
156156
reversed->clear();
157157

158158
for (int channel = 0; channel < channels; channel++)
@@ -177,7 +177,7 @@ juce::AudioSampleBuffer* AudioReaderSource::reverse_buffer(juce::AudioSampleBuff
177177
}
178178

179179
// Get the next block of audio samples
180-
void AudioReaderSource::getNextAudioBlock(const AudioSourceChannelInfo& info)
180+
void AudioReaderSource::getNextAudioBlock(const juce::AudioSourceChannelInfo& info)
181181
{
182182
int buffer_samples = buffer->getNumSamples();
183183
int buffer_channels = buffer->getNumChannels();
@@ -248,22 +248,22 @@ void AudioReaderSource::prepareToPlay(int, double) { }
248248
void AudioReaderSource::releaseResources() { }
249249

250250
// Set the next read position of this source
251-
void AudioReaderSource::setNextReadPosition (int64 newPosition)
251+
void AudioReaderSource::setNextReadPosition (juce::int64 newPosition)
252252
{
253253
// set position (if the new position is in range)
254254
if (newPosition >= 0 && newPosition < buffer->getNumSamples())
255255
position = newPosition;
256256
}
257257

258258
// Get the next read position of this source
259-
int64 AudioReaderSource::getNextReadPosition() const
259+
juce::int64 AudioReaderSource::getNextReadPosition() const
260260
{
261261
// return the next read position
262262
return position;
263263
}
264264

265265
// Get the total length (in samples) of this audio source
266-
int64 AudioReaderSource::getTotalLength() const
266+
juce::int64 AudioReaderSource::getTotalLength() const
267267
{
268268
// Get the length
269269
if (reader)
@@ -287,7 +287,7 @@ void AudioReaderSource::setLooping (bool shouldLoop)
287287
}
288288

289289
// Update the internal buffer used by this source
290-
void AudioReaderSource::setBuffer (AudioSampleBuffer *audio_buffer)
290+
void AudioReaderSource::setBuffer (juce::AudioSampleBuffer *audio_buffer)
291291
{
292292
buffer = audio_buffer;
293293
setNextReadPosition(0);

0 commit comments

Comments
 (0)