From 3a72d3e7af018d4e4474d48d9007841a0c63c020 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sat, 25 May 2013 15:59:25 +0100 Subject: Try to fix memory leak in filter graph. --- src/lib/filter_graph.cc | 1 + 1 file changed, 1 insertion(+) (limited to 'src/lib') diff --git a/src/lib/filter_graph.cc b/src/lib/filter_graph.cc index b0427a23d..8ff5e75df 100644 --- a/src/lib/filter_graph.cc +++ b/src/lib/filter_graph.cc @@ -150,6 +150,7 @@ FFmpegFilterGraph::process (AVFrame* frame) } images.push_back (shared_ptr (new SimpleImage (_frame))); + av_frame_unref (_frame); } return images; -- cgit v1.2.3 From 003de48cd0371a60d095dc9d02ed5763c410cf5e Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 29 May 2013 12:00:36 +0100 Subject: Build fixes for OS X. --- src/lib/image.cc | 8 ++++---- src/tools/servomatic_gui.cc | 5 ++++- src/wx/audio_plot.cc | 2 ++ src/wx/film_viewer.cc | 3 +++ test/wscript | 2 +- 5 files changed, 14 insertions(+), 6 deletions(-) (limited to 'src/lib') diff --git a/src/lib/image.cc b/src/lib/image.cc index b166dfac6..bd527e91e 100644 --- a/src/lib/image.cc +++ b/src/lib/image.cc @@ -68,7 +68,7 @@ Image::lines (int n) const throw PixelFormatError (N_("lines()"), _pixel_format); } - return size().height / pow(2, d->log2_chroma_h); + return size().height / pow(2.0f, d->log2_chroma_h); } /** @return Number of components */ @@ -417,13 +417,13 @@ Image::bytes_per_pixel (int c) const bpp[0] = floor ((d->comp[0].depth_minus1 + 1 + 7) / 8); if (d->nb_components > 1) { - bpp[1] = floor ((d->comp[1].depth_minus1 + 1 + 7) / 8) / pow (2, d->log2_chroma_w); + bpp[1] = floor ((d->comp[1].depth_minus1 + 1 + 7) / 8) / pow (2.0f, d->log2_chroma_w); } if (d->nb_components > 2) { - bpp[2] = floor ((d->comp[2].depth_minus1 + 1 + 7) / 8) / pow (2, d->log2_chroma_w); + bpp[2] = floor ((d->comp[2].depth_minus1 + 1 + 7) / 8) / pow (2.0f, d->log2_chroma_w); } if (d->nb_components > 3) { - bpp[3] = floor ((d->comp[3].depth_minus1 + 1 + 7) / 8) / pow (2, d->log2_chroma_w); + bpp[3] = floor ((d->comp[3].depth_minus1 + 1 + 7) / 8) / pow (2.0f, d->log2_chroma_w); } if ((d->flags & PIX_FMT_PLANAR) == 0) { diff --git a/src/tools/servomatic_gui.cc b/src/tools/servomatic_gui.cc index 5e36660eb..000c2019f 100644 --- a/src/tools/servomatic_gui.cc +++ b/src/tools/servomatic_gui.cc @@ -102,8 +102,11 @@ public: wxBitmap bitmap (wxString::Format (wxT ("%s/taskbar_icon.png"), POSIX_ICON_PREFIX), wxBITMAP_TYPE_PNG); wxIcon icon; icon.CopyFromBitmap (bitmap); -#endif +#endif +#ifndef __WXOSX__ + /* XXX: fix this for OS X */ SetIcon (icon, std_to_wx ("DVD-o-matic encode server")); +#endif Connect (ID_status, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler (TaskBarIcon::status)); Connect (ID_quit, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler (TaskBarIcon::quit)); diff --git a/src/wx/audio_plot.cc b/src/wx/audio_plot.cc index cf44eb69f..3fec1d3fe 100644 --- a/src/wx/audio_plot.cc +++ b/src/wx/audio_plot.cc @@ -42,7 +42,9 @@ AudioPlot::AudioPlot (wxWindow* parent) , _gain (0) , _smoothing (max_smoothing / 2) { +#ifndef __WXOSX__ SetDoubleBuffered (true); +#endif for (int i = 0; i < MAX_AUDIO_CHANNELS; ++i) { _channel_visible[i] = false; diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc index 4f2985a06..82490e329 100644 --- a/src/wx/film_viewer.cc +++ b/src/wx/film_viewer.cc @@ -59,7 +59,10 @@ FilmViewer::FilmViewer (shared_ptr f, wxWindow* p) , _display_frame_x (0) , _got_frame (false) { +#ifndef __WXOSX__ _panel->SetDoubleBuffered (true); +#endif + #if wxMAJOR_VERSION == 2 && wxMINOR_VERSION >= 9 _panel->SetBackgroundStyle (wxBG_STYLE_PAINT); #endif diff --git a/test/wscript b/test/wscript index 15d5410b3..5de1a99ce 100644 --- a/test/wscript +++ b/test/wscript @@ -3,7 +3,7 @@ def configure(conf): #define BOOST_TEST_MODULE Config test\n #include \n int main() {} - """, msg = 'Checking for boost unit testing library', lib = 'boost_unit_test_framework-mt', uselib_store = 'BOOST_TEST') + """, msg = 'Checking for boost unit testing library', lib = 'boost_unit_test_framework', uselib_store = 'BOOST_TEST') def build(bld): obj = bld(features = 'cxx cxxprogram') -- cgit v1.2.3 From b1da49fd4f3bc918de2ee4cdf49959258576977c Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 29 May 2013 16:06:58 +0100 Subject: Remove unnecessary include; add makedcp-osx. --- run/makedcp-osx | 15 +++++++++++++++ src/lib/ffmpeg_decoder.cc | 1 - 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100755 run/makedcp-osx (limited to 'src/lib') diff --git a/run/makedcp-osx b/run/makedcp-osx new file mode 100755 index 000000000..1b95ecc5d --- /dev/null +++ b/run/makedcp-osx @@ -0,0 +1,15 @@ +#!/bin/bash + +export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:build/src/lib:build/src:/Users/carl/Environments/osx/10.8/lib +if [ "$1" == "--debug" ]; then + shift + gdb --args build/src/tools/makedcp "$@" +elif [ "$1" == "--memcheck" ]; then + shift + valgrind --tool="memcheck" --leak-check=full --show-reachable=yes build/src/tools/makedcp "$@" +elif [ "$1" == "--massif" ]; then + shift + valgrind --tool="massif" build/src/tools/makedcp "$@" +else + build/src/tools/makedcp "$@" +fi diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc index 982139515..bcfbea431 100644 --- a/src/lib/ffmpeg_decoder.cc +++ b/src/lib/ffmpeg_decoder.cc @@ -29,7 +29,6 @@ #include #include extern "C" { -#include #include #include #include -- cgit v1.2.3 From 07ee845fddca9c7f4e714cf0df8f3e755af7ed81 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 29 May 2013 23:02:00 +0100 Subject: Add magic lines to put the DVD-o-matic window at the front on OS X so that it gets a menu bar. Put our Rect in a namespace to hide from Carbon's version. --- src/lib/dcp_video_frame.cc | 2 +- src/lib/subtitle.cc | 10 +++++----- src/lib/subtitle.h | 6 +++--- src/lib/util.cc | 4 ++-- src/lib/util.h | 7 +++++++ src/tools/dvdomatic.cc | 9 +++++++++ src/wx/film_viewer.cc | 2 +- 7 files changed, 28 insertions(+), 12 deletions(-) (limited to 'src/lib') diff --git a/src/lib/dcp_video_frame.cc b/src/lib/dcp_video_frame.cc index d674393a9..77b81a658 100644 --- a/src/lib/dcp_video_frame.cc +++ b/src/lib/dcp_video_frame.cc @@ -164,7 +164,7 @@ DCPVideoFrame::encode_locally () shared_ptr prepared = _input->scale_and_convert_to_rgb (_out_size, _padding, _scaler, true); if (_subtitle) { - Rect tx = subtitle_transformed_area ( + dvdomatic::Rect tx = subtitle_transformed_area ( float (_out_size.width) / _input->size().width, float (_out_size.height) / _input->size().height, _subtitle->area(), _subtitle_offset, _subtitle_scale diff --git a/src/lib/subtitle.cc b/src/lib/subtitle.cc index 5c1ad9706..5c2a0d0b5 100644 --- a/src/lib/subtitle.cc +++ b/src/lib/subtitle.cc @@ -108,13 +108,13 @@ Subtitle::Subtitle (Position p, shared_ptr i) * in the coordinate space of the source. * @param subtitle_scale scaling factor to apply to the subtitle image. */ -Rect +dvdomatic::Rect subtitle_transformed_area ( float target_x_scale, float target_y_scale, - Rect sub_area, int subtitle_offset, float subtitle_scale + dvdomatic::Rect sub_area, int subtitle_offset, float subtitle_scale ) { - Rect tx; + dvdomatic::Rect tx; sub_area.y += subtitle_offset; @@ -143,8 +143,8 @@ subtitle_transformed_area ( } /** @return area that this subtitle takes up, in the original uncropped source's coordinate space */ -Rect +dvdomatic::Rect Subtitle::area () const { - return Rect (_position.x, _position.y, _image->size().width, _image->size().height); + return dvdomatic::Rect (_position.x, _position.y, _image->size().width, _image->size().height); } diff --git a/src/lib/subtitle.h b/src/lib/subtitle.h index 38ba4e70e..e3a853695 100644 --- a/src/lib/subtitle.h +++ b/src/lib/subtitle.h @@ -46,17 +46,17 @@ public: return _image; } - Rect area () const; + dvdomatic::Rect area () const; private: Position _position; boost::shared_ptr _image; }; -Rect +dvdomatic::Rect subtitle_transformed_area ( float target_x_scale, float target_y_scale, - Rect sub_area, int subtitle_offset, float subtitle_scale + dvdomatic::Rect sub_area, int subtitle_offset, float subtitle_scale ); /** A Subtitle class with details of the time over which it should be shown */ diff --git a/src/lib/util.cc b/src/lib/util.cc index 2f8be6edd..b8b60c6f6 100644 --- a/src/lib/util.cc +++ b/src/lib/util.cc @@ -637,8 +637,8 @@ Socket::read_uint32 () /** @param other A Rect. * @return The intersection of this with `other'. */ -Rect -Rect::intersection (Rect const & other) const +dvdomatic::Rect +dvdomatic::Rect::intersection (Rect const & other) const { int const tx = max (x, other.x); int const ty = max (y, other.y); diff --git a/src/lib/util.h b/src/lib/util.h index d0c350a56..3e1d7f4b4 100644 --- a/src/lib/util.h +++ b/src/lib/util.h @@ -44,6 +44,8 @@ extern "C" { #define TIMING(...) #endif +#undef check + /** The maximum number of audio channels that we can cope with */ #define MAX_AUDIO_CHANNELS 6 @@ -150,6 +152,9 @@ struct Position int y; }; +namespace dvdomatic +{ + /** @struct Rect * @brief A rectangle. */ @@ -185,6 +190,8 @@ struct Rect Rect intersection (Rect const & other) const; }; +} + extern std::string crop_string (Position, libdcp::Size); extern int dcp_audio_sample_rate (int); extern std::string colour_lut_index_to_name (int index); diff --git a/src/tools/dvdomatic.cc b/src/tools/dvdomatic.cc index ff1560f0e..e6d4471db 100644 --- a/src/tools/dvdomatic.cc +++ b/src/tools/dvdomatic.cc @@ -23,6 +23,9 @@ #ifdef __WXMSW__ #include #endif +#ifdef __WXOSX__ +#include +#endif #include #include #include @@ -472,6 +475,12 @@ class App : public wxApp #ifdef DVDOMATIC_POSIX unsetenv ("UBUNTU_MENUPROXY"); +#endif + +#ifdef __WXOSX__ + ProcessSerialNumber serial; + GetCurrentProcess (&serial); + TransformProcessType (&serial, kProcessTransformToForegroundApplication); #endif wxInitAllImageHandlers (); diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc index 82490e329..79642af9c 100644 --- a/src/wx/film_viewer.cc +++ b/src/wx/film_viewer.cc @@ -329,7 +329,7 @@ FilmViewer::raw_to_display () Size const cropped_size = _film->cropped_size (_film->size ()); - Rect tx = subtitle_transformed_area ( + dvdomatic::Rect tx = subtitle_transformed_area ( float (_film_size.width) / cropped_size.width, float (_film_size.height) / cropped_size.height, _raw_sub->area(), _film->subtitle_offset(), _film->subtitle_scale() -- cgit v1.2.3 From ebabac1b19f7e039ed34f407a73f24dddaa4e493 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 30 May 2013 12:15:01 +0100 Subject: Trim must be part of the video identifier if we are doing encode-trims. --- src/lib/film.cc | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/lib') diff --git a/src/lib/film.cc b/src/lib/film.cc index 81c7de77f..5573ee9d2 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -218,6 +218,10 @@ Film::video_state_identifier () const << "_" << j2k_bandwidth() << "_" << boost::lexical_cast (colour_lut()); + if (trim_type() == ENCODE) { + s << "_" << trim_start() << "_" << trim_end(); + } + if (dcp_ab()) { pair fa = Filter::ffmpeg_strings (Config::instance()->reference_filters()); s << "ab_" << Config::instance()->reference_scaler()->id() << "_" << fa.first << "_" << fa.second; -- cgit v1.2.3 From 75ca9a37fc0567357ff737e7cc43bfcc19237501 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 31 May 2013 10:29:06 +0100 Subject: Try to create directory for .dvdomatic if it doesn't exist. --- src/lib/config.cc | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/lib') diff --git a/src/lib/config.cc b/src/lib/config.cc index 8c65e371a..7d8e82335 100644 --- a/src/lib/config.cc +++ b/src/lib/config.cc @@ -122,6 +122,8 @@ Config::file () const { boost::filesystem::path p; p /= g_get_user_config_dir (); + boost::system::error_code ec; + boost::filesystem::create_directory (p, ec); p /= N_(".dvdomatic"); return p.string (); } -- cgit v1.2.3