Various: Remove unused variables (#467)

Several data members and local variables were flagged by static
analysis tools as never being used anywhere in the code.
This commit is contained in:
Frank Dana
2020-04-22 02:02:55 -04:00
committed by GitHub
parent f36bb334e2
commit 6336f30ee3
14 changed files with 9 additions and 27 deletions

View File

@@ -48,7 +48,6 @@ namespace openshot
{
private:
int position;
int start;
bool repeat;
juce::AudioSampleBuffer *buffer;

View File

@@ -54,7 +54,6 @@ namespace openshot
int speed; /// The speed and direction to playback a reader (1=normal, 2=fast, 3=faster, -1=rewind, etc...)
ReaderBase *reader; /// The reader to pull samples from
int64_t original_frame_number; /// The current frame to read from
int64_t frame_number; /// The current frame number
std::shared_ptr<Frame> frame; /// The current frame object that is being read
int64_t frame_position; /// The position of the current frame's buffer

View File

@@ -103,7 +103,6 @@ namespace openshot {
// Audio resampler (if time mapping)
openshot::AudioResampler *resampler;
juce::AudioSampleBuffer *audio_cache;
// File Reader object
openshot::ReaderBase* reader;

View File

@@ -167,7 +167,6 @@ namespace openshot {
AVCodecContext *video_codec;
AVCodecContext *audio_codec;
SwsContext *img_convert_ctx;
double audio_pts, video_pts;
int16_t *samples;
uint8_t *audio_outbuf;
uint8_t *audio_encoder_buffer;

View File

@@ -88,7 +88,6 @@ namespace openshot
private:
std::string path;
int cache_size;
bool is_writing;
bool is_open;
int64_t write_video_count;
std::vector<Magick::Image> frames;

View File

@@ -35,7 +35,7 @@ using namespace openshot;
// Default constructor
AudioBufferSource::AudioBufferSource(juce::AudioSampleBuffer *audio_buffer)
: position(0), start(0), repeat(false), buffer(audio_buffer)
: position(0), repeat(false), buffer(audio_buffer)
{ }
// Destructor

View File

@@ -35,7 +35,7 @@ using namespace openshot;
// Constructor that reads samples from a reader
AudioReaderSource::AudioReaderSource(ReaderBase *audio_reader, int64_t starting_frame_number, int buffer_size)
: reader(audio_reader), frame_number(starting_frame_number), original_frame_number(starting_frame_number),
: reader(audio_reader), frame_number(starting_frame_number),
size(buffer_size), position(0), frame_position(0), estimated_frame(0), speed(1) {
// Initialize an audio buffer (based on reader)

View File

@@ -228,7 +228,7 @@ std::shared_ptr<Frame> CacheDisk::GetFrame(int64_t frame_number)
// Load image file
std::shared_ptr<QImage> image = std::shared_ptr<QImage>(new QImage());
bool success = image->load(QString::fromStdString(frame_path.toStdString()));
image->load(frame_path);
// Set pixel formatimage->
image = std::shared_ptr<QImage>(new QImage(image->convertToFormat(QImage::Format_RGBA8888)));

View File

@@ -132,14 +132,14 @@ void Clip::init_reader_rotation() {
}
// Default Constructor for a clip
Clip::Clip() : resampler(NULL), audio_cache(NULL), reader(NULL), allocated_reader(NULL)
Clip::Clip() : resampler(NULL), reader(NULL), allocated_reader(NULL)
{
// Init all default settings
init_settings();
}
// Constructor with reader
Clip::Clip(ReaderBase* new_reader) : resampler(NULL), audio_cache(NULL), reader(new_reader), allocated_reader(NULL)
Clip::Clip(ReaderBase* new_reader) : resampler(NULL), reader(new_reader), allocated_reader(NULL)
{
// Init all default settings
init_settings();
@@ -153,7 +153,7 @@ Clip::Clip(ReaderBase* new_reader) : resampler(NULL), audio_cache(NULL), reader(
}
// Constructor with filepath
Clip::Clip(std::string path) : resampler(NULL), audio_cache(NULL), reader(NULL), allocated_reader(NULL)
Clip::Clip(std::string path) : resampler(NULL), reader(NULL), allocated_reader(NULL)
{
// Init all default settings
init_settings();
@@ -422,7 +422,6 @@ void Clip::get_time_mapped_frame(std::shared_ptr<Frame> frame, int64_t frame_num
int delta = int(round(time.GetDelta(frame_number)));
// Init audio vars
int sample_rate = reader->info.sample_rate;
int channels = reader->info.channels;
int number_of_samples = GetOrCreateFrame(new_frame_number)->GetAudioSamplesCount();
@@ -433,7 +432,6 @@ void Clip::get_time_mapped_frame(std::shared_ptr<Frame> frame, int64_t frame_num
// SLOWING DOWN AUDIO
// Resample data, and return new buffer pointer
juce::AudioSampleBuffer *resampled_buffer = NULL;
int resampled_buffer_size = 0;
// SLOW DOWN audio (split audio)
samples = new juce::AudioSampleBuffer(channels, number_of_samples);
@@ -455,9 +453,6 @@ void Clip::get_time_mapped_frame(std::shared_ptr<Frame> frame, int64_t frame_num
// Resample the data (since it's the 1st slice)
resampled_buffer = resampler->GetResampledBuffer();
// Get the length of the resampled buffer (if one exists)
resampled_buffer_size = resampled_buffer->getNumSamples();
// Just take the samples we need for the requested frame
int start = (number_of_samples * (time.GetRepeatFraction(frame_number).num - 1));
if (start > 0)
@@ -567,7 +562,6 @@ void Clip::get_time_mapped_frame(std::shared_ptr<Frame> frame, int64_t frame_num
// Resample data, and return new buffer pointer
juce::AudioSampleBuffer *buffer = resampler->GetResampledBuffer();
int resampled_buffer_size = buffer->getNumSamples();
// Add the newly resized audio samples to the current frame
for (int channel = 0; channel < channels; channel++)

View File

@@ -1426,8 +1426,6 @@ void FFmpegReader::ProcessAudioPacket(int64_t requested_frame, int64_t target_fr
int packet_samples = 0;
int data_size = 0;
// re-initialize buffer size (it gets changed in the avcodec_decode_audio2 method call)
int buf_size = AVCODEC_MAX_AUDIO_FRAME_SIZE + MY_INPUT_BUFFER_PADDING_SIZE;
#pragma omp critical (ProcessAudioPacket)
{
#if IS_FFMPEG_3_2
@@ -1465,7 +1463,6 @@ void FFmpegReader::ProcessAudioPacket(int64_t requested_frame, int64_t target_fr
if (frame_finished) {
// determine how many samples were decoded
int planar = av_sample_fmt_is_planar((AVSampleFormat) AV_GET_CODEC_PIXEL_FORMAT(aStream, aCodecCtx));
int plane_size = -1;
data_size = av_samples_get_buffer_size(&plane_size,
AV_GET_CODEC_ATTRIBUTES(aStream, aCodecCtx)->channels,
@@ -1554,7 +1551,7 @@ void FFmpegReader::ProcessAudioPacket(int64_t requested_frame, int64_t target_fr
av_opt_set_int(avr, "out_sample_rate", info.sample_rate, 0);
av_opt_set_int(avr, "in_channels", info.channels, 0);
av_opt_set_int(avr, "out_channels", info.channels, 0);
int r = SWR_INIT(avr);
SWR_INIT(avr);
// Convert audio samples
nb_samples = SWR_CONVERT(avr, // audio resample context

View File

@@ -84,7 +84,7 @@ static int set_hwframe_ctx(AVCodecContext *ctx, AVBufferRef *hw_device_ctx, int6
#endif // HAVE_HW_ACCEL
FFmpegWriter::FFmpegWriter(std::string path) :
path(path), fmt(NULL), oc(NULL), audio_st(NULL), video_st(NULL), audio_pts(0), video_pts(0), samples(NULL),
path(path), fmt(NULL), oc(NULL), audio_st(NULL), video_st(NULL), samples(NULL),
audio_outbuf(NULL), audio_outbuf_size(0), audio_input_frame_size(0), audio_input_position(0),
initial_audio_input_frame_size(0), img_convert_ctx(NULL), cache_size(8), num_of_rescalers(32),
rescaler_position(0), video_codec(NULL), audio_codec(NULL), is_writing(false), write_video_count(0), write_audio_count(0),
@@ -2030,7 +2030,6 @@ bool FFmpegWriter::write_video_packet(std::shared_ptr<Frame> frame, AVFrame *fra
int error_code = 0;
#if IS_FFMPEG_3_2
// Write video packet (latest version of FFmpeg)
int frameFinished = 0;
int ret;
#if HAVE_HW_ACCEL

View File

@@ -39,7 +39,7 @@
using namespace openshot;
ImageWriter::ImageWriter(std::string path) :
path(path), cache_size(8), is_writing(false), write_video_count(0), image_quality(75), number_of_loops(1),
path(path), cache_size(8), write_video_count(0), image_quality(75), number_of_loops(1),
combine_frames(true), is_open(false)
{
// Disable audio & video (so they can be independently enabled)

View File

@@ -524,9 +524,6 @@ void Timeline::add_layer(std::shared_ptr<Frame> new_frame, Clip* source_clip, in
// Loop through pixels
for (int pixel = 0, byte_index=0; pixel < source_image->width() * source_image->height(); pixel++, byte_index+=4)
{
// Get the alpha values from the pixel
int A = pixels[byte_index + 3];
// Apply alpha to pixel
pixels[byte_index + 3] *= alpha;
}