projects
/
dcpomatic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
16e560c
)
C++11 tidying.
author
Carl Hetherington
<cth@carlh.net>
Sat, 3 Jul 2021 20:35:30 +0000
(22:35 +0200)
committer
Carl Hetherington
<cth@carlh.net>
Sat, 3 Jul 2021 20:35:30 +0000
(22:35 +0200)
src/lib/audio_filter.cc
patch
|
blob
|
history
src/lib/audio_filter.h
patch
|
blob
|
history
src/lib/encoder.cc
patch
|
blob
|
history
src/lib/encoder.h
patch
|
blob
|
history
src/lib/filter_graph.cc
patch
|
blob
|
history
src/lib/filter_graph.h
patch
|
blob
|
history
src/lib/user_property.h
patch
|
blob
|
history
diff --git
a/src/lib/audio_filter.cc
b/src/lib/audio_filter.cc
index 24aa244f2fe7bc2e18da7b5259f0a09e10b44d78..281ac966831c8e80de73609a96a12132a763d67a 100644
(file)
--- a/
src/lib/audio_filter.cc
+++ b/
src/lib/audio_filter.cc
@@
-1,5
+1,5
@@
/*
/*
- Copyright (C) 2014 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2014
-2021
Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
This file is part of DCP-o-matic.
@@
-18,14
+18,18
@@
*/
*/
+
#include "audio_filter.h"
#include "audio_buffers.h"
#include "util.h"
#include <cmath>
#include "audio_filter.h"
#include "audio_buffers.h"
#include "util.h"
#include <cmath>
+
+using std::make_shared;
using std::min;
using std::shared_ptr;
using std::min;
using std::shared_ptr;
+
/** @return array of floats which the caller must destroy with delete[] */
float *
AudioFilter::sinc_blackman (float cutoff, bool invert) const
/** @return array of floats which the caller must destroy with delete[] */
float *
AudioFilter::sinc_blackman (float cutoff, bool invert) const
@@
-68,15
+72,17
@@
AudioFilter::sinc_blackman (float cutoff, bool invert) const
return ir;
}
return ir;
}
+
AudioFilter::~AudioFilter ()
{
delete[] _ir;
}
AudioFilter::~AudioFilter ()
{
delete[] _ir;
}
+
shared_ptr<AudioBuffers>
AudioFilter::run (shared_ptr<const AudioBuffers> in)
{
shared_ptr<AudioBuffers>
AudioFilter::run (shared_ptr<const AudioBuffers> in)
{
-
shared_ptr<AudioBuffers> out (new AudioBuffers (in->channels(), in->frames()
));
+
auto out = make_shared<AudioBuffers>(in->channels(), in->frames(
));
if (!_tail) {
_tail.reset (new AudioBuffers (in->channels(), _M + 1));
if (!_tail) {
_tail.reset (new AudioBuffers (in->channels(), _M + 1));
@@
-87,9
+93,9
@@
AudioFilter::run (shared_ptr<const AudioBuffers> in)
int const frames = in->frames ();
for (int i = 0; i < channels; ++i) {
int const frames = in->frames ();
for (int i = 0; i < channels; ++i) {
-
float*
tail_p = _tail->data (i);
-
float*
in_p = in->data (i);
-
float*
out_p = out->data (i);
+
auto
tail_p = _tail->data (i);
+
auto
in_p = in->data (i);
+
auto
out_p = out->data (i);
for (int j = 0; j < frames; ++j) {
float s = 0;
for (int k = 0; k <= _M; ++k) {
for (int j = 0; j < frames; ++j) {
float s = 0;
for (int k = 0; k <= _M; ++k) {
@@
-113,12
+119,14
@@
AudioFilter::run (shared_ptr<const AudioBuffers> in)
return out;
}
return out;
}
+
void
AudioFilter::flush ()
{
_tail.reset ();
}
void
AudioFilter::flush ()
{
_tail.reset ();
}
+
LowPassAudioFilter::LowPassAudioFilter (float transition_bandwidth, float cutoff)
: AudioFilter (transition_bandwidth)
{
LowPassAudioFilter::LowPassAudioFilter (float transition_bandwidth, float cutoff)
: AudioFilter (transition_bandwidth)
{
@@
-132,11
+140,12
@@
HighPassAudioFilter::HighPassAudioFilter (float transition_bandwidth, float cuto
_ir = sinc_blackman (cutoff, true);
}
_ir = sinc_blackman (cutoff, true);
}
+
BandPassAudioFilter::BandPassAudioFilter (float transition_bandwidth, float lower, float higher)
: AudioFilter (transition_bandwidth)
{
BandPassAudioFilter::BandPassAudioFilter (float transition_bandwidth, float lower, float higher)
: AudioFilter (transition_bandwidth)
{
-
float*
lpf = sinc_blackman (lower, false);
-
float*
hpf = sinc_blackman (higher, true);
+
auto
lpf = sinc_blackman (lower, false);
+
auto
hpf = sinc_blackman (higher, true);
delete[] _ir;
_ir = new float[_M + 1];
delete[] _ir;
_ir = new float[_M + 1];
diff --git
a/src/lib/audio_filter.h
b/src/lib/audio_filter.h
index 500cfa6e258b5b4d39fe5323596d75a5552b45d4..922cc5fdb483fdec278721becf8f4528776600dd 100644
(file)
--- a/
src/lib/audio_filter.h
+++ b/
src/lib/audio_filter.h
@@
-1,5
+1,5
@@
/*
/*
- Copyright (C) 2014 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2014
-2021
Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
This file is part of DCP-o-matic.
@@
-28,6
+28,7
@@
class AudioBuffers;
struct audio_filter_impulse_input_test;
class AudioBuffers;
struct audio_filter_impulse_input_test;
+
/** An audio filter which can take AudioBuffers and apply some filtering operation,
* returning filtered samples
*/
/** An audio filter which can take AudioBuffers and apply some filtering operation,
* returning filtered samples
*/
@@
-35,7
+36,6
@@
class AudioFilter
{
public:
explicit AudioFilter (float transition_bandwidth)
{
public:
explicit AudioFilter (float transition_bandwidth)
- : _ir (0)
{
_M = 4 / transition_bandwidth;
if (_M % 2) {
{
_M = 4 / transition_bandwidth;
if (_M % 2) {
@@
-55,11
+55,12
@@
protected:
float* sinc_blackman (float cutoff, bool invert) const;
float* sinc_blackman (float cutoff, bool invert) const;
- float* _ir;
+ float* _ir
= nullptr
;
int _M;
std::shared_ptr<AudioBuffers> _tail;
};
int _M;
std::shared_ptr<AudioBuffers> _tail;
};
+
class LowPassAudioFilter : public AudioFilter
{
public:
class LowPassAudioFilter : public AudioFilter
{
public:
@@
-70,6
+71,7
@@
public:
LowPassAudioFilter (float transition_bandwidth, float cutoff);
};
LowPassAudioFilter (float transition_bandwidth, float cutoff);
};
+
class HighPassAudioFilter : public AudioFilter
{
public:
class HighPassAudioFilter : public AudioFilter
{
public:
@@
-80,6
+82,7
@@
public:
HighPassAudioFilter (float transition_bandwidth, float cutoff);
};
HighPassAudioFilter (float transition_bandwidth, float cutoff);
};
+
class BandPassAudioFilter : public AudioFilter
{
public:
class BandPassAudioFilter : public AudioFilter
{
public:
@@
-91,4
+94,5
@@
public:
BandPassAudioFilter (float transition_bandwidth, float lower, float higher);
};
BandPassAudioFilter (float transition_bandwidth, float lower, float higher);
};
+
#endif
#endif
diff --git
a/src/lib/encoder.cc
b/src/lib/encoder.cc
index fd826deb6666320ee33be0d0f6591cef9b0b5b10..fe27cb7dd5a80574c69cc93213fba7f0cdc619d2 100644
(file)
--- a/
src/lib/encoder.cc
+++ b/
src/lib/encoder.cc
@@
-18,6
+18,7
@@
*/
*/
+
/** @file src/encoder.cc
* @brief A class which takes a Film and some Options, then uses those to encode the film
* into some output format.
/** @file src/encoder.cc
* @brief A class which takes a Film and some Options, then uses those to encode the film
* into some output format.
@@
-26,19
+27,18
@@
* as a parameter to the constructor.
*/
* as a parameter to the constructor.
*/
+
#include "encoder.h"
#include "player.h"
#include "i18n.h"
#include "encoder.h"
#include "player.h"
#include "i18n.h"
-using std::weak_ptr;
-using std::shared_ptr;
/** Construct an encoder.
* @param film Film that we are encoding.
* @param job Job that this encoder is being used in.
*/
/** Construct an encoder.
* @param film Film that we are encoding.
* @param job Job that this encoder is being used in.
*/
-Encoder::Encoder (s
hared_ptr<const Film> film,
weak_ptr<Job> job)
+Encoder::Encoder (s
td::shared_ptr<const Film> film, std::
weak_ptr<Job> job)
: _film (film)
, _job (job)
, _player (new Player(film))
: _film (film)
, _job (job)
, _player (new Player(film))
diff --git
a/src/lib/encoder.h
b/src/lib/encoder.h
index 1403e75b2d4f7691d6da67c69d7472b24e96d94a..19c1120b360f789fd8af1ef76ccf85a97e494337 100644
(file)
--- a/
src/lib/encoder.h
+++ b/
src/lib/encoder.h
@@
-1,5
+1,5
@@
/*
/*
- Copyright (C) 2012-20
17
Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-20
21
Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
This file is part of DCP-o-matic.
@@
-18,13
+18,16
@@
*/
*/
+
#ifndef DCPOMATIC_ENCODER_H
#define DCPOMATIC_ENCODER_H
#ifndef DCPOMATIC_ENCODER_H
#define DCPOMATIC_ENCODER_H
-#include "types.h"
+
#include "player_text.h"
#include "player_text.h"
+#include "types.h"
#include <boost/signals2.hpp>
#include <boost/signals2.hpp>
+
class Film;
class Encoder;
class Player;
class Film;
class Encoder;
class Player;
@@
-32,6
+35,7
@@
class Job;
class PlayerVideo;
class AudioBuffers;
class PlayerVideo;
class AudioBuffers;
+
/** @class Encoder
* @brief Parent class for something that can encode a film into some format
*/
/** @class Encoder
* @brief Parent class for something that can encode a film into some format
*/
@@
-48,7
+52,7
@@
public:
/** @return the current frame rate over the last short while */
virtual boost::optional<float> current_rate () const {
/** @return the current frame rate over the last short while */
virtual boost::optional<float> current_rate () const {
- return
boost::optional<float>()
;
+ return
{}
;
}
/** @return the number of frames that are done */
}
/** @return the number of frames that are done */
@@
-61,4
+65,5
@@
protected:
std::shared_ptr<Player> _player;
};
std::shared_ptr<Player> _player;
};
+
#endif
#endif
diff --git
a/src/lib/filter_graph.cc
b/src/lib/filter_graph.cc
index ba0e01ed534f131c7025f0a34c726cfe6f66ed15..fc6b9033ac97805e01b4ea45aaeca6dc6fb41208 100644
(file)
--- a/
src/lib/filter_graph.cc
+++ b/
src/lib/filter_graph.cc
@@
-1,5
+1,5
@@
/*
/*
- Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012
-2021
Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
This file is part of DCP-o-matic.
@@
-50,22
+50,11
@@
using std::weak_ptr;
using dcp::Size;
using dcp::Size;
-/** Construct a FilterGraph for the settings in a piece of content */
-FilterGraph::FilterGraph ()
- : _graph (0)
- , _copy (false)
- , _buffer_src_context (0)
- , _buffer_sink_context (0)
- , _frame (0)
-{
-
-}
-
void
FilterGraph::setup (vector<Filter const *> filters)
{
void
FilterGraph::setup (vector<Filter const *> filters)
{
-
string
const filters_string = Filter::ffmpeg_string (filters);
- if (filters.empty
()) {
+
auto
const filters_string = Filter::ffmpeg_string (filters);
+ if (filters.empty()) {
_copy = true;
return;
}
_copy = true;
return;
}
diff --git
a/src/lib/filter_graph.h
b/src/lib/filter_graph.h
index d5a2da7a29be925cbbb6e572544a8390dd2c57ba..9ee628d4cd097fa9b2bae97e08ac793986be4261 100644
(file)
--- a/
src/lib/filter_graph.h
+++ b/
src/lib/filter_graph.h
@@
-1,5
+1,5
@@
/*
/*
- Copyright (C) 2012-20
15
Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-20
21
Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
This file is part of DCP-o-matic.
@@
-18,13
+18,16
@@
*/
*/
+
/** @file src/lib/filter_graph.h
* @brief A graph of FFmpeg filters.
*/
/** @file src/lib/filter_graph.h
* @brief A graph of FFmpeg filters.
*/
+
#ifndef DCPOMATIC_FILTER_GRAPH_H
#define DCPOMATIC_FILTER_GRAPH_H
#ifndef DCPOMATIC_FILTER_GRAPH_H
#define DCPOMATIC_FILTER_GRAPH_H
+
#include "util.h"
#include "warnings.h"
DCPOMATIC_DISABLE_WARNINGS
#include "util.h"
#include "warnings.h"
DCPOMATIC_DISABLE_WARNINGS
@@
-33,18
+36,20
@@
extern "C" {
}
DCPOMATIC_ENABLE_WARNINGS
}
DCPOMATIC_ENABLE_WARNINGS
+
struct AVFilterContext;
struct AVFrame;
class Image;
class Filter;
struct AVFilterContext;
struct AVFrame;
class Image;
class Filter;
+
/** @class FilterGraph
* @brief A graph of FFmpeg filters.
*/
class FilterGraph
{
public:
/** @class FilterGraph
* @brief A graph of FFmpeg filters.
*/
class FilterGraph
{
public:
- FilterGraph
()
;
+ FilterGraph
() = default
;
virtual ~FilterGraph ();
FilterGraph (FilterGraph const&) = delete;
virtual ~FilterGraph ();
FilterGraph (FilterGraph const&) = delete;
@@
-59,12
+64,13
@@
protected:
virtual void set_parameters (AVFilterContext* context) const = 0;
virtual std::string sink_name () const = 0;
virtual void set_parameters (AVFilterContext* context) const = 0;
virtual std::string sink_name () const = 0;
- AVFilterGraph* _graph;
+ AVFilterGraph* _graph
= nullptr
;
/** true if this graph has no filters in, so it just copies stuff straight through */
/** true if this graph has no filters in, so it just copies stuff straight through */
- bool _copy;
- AVFilterContext* _buffer_src_context;
- AVFilterContext* _buffer_sink_context;
- AVFrame* _frame;
+ bool _copy
= false
;
+ AVFilterContext* _buffer_src_context
= nullptr
;
+ AVFilterContext* _buffer_sink_context
= nullptr
;
+ AVFrame* _frame
= nullptr
;
};
};
+
#endif
#endif
diff --git
a/src/lib/user_property.h
b/src/lib/user_property.h
index ffbb99a5f4b81f1f19f233607eab59241da23715..fb597eeb64ff67dd74e5b2b67658a017572a228d 100644
(file)
--- a/
src/lib/user_property.h
+++ b/
src/lib/user_property.h
@@
-1,5
+1,5
@@
/*
/*
- Copyright (C) 2013-20
16
Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2013-20
21
Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
This file is part of DCP-o-matic.
@@
-18,11
+18,14
@@
*/
*/
+
#ifndef DCPOMATIC_USER_PROPERTY_H
#define DCPOMATIC_USER_PROPERTY_H
#ifndef DCPOMATIC_USER_PROPERTY_H
#define DCPOMATIC_USER_PROPERTY_H
+
#include <dcp/locale_convert.h>
#include <dcp/locale_convert.h>
+
class UserProperty
{
public:
class UserProperty
{
public:
@@
-47,4
+50,5
@@
public:
std::string unit;
};
std::string unit;
};
+
#endif
#endif