*/
-#include "audio_filter_graph.h"
+
#include "audio_buffers.h"
+#include "audio_filter_graph.h"
#include "compose.hpp"
+#include "dcpomatic_assert.h"
+#include "exceptions.h"
extern "C" {
#include <libavfilter/buffersink.h>
#include <libavfilter/buffersrc.h>
#include "i18n.h"
-using std::string;
+
using std::cout;
+using std::make_shared;
using std::shared_ptr;
+using std::string;
+
AudioFilterGraph::AudioFilterGraph (int sample_rate, int channels)
: _sample_rate (sample_rate)
}
_in_frame = av_frame_alloc ();
+ if (_in_frame == nullptr) {
+ throw std::bad_alloc();
+ }
}
AudioFilterGraph::~AudioFilterGraph()
}
void
-AudioFilterGraph::process (shared_ptr<const AudioBuffers> buffers)
+AudioFilterGraph::process (shared_ptr<AudioBuffers> buffers)
{
DCPOMATIC_ASSERT (buffers->frames() > 0);
int const process_channels = av_get_channel_layout_nb_channels (_channel_layout);
the constructor) so we need to create new buffers with some extra
silent channels.
*/
- shared_ptr<AudioBuffers> extended_buffers (new AudioBuffers (process_channels, buffers->frames()));
+ auto extended_buffers = make_shared<AudioBuffers>(process_channels, buffers->frames());
for (int i = 0; i < buffers->channels(); ++i) {
extended_buffers->copy_channel_from (buffers.get(), i, i);
}