* Add subtitle view.
+2014-06-03 Carl Hetherington <cth@carlh.net>
+
+ * Fix bad resampling of separate sound file sources that
+ have specified video frame rates.
+
+ * Version 1.69.20 released.
+
+2014-06-03 Carl Hetherington <cth@carlh.net>
+
+ * Re-calculate and update audio plots when the mapping is changed.
+
+ * Change the -3dB preset to -6dB since we are talking about
+ amplitude, not power.
+
+ * Version 1.69.19 released.
+
+2014-06-02 Carl Hetherington <cth@carlh.net>
+
+ * Empirical hack to prevent over-read of array
+ by libswscale; may fix crashes at the start of
+ DCP encodes.
+
2014-05-29 Carl Hetherington <cth@carlh.net>
* Version 1.69.18 released.
-dcpomatic (1.69.18-1) UNRELEASED; urgency=low
+dcpomatic (1.69.20-1) UNRELEASED; urgency=low
* New upstream release.
* New upstream release.
* New upstream release.
* New upstream release.
* New upstream release.
+ * New upstream release.
+ * New upstream release.
- -- Carl Hetherington <carl@d1stkfactory> Thu, 29 May 2014 16:38:35 +0100
+ -- Carl Hetherington <carl@d1stkfactory> Tue, 03 Jun 2014 15:32:33 +0100
dcpomatic (0.87-1) UNRELEASED; urgency=low
gdb --args build/src/tools/dcpomatic_cli "$@"
elif [ "$1" == "--valgrind" ]; then
shift
- valgrind --tool="memcheck" --leak-check=full --show-reachable=yes --num-callers=24 build/src/tools/dcpomatic_cli "$@"
+ valgrind --tool="memcheck" --num-callers=24 --suppressions=suppressions build/src/tools/dcpomatic_cli "$@"
+# valgrind --tool="memcheck" --leak-check=full --show-reachable=yes --num-callers=24 --suppressions=suppressions build/src/tools/dcpomatic_cli "$@"
else
build/src/tools/dcpomatic_cli "$@"
fi
#include "i18n.h"
using std::string;
+using std::cout;
using std::vector;
using boost::shared_ptr;
using boost::dynamic_pointer_cast;
}
boost::filesystem::path p = film->audio_analysis_dir ();
- p /= digest ();
+ p /= digest() + "_" + audio_mapping().digest();
return p;
}
#include <dcp/raw_convert.h>
#include "audio_mapping.h"
#include "util.h"
+#include "md5_digester.h"
using std::list;
using std::cout;
}
}
}
+
+/** @return a string which is unique for a given AudioMapping configuration, for
+ * differentiation between different AudioMappings.
+ */
+string
+AudioMapping::digest () const
+{
+ MD5Digester digester;
+ digester.add (_content_channels);
+ for (int i = 0; i < _content_channels; ++i) {
+ for (int j = 0; j < MAX_DCP_AUDIO_CHANNELS; ++j) {
+ digester.add (_gain[i][j]);
+ }
+ }
+
+ return digester.get ();
+}
int content_channels () const {
return _content_channels;
}
+
+ std::string digest () const;
private:
void setup (int);
#include "config.h"
#include "colour_conversion.h"
#include "util.h"
+#include "md5_digester.h"
#include "i18n.h"
string
ColourConversion::identifier () const
{
- double numbers[12];
-
- int n = 0;
- numbers[n++] = input_gamma;
- numbers[n++] = input_gamma_linearised;
+ MD5Digester digester;
+
+ digester.add (input_gamma);
+ digester.add (input_gamma_linearised);
for (int i = 0; i < 3; ++i) {
for (int j = 0; j < 3; ++j) {
- numbers[n++] = matrix (i, j);
+ digester.add (matrix (i, j));
}
}
- numbers[n++] = output_gamma;
-
- assert (n == 12);
-
- return md5_digest (numbers, 12 * sizeof (double));
+ digester.add (output_gamma);
+
+ return digester.get ();
}
PresetColourConversion::PresetColourConversion ()
#include <boost/asio.hpp>
#include <boost/filesystem.hpp>
#include <boost/lexical_cast.hpp>
-#include <openssl/md5.h>
#include <dcp/gamma_lut.h>
#include <dcp/xyz_frame.h>
#include <dcp/rgb_xyz.h>
matrix
);
- {
- MD5_CTX md5_context;
- MD5_Init (&md5_context);
- MD5_Update (&md5_context, xyz->data(0), 1998 * 1080 * 4);
- MD5_Update (&md5_context, xyz->data(1), 1998 * 1080 * 4);
- MD5_Update (&md5_context, xyz->data(2), 1998 * 1080 * 4);
- unsigned char digest[MD5_DIGEST_LENGTH];
- MD5_Final (digest, &md5_context);
-
- stringstream s;
- for (int i = 0; i < MD5_DIGEST_LENGTH; ++i) {
- s << std::hex << std::setfill('0') << std::setw(2) << ((int) digest[i]);
- }
- }
-
/* Set the max image and component sizes based on frame_rate */
int max_cs_len = ((float) _j2k_bandwidth) / 8 / _frames_per_second;
if (_frame->eyes() == EYES_LEFT || _frame->eyes() == EYES_RIGHT) {
*/
#include <iostream>
-#include <openssl/md5.h>
extern "C" {
#include <libswscale/swscale.h>
#include <libavutil/pixfmt.h>
#include "scaler.h"
#include "timer.h"
#include "rect.h"
+#include "md5_digester.h"
#include "i18n.h"
OS X crashes on this illegal read, though other operating systems don't
seem to mind. The nasty + 1 in this malloc makes sure there is always a byte
for that instruction to read safely.
+
+ Further to the above, valgrind is now telling me that ff_rgb24ToY_ssse3
+ over-reads by more then _avx. I can't follow the code to work out how much,
+ so I'll just over-allocate by 32 bytes and have done with it. Empirical
+ testing suggests that it works.
*/
- _data[i] = (uint8_t *) wrapped_av_malloc (_stride[i] * lines (i) + 1);
+ _data[i] = (uint8_t *) wrapped_av_malloc (_stride[i] * lines (i) + 32);
}
}
string
Image::digest () const
{
- MD5_CTX md5_context;
- MD5_Init (&md5_context);
+ MD5Digester digester;
for (int i = 0; i < components(); ++i) {
- MD5_Update (&md5_context, data()[i], line_size()[i]);
- }
-
- unsigned char digest[MD5_DIGEST_LENGTH];
- MD5_Final (digest, &md5_context);
-
- stringstream s;
- for (int i = 0; i < MD5_DIGEST_LENGTH; ++i) {
- s << std::hex << std::setfill('0') << std::setw(2) << ((int) digest[i]);
+ digester.add (data()[i], line_size()[i]);
}
- return s.str ();
+ return digester.get ();
}
--- /dev/null
+/*
+ Copyright (C) 2014 Carl Hetherington <cth@carlh.net>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include <iomanip>
+#include <sstream>
+#include <openssl/md5.h>
+#include "md5_digester.h"
+
+using std::string;
+using std::stringstream;
+using std::hex;
+using std::setfill;
+using std::setw;
+
+MD5Digester::MD5Digester ()
+{
+ MD5_Init (&_context);
+}
+
+MD5Digester::~MD5Digester ()
+{
+ get ();
+}
+
+void
+MD5Digester::add (void const * data, size_t size)
+{
+ MD5_Update (&_context, data, size);
+}
+
+string
+MD5Digester::get () const
+{
+ if (!_digest) {
+ unsigned char digest[MD5_DIGEST_LENGTH];
+ MD5_Final (digest, &_context);
+
+ stringstream s;
+ for (int i = 0; i < MD5_DIGEST_LENGTH; ++i) {
+ s << hex << setfill('0') << setw(2) << ((int) digest[i]);
+ }
+
+ _digest = s.str ();
+ }
+
+ return _digest.get ();
+}
--- /dev/null
+/*
+ Copyright (C) 2014 Carl Hetherington <cth@carlh.net>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include <string>
+#include <boost/noncopyable.hpp>
+#include <boost/optional.hpp>
+#include <openssl/md5.h>
+
+class MD5Digester : public boost::noncopyable
+{
+public:
+ MD5Digester ();
+ ~MD5Digester ();
+
+ void add (void const * data, size_t size);
+
+ template <class T>
+ void add (T data) {
+ add (&data, sizeof (T));
+ }
+
+ std::string get () const;
+
+private:
+ mutable MD5_CTX _context;
+ mutable boost::optional<std::string> _digest;
+};
}
}
+/** @param already_resampled true if this data has already been through the chain up to the resampler */
void
Player::playlist_changed ()
{
#include "job.h"
#include "config.h"
#include "util.h"
+#include "md5_digester.h"
#include "i18n.h"
}
}
- return md5_digest (t.c_str(), t.length());
+ MD5Digester digester;
+ digester.add (t.c_str(), t.length());
+ return digester.get ();
}
/** @param node <Playlist> node */
#endif
#include <glib.h>
#include <openjpeg.h>
-#include <openssl/md5.h>
#include <pangomm/init.h>
#include <magick/MagickCore.h>
#include <magick/version.h>
#include "cross.h"
#include "video_content.h"
#include "rect.h"
+#include "md5_digester.h"
#ifdef DCPOMATIC_WINDOWS
#include "stack.hpp"
#endif
{
dbg::stack s;
FILE* f = fopen_boost (backtrace_file, "w");
+ fprintf (f, "Exception thrown:");
for (dbg::stack::const_iterator i = s.begin(); i != s.end(); ++i) {
- fprintf (f, "%p %s %d %s", i->instruction, i->function.c_str(), i->line, i->module.c_str());
+ fprintf (f, "%p %s %d %s\n", i->instruction, i->function.c_str(), i->line, i->module.c_str());
}
fclose (f);
return EXCEPTION_CONTINUE_SEARCH;
return out;
}
-string
-md5_digest (void const * data, int size)
-{
- MD5_CTX md5_context;
- MD5_Init (&md5_context);
- MD5_Update (&md5_context, data, size);
- unsigned char digest[MD5_DIGEST_LENGTH];
- MD5_Final (digest, &md5_context);
-
- stringstream s;
- for (int i = 0; i < MD5_DIGEST_LENGTH; ++i) {
- s << std::hex << std::setfill('0') << std::setw(2) << ((int) digest[i]);
- }
-
- return s.str ();
-}
-
/** @param job Optional job for which to report progress */
string
md5_digest (vector<boost::filesystem::path> files, shared_ptr<Job> job)
boost::uintmax_t const buffer_size = 64 * 1024;
char buffer[buffer_size];
- MD5_CTX md5_context;
- MD5_Init (&md5_context);
+ MD5Digester digester;
vector<int64_t> sizes;
for (size_t i = 0; i < files.size(); ++i) {
while (remaining > 0) {
int const t = min (remaining, buffer_size);
fread (buffer, 1, t, f);
- MD5_Update (&md5_context, buffer, t);
+ digester.add (buffer, t);
remaining -= t;
if (job) {
fclose (f);
}
- unsigned char digest[MD5_DIGEST_LENGTH];
- MD5_Final (digest, &md5_context);
-
- stringstream s;
- for (int i = 0; i < MD5_DIGEST_LENGTH; ++i) {
- s << std::hex << std::setfill('0') << std::setw(2) << ((int) digest[i]);
- }
-
- return s.str ();
+ return digester.get ();
}
/** @param An arbitrary audio frame rate.
extern void dcpomatic_setup_gettext_i18n (std::string);
extern std::vector<std::string> split_at_spaces_considering_quotes (std::string);
extern std::string md5_digest (std::vector<boost::filesystem::path>, boost::shared_ptr<Job>);
-extern std::string md5_digest (void const *, int);
extern void ensure_ui_thread ();
extern std::string audio_channel_name (int);
extern bool valid_image_file (boost::filesystem::path);
#include "job.h"
#include "cross.h"
#include "audio_buffers.h"
+#include "md5_digester.h"
#include "i18n.h"
LOG_GENERAL ("Existing frame %1 is incomplete", f);
return false;
}
-
- string const existing_hash = md5_digest (data.data(), data.size());
- if (existing_hash != info.hash) {
+
+ MD5Digester digester;
+ digester.add (data.data(), data.size());
+ if (digester.get() != info.hash) {
LOG_GENERAL ("Existing frame %1 failed hash check", f);
return false;
}
kdm.cc
json_server.cc
log.cc
+ md5_digester.cc
player.cc
player_video_frame.cc
playlist.cc
}
if (!boost::filesystem::exists (_content->audio_analysis_path())) {
+ _plot->set_analysis (shared_ptr<AudioAnalysis> ());
_analysis_finished_connection = _content->analyse_audio (bind (&AudioDialog::analysis_finished, this));
return;
}
a.reset (new AudioAnalysis (_content->audio_analysis_path ()));
_plot->set_analysis (a);
- if (_channel_checkbox[0]) {
+ /* Set up some defaults if no check boxes are checked */
+
+ int i = 0;
+ while (i < MAX_DCP_AUDIO_CHANNELS && (!_channel_checkbox[i] || !_channel_checkbox[i]->GetValue ())) {
+ ++i;
+ }
+
+ if (i == MAX_DCP_AUDIO_CHANNELS && _channel_checkbox[0]) {
_channel_checkbox[0]->SetValue (true);
+ _plot->set_channel_visible (0, true);
}
- _plot->set_channel_visible (0, true);
- for (int i = 0; i < AudioPoint::COUNT; ++i) {
- _type_checkbox[i]->SetValue (true);
- _plot->set_type_visible (i, true);
+ i = 0;
+ while (i < AudioPoint::COUNT && !_type_checkbox[i]->GetValue ()) {
+ i++;
+ }
+
+ if (i == AudioPoint::COUNT) {
+ for (int i = 0; i < AudioPoint::COUNT; ++i) {
+ _type_checkbox[i]->SetValue (true);
+ _plot->set_type_visible (i, true);
+ }
}
}
{
if (p == AudioContentProperty::AUDIO_GAIN) {
_plot->set_gain (_content->audio_gain ());
+ } else if (p == AudioContentProperty::AUDIO_MAPPING) {
+ try_to_load_analysis ();
}
}
enum {
ID_off = 1,
ID_full = 2,
- ID_minus3dB = 3,
+ ID_minus6dB = 3,
ID_edit = 4
};
_menu = new wxMenu;
_menu->Append (ID_off, _("Off"));
_menu->Append (ID_full, _("Full"));
- _menu->Append (ID_minus3dB, _("-3dB"));
+ _menu->Append (ID_minus6dB, _("-6dB"));
_menu->Append (ID_edit, _("Edit..."));
Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&AudioMappingView::off, this), ID_off);
Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&AudioMappingView::full, this), ID_full);
- Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&AudioMappingView::minus3dB, this), ID_minus3dB);
+ Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&AudioMappingView::minus6dB, this), ID_minus6dB);
Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&AudioMappingView::edit, this), ID_edit);
}
}
void
-AudioMappingView::minus3dB ()
+AudioMappingView::minus6dB ()
{
- _map.set (_menu_row, static_cast<dcp::Channel> (_menu_column - 1), 1 / sqrt (2));
+ _map.set (_menu_row, static_cast<dcp::Channel> (_menu_column - 1), pow (10, -6.0 / 20));
map_changed ();
}
void off ();
void full ();
- void minus3dB ();
+ void minus6dB ();
void edit ();
wxGrid* _grid;
: wxPanel (parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE)
, _gain (0)
, _smoothing (max_smoothing / 2)
- , _message (_("Please wait; audio is being analysed..."))
{
#ifndef __WXOSX__
SetDoubleBuffered (true);
_colours.push_back (wxColour (255, 0, 139));
_colours.push_back (wxColour (139, 0, 255));
+ set_analysis (shared_ptr<AudioAnalysis> ());
+
#if MAX_DCP_AUDIO_CHANNELS != 12
#warning AudioPlot::AudioPlot is expecting the wrong MAX_DCP_AUDIO_CHANNELS
#endif
{
_analysis = a;
- for (int i = 0; i < MAX_DCP_AUDIO_CHANNELS; ++i) {
- _channel_visible[i] = false;
+ if (!a) {
+ _message = _("Please wait; audio is being analysed...");
}
- for (int i = 0; i < AudioPoint::COUNT; ++i) {
- _type_visible[i] = false;
- }
-
Refresh ();
}