From e60bb3e51bd1508b149e6b8f6608f09b5196ae26 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 21 Jun 2015 01:15:32 +0100 Subject: [PATCH] No-op: remove all trailing whitespace. --- src/lib/analyse_audio_job.cc | 4 +- src/lib/audio_analysis.cc | 4 +- src/lib/audio_analysis.h | 4 +- src/lib/audio_buffers.cc | 20 +- src/lib/audio_buffers.h | 4 +- src/lib/audio_content.cc | 14 +- src/lib/audio_content.h | 4 +- src/lib/audio_decoder.h | 6 +- src/lib/audio_decoder_stream.cc | 12 +- src/lib/audio_decoder_stream.h | 4 +- src/lib/audio_filter.cc | 32 +-- src/lib/audio_mapping.cc | 6 +- src/lib/audio_mapping.h | 6 +- src/lib/audio_stream.h | 4 +- src/lib/channel_count.h | 2 +- src/lib/cinema.cc | 2 +- src/lib/cinema.h | 6 +- src/lib/cinema_sound_processor.h | 2 +- src/lib/colour_conversion.cc | 14 +- src/lib/colour_conversion.h | 4 +- src/lib/config.cc | 22 +-- src/lib/config.h | 30 +-- src/lib/content.cc | 8 +- src/lib/content.h | 14 +- src/lib/content_audio.h | 2 +- src/lib/content_factory.cc | 2 +- src/lib/content_subtitle.h | 2 +- src/lib/content_video.h | 2 +- src/lib/cross.cc | 38 ++-- src/lib/data.cc | 4 +- src/lib/dcp_content.cc | 4 +- src/lib/dcp_content.h | 8 +- src/lib/dcp_content_type.h | 2 +- src/lib/dcp_decoder.cc | 6 +- src/lib/dcp_decoder.h | 2 +- src/lib/dcp_examiner.cc | 8 +- src/lib/dcp_examiner.h | 10 +- src/lib/dcp_subtitle.cc | 4 +- src/lib/dcp_subtitle_content.cc | 6 +- src/lib/dcp_subtitle_decoder.cc | 4 +- src/lib/dcp_video.cc | 28 +-- src/lib/dcp_video.h | 4 +- src/lib/dcpomatic_socket.cc | 4 +- src/lib/dcpomatic_socket.h | 4 +- src/lib/dcpomatic_time.h | 14 +- src/lib/decoder.h | 4 +- src/lib/dolby_cp750.cc | 2 +- src/lib/encoder.cc | 20 +- src/lib/encoder.h | 4 +- src/lib/environment_info.cc | 4 +- src/lib/exceptions.cc | 4 +- src/lib/exceptions.h | 4 +- src/lib/ffmpeg.cc | 18 +- src/lib/ffmpeg.h | 4 +- src/lib/ffmpeg_audio_stream.h | 2 +- src/lib/ffmpeg_content.cc | 6 +- src/lib/ffmpeg_content.h | 8 +- src/lib/ffmpeg_decoder.cc | 48 ++--- src/lib/ffmpeg_decoder.h | 4 +- src/lib/ffmpeg_examiner.cc | 8 +- src/lib/ffmpeg_examiner.h | 8 +- src/lib/ffmpeg_stream.h | 4 +- src/lib/ffmpeg_subtitle_stream.cc | 4 +- src/lib/ffmpeg_subtitle_stream.h | 2 +- src/lib/file_group.cc | 6 +- src/lib/film.cc | 76 +++---- src/lib/film.h | 12 +- src/lib/filter.cc | 2 +- src/lib/filter.h | 4 +- src/lib/filter_graph.cc | 12 +- src/lib/font.cc | 2 +- src/lib/font.h | 2 +- src/lib/frame_rate_change.cc | 6 +- src/lib/image.cc | 42 ++-- src/lib/image.h | 8 +- src/lib/image_content.cc | 10 +- src/lib/image_content.h | 2 +- src/lib/image_decoder.cc | 2 +- src/lib/image_decoder.h | 2 +- src/lib/image_examiner.cc | 2 +- src/lib/image_filename_sorter.cc | 2 +- src/lib/image_subtitle.h | 2 +- src/lib/internet.cc | 10 +- src/lib/isdcf_metadata.cc | 2 +- src/lib/isdcf_metadata.h | 2 +- src/lib/j2k_image_proxy.cc | 2 +- src/lib/j2k_image_proxy.h | 4 +- src/lib/job.cc | 22 +-- src/lib/job.h | 4 +- src/lib/job_manager.cc | 14 +- src/lib/job_manager.h | 4 +- src/lib/json_server.cc | 18 +- src/lib/json_server.h | 2 +- src/lib/kdm.cc | 38 ++-- src/lib/log.cc | 8 +- src/lib/log.h | 8 +- src/lib/magick_image_proxy.cc | 12 +- src/lib/magick_image_proxy.h | 2 +- src/lib/md5_digester.cc | 6 +- src/lib/md5_digester.h | 2 +- src/lib/piece.h | 2 +- src/lib/player.cc | 28 +-- src/lib/player.h | 12 +- src/lib/player_subtitles.h | 2 +- src/lib/player_video.cc | 12 +- src/lib/player_video.h | 4 +- src/lib/playlist.cc | 32 +-- src/lib/playlist.h | 4 +- src/lib/position_image.h | 4 +- src/lib/ratio.cc | 6 +- src/lib/ratio.h | 2 +- src/lib/raw_image_proxy.h | 4 +- src/lib/rect.h | 8 +- src/lib/render_subtitles.cc | 8 +- src/lib/resampler.cc | 14 +- src/lib/resampler.h | 2 +- src/lib/safe_stringstream.h | 6 +- src/lib/scoped_temporary.cc | 2 +- src/lib/scp_dcp_job.cc | 38 ++-- src/lib/send_kdm_email_job.cc | 4 +- src/lib/send_problem_report_job.cc | 14 +- src/lib/server.cc | 28 +-- src/lib/server.h | 8 +- src/lib/server_finder.cc | 10 +- src/lib/server_finder.h | 2 +- src/lib/signal_manager.h | 2 +- src/lib/signaller.h | 2 +- src/lib/single_stream_audio_content.cc | 2 +- src/lib/single_stream_audio_content.h | 2 +- src/lib/sndfile_base.cc | 4 +- src/lib/sndfile_base.h | 2 +- src/lib/sndfile_content.h | 8 +- src/lib/sndfile_decoder.cc | 8 +- src/lib/sndfile_decoder.h | 2 +- src/lib/sndfile_examiner.h | 2 +- src/lib/subrip_content.cc | 2 +- src/lib/subrip_content.h | 4 +- src/lib/subrip_decoder.cc | 4 +- src/lib/subrip_decoder.h | 2 +- src/lib/subrip_subtitle.h | 2 +- src/lib/subtitle_content.cc | 10 +- src/lib/subtitle_content.h | 2 +- src/lib/subtitle_decoder.cc | 4 +- src/lib/subtitle_decoder.h | 4 +- src/lib/timer.cc | 2 +- src/lib/timer.h | 2 +- src/lib/transcode_job.cc | 8 +- src/lib/transcode_job.h | 2 +- src/lib/transcoder.cc | 2 +- src/lib/types.h | 4 +- src/lib/update.cc | 18 +- src/lib/update.h | 6 +- src/lib/upmixer_a.h | 2 +- src/lib/util.cc | 40 ++-- src/lib/video_content.cc | 32 +-- src/lib/video_content.h | 12 +- src/lib/video_content_scale.cc | 8 +- src/lib/video_decoder.cc | 6 +- src/lib/writer.cc | 50 ++--- src/lib/writer.h | 8 +- src/tools/dcpomatic.cc | 118 +++++------ src/tools/dcpomatic_batch.cc | 16 +- src/tools/dcpomatic_cli.cc | 14 +- src/tools/dcpomatic_create.cc | 8 +- src/tools/dcpomatic_kdm.cc | 10 +- src/tools/dcpomatic_server.cc | 16 +- src/tools/dcpomatic_server_cli.cc | 4 +- src/tools/server_test.cc | 6 +- src/wx/about_dialog.cc | 14 +- src/wx/audio_dialog.cc | 26 +-- src/wx/audio_gain_dialog.cc | 2 +- src/wx/audio_gain_dialog.h | 2 +- src/wx/audio_mapping_view.cc | 18 +- src/wx/audio_panel.cc | 8 +- src/wx/audio_panel.h | 2 +- src/wx/audio_plot.cc | 22 +-- src/wx/cinema_dialog.h | 2 +- src/wx/colour_conversion_editor.cc | 20 +- src/wx/colour_conversion_editor.h | 2 +- src/wx/config_dialog.cc | 218 ++++++++++----------- src/wx/content_colour_conversion_dialog.cc | 4 +- src/wx/content_colour_conversion_dialog.h | 2 +- src/wx/content_menu.cc | 22 +-- src/wx/content_menu.h | 4 +- src/wx/content_panel.cc | 52 ++--- src/wx/content_panel.h | 4 +- src/wx/content_properties_dialog.cc | 4 +- src/wx/content_widget.h | 10 +- src/wx/dcp_panel.cc | 36 ++-- src/wx/dcp_panel.h | 2 +- src/wx/dir_picker_ctrl.cc | 2 +- src/wx/dir_picker_ctrl.h | 2 +- src/wx/dolby_certificate_dialog.cc | 6 +- src/wx/doremi_certificate_dialog.cc | 4 +- src/wx/download_certificate_dialog.cc | 4 +- src/wx/download_certificate_dialog.h | 2 +- src/wx/editable_list.h | 16 +- src/wx/film_editor.cc | 8 +- src/wx/film_editor.h | 4 +- src/wx/film_viewer.cc | 34 ++-- src/wx/filter_dialog.cc | 2 +- src/wx/filter_dialog.h | 2 +- src/wx/filter_editor.cc | 2 +- src/wx/fonts_dialog.cc | 6 +- src/wx/fonts_dialog.h | 2 +- src/wx/gain_calculator_dialog.cc | 2 +- src/wx/hints_dialog.cc | 6 +- src/wx/hints_dialog.h | 2 +- src/wx/isdcf_metadata_dialog.cc | 4 +- src/wx/job_manager_view.cc | 18 +- src/wx/job_manager_view.h | 2 +- src/wx/kdm_dialog.cc | 38 ++-- src/wx/kdm_dialog.h | 4 +- src/wx/key_dialog.cc | 2 +- src/wx/key_dialog.h | 2 +- src/wx/make_signer_chain_dialog.h | 4 +- src/wx/new_film_dialog.cc | 6 +- src/wx/new_film_dialog.h | 4 +- src/wx/report_problem_dialog.cc | 2 +- src/wx/screen_dialog.h | 4 +- src/wx/servers_list_dialog.cc | 4 +- src/wx/subtitle_panel.cc | 20 +- src/wx/subtitle_panel.h | 4 +- src/wx/subtitle_view.cc | 2 +- src/wx/subtitle_view.h | 2 +- src/wx/table_dialog.cc | 2 +- src/wx/table_dialog.h | 4 +- src/wx/timecode.cc | 6 +- src/wx/timecode.h | 8 +- src/wx/timeline.cc | 30 +-- src/wx/timeline_audio_content_view.h | 2 +- src/wx/timeline_content_view.cc | 20 +- src/wx/timeline_content_view.h | 2 +- src/wx/timeline_dialog.cc | 2 +- src/wx/timeline_dialog.h | 2 +- src/wx/timeline_subtitle_content_view.cc | 4 +- src/wx/timeline_time_axis_view.cc | 24 +-- src/wx/timeline_time_axis_view.h | 2 +- src/wx/timeline_video_content_view.h | 2 +- src/wx/timeline_view.cc | 2 +- src/wx/timeline_view.h | 6 +- src/wx/timing_panel.cc | 30 +-- src/wx/timing_panel.h | 4 +- src/wx/update_dialog.cc | 6 +- src/wx/video_panel.cc | 18 +- src/wx/wx_util.cc | 16 +- test/audio_analysis_test.cc | 10 +- test/audio_buffers_test.cc | 8 +- test/audio_decoder_test.cc | 6 +- test/audio_delay_test.cc | 4 +- test/audio_filter_test.cc | 6 +- test/client_server_test.cc | 8 +- test/ffmpeg_audio_test.cc | 6 +- test/ffmpeg_dcp_test.cc | 6 +- test/ffmpeg_decoder_seek_test.cc | 8 +- test/ffmpeg_decoder_sequential_test.cc | 10 +- test/file_group_test.cc | 2 +- test/film_metadata_test.cc | 2 +- test/frame_rate_test.cc | 18 +- test/image_test.cc | 6 +- test/isdcf_name_test.cc | 4 +- test/make_black_test.cc | 4 +- test/pixel_formats_test.cc | 2 +- test/play_test.cc | 4 +- test/player_test.cc | 2 +- test/recover_test.cc | 2 +- test/repeat_frame_test.cc | 2 +- test/resampler_test.cc | 6 +- test/scaling_test.cc | 2 +- test/seek_zero_test.cc | 2 +- test/silence_padding_test.cc | 6 +- test/srt_subtitle_test.cc | 2 +- test/stream_test.cc | 4 +- test/test.cc | 18 +- test/threed_test.cc | 2 +- test/util_test.cc | 4 +- test/video_content_scale_test.cc | 8 +- test/video_decoder_fill_test.cc | 8 +- 278 files changed, 1347 insertions(+), 1347 deletions(-) diff --git a/src/lib/analyse_audio_job.cc b/src/lib/analyse_audio_job.cc index 3dd15ac27..8f9b15010 100644 --- a/src/lib/analyse_audio_job.cc +++ b/src/lib/analyse_audio_job.cc @@ -63,7 +63,7 @@ AnalyseAudioJob::run () { shared_ptr player (new Player (_film)); player->set_ignore_video (); - + int64_t const len = _film->length().frames (_film->audio_frame_rate()); _samples_per_point = max (int64_t (1), len / _num_points); @@ -88,7 +88,7 @@ AnalyseAudioJob::run () _analysis->set_peak (_overall_peak, DCPTime::from_frames (_overall_peak_frame, _film->audio_frame_rate ())); _analysis->write (_film->audio_analysis_path ()); - + set_progress (1); set_state (FINISHED_OK); } diff --git a/src/lib/audio_analysis.cc b/src/lib/audio_analysis.cc index 73422a9be..7e1dc6e78 100644 --- a/src/lib/audio_analysis.cc +++ b/src/lib/audio_analysis.cc @@ -65,7 +65,7 @@ AudioPoint::operator= (AudioPoint const & other) if (this == &other) { return *this; } - + for (int i = 0; i < COUNT; ++i) { _data[i] = other._data[i]; } @@ -79,7 +79,7 @@ AudioPoint::as_xml (xmlpp::Element* parent) const parent->add_child ("Peak")->add_child_text (raw_convert (_data[PEAK])); parent->add_child ("RMS")->add_child_text (raw_convert (_data[RMS])); } - + AudioAnalysis::AudioAnalysis (int channels) { _data.resize (channels); diff --git a/src/lib/audio_analysis.h b/src/lib/audio_analysis.h index 9387ec896..2411b4316 100644 --- a/src/lib/audio_analysis.h +++ b/src/lib/audio_analysis.h @@ -42,7 +42,7 @@ public: AudioPoint& operator= (AudioPoint const &); void as_xml (xmlpp::Element *) const; - + float& operator[] (int t) { return _data[t]; } @@ -62,7 +62,7 @@ public: _peak = peak; _peak_time = time; } - + AudioPoint get_point (int c, int p) const; int points (int c) const; int channels () const; diff --git a/src/lib/audio_buffers.cc b/src/lib/audio_buffers.cc index 71422944d..0130f17b4 100644 --- a/src/lib/audio_buffers.cc +++ b/src/lib/audio_buffers.cc @@ -57,7 +57,7 @@ AudioBuffers::operator= (AudioBuffers const & other) if (this == &other) { return *this; } - + deallocate (); allocate (other._channels, other._frames); copy_from (&other, other._frames, 0, 0); @@ -80,12 +80,12 @@ AudioBuffers::allocate (int channels, int frames) _channels = channels; _frames = frames; _allocated_frames = frames; - + _data = static_cast (malloc (_channels * sizeof (float *))); if (!_data) { throw bad_alloc (); } - + for (int i = 0; i < _channels; ++i) { _data[i] = static_cast (malloc (frames * sizeof (float))); if (!_data[i]) { @@ -129,7 +129,7 @@ AudioBuffers::set_frames (int f) _data[c][i] = 0; } } - + _frames = f; } @@ -149,7 +149,7 @@ void AudioBuffers::make_silent (int c) { DCPOMATIC_ASSERT (c >= 0 && c < _channels); - + for (int i = 0; i < _frames; ++i) { _data[c][i] = 0; } @@ -180,7 +180,7 @@ AudioBuffers::copy_from (AudioBuffers const * from, int frames_to_copy, int read /* Prevent the asserts from firing if there is nothing to do */ return; } - + DCPOMATIC_ASSERT (from->channels() == channels()); DCPOMATIC_ASSERT (from); @@ -197,14 +197,14 @@ AudioBuffers::copy_from (AudioBuffers const * from, int frames_to_copy, int read * @param to Offset to move to. * @param frames Number of frames to move. */ - + void AudioBuffers::move (int from, int to, int frames) { if (frames == 0) { return; } - + DCPOMATIC_ASSERT (from >= 0); DCPOMATIC_ASSERT (from < _frames); DCPOMATIC_ASSERT (to >= 0); @@ -213,7 +213,7 @@ AudioBuffers::move (int from, int to, int frames) DCPOMATIC_ASSERT (frames <= _frames); DCPOMATIC_ASSERT ((from + frames) <= _frames); DCPOMATIC_ASSERT ((to + frames) <= _allocated_frames); - + for (int i = 0; i < _channels; ++i) { memmove (_data[i] + to, _data[i] + from, frames * sizeof(float)); } @@ -279,7 +279,7 @@ void AudioBuffers::apply_gain (float dB) { float const linear = pow (10, dB / 20); - + for (int i = 0; i < _channels; ++i) { for (int j = 0; j < _frames; ++j) { _data[i][j] *= linear; diff --git a/src/lib/audio_buffers.h b/src/lib/audio_buffers.h index 8cd67aaa7..bcf5d5928 100644 --- a/src/lib/audio_buffers.h +++ b/src/lib/audio_buffers.h @@ -47,7 +47,7 @@ public: float** data () const { return _data; } - + float* data (int) const; int channels () const { @@ -75,7 +75,7 @@ public: private: void allocate (int, int); void deallocate (); - + /** Number of channels */ int _channels; /** Number of frames (where a frame is one sample across all channels) */ diff --git a/src/lib/audio_content.cc b/src/lib/audio_content.cc index e1f435f49..d2d90a1f5 100644 --- a/src/lib/audio_content.cc +++ b/src/lib/audio_content.cc @@ -82,7 +82,7 @@ AudioContent::AudioContent (shared_ptr film, vector ref = dynamic_pointer_cast (c[0]); DCPOMATIC_ASSERT (ref); - + for (size_t i = 0; i < c.size(); ++i) { shared_ptr ac = dynamic_pointer_cast (c[i]); @@ -115,7 +115,7 @@ AudioContent::set_audio_gain (double g) boost::mutex::scoped_lock lm (_mutex); _audio_gain = g; } - + signal_changed (AudioContentProperty::AUDIO_GAIN); } @@ -126,7 +126,7 @@ AudioContent::set_audio_delay (int d) boost::mutex::scoped_lock lm (_mutex); _audio_delay = d; } - + signal_changed (AudioContentProperty::AUDIO_DELAY); } @@ -155,7 +155,7 @@ AudioContent::set_audio_mapping (AudioMapping mapping) } i->set_mapping (stream_mapping); } - + signal_changed (AudioContentProperty::AUDIO_STREAMS); } @@ -166,9 +166,9 @@ AudioContent::audio_mapping () const BOOST_FOREACH (AudioStreamPtr i, audio_streams ()) { channels += i->channels (); } - + AudioMapping merged (channels, MAX_DCP_AUDIO_CHANNELS); - + int c = 0; int s = 0; BOOST_FOREACH (AudioStreamPtr i, audio_streams ()) { @@ -193,7 +193,7 @@ AudioContent::resampled_audio_frame_rate () const { shared_ptr film = _film.lock (); DCPOMATIC_ASSERT (film); - + /* Resample to a DCI-approved sample rate */ double t = has_rate_above_48k() ? 96000 : 48000; diff --git a/src/lib/audio_content.h b/src/lib/audio_content.h index df6527ed0..2ecb51205 100644 --- a/src/lib/audio_content.h +++ b/src/lib/audio_content.h @@ -68,7 +68,7 @@ public: void set_audio_gain (double); void set_audio_delay (int); - + double audio_gain () const { boost::mutex::scoped_lock lm (_mutex); return _audio_gain; @@ -80,7 +80,7 @@ public: } std::string processing_description () const; - + private: /** Gain to apply to audio in dB */ double _audio_gain; diff --git a/src/lib/audio_decoder.h b/src/lib/audio_decoder.h index 1b17029b7..387b1ad7f 100644 --- a/src/lib/audio_decoder.h +++ b/src/lib/audio_decoder.h @@ -40,7 +40,7 @@ class AudioDecoder : public virtual Decoder, public boost::enable_shared_from_th { public: AudioDecoder (boost::shared_ptr); - + boost::shared_ptr audio_content () const { return _audio_content; } @@ -57,8 +57,8 @@ protected: void audio (AudioStreamPtr stream, boost::shared_ptr, ContentTime); void flush (); void seek (ContentTime t, bool accurate); - -private: + +private: boost::shared_ptr _audio_content; /** An AudioDecoderStream object to manage each stream in _audio_content */ std::map > _streams; diff --git a/src/lib/audio_decoder_stream.cc b/src/lib/audio_decoder_stream.cc index f1d9839f8..8c521f94d 100644 --- a/src/lib/audio_decoder_stream.cc +++ b/src/lib/audio_decoder_stream.cc @@ -59,7 +59,7 @@ AudioDecoderStream::get (Frame frame, Frame length, bool accurate) shared_ptr dec; Frame const end = frame + length - 1; - + if (frame < _decoded.frame || end > (_decoded.frame + length * 4)) { /* Either we have no decoded data, or what we do have is a long way from what we want: seek */ seek (ContentTime::from_frames (frame, _content->resampled_audio_frame_rate()), accurate); @@ -69,7 +69,7 @@ AudioDecoderStream::get (Frame frame, Frame length, bool accurate) (to be set up shortly) */ Frame decoded_offset = 0; - + /* Now enough pass() calls will either: * (a) give us what we want, or * (b) hit the end of the decoder. @@ -84,7 +84,7 @@ AudioDecoderStream::get (Frame frame, Frame length, bool accurate) !_decoder->pass () ) {} - + decoded_offset = frame - _decoded.frame; } else { while ( @@ -92,7 +92,7 @@ AudioDecoderStream::get (Frame frame, Frame length, bool accurate) !_decoder->pass () ) {} - + /* Use decoded_offset of 0, as we don't really care what frames we return */ } @@ -183,7 +183,7 @@ AudioDecoderStream::add (shared_ptr data) */ return; } - + /* Resize _decoded to fit the new data */ int new_size = 0; if (_decoded.audio->frames() == 0) { @@ -194,7 +194,7 @@ AudioDecoderStream::add (shared_ptr data) /* Otherwise we need to extend _decoded to include the new stuff */ new_size = _position.get() + data->frames() - _decoded.frame; } - + _decoded.audio->ensure_size (new_size); _decoded.audio->set_frames (new_size); diff --git a/src/lib/audio_decoder_stream.h b/src/lib/audio_decoder_stream.h index 24f86c2e3..5c772e4f7 100644 --- a/src/lib/audio_decoder_stream.h +++ b/src/lib/audio_decoder_stream.h @@ -32,12 +32,12 @@ class AudioDecoderStream { public: AudioDecoderStream (boost::shared_ptr, AudioStreamPtr, AudioDecoder* decoder); - + ContentAudio get (Frame time, Frame length, bool accurate); void audio (boost::shared_ptr, ContentTime); void flush (); void seek (ContentTime time, bool accurate); - + private: void reset_decoded (); diff --git a/src/lib/audio_filter.cc b/src/lib/audio_filter.cc index dbef25201..2cf1cf604 100644 --- a/src/lib/audio_filter.cc +++ b/src/lib/audio_filter.cc @@ -29,9 +29,9 @@ vector AudioFilter::sinc_blackman (float cutoff, bool invert) const { vector ir (_M + 1); - + /* Impulse response */ - + for (int i = 0; i <= _M; ++i) { if (i == (_M / 2)) { ir[i] = 2 * M_PI * cutoff; @@ -42,27 +42,27 @@ AudioFilter::sinc_blackman (float cutoff, bool invert) const ir[i] *= (0.42 - 0.5 * cos (2 * M_PI * i / _M) + 0.08 * cos (4 * M_PI * i / _M)); } } - + /* Normalise */ - + float sum = 0; for (int i = 0; i <= _M; ++i) { sum += ir[i]; } - + for (int i = 0; i <= _M; ++i) { ir[i] /= sum; } - + /* Frequency inversion (swapping low-pass for high-pass, or whatever) */ - + if (invert) { for (int i = 0; i <= _M; ++i) { ir[i] = -ir[i]; } ir[_M / 2] += 1; } - + return ir; } @@ -70,12 +70,12 @@ shared_ptr AudioFilter::run (shared_ptr in) { shared_ptr out (new AudioBuffers (in->channels(), in->frames())); - + if (!_tail) { _tail.reset (new AudioBuffers (in->channels(), _M + 1)); _tail->make_silent (); } - + for (int i = 0; i < in->channels(); ++i) { for (int j = 0; j < in->frames(); ++j) { float s = 0; @@ -86,17 +86,17 @@ AudioFilter::run (shared_ptr in) s += in->data(i)[j - k] * _ir[k]; } } - + out->data(i)[j] = s; } } - + int const amount = min (in->frames(), _tail->frames()); if (amount < _tail->frames ()) { _tail->move (amount, 0, _tail->frames() - amount); } _tail->copy_from (in.get(), amount, in->frames() - amount, _tail->frames () - amount); - + return out; } @@ -124,16 +124,16 @@ BandPassAudioFilter::BandPassAudioFilter (float transition_bandwidth, float lowe { vector lpf = sinc_blackman (lower, false); vector hpf = sinc_blackman (higher, true); - + _ir.resize (_M + 1); for (int i = 0; i <= _M; ++i) { _ir[i] = lpf[i] + hpf[i]; } - + /* We now have a band-stop, so invert for band-pass */ for (int i = 0; i <= _M; ++i) { _ir[i] = -_ir[i]; } - + _ir[_M / 2] += 1; } diff --git a/src/lib/audio_mapping.cc b/src/lib/audio_mapping.cc index ca175912b..725109ae6 100644 --- a/src/lib/audio_mapping.cc +++ b/src/lib/audio_mapping.cc @@ -56,7 +56,7 @@ AudioMapping::setup (int input_channels, int output_channels) { _input_channels = input_channels; _output_channels = output_channels; - + _gain.resize (_input_channels); for (int i = 0; i < _input_channels; ++i) { _gain[i].resize (_output_channels); @@ -161,7 +161,7 @@ AudioMapping::mapped_output_channels () const static float const minus_96_db = 0.000015849; list mapped; - + for (vector >::const_iterator i = _gain.begin(); i != _gain.end(); ++i) { for (size_t j = 0; j < i->size(); ++j) { if (abs ((*i)[j]) > minus_96_db) { @@ -172,7 +172,7 @@ AudioMapping::mapped_output_channels () const mapped.sort (); mapped.unique (); - + return mapped; } diff --git a/src/lib/audio_mapping.h b/src/lib/audio_mapping.h index 57169cc1e..ca9b9847f 100644 --- a/src/lib/audio_mapping.h +++ b/src/lib/audio_mapping.h @@ -48,7 +48,7 @@ public: AudioMapping (cxml::ConstNodePtr, int); /* Default copy constructor is fine */ - + void as_xml (xmlpp::Node *) const; void make_zero (); @@ -63,12 +63,12 @@ public: int output_channels () const { return _output_channels; } - + std::string digest () const; std::list mapped_output_channels () const; void unmap_all (); - + private: void setup (int input_channels, int output_channels); diff --git a/src/lib/audio_stream.h b/src/lib/audio_stream.h index 757d2ea29..80ccc4cdb 100644 --- a/src/lib/audio_stream.h +++ b/src/lib/audio_stream.h @@ -30,7 +30,7 @@ class AudioStream public: AudioStream (int frame_rate, int channels); AudioStream (int frame_rate, AudioMapping mapping); - + void set_mapping (AudioMapping mapping); void set_frame_rate (int frame_rate); @@ -51,7 +51,7 @@ protected: private: friend struct audio_sampling_rate_test; - + int _frame_rate; AudioMapping _mapping; }; diff --git a/src/lib/channel_count.h b/src/lib/channel_count.h index 4247fc063..bc840293e 100644 --- a/src/lib/channel_count.h +++ b/src/lib/channel_count.h @@ -32,7 +32,7 @@ public: : min (n) , max (n) {} - + ChannelCount (int min_, int max_) : min (min_) , max (max_) diff --git a/src/lib/cinema.cc b/src/lib/cinema.cc index ce3077b2a..f77439238 100644 --- a/src/lib/cinema.cc +++ b/src/lib/cinema.cc @@ -84,4 +84,4 @@ Screen::as_xml (xmlpp::Element* parent) const } } - + diff --git a/src/lib/cinema.h b/src/lib/cinema.h index 5c0386837..fea4f1c14 100644 --- a/src/lib/cinema.h +++ b/src/lib/cinema.h @@ -44,7 +44,7 @@ public: Screen (cxml::ConstNodePtr); void as_xml (xmlpp::Element *) const; - + boost::shared_ptr cinema; std::string name; boost::optional certificate; @@ -72,13 +72,13 @@ public: void add_screen (boost::shared_ptr); void remove_screen (boost::shared_ptr); - + std::string name; std::string email; std::list > screens () const { return _screens; } -private: +private: std::list > _screens; }; diff --git a/src/lib/cinema_sound_processor.h b/src/lib/cinema_sound_processor.h index 30ab7d5a5..1d4a389f3 100644 --- a/src/lib/cinema_sound_processor.h +++ b/src/lib/cinema_sound_processor.h @@ -50,7 +50,7 @@ public: std::string name () const { return _name; } - + static std::vector all (); static void setup_cinema_sound_processors (); static CinemaSoundProcessor const * from_id (std::string id); diff --git a/src/lib/colour_conversion.cc b/src/lib/colour_conversion.cc index 0f05474d8..31d4cc41a 100644 --- a/src/lib/colour_conversion.cc +++ b/src/lib/colour_conversion.cc @@ -45,13 +45,13 @@ vector PresetColourConversion::_presets; ColourConversion::ColourConversion () : dcp::ColourConversion (dcp::ColourConversion::srgb_to_xyz ()) { - + } ColourConversion::ColourConversion (dcp::ColourConversion conversion_) : dcp::ColourConversion (conversion_) { - + } ColourConversion::ColourConversion (cxml::NodePtr node, int version) @@ -78,7 +78,7 @@ ColourConversion::ColourConversion (cxml::NodePtr node, int version) } else { /* Version 1.x */ - + if (node->bool_child ("InputGammaLinearised")) { _in.reset (new dcp::ModifiedGammaTransferFunction (node->number_child ("InputGamma"), 0.04045, 0.055, 12.92)); } else { @@ -87,7 +87,7 @@ ColourConversion::ColourConversion (cxml::NodePtr node, int version) } _yuv_to_rgb = static_cast (node->optional_number_child("YUVToRGB").get_value_or (dcp::YUV_TO_RGB_REC601)); - + list m = node->node_children ("Matrix"); if (!m.empty ()) { /* Read in old nodes and convert them to chromaticities */ @@ -117,8 +117,8 @@ ColourConversion::ColourConversion (cxml::NodePtr node, int version) node->number_child ("AdjustedWhiteX"), node->number_child ("AdjustedWhiteY") ); } - } - + } + _out.reset (new dcp::GammaTransferFunction (node->number_child ("OutputGamma"))); } @@ -212,7 +212,7 @@ ColourConversion::identifier () const } digester.add (dynamic_pointer_cast (_out)->gamma ()); - + return digester.get (); } diff --git a/src/lib/colour_conversion.h b/src/lib/colour_conversion.h index 06a9cf6c3..eaf43f592 100644 --- a/src/lib/colour_conversion.h +++ b/src/lib/colour_conversion.h @@ -59,7 +59,7 @@ public: std::string name; /** an internal short (non-internationalised) name for this preset */ std::string id; - + static std::vector all () { return _presets; } @@ -67,7 +67,7 @@ public: static PresetColourConversion from_id (std::string id); static void setup_colour_conversion_presets (); - + private: static std::vector _presets; }; diff --git a/src/lib/config.cc b/src/lib/config.cc index e726acee1..e6f363729 100644 --- a/src/lib/config.cc +++ b/src/lib/config.cc @@ -79,9 +79,9 @@ Config::set_defaults () _check_for_test_updates = false; _maximum_j2k_bandwidth = 250000000; _log_types = Log::TYPE_GENERAL | Log::TYPE_WARNING | Log::TYPE_ERROR | Log::TYPE_DEBUG; -#ifdef DCPOMATIC_WINDOWS +#ifdef DCPOMATIC_WINDOWS _win32_console = false; -#endif +#endif _allowed_dcp_frame_rates.clear (); _allowed_dcp_frame_rates.push_back (24); @@ -138,7 +138,7 @@ Config::read () _servers.push_back ((*i)->content ()); } } - + _tms_ip = f.string_child ("TMSIP"); _tms_path = f.string_child ("TMSPath"); _tms_user = f.string_child ("TMSUser"); @@ -170,13 +170,13 @@ Config::read () } else if (f.optional_string_child ("DCPIssuer")) { _dcp_issuer = f.string_child ("DCPIssuer"); } - + if (version && version.get() >= 2) { _default_isdcf_metadata = ISDCFMetadata (f.node_child ("ISDCFMetadata")); } else { _default_isdcf_metadata = ISDCFMetadata (f.node_child ("DCIMetadata")); } - + _default_still_length = f.optional_number_child("DefaultStillLength").get_value_or (10); _default_j2k_bandwidth = f.optional_number_child("DefaultJ2KBandwidth").get_value_or (200000000); _default_audio_delay = f.optional_number_child("DefaultAudioDelay").get_value_or (0); @@ -207,9 +207,9 @@ Config::read () _allow_any_dcp_frame_rate = f.optional_bool_child ("AllowAnyDCPFrameRate"); _log_types = f.optional_number_child ("LogTypes").get_value_or (Log::TYPE_GENERAL | Log::TYPE_WARNING | Log::TYPE_ERROR); -#ifdef DCPOMATIC_WINDOWS +#ifdef DCPOMATIC_WINDOWS _win32_console = f.optional_bool_child ("Win32Console").get_value_or (false); -#endif +#endif list his = f.node_children ("History"); for (list::const_iterator i = his.begin(); i != his.end(); ++i) { @@ -308,7 +308,7 @@ Config::write () const root->add_child("DefaultDirectory")->add_child_text (_default_directory.string ()); root->add_child("ServerPortBase")->add_child_text (raw_convert (_server_port_base)); root->add_child("UseAnyServers")->add_child_text (_use_any_servers ? "1" : "0"); - + for (vector::const_iterator i = _servers.begin(); i != _servers.end(); ++i) { root->add_child("Server")->add_child_text (*i); } @@ -356,9 +356,9 @@ Config::write () const root->add_child("MaximumJ2KBandwidth")->add_child_text (raw_convert (_maximum_j2k_bandwidth)); root->add_child("AllowAnyDCPFrameRate")->add_child_text (_allow_any_dcp_frame_rate ? "1" : "0"); root->add_child("LogTypes")->add_child_text (raw_convert (_log_types)); -#ifdef DCPOMATIC_WINDOWS +#ifdef DCPOMATIC_WINDOWS root->add_child("Win32Console")->add_child_text (_win32_console ? "1" : "0"); -#endif +#endif xmlpp::Element* signer = root->add_child ("Signer"); dcp::CertificateChain::List certs = _signer->certificates().root_to_leaf (); @@ -437,7 +437,7 @@ Config::add_to_history (boost::filesystem::path p) { /* Remove existing instances of this path in the history */ _history.erase (remove (_history.begin(), _history.end(), p), _history.end ()); - + _history.insert (_history.begin (), p); if (_history.size() > HISTORY_SIZE) { _history.pop_back (); diff --git a/src/lib/config.h b/src/lib/config.h index 20529911b..0040591f1 100644 --- a/src/lib/config.h +++ b/src/lib/config.h @@ -88,7 +88,7 @@ public: std::string tms_ip () const { return _tms_ip; } - + /** @return The path on a TMS that we should changed DCPs to */ std::string tms_path () const { return _tms_path; @@ -112,7 +112,7 @@ public: std::list > cinemas () const { return _cinemas; } - + std::list allowed_dcp_frame_rates () const { return _allowed_dcp_frame_rates; } @@ -120,7 +120,7 @@ public: bool allow_any_dcp_frame_rate () const { return _allow_any_dcp_frame_rate; } - + ISDCFMetadata default_isdcf_metadata () const { return _default_isdcf_metadata; } @@ -180,7 +180,7 @@ public: std::string kdm_bcc () const { return _kdm_bcc; } - + std::string kdm_email () const { return _kdm_email; } @@ -213,11 +213,11 @@ public: return _log_types; } -#ifdef DCPOMATIC_WINDOWS +#ifdef DCPOMATIC_WINDOWS bool win32_console () const { return _win32_console; } -#endif +#endif std::vector history () const { return _history; @@ -291,7 +291,7 @@ public: if (!_language) { return; } - + _language = boost::none; changed (); } @@ -347,7 +347,7 @@ public: void set_kdm_bcc (std::string f) { maybe_set (_kdm_bcc, f); } - + void set_kdm_email (std::string e) { maybe_set (_kdm_email, e); } @@ -382,11 +382,11 @@ public: maybe_set (_log_types, t); } -#ifdef DCPOMATIC_WINDOWS +#ifdef DCPOMATIC_WINDOWS void set_win32_console (bool c) { maybe_set (_win32_console, c); } -#endif +#endif void clear_history () { _history.clear (); @@ -394,12 +394,12 @@ public: } void add_to_history (boost::filesystem::path p); - + void changed (); boost::signals2::signal Changed; void write () const; - + static Config* instance (); static void drop (); static void restore_defaults (); @@ -474,11 +474,11 @@ private: /** maximum allowed J2K bandwidth in bits per second */ int _maximum_j2k_bandwidth; int _log_types; -#ifdef DCPOMATIC_WINDOWS +#ifdef DCPOMATIC_WINDOWS bool _win32_console; -#endif +#endif std::vector _history; - + /** Singleton instance, or 0 */ static Config* _instance; }; diff --git a/src/lib/content.cc b/src/lib/content.cc index 2ee660b7f..aa382d68b 100644 --- a/src/lib/content.cc +++ b/src/lib/content.cc @@ -134,7 +134,7 @@ Content::examine (shared_ptr job) if (job) { job->sub (_("Computing digest")); } - + boost::mutex::scoped_lock lm (_mutex); vector p = _paths; lm.unlock (); @@ -163,7 +163,7 @@ Content::set_position (DCPTime p) if (p == _position) { return; } - + _position = p; } @@ -200,7 +200,7 @@ Content::clone () const if (!film) { return shared_ptr (); } - + /* This is a bit naughty, but I can't think of a compelling reason not to do it ... */ xmlpp::Document doc; xmlpp::Node* node = doc.create_root_node ("Content"); @@ -230,7 +230,7 @@ string Content::identifier () const { SafeStringStream s; - + s << Content::digest() << "_" << position().get() << "_" << trim_start().get() diff --git a/src/lib/content.h b/src/lib/content.h index 4b6153a9d..6ee9e59dd 100644 --- a/src/lib/content.h +++ b/src/lib/content.h @@ -69,17 +69,17 @@ public: * @param job Job to use to report progress, or 0. */ virtual void examine (boost::shared_ptr job); - + /** @return Quick one-line summary of the content, as will be presented in the * film editor. */ virtual std::string summary () const = 0; - + /** @return Technical details of this content; these are written to logs to * help with debugging. */ virtual std::string technical_summary () const; - + virtual void as_xml (xmlpp::Node *) const; virtual DCPTime full_length () const = 0; virtual std::string identifier () const; @@ -104,7 +104,7 @@ public: boost::mutex::scoped_lock lm (_mutex); return _paths[i]; } - + bool paths_valid () const; /** @return Digest of the content's file(s). Note: this is @@ -134,7 +134,7 @@ public: } void set_trim_end (DCPTime); - + DCPTime trim_end () const { boost::mutex::scoped_lock lm (_mutex); return _trim_end; @@ -146,7 +146,7 @@ public: } DCPTime length_after_trim () const; - + void set_change_signals_frequent (bool f) { _change_signals_frequent = f; } @@ -169,7 +169,7 @@ protected: /** Paths of our data files */ std::vector _paths; - + private: std::string _digest; DCPTime _position; diff --git a/src/lib/content_audio.h b/src/lib/content_audio.h index 194e90e3f..c343865e3 100644 --- a/src/lib/content_audio.h +++ b/src/lib/content_audio.h @@ -37,7 +37,7 @@ public: : audio (new AudioBuffers (0, 0)) , frame (0) {} - + ContentAudio (boost::shared_ptr a, Frame f) : audio (a) , frame (f) diff --git a/src/lib/content_factory.cc b/src/lib/content_factory.cc index db3a30500..3c65b4312 100644 --- a/src/lib/content_factory.cc +++ b/src/lib/content_factory.cc @@ -48,7 +48,7 @@ content_factory (shared_ptr film, cxml::NodePtr node, int version, l string const type = node->string_child ("Type"); boost::shared_ptr content; - + if (type == "FFmpeg") { content.reset (new FFmpegContent (film, node, version, notes)); } else if (type == "Image") { diff --git a/src/lib/content_subtitle.h b/src/lib/content_subtitle.h index 36bc22b13..ef904a980 100644 --- a/src/lib/content_subtitle.h +++ b/src/lib/content_subtitle.h @@ -61,7 +61,7 @@ public: {} ContentTimePeriod period () const; - + std::list subs; }; diff --git a/src/lib/content_video.h b/src/lib/content_video.h index c8f5cca0b..2c996f816 100644 --- a/src/lib/content_video.h +++ b/src/lib/content_video.h @@ -40,7 +40,7 @@ public: , part (p) , frame (f) {} - + boost::shared_ptr image; Eyes eyes; Part part; diff --git a/src/lib/cross.cc b/src/lib/cross.cc index 0bcb31e3e..2689be2c2 100644 --- a/src/lib/cross.cc +++ b/src/lib/cross.cc @@ -75,7 +75,7 @@ string cpu_info () { string info; - + #ifdef DCPOMATIC_LINUX /* This use of ifstream is ok; the filename can never be non-Latin @@ -99,7 +99,7 @@ cpu_info () if (sysctlbyname ("machdep.cpu.brand_string", buffer, &N, 0, 0) == 0) { info = buffer; } -#endif +#endif #ifdef DCPOMATIC_WINDOWS HKEY key; @@ -124,11 +124,11 @@ cpu_info () } info = string (value.begin(), value.end()); - + RegCloseKey (key); -#endif - +#endif + return info; } @@ -142,7 +142,7 @@ app_contents () if (_NSGetExecutablePath (buffer, &size)) { throw StringError ("_NSGetExecutablePath failed"); } - + boost::filesystem::path path (buffer); path = boost::filesystem::canonical (path); path = path.parent_path (); @@ -170,7 +170,7 @@ shared_path () #endif #ifdef DCPOMATIC_OSX return app_contents() / "Resources"; -#endif +#endif } void @@ -241,7 +241,7 @@ run_ffprobe (boost::filesystem::path content, boost::filesystem::path out, share CloseHandle (child_stderr_read); #endif -#ifdef DCPOMATIC_LINUX +#ifdef DCPOMATIC_LINUX string ffprobe = "ffprobe \"" + content.string() + "\" 2> \"" + out.string() + "\""; LOG_GENERAL (N_("Probing with %1"), ffprobe); system (ffprobe.c_str ()); @@ -251,7 +251,7 @@ run_ffprobe (boost::filesystem::path content, boost::filesystem::path out, share boost::filesystem::path path = app_contents(); path /= "MacOS"; path /= "ffprobe"; - + string ffprobe = path.string() + " \"" + content.string() + "\" 2> \"" + out.string() + "\""; LOG_GENERAL (N_("Probing with %1"), ffprobe); system (ffprobe.c_str ()); @@ -262,13 +262,13 @@ list > mount_info () { list > m; - + #ifdef DCPOMATIC_LINUX FILE* f = setmntent ("/etc/mtab", "r"); if (!f) { return m; } - + while (true) { struct mntent* mnt = getmntent (f); if (!mnt) { @@ -291,11 +291,11 @@ openssl_path () wchar_t dir[512]; GetModuleFileName (GetModuleHandle (0), dir, sizeof (dir)); PathRemoveFileSpec (dir); - + boost::filesystem::path path = dir; path /= "openssl.exe"; return path; -#else +#else /* We assume that it's on the path for Linux and OS X */ return "openssl"; #endif @@ -323,9 +323,9 @@ dcpomatic_fseek (FILE* stream, int64_t offset, int whence) { #ifdef DCPOMATIC_WINDOWS return _fseeki64 (stream, offset, whence); -#else +#else return fseek (stream, offset, whence); -#endif +#endif } void @@ -333,7 +333,7 @@ Waker::nudge () { #ifdef DCPOMATIC_WINDOWS SetThreadExecutionState (ES_SYSTEM_REQUIRED); -#endif +#endif } Waker::Waker () @@ -343,12 +343,12 @@ Waker::Waker () // IOPMAssertionCreateWithName (kIOPMAssertionTypeNoIdleSleep, kIOPMAssertionLevelOn, CFSTR ("Encoding DCP"), &_assertion_id); /* but it's not available on 10.5, so we use this */ IOPMAssertionCreate (kIOPMAssertionTypeNoIdleSleep, kIOPMAssertionLevelOn, &_assertion_id); -#endif +#endif } Waker::~Waker () { -#ifdef DCPOMATIC_OSX +#ifdef DCPOMATIC_OSX IOPMAssertionRelease (_assertion_id); -#endif +#endif } diff --git a/src/lib/data.cc b/src/lib/data.cc index 92b0b19d5..5975ff6fc 100644 --- a/src/lib/data.cc +++ b/src/lib/data.cc @@ -54,13 +54,13 @@ Data::Data (boost::filesystem::path file) if (!f) { throw FileError (_("could not open file for reading"), file); } - + size_t const r = fread (_data.get(), 1, _size, f); if (r != size_t (_size)) { fclose (f); throw FileError (_("could not read from file"), file); } - + fclose (f); } diff --git a/src/lib/dcp_content.cc b/src/lib/dcp_content.cc index d51a560dd..880a543e7 100644 --- a/src/lib/dcp_content.cc +++ b/src/lib/dcp_content.cc @@ -82,10 +82,10 @@ void DCPContent::examine (shared_ptr job) { bool const could_be_played = can_be_played (); - + job->set_progress_unknown (); Content::examine (job); - + shared_ptr examiner (new DCPExaminer (shared_from_this ())); take_from_video_examiner (examiner); take_from_audio_examiner (examiner); diff --git a/src/lib/dcp_content.h b/src/lib/dcp_content.h index 74f06cdc6..54527422e 100644 --- a/src/lib/dcp_content.h +++ b/src/lib/dcp_content.h @@ -51,7 +51,7 @@ public: } DCPTime full_length () const; - + void examine (boost::shared_ptr); std::string summary () const; std::string technical_summary () const; @@ -63,7 +63,7 @@ public: boost::mutex::scoped_lock lm (_mutex); return _has_subtitles; } - + boost::filesystem::path directory () const; bool encrypted () const { @@ -78,10 +78,10 @@ public: } bool can_be_played () const; - + private: void read_directory (boost::filesystem::path); - + std::string _name; bool _has_subtitles; /** true if our DCP is encrypted */ diff --git a/src/lib/dcp_content_type.h b/src/lib/dcp_content_type.h index 34398009b..c370fef4d 100644 --- a/src/lib/dcp_content_type.h +++ b/src/lib/dcp_content_type.h @@ -64,5 +64,5 @@ private: /** All available DCP content types */ static std::vector _dcp_content_types; }; - + #endif diff --git a/src/lib/dcp_decoder.cc b/src/lib/dcp_decoder.cc index ab906b3d1..0ec50e0cd 100644 --- a/src/lib/dcp_decoder.cc +++ b/src/lib/dcp_decoder.cc @@ -63,7 +63,7 @@ DCPDecoder::pass () float const vfr = _dcp_content->video_frame_rate (); int64_t const frame = _next.frames (vfr); - + if ((*_reel)->main_picture ()) { shared_ptr asset = (*_reel)->main_picture()->asset (); shared_ptr mono = dynamic_pointer_cast (asset); @@ -76,7 +76,7 @@ DCPDecoder::pass () shared_ptr (new J2KImageProxy (stereo->get_frame (entry_point + frame), asset->size(), dcp::EYE_LEFT)), frame ); - + video ( shared_ptr (new J2KImageProxy (stereo->get_frame (entry_point + frame), asset->size(), dcp::EYE_RIGHT)), frame @@ -111,7 +111,7 @@ DCPDecoder::pass () ++_reel; } } - + return false; } diff --git a/src/lib/dcp_decoder.h b/src/lib/dcp_decoder.h index 5d9b76497..7d26139ba 100644 --- a/src/lib/dcp_decoder.h +++ b/src/lib/dcp_decoder.h @@ -40,7 +40,7 @@ public: private: bool pass (); void seek (ContentTime t, bool accurate); - + std::list image_subtitles_during (ContentTimePeriod, bool starting) const; std::list text_subtitles_during (ContentTimePeriod, bool starting) const; diff --git a/src/lib/dcp_examiner.cc b/src/lib/dcp_examiner.cc index 21ffeda29..1dd469206 100644 --- a/src/lib/dcp_examiner.cc +++ b/src/lib/dcp_examiner.cc @@ -83,7 +83,7 @@ DCPExaminer::DCPExaminer (shared_ptr content) _video_length += (*i)->main_picture()->duration(); } - + if ((*i)->main_sound ()) { shared_ptr asset = (*i)->main_sound()->asset (); @@ -109,20 +109,20 @@ DCPExaminer::DCPExaminer (shared_ptr content) _encrypted = dcp.encrypted (); _kdm_valid = true; - + /* Check that we can read the first picture frame */ try { if (!dcp.cpls().empty () && !dcp.cpls().front()->reels().empty ()) { shared_ptr asset = dcp.cpls().front()->reels().front()->main_picture()->asset (); shared_ptr mono = dynamic_pointer_cast (asset); shared_ptr stereo = dynamic_pointer_cast (asset); - + if (mono) { mono->get_frame(0)->xyz_image (); } else { stereo->get_frame(0)->xyz_image (dcp::EYE_LEFT); } - + } } catch (dcp::DCPReadError& e) { _kdm_valid = false; diff --git a/src/lib/dcp_examiner.h b/src/lib/dcp_examiner.h index bf083e8ec..ed457b5c2 100644 --- a/src/lib/dcp_examiner.h +++ b/src/lib/dcp_examiner.h @@ -30,15 +30,15 @@ class DCPExaminer : public VideoExaminer, public AudioExaminer { public: DCPExaminer (boost::shared_ptr); - + boost::optional video_frame_rate () const { return _video_frame_rate; } - + dcp::Size video_size () const { return _video_size.get_value_or (dcp::Size (1998, 1080)); } - + Frame video_length () const { return _video_length; } @@ -58,11 +58,11 @@ public: int audio_channels () const { return _audio_channels.get_value_or (0); } - + Frame audio_length () const { return _audio_length; } - + int audio_frame_rate () const { return _audio_frame_rate.get_value_or (48000); } diff --git a/src/lib/dcp_subtitle.cc b/src/lib/dcp_subtitle.cc index 9963d0a94..be6493780 100644 --- a/src/lib/dcp_subtitle.cc +++ b/src/lib/dcp_subtitle.cc @@ -30,11 +30,11 @@ shared_ptr DCPSubtitle::load (boost::filesystem::path file) const { shared_ptr sc; - + try { sc.reset (new dcp::InteropSubtitleAsset (file)); } catch (...) { - + } if (!sc) { diff --git a/src/lib/dcp_subtitle_content.cc b/src/lib/dcp_subtitle_content.cc index 3f13f34e2..8b09b6fee 100644 --- a/src/lib/dcp_subtitle_content.cc +++ b/src/lib/dcp_subtitle_content.cc @@ -36,7 +36,7 @@ DCPSubtitleContent::DCPSubtitleContent (shared_ptr film, boost::file : Content (film, path) , SubtitleContent (film, path) { - + } DCPSubtitleContent::DCPSubtitleContent (shared_ptr film, cxml::ConstNodePtr node, int version) @@ -56,7 +56,7 @@ DCPSubtitleContent::examine (shared_ptr job) /* Default to turning these subtitles on */ set_use_subtitles (true); - + boost::mutex::scoped_lock lm (_mutex); shared_ptr iop = dynamic_pointer_cast (sc); @@ -95,7 +95,7 @@ DCPSubtitleContent::technical_summary () const { return Content::technical_summary() + " - " + _("DCP XML subtitles"); } - + void DCPSubtitleContent::as_xml (xmlpp::Node* node) const { diff --git a/src/lib/dcp_subtitle_decoder.cc b/src/lib/dcp_subtitle_decoder.cc index 9687f646c..3c7bffdda 100644 --- a/src/lib/dcp_subtitle_decoder.cc +++ b/src/lib/dcp_subtitle_decoder.cc @@ -65,7 +65,7 @@ DCPSubtitleDecoder::image_subtitles_during (ContentTimePeriod, bool) const { return list (); } - + list DCPSubtitleDecoder::text_subtitles_during (ContentTimePeriod p, bool starting) const { @@ -78,7 +78,7 @@ DCPSubtitleDecoder::text_subtitles_during (ContentTimePeriod p, bool starting) c ContentTime::from_seconds (i->in().as_seconds ()), ContentTime::from_seconds (i->out().as_seconds ()) ); - + if ((starting && p.contains (period.from)) || (!starting && p.overlaps (period))) { d.push_back (period); } diff --git a/src/lib/dcp_video.cc b/src/lib/dcp_video.cc index 806ec9464..b72353d9e 100644 --- a/src/lib/dcp_video.cc +++ b/src/lib/dcp_video.cc @@ -87,7 +87,7 @@ DCPVideo::DCPVideo ( , _burn_subtitles (b) , _log (l) { - + } DCPVideo::DCPVideo (shared_ptr frame, shared_ptr node, shared_ptr log) @@ -144,11 +144,11 @@ DCPVideo::encode_locally (dcp::NoteHandler note) parameters.tile_size_on = false; parameters.cp_tdx = 1; parameters.cp_tdy = 1; - + /* Tile part */ parameters.tp_flag = 'C'; parameters.tp_on = 1; - + /* Tile and Image shall be at (0,0) */ parameters.cp_tx0 = 0; parameters.cp_ty0 = 0; @@ -159,19 +159,19 @@ DCPVideo::encode_locally (dcp::NoteHandler note) parameters.cblockw_init = 32; parameters.cblockh_init = 32; parameters.csty |= 0x01; - + /* The progression order shall be CPRL */ parameters.prog_order = CPRL; - + /* No ROI */ parameters.roi_compno = -1; - + parameters.subsampling_dx = 1; parameters.subsampling_dy = 1; - + /* 9-7 transform */ parameters.irreversible = 1; - + parameters.tcp_rates[0] = 0; parameters.tcp_numlayers++; parameters.cp_disto_alloc = 1; @@ -179,27 +179,27 @@ DCPVideo::encode_locally (dcp::NoteHandler note) if (_resolution == RESOLUTION_4K) { parameters.numpocs = 2; parameters.POC[0].tile = 1; - parameters.POC[0].resno0 = 0; + parameters.POC[0].resno0 = 0; parameters.POC[0].compno0 = 0; parameters.POC[0].layno1 = 1; parameters.POC[0].resno1 = parameters.numresolution - 1; parameters.POC[0].compno1 = 3; parameters.POC[0].prg1 = CPRL; parameters.POC[1].tile = 1; - parameters.POC[1].resno0 = parameters.numresolution - 1; + parameters.POC[1].resno0 = parameters.numresolution - 1; parameters.POC[1].compno0 = 0; parameters.POC[1].layno1 = 1; parameters.POC[1].resno1 = parameters.numresolution; parameters.POC[1].compno1 = 3; parameters.POC[1].prg1 = CPRL; } - + parameters.cp_comment = strdup (N_("DCP-o-matic")); parameters.cp_cinema = _resolution == RESOLUTION_2K ? CINEMA2K_24 : CINEMA4K_24; /* 3 components, so use MCT */ parameters.tcp_mct = 1; - + /* set max image */ parameters.max_comp_size = max_comp_size; parameters.tcp_rates[0] = ((float) (3 * xyz->size().width * xyz->size().height * 12)) / (max_cs_len * 8); @@ -269,7 +269,7 @@ DCPVideo::encode_remotely (ServerDescription serv) add_metadata (root); LOG_GENERAL (N_("Sending frame %1 to remote"), _index); - + /* Send XML metadata */ string xml = doc.write_to_string ("UTF-8"); socket->write (xml.length() + 1); @@ -285,7 +285,7 @@ DCPVideo::encode_remotely (ServerDescription serv) socket->read (e.data().get(), e.size()); LOG_GENERAL (N_("Finished remotely-encoded frame %1"), _index); - + return e; } diff --git a/src/lib/dcp_video.h b/src/lib/dcp_video.h index c1c48623d..97be07798 100644 --- a/src/lib/dcp_video.h +++ b/src/lib/dcp_video.h @@ -59,11 +59,11 @@ public: Eyes eyes () const; bool same (boost::shared_ptr other) const; - + private: void add_metadata (xmlpp::Element *) const; - + boost::shared_ptr _frame; int _index; ///< frame index within the DCP's intrinsic duration int _frames_per_second; ///< Frames per second that we will use for the DCP diff --git a/src/lib/dcpomatic_socket.cc b/src/lib/dcpomatic_socket.cc index d575e3230..16f01f39c 100644 --- a/src/lib/dcpomatic_socket.cc +++ b/src/lib/dcpomatic_socket.cc @@ -78,7 +78,7 @@ Socket::write (uint8_t const * data, int size) boost::system::error_code ec = boost::asio::error::would_block; boost::asio::async_write (_socket, boost::asio::buffer (data, size), boost::lambda::var(ec) = boost::lambda::_1); - + do { _io_service.run_one (); } while (ec == boost::asio::error::would_block); @@ -110,7 +110,7 @@ Socket::read (uint8_t* data, int size) do { _io_service.run_one (); } while (ec == boost::asio::error::would_block); - + if (ec) { throw NetworkError (String::compose (_("error during async_read (%1)"), ec.value ())); } diff --git a/src/lib/dcpomatic_socket.h b/src/lib/dcpomatic_socket.h index 82ca5ff69..9e81faa0c 100644 --- a/src/lib/dcpomatic_socket.h +++ b/src/lib/dcpomatic_socket.h @@ -40,10 +40,10 @@ public: void write (uint32_t n); void write (uint8_t const * data, int size); - + void read (uint8_t* data, int size); uint32_t read_uint32 (); - + private: void check (); diff --git a/src/lib/dcpomatic_time.h b/src/lib/dcpomatic_time.h index 0b78c5390..df9c46c71 100644 --- a/src/lib/dcpomatic_time.h +++ b/src/lib/dcpomatic_time.h @@ -62,7 +62,7 @@ public: /* Explicit conversion from type O */ Time (Time d, FrameRateChange f); - + Type get () const { return _t; } @@ -144,7 +144,7 @@ public: to a frame boundary at the start rather than the end. */ int64_t ff = frames (r); - + h = ff / (3600 * r); ff -= h * 3600 * r; m = ff / (60 * r); @@ -173,7 +173,7 @@ public: return o.str (); } - + static Time from_seconds (double s) { return Time (s * HZ); } @@ -191,14 +191,14 @@ public: static Time min () { return Time (-INT64_MAX); } - + static Time max () { return Time (INT64_MAX); } - + private: friend struct dcptime_round_up_test; - + Type _t; static const int HZ = 96000; }; @@ -223,7 +223,7 @@ class ContentTimePeriod { public: ContentTimePeriod () {} - + ContentTimePeriod (ContentTime f, ContentTime t) : from (f) , to (t) diff --git a/src/lib/decoder.h b/src/lib/decoder.h index c5a359e1a..c93069882 100644 --- a/src/lib/decoder.h +++ b/src/lib/decoder.h @@ -40,9 +40,9 @@ class Decoder : public boost::noncopyable public: virtual ~Decoder () {} -protected: +protected: friend class AudioDecoderStream; - + /** Seek so that the next pass() will yield the next thing * (video/sound frame, subtitle etc.) at or after the requested * time. Pass accurate = true to try harder to ensure that, at worst, diff --git a/src/lib/dolby_cp750.cc b/src/lib/dolby_cp750.cc index 317d129d9..35f044630 100644 --- a/src/lib/dolby_cp750.cc +++ b/src/lib/dolby_cp750.cc @@ -39,7 +39,7 @@ DolbyCP750::db_for_fader_change (float from, float to) const float const t = min (to, 4.0f); db += (t - from) * 20; } - + if (to > 4) { float const t = max (from, 4.0f); db += (to - t) * 3.33333333333333333; diff --git a/src/lib/encoder.cc b/src/lib/encoder.cc index 776ccd118..93e15031d 100644 --- a/src/lib/encoder.cc +++ b/src/lib/encoder.cc @@ -117,7 +117,7 @@ Encoder::end () } lock.unlock (); - + terminate_threads (); LOG_GENERAL (N_("Mopping up %1"), _queue.size()); @@ -144,7 +144,7 @@ Encoder::end () LOG_ERROR (N_("Local encode failed (%1)"), e.what ()); } } -} +} /** @return an estimate of the current number of frames we are encoding per second, * or 0 if not known. @@ -178,7 +178,7 @@ void Encoder::frame_done () { boost::mutex::scoped_lock lock (_state_mutex); - + struct timeval tv; gettimeofday (&tv, 0); _time_history.push_front (tv); @@ -194,7 +194,7 @@ void Encoder::enqueue (shared_ptr pv) { _waker.nudge (); - + boost::mutex::scoped_lock lock (_mutex); /* XXX: discard 3D here if required */ @@ -283,7 +283,7 @@ try encodings. */ int remote_backoff = 0; - + while (true) { LOG_TIMING ("[%1] encoder thread sleeps", boost::this_thread::get_id()); @@ -300,7 +300,7 @@ try shared_ptr vf = _queue.front (); LOG_TIMING ("[%1] encoder thread pops frame %2 (%3) from queue", boost::this_thread::get_id(), vf->index(), vf->eyes ()); _queue.pop_front (); - + lock.unlock (); optional encoded; @@ -309,14 +309,14 @@ try if (server) { try { encoded = vf->encode_remotely (server.get ()); - + if (remote_backoff > 0) { LOG_GENERAL ("%1 was lost, but now she is found; removing backoff", server->host_name ()); } - + /* This job succeeded, so remove any backoff */ remote_backoff = 0; - + } catch (std::exception& e) { if (remote_backoff < 60) { /* back off more */ @@ -327,7 +327,7 @@ try vf->index(), server->host_name(), e.what(), remote_backoff ); } - + } else { try { LOG_TIMING ("[%1] encoder thread begins local encode of %2", boost::this_thread::get_id(), vf->index()); diff --git a/src/lib/encoder.h b/src/lib/encoder.h index 0e2d30654..6bbdda4c5 100644 --- a/src/lib/encoder.h +++ b/src/lib/encoder.h @@ -77,9 +77,9 @@ public: int video_frames_out () const; private: - + void frame_done (); - + void encoder_thread (boost::optional); void terminate_threads (); void add_worker_threads (ServerDescription); diff --git a/src/lib/environment_info.cc b/src/lib/environment_info.cc index d10e23727..364973ff8 100644 --- a/src/lib/environment_info.cc +++ b/src/lib/environment_info.cc @@ -109,7 +109,7 @@ environment_info (shared_ptr log) info.dwOSVersionInfoSize = sizeof (info); GetVersionEx (&info); LOG_GENERAL ("Windows version %1.%2.%3 SP %4", info.dwMajorVersion, info.dwMinorVersion, info.dwBuildNumber, info.szCSDVersion); -#endif +#endif #if __GNUC__ #if __x86_64__ @@ -118,7 +118,7 @@ environment_info (shared_ptr log) LOG_GENERAL_NC ("Built for 32-bit"); #endif #endif - + LOG_GENERAL ("CPU: %1, %2 processors", cpu_info(), boost::thread::hardware_concurrency ()); list > const m = mount_info (); for (list >::const_iterator i = m.begin(); i != m.end(); ++i) { diff --git a/src/lib/exceptions.cc b/src/lib/exceptions.cc index c4c3d0815..399915253 100644 --- a/src/lib/exceptions.cc +++ b/src/lib/exceptions.cc @@ -47,7 +47,7 @@ ReadFileError::ReadFileError (boost::filesystem::path f, int e) WriteFileError::WriteFileError (boost::filesystem::path f, int e) : FileError (String::compose (_("could not write to file %1 (%2)"), f.string(), strerror (e)), f) { - + } MissingSettingError::MissingSettingError (string s) @@ -65,7 +65,7 @@ PixelFormatError::PixelFormatError (string o, AVPixelFormat f) SubRipError::SubRipError (string saw, string expecting, boost::filesystem::path f) : FileError (String::compose (_("Error in SubRip file: saw %1 while expecting %2"), saw.empty() ? "[nothing]" : saw, expecting), f) { - + } InvalidSignerError::InvalidSignerError () diff --git a/src/lib/exceptions.h b/src/lib/exceptions.h index 96dc816ec..268e8c36d 100644 --- a/src/lib/exceptions.h +++ b/src/lib/exceptions.h @@ -296,8 +296,8 @@ public: } } -protected: - +protected: + void store_current () { boost::mutex::scoped_lock lm (_mutex); _exception = boost::current_exception (); diff --git a/src/lib/ffmpeg.cc b/src/lib/ffmpeg.cc index 8764933e3..f5d114e8f 100644 --- a/src/lib/ffmpeg.cc +++ b/src/lib/ffmpeg.cc @@ -85,14 +85,14 @@ FFmpeg::setup_general () _avio_context = avio_alloc_context (_avio_buffer, _avio_buffer_size, 0, this, avio_read_wrapper, 0, avio_seek_wrapper); _format_context = avformat_alloc_context (); _format_context->pb = _avio_context; - + AVDictionary* options = 0; /* These durations are in microseconds, and represent how far into the content file we will look for streams. */ av_dict_set (&options, "analyzeduration", raw_convert (5 * 60 * 1000000).c_str(), 0); av_dict_set (&options, "probesize", raw_convert (5 * 60 * 1000000).c_str(), 0); - + if (avformat_open_input (&_format_context, 0, 0, &options) < 0) { throw OpenFileError (_ffmpeg_content->path(0).string ()); } @@ -126,8 +126,8 @@ FFmpeg::setup_general () */ if (_video_stream == -1 && video_stream_undefined_frame_rate != -1) { _video_stream = video_stream_undefined_frame_rate; - } - + } + if (_video_stream < 0) { throw DecodeError (N_("could not find video stream")); } @@ -146,7 +146,7 @@ FFmpeg::setup_general () } } } - + if (duplicates) { /* Put in our own IDs */ for (uint32_t i = 0; i < _format_context->nb_streams; ++i) { @@ -167,7 +167,7 @@ FFmpeg::setup_decoders () for (uint32_t i = 0; i < _format_context->nb_streams; ++i) { AVCodecContext* context = _format_context->streams[i]->codec; - + AVCodec* codec = avcodec_find_decoder (context->codec_id); if (codec) { @@ -177,7 +177,7 @@ FFmpeg::setup_decoders () */ AVDictionary* options = 0; av_dict_set (&options, "disable_footer", "1", 0); - + if (avcodec_open2 (context, codec, &options) < 0) { throw DecodeError (N_("could not open decoder")); } @@ -199,7 +199,7 @@ FFmpeg::subtitle_codec_context () const if (!_ffmpeg_content->subtitle_stream ()) { return 0; } - + return _ffmpeg_content->subtitle_stream()->stream(_format_context)->codec; } @@ -215,6 +215,6 @@ FFmpeg::avio_seek (int64_t const pos, int whence) if (whence == AVSEEK_SIZE) { return _file_group.length (); } - + return _file_group.seek (pos, whence); } diff --git a/src/lib/ffmpeg.h b/src/lib/ffmpeg.h index 835136c75..4299edc28 100644 --- a/src/lib/ffmpeg.h +++ b/src/lib/ffmpeg.h @@ -56,14 +56,14 @@ public: protected: AVCodecContext* video_codec_context () const; AVCodecContext* subtitle_codec_context () const; - + boost::shared_ptr _ffmpeg_content; uint8_t* _avio_buffer; int _avio_buffer_size; AVIOContext* _avio_context; FileGroup _file_group; - + AVFormatContext* _format_context; AVPacket _packet; AVFrame* _frame; diff --git a/src/lib/ffmpeg_audio_stream.h b/src/lib/ffmpeg_audio_stream.h index 7fe3c4fda..84882e89c 100644 --- a/src/lib/ffmpeg_audio_stream.h +++ b/src/lib/ffmpeg_audio_stream.h @@ -37,7 +37,7 @@ public: void as_xml (xmlpp::Node *) const; /* XXX: should probably be locked */ - + boost::optional first_audio; private: diff --git a/src/lib/ffmpeg_content.cc b/src/lib/ffmpeg_content.cc index 1793b8998..c4fc36357 100644 --- a/src/lib/ffmpeg_content.cc +++ b/src/lib/ffmpeg_content.cc @@ -172,7 +172,7 @@ FFmpegContent::examine (shared_ptr job) if (!_subtitle_streams.empty ()) { _subtitle_stream = _subtitle_streams.front (); } - + _audio_streams = examiner->audio_streams (); if (!_audio_streams.empty ()) { @@ -214,7 +214,7 @@ FFmpegContent::technical_summary () const } string filt = Filter::ffmpeg_string (_filters); - + return Content::technical_summary() + " - " + VideoContent::technical_summary() + " - " + AudioContent::technical_summary() + " - " @@ -321,7 +321,7 @@ vector FFmpegContent::audio_streams () const { boost::mutex::scoped_lock lm (_mutex); - + vector s; copy (_audio_streams.begin(), _audio_streams.end(), back_inserter (s)); return s; diff --git a/src/lib/ffmpeg_content.h b/src/lib/ffmpeg_content.h index 04523b117..5c2b5496d 100644 --- a/src/lib/ffmpeg_content.h +++ b/src/lib/ffmpeg_content.h @@ -54,7 +54,7 @@ public: boost::shared_ptr shared_from_this () { return boost::dynamic_pointer_cast (Content::shared_from_this ()); } - + void examine (boost::shared_ptr); std::string summary () const; std::string technical_summary () const; @@ -65,7 +65,7 @@ public: /* VideoContent */ void set_default_colour_conversion (); - + /* AudioContent */ std::vector audio_streams () const; @@ -73,7 +73,7 @@ public: bool has_subtitles () const; void set_filters (std::vector const &); - + std::vector > subtitle_streams () const { boost::mutex::scoped_lock lm (_mutex); return _subtitle_streams; @@ -106,7 +106,7 @@ public: private: friend struct ffmpeg_pts_offset_test; friend struct audio_sampling_rate_test; - + std::vector > _subtitle_streams; boost::shared_ptr _subtitle_stream; std::vector > _audio_streams; diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc index 4ca06329b..0c9225a6a 100644 --- a/src/lib/ffmpeg_decoder.cc +++ b/src/lib/ffmpeg_decoder.cc @@ -124,14 +124,14 @@ void FFmpegDecoder::flush () { /* Get any remaining frames */ - + _packet.data = 0; _packet.size = 0; - + /* XXX: should we reset _packet.data and size after each *_decode_* call? */ - + while (decode_video_packet ()) {} - + decode_audio_packet (); AudioDecoder::flush (); } @@ -152,7 +152,7 @@ FFmpegDecoder::pass () av_strerror (r, buf, sizeof(buf)); LOG_ERROR (N_("error on av_read_frame (%1) (%2)"), buf, r); } - + flush (); return true; } @@ -206,7 +206,7 @@ FFmpegDecoder::deinterleave_audio (shared_ptr stream, uint8_t } } break; - + case AV_SAMPLE_FMT_S16: { int16_t* p = reinterpret_cast (data[0]); @@ -234,7 +234,7 @@ FFmpegDecoder::deinterleave_audio (shared_ptr stream, uint8_t } } break; - + case AV_SAMPLE_FMT_S32: { int32_t* p = reinterpret_cast (data[0]); @@ -268,7 +268,7 @@ FFmpegDecoder::deinterleave_audio (shared_ptr stream, uint8_t } } break; - + case AV_SAMPLE_FMT_FLTP: { float** p = reinterpret_cast (data); @@ -314,7 +314,7 @@ FFmpegDecoder::seek (ContentTime time, bool accurate) /* XXX: it seems debatable whether PTS should be used here... http://www.mjbshaw.com/2012/04/seeking-in-ffmpeg-know-your-timestamp.html */ - + ContentTime u = time - _pts_offset; if (u < ContentTime ()) { u = ContentTime (); @@ -324,7 +324,7 @@ FFmpegDecoder::seek (ContentTime time, bool accurate) avcodec_flush_buffers (video_codec_context()); /* XXX: should be flushing audio buffers? */ - + if (subtitle_codec_context ()) { avcodec_flush_buffers (subtitle_codec_context ()); } @@ -336,7 +336,7 @@ FFmpegDecoder::decode_audio_packet () /* Audio packets can contain multiple frames, so we may have to call avcodec_decode_audio4 several times. */ - + AVPacket copy_packet = _packet; /* XXX: inefficient */ @@ -350,7 +350,7 @@ FFmpegDecoder::decode_audio_packet () /* The packet's stream may not be an audio one; just ignore it in this method if so */ return; } - + while (copy_packet.size > 0) { int frame_finished; @@ -376,14 +376,14 @@ FFmpegDecoder::decode_audio_packet () av_frame_get_best_effort_timestamp (_frame) * av_q2d ((*stream)->stream (_format_context)->time_base)) + _pts_offset; - + int const data_size = av_samples_get_buffer_size ( 0, (*stream)->stream(_format_context)->codec->channels, _frame->nb_samples, audio_sample_format (*stream), 1 ); audio (*stream, deinterleave_audio (*stream, _frame->data, data_size), ct); } - + copy_packet.data += decode_result; copy_packet.size -= decode_result; } @@ -400,7 +400,7 @@ FFmpegDecoder::decode_video_packet () boost::mutex::scoped_lock lm (_filter_graphs_mutex); shared_ptr graph; - + list >::iterator i = _filter_graphs.begin(); while (i != _filter_graphs.end() && !(*i)->can_process (dcp::Size (_frame->width, _frame->height), (AVPixelFormat) _frame->format)) { ++i; @@ -419,7 +419,7 @@ FFmpegDecoder::decode_video_packet () for (list, int64_t> >::iterator i = images.begin(); i != images.end(); ++i) { shared_ptr image = i->first; - + if (i->second != AV_NOPTS_VALUE) { double const pts = i->second * av_q2d (_format_context->streams[_video_stream]->time_base) + _pts_offset.seconds (); video ( @@ -433,7 +433,7 @@ FFmpegDecoder::decode_video_packet () return true; } - + void FFmpegDecoder::decode_subtitle_packet () { @@ -442,7 +442,7 @@ FFmpegDecoder::decode_subtitle_packet () if (avcodec_decode_subtitle2 (subtitle_codec_context(), &sub, &got_subtitle, &_packet) < 0 || !got_subtitle) { return; } - + if (sub.num_rects <= 0) { /* Sometimes we get an empty AVSubtitle, which is used by some codecs to indicate that the previous subtitle should stop. We can ignore it here. @@ -465,7 +465,7 @@ FFmpegDecoder::decode_subtitle_packet () /* We have to look up the `to' time in the stream's records */ period.to = ffmpeg_content()->subtitle_stream()->find_subtitle_to (sub_period.from); } - + AVSubtitleRect const * rect = sub.rects[0]; switch (rect->type) { @@ -481,7 +481,7 @@ FFmpegDecoder::decode_subtitle_packet () cout << "XXX: SUBTITLE_ASS " << rect->ass << "\n"; break; } - + avsubtitle_free (&sub); } @@ -504,7 +504,7 @@ FFmpegDecoder::decode_bitmap_subtitle (AVSubtitleRect const * rect, ContentTimeP G, third B, fourth A. */ shared_ptr image (new Image (PIX_FMT_RGBA, dcp::Size (rect->w, rect->h), true)); - + /* Start of the first line in the subtitle */ uint8_t* sub_p = rect->pict.data[0]; /* sub_p looks up into a BGRA palette which is here @@ -513,7 +513,7 @@ FFmpegDecoder::decode_bitmap_subtitle (AVSubtitleRect const * rect, ContentTimeP uint32_t const * palette = (uint32_t *) rect->pict.data[1]; /* Start of the output data */ uint32_t* out_p = (uint32_t *) image->data()[0]; - + for (int y = 0; y < rect->h; ++y) { uint8_t* sub_line_p = sub_p; uint32_t* out_line_p = out_p; @@ -524,7 +524,7 @@ FFmpegDecoder::decode_bitmap_subtitle (AVSubtitleRect const * rect, ContentTimeP sub_p += rect->pict.linesize[0]; out_p += image->stride()[0] / sizeof (uint32_t); } - + dcp::Size const vs = _ffmpeg_content->video_size (); dcpomatic::Rect const scaled_rect ( static_cast (rect->x) / vs.width, @@ -532,7 +532,7 @@ FFmpegDecoder::decode_bitmap_subtitle (AVSubtitleRect const * rect, ContentTimeP static_cast (rect->w) / vs.width, static_cast (rect->h) / vs.height ); - + image_subtitle (period, image, scaled_rect); } diff --git a/src/lib/ffmpeg_decoder.h b/src/lib/ffmpeg_decoder.h index 41af74447..60217b073 100644 --- a/src/lib/ffmpeg_decoder.h +++ b/src/lib/ffmpeg_decoder.h @@ -72,9 +72,9 @@ private: std::list image_subtitles_during (ContentTimePeriod, bool starting) const; std::list text_subtitles_during (ContentTimePeriod, bool starting) const; - + boost::shared_ptr _log; - + std::list > _filter_graphs; boost::mutex _filter_graphs_mutex; diff --git a/src/lib/ffmpeg_examiner.cc b/src/lib/ffmpeg_examiner.cc index 6d5e33238..16a89faa7 100644 --- a/src/lib/ffmpeg_examiner.cc +++ b/src/lib/ffmpeg_examiner.cc @@ -56,7 +56,7 @@ FFmpegExaminer::FFmpegExaminer (shared_ptr c, shared_ptrcodec->channel_layout == 0) { s->codec->channel_layout = av_get_default_channel_layout (s->codec->channels); } - + _audio_streams.push_back ( shared_ptr ( new FFmpegAudioStream (audio_stream_name (s), s->id, s->codec->sample_rate, s->codec->channels) @@ -105,7 +105,7 @@ FFmpegExaminer::FFmpegExaminer (shared_ptr c, shared_ptruses_index (_format_context, _packet.stream_index)) { audio_packet (context, _audio_streams[i]); @@ -180,7 +180,7 @@ optional FFmpegExaminer::frame_time (AVStream* s) const { optional t; - + int64_t const bet = av_frame_get_best_effort_timestamp (_frame); if (bet != AV_NOPTS_VALUE) { t = ContentTime::from_seconds (bet * av_q2d (s->time_base)); @@ -263,7 +263,7 @@ FFmpegExaminer::stream_name (AVStream* s) const if (lang) { n << lang->value; } - + AVDictionaryEntry const * title = av_dict_get (s->metadata, "title", 0, 0); if (title) { if (!n.str().empty()) { diff --git a/src/lib/ffmpeg_examiner.h b/src/lib/ffmpeg_examiner.h index d6149446a..7b64b508a 100644 --- a/src/lib/ffmpeg_examiner.h +++ b/src/lib/ffmpeg_examiner.h @@ -28,7 +28,7 @@ class FFmpegExaminer : public FFmpeg, public VideoExaminer { public: FFmpegExaminer (boost::shared_ptr, boost::shared_ptr job = boost::shared_ptr ()); - + boost::optional video_frame_rate () const; dcp::Size video_size () const; Frame video_length () const; @@ -37,7 +37,7 @@ public: std::vector > subtitle_streams () const { return _subtitle_streams; } - + std::vector > audio_streams () const { return _audio_streams; } @@ -45,12 +45,12 @@ public: boost::optional first_video () const { return _first_video; } - + private: void video_packet (AVCodecContext *); void audio_packet (AVCodecContext *, boost::shared_ptr); void subtitle_packet (AVCodecContext *, boost::shared_ptr); - + std::string stream_name (AVStream* s) const; std::string audio_stream_name (AVStream* s) const; std::string subtitle_stream_name (AVStream* s) const; diff --git a/src/lib/ffmpeg_stream.h b/src/lib/ffmpeg_stream.h index 6479bd70d..0930ea2b4 100644 --- a/src/lib/ffmpeg_stream.h +++ b/src/lib/ffmpeg_stream.h @@ -33,7 +33,7 @@ public: : name (n) , _id (i) {} - + FFmpegStream (cxml::ConstNodePtr); void as_xml (xmlpp::Node *) const; @@ -57,7 +57,7 @@ public: friend bool operator== (FFmpegStream const & a, FFmpegStream const & b); friend bool operator!= (FFmpegStream const & a, FFmpegStream const & b); - + private: int _id; }; diff --git a/src/lib/ffmpeg_subtitle_stream.cc b/src/lib/ffmpeg_subtitle_stream.cc index b322428b9..413477865 100644 --- a/src/lib/ffmpeg_subtitle_stream.cc +++ b/src/lib/ffmpeg_subtitle_stream.cc @@ -62,11 +62,11 @@ FFmpegSubtitleStream::add_subtitle (ContentTimePeriod period) _subtitles[period.from] = period.to; } -list +list FFmpegSubtitleStream::subtitles_during (ContentTimePeriod period, bool starting) const { list d; - + /* XXX: inefficient */ for (map::const_iterator i = _subtitles.begin(); i != _subtitles.end(); ++i) { if ((starting && period.contains (i->first)) || (!starting && period.overlaps (ContentTimePeriod (i->first, i->second)))) { diff --git a/src/lib/ffmpeg_subtitle_stream.h b/src/lib/ffmpeg_subtitle_stream.h index 3ed931b8c..a39b10ffd 100644 --- a/src/lib/ffmpeg_subtitle_stream.h +++ b/src/lib/ffmpeg_subtitle_stream.h @@ -26,7 +26,7 @@ public: FFmpegSubtitleStream (std::string n, int i) : FFmpegStream (n, i) {} - + FFmpegSubtitleStream (cxml::ConstNodePtr); void as_xml (xmlpp::Node *) const; diff --git a/src/lib/file_group.cc b/src/lib/file_group.cc index 9c8d43204..6f6a5a916 100644 --- a/src/lib/file_group.cc +++ b/src/lib/file_group.cc @@ -82,7 +82,7 @@ FileGroup::ensure_open_path (size_t p) const /* Already open */ return; } - + if (_current_file) { fclose (_current_file); } @@ -111,9 +111,9 @@ FileGroup::seek (int64_t pos, int whence) const } #ifdef DCPOMATIC_WINDOWS full_pos += _ftelli64 (_current_file); -#else +#else full_pos += ftell (_current_file); -#endif +#endif full_pos += pos; break; case SEEK_END: diff --git a/src/lib/film.cc b/src/lib/film.cc index 5ec5fbc2f..66f1de868 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -137,11 +137,11 @@ Film::Film (boost::filesystem::path dir, bool log) _playlist_changed_connection = _playlist->Changed.connect (bind (&Film::playlist_changed, this)); _playlist_content_changed_connection = _playlist->ContentChanged.connect (bind (&Film::playlist_content_changed, this, _1, _2, _3)); - + /* Make state.directory a complete path without ..s (where possible) (Code swiped from Adam Bowen on stackoverflow) */ - + boost::filesystem::path p (boost::filesystem::system_complete (dir)); boost::filesystem::path result; for (boost::filesystem::path::iterator i = p.begin(); i != p.end(); ++i) { @@ -171,7 +171,7 @@ Film::~Film () for (list::const_iterator i = _job_connections.begin(); i != _job_connections.end(); ++i) { i->disconnect (); } -} +} string Film::video_identifier () const @@ -180,7 +180,7 @@ Film::video_identifier () const SafeStringStream s; s.imbue (std::locale::classic ()); - + s << container()->id() << "_" << resolution_to_string (_resolution) << "_" << _playlist->video_identifier() @@ -209,7 +209,7 @@ Film::video_identifier () const return s.str (); } - + /** @return The file to write video frame info to */ boost::filesystem::path Film::info_file () const @@ -259,7 +259,7 @@ Film::audio_analysis_path () const if (!ac) { continue; } - + digester.add (ac->digest ()); digester.add (ac->audio_mapping().digest ()); digester.add (ac->audio_gain ()); @@ -278,7 +278,7 @@ void Film::make_dcp () { set_isdcf_date_today (); - + if (dcp_name().find ("/") != string::npos) { throw BadSettingError (_("name"), _("cannot contain slashes")); } @@ -292,7 +292,7 @@ Film::make_dcp () LOG_GENERAL ("DCP video rate %1 fps", video_frame_rate()); LOG_GENERAL ("%1 threads", Config::instance()->num_local_encoding_threads()); LOG_GENERAL ("J2K bandwidth %1", j2k_bandwidth()); - + if (container() == 0) { throw MissingSettingError (_("container")); } @@ -386,7 +386,7 @@ Film::read_metadata () if (_state_version > current_state_version) { throw StringError (_("This film was created with a newer version of DCP-o-matic, and it cannot be loaded into this version. Sorry!")); } - + _name = f.string_child ("Name"); if (_state_version >= 9) { _use_isdcf_name = f.bool_child ("UseISDCFName"); @@ -460,9 +460,9 @@ Film::dir (boost::filesystem::path d) const boost::filesystem::path p; p /= _directory; p /= d; - + boost::filesystem::create_directories (p); - + return p; } @@ -477,7 +477,7 @@ Film::file (boost::filesystem::path f) const p /= f; boost::filesystem::create_directories (p.parent_path ()); - + return p; } @@ -494,7 +494,7 @@ Film::isdcf_name (bool if_created_now) const split (words, raw_name, is_any_of (" ")); string fixed_name; - + /* Add each word to fixed_name */ for (vector::const_iterator i = words.begin(); i != words.end(); ++i) { string w = *i; @@ -509,7 +509,7 @@ Film::isdcf_name (bool if_created_now) const ++caps; } } - + /* If w is all caps make the rest of it lower case, otherwise leave it alone. */ @@ -540,15 +540,15 @@ Film::isdcf_name (bool if_created_now) const if (dm.temp_version) { d << "-Temp"; } - + if (dm.pre_release) { d << "-Pre"; } - + if (dm.red_band) { d << "-RedBand"; } - + if (!dm.chain.empty ()) { d << "-" << dm.chain; } @@ -568,13 +568,13 @@ Film::isdcf_name (bool if_created_now) const if (video_frame_rate() != 24) { d << "-" << video_frame_rate(); } - + if (container()) { d << "_" << container()->isdcf_name(); } ContentList cl = content (); - + /* XXX: this uses the first bit of content only */ /* The standard says we don't do this for trailers, for some strange reason */ @@ -592,7 +592,7 @@ Film::isdcf_name (bool if_created_now) const break; } } - + if (content_ratio && content_ratio != container()) { d << "-" << content_ratio->isdcf_name(); } @@ -637,18 +637,18 @@ Film::isdcf_name (bool if_created_now) const copy (c.begin(), c.end(), back_inserter (mapped)); } } - + mapped.sort (); mapped.unique (); - + /* Count them */ - + for (list::const_iterator i = mapped.begin(); i != mapped.end(); ++i) { if (*i >= audio_channels()) { /* This channel is mapped but is not included in the DCP */ continue; } - + if (static_cast (*i) == dcp::LFE) { ++lfe; } else { @@ -656,7 +656,7 @@ Film::isdcf_name (bool if_created_now) const } } } - + if (non_lfe) { d << "_" << non_lfe << lfe; } @@ -664,7 +664,7 @@ Film::isdcf_name (bool if_created_now) const /* XXX: HI/VI */ d << "_" << resolution_to_string (_resolution); - + if (!dm.studio.empty ()) { d << "_" << dm.studio; } @@ -684,7 +684,7 @@ Film::isdcf_name (bool if_created_now) const } else { d << "_SMPTE"; } - + if (three_d ()) { d << "-3D"; } @@ -718,7 +718,7 @@ Film::dcp_name (bool if_created_now) const filtered += unfiltered[i]; } } - + return filtered; } @@ -863,7 +863,7 @@ Film::j2c_path (int f, Eyes e, bool t) const } else if (e == EYES_RIGHT) { s << ".R"; } - + s << ".j2c"; if (t) { @@ -879,7 +879,7 @@ vector Film::cpls () const { vector out; - + boost::filesystem::path const dir = directory (); for (boost::filesystem::directory_iterator i = boost::filesystem::directory_iterator(dir); i != boost::filesystem::directory_iterator(); ++i) { if ( @@ -903,7 +903,7 @@ Film::cpls () const } } } - + return out; } @@ -947,13 +947,13 @@ Film::examine_and_add_content (shared_ptr c) if (dynamic_pointer_cast (c)) { run_ffprobe (c->path(0), file ("ffprobe.log"), _log); } - + shared_ptr j (new ExamineContentJob (shared_from_this(), c)); _job_connections.push_back ( j->Finished.connect (bind (&Film::maybe_add_content, this, boost::weak_ptr (j), boost::weak_ptr (c))) ); - + JobManager::instance()->add (j); } @@ -964,7 +964,7 @@ Film::maybe_add_content (weak_ptr j, weak_ptr c) if (!job || !job->finished_ok ()) { return; } - + shared_ptr content = c.lock (); if (content) { add_content (content); @@ -1035,7 +1035,7 @@ Film::playlist_changed () { signal_changed (CONTENT); signal_changed (NAME); -} +} int Film::audio_frame_rate () const @@ -1088,7 +1088,7 @@ Film::make_kdm ( if (!signer->valid ()) { throw InvalidSignerError (); } - + return dcp::DecryptedKDM ( cpl, key(), from, until, "DCP-o-matic", cpl->content_title_text(), dcp::LocalTime().as_string() ).encrypt (signer, target, formulation); @@ -1162,7 +1162,7 @@ string Film::subtitle_language () const { set languages; - + ContentList cl = content (); BOOST_FOREACH (shared_ptr& c, cl) { shared_ptr sc = dynamic_pointer_cast (c); @@ -1215,7 +1215,7 @@ Film::audio_output_names () const if (audio_processor ()) { return audio_processor()->input_names (); } - + vector n; n.push_back (_("L")); n.push_back (_("R")); diff --git a/src/lib/film.h b/src/lib/film.h index f268bc5b7..5e4c01c86 100644 --- a/src/lib/film.h +++ b/src/lib/film.h @@ -105,7 +105,7 @@ public: uint64_t required_disk_space () const; bool should_be_enough_disk_space (double& required, double& available, bool& can_hard_link) const; - + /* Proxies for some Playlist methods */ ContentList content () const; @@ -121,7 +121,7 @@ public: dcp::LocalTime until, dcp::Formulation formulation ) const; - + std::list make_kdms ( std::list >, boost::filesystem::path cpl_file, @@ -140,7 +140,7 @@ public: std::vector audio_output_names () const; void repeat_content (ContentList, int); - + /** Identifiers for the parts of our state; used for signalling changes. */ @@ -200,7 +200,7 @@ public: bool is_signed () const { return _signed; } - + bool encrypted () const { return _encrypted; } @@ -245,7 +245,7 @@ public: AudioProcessor const * audio_processor () const { return _audio_processor; } - + /* SET */ @@ -304,7 +304,7 @@ private: * must not be relative. */ boost::filesystem::path _directory; - + /** Name for DCP-o-matic */ std::string _name; /** True if a auto-generated ISDCF-compliant name should be used for our DCP */ diff --git a/src/lib/filter.cc b/src/lib/filter.cc index a7dd9c5ce..c9876c05b 100644 --- a/src/lib/filter.cc +++ b/src/lib/filter.cc @@ -61,7 +61,7 @@ void Filter::setup_filters () { /* Note: "none" is a magic id name, so don't use it here */ - + maybe_add (N_("mcdeint"), _("Motion compensating deinterlacer"), _("De-interlacing"), N_("mcdeint")); maybe_add (N_("kerndeint"), _("Kernel deinterlacer"), _("De-interlacing"), N_("kerndeint")); maybe_add (N_("yadif"), _("Yet Another Deinterlacing Filter"), _("De-interlacing"), N_("yadif")); diff --git a/src/lib/filter.h b/src/lib/filter.h index 66ecc4308..39687fcd4 100644 --- a/src/lib/filter.h +++ b/src/lib/filter.h @@ -54,11 +54,11 @@ public: std::string vf () const { return _vf; } - + std::string category () const { return _category; } - + static std::vector all (); static Filter const * from_id (std::string); static void setup_filters (); diff --git a/src/lib/filter_graph.cc b/src/lib/filter_graph.cc index 9f80118bd..da7b04133 100644 --- a/src/lib/filter_graph.cc +++ b/src/lib/filter_graph.cc @@ -67,7 +67,7 @@ FilterGraph::FilterGraph (shared_ptr content, dcp::Size s, } _frame = av_frame_alloc (); - + AVFilterGraph* graph = avfilter_graph_alloc(); if (graph == 0) { throw DecodeError (N_("could not create filter graph.")); @@ -98,7 +98,7 @@ FilterGraph::FilterGraph (shared_ptr content, dcp::Size s, pixel_fmts[0] = _pixel_format; pixel_fmts[1] = PIX_FMT_NONE; sink_params->pixel_fmts = pixel_fmts; - + if (avfilter_graph_create_filter (&_buffer_sink_context, buffer_sink, N_("out"), 0, sink_params, graph) < 0) { throw DecodeError (N_("could not create buffer sink.")); } @@ -120,7 +120,7 @@ FilterGraph::FilterGraph (shared_ptr content, dcp::Size s, if (avfilter_graph_parse (graph, filters.c_str(), inputs, outputs, 0) < 0) { throw DecodeError (N_("could not set up filter graph.")); } - + if (avfilter_graph_config (graph, 0) < 0) { throw DecodeError (N_("could not configure filter graph.")); } @@ -148,17 +148,17 @@ FilterGraph::process (AVFrame* frame) if (r < 0) { throw DecodeError (String::compose (N_("could not push buffer into filter chain (%1)."), r)); } - + while (true) { if (av_buffersink_get_frame (_buffer_sink_context, _frame) < 0) { break; } - + images.push_back (make_pair (shared_ptr (new Image (_frame)), av_frame_get_best_effort_timestamp (_frame))); av_frame_unref (_frame); } } - + return images; } diff --git a/src/lib/font.cc b/src/lib/font.cc index 0e1ad85cd..d729c2696 100644 --- a/src/lib/font.cc +++ b/src/lib/font.cc @@ -24,7 +24,7 @@ Font::Font (cxml::NodePtr node) : _id (node->string_child ("Id")) , _file (node->optional_string_child ("File")) { - + } void diff --git a/src/lib/font.h b/src/lib/font.h index 0dd63448e..ca7650cc1 100644 --- a/src/lib/font.h +++ b/src/lib/font.h @@ -51,7 +51,7 @@ public: boost::signals2::signal Changed; -private: +private: /** Font ID, used to describe it in the subtitle content */ std::string _id; boost::optional _file; diff --git a/src/lib/frame_rate_change.cc b/src/lib/frame_rate_change.cc index 31fce6b6d..d327f8e31 100644 --- a/src/lib/frame_rate_change.cc +++ b/src/lib/frame_rate_change.cc @@ -37,14 +37,14 @@ about_equal (float a, float b) = Ff + Fd - Ff frames = Fd frames = Fd/f seconds - + So if we accept a difference of 1 frame, ie 1/f seconds, we can say that 1/f = Fd/f ie 1 = Fd ie d = 1/F - + So for a 3hr film, ie F = 3 * 60 * 60 = 10800, the acceptable FPS error is 1/F ~= 0.0001 ~= 10-e4 */ @@ -81,7 +81,7 @@ string FrameRateChange::description () const { string description; - + if (!skip && repeat == 1 && !change_speed) { description = _("Content and DCP have the same rate.\n"); } else { diff --git a/src/lib/image.cc b/src/lib/image.cc index d5d3167cd..c403b61ab 100644 --- a/src/lib/image.cc +++ b/src/lib/image.cc @@ -56,7 +56,7 @@ Image::line_factor (int n) const if (!d) { throw PixelFormatError ("lines()", _pixel_format); } - + return pow (2.0f, d->log2_chroma_h); } @@ -81,7 +81,7 @@ Image::components () const if ((d->flags & PIX_FMT_PLANAR) == 0) { return 1; } - + return d->nb_components; } @@ -129,7 +129,7 @@ Image::crop_scale_window ( sws_getCoefficients (lut[yuv_to_rgb]), 0, 0, 1 << 16, 1 << 16 ); - + /* Prepare input data pointers with crop */ uint8_t* scale_in_data[components()]; for (int c = 0; c < components(); ++c) { @@ -153,7 +153,7 @@ Image::crop_scale_window ( sws_freeContext (scale_context); - return out; + return out; } shared_ptr @@ -184,7 +184,7 @@ Image::scale (dcp::Size out_size, dcp::YUVToRGB yuv_to_rgb, AVPixelFormat out_fo sws_getCoefficients (lut[yuv_to_rgb]), 0, 0, 1 << 16, 1 << 16 ); - + sws_scale ( scale_context, data(), stride(), @@ -263,7 +263,7 @@ Image::make_black () static uint16_t const ten_bit_uv = (1 << 9) - 1; /* U/V black value for 16-bit colour */ static uint16_t const sixteen_bit_uv = (1 << 15) - 1; - + switch (_pixel_format) { case PIX_FMT_YUV420P: case PIX_FMT_YUV422P: @@ -291,7 +291,7 @@ Image::make_black () case PIX_FMT_YUV444P9BE: yuv_16_black (swap_16 (nine_bit_uv), false); break; - + case PIX_FMT_YUV422P10LE: case PIX_FMT_YUV444P10LE: yuv_16_black (ten_bit_uv, false); @@ -301,7 +301,7 @@ Image::make_black () case PIX_FMT_YUV444P16LE: yuv_16_black (sixteen_bit_uv, false); break; - + case PIX_FMT_YUV444P10BE: case PIX_FMT_YUV422P10BE: yuv_16_black (swap_16 (ten_bit_uv), false); @@ -312,31 +312,31 @@ Image::make_black () case AV_PIX_FMT_YUVA444P9BE: yuv_16_black (swap_16 (nine_bit_uv), true); break; - + case AV_PIX_FMT_YUVA420P9LE: case AV_PIX_FMT_YUVA422P9LE: case AV_PIX_FMT_YUVA444P9LE: yuv_16_black (nine_bit_uv, true); break; - + case AV_PIX_FMT_YUVA420P10BE: case AV_PIX_FMT_YUVA422P10BE: case AV_PIX_FMT_YUVA444P10BE: yuv_16_black (swap_16 (ten_bit_uv), true); break; - + case AV_PIX_FMT_YUVA420P10LE: case AV_PIX_FMT_YUVA422P10LE: case AV_PIX_FMT_YUVA444P10LE: yuv_16_black (ten_bit_uv, true); break; - + case AV_PIX_FMT_YUVA420P16BE: case AV_PIX_FMT_YUVA422P16BE: case AV_PIX_FMT_YUVA444P16BE: yuv_16_black (swap_16 (sixteen_bit_uv), true); break; - + case AV_PIX_FMT_YUVA420P16LE: case AV_PIX_FMT_YUVA422P16LE: case AV_PIX_FMT_YUVA444P16LE: @@ -419,7 +419,7 @@ Image::alpha_blend (shared_ptr other, Position position) tp[0] = op[0] * alpha + tp[0] * (1 - alpha); tp[1] = op[1] * alpha + tp[1] * (1 - alpha); tp[2] = op[2] * alpha + tp[2] * (1 - alpha); - + tp += this_bpp; op += other_bpp; } @@ -439,7 +439,7 @@ Image::alpha_blend (shared_ptr other, Position position) tp[1] = op[1] * alpha + tp[1] * (1 - alpha); tp[2] = op[2] * alpha + tp[2] * (1 - alpha); tp[3] = op[3] * alpha + tp[3] * (1 - alpha); - + tp += this_bpp; op += other_bpp; } @@ -458,7 +458,7 @@ Image::alpha_blend (shared_ptr other, Position position) tp[1] = op[0] * alpha + tp[1] * (1 - alpha); tp[3] = op[1] * alpha + tp[3] * (1 - alpha); tp[5] = op[2] * alpha + tp[5] * (1 - alpha); - + tp += this_bpp; op += other_bpp; } @@ -469,7 +469,7 @@ Image::alpha_blend (shared_ptr other, Position position) DCPOMATIC_ASSERT (false); } } - + void Image::copy (shared_ptr other, Position position) { @@ -483,7 +483,7 @@ Image::copy (shared_ptr other, Position position) uint8_t * const op = other->data()[0] + oy * other->stride()[0]; memcpy (tp, op, N * 3); } -} +} void Image::read_from_socket (shared_ptr socket) @@ -534,7 +534,7 @@ Image::bytes_per_pixel (int c) const if (d->nb_components > 3) { 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) { /* Not planar; sum them up */ return bpp[0] + bpp[1] + bpp[2] + bpp[3]; @@ -562,10 +562,10 @@ Image::allocate () { _data = (uint8_t **) wrapped_av_malloc (4 * sizeof (uint8_t *)); _data[0] = _data[1] = _data[2] = _data[3] = 0; - + _line_size = (int *) wrapped_av_malloc (4 * sizeof (int)); _line_size[0] = _line_size[1] = _line_size[2] = _line_size[3] = 0; - + _stride = (int *) wrapped_av_malloc (4 * sizeof (int)); _stride[0] = _stride[1] = _stride[2] = _stride[3] = 0; diff --git a/src/lib/image.h b/src/lib/image.h index 8cf4a72f7..89cd98f7b 100644 --- a/src/lib/image.h +++ b/src/lib/image.h @@ -47,7 +47,7 @@ public: Image (boost::shared_ptr, bool); Image& operator= (Image const &); ~Image (); - + uint8_t * const * data () const; int * line_size () const; int const * stride () const; @@ -61,7 +61,7 @@ public: boost::shared_ptr scale (dcp::Size, dcp::YUVToRGB yuv_to_rgb, AVPixelFormat, bool aligned) const; boost::shared_ptr crop (Crop c, bool aligned) const; boost::shared_ptr crop_scale_window (Crop c, dcp::Size, dcp::Size, dcp::YUVToRGB yuv_to_rgb, AVPixelFormat, bool aligned) const; - + void make_black (); void make_transparent (); void alpha_blend (boost::shared_ptr image, Position pos); @@ -70,14 +70,14 @@ public: void read_from_socket (boost::shared_ptr); void write_to_socket (boost::shared_ptr) const; - + AVPixelFormat pixel_format () const { return _pixel_format; } private: friend struct pixel_formats_test; - + void allocate (); void swap (Image &); float bytes_per_pixel (int) const; diff --git a/src/lib/image_content.cc b/src/lib/image_content.cc index 3f62c3ebf..920d7ae54 100644 --- a/src/lib/image_content.cc +++ b/src/lib/image_content.cc @@ -58,7 +58,7 @@ ImageContent::ImageContent (shared_ptr film, boost::filesystem::path if (_paths.empty()) { throw FileError (_("No valid image files were found in the folder."), p); } - + sort (_paths.begin(), _paths.end(), ImageFilenameSorter ()); } @@ -73,7 +73,7 @@ ImageContent::ImageContent (shared_ptr film, cxml::ConstNodePtr node : Content (film, node) , VideoContent (film, node, version) { - + } string @@ -120,7 +120,7 @@ ImageContent::examine (shared_ptr job) shared_ptr film = _film.lock (); DCPOMATIC_ASSERT (film); - + shared_ptr examiner (new ImageExaminer (film, shared_from_this(), job)); take_from_video_examiner (examiner); } @@ -168,10 +168,10 @@ ImageContent::set_video_frame_rate (float r) if (_video_frame_rate == r) { return; } - + _video_frame_rate = r; } - + signal_changed (VideoContentProperty::VIDEO_FRAME_RATE); } diff --git a/src/lib/image_content.h b/src/lib/image_content.h index 11c932153..4a8d91bdb 100644 --- a/src/lib/image_content.h +++ b/src/lib/image_content.h @@ -47,7 +47,7 @@ public: /* VideoContent */ void set_default_colour_conversion (); - + void set_video_length (Frame); bool still () const; void set_video_frame_rate (float); diff --git a/src/lib/image_decoder.cc b/src/lib/image_decoder.cc index 3d3e1a55b..3d543eaf2 100644 --- a/src/lib/image_decoder.cc +++ b/src/lib/image_decoder.cc @@ -61,7 +61,7 @@ ImageDecoder::pass () _image.reset (new MagickImageProxy (path)); } } - + video (_image, _video_position); ++_video_position; return false; diff --git a/src/lib/image_decoder.h b/src/lib/image_decoder.h index 775496bfd..ed5ce65a7 100644 --- a/src/lib/image_decoder.h +++ b/src/lib/image_decoder.h @@ -37,7 +37,7 @@ public: private: bool pass (); void seek (ContentTime, bool); - + boost::shared_ptr _image_content; boost::shared_ptr _image; Frame _video_position; diff --git a/src/lib/image_examiner.cc b/src/lib/image_examiner.cc index cea5dfea7..79c9f727c 100644 --- a/src/lib/image_examiner.cc +++ b/src/lib/image_examiner.cc @@ -41,7 +41,7 @@ ImageExaminer::ImageExaminer (shared_ptr film, shared_ptrpath(0).string (); diff --git a/src/lib/image_filename_sorter.cc b/src/lib/image_filename_sorter.cc index 0cb6adc6b..5a3e1dcec 100644 --- a/src/lib/image_filename_sorter.cc +++ b/src/lib/image_filename_sorter.cc @@ -40,7 +40,7 @@ private: boost::optional extract_number (boost::filesystem::path p) { p = p.leaf (); - + std::string number; for (size_t i = 0; i < p.string().size(); ++i) { if (isdigit (p.string()[i])) { diff --git a/src/lib/image_subtitle.h b/src/lib/image_subtitle.h index b25943ae1..217f70fb2 100644 --- a/src/lib/image_subtitle.h +++ b/src/lib/image_subtitle.h @@ -31,7 +31,7 @@ public: : image (i) , rectangle (r) {} - + boost::shared_ptr image; /** Area that the subtitle covers on its corresponding video, expressed in * proportions of the image size; e.g. rectangle.x = 0.5 would mean that diff --git a/src/lib/internet.cc b/src/lib/internet.cc index b4395fd21..7bc818717 100644 --- a/src/lib/internet.cc +++ b/src/lib/internet.cc @@ -53,7 +53,7 @@ get_from_zip_url (string url, string file, function (_("Could not open downloaded ZIP file")); } - + struct zip_file* zip_file = zip_fopen (zip, file.c_str(), 0); if (!zip_file) { return optional (_("Unexpected ZIP file contents")); } - + ScopedTemporary temp_cert; f = temp_cert.open ("wb"); char buffer[4096]; @@ -93,7 +93,7 @@ get_from_zip_url (string url, string file, function (); } diff --git a/src/lib/isdcf_metadata.cc b/src/lib/isdcf_metadata.cc index a9d7d939e..4a0e57d27 100644 --- a/src/lib/isdcf_metadata.cc +++ b/src/lib/isdcf_metadata.cc @@ -44,7 +44,7 @@ ISDCFMetadata::ISDCFMetadata (cxml::ConstNodePtr node) , two_d_version_of_three_d (node->optional_bool_child ("TwoDVersionOfThreeD").get_value_or (false)) , mastered_luminance (node->optional_string_child ("MasteredLuminance").get_value_or ("")) { - + } void diff --git a/src/lib/isdcf_metadata.h b/src/lib/isdcf_metadata.h index 6b326ddc8..0e904238d 100644 --- a/src/lib/isdcf_metadata.h +++ b/src/lib/isdcf_metadata.h @@ -34,7 +34,7 @@ public: , red_band (false) , two_d_version_of_three_d (false) {} - + ISDCFMetadata (cxml::ConstNodePtr); void as_xml (xmlpp::Node *) const; diff --git a/src/lib/j2k_image_proxy.cc b/src/lib/j2k_image_proxy.cc index ce0b88265..991488773 100644 --- a/src/lib/j2k_image_proxy.cc +++ b/src/lib/j2k_image_proxy.cc @@ -112,7 +112,7 @@ J2KImageProxy::image (optional note) const } else { dcp::xyz_to_rgb (oj, dcp::ColourConversion::srgb_to_xyz(), image->data()[0], image->stride()[0], note); } - + return image; } diff --git a/src/lib/j2k_image_proxy.h b/src/lib/j2k_image_proxy.h index fa2df8cd8..191d759db 100644 --- a/src/lib/j2k_image_proxy.h +++ b/src/lib/j2k_image_proxy.h @@ -40,11 +40,11 @@ public: Data j2k () const { return _data; } - + dcp::Size size () const { return _size; } - + private: Data _data; dcp::Size _size; diff --git a/src/lib/job.cc b/src/lib/job.cc index 25ff0aa4c..71e4c3446 100644 --- a/src/lib/job.cc +++ b/src/lib/job.cc @@ -86,7 +86,7 @@ Job::run_wrapper () set_error (e.what(), m); set_progress (1); set_state (FINISHED_ERROR); - + } catch (OpenFileError& e) { set_error ( @@ -106,7 +106,7 @@ Job::run_wrapper () set_error (_("Out of memory"), _("There was not enough memory to do this.")); set_progress (1); set_state (FINISHED_ERROR); - + } catch (std::exception& e) { set_error ( @@ -116,7 +116,7 @@ Job::run_wrapper () set_progress (1); set_state (FINISHED_ERROR); - + } catch (...) { set_error ( @@ -182,7 +182,7 @@ Job::paused () const boost::mutex::scoped_lock lm (_state_mutex); return _state == PAUSED; } - + /** Set the state of this job. * @param s New state. */ @@ -204,7 +204,7 @@ Job::set_state (State s) if (finished) { emit (boost::bind (boost::ref (Finished))); - } + } } /** @return DCPTime (in seconds) that this sub-job has been running */ @@ -214,7 +214,7 @@ Job::elapsed_time () const if (_start_time == 0) { return 0; } - + return time (0) - _start_time; } @@ -259,7 +259,7 @@ Job::sub (string n) boost::mutex::scoped_lock lm (_progress_mutex); _sub_name = n; } - + set_progress (0, true); } @@ -286,7 +286,7 @@ Job::set_error (string s, string d) { LOG_ERROR_NC (s); LOG_ERROR_NC (d); - + _film->log()->log (String::compose ("Error in job: %1 (%2)", s, d), Log::TYPE_ERROR); boost::mutex::scoped_lock lm (_state_mutex); _error_summary = s; @@ -319,9 +319,9 @@ Job::status () const /* 100% makes it sound like we've finished when we haven't */ pc = 99; } - + s << pc << N_("%"); - + if (t > 10 && r > 0) { /// TRANSLATORS: remaining here follows an amount of time that is remaining /// on an operation. @@ -368,7 +368,7 @@ Job::remaining_time () const if (progress().get_value_or(0) == 0) { return elapsed_time (); } - + return elapsed_time() / progress().get() - elapsed_time(); } diff --git a/src/lib/job.h b/src/lib/job.h index 8fe87747c..06a341f40 100644 --- a/src/lib/job.h +++ b/src/lib/job.h @@ -47,7 +47,7 @@ public: virtual std::string json_name () const = 0; /** Run this job in the current thread. */ virtual void run () = 0; - + void start (); void pause (); void resume (); @@ -97,7 +97,7 @@ protected: FINISHED_ERROR, ///< the job has finished in error FINISHED_CANCELLED ///< the job was cancelled }; - + void set_state (State); void set_error (std::string s, std::string d); diff --git a/src/lib/job_manager.cc b/src/lib/job_manager.cc index b5b64a77e..f31a00a18 100644 --- a/src/lib/job_manager.cc +++ b/src/lib/job_manager.cc @@ -40,7 +40,7 @@ JobManager::JobManager () , _last_active_jobs (false) , _scheduler (new boost::thread (boost::bind (&JobManager::scheduler, this))) { - + } JobManager::~JobManager () @@ -64,7 +64,7 @@ JobManager::add (shared_ptr j) } emit (boost::bind (boost::ref (JobAdded), weak_ptr (j))); - + return j; } @@ -98,7 +98,7 @@ JobManager::errors () const } return false; -} +} void JobManager::scheduler () @@ -112,21 +112,21 @@ JobManager::scheduler () if (_terminate) { return; } - + for (list >::iterator i = _jobs.begin(); i != _jobs.end(); ++i) { if (!(*i)->finished ()) { active_jobs = true; } - + if ((*i)->running ()) { /* Something is already happening */ break; } - + if ((*i)->is_new()) { (*i)->start (); - + /* Only start one job at once */ break; } diff --git a/src/lib/job_manager.h b/src/lib/job_manager.h index b946c1a98..d0e83e26f 100644 --- a/src/lib/job_manager.h +++ b/src/lib/job_manager.h @@ -51,11 +51,11 @@ public: private: /* This function is part of the test suite */ friend void ::wait_for_jobs (); - + JobManager (); ~JobManager (); void scheduler (); - + mutable boost::mutex _mutex; std::list > _jobs; bool _terminate; diff --git a/src/lib/json_server.cc b/src/lib/json_server.cc index 1035c248f..e06ee22c3 100644 --- a/src/lib/json_server.cc +++ b/src/lib/json_server.cc @@ -139,22 +139,22 @@ void JSONServer::request (string url, shared_ptr socket) { cout << "request: " << url << "\n"; - + map r = split_get_request (url); for (map::iterator i = r.begin(); i != r.end(); ++i) { cout << i->first << " => " << i->second << "\n"; } - + string action; if (r.find ("action") != r.end ()) { action = r["action"]; } - + stringstream json; if (action == "status") { - + list > jobs = JobManager::instance()->get (); - + json << "{ \"jobs\": ["; for (list >::iterator i = jobs.begin(); i != jobs.end(); ++i) { @@ -163,7 +163,7 @@ JSONServer::request (string url, shared_ptr socket) if ((*i)->film()) { json << "\"dcp\": \"" << (*i)->film()->dcp_name() << "\", "; } - + json << "\"name\": \"" << (*i)->json_name() << "\", "; if ((*i)->progress ()) { json << "\"progress\": " << (*i)->progress().get() << ", "; @@ -172,7 +172,7 @@ JSONServer::request (string url, shared_ptr socket) } json << "\"status\": \"" << (*i)->json_status() << "\""; json << " }"; - + list >::iterator j = i; ++j; if (j != jobs.end ()) { @@ -180,12 +180,12 @@ JSONServer::request (string url, shared_ptr socket) } } json << "] }"; - + if (json.str().empty ()) { json << "{ }"; } } - + stringstream reply; reply << "HTTP/1.1 200 OK\r\n" << "Content-Length: " << json.str().length() << "\r\n" diff --git a/src/lib/json_server.h b/src/lib/json_server.h index 623067558..06c49d885 100644 --- a/src/lib/json_server.h +++ b/src/lib/json_server.h @@ -28,4 +28,4 @@ private: void request (std::string url, boost::shared_ptr socket); }; - + diff --git a/src/lib/kdm.cc b/src/lib/kdm.cc index 8949736f8..8489eed33 100644 --- a/src/lib/kdm.cc +++ b/src/lib/kdm.cc @@ -42,7 +42,7 @@ struct ScreenKDM : screen (s) , kdm (k) {} - + shared_ptr screen; dcp::EncryptedKDM kdm; }; @@ -68,23 +68,23 @@ struct CinemaKDMs } throw FileError ("could not create ZIP file", zip_file); } - + list > kdm_strings; - + for (list::const_iterator i = screen_kdms.begin(); i != screen_kdms.end(); ++i) { shared_ptr kdm (new string (i->kdm.as_xml ())); kdm_strings.push_back (kdm); - + struct zip_source* source = zip_source_buffer (zip, kdm->c_str(), kdm->length(), 0); if (!source) { throw StringError ("could not create ZIP source"); } - + if (zip_add (zip, kdm_filename (film, *i).c_str(), source) == -1) { throw StringError ("failed to add KDM to ZIP archive"); } } - + if (zip_close (zip) == -1) { throw StringError ("failed to close ZIP archive"); } @@ -111,9 +111,9 @@ make_screen_kdms ( ) { list kdms = film->make_kdms (screens, cpl, from, to, formulation); - + list screen_kdms; - + list >::iterator i = screens.begin (); list::iterator j = kdms.begin (); while (i != screens.end() && j != kdms.end ()) { @@ -139,18 +139,18 @@ make_cinema_kdms ( list cinema_kdms; while (!screen_kdms.empty ()) { - + /* Get all the screens from a single cinema */ CinemaKDMs ck; - + list::iterator i = screen_kdms.begin (); ck.cinema = i->screen->cinema; ck.screen_kdms.push_back (*i); list::iterator j = i; ++i; screen_kdms.remove (*j); - + while (i != screen_kdms.end ()) { if (i->screen->cinema == ck.cinema) { ck.screen_kdms.push_back (*i); @@ -225,27 +225,27 @@ email_kdms ( list cinema_kdms = make_cinema_kdms (film, screens, cpl, from, to, formulation); for (list::const_iterator i = cinema_kdms.begin(); i != cinema_kdms.end(); ++i) { - + boost::filesystem::path zip_file = boost::filesystem::temp_directory_path (); zip_file /= boost::filesystem::unique_path().string() + ".zip"; i->make_zip_file (film, zip_file); - + /* Send email */ - + quickmail_initialize (); SafeStringStream start; start << from.date() << " " << from.time_of_day(); SafeStringStream end; end << to.date() << " " << to.time_of_day(); - + string subject = Config::instance()->kdm_subject(); boost::algorithm::replace_all (subject, "$CPL_NAME", film->dcp_name ()); boost::algorithm::replace_all (subject, "$START_TIME", start.str ()); boost::algorithm::replace_all (subject, "$END_TIME", end.str ()); boost::algorithm::replace_all (subject, "$CINEMA_NAME", i->cinema->name); quickmail mail = quickmail_create (Config::instance()->kdm_from().c_str(), subject.c_str ()); - + quickmail_add_to (mail, i->cinema->email.c_str ()); if (!Config::instance()->kdm_cc().empty ()) { quickmail_add_cc (mail, Config::instance()->kdm_cc().c_str ()); @@ -255,13 +255,13 @@ email_kdms ( } quickmail_add_header (mail, "Content-Type: text/plain; charset=UTF-8"); - + string body = Config::instance()->kdm_email().c_str(); boost::algorithm::replace_all (body, "$CPL_NAME", film->dcp_name ()); boost::algorithm::replace_all (body, "$START_TIME", start.str ()); boost::algorithm::replace_all (body, "$END_TIME", end.str ()); boost::algorithm::replace_all (body, "$CINEMA_NAME", i->cinema->name); - + SafeStringStream screens; for (list::const_iterator j = i->screen_kdms.begin(); j != i->screen_kdms.end(); ++j) { screens << j->screen->name << ", "; @@ -280,7 +280,7 @@ email_kdms ( Config::instance()->mail_user().c_str(), Config::instance()->mail_password().c_str() ); - + if (error) { quickmail_destroy (mail); throw KDMError (String::compose ("Failed to send KDM email (%1)", error)); diff --git a/src/lib/log.cc b/src/lib/log.cc index efea9f6b5..42184ec45 100644 --- a/src/lib/log.cc +++ b/src/lib/log.cc @@ -75,7 +75,7 @@ Log::log (string message, int type) if (type & TYPE_WARNING) { s << "WARNING: "; } - + s << message; do_log (s.str ()); } @@ -153,7 +153,7 @@ FileLog::head_and_tail (int amount) const head_amount = size; tail_amount = 0; } - + FILE* f = fopen_boost (_file, "r"); if (!f) { return ""; @@ -162,7 +162,7 @@ FileLog::head_and_tail (int amount) const string out; char* buffer = new char[max(head_amount, tail_amount) + 1]; - + int N = fread (buffer, 1, head_amount, f); buffer[N] = '\0'; out += string (buffer); @@ -171,7 +171,7 @@ FileLog::head_and_tail (int amount) const out += "\n .\n .\n .\n"; fseek (f, - tail_amount - 1, SEEK_END); - + N = fread (buffer, 1, tail_amount, f); buffer[N] = '\0'; out += string (buffer) + "\n"; diff --git a/src/lib/log.h b/src/lib/log.h index f83c6a902..1b7cef038 100644 --- a/src/lib/log.h +++ b/src/lib/log.h @@ -54,14 +54,14 @@ public: virtual std::string head_and_tail (int amount = 1024) const = 0; protected: - + /** mutex to protect the log */ mutable boost::mutex _mutex; - + private: virtual void do_log (std::string m) = 0; void config_changed (); - + /** bit-field of log types which should be put into the log (others are ignored) */ int _types; boost::signals2::scoped_connection _config_connection; @@ -87,7 +87,7 @@ public: return ""; } -private: +private: void do_log (std::string) {} }; diff --git a/src/lib/magick_image_proxy.cc b/src/lib/magick_image_proxy.cc index d4d7e8aa6..41aede613 100644 --- a/src/lib/magick_image_proxy.cc +++ b/src/lib/magick_image_proxy.cc @@ -36,19 +36,19 @@ using boost::dynamic_pointer_cast; MagickImageProxy::MagickImageProxy (boost::filesystem::path path) { /* Read the file into a Blob */ - + boost::uintmax_t const size = boost::filesystem::file_size (path); FILE* f = fopen_boost (path, "rb"); if (!f) { throw OpenFileError (path); } - + uint8_t* data = new uint8_t[size]; if (fread (data, 1, size, f) != size) { delete[] data; throw ReadFileError (path); } - + fclose (f); _blob.update (data, size); delete[] data; @@ -67,7 +67,7 @@ shared_ptr MagickImageProxy::image (optional) const { boost::mutex::scoped_lock lm (_mutex); - + if (_image) { return _image; } @@ -110,7 +110,7 @@ MagickImageProxy::image (optional) const using namespace MagickCore; #else using namespace MagickLib; -#endif +#endif magick_image->write (0, i, size.width, 1, "RGB", CharPixel, p); p += _image->stride()[0]; } @@ -144,6 +144,6 @@ MagickImageProxy::same (shared_ptr other) const if (_blob.length() != mp->_blob.length()) { return false; } - + return memcmp (_blob.data(), mp->_blob.data(), _blob.length()) == 0; } diff --git a/src/lib/magick_image_proxy.h b/src/lib/magick_image_proxy.h index f4ddb2c94..d22789eda 100644 --- a/src/lib/magick_image_proxy.h +++ b/src/lib/magick_image_proxy.h @@ -31,7 +31,7 @@ public: void send_binary (boost::shared_ptr) const; bool same (boost::shared_ptr other) const; -private: +private: Magick::Blob _blob; mutable boost::shared_ptr _image; mutable boost::mutex _mutex; diff --git a/src/lib/md5_digester.cc b/src/lib/md5_digester.cc index df73a6945..c1c8f6827 100644 --- a/src/lib/md5_digester.cc +++ b/src/lib/md5_digester.cc @@ -55,14 +55,14 @@ MD5Digester::get () const if (!_digest) { unsigned char digest[MD5_DIGEST_LENGTH]; MD5_Final (digest, &_context); - + SafeStringStream 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 (); } diff --git a/src/lib/md5_digester.h b/src/lib/md5_digester.h index 8ae7e81cf..650714672 100644 --- a/src/lib/md5_digester.h +++ b/src/lib/md5_digester.h @@ -36,7 +36,7 @@ public: } void add (std::string const & s); - + std::string get () const; private: diff --git a/src/lib/piece.h b/src/lib/piece.h index 976409381..9aaeec301 100644 --- a/src/lib/piece.h +++ b/src/lib/piece.h @@ -34,7 +34,7 @@ public: , decoder (d) , frc (f) {} - + boost::shared_ptr content; boost::shared_ptr decoder; FrameRateChange frc; diff --git a/src/lib/player.cc b/src/lib/player.cc index 449a4384d..be1268f48 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -94,7 +94,7 @@ Player::setup_pieces () if (!(*i)->paths_valid ()) { continue; } - + shared_ptr decoder; optional frc; @@ -106,7 +106,7 @@ Player::setup_pieces () if (!vc) { continue; } - + DCPTime const overlap = max (vc->position(), (*i)->position()) - min (vc->end(), (*i)->end()); if (overlap > best_overlap_t) { best_overlap = vc; @@ -202,7 +202,7 @@ Player::content_changed (weak_ptr w, int property, bool frequent) property == VideoContentProperty::VIDEO_FRAME_TYPE || property == DCPContentProperty::CAN_BE_PLAYED ) { - + _have_valid_pieces = false; Changed (frequent); @@ -218,7 +218,7 @@ Player::content_changed (weak_ptr w, int property, bool frequent) property == VideoContentProperty::VIDEO_FADE_IN || property == VideoContentProperty::VIDEO_FADE_OUT ) { - + Changed (frequent); } } @@ -256,7 +256,7 @@ list Player::transform_image_subtitles (list subs) const { list all; - + for (list::const_iterator i = subs.begin(); i != subs.end(); ++i) { if (!i->image) { continue; @@ -264,7 +264,7 @@ Player::transform_image_subtitles (list subs) const /* We will scale the subtitle up to fit _video_container_size */ dcp::Size scaled_size (i->rectangle.width * _video_container_size.width, i->rectangle.height * _video_container_size.height); - + /* Then we need a corrective translation, consisting of two parts: * * 1. that which is the result of the scaling of the subtitle by _video_container_size; this will be @@ -346,7 +346,7 @@ Player::get_video (DCPTime time, bool accurate) pvf.push_back (black_player_video_frame (time)); return pvf; } - + dcp::Size image_size = content->scale().size (content, _video_container_size, _film->frame_size ()); for (list::const_iterator i = content_video.begin(); i != content_video.end(); ++i) { @@ -388,8 +388,8 @@ Player::get_video (DCPTime time, bool accurate) for (list >::const_iterator i = pvf.begin(); i != pvf.end(); ++i) { (*i)->set_subtitle (merge (sub_images)); } - } - + } + return pvf; } @@ -404,7 +404,7 @@ Player::get_audio (DCPTime time, DCPTime length, bool accurate) shared_ptr audio (new AudioBuffers (_film->audio_channels(), length_frames)); audio->make_silent (); - + list > ov = overlaps (time, time + length); if (ov.empty ()) { return audio; @@ -436,7 +436,7 @@ Player::get_audio (DCPTime time, DCPTime length, bool accurate) Frame const content_frame = dcp_to_content_audio (*i, request); BOOST_FOREACH (AudioStreamPtr j, content->audio_streams ()) { - + /* Audio from this piece's decoder stream (which might be more or less than what we asked for) */ ContentAudio all = decoder->get_audio (j, content_frame, request_frames, accurate); @@ -467,7 +467,7 @@ Player::get_audio (DCPTime time, DCPTime length, bool accurate) if (_audio_processor) { dcp_mapped = _audio_processor->run (dcp_mapped); } - + all.audio = dcp_mapped; audio->accumulate_frames ( @@ -561,7 +561,7 @@ Player::get_subtitles (DCPTime time, DCPTime length, bool starting) list image = subtitle_decoder->get_image_subtitles (ContentTimePeriod (from, to), starting); for (list::iterator i = image.begin(); i != image.end(); ++i) { - + /* Apply content's subtitle offsets */ i->sub.rectangle.x += subtitle_content->subtitle_x_offset (); i->sub.rectangle.y += subtitle_content->subtitle_y_offset (); @@ -573,7 +573,7 @@ Player::get_subtitles (DCPTime time, DCPTime length, bool starting) /* Apply a corrective translation to keep the subtitle centred after that scale */ i->sub.rectangle.x -= i->sub.rectangle.width * (subtitle_content->subtitle_x_scale() - 1); i->sub.rectangle.y -= i->sub.rectangle.height * (subtitle_content->subtitle_y_scale() - 1); - + ps.image.push_back (i->sub); } diff --git a/src/lib/player.h b/src/lib/player.h index e515fced3..f22faa7ac 100644 --- a/src/lib/player.h +++ b/src/lib/player.h @@ -44,7 +44,7 @@ class Resampler; class PlayerVideo; class ImageProxy; class Font; - + class PlayerStatistics { public: @@ -55,7 +55,7 @@ public: , good (0) , skip (0) {} - + int black; int repeat; int good; @@ -68,7 +68,7 @@ public: , good (0) , skip (0) {} - + DCPTime silence; int64_t good; int64_t skip; @@ -96,7 +96,7 @@ public: void set_burn_subtitles (bool burn); PlayerStatistics const & statistics () const; - + /** Emitted when something has changed such that if we went back and emitted * the last frame again it would look different. This is not emitted after * a seek. @@ -141,10 +141,10 @@ private: overlaps.push_back (*i); } } - + return overlaps; } - + boost::shared_ptr _film; /** Our pieces are ready to go; if this is false the pieces must be (re-)created before they are used */ diff --git a/src/lib/player_subtitles.h b/src/lib/player_subtitles.h index 65de500f6..93a0d5378 100644 --- a/src/lib/player_subtitles.h +++ b/src/lib/player_subtitles.h @@ -30,7 +30,7 @@ public: : from (f) , to (t) {} - + DCPTime from; DCPTime to; diff --git a/src/lib/player_video.cc b/src/lib/player_video.cc index a84d3b45f..c2ba1362a 100644 --- a/src/lib/player_video.cc +++ b/src/lib/player_video.cc @@ -71,13 +71,13 @@ PlayerVideo::PlayerVideo (shared_ptr node, shared_ptr socket _in = image_proxy_factory (node->node_child ("In"), socket); if (node->optional_number_child ("SubtitleX")) { - + _subtitle.position = Position (node->number_child ("SubtitleX"), node->number_child ("SubtitleY")); _subtitle.image.reset ( new Image (PIX_FMT_RGBA, dcp::Size (node->number_child ("SubtitleWidth"), node->number_child ("SubtitleHeight")), true) ); - + _subtitle.image->read_from_socket (socket); } } @@ -92,7 +92,7 @@ shared_ptr PlayerVideo::image (AVPixelFormat pixel_format, bool burn_subtitle, dcp::NoteHandler note) const { shared_ptr im = _in->image (optional (note)); - + Crop total_crop = _crop; switch (_part) { case PART_LEFT_HALF: @@ -115,7 +115,7 @@ PlayerVideo::image (AVPixelFormat pixel_format, bool burn_subtitle, dcp::NoteHan if (_colour_conversion) { yuv_to_rgb = _colour_conversion.get().yuv_to_rgb(); } - + shared_ptr out = im->crop_scale_window (total_crop, _inter_size, _out_size, yuv_to_rgb, pixel_format, true); if (burn_subtitle && _subtitle.image) { @@ -168,12 +168,12 @@ bool PlayerVideo::has_j2k () const { /* XXX: burnt-in subtitle; maybe other things */ - + shared_ptr j2k = dynamic_pointer_cast (_in); if (!j2k) { return false; } - + return _crop == Crop () && _inter_size == j2k->size(); } diff --git a/src/lib/player_video.h b/src/lib/player_video.h index e6aa4c7b2..276c97948 100644 --- a/src/lib/player_video.h +++ b/src/lib/player_video.h @@ -49,11 +49,11 @@ public: Part, boost::optional ); - + PlayerVideo (boost::shared_ptr, boost::shared_ptr); void set_subtitle (PositionImage); - + boost::shared_ptr image (AVPixelFormat pix_fmt, bool burn_subtitle, dcp::NoteHandler note) const; void add_metadata (xmlpp::Node* node, bool send_subtitles) const; diff --git a/src/lib/playlist.cc b/src/lib/playlist.cc index 0bb339f50..c5e026699 100644 --- a/src/lib/playlist.cc +++ b/src/lib/playlist.cc @@ -67,11 +67,11 @@ Playlist::content_changed (weak_ptr content, int property, bool frequen - any other position changes will be timeline drags which should not result in content being sequenced. */ - + if (property == ContentProperty::LENGTH || property == VideoContentProperty::VIDEO_FRAME_TYPE) { maybe_sequence_video (); } - + ContentChanged (content, property, frequent); } @@ -81,9 +81,9 @@ Playlist::maybe_sequence_video () if (!_sequence_video || _sequencing_video) { return; } - + _sequencing_video = true; - + DCPTime next_left; DCPTime next_right; for (ContentList::iterator i = _content.begin(); i != _content.end(); ++i) { @@ -91,7 +91,7 @@ Playlist::maybe_sequence_video () if (!vc) { continue; } - + if (vc->video_frame_type() == VIDEO_FRAME_TYPE_3D_RIGHT) { vc->set_position (next_right); next_right = vc->end() + DCPTime::delta (); @@ -102,7 +102,7 @@ Playlist::maybe_sequence_video () } /* This won't change order, so it does not need a sort */ - + _sequencing_video = false; } @@ -110,7 +110,7 @@ string Playlist::video_identifier () const { string t; - + for (ContentList::const_iterator i = _content.begin(); i != _content.end(); ++i) { shared_ptr vc = dynamic_pointer_cast (*i); if (vc) { @@ -162,7 +162,7 @@ Playlist::remove (shared_ptr c) while (i != _content.end() && *i != c) { ++i; } - + if (i != _content.end ()) { _content.erase (i); Changed (); @@ -179,14 +179,14 @@ Playlist::remove (ContentList c) while (j != _content.end() && *j != *i) { ++j; } - + if (j != _content.end ()) { _content.erase (j); } } /* This won't change order, so it does not need a sort */ - + Changed (); } @@ -249,7 +249,7 @@ Playlist::best_dcp_frame_rate () const if (!best) { return 24; } - + return best->dcp; } @@ -272,7 +272,7 @@ Playlist::reconnect () } _content_connections.clear (); - + for (ContentList::iterator i = _content.begin(); i != _content.end(); ++i) { _content_connections.push_back ((*i)->Changed.connect (bind (&Playlist::content_changed, this, _1, _2, _3))); } @@ -349,7 +349,7 @@ Playlist::repeat (ContentList c, int n) } sort (_content.begin(), _content.end(), ContentSorter ()); - + reconnect (); Changed (); } @@ -358,7 +358,7 @@ void Playlist::move_earlier (shared_ptr c) { sort (_content.begin(), _content.end(), ContentSorter ()); - + ContentList::iterator previous = _content.end (); ContentList::iterator i = _content.begin(); while (i != _content.end() && *i != c) { @@ -371,7 +371,7 @@ Playlist::move_earlier (shared_ptr c) return; } - + DCPTime const p = (*previous)->position (); (*previous)->set_position (p + c->length_after_trim ()); c->set_position (p); @@ -382,7 +382,7 @@ void Playlist::move_later (shared_ptr c) { sort (_content.begin(), _content.end(), ContentSorter ()); - + ContentList::iterator i = _content.begin(); while (i != _content.end() && *i != c) { ++i; diff --git a/src/lib/playlist.h b/src/lib/playlist.h index 91051e9c4..3829d6f31 100644 --- a/src/lib/playlist.h +++ b/src/lib/playlist.h @@ -68,7 +68,7 @@ public: std::string video_identifier () const; DCPTime length () const; - + int best_dcp_frame_rate () const; DCPTime video_end () const; FrameRateChange active_frame_rate_change (DCPTime, int dcp_frame_rate) const; @@ -85,7 +85,7 @@ public: * Third parameter is true if signals are currently being emitted frequently. */ mutable boost::signals2::signal, int, bool)> ContentChanged; - + private: void content_changed (boost::weak_ptr, int, bool); void reconnect (); diff --git a/src/lib/position_image.h b/src/lib/position_image.h index c0c65d1da..e3a091b37 100644 --- a/src/lib/position_image.h +++ b/src/lib/position_image.h @@ -29,12 +29,12 @@ class PositionImage { public: PositionImage () {} - + PositionImage (boost::shared_ptr i, Position p) : image (i) , position (p) {} - + boost::shared_ptr image; Position position; diff --git a/src/lib/ratio.cc b/src/lib/ratio.cc index 6edd154e0..a6ebad141 100644 --- a/src/lib/ratio.cc +++ b/src/lib/ratio.cc @@ -49,7 +49,7 @@ Ratio::from_id (string i) if (i == "137") { i = "138"; } - + vector::iterator j = _ratios.begin (); while (j != _ratios.end() && (*j)->id() != i) { ++j; @@ -77,13 +77,13 @@ Ratio::from_ratio (float r) return *j; } - + Ratio const * Ratio::nearest_from_ratio (float r) { Ratio const * nearest = 0; float distance = FLT_MAX; - + for (vector::iterator i = _ratios.begin (); i != _ratios.end(); ++i) { float const d = fabs ((*i)->ratio() - r); if (d < distance) { diff --git a/src/lib/ratio.h b/src/lib/ratio.h index 360fb2340..7b70bd7f7 100644 --- a/src/lib/ratio.h +++ b/src/lib/ratio.h @@ -66,7 +66,7 @@ private: std::string _nickname; std::string _isdcf_name; - static std::vector _ratios; + static std::vector _ratios; }; #endif diff --git a/src/lib/raw_image_proxy.h b/src/lib/raw_image_proxy.h index 33bf48273..71c8df30b 100644 --- a/src/lib/raw_image_proxy.h +++ b/src/lib/raw_image_proxy.h @@ -27,12 +27,12 @@ class RawImageProxy : public ImageProxy public: RawImageProxy (boost::shared_ptr); RawImageProxy (boost::shared_ptr xml, boost::shared_ptr socket); - + boost::shared_ptr image (boost::optional note = boost::optional ()) const; void add_metadata (xmlpp::Node *) const; void send_binary (boost::shared_ptr) const; bool same (boost::shared_ptr) const; - + private: boost::shared_ptr _image; }; diff --git a/src/lib/rect.h b/src/lib/rect.h index 963119b50..97b90abc5 100644 --- a/src/lib/rect.h +++ b/src/lib/rect.h @@ -27,15 +27,15 @@ namespace dcpomatic { - + /** @struct Rect * @brief A rectangle. */ -template +template class Rect { public: - + Rect () : x (0) , y (0) @@ -71,7 +71,7 @@ public: { T const tx = max (x, other.x); T const ty = max (y, other.y); - + return Rect ( tx, ty, min (x + width, other.x + other.width) - tx, diff --git a/src/lib/render_subtitles.cc b/src/lib/render_subtitles.cc index 0d059eb43..53f713283 100644 --- a/src/lib/render_subtitles.cc +++ b/src/lib/render_subtitles.cc @@ -72,7 +72,7 @@ render_subtitle (dcp::SubtitleString const & subtitle, dcp::Size target) image->size().height, Cairo::ImageSurface::format_stride_for_width (Cairo::FORMAT_ARGB32, image->size().width) ); - + Cairo::RefPtr context = Cairo::Context::create (surface); Glib::RefPtr layout = Pango::Layout::create (context); @@ -89,13 +89,13 @@ render_subtitle (dcp::SubtitleString const & subtitle, dcp::Size target) } layout->set_font_description (font); layout->set_text (subtitle.text ()); - + /* Compute fade factor */ /* XXX */ float fade_factor = 1; layout->update_from_cairo_context (context); - + context->scale (xscale, yscale); if (subtitle.effect() == dcp::SHADOW) { @@ -123,7 +123,7 @@ render_subtitle (dcp::SubtitleString const & subtitle, dcp::Size target) layout->add_to_cairo_context (context); context->stroke (); } - + int layout_width; int layout_height; layout->get_size (layout_width, layout_height); diff --git a/src/lib/resampler.cc b/src/lib/resampler.cc index 8111dde5f..2538f7dca 100644 --- a/src/lib/resampler.cc +++ b/src/lib/resampler.cc @@ -20,7 +20,7 @@ extern "C" { #include "libavutil/channel_layout.h" #include "libavutil/opt.h" -} +} #include "resampler.h" #include "audio_buffers.h" #include "exceptions.h" @@ -51,7 +51,7 @@ Resampler::Resampler (int in, int out, int channels) /* Sample rates */ av_opt_set_int (_swr_context, "isr", _in_rate, 0); av_opt_set_int (_swr_context, "osr", _out_rate, 0); - + swr_init (_swr_context); } @@ -70,16 +70,16 @@ Resampler::run (shared_ptr in) int const resampled_frames = swr_convert ( _swr_context, (uint8_t **) resampled->data(), max_resampled_frames, (uint8_t const **) in->data(), in->frames() ); - + if (resampled_frames < 0) { char buf[256]; av_strerror (resampled_frames, buf, sizeof(buf)); throw EncodeError (String::compose (_("could not run sample-rate converter for %1 samples (%2) (%3)"), in->frames(), resampled_frames, buf)); } - + resampled->set_frames (resampled_frames); return resampled; -} +} shared_ptr Resampler::flush () @@ -91,11 +91,11 @@ Resampler::flush () while (true) { int const frames = swr_convert (_swr_context, (uint8_t **) pass->data(), pass_size, 0, 0); - + if (frames < 0) { throw EncodeError (_("could not run sample-rate converter")); } - + if (frames == 0) { break; } diff --git a/src/lib/resampler.h b/src/lib/resampler.h index 21ef412de..332b9b4b1 100644 --- a/src/lib/resampler.h +++ b/src/lib/resampler.h @@ -36,7 +36,7 @@ public: boost::shared_ptr run (boost::shared_ptr); boost::shared_ptr flush (); -private: +private: SwrContext* _swr_context; int _in_rate; int _out_rate; diff --git a/src/lib/safe_stringstream.h b/src/lib/safe_stringstream.h index 0ffcb6224..e6f6595ba 100644 --- a/src/lib/safe_stringstream.h +++ b/src/lib/safe_stringstream.h @@ -44,11 +44,11 @@ class SafeStringStream public: SafeStringStream () {} - + SafeStringStream (std::string s) : _stream (s) {} - + template std::ostream& operator<< (T val) { @@ -88,7 +88,7 @@ public: { _stream.fill (f); } - + void precision (int p) { _stream.precision (p); diff --git a/src/lib/scoped_temporary.cc b/src/lib/scoped_temporary.cc index c64f63243..b712fe494 100644 --- a/src/lib/scoped_temporary.cc +++ b/src/lib/scoped_temporary.cc @@ -31,7 +31,7 @@ ScopedTemporary::ScopedTemporary () /** Close and delete the temporary file */ ScopedTemporary::~ScopedTemporary () { - close (); + close (); boost::system::error_code ec; boost::filesystem::remove (_file, ec); } diff --git a/src/lib/scp_dcp_job.cc b/src/lib/scp_dcp_job.cc index d71ec6fd2..86eec16b2 100644 --- a/src/lib/scp_dcp_job.cc +++ b/src/lib/scp_dcp_job.cc @@ -74,7 +74,7 @@ public: ssh_session session; -private: +private: bool _connected; }; @@ -121,60 +121,60 @@ void SCPDCPJob::run () { LOG_GENERAL_NC (N_("SCP DCP job starting")); - + SSHSession ss; - + set_status (_("connecting")); - + ssh_options_set (ss.session, SSH_OPTIONS_HOST, Config::instance()->tms_ip().c_str ()); ssh_options_set (ss.session, SSH_OPTIONS_USER, Config::instance()->tms_user().c_str ()); int const port = 22; ssh_options_set (ss.session, SSH_OPTIONS_PORT, &port); - + int r = ss.connect (); if (r != SSH_OK) { throw NetworkError (String::compose (_("Could not connect to server %1 (%2)"), Config::instance()->tms_ip(), ssh_get_error (ss.session))); } - + int const state = ssh_is_server_known (ss.session); if (state == SSH_SERVER_ERROR) { throw NetworkError (String::compose (_("SSH error (%1)"), ssh_get_error (ss.session))); } - + r = ssh_userauth_password (ss.session, 0, Config::instance()->tms_password().c_str ()); if (r != SSH_AUTH_SUCCESS) { throw NetworkError (String::compose (_("Failed to authenticate with server (%1)"), ssh_get_error (ss.session))); } - + SSHSCP sc (ss.session); - + r = ssh_scp_init (sc.scp); if (r != SSH_OK) { throw NetworkError (String::compose (_("Could not start SCP session (%1)"), ssh_get_error (ss.session))); } - + r = ssh_scp_push_directory (sc.scp, _film->dcp_name().c_str(), S_IRWXU); if (r != SSH_OK) { throw NetworkError (String::compose (_("Could not create remote directory %1 (%2)"), _film->dcp_name(), ssh_get_error (ss.session))); } - + boost::filesystem::path const dcp_dir = _film->dir (_film->dcp_name()); - + boost::uintmax_t bytes_to_transfer = 0; for (boost::filesystem::directory_iterator i = boost::filesystem::directory_iterator (dcp_dir); i != boost::filesystem::directory_iterator(); ++i) { bytes_to_transfer += boost::filesystem::file_size (*i); } - + boost::uintmax_t buffer_size = 64 * 1024; char buffer[buffer_size]; boost::uintmax_t bytes_transferred = 0; - + for (boost::filesystem::directory_iterator i = boost::filesystem::directory_iterator (dcp_dir); i != boost::filesystem::directory_iterator(); ++i) { - + string const leaf = boost::filesystem::path(*i).leaf().generic_string (); - + set_status (String::compose (_("copying %1"), leaf)); - + boost::uintmax_t to_do = boost::filesystem::file_size (*i); ssh_scp_push_file (sc.scp, leaf.c_str(), to_do, S_IRUSR | S_IWUSR); @@ -190,7 +190,7 @@ SCPDCPJob::run () fclose (f); throw ReadFileError (boost::filesystem::path (*i).string()); } - + r = ssh_scp_write (sc.scp, buffer, t); if (r != SSH_OK) { fclose (f); @@ -206,7 +206,7 @@ SCPDCPJob::run () fclose (f); } - + set_progress (1); set_status (N_("")); set_state (FINISHED_OK); diff --git a/src/lib/send_kdm_email_job.cc b/src/lib/send_kdm_email_job.cc index 4be54c5cd..cddf424f4 100644 --- a/src/lib/send_kdm_email_job.cc +++ b/src/lib/send_kdm_email_job.cc @@ -62,12 +62,12 @@ void SendKDMEmailJob::run () { try { - + set_progress_unknown (); email_kdms (_film, _screens, _dcp, _from, _to, _formulation); set_progress (1); set_state (FINISHED_OK); - + } catch (std::exception& e) { set_progress (1); diff --git a/src/lib/send_problem_report_job.cc b/src/lib/send_problem_report_job.cc index 0fd14bc24..f08adea78 100644 --- a/src/lib/send_problem_report_job.cc +++ b/src/lib/send_problem_report_job.cc @@ -62,11 +62,11 @@ SendProblemReportJob::run () set_progress_unknown (); quickmail mail = quickmail_create (_from.c_str(), "DCP-o-matic problem report"); - + quickmail_add_to (mail, "carl@dcpomatic.com"); - + string body = _summary + "\n\n"; - + body += "log head and tail:\n"; body += "---<8----\n"; body += _film->log()->head_and_tail (); @@ -76,16 +76,16 @@ SendProblemReportJob::run () add_file (body, "metadata.xml"); quickmail_set_body (mail, body.c_str()); - + char const* error = quickmail_send (mail, "main.carlh.net", 2525, 0, 0); - + if (error) { set_state (FINISHED_ERROR); set_error (error, ""); } else { set_state (FINISHED_OK); } - + quickmail_destroy (mail); set_progress (1); @@ -98,7 +98,7 @@ SendProblemReportJob::add_file (string& body, boost::filesystem::path file) cons if (!f) { return; } - + body += file.string() + ":\n"; body += "---<8----\n"; uintmax_t const size = boost::filesystem::file_size (_film->file (file)); diff --git a/src/lib/server.cc b/src/lib/server.cc index 2a5ff5c9a..79840c25b 100644 --- a/src/lib/server.cc +++ b/src/lib/server.cc @@ -118,11 +118,11 @@ Server::process (shared_ptr socket, struct timeval& after_read, struct t DCPVideo dcp_video_frame (pvf, xml, _log); gettimeofday (&after_read, 0); - + Data encoded = dcp_video_frame.encode_locally (boost::bind (&Log::dcp_log, _log.get(), _1, _2)); gettimeofday (&after_encode, 0); - + try { socket->write (encoded.size ()); socket->write (encoded.data ().get (), encoded.size ()); @@ -150,7 +150,7 @@ Server::worker_thread () shared_ptr socket = _queue.front (); _queue.pop_front (); - + lock.unlock (); int frame = -1; @@ -160,9 +160,9 @@ Server::worker_thread () struct timeval after_read; struct timeval after_encode; struct timeval end; - + gettimeofday (&start, 0); - + try { frame = process (socket, after_read, after_encode); ip = socket->socket().remote_endpoint().address().to_string(); @@ -174,7 +174,7 @@ Server::worker_thread () gettimeofday (&end, 0); socket.reset (); - + lock.lock (); if (frame >= 0) { @@ -188,14 +188,14 @@ Server::worker_thread () << "receive " << (seconds(after_read) - seconds(start)) << "s " << "encode " << (seconds(after_encode) - seconds(after_read)) << "s " << "send " << (seconds(end) - seconds(after_encode)) << "s."; - + if (_verbose) { cout << message.str() << "\n"; } LOG_GENERAL_NC (message.str ()); } - + _full_condition.notify_all (); } } @@ -207,13 +207,13 @@ Server::run (int num_threads) if (_verbose) { cout << "DCP-o-matic server starting with " << num_threads << " threads.\n"; } - + for (int i = 0; i < num_threads; ++i) { _worker_threads.push_back (new thread (bind (&Server::worker_thread, this))); } _broadcast.thread = new thread (bind (&Server::broadcast_thread, this)); - + start_accept (); _io_service.run (); } @@ -267,7 +267,7 @@ Server::broadcast_received () } } - + _broadcast.socket->async_receive_from ( boost::asio::buffer (_broadcast.buffer, sizeof (_broadcast.buffer)), _broadcast.send_endpoint, boost::bind (&Server::broadcast_received, this) @@ -293,15 +293,15 @@ Server::handle_accept (shared_ptr socket, boost::system::error_code cons } boost::mutex::scoped_lock lock (_worker_mutex); - + /* Wait until the queue has gone down a bit */ while (_queue.size() >= _worker_threads.size() * 2 && !_terminate) { _full_condition.wait (lock); } - + _queue.push_back (socket); _empty_condition.notify_all (); start_accept (); } - + diff --git a/src/lib/server.h b/src/lib/server.h index 1dc3b7b4e..51dc8774e 100644 --- a/src/lib/server.h +++ b/src/lib/server.h @@ -50,7 +50,7 @@ public: : _host_name ("") , _threads (1) {} - + /** @param h Server host name or IP address in string form. * @param t Number of threads to use on the server. */ @@ -60,7 +60,7 @@ public: {} /* Default copy constructor is fine */ - + /** @return server's host name or IP address in string form */ std::string host_name () const { return _host_name; @@ -121,13 +121,13 @@ private: : thread (0) , socket (0) {} - + boost::thread* thread; boost::asio::ip::udp::socket* socket; char buffer[64]; boost::asio::ip::udp::endpoint send_endpoint; boost::asio::io_service io_service; - + } _broadcast; }; diff --git a/src/lib/server_finder.cc b/src/lib/server_finder.cc index 726437ea5..ac4651657 100644 --- a/src/lib/server_finder.cc +++ b/src/lib/server_finder.cc @@ -76,7 +76,7 @@ try socket.set_option (boost::asio::socket_base::broadcast (true)); string const data = DCPOMATIC_HELLO; - + while (!_stop) { if (Config::instance()->use_any_servers ()) { /* Broadcast to look for servers */ @@ -153,18 +153,18 @@ ServerFinder::handle_accept (boost::system::error_code ec, shared_ptr so start_accept (); return; } - + uint32_t length; socket->read (reinterpret_cast (&length), sizeof (uint32_t)); length = ntohl (length); - + scoped_array buffer (new char[length]); socket->read (reinterpret_cast (buffer.get()), length); - + string s (buffer.get()); shared_ptr xml (new cxml::Document ("ServerAvailable")); xml->read_string (s); - + string const ip = socket->socket().remote_endpoint().address().to_string (); if (!server_found (ip) && xml->optional_number_child("Version").get_value_or (0) == SERVER_LINK_VERSION) { ServerDescription sd (ip, xml->number_child ("Threads")); diff --git a/src/lib/server_finder.h b/src/lib/server_finder.h index dc62f998d..ec855938b 100644 --- a/src/lib/server_finder.h +++ b/src/lib/server_finder.h @@ -51,7 +51,7 @@ private: boost::signals2::signal ServerFound; bool _disabled; - + /** Thread to periodically issue broadcasts to find encoding servers */ boost::thread* _broadcast_thread; /** Thread to listen to the responses from servers */ diff --git a/src/lib/signal_manager.h b/src/lib/signal_manager.h index ae4306e30..546d3d739 100644 --- a/src/lib/signal_manager.h +++ b/src/lib/signal_manager.h @@ -76,7 +76,7 @@ private: } friend class Signaller; - + /** A io_service which is used as the conduit for messages */ boost::asio::io_service _service; /** Object required to keep io_service from stopping when it has nothing to do */ diff --git a/src/lib/signaller.h b/src/lib/signaller.h index 661a171ec..fa249078c 100644 --- a/src/lib/signaller.h +++ b/src/lib/signaller.h @@ -103,7 +103,7 @@ public: if (signal_manager) { signal_manager->emit (boost::bind (&Wrapper::signal, w)); } - + boost::mutex::scoped_lock lm (_signaller_mutex); /* Clean up finished Wrappers */ diff --git a/src/lib/single_stream_audio_content.cc b/src/lib/single_stream_audio_content.cc index 6a9a78bfa..cf2dcc1bd 100644 --- a/src/lib/single_stream_audio_content.cc +++ b/src/lib/single_stream_audio_content.cc @@ -62,7 +62,7 @@ SingleStreamAudioContent::take_from_audio_examiner (shared_ptr ex { shared_ptr film = _film.lock (); DCPOMATIC_ASSERT (film); - + { boost::mutex::scoped_lock lm (_mutex); _audio_stream.reset (new AudioStream (examiner->audio_frame_rate(), examiner->audio_channels ())); diff --git a/src/lib/single_stream_audio_content.h b/src/lib/single_stream_audio_content.h index abe68b444..7ae6dbaa4 100644 --- a/src/lib/single_stream_audio_content.h +++ b/src/lib/single_stream_audio_content.h @@ -45,7 +45,7 @@ public: AudioStreamPtr audio_stream () const { return _audio_stream; } - + void take_from_audio_examiner (boost::shared_ptr); protected: diff --git a/src/lib/sndfile_base.cc b/src/lib/sndfile_base.cc index 3f7ee0d75..712df7bda 100644 --- a/src/lib/sndfile_base.cc +++ b/src/lib/sndfile_base.cc @@ -39,10 +39,10 @@ Sndfile::Sndfile (shared_ptr c) /* Here be monsters. See fopen_boost for similar shenanigans */ #ifdef DCPOMATIC_WINDOWS _sndfile = sf_wchar_open (_sndfile_content->path(0).c_str(), SFM_READ, &_info); -#else +#else _sndfile = sf_open (_sndfile_content->path(0).string().c_str(), SFM_READ, &_info); #endif - + if (!_sndfile) { throw DecodeError (_("could not open audio file for reading")); } diff --git a/src/lib/sndfile_base.h b/src/lib/sndfile_base.h index 6c4f02197..4b7a50fc7 100644 --- a/src/lib/sndfile_base.h +++ b/src/lib/sndfile_base.h @@ -31,7 +31,7 @@ public: Sndfile (boost::shared_ptr content); virtual ~Sndfile (); -protected: +protected: boost::shared_ptr _sndfile_content; SNDFILE* _sndfile; SF_INFO _info; diff --git a/src/lib/sndfile_content.h b/src/lib/sndfile_content.h index f5a2e38b1..c07b823d4 100644 --- a/src/lib/sndfile_content.h +++ b/src/lib/sndfile_content.h @@ -38,9 +38,9 @@ public: boost::shared_ptr shared_from_this () { return boost::dynamic_pointer_cast (Content::shared_from_this ()); } - + DCPTime full_length () const; - + void examine (boost::shared_ptr); std::string summary () const; std::string technical_summary () const; @@ -48,7 +48,7 @@ public: void as_xml (xmlpp::Node *) const; void take_from_audio_examiner (boost::shared_ptr); - + static bool valid_file (boost::filesystem::path); private: @@ -56,7 +56,7 @@ private: boost::mutex::scoped_lock lm (_mutex); return _audio_length; } - + Frame _audio_length; }; diff --git a/src/lib/sndfile_decoder.cc b/src/lib/sndfile_decoder.cc index ff14543e1..2fa9ae2a3 100644 --- a/src/lib/sndfile_decoder.cc +++ b/src/lib/sndfile_decoder.cc @@ -39,7 +39,7 @@ SndfileDecoder::SndfileDecoder (shared_ptr c) , _remaining (_info.frames) , _deinterleave_buffer (0) { - + } SndfileDecoder::~SndfileDecoder () @@ -53,7 +53,7 @@ SndfileDecoder::pass () if (_remaining == 0) { return true; } - + /* Do things in half second blocks as I think there may be limits to what FFmpeg (and in particular the resampler) can cope with. */ @@ -61,7 +61,7 @@ SndfileDecoder::pass () sf_count_t const this_time = min (block, _remaining); int const channels = _sndfile_content->audio_stream()->channels (); - + shared_ptr data (new AudioBuffers (channels, this_time)); if (_sndfile_content->audio_stream()->channels() == 1) { @@ -84,7 +84,7 @@ SndfileDecoder::pass () } } } - + data->set_frames (this_time); audio (_sndfile_content->audio_stream (), data, ContentTime::from_frames (_done, _info.samplerate)); _done += this_time; diff --git a/src/lib/sndfile_decoder.h b/src/lib/sndfile_decoder.h index 40e313165..7fcf5037c 100644 --- a/src/lib/sndfile_decoder.h +++ b/src/lib/sndfile_decoder.h @@ -33,7 +33,7 @@ public: private: bool pass (); void seek (ContentTime, bool); - + int64_t _done; int64_t _remaining; float* _deinterleave_buffer; diff --git a/src/lib/sndfile_examiner.h b/src/lib/sndfile_examiner.h index b3ab3c4e2..c64ceae6e 100644 --- a/src/lib/sndfile_examiner.h +++ b/src/lib/sndfile_examiner.h @@ -24,7 +24,7 @@ class SndfileExaminer : public Sndfile, public AudioExaminer { public: SndfileExaminer (boost::shared_ptr content); - + int audio_channels () const; Frame audio_length () const; int audio_frame_rate () const; diff --git a/src/lib/subrip_content.cc b/src/lib/subrip_content.cc index 9656ec184..7ab13c2c3 100644 --- a/src/lib/subrip_content.cc +++ b/src/lib/subrip_content.cc @@ -56,7 +56,7 @@ SubRipContent::examine (boost::shared_ptr job) shared_ptr film = _film.lock (); DCPOMATIC_ASSERT (film); - + DCPTime len (s.length (), film->active_frame_rate_change (position ())); /* Default to turning these subtitles on */ diff --git a/src/lib/subrip_content.h b/src/lib/subrip_content.h index e63526179..09346a174 100644 --- a/src/lib/subrip_content.h +++ b/src/lib/subrip_content.h @@ -28,7 +28,7 @@ public: boost::shared_ptr shared_from_this () { return boost::dynamic_pointer_cast (Content::shared_from_this ()); } - + /* Content */ void examine (boost::shared_ptr); std::string summary () const; @@ -42,7 +42,7 @@ public: } static std::string const font_id; - + private: DCPTime _length; }; diff --git a/src/lib/subrip_decoder.cc b/src/lib/subrip_decoder.cc index fecbbc558..c2bd4f3e0 100644 --- a/src/lib/subrip_decoder.cc +++ b/src/lib/subrip_decoder.cc @@ -40,7 +40,7 @@ void SubRipDecoder::seek (ContentTime time, bool accurate) { SubtitleDecoder::seek (time, accurate); - + _next = 0; while (_next < _subtitles.size() && ContentTime::from_seconds (_subtitles[_next].from.all_as_seconds ()) < time) { ++_next; @@ -55,7 +55,7 @@ SubRipDecoder::pass () } /* XXX: we are ignoring positioning specified in the file */ - + list out; for (list::const_iterator i = _subtitles[_next].lines.begin(); i != _subtitles[_next].lines.end(); ++i) { for (list::const_iterator j = i->blocks.begin(); j != i->blocks.end(); ++j) { diff --git a/src/lib/subrip_decoder.h b/src/lib/subrip_decoder.h index 876f763d3..38ccca0a3 100644 --- a/src/lib/subrip_decoder.h +++ b/src/lib/subrip_decoder.h @@ -37,7 +37,7 @@ protected: private: std::list image_subtitles_during (ContentTimePeriod, bool starting) const; std::list text_subtitles_during (ContentTimePeriod, bool starting) const; - + size_t _next; }; diff --git a/src/lib/subrip_subtitle.h b/src/lib/subrip_subtitle.h index d4d27e140..f39a317b7 100644 --- a/src/lib/subrip_subtitle.h +++ b/src/lib/subrip_subtitle.h @@ -32,7 +32,7 @@ struct SubRipSubtitlePiece , italic (false) , underline (false) {} - + std::string text; bool bold; bool italic; diff --git a/src/lib/subtitle_content.cc b/src/lib/subtitle_content.cc index 514ee03cb..215829659 100644 --- a/src/lib/subtitle_content.cc +++ b/src/lib/subtitle_content.cc @@ -78,7 +78,7 @@ SubtitleContent::SubtitleContent (shared_ptr film, cxml::ConstNodePt } else { _use_subtitles = false; } - + if (version >= 7) { _subtitle_x_offset = node->number_child ("SubtitleXOffset"); _subtitle_y_offset = node->number_child ("SubtitleYOffset"); @@ -109,7 +109,7 @@ SubtitleContent::SubtitleContent (shared_ptr film, vector ref = dynamic_pointer_cast (c[0]); DCPOMATIC_ASSERT (ref); list > ref_fonts = ref->fonts (); - + for (size_t i = 0; i < c.size(); ++i) { shared_ptr sc = dynamic_pointer_cast (c[i]); @@ -120,7 +120,7 @@ SubtitleContent::SubtitleContent (shared_ptr film, vectorsubtitle_x_offset() != ref->subtitle_x_offset()) { throw JoinError (_("Content to be joined must have the same subtitle X offset.")); } - + if (sc->subtitle_y_offset() != ref->subtitle_y_offset()) { throw JoinError (_("Content to be joined must have the same subtitle Y offset.")); } @@ -166,7 +166,7 @@ void SubtitleContent::as_xml (xmlpp::Node* root) const { boost::mutex::scoped_lock lm (_mutex); - + root->add_child("UseSubtitles")->add_child_text (raw_convert (_use_subtitles)); root->add_child("SubtitleXOffset")->add_child_text (raw_convert (_subtitle_x_offset)); root->add_child("SubtitleYOffset")->add_child_text (raw_convert (_subtitle_y_offset)); @@ -188,7 +188,7 @@ SubtitleContent::set_use_subtitles (bool u) } signal_changed (SubtitleContentProperty::USE_SUBTITLES); } - + void SubtitleContent::set_subtitle_x_offset (double o) { diff --git a/src/lib/subtitle_content.h b/src/lib/subtitle_content.h index a159d7849..c00ec6f90 100644 --- a/src/lib/subtitle_content.h +++ b/src/lib/subtitle_content.h @@ -102,7 +102,7 @@ public: protected: /** subtitle language (e.g. "German") or empty if it is not known */ std::string _subtitle_language; - + private: friend struct ffmpeg_pts_offset_test; void font_changed (); diff --git a/src/lib/subtitle_decoder.cc b/src/lib/subtitle_decoder.cc index 93493aa70..dd2558505 100644 --- a/src/lib/subtitle_decoder.cc +++ b/src/lib/subtitle_decoder.cc @@ -74,7 +74,7 @@ SubtitleDecoder::get (list const & subs, list const & sp, /* Now look for what we wanted in the data we have collected */ /* XXX: inefficient */ - + list out; for (typename list::const_iterator i = subs.begin(); i != subs.end(); ++i) { if ((starting && period.contains (i->period().from)) || (!starting && period.overlaps (i->period ()))) { @@ -83,7 +83,7 @@ SubtitleDecoder::get (list const & subs, list const & sp, } /* Discard anything in _decoded_image_subtitles that is outside 5 seconds either side of period */ - + list::iterator i = _decoded_image_subtitles.begin(); while (i != _decoded_image_subtitles.end()) { list::iterator tmp = i; diff --git a/src/lib/subtitle_decoder.h b/src/lib/subtitle_decoder.h index 8ba74404f..c958419c7 100644 --- a/src/lib/subtitle_decoder.h +++ b/src/lib/subtitle_decoder.h @@ -40,7 +40,7 @@ public: protected: void seek (ContentTime, bool); - + void image_subtitle (ContentTimePeriod period, boost::shared_ptr, dcpomatic::Rect); void text_subtitle (std::list); @@ -56,7 +56,7 @@ private: */ virtual std::list image_subtitles_during (ContentTimePeriod period, bool starting) const = 0; virtual std::list text_subtitles_during (ContentTimePeriod period, bool starting) const = 0; - + boost::shared_ptr _subtitle_content; }; diff --git a/src/lib/timer.cc b/src/lib/timer.cc index 69a7e3aa9..42f1cb350 100644 --- a/src/lib/timer.cc +++ b/src/lib/timer.cc @@ -81,7 +81,7 @@ StateTimer::~StateTimer () return; } - + set_state (N_("")); cout << _name << N_(":\n"); diff --git a/src/lib/timer.h b/src/lib/timer.h index 8c4b046bf..4293fee0d 100644 --- a/src/lib/timer.h +++ b/src/lib/timer.h @@ -39,7 +39,7 @@ class PeriodTimer public: PeriodTimer (std::string n); ~PeriodTimer (); - + private: /** name to use when giving output */ diff --git a/src/lib/transcode_job.cc b/src/lib/transcode_job.cc index d16287111..4a2d768f4 100644 --- a/src/lib/transcode_job.cc +++ b/src/lib/transcode_job.cc @@ -45,7 +45,7 @@ using boost::shared_ptr; TranscodeJob::TranscodeJob (shared_ptr film) : Job (film) { - + } string @@ -101,7 +101,7 @@ TranscodeJob::status () const /// TRANSLATORS: fps here is an abbreviation for frames per second s << "; " << fixed << setprecision (1) << fps << " " << _("fps"); } - + return s.str (); } @@ -111,11 +111,11 @@ TranscodeJob::remaining_time () const { /* _transcoder might be destroyed by the job-runner thread */ shared_ptr t = _transcoder; - + if (!t) { return 0; } - + float fps = t->current_encoding_rate (); if (fps == 0) { diff --git a/src/lib/transcode_job.h b/src/lib/transcode_job.h index efe3f9719..23a856069 100644 --- a/src/lib/transcode_job.h +++ b/src/lib/transcode_job.h @@ -33,7 +33,7 @@ class TranscodeJob : public Job { public: TranscodeJob (boost::shared_ptr); - + std::string name () const; std::string json_name () const; void run (); diff --git a/src/lib/transcoder.cc b/src/lib/transcoder.cc index 4ff0c6dfe..3ecc3a064 100644 --- a/src/lib/transcoder.cc +++ b/src/lib/transcoder.cc @@ -67,7 +67,7 @@ Transcoder::go () if (!_film->burn_subtitles ()) { _writer->write (_player->get_subtitle_fonts ()); } - + for (DCPTime t; t < length; t += frame) { list > v = _player->get_video (t, true); for (list >::const_iterator i = v.begin(); i != v.end(); ++i) { diff --git a/src/lib/types.h b/src/lib/types.h index 655aeba09..b0e9e51ac 100644 --- a/src/lib/types.h +++ b/src/lib/types.h @@ -115,7 +115,7 @@ struct Crop if (s.height < minimum) { s.height = minimum; } - + return s; } @@ -130,7 +130,7 @@ struct CPLSummary , cpl_annotation_text (a) , cpl_file (f) {} - + std::string dcp_directory; std::string cpl_id; std::string cpl_annotation_text; diff --git a/src/lib/update.cc b/src/lib/update.cc index f433ff991..24cd28b16 100644 --- a/src/lib/update.cc +++ b/src/lib/update.cc @@ -64,7 +64,7 @@ UpdateChecker::UpdateChecker () curl_easy_setopt (_curl, CURLOPT_WRITEFUNCTION, write_callback_wrapper); curl_easy_setopt (_curl, CURLOPT_WRITEDATA, this); curl_easy_setopt (_curl, CURLOPT_TIMEOUT, 20); - + string const agent = "dcpomatic/" + string (dcpomatic_version); curl_easy_setopt (_curl, CURLOPT_USERAGENT, agent.c_str ()); @@ -74,7 +74,7 @@ UpdateChecker::UpdateChecker () UpdateChecker::~UpdateChecker () { /* We are not cleaning up our thread, but hey well */ - + curl_easy_cleanup (_curl); curl_global_cleanup (); delete[] _buffer; @@ -100,12 +100,12 @@ UpdateChecker::thread () } --_to_do; lock.unlock (); - + try { _offset = 0; /* Perform the request */ - + int r = curl_easy_perform (_curl); if (r != CURLE_OK) { set_state (FAILED); @@ -113,7 +113,7 @@ UpdateChecker::thread () } /* Parse the reply */ - + _buffer[_offset] = '\0'; string s (_buffer); cxml::Document doc ("Update"); @@ -133,7 +133,7 @@ UpdateChecker::thread () if (version_less_than (dcpomatic_version, stable)) { _stable = stable; } - + if (Config::instance()->check_for_test_updates() && version_less_than (dcpomatic_version, test)) { _test = test; } @@ -148,7 +148,7 @@ UpdateChecker::thread () } } } - + size_t UpdateChecker::write_callback (void* data, size_t size, size_t nmemb) { @@ -203,13 +203,13 @@ UpdateChecker::version_less_than (string const & a, string const & b) } else { am = raw_convert (ap[2]); } - + float bm; if (ends_with (bp[2], "devel")) { bm = raw_convert (bp[2].substr (0, bp[2].length() - 5)) + 0.5; } else { bm = raw_convert (bp[2]); } - + return am < bm; } diff --git a/src/lib/update.h b/src/lib/update.h index 461217a37..b82be7808 100644 --- a/src/lib/update.h +++ b/src/lib/update.h @@ -51,7 +51,7 @@ public: boost::mutex::scoped_lock lm (_data_mutex); return _state; } - + /** @return new stable version, if there is one */ boost::optional stable () { boost::mutex::scoped_lock lm (_data_mutex); @@ -63,7 +63,7 @@ public: boost::mutex::scoped_lock lm (_data_mutex); return _test; } - + /** @return true if the last signal emission was the first */ bool last_emit_was_first () const { boost::mutex::scoped_lock lm (_data_mutex); @@ -78,7 +78,7 @@ public: private: friend struct update_checker_test; - + static UpdateChecker* _instance; static bool version_less_than (std::string const & a, std::string const & b); diff --git a/src/lib/upmixer_a.h b/src/lib/upmixer_a.h index 111846fe0..389d52d25 100644 --- a/src/lib/upmixer_a.h +++ b/src/lib/upmixer_a.h @@ -31,7 +31,7 @@ class UpmixerA : public AudioProcessor { public: UpmixerA (int sampling_rate); - + std::string name () const; std::string id () const; ChannelCount in_channels () const; diff --git a/src/lib/util.cc b/src/lib/util.cc index ad4349da2..05eb3121e 100644 --- a/src/lib/util.cc +++ b/src/lib/util.cc @@ -184,7 +184,7 @@ int addr2line (void const * const addr) { char addr2line_cmd[512] = { 0 }; - sprintf (addr2line_cmd, "addr2line -f -p -e %.256s %p > %s", program_name.c_str(), addr, backtrace_file.string().c_str()); + sprintf (addr2line_cmd, "addr2line -f -p -e %.256s %p > %s", program_name.c_str(), addr, backtrace_file.string().c_str()); return system(addr2line_cmd); } @@ -198,19 +198,19 @@ exception_handler(struct _EXCEPTION_POINTERS * info) FILE* f = fopen_boost (backtrace_file, "w"); fprintf (f, "C-style exception %d\n", info->ExceptionRecord->ExceptionCode); fclose(f); - + if (info->ExceptionRecord->ExceptionCode != EXCEPTION_STACK_OVERFLOW) { CONTEXT* context = info->ContextRecord; SymInitialize (GetCurrentProcess (), 0, true); - + STACKFRAME frame = { 0 }; - + /* setup initial stack frame */ #if _WIN64 frame.AddrPC.Offset = context->Rip; frame.AddrStack.Offset = context->Rsp; frame.AddrFrame.Offset = context->Rbp; -#else +#else frame.AddrPC.Offset = context->Eip; frame.AddrStack.Offset = context->Esp; frame.AddrFrame.Offset = context->Ebp; @@ -218,7 +218,7 @@ exception_handler(struct _EXCEPTION_POINTERS * info) frame.AddrPC.Mode = AddrModeFlat; frame.AddrStack.Mode = AddrModeFlat; frame.AddrFrame.Mode = AddrModeFlat; - + while ( StackWalk ( IMAGE_FILE_MACHINE_I386, @@ -235,13 +235,13 @@ exception_handler(struct _EXCEPTION_POINTERS * info) addr2line((void *) frame.AddrPC.Offset); } } else { -#ifdef _WIN64 +#ifdef _WIN64 addr2line ((void *) info->ContextRecord->Rip); -#else +#else addr2line ((void *) info->ContextRecord->Eip); -#endif +#endif } - + return EXCEPTION_CONTINUE_SEARCH; } #endif @@ -273,7 +273,7 @@ terminate () << e.what() << std::endl; } catch (...) { - std::cerr << __FUNCTION__ << " caught unknown/unhandled exception." + std::cerr << __FUNCTION__ << " caught unknown/unhandled exception." << std::endl; } @@ -306,8 +306,8 @@ dcpomatic_setup () */ std::locale::global (boost::locale::generator().generate ("")); boost::filesystem::path::imbue (std::locale ()); -#endif - +#endif + avfilter_register_all (); #ifdef DCPOMATIC_OSX @@ -323,7 +323,7 @@ dcpomatic_setup () Pango::init (); dcp::init (); - + Ratio::setup_ratios (); PresetColourConversion::setup_colour_conversion_presets (); VideoContentScale::setup_scales (); @@ -382,7 +382,7 @@ dcpomatic_setup_gettext_i18n (string lang) #if defined(DCPOMATIC_WINDOWS) || defined(DCPOMATIC_OSX) bindtextdomain ("libdcpomatic2", mo_path().string().c_str()); bind_textdomain_codeset ("libdcpomatic2", "UTF8"); -#endif +#endif #ifdef DCPOMATIC_LINUX bindtextdomain ("libdcpomatic2", LINUX_LOCALE_PREFIX); @@ -434,7 +434,7 @@ md5_digest_head_tail (vector files, boost::uintmax_t si fclose (f); --i; - } + } digester.add (buffer.get(), size - to_do); return digester.get (); @@ -516,7 +516,7 @@ valid_image_file (boost::filesystem::path f) if (boost::starts_with (f.leaf().string(), "._")) { return false; } - + string ext = f.extension().string(); transform (ext.begin(), ext.end(), ext.begin(), ::tolower); return ( @@ -555,7 +555,7 @@ fit_ratio_within (float ratio, dcp::Size full_frame) if (ratio < full_frame.ratio ()) { return dcp::Size (rint (full_frame.height * ratio), full_frame.height); } - + return dcp::Size (full_frame.width, rint (full_frame.width / ratio)); } @@ -578,7 +578,7 @@ subtitle_period (AVSubtitle const & sub) /* End time is not known */ return FFmpegSubtitlePeriod (packet_time + ContentTime::from_seconds (sub.start_display_time / 1e3)); } - + return FFmpegSubtitlePeriod ( packet_time + ContentTime::from_seconds (sub.start_display_time / 1e3), packet_time + ContentTime::from_seconds (sub.end_display_time / 1e3) @@ -593,7 +593,7 @@ split_get_request (string url) KEY, VALUE } state = AWAITING_QUESTION_MARK; - + map r; string k; string v; diff --git a/src/lib/video_content.cc b/src/lib/video_content.cc index f97e46322..8c6f6c7eb 100644 --- a/src/lib/video_content.cc +++ b/src/lib/video_content.cc @@ -119,7 +119,7 @@ VideoContent::VideoContent (shared_ptr film, cxml::ConstNodePtr node _scale = VideoContentScale (node->node_child ("Scale")); } - + if (node->optional_node_child ("ColourConversion")) { _colour_conversion = ColourConversion (node->node_child ("ColourConversion"), version); } @@ -168,7 +168,7 @@ VideoContent::VideoContent (shared_ptr film, vectorfade_in() != ref->fade_in() || vc->fade_out() != ref->fade_out()) { throw JoinError (_("Content to be joined must have the same fades.")); } - + _video_length += vc->video_length (); } @@ -239,7 +239,7 @@ VideoContent::take_from_video_examiner (shared_ptr d) LOG_GENERAL ("Video length obtained from header as %1 frames", _video_length); set_default_colour_conversion (); - + signal_changed (VideoContentProperty::VIDEO_SIZE); signal_changed (VideoContentProperty::VIDEO_FRAME_RATE); signal_changed (VideoContentProperty::VIDEO_SCALE); @@ -251,14 +251,14 @@ VideoContent::set_left_crop (int c) { { boost::mutex::scoped_lock lm (_mutex); - + if (_crop.left == c) { return; } - + _crop.left = c; } - + signal_changed (VideoContentProperty::VIDEO_CROP); } @@ -270,10 +270,10 @@ VideoContent::set_right_crop (int c) if (_crop.right == c) { return; } - + _crop.right = c; } - + signal_changed (VideoContentProperty::VIDEO_CROP); } @@ -285,10 +285,10 @@ VideoContent::set_top_crop (int c) if (_crop.top == c) { return; } - + _crop.top = c; } - + signal_changed (VideoContentProperty::VIDEO_CROP); } @@ -300,7 +300,7 @@ VideoContent::set_bottom_crop (int c) if (_crop.bottom == c) { return; } - + _crop.bottom = c; } @@ -478,10 +478,10 @@ VideoContent::set_video_frame_rate (float r) if (_video_frame_rate == r) { return; } - + _video_frame_rate = r; } - + signal_changed (VideoContentProperty::VIDEO_FRAME_RATE); } @@ -489,7 +489,7 @@ optional VideoContent::fade (Frame f) const { DCPOMATIC_ASSERT (f >= 0); - + if (f < fade_in()) { return float (f) / fade_in(); } @@ -550,7 +550,7 @@ VideoContent::processing_description () const d << " (" << fixed << setprecision(2) << scaled.ratio() << ":1)\n"; } - + if (scaled != container_size) { d << String::compose ( _("Padded with black to fit container %1 (%2x%3)"), @@ -563,7 +563,7 @@ VideoContent::processing_description () const d << _("Content frame rate"); d << " " << fixed << setprecision(4) << video_frame_rate() << "\n"; - + FrameRateChange frc (video_frame_rate(), film->video_frame_rate ()); d << frc.description () << "\n"; diff --git a/src/lib/video_content.h b/src/lib/video_content.h index abc9c5fa3..01e3cb2aa 100644 --- a/src/lib/video_content.h +++ b/src/lib/video_content.h @@ -54,7 +54,7 @@ public: virtual std::string identifier () const; virtual void set_default_colour_conversion (); - + Frame video_length () const { boost::mutex::scoped_lock lm (_mutex); return _video_length; @@ -65,7 +65,7 @@ public: if (_video_frame_type == VIDEO_FRAME_TYPE_3D_ALTERNATE) { return _video_length / 2; } - + return _video_length; } @@ -73,7 +73,7 @@ public: boost::mutex::scoped_lock lm (_mutex); return _video_size; } - + float video_frame_rate () const { boost::mutex::scoped_lock lm (_mutex); return _video_frame_rate; @@ -93,7 +93,7 @@ public: void set_fade_in (Frame); void set_fade_out (Frame); - + VideoFrameType video_frame_type () const { boost::mutex::scoped_lock lm (_mutex); return _video_frame_type; @@ -149,7 +149,7 @@ public: boost::mutex::scoped_lock lm (_mutex); return _fade_out; } - + dcp::Size video_size_after_3d_split () const; dcp::Size video_size_after_crop () const; @@ -176,7 +176,7 @@ private: friend struct audio_sampling_rate_test; void setup_default_colour_conversion (); - + dcp::Size _video_size; VideoFrameType _video_frame_type; Crop _crop; diff --git a/src/lib/video_content_scale.cc b/src/lib/video_content_scale.cc index 59ff4bd9b..c8c295361 100644 --- a/src/lib/video_content_scale.cc +++ b/src/lib/video_content_scale.cc @@ -84,13 +84,13 @@ string VideoContentScale::id () const { SafeStringStream s; - + if (_ratio) { s << _ratio->id (); } else { s << (_scale ? "S1" : "S0"); } - + return s.str (); } @@ -122,7 +122,7 @@ VideoContentScale::from_id (string id) return VideoContentScale (true); } - + /** @param display_container Size of the container that we are displaying this content in. * @param film_container The size of the film's image. */ @@ -154,7 +154,7 @@ VideoContentScale::size (shared_ptr c, dcp::Size display_con float (display_container.width) / film_container.width, float (display_container.height) / film_container.height ); - + size.width = rint (size.width * scale); size.height = rint (size.height * scale); } diff --git a/src/lib/video_decoder.cc b/src/lib/video_decoder.cc index 9d165ab02..fcc262163 100644 --- a/src/lib/video_decoder.cc +++ b/src/lib/video_decoder.cc @@ -52,7 +52,7 @@ list VideoDecoder::decoded_video (Frame frame) { list output; - + for (list::const_iterator i = _decoded_video.begin(); i != _decoded_video.end(); ++i) { if (i->frame == frame) { output.push_back (*i); @@ -224,7 +224,7 @@ VideoDecoder::fill_3d (Frame from, Frame to, Eyes eye) } } } - + /** Called by subclasses when they have a video frame ready */ void VideoDecoder::video (shared_ptr image, Frame frame) @@ -272,7 +272,7 @@ VideoDecoder::video (shared_ptr image, Frame frame) boost::optional from; boost::optional to; - + if (_decoded_video.empty() && _last_seek_time && _last_seek_accurate) { from = _last_seek_time->frames (_video_content->video_frame_rate ()); to = to_push.front().frame; diff --git a/src/lib/writer.cc b/src/lib/writer.cc index 8643b0def..ae1fb3e87 100644 --- a/src/lib/writer.cc +++ b/src/lib/writer.cc @@ -118,7 +118,7 @@ Writer::Writer (shared_ptr film, weak_ptr j) job->sub (_("Checking existing image data")); check_existing_picture_asset (); - + _picture_asset_writer = _picture_asset->start_write ( _film->internal_video_asset_dir() / _film->internal_video_asset_filename(), _film->interop() ? dcp::INTEROP : dcp::SMPTE, @@ -133,7 +133,7 @@ Writer::Writer (shared_ptr film, weak_ptr j) if (_film->encrypted ()) { _sound_asset->set_key (_film->key ()); } - + /* Write the sound asset into the film directory so that we leave the creation of the DCP directory until the last minute. */ @@ -227,14 +227,14 @@ Writer::fake_write (int frame, Eyes eyes) /* The queue is too big; wait until that is sorted out */ _full_condition.wait (lock); } - + FILE* file = fopen_boost (_film->info_file (), "rb"); if (!file) { throw ReadFileError (_film->info_file ()); } dcp::FrameInfo info = read_frame_info (file, frame, eyes); fclose (file); - + QueueItem qi; qi.type = QueueItem::FAKE; qi.size = info.size; @@ -318,7 +318,7 @@ try bool done_something = false; while (true) { - + if (_finish || _queued_full_in_memory > _maximum_frames_in_memory || have_sequenced_image_at_queue_head ()) { /* We've got something to do: go and do it */ break; @@ -349,7 +349,7 @@ try LOG_WARNING (N_("- type FULL, frame %1, eyes %2"), i->frame, i->eyes); } else { LOG_WARNING (N_("- type FAKE, size %1, frame %2, eyes %3"), i->size, i->frame, i->eyes); - } + } } LOG_WARNING (N_("Last written frame %1, last written eyes %2"), _last_written_frame, _last_written_eyes); } @@ -399,7 +399,7 @@ try _last_written_frame = qi.frame; _last_written_eyes = qi.eyes; - + shared_ptr job = _job.lock (); DCPOMATIC_ASSERT (job); int64_t total = _film->length().frames (_film->video_frame_rate ()); @@ -443,7 +443,7 @@ try ); i->encoded->write_via_temp (_film->j2c_path (i->frame, i->eyes, true), _film->j2c_path (i->frame, i->eyes, false)); - + lock.lock (); i->encoded.reset (); --_queued_full_in_memory; @@ -473,7 +473,7 @@ Writer::terminate_thread (bool can_throw) if (_thread == 0) { return; } - + _finish = true; _empty_condition.notify_all (); _full_condition.notify_all (); @@ -483,10 +483,10 @@ Writer::terminate_thread (bool can_throw) if (can_throw) { rethrow (); } - + delete _thread; _thread = 0; -} +} void Writer::finish () @@ -494,17 +494,17 @@ Writer::finish () if (!_thread) { return; } - + terminate_thread (true); _picture_asset_writer->finalize (); if (_sound_asset_writer) { _sound_asset_writer->finalize (); } - + /* Hard-link the video asset into the DCP */ boost::filesystem::path video_from = _picture_asset->file (); - + boost::filesystem::path video_to; video_to /= _film->dir (_film->dcp_name()); video_to /= video_asset_filename (_picture_asset); @@ -528,7 +528,7 @@ Writer::finish () boost::filesystem::path audio_to; audio_to /= _film->dir (_film->dcp_name ()); audio_to /= audio_asset_filename (_sound_asset); - + boost::filesystem::rename (_film->file (audio_asset_filename (_sound_asset)), audio_to, ec); if (ec) { throw FileError ( @@ -547,7 +547,7 @@ Writer::finish () _film->dcp_content_type()->libdcp_kind () ) ); - + dcp.add (cpl); shared_ptr reel (new dcp::Reel ()); @@ -583,7 +583,7 @@ Writer::finish () _film->dir (_film->dcp_name ()) / ("sub_" + _subtitle_asset->id() + ".mxf") ); } - + reel->add (shared_ptr ( new dcp::ReelSubtitleAsset ( _subtitle_asset, @@ -593,7 +593,7 @@ Writer::finish () ) )); } - + cpl->add (reel); shared_ptr job = _job.lock (); @@ -637,14 +637,14 @@ Writer::check_existing_picture_asset_frame (FILE* asset, int f, Eyes eyes) LOG_GENERAL ("Existing frame %1 has no info file", f); return false; } - + dcp::FrameInfo info = read_frame_info (file, f, eyes); fclose (file); if (info.size == 0) { LOG_GENERAL ("Existing frame %1 has no info file", f); return false; } - + /* Read the data from the asset and hash it */ dcpomatic_fseek (asset, info.offset, SEEK_SET); Data data (info.size); @@ -738,9 +738,9 @@ Writer::write (PlayerSubtitles subs) s->set_edit_rate (dcp::Fraction (_film->video_frame_rate (), 1)); s->set_time_code_rate (_film->video_frame_rate ()); _subtitle_asset = s; - } + } } - + for (list::const_iterator i = subs.text.begin(); i != subs.text.end(); ++i) { _subtitle_asset->add (*i); } @@ -779,7 +779,7 @@ long Writer::frame_info_position (int frame, Eyes eyes) const { static int const info_size = 48; - + switch (eyes) { case EYES_BOTH: return frame * info_size; @@ -790,7 +790,7 @@ Writer::frame_info_position (int frame, Eyes eyes) const default: DCPOMATIC_ASSERT (false); } - + DCPOMATIC_ASSERT (false); } @@ -802,7 +802,7 @@ Writer::read_frame_info (FILE* file, int frame, Eyes eyes) const dcpomatic_fseek (file, frame_info_position (frame, eyes), SEEK_SET); fread (&info.offset, sizeof (info.offset), 1, file); fread (&info.size, sizeof (info.size), 1, file); - + char hash_buffer[33]; fread (hash_buffer, 1, 32, file); hash_buffer[32] = '\0'; diff --git a/src/lib/writer.h b/src/lib/writer.h index 90b36962c..486d7d672 100644 --- a/src/lib/writer.h +++ b/src/lib/writer.h @@ -56,7 +56,7 @@ public: QueueItem () : size (0) {} - + enum Type { /** a normal frame with some JPEG200 data */ FULL, @@ -98,7 +98,7 @@ public: ~Writer (); bool can_fake_write (int) const; - + void write (Data, int, Eyes); void fake_write (int, Eyes); void repeat (int, Eyes); @@ -149,7 +149,7 @@ private: * ordering */ int _maximum_frames_in_memory; - + /** number of FULL written frames */ int _full_written; /** number of FAKE written frames */ @@ -159,7 +159,7 @@ private: due to the limit of frames to be held in memory. */ int _pushed_to_disk; - + boost::shared_ptr _picture_asset; boost::shared_ptr _picture_asset_writer; boost::shared_ptr _sound_asset; diff --git a/src/tools/dcpomatic.cc b/src/tools/dcpomatic.cc index 5fea90504..0a105fa6b 100644 --- a/src/tools/dcpomatic.cc +++ b/src/tools/dcpomatic.cc @@ -113,7 +113,7 @@ public: private: /* Not defined */ FilmChangedDialog (FilmChangedDialog const &); - + wxMessageDialog* _dialog; }; @@ -124,7 +124,7 @@ private: #define NEEDS_SELECTED_VIDEO_CONTENT 0x8 map menu_items; - + enum { ID_file_new = 1, ID_file_open, @@ -163,13 +163,13 @@ public: #if defined(DCPOMATIC_WINDOWS) if (Config::instance()->win32_console ()) { AllocConsole(); - + HANDLE handle_out = GetStdHandle(STD_OUTPUT_HANDLE); int hCrt = _open_osfhandle((intptr_t) handle_out, _O_TEXT); FILE* hf_out = _fdopen(hCrt, "w"); setvbuf(hf_out, NULL, _IONBF, 1); *stdout = *hf_out; - + HANDLE handle_in = GetStdHandle(STD_INPUT_HANDLE); hCrt = _open_osfhandle((intptr_t) handle_in, _O_TEXT); FILE* hf_in = _fdopen(hCrt, "r"); @@ -257,7 +257,7 @@ public: try { maybe_save_then_delete_film (); - + shared_ptr film (new Film (file)); list const notes = film->read_metadata (); @@ -268,11 +268,11 @@ public: "in this version. Please check the film's settings carefully.") ); } - + for (list::const_iterator i = notes.begin(); i != notes.end(); ++i) { error_dialog (0, std_to_wx (*i)); } - + set_film (film); } catch (std::exception& e) { @@ -293,7 +293,7 @@ public: shared_ptr film () const { return _film; } - + private: void file_changed (boost::filesystem::path f) @@ -302,15 +302,15 @@ private: if (!f.empty ()) { s += " - " + f.string (); } - + SetTitle (std_to_wx (s)); } - + void file_new () { NewFilmDialog* d = new NewFilmDialog (this); int const r = d->ShowModal (); - + if (r == wxID_OK) { if (boost::filesystem::is_directory (d->get_path()) && !boost::filesystem::is_empty(d->get_path())) { @@ -331,11 +331,11 @@ private: ); return; } - + maybe_save_then_delete_film (); new_film (d->get_path ()); } - + d->Destroy (); } @@ -347,7 +347,7 @@ private: std_to_wx (Config::instance()->default_directory_or (wx_to_std (wxStandardPaths::Get().GetDocumentsDir())).string ()), wxDEFAULT_DIALOG_STYLE | wxDD_DIR_MUST_EXIST ); - + int r; while (true) { r = c->ShowModal (); @@ -357,7 +357,7 @@ private: break; } } - + if (r == wxID_OK) { load_film (wx_to_std (c->GetPath ())); } @@ -385,7 +385,7 @@ private: load_film (history[n]); } } - + void file_exit () { /* false here allows the close handler to veto the close request */ @@ -441,7 +441,7 @@ private: if (!_film) { return; } - + KDMDialog* d = new KDMDialog (this, _film); if (d->ShowModal () != wxID_OK) { d->Destroy (); @@ -463,7 +463,7 @@ private: } catch (...) { error_dialog (this, _("An unknown exception occurred.")); } - + d->Destroy (); } @@ -482,7 +482,7 @@ private: (*i)->scale_and_crop_to_fit_height (); } } - + void jobs_send_dcp_to_tms () { _film->send_dcp_to_tms (); @@ -512,14 +512,14 @@ private: } } } -#endif +#endif #ifdef DCPOMATIC_OSX int r = system (string ("open -R " + _film->dir (_film->dcp_name (false)).string ()).c_str ()); if (WEXITSTATUS (r)) { error_dialog (this, _("Could not show DCP")); } -#endif +#endif } void tools_hints () @@ -578,7 +578,7 @@ private: d->Destroy (); return r; } - + void close (wxCloseEvent& ev) { if (!should_close ()) { @@ -591,7 +591,7 @@ private: now (without, as far as I can see, any way for us to find out). */ _config_changed_connection.disconnect (); - + maybe_save_then_delete_film (); ev.Skip (); } @@ -606,27 +606,27 @@ private: bool const dcp_creation = (i != jobs.end ()) && !(*i)->finished (); bool const have_cpl = _film && !_film->cpls().empty (); bool const have_selected_video_content = !_film_editor->content_panel()->selected_video().empty(); - + for (map::iterator j = menu_items.begin(); j != menu_items.end(); ++j) { - + bool enabled = true; - + if ((j->second & NEEDS_FILM) && !_film) { enabled = false; } - + if ((j->second & NOT_DURING_DCP_CREATION) && dcp_creation) { enabled = false; } - + if ((j->second & NEEDS_CPL) && !have_cpl) { enabled = false; } - + if ((j->second & NEEDS_SELECTED_VIDEO_CONTENT) && !have_selected_video_content) { enabled = false; } - + j->first->Enable (enabled); } } @@ -636,7 +636,7 @@ private: if (!_film) { return; } - + if (_film->dirty ()) { FilmChangedDialog d (_film->name ()); switch (d.run ()) { @@ -647,7 +647,7 @@ private: break; } } - + _film.reset (); } @@ -656,7 +656,7 @@ private: wxMenuItem* item = menu->Append (id, text); menu_items.insert (make_pair (item, sens)); } - + void setup_menu (wxMenuBar* m) { _file_menu = new wxMenu; @@ -669,17 +669,17 @@ private: _history_position = _file_menu->GetMenuItems().GetCount(); -#ifndef __WXOSX__ +#ifndef __WXOSX__ _file_menu->AppendSeparator (); #endif - -#ifdef __WXOSX__ + +#ifdef __WXOSX__ add_item (_file_menu, _("&Exit"), wxID_EXIT, ALWAYS); #else add_item (_file_menu, _("&Quit"), wxID_EXIT, ALWAYS); -#endif - -#ifdef __WXOSX__ +#endif + +#ifdef __WXOSX__ add_item (_file_menu, _("&Preferences...\tCtrl-P"), wxID_PREFERENCES, ALWAYS); #else wxMenu* edit = new wxMenu; @@ -689,7 +689,7 @@ private: wxMenu* content = new wxMenu; add_item (content, _("Scale to fit &width"), ID_content_scale_to_fit_width, NEEDS_FILM | NEEDS_SELECTED_VIDEO_CONTENT); add_item (content, _("Scale to fit &height"), ID_content_scale_to_fit_height, NEEDS_FILM | NEEDS_SELECTED_VIDEO_CONTENT); - + wxMenu* jobs_menu = new wxMenu; add_item (jobs_menu, _("&Make DCP\tCtrl-M"), ID_jobs_make_dcp, NEEDS_FILM | NOT_DURING_DCP_CREATION); add_item (jobs_menu, _("Make &KDMs...\tCtrl-K"), ID_jobs_make_kdms, NEEDS_FILM); @@ -702,17 +702,17 @@ private: add_item (tools, _("Check for updates"), ID_tools_check_for_updates, 0); tools->AppendSeparator (); add_item (tools, _("Restore default preferences"), ID_tools_restore_default_preferences, ALWAYS); - + wxMenu* help = new wxMenu; -#ifdef __WXOSX__ +#ifdef __WXOSX__ add_item (help, _("About DCP-o-matic"), wxID_ABOUT, ALWAYS); -#else +#else add_item (help, _("About"), wxID_ABOUT, ALWAYS); -#endif +#endif add_item (help, _("Report a problem..."), ID_help_report_a_problem, ALWAYS); - + m->Append (_file_menu, _("&File")); -#ifndef __WXOSX__ +#ifndef __WXOSX__ m->Append (edit, _("&Edit")); #endif m->Append (content, _("&Content")); @@ -732,15 +732,15 @@ private: } delete _history_separator; _history_separator = 0; - + int pos = _history_position; - + vector history = Config::instance()->history (); - + if (!history.empty ()) { _history_separator = _file_menu->InsertSeparator (pos++); } - + for (size_t i = 0; i < history.size(); ++i) { SafeStringStream s; if (i < 9) { @@ -752,7 +752,7 @@ private: _history_items = history.size (); } - + FilmEditor* _film_editor; FilmViewer* _film_viewer; HintsDialog* _hints_dialog; @@ -784,26 +784,26 @@ public: , _frame (0) {} -private: - +private: + bool OnInit () try { SetAppName (_("DCP-o-matic")); - + if (!wxApp::OnInit()) { return false; } - -#ifdef DCPOMATIC_LINUX + +#ifdef DCPOMATIC_LINUX unsetenv ("UBUNTU_MENUPROXY"); #endif -#ifdef __WXOSX__ +#ifdef __WXOSX__ ProcessSerialNumber serial; GetCurrentProcess (&serial); TransformProcessType (&serial, kProcessTransformToForegroundApplication); -#endif +#endif wxInitAllImageHandlers (); @@ -905,7 +905,7 @@ private: /* This will terminate the program */ return false; } - + void OnUnhandledException () { error_dialog (0, _("An unknown exception occurred.") + " " + REPORT_PROBLEM); diff --git a/src/tools/dcpomatic_batch.cc b/src/tools/dcpomatic_batch.cc index 60c5e697d..48ef8f798 100644 --- a/src/tools/dcpomatic_batch.cc +++ b/src/tools/dcpomatic_batch.cc @@ -99,7 +99,7 @@ private: _sizer->Layout (); ev.Skip (); } - + bool should_close () { if (!JobManager::instance()->work_to_do ()) { @@ -117,7 +117,7 @@ private: d->Destroy (); return r; } - + void close (wxCloseEvent& ev) { if (!should_close ()) { @@ -132,7 +132,7 @@ private: { add_film (); } - + void file_quit () { if (should_close ()) { @@ -153,7 +153,7 @@ private: if (_last_parent) { c->SetPath (std_to_wx (_last_parent.get().string ())); } - + int r; while (true) { r = c->ShowModal (); @@ -163,7 +163,7 @@ private: break; } } - + if (r == wxID_OK) { try { shared_ptr film (new Film (wx_to_std (c->GetPath ()))); @@ -197,10 +197,10 @@ class App : public wxApp if (!wxApp::OnInit()) { return false; } - -#ifdef DCPOMATIC_LINUX + +#ifdef DCPOMATIC_LINUX unsetenv ("UBUNTU_MENUPROXY"); -#endif +#endif /* Enable i18n; this will create a Config object to look for a force-configured language. This Config diff --git a/src/tools/dcpomatic_cli.cc b/src/tools/dcpomatic_cli.cc index 54e196fe0..f885412ef 100644 --- a/src/tools/dcpomatic_cli.cc +++ b/src/tools/dcpomatic_cli.cc @@ -100,7 +100,7 @@ print_dump (shared_ptr film) } else { cout << "\tno colour conversion\n"; } - + } shared_ptr audio = dynamic_pointer_cast (c); @@ -176,10 +176,10 @@ main (int argc, char* argv[]) } film_dir = argv[optind]; - + dcpomatic_setup (); signal_manager = new SignalManager (); - + if (no_remote) { ServerFinder::instance()->disable (); } @@ -201,7 +201,7 @@ main (int argc, char* argv[]) print_dump (film); exit (EXIT_SUCCESS); } - + ContentList content = film->content (); for (ContentList::const_iterator i = content.begin(); i != content.end(); ++i) { vector paths = (*i)->paths (); @@ -241,7 +241,7 @@ main (int argc, char* argv[]) for (list >::iterator i = jobs.begin(); i != jobs.end(); ++i) { if (progress) { cout << (*i)->name() << ": "; - + if ((*i)->progress ()) { cout << (*i)->status() << " \n"; } else { @@ -283,8 +283,8 @@ main (int argc, char* argv[]) JobManager::drop (); ServerFinder::drop (); - + return error ? EXIT_FAILURE : EXIT_SUCCESS; } - + diff --git a/src/tools/dcpomatic_create.cc b/src/tools/dcpomatic_create.cc index a826a1071..d4d4df29b 100644 --- a/src/tools/dcpomatic_create.cc +++ b/src/tools/dcpomatic_create.cc @@ -79,7 +79,7 @@ main (int argc, char* argv[]) Ratio const * content_ratio = 0; int still_length = 10; boost::filesystem::path output; - + int option_index = 0; while (true) { static struct option long_options[] = { @@ -171,7 +171,7 @@ main (int argc, char* argv[]) film->set_container (container_ratio); film->set_dcp_content_type (dcp_content_type); - + for (int i = optind; i < argc; ++i) { shared_ptr c = content_factory (film, argv[i]); shared_ptr vc = dynamic_pointer_cast (c); @@ -180,7 +180,7 @@ main (int argc, char* argv[]) } film->examine_and_add_content (c); } - + JobManager* jm = JobManager::instance (); while (jm->work_to_do ()) {} @@ -214,6 +214,6 @@ main (int argc, char* argv[]) cerr << argv[0] << ": " << e.what() << "\n"; exit (EXIT_FAILURE); } - + return 0; } diff --git a/src/tools/dcpomatic_kdm.cc b/src/tools/dcpomatic_kdm.cc index ae7d97f4f..345b90545 100644 --- a/src/tools/dcpomatic_kdm.cc +++ b/src/tools/dcpomatic_kdm.cc @@ -116,7 +116,7 @@ int main (int argc, char* argv[]) dcp::Formulation formulation = dcp::MODIFIED_TRANSITIONAL_1; program_name = argv[0]; - + int option_index = 0; while (true) { static struct option long_options[] = { @@ -215,7 +215,7 @@ int main (int argc, char* argv[]) } string const film_dir = argv[optind]; - + dcpomatic_setup (); shared_ptr film; @@ -249,7 +249,7 @@ int main (int argc, char* argv[]) if (output.empty ()) { error ("you must specify --output"); } - + dcp::Certificate certificate (dcp::file_to_string (certificate_file)); dcp::EncryptedKDM kdm = film->make_kdm (certificate, cpl, valid_from.get(), valid_to.get(), formulation); kdm.as_xml (output); @@ -278,7 +278,7 @@ int main (int argc, char* argv[]) write_kdm_zip_files ( film, (*i)->screens(), cpl, dcp::LocalTime (valid_from.get()), dcp::LocalTime (valid_to.get()), formulation, output ); - + if (verbose) { cout << "Wrote ZIP files to " << output << "\n"; } @@ -286,7 +286,7 @@ int main (int argc, char* argv[]) write_kdm_files ( film, (*i)->screens(), cpl, dcp::LocalTime (valid_from.get()), dcp::LocalTime (valid_to.get()), formulation, output ); - + if (verbose) { cout << "Wrote KDM files to " << output << "\n"; } diff --git a/src/tools/dcpomatic_server.cc b/src/tools/dcpomatic_server.cc index 8107949f5..37eeb1e8e 100644 --- a/src/tools/dcpomatic_server.cc +++ b/src/tools/dcpomatic_server.cc @@ -61,7 +61,7 @@ private: _log = m; } - string _log; + string _log; }; static shared_ptr memory_log (new MemoryLog); @@ -103,7 +103,7 @@ class TaskBarIcon : public wxTaskBarIcon public: TaskBarIcon () { -#ifdef __WXMSW__ +#ifdef __WXMSW__ wxIcon icon (std_to_wx ("taskbar_icon")); #endif #ifdef __WXGTK__ @@ -115,12 +115,12 @@ public: #ifndef __WXOSX__ /* XXX: fix this for OS X */ SetIcon (icon, std_to_wx ("DCP-o-matic encode server")); -#endif +#endif Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&TaskBarIcon::status, this), ID_status); Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&TaskBarIcon::quit, this), ID_quit); } - + wxMenu* CreatePopupMenu () { wxMenu* menu = new wxMenu; @@ -151,14 +151,14 @@ public: , _icon (0) {} -private: - +private: + bool OnInit () { if (!wxApp::OnInit ()) { return false; } - + dcpomatic_setup (); _icon = new TaskBarIcon; @@ -167,7 +167,7 @@ private: Bind (wxEVT_TIMER, boost::bind (&App::check, this)); _timer.reset (new wxTimer (this)); _timer->Start (1000); - + return true; } diff --git a/src/tools/dcpomatic_server_cli.cc b/src/tools/dcpomatic_server_cli.cc index 847c1fa1b..efcfdc40e 100644 --- a/src/tools/dcpomatic_server_cli.cc +++ b/src/tools/dcpomatic_server_cli.cc @@ -105,9 +105,9 @@ main (int argc, char* argv[]) } else { log.reset (new NullLog); } - + Server server (log, verbose); - + try { server.run (num_threads); } catch (boost::system::system_error& e) { diff --git a/src/tools/server_test.cc b/src/tools/server_test.cc index 6f7a43569..02f4e6673 100644 --- a/src/tools/server_test.cc +++ b/src/tools/server_test.cc @@ -76,7 +76,7 @@ process_video (shared_ptr pvf) cout << "\033[0;31msizes differ\033[0m\n"; return; } - + uint8_t* p = local_encoded.data().get (); uint8_t* q = remote_encoded.data().get (); for (int i = 0; i < local_encoded.size(); ++i) { @@ -129,7 +129,7 @@ main (int argc, char* argv[]) break; } } - + if (server_host.empty() || film_dir.empty()) { help (argv[0]); exit (EXIT_FAILURE); @@ -141,7 +141,7 @@ main (int argc, char* argv[]) server = new ServerDescription (server_host, 1); film.reset (new Film (film_dir)); film->read_metadata (); - + shared_ptr player (new Player (film)); DCPTime const frame = DCPTime::from_frames (1, film->video_frame_rate ()); diff --git a/src/wx/about_dialog.cc b/src/wx/about_dialog.cc index 13a1ef671..142705a55 100644 --- a/src/wx/about_dialog.cc +++ b/src/wx/about_dialog.cc @@ -35,7 +35,7 @@ AboutDialog::AboutDialog (wxWindow* parent) { wxBoxSizer* overall_sizer = new wxBoxSizer (wxVERTICAL); wxBoxSizer* sizer = new wxBoxSizer (wxVERTICAL); - + wxFont title_font (*wxNORMAL_FONT); title_font.SetPointSize (title_font.GetPointSize() + 12); title_font.SetWeight (wxFONTWEIGHT_BOLD); @@ -45,7 +45,7 @@ AboutDialog::AboutDialog (wxWindow* parent) wxFont version_font (*wxNORMAL_FONT); version_font.SetWeight (wxFONTWEIGHT_BOLD); - + wxStaticText* t = new wxStaticText (this, wxID_ANY, _("DCP-o-matic")); t->SetFont (title_font); sizer->Add (t, wxSizerFlags().Centre().Border(wxALL, 16)); @@ -66,7 +66,7 @@ AboutDialog::AboutDialog (wxWindow* parent) wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER ); t->SetFont (subtitle_font); - + sizer->Add (t, wxSizerFlags().Centre().Border(wxALL, 8)); wxHyperlinkCtrl* h = new wxHyperlinkCtrl ( @@ -82,7 +82,7 @@ AboutDialog::AboutDialog (wxWindow* parent) _("(C) 2012-2015 Carl Hetherington, Terrence Meiczinger\n Ole Laursen, Brecht Sanders"), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER ); - + sizer->Add (t, wxSizerFlags().Centre().Border(wxLEFT | wxRIGHT, 16)); _notebook = new wxNotebook (this, wxID_ANY); @@ -236,7 +236,7 @@ AboutDialog::AboutDialog (wxWindow* parent) tested_by.Add (wxT ("Paul Willmott")); tested_by.Add (wxT ("Wolfgang Woehl")); add_section (_("Tested by"), tested_by); - + sizer->Add (_notebook, wxSizerFlags().Centre().Border(wxALL, 16).Expand()); overall_sizer->Add (sizer); @@ -245,7 +245,7 @@ AboutDialog::AboutDialog (wxWindow* parent) if (buttons) { overall_sizer->Add (buttons, 1, wxEXPAND | wxALL, 4); } - + SetSizerAndFit (overall_sizer); } @@ -263,7 +263,7 @@ AboutDialog::add_section (wxString name, wxArrayString credits) wxSizer* overall_sizer = new wxBoxSizer (wxHORIZONTAL); vector sizers; - + for (int i = 0; i < N; ++i) { sizers.push_back (new wxBoxSizer (wxVERTICAL)); overall_sizer->Add (sizers.back (), 1, wxEXPAND | wxALL, 6); diff --git a/src/wx/audio_dialog.cc b/src/wx/audio_dialog.cc index e1ea70ee3..fd523aa02 100644 --- a/src/wx/audio_dialog.cc +++ b/src/wx/audio_dialog.cc @@ -41,7 +41,7 @@ AudioDialog::AudioDialog (wxWindow* parent, shared_ptr film) wxBoxSizer* overall_sizer = new wxBoxSizer (wxVERTICAL); wxBoxSizer* lr_sizer = new wxBoxSizer (wxHORIZONTAL); - + wxBoxSizer* left = new wxBoxSizer (wxVERTICAL); _plot = new AudioPlot (this); @@ -70,7 +70,7 @@ AudioDialog::AudioDialog (wxWindow* parent, shared_ptr film) m->SetFont (subheading_font); right->Add (m, 1, wxALIGN_CENTER_VERTICAL | wxTOP, 16); } - + wxString const types[] = { _("Peak"), _("RMS") @@ -87,7 +87,7 @@ AudioDialog::AudioDialog (wxWindow* parent, shared_ptr film) m->SetFont (subheading_font); right->Add (m, 1, wxALIGN_CENTER_VERTICAL | wxTOP, 16); } - + _smoothing = new wxSlider (this, wxID_ANY, AudioPlot::max_smoothing / 2, 1, AudioPlot::max_smoothing); _smoothing->Bind (wxEVT_SCROLL_THUMBTRACK, boost::bind (&AudioDialog::smoothing_changed, this)); right->Add (_smoothing, 0, wxEXPAND); @@ -96,12 +96,12 @@ AudioDialog::AudioDialog (wxWindow* parent, shared_ptr film) overall_sizer->Add (lr_sizer); -#ifdef DCPOMATIC_LINUX +#ifdef DCPOMATIC_LINUX wxSizer* buttons = CreateSeparatedButtonSizer (wxCLOSE); if (buttons) { overall_sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder()); } -#endif +#endif SetSizer (overall_sizer); overall_sizer->Layout (); @@ -141,12 +141,12 @@ AudioDialog::try_to_load_analysis () JobManager::instance()->add (job); return; } - + _plot->set_analysis (_analysis); setup_peak_time (); /* 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; @@ -177,7 +177,7 @@ AudioDialog::analysis_finished () { shared_ptr film = _film.lock (); DCPOMATIC_ASSERT (film); - + if (!boost::filesystem::exists (film->audio_analysis_path ())) { /* We analysed and still nothing showed up, so maybe it was cancelled or it failed. Give up. @@ -235,14 +235,14 @@ AudioDialog::setup_peak_time () if (!_analysis || !_analysis->peak ()) { return; } - + shared_ptr film = _film.lock (); if (!film) { return; } - + float peak_dB = 20 * log10 (_analysis->peak().get()); - + _peak_time->SetLabel ( wxString::Format ( _("Peak is %.2fdB at %s"), @@ -250,7 +250,7 @@ AudioDialog::setup_peak_time () time_to_timecode (_analysis->peak_time().get(), film->video_frame_rate ()).data () ) ); - + if (peak_dB > -3) { _peak_time->SetForegroundColour (wxColour (255, 0, 0)); } else { @@ -266,4 +266,4 @@ AudioDialog::Show (bool show) return r; } - + diff --git a/src/wx/audio_gain_dialog.cc b/src/wx/audio_gain_dialog.cc index b9b2c1fb7..75a993d8c 100644 --- a/src/wx/audio_gain_dialog.cc +++ b/src/wx/audio_gain_dialog.cc @@ -44,6 +44,6 @@ AudioGainDialog::value () const if (_gain->GetValue() <= -144) { return 0; } - + return pow (10, _gain->GetValue () / 20); } diff --git a/src/wx/audio_gain_dialog.h b/src/wx/audio_gain_dialog.h index 673919c24..e4f8ab16c 100644 --- a/src/wx/audio_gain_dialog.h +++ b/src/wx/audio_gain_dialog.h @@ -27,7 +27,7 @@ public: AudioGainDialog (wxWindow *, int, int, float); float value () const; - + private: wxSpinCtrlDouble* _gain; }; diff --git a/src/wx/audio_mapping_view.cc b/src/wx/audio_mapping_view.cc index fc2caf0f7..809b16bc8 100644 --- a/src/wx/audio_mapping_view.cc +++ b/src/wx/audio_mapping_view.cc @@ -88,7 +88,7 @@ public: } height = max (0, height); - + if (value > 0) { /* Make sure we get a little bit of the marker if there is any gain */ height = max (3, height); @@ -102,7 +102,7 @@ public: { return wxSize (INDICATOR_SIZE + 4, INDICATOR_SIZE + 4); } - + wxGridCellRenderer* Clone () const { return new ValueRenderer; @@ -155,7 +155,7 @@ AudioMappingView::map_values_changed () update_cells (); Changed (_map); _last_tooltip_column = -1; -} +} void AudioMappingView::left_click (wxGridEvent& ev) @@ -165,7 +165,7 @@ AudioMappingView::left_click (wxGridEvent& ev) } int const d = ev.GetCol() - 1; - + if (_map.get (ev.GetRow(), d) > 0) { _map.set (ev.GetRow(), d, 0); } else { @@ -212,13 +212,13 @@ void AudioMappingView::edit () { int const d = _menu_column - 1; - + AudioGainDialog* dialog = new AudioGainDialog (this, _menu_row, _menu_column - 1, _map.get (_menu_row, d)); if (dialog->ShowModal () == wxID_OK) { _map.set (_menu_row, d, dialog->value ()); map_values_changed (); } - + dialog->Destroy (); } @@ -263,7 +263,7 @@ AudioMappingView::update_cells () for (int i = 0; i < _grid->GetNumberRows (); ++i) { row_names.push_back (wx_to_std (_grid->GetCellValue (i, 0))); } - + if (_grid->GetNumberRows ()) { _grid->DeleteRows (0, _grid->GetNumberRows ()); } @@ -275,7 +275,7 @@ AudioMappingView::update_cells () _grid->SetCellRenderer (i, j + 1, new ValueRenderer); } } - + for (int i = 0; i < _map.input_channels(); ++i) { if (i < int (row_names.size ())) { _grid->SetCellValue (i, 0, std_to_wx (row_names[i])); @@ -316,7 +316,7 @@ AudioMappingView::mouse_moved (wxMouseEvent& ev) float const dB = 20 * log10 (gain); s = wxString::Format (_("Audio will be passed from content channel %d to DCP channel %d with gain %.1fdB."), row + 1, column, dB); } - + _grid->GetGridWindow()->SetToolTip (s + " " + _("Right click to change gain.")); _last_tooltip_row = row; _last_tooltip_column = column; diff --git a/src/wx/audio_panel.cc b/src/wx/audio_panel.cc index 006b12398..c31d5b575 100644 --- a/src/wx/audio_panel.cc +++ b/src/wx/audio_panel.cc @@ -54,7 +54,7 @@ AudioPanel::AudioPanel (ContentPanel* p) boost::mem_fn (&AudioContent::audio_gain), boost::mem_fn (&AudioContent::set_audio_gain) ); - + _gain->add (grid, wxGBPosition (r, 1)); add_label_to_grid_bag_sizer (grid, this, _("dB"), false, wxGBPosition (r, 2)); _gain_calculate_button = new wxButton (this, wxID_ANY, _("Calculate...")); @@ -69,7 +69,7 @@ AudioPanel::AudioPanel (ContentPanel* p) boost::mem_fn (&AudioContent::audio_delay), boost::mem_fn (&AudioContent::set_audio_delay) ); - + _delay->add (grid, wxGBPosition (r, 1)); /// TRANSLATORS: this is an abbreviation for milliseconds, the unit of time add_label_to_grid_bag_sizer (grid, this, _("ms"), false, wxGBPosition (r, 2)); @@ -140,7 +140,7 @@ AudioPanel::gain_calculate_button_clicked () d->Destroy (); return; } - + _gain->wrapped()->SetValue ( Config::instance()->cinema_sound_processor()->db_for_fader_change ( d->wanted_fader (), @@ -152,7 +152,7 @@ AudioPanel::gain_calculate_button_clicked () I think. */ _gain->view_changed (); - + d->Destroy (); } diff --git a/src/wx/audio_panel.h b/src/wx/audio_panel.h index edd3dfcd4..2856cec4d 100644 --- a/src/wx/audio_panel.h +++ b/src/wx/audio_panel.h @@ -35,7 +35,7 @@ public: void film_changed (Film::Property); void film_content_changed (int); void content_selection_changed (); - + private: void gain_calculate_button_clicked (); void mapping_changed (AudioMapping); diff --git a/src/wx/audio_plot.cc b/src/wx/audio_plot.cc index 829290d4d..1c5c1f94b 100644 --- a/src/wx/audio_plot.cc +++ b/src/wx/audio_plot.cc @@ -40,9 +40,9 @@ AudioPlot::AudioPlot (wxWindow* parent) : wxPanel (parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE) , _smoothing (max_smoothing / 2) { -#ifndef __WXOSX__ +#ifndef __WXOSX__ SetDoubleBuffered (true); -#endif +#endif for (int i = 0; i < MAX_DCP_AUDIO_CHANNELS; ++i) { _channel_visible[i] = false; @@ -69,10 +69,10 @@ AudioPlot::AudioPlot (wxWindow* parent) #if MAX_DCP_AUDIO_CHANNELS != 12 #warning AudioPlot::AudioPlot is expecting the wrong MAX_DCP_AUDIO_CHANNELS -#endif - +#endif + Bind (wxEVT_PAINT, boost::bind (&AudioPlot::paint, this)); - + SetMinSize (wxSize (640, 512)); } @@ -143,7 +143,7 @@ AudioPlot::paint () gc->GetTextExtent (wxT ("-80dB"), &metrics.db_label_width, &db_label_height, &db_label_descent, &db_label_leading); metrics.db_label_width += 8; - + int const data_width = GetSize().GetWidth() - metrics.db_label_width; /* Assume all channels have the same number of points */ metrics.x_scale = data_width / float (_analysis->points (0)); @@ -162,7 +162,7 @@ AudioPlot::paint () gc->StrokePath (grid); gc->DrawText (_("Time"), data_width, metrics.height - metrics.y_origin + db_label_height / 2); - + if (_type_visible[AudioPoint::PEAK]) { for (int c = 0; c < MAX_DCP_AUDIO_CHANNELS; ++c) { wxGraphicsPath p = gc->CreatePath (); @@ -203,7 +203,7 @@ AudioPlot::y_for_linear (float p, Metrics const & metrics) const if (p < 1e-4) { p = 1e-4; } - + return metrics.height - (20 * log10(p) - _minimum) * metrics.y_scale - metrics.y_origin; } @@ -213,7 +213,7 @@ AudioPlot::plot_peak (wxGraphicsPath& path, int channel, Metrics const & metrics if (_analysis->points (channel) == 0) { return; } - + path.MoveToPoint (metrics.db_label_width, y_for_linear (_analysis->get_point(channel, 0)[AudioPoint::PEAK], metrics)); float peak = 0; @@ -237,7 +237,7 @@ AudioPlot::plot_rms (wxGraphicsPath& path, int channel, Metrics const & metrics) if (_analysis->points (channel) == 0) { return; } - + path.MoveToPoint (metrics.db_label_width, y_for_linear (_analysis->get_point(channel, 0)[AudioPoint::RMS], metrics)); list smoothing; @@ -249,7 +249,7 @@ AudioPlot::plot_rms (wxGraphicsPath& path, int channel, Metrics const & metrics) int const before = _smoothing / 2; int const after = _smoothing - before; - + /* Pre-load the smoothing list */ for (int i = 0; i < before; ++i) { smoothing.push_back (first); diff --git a/src/wx/cinema_dialog.h b/src/wx/cinema_dialog.h index 26520a412..56beaa5bd 100644 --- a/src/wx/cinema_dialog.h +++ b/src/wx/cinema_dialog.h @@ -27,7 +27,7 @@ public: std::string name () const; std::string email () const; - + private: wxTextCtrl* _name; wxTextCtrl* _email; diff --git a/src/wx/colour_conversion_editor.cc b/src/wx/colour_conversion_editor.cc index 549940c00..d82239b79 100644 --- a/src/wx/colour_conversion_editor.cc +++ b/src/wx/colour_conversion_editor.cc @@ -71,9 +71,9 @@ ColourConversionEditor::ColourConversionEditor (wxWindow* parent) _input_B = new wxTextCtrl (this, wxID_ANY, wxT ("")); s->Add (_input_B, 1, wxEXPAND | wxRIGHT, DCPOMATIC_SIZER_GAP); table->Add (s, wxGBPosition (r, 1), wxGBSpan (1, 3)); - } + } ++r; - + wxClientDC dc (parent); wxSize size = dc.GetTextExtent (wxT ("-0.12345678901")); size.SetHeight (-1); @@ -92,7 +92,7 @@ ColourConversionEditor::ColourConversionEditor (wxWindow* parent) /* YUV to RGB conversion */ subhead (table, this, _("YUV to RGB conversion"), r); - + add_label_to_grid_bag_sizer (table, this, _("YUV to RGB matrix"), true, wxGBPosition (r, 0)); _yuv_to_rgb = new wxChoice (this, wxID_ANY); _yuv_to_rgb->Append (_("Rec. 601")); @@ -139,7 +139,7 @@ ColourConversionEditor::ColourConversionEditor (wxWindow* parent) size = dc.GetTextExtent (wxT ("0.12345678")); size.SetHeight (-1); - + wxFlexGridSizer* rgb_to_xyz_sizer = new wxFlexGridSizer (3, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP); for (int i = 0; i < 3; ++i) { for (int j = 0; j < 3; ++j) { @@ -169,7 +169,7 @@ ColourConversionEditor::ColourConversionEditor (wxWindow* parent) size = dc.GetTextExtent (wxT ("0.12345678")); size.SetHeight (-1); - + wxFlexGridSizer* bradford_sizer = new wxFlexGridSizer (3, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP); for (int i = 0; i < 3; ++i) { for (int j = 0; j < 3; ++j) { @@ -180,7 +180,7 @@ ColourConversionEditor::ColourConversionEditor (wxWindow* parent) table->Add (bradford_sizer, wxGBPosition (r - 2, 3), wxGBSpan (2, 1)); subhead (table, this, _("Output gamma correction"), r); - + add_label_to_grid_bag_sizer (table, this, _("Output gamma"), true, wxGBPosition (r, 0)); wxBoxSizer* output_sizer = new wxBoxSizer (wxHORIZONTAL); /// TRANSLATORS: this means the mathematical reciprocal operation, i.e. we are dividing 1 by the control that @@ -300,7 +300,7 @@ ColourConversionEditor::set (ColourConversion conversion) update_rgb_to_xyz (); update_bradford (); - + set_spin_ctrl (_output_gamma, dynamic_pointer_cast (conversion.out ())->gamma ()); } @@ -366,7 +366,7 @@ ColourConversionEditor::changed () _input_threshold->Enable (lin); _input_A->Enable (lin); _input_B->Enable (lin); - + Changed (); } @@ -389,7 +389,7 @@ ColourConversionEditor::update_bradford () { _adjusted_white_x->Enable (_adjust_white->GetValue ()); _adjusted_white_y->Enable (_adjust_white->GetValue ()); - + boost::numeric::ublas::matrix m = get().bradford (); for (int i = 0; i < 3; ++i) { for (int j = 0; j < 3; ++j) { @@ -427,7 +427,7 @@ ColourConversionEditor::changed (wxSpinCtrlDouble* sc) if (fabs (_last_spin_ctrl_value[sc] - sc->GetValue()) < 1e-3) { return; } - + Changed (); } diff --git a/src/wx/colour_conversion_editor.h b/src/wx/colour_conversion_editor.h index b7467a70a..ab45104e9 100644 --- a/src/wx/colour_conversion_editor.h +++ b/src/wx/colour_conversion_editor.h @@ -49,7 +49,7 @@ private: void set_spin_ctrl (wxSpinCtrlDouble *, double); std::map _last_spin_ctrl_value; - + wxSpinCtrlDouble* _input_gamma; wxSpinCtrlDouble* _input_power; wxTextCtrl* _input_threshold; diff --git a/src/wx/config_dialog.cc b/src/wx/config_dialog.cc index 447bb98ce..036172bb7 100644 --- a/src/wx/config_dialog.cc +++ b/src/wx/config_dialog.cc @@ -81,10 +81,10 @@ protected: config_changed (); _panel->Bind (wxEVT_DESTROY, boost::bind (&Page::window_destroyed, this)); - + return _panel; } - + int _border; wxPanel* _panel; @@ -143,13 +143,13 @@ public: : StockPage (Kind_General, panel_size, border) {} -private: +private: void setup () { wxFlexGridSizer* table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP); table->AddGrowableCol (1, 1); _panel->GetSizer()->Add (table, 1, wxALL | wxEXPAND, _border); - + _set_language = new wxCheckBox (_panel, wxID_ANY, _("Set language")); table->Add (_set_language, 1); _language = new wxChoice (_panel, wxID_ANY); @@ -162,14 +162,14 @@ private: _language->Append (wxT ("Svenska")); _language->Append (wxT ("Русский")); table->Add (_language); - + wxStaticText* restart = add_label_to_sizer (table, _panel, _("(restart DCP-o-matic to see language changes)"), false); wxFont font = restart->GetFont(); font.SetStyle (wxFONTSTYLE_ITALIC); font.SetPointSize (font.GetPointSize() - 1); restart->SetFont (font); table->AddSpacer (0); - + add_label_to_sizer (table, _panel, _("Threads to use for encoding on this host"), true); _num_local_encoding_threads = new wxSpinCtrl (_panel); table->Add (_num_local_encoding_threads, 1); @@ -177,14 +177,14 @@ private: _check_for_updates = new wxCheckBox (_panel, wxID_ANY, _("Check for updates on startup")); table->Add (_check_for_updates, 1, wxEXPAND | wxALL); table->AddSpacer (0); - + _check_for_test_updates = new wxCheckBox (_panel, wxID_ANY, _("Check for testing updates as well as stable ones")); table->Add (_check_for_test_updates, 1, wxEXPAND | wxALL); table->AddSpacer (0); _set_language->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&GeneralPage::set_language_changed, this)); _language->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&GeneralPage::language_changed, this)); - + _num_local_encoding_threads->SetRange (1, 128); _num_local_encoding_threads->Bind (wxEVT_COMMAND_SPINCTRL_UPDATED, boost::bind (&GeneralPage::num_local_encoding_threads_changed, this)); @@ -195,9 +195,9 @@ private: void config_changed () { Config* config = Config::instance (); - + checked_set (_set_language, config->language ()); - + if (config->language().get_value_or ("") == "fr") { _language->SetSelection (3); } else if (config->language().get_value_or ("") == "it") { @@ -217,7 +217,7 @@ private: } setup_language_sensitivity (); - + checked_set (_num_local_encoding_threads, config->num_local_encoding_threads ()); checked_set (_check_for_updates, config->check_for_updates ()); checked_set (_check_for_test_updates, config->check_for_test_updates ()); @@ -267,12 +267,12 @@ private: break; } } - + void check_for_updates_changed () { Config::instance()->set_check_for_updates (_check_for_updates->GetValue ()); } - + void check_for_test_updates_changed () { Config::instance()->set_check_for_test_updates (_check_for_test_updates->GetValue ()); @@ -296,26 +296,26 @@ public: DefaultsPage (wxSize panel_size, int border) : StandardPage (panel_size, border) {} - + wxString GetName () const { return _("Defaults"); } -#ifdef DCPOMATIC_OSX +#ifdef DCPOMATIC_OSX wxBitmap GetLargeIcon () const { return wxBitmap ("defaults", wxBITMAP_TYPE_PNG_RESOURCE); } -#endif +#endif -private: +private: void setup () { wxFlexGridSizer* table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP); table->AddGrowableCol (1, 1); _panel->GetSizer()->Add (table, 1, wxALL | wxEXPAND, _border); - + { add_label_to_sizer (table, _panel, _("Default duration of still images"), true); wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL); @@ -324,15 +324,15 @@ private: add_label_to_sizer (s, _panel, _("s"), false); table->Add (s, 1); } - + add_label_to_sizer (table, _panel, _("Default directory for new films"), true); #ifdef DCPOMATIC_USE_OWN_DIR_PICKER _directory = new DirPickerCtrl (_panel); -#else +#else _directory = new wxDirPickerCtrl (_panel, wxDD_DIR_MUST_EXIST); #endif table->Add (_directory, 1, wxEXPAND); - + add_label_to_sizer (table, _panel, _("Default ISDCF name details"), true); _isdcf_metadata_button = new wxButton (_panel, wxID_ANY, _("Edit...")); table->Add (_isdcf_metadata_button); @@ -340,11 +340,11 @@ private: add_label_to_sizer (table, _panel, _("Default container"), true); _container = new wxChoice (_panel, wxID_ANY); table->Add (_container); - + add_label_to_sizer (table, _panel, _("Default content type"), true); _dcp_content_type = new wxChoice (_panel, wxID_ANY); table->Add (_dcp_content_type); - + { add_label_to_sizer (table, _panel, _("Default JPEG2000 bandwidth"), true); wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL); @@ -353,7 +353,7 @@ private: add_label_to_sizer (s, _panel, _("Mbit/s"), false); table->Add (s, 1); } - + { add_label_to_sizer (table, _panel, _("Default audio delay"), true); wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL); @@ -369,28 +369,28 @@ private: _still_length->SetRange (1, 3600); _still_length->Bind (wxEVT_COMMAND_SPINCTRL_UPDATED, boost::bind (&DefaultsPage::still_length_changed, this)); - + _directory->Bind (wxEVT_COMMAND_DIRPICKER_CHANGED, boost::bind (&DefaultsPage::directory_changed, this)); - + _isdcf_metadata_button->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&DefaultsPage::edit_isdcf_metadata_clicked, this)); - + vector ratios = Ratio::all (); for (size_t i = 0; i < ratios.size(); ++i) { _container->Append (std_to_wx (ratios[i]->nickname ())); } - + _container->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&DefaultsPage::container_changed, this)); - + vector const ct = DCPContentType::all (); for (size_t i = 0; i < ct.size(); ++i) { _dcp_content_type->Append (std_to_wx (ct[i]->pretty_name ())); } - + _dcp_content_type->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&DefaultsPage::dcp_content_type_changed, this)); - + _j2k_bandwidth->SetRange (50, 250); _j2k_bandwidth->Bind (wxEVT_COMMAND_SPINCTRL_UPDATED, boost::bind (&DefaultsPage::j2k_bandwidth_changed, this)); - + _audio_delay->SetRange (-1000, 1000); _audio_delay->Bind (wxEVT_COMMAND_SPINCTRL_UPDATED, boost::bind (&DefaultsPage::audio_delay_changed, this)); @@ -414,7 +414,7 @@ private: _dcp_content_type->SetSelection (i); } } - + checked_set (_still_length, config->default_still_length ()); _directory->SetPath (std_to_wx (config->default_directory_or (wx_to_std (wxStandardPaths::Get().GetDocumentsDir())).string ())); checked_set (_j2k_bandwidth, config->default_j2k_bandwidth() / 1000000); @@ -422,12 +422,12 @@ private: checked_set (_audio_delay, config->default_audio_delay ()); checked_set (_issuer, config->dcp_issuer ()); } - + void j2k_bandwidth_changed () { Config::instance()->set_default_j2k_bandwidth (_j2k_bandwidth->GetValue() * 1000000); } - + void audio_delay_changed () { Config::instance()->set_default_audio_delay (_audio_delay->GetValue()); @@ -456,7 +456,7 @@ private: vector ratio = Ratio::all (); Config::instance()->set_default_container (ratio[_container->GetSelection()]); } - + void dcp_content_type_changed () { vector ct = DCPContentType::all (); @@ -467,7 +467,7 @@ private: { Config::instance()->set_dcp_issuer (wx_to_std (_issuer->GetValue ())); } - + wxSpinCtrl* _j2k_bandwidth; wxSpinCtrl* _audio_delay; wxButton* _isdcf_metadata_button; @@ -488,25 +488,25 @@ public: EncodingServersPage (wxSize panel_size, int border) : StandardPage (panel_size, border) {} - + wxString GetName () const { return _("Servers"); } -#ifdef DCPOMATIC_OSX +#ifdef DCPOMATIC_OSX wxBitmap GetLargeIcon () const { return wxBitmap ("servers", wxBITMAP_TYPE_PNG_RESOURCE); } -#endif +#endif -private: +private: void setup () { _use_any_servers = new wxCheckBox (_panel, wxID_ANY, _("Use all servers")); _panel->GetSizer()->Add (_use_any_servers, 0, wxALL, _border); - + vector columns; columns.push_back (wx_to_std (_("IP address / host name"))); _servers_list = new EditableList ( @@ -516,9 +516,9 @@ private: boost::bind (&Config::set_servers, Config::instance(), _1), boost::bind (&EncodingServersPage::server_column, this, _1) ); - + _panel->GetSizer()->Add (_servers_list, 1, wxEXPAND | wxALL, _border); - + _use_any_servers->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&EncodingServersPage::use_any_servers_changed, this)); } @@ -527,7 +527,7 @@ private: checked_set (_use_any_servers, Config::instance()->use_any_servers ()); _servers_list->refresh (); } - + void use_any_servers_changed () { Config::instance()->set_use_any_servers (_use_any_servers->GetValue ()); @@ -559,17 +559,17 @@ public: { return wxBitmap ("keys", wxBITMAP_TYPE_PNG_RESOURCE); } -#endif +#endif private: void setup () { wxStaticText* m = new wxStaticText (_panel, wxID_ANY, _("Certificate chain for signing DCPs and KDMs:")); _panel->GetSizer()->Add (m, 0, wxALL, _border); - + wxBoxSizer* certificates_sizer = new wxBoxSizer (wxHORIZONTAL); _panel->GetSizer()->Add (certificates_sizer, 0, wxLEFT | wxRIGHT, _border); - + _certificates = new wxListCtrl (_panel, wxID_ANY, wxDefaultPosition, wxSize (400, 200), wxLC_REPORT | wxLC_SINGLE_SEL); { @@ -589,7 +589,7 @@ private: wxFont font = ip.GetFont (); font.SetFamily (wxFONTFAMILY_TELETYPE); ip.SetFont (font); - + _certificates->InsertColumn (1, ip); } @@ -608,7 +608,7 @@ private: _panel->GetSizer()->Add (table, 1, wxALL | wxEXPAND, _border); int r = 0; - + _remake_certificates = new wxButton (_panel, wxID_ANY, _("Re-make certificates...")); table->Add (_remake_certificates, wxGBPosition (r, 0), wxGBSpan (1, 3)); ++r; @@ -642,7 +642,7 @@ private: _export_decryption_certificate = new wxButton (_panel, wxID_ANY, _("Export DCP decryption certificate...")); table->Add (_export_decryption_certificate, wxGBPosition (r, 0), wxGBSpan (1, 3)); ++r; - + _add_certificate->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&KeysPage::add_certificate, this)); _remove_certificate->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&KeysPage::remove_certificate, this)); _certificates->Bind (wxEVT_COMMAND_LIST_ITEM_SELECTED, boost::bind (&KeysPage::update_sensitivity, this)); @@ -664,11 +664,11 @@ private: update_decryption_private_key (); update_sensitivity (); } - + void add_certificate () { wxFileDialog* d = new wxFileDialog (_panel, _("Select Certificate File")); - + if (d->ShowModal() == wxID_OK) { try { dcp::Certificate c (dcp::file_to_string (wx_to_std (d->GetPath ()))); @@ -679,7 +679,7 @@ private: error_dialog (_panel, wxString::Format (_("Could not read certificate file (%s)"), e.what ())); } } - + d->Destroy (); update_sensitivity (); @@ -691,7 +691,7 @@ private: if (i == -1) { return; } - + _certificates->DeleteItem (i); _signer->certificates().remove (i); Config::instance()->set_signer (_signer); @@ -741,7 +741,7 @@ private: update_certificate_list (); update_signer_private_key (); } - + d->Destroy (); } @@ -753,7 +753,7 @@ private: void update_signer_private_key () { checked_set (_signer_private_key, dcp::private_key_fingerprint (_signer->key ())); - } + } void load_signer_private_key () { @@ -766,7 +766,7 @@ private: error_dialog (_panel, wxString::Format (_("Could not read key file (%s)"), std_to_wx (p.string ()))); return; } - + _signer->set_key (dcp::file_to_string (p)); Config::instance()->set_signer (_signer); update_signer_private_key (); @@ -774,7 +774,7 @@ private: error_dialog (_panel, wxString::Format (_("Could not read certificate file (%s)"), e.what ())); } } - + d->Destroy (); update_sensitivity (); @@ -784,7 +784,7 @@ private: void load_decryption_certificate () { wxFileDialog* d = new wxFileDialog (_panel, _("Select Certificate File")); - + if (d->ShowModal() == wxID_OK) { try { dcp::Certificate c (dcp::file_to_string (wx_to_std (d->GetPath ()))); @@ -794,7 +794,7 @@ private: error_dialog (_panel, wxString::Format (_("Could not read certificate file (%s)"), e.what ())); } } - + d->Destroy (); } @@ -816,7 +816,7 @@ private: error_dialog (_panel, wxString::Format (_("Could not read key file (%s)"), e.what ())); } } - + d->Destroy (); } @@ -831,7 +831,7 @@ private: _panel, _("Select Certificate File"), wxEmptyString, wxEmptyString, wxT ("PEM files (*.pem)|*.pem"), wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); - + if (d->ShowModal () == wxID_OK) { FILE* f = fopen_boost (wx_to_std (d->GetPath ()), "w"); if (!f) { @@ -871,36 +871,36 @@ public: return _("TMS"); } -#ifdef DCPOMATIC_OSX +#ifdef DCPOMATIC_OSX wxBitmap GetLargeIcon () const { return wxBitmap ("tms", wxBITMAP_TYPE_PNG_RESOURCE); } -#endif +#endif -private: +private: void setup () { wxFlexGridSizer* table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP); table->AddGrowableCol (1, 1); _panel->GetSizer()->Add (table, 1, wxALL | wxEXPAND, _border); - + add_label_to_sizer (table, _panel, _("IP address"), true); _tms_ip = new wxTextCtrl (_panel, wxID_ANY); table->Add (_tms_ip, 1, wxEXPAND); - + add_label_to_sizer (table, _panel, _("Target path"), true); _tms_path = new wxTextCtrl (_panel, wxID_ANY); table->Add (_tms_path, 1, wxEXPAND); - + add_label_to_sizer (table, _panel, _("User name"), true); _tms_user = new wxTextCtrl (_panel, wxID_ANY); table->Add (_tms_user, 1, wxEXPAND); - + add_label_to_sizer (table, _panel, _("Password"), true); _tms_password = new wxTextCtrl (_panel, wxID_ANY); table->Add (_tms_password, 1, wxEXPAND); - + _tms_ip->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&TMSPage::tms_ip_changed, this)); _tms_path->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&TMSPage::tms_path_changed, this)); _tms_user->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&TMSPage::tms_user_changed, this)); @@ -910,28 +910,28 @@ private: void config_changed () { Config* config = Config::instance (); - + checked_set (_tms_ip, config->tms_ip ()); checked_set (_tms_path, config->tms_path ()); checked_set (_tms_user, config->tms_user ()); checked_set (_tms_password, config->tms_password ()); } - + void tms_ip_changed () { Config::instance()->set_tms_ip (wx_to_std (_tms_ip->GetValue ())); } - + void tms_path_changed () { Config::instance()->set_tms_path (wx_to_std (_tms_path->GetValue ())); } - + void tms_user_changed () { Config::instance()->set_tms_user (wx_to_std (_tms_user->GetValue ())); } - + void tms_password_changed () { Config::instance()->set_tms_password (wx_to_std (_tms_password->GetValue ())); @@ -948,27 +948,27 @@ class KDMEmailPage : public StandardPage public: KDMEmailPage (wxSize panel_size, int border) -#ifdef DCPOMATIC_OSX +#ifdef DCPOMATIC_OSX /* We have to force both width and height of this one */ : StandardPage (wxSize (480, 128), border) #else : StandardPage (panel_size, border) -#endif +#endif {} - + wxString GetName () const { return _("KDM Email"); } -#ifdef DCPOMATIC_OSX +#ifdef DCPOMATIC_OSX wxBitmap GetLargeIcon () const { return wxBitmap ("kdm_email", wxBITMAP_TYPE_PNG_RESOURCE); } -#endif +#endif -private: +private: void setup () { wxFlexGridSizer* table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP); @@ -978,15 +978,15 @@ private: add_label_to_sizer (table, _panel, _("Outgoing mail server"), true); _mail_server = new wxTextCtrl (_panel, wxID_ANY); table->Add (_mail_server, 1, wxEXPAND | wxALL); - + add_label_to_sizer (table, _panel, _("Mail user name"), true); _mail_user = new wxTextCtrl (_panel, wxID_ANY); table->Add (_mail_user, 1, wxEXPAND | wxALL); - + add_label_to_sizer (table, _panel, _("Mail password"), true); _mail_password = new wxTextCtrl (_panel, wxID_ANY); table->Add (_mail_password, 1, wxEXPAND | wxALL); - + wxStaticText* plain = add_label_to_sizer (table, _panel, _("(password will be stored on disk in plaintext)"), false); wxFont font = plain->GetFont(); font.SetStyle (wxFONTSTYLE_ITALIC); @@ -997,7 +997,7 @@ private: add_label_to_sizer (table, _panel, _("Subject"), true); _kdm_subject = new wxTextCtrl (_panel, wxID_ANY); table->Add (_kdm_subject, 1, wxEXPAND | wxALL); - + add_label_to_sizer (table, _panel, _("From address"), true); _kdm_from = new wxTextCtrl (_panel, wxID_ANY); table->Add (_kdm_from, 1, wxEXPAND | wxALL); @@ -1009,7 +1009,7 @@ private: add_label_to_sizer (table, _panel, _("BCC address"), true); _kdm_bcc = new wxTextCtrl (_panel, wxID_ANY); table->Add (_kdm_bcc, 1, wxEXPAND | wxALL); - + _kdm_email = new wxTextCtrl (_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize (480, 128), wxTE_MULTILINE); _panel->GetSizer()->Add (_kdm_email, 1, wxEXPAND | wxALL, _border); @@ -1030,7 +1030,7 @@ private: void config_changed () { Config* config = Config::instance (); - + checked_set (_mail_server, config->mail_server ()); checked_set (_mail_user, config->mail_user ()); checked_set (_mail_password, config->mail_password ()); @@ -1040,17 +1040,17 @@ private: checked_set (_kdm_bcc, config->kdm_bcc ()); checked_set (_kdm_email, Config::instance()->kdm_email ()); } - + void mail_server_changed () { Config::instance()->set_mail_server (wx_to_std (_mail_server->GetValue ())); } - + void mail_user_changed () { Config::instance()->set_mail_user (wx_to_std (_mail_user->GetValue ())); } - + void mail_password_changed () { Config::instance()->set_mail_password (wx_to_std (_mail_password->GetValue ())); @@ -1060,7 +1060,7 @@ private: { Config::instance()->set_kdm_subject (wx_to_std (_kdm_subject->GetValue ())); } - + void kdm_from_changed () { Config::instance()->set_kdm_from (wx_to_std (_kdm_from->GetValue ())); @@ -1075,7 +1075,7 @@ private: { Config::instance()->set_kdm_bcc (wx_to_std (_kdm_bcc->GetValue ())); } - + void kdm_email_changed () { if (_kdm_email->GetValue().IsEmpty ()) { @@ -1120,7 +1120,7 @@ public: , _log_timing (0) {} -private: +private: void setup () { wxFlexGridSizer* table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP); @@ -1143,11 +1143,11 @@ private: #ifdef __WXOSX__ wxStaticText* m = new wxStaticText (_panel, wxID_ANY, _("Log:")); table->Add (m, 0, wxALIGN_TOP | wxLEFT | wxRIGHT | wxEXPAND | wxALL | wxALIGN_RIGHT, 6); -#else +#else wxStaticText* m = new wxStaticText (_panel, wxID_ANY, _("Log")); table->Add (m, 0, wxALIGN_TOP | wxLEFT | wxRIGHT | wxEXPAND | wxALL, 6); -#endif - +#endif + { wxBoxSizer* t = new wxBoxSizer (wxVERTICAL); _log_general = new wxCheckBox (_panel, wxID_ANY, _("General")); @@ -1161,12 +1161,12 @@ private: table->Add (t, 0, wxALL, 6); } -#ifdef DCPOMATIC_WINDOWS +#ifdef DCPOMATIC_WINDOWS _win32_console = new wxCheckBox (_panel, wxID_ANY, _("Open console window")); table->Add (_win32_console, 1, wxEXPAND | wxALL); table->AddSpacer (0); -#endif - +#endif + _maximum_j2k_bandwidth->SetRange (1, 1000); _maximum_j2k_bandwidth->Bind (wxEVT_COMMAND_SPINCTRL_UPDATED, boost::bind (&AdvancedPage::maximum_j2k_bandwidth_changed, this)); _allow_any_dcp_frame_rate->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&AdvancedPage::allow_any_dcp_frame_rate_changed, this)); @@ -1176,13 +1176,13 @@ private: _log_timing->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&AdvancedPage::log_changed, this)); #ifdef DCPOMATIC_WINDOWS _win32_console->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&AdvancedPage::win32_console_changed, this)); -#endif +#endif } void config_changed () { Config* config = Config::instance (); - + checked_set (_maximum_j2k_bandwidth, config->maximum_j2k_bandwidth() / 1000000); checked_set (_allow_any_dcp_frame_rate, config->allow_any_dcp_frame_rate ()); checked_set (_log_general, config->log_types() & Log::TYPE_GENERAL); @@ -1222,24 +1222,24 @@ private: Config::instance()->set_log_types (types); } -#ifdef DCPOMATIC_WINDOWS +#ifdef DCPOMATIC_WINDOWS void win32_console_changed () { Config::instance()->set_win32_console (_win32_console->GetValue ()); } -#endif - +#endif + wxSpinCtrl* _maximum_j2k_bandwidth; wxCheckBox* _allow_any_dcp_frame_rate; wxCheckBox* _log_general; wxCheckBox* _log_warning; wxCheckBox* _log_error; wxCheckBox* _log_timing; -#ifdef DCPOMATIC_WINDOWS +#ifdef DCPOMATIC_WINDOWS wxCheckBox* _win32_console; -#endif +#endif }; - + wxPreferencesEditor* create_config_dialog () { @@ -1256,7 +1256,7 @@ create_config_dialog () wxSize ps = wxSize (-1, -1); int const border = 8; #endif - + e->AddPage (new GeneralPage (ps, border)); e->AddPage (new DefaultsPage (ps, border)); e->AddPage (new EncodingServersPage (ps, border)); diff --git a/src/wx/content_colour_conversion_dialog.cc b/src/wx/content_colour_conversion_dialog.cc index 20cbaa02d..45d19d78d 100644 --- a/src/wx/content_colour_conversion_dialog.cc +++ b/src/wx/content_colour_conversion_dialog.cc @@ -89,7 +89,7 @@ ContentColourConversionDialog::check_for_preset () if (_setting) { return; } - + optional preset = _editor->get().preset (); _preset_check->SetValue (preset); @@ -123,4 +123,4 @@ ContentColourConversionDialog::preset_choice_changed () } } - + diff --git a/src/wx/content_colour_conversion_dialog.h b/src/wx/content_colour_conversion_dialog.h index 57fd5f1e5..407f3f0c8 100644 --- a/src/wx/content_colour_conversion_dialog.h +++ b/src/wx/content_colour_conversion_dialog.h @@ -33,7 +33,7 @@ private: void check_for_preset (); void preset_check_clicked (); void preset_choice_changed (); - + wxCheckBox* _preset_check; wxChoice* _preset_choice; ColourConversionEditor* _editor; diff --git a/src/wx/content_menu.cc b/src/wx/content_menu.cc index 3cf9f23dc..0adbc775a 100644 --- a/src/wx/content_menu.cc +++ b/src/wx/content_menu.cc @@ -91,9 +91,9 @@ ContentMenu::popup (weak_ptr film, ContentList c, TimelineContentViewList ++n; } } - + _join->Enable (n > 1); - + _find_missing->Enable (_content.size() == 1 && !_content.front()->paths_valid ()); _properties->Enable (_content.size() == 1); _re_examine->Enable (!_content.empty ()); @@ -104,7 +104,7 @@ ContentMenu::popup (weak_ptr film, ContentList c, TimelineContentViewList } else { _kdm->Enable (false); } - + _remove->Enable (!_content.empty ()); _parent->PopupMenu (_menu, p); } @@ -115,7 +115,7 @@ ContentMenu::repeat () if (_content.empty ()) { return; } - + RepeatDialog* d = new RepeatDialog (_parent); if (d->ShowModal() != wxID_OK) { d->Destroy (); @@ -186,7 +186,7 @@ ContentMenu::remove () if (!fc) { continue; } - + shared_ptr video; shared_ptr audio; @@ -228,7 +228,7 @@ ContentMenu::find_missing () if (!film) { return; } - + shared_ptr content; /* XXX: a bit nasty */ @@ -254,7 +254,7 @@ ContentMenu::find_missing () } shared_ptr j (new ExamineContentJob (film, content)); - + _job_connection = j->Finished.connect ( bind ( &ContentMenu::maybe_found_missing, @@ -264,7 +264,7 @@ ContentMenu::find_missing () boost::weak_ptr (content) ) ); - + JobManager::instance()->add (j); } @@ -308,16 +308,16 @@ ContentMenu::kdm () DCPOMATIC_ASSERT (!_content.empty ()); shared_ptr dcp = dynamic_pointer_cast (_content.front ()); DCPOMATIC_ASSERT (dcp); - + wxFileDialog* d = new wxFileDialog (_parent, _("Select KDM")); - + if (d->ShowModal() == wxID_OK) { dcp->add_kdm (dcp::EncryptedKDM (dcp::file_to_string (wx_to_std (d->GetPath ())))); shared_ptr film = _film.lock (); DCPOMATIC_ASSERT (film); film->examine_content (dcp); } - + d->Destroy (); } diff --git a/src/wx/content_menu.h b/src/wx/content_menu.h index a0ac3f481..054e3de3e 100644 --- a/src/wx/content_menu.h +++ b/src/wx/content_menu.h @@ -34,7 +34,7 @@ class ContentMenu : public boost::noncopyable public: ContentMenu (wxWindow* p); ~ContentMenu (); - + void popup (boost::weak_ptr, ContentList, TimelineContentViewList, wxPoint); private: @@ -46,7 +46,7 @@ private: void kdm (); void remove (); void maybe_found_missing (boost::weak_ptr, boost::weak_ptr, boost::weak_ptr); - + wxMenu* _menu; /** Film that we are working with; set up by popup() */ boost::weak_ptr _film; diff --git a/src/wx/content_panel.cc b/src/wx/content_panel.cc index 8bb251251..a578c1628 100644 --- a/src/wx/content_panel.cc +++ b/src/wx/content_panel.cc @@ -61,7 +61,7 @@ ContentPanel::ContentPanel (wxNotebook* n, boost::shared_ptr film, FilmVie { wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL); - + _content = new wxListCtrl (_panel, wxID_ANY, wxDefaultPosition, wxSize (320, 160), wxLC_REPORT | wxLC_NO_HEADER); _content->DragAcceptFiles (true); s->Add (_content, 1, wxEXPAND | wxTOP | wxBOTTOM, 6); @@ -70,27 +70,27 @@ ContentPanel::ContentPanel (wxNotebook* n, boost::shared_ptr film, FilmVie _content->SetColumnWidth (0, 512); wxBoxSizer* b = new wxBoxSizer (wxVERTICAL); - + _add_file = new wxButton (_panel, wxID_ANY, _("Add file(s)...")); _add_file->SetToolTip (_("Add video, image or sound files to the film.")); b->Add (_add_file, 0, wxEXPAND | wxALL, DCPOMATIC_BUTTON_STACK_GAP); - + _add_folder = new wxButton (_panel, wxID_ANY, _("Add folder...")); _add_folder->SetToolTip (_("Add a folder of image files (which will be used as a moving image sequence) or a DCP.")); b->Add (_add_folder, 1, wxEXPAND | wxALL, DCPOMATIC_BUTTON_STACK_GAP); - + _remove = new wxButton (_panel, wxID_ANY, _("Remove")); _remove->SetToolTip (_("Remove the selected piece of content from the film.")); b->Add (_remove, 0, wxEXPAND | wxALL, DCPOMATIC_BUTTON_STACK_GAP); - + _earlier = new wxButton (_panel, wxID_ANY, _("Up")); _earlier->SetToolTip (_("Move the selected piece of content earlier in the film.")); b->Add (_earlier, 0, wxEXPAND | wxALL, DCPOMATIC_BUTTON_STACK_GAP); - + _later = new wxButton (_panel, wxID_ANY, _("Down")); _later->SetToolTip (_("Move the selected piece of content later in the film.")); b->Add (_later, 0, wxEXPAND | wxALL, DCPOMATIC_BUTTON_STACK_GAP); - + _timeline = new wxButton (_panel, wxID_ANY, _("Timeline...")); _timeline->SetToolTip (_("Open the timeline for the film.")); b->Add (_timeline, 0, wxEXPAND | wxALL, DCPOMATIC_BUTTON_STACK_GAP); @@ -148,7 +148,7 @@ ContentPanel::selected_video () { ContentList c = selected (); VideoContentList vc; - + for (ContentList::iterator i = c.begin(); i != c.end(); ++i) { shared_ptr t = dynamic_pointer_cast (*i); if (t) { @@ -164,7 +164,7 @@ ContentPanel::selected_audio () { ContentList c = selected (); AudioContentList ac; - + for (ContentList::iterator i = c.begin(); i != c.end(); ++i) { shared_ptr t = dynamic_pointer_cast (*i); if (t) { @@ -180,7 +180,7 @@ ContentPanel::selected_subtitle () { ContentList c = selected (); SubtitleContentList sc; - + for (ContentList::iterator i = c.begin(); i != c.end(); ++i) { shared_ptr t = dynamic_pointer_cast (*i); if (t) { @@ -196,7 +196,7 @@ ContentPanel::selected_ffmpeg () { ContentList c = selected (); FFmpegContentList sc; - + for (ContentList::iterator i = c.begin(); i != c.end(); ++i) { shared_ptr t = dynamic_pointer_cast (*i); if (t) { @@ -221,7 +221,7 @@ ContentPanel::film_changed (Film::Property p) for (list::iterator i = _panels.begin(); i != _panels.end(); ++i) { (*i)->film_changed (p); } -} +} void ContentPanel::selection_changed () @@ -265,7 +265,7 @@ ContentPanel::add_folder_clicked () int r = d->ShowModal (); boost::filesystem::path const path (wx_to_std (d->GetPath ())); d->Destroy (); - + if (r != wxID_OK) { return; } @@ -290,7 +290,7 @@ ContentPanel::add_folder_clicked () error_dialog (_panel, _("Could not find a DCP nor a set of images in that folder.")); } } else { - + ImageSequenceDialog* e = new ImageSequenceDialog (_panel); r = e->ShowModal (); float const frame_rate = e->frame_rate (); @@ -301,7 +301,7 @@ ContentPanel::add_folder_clicked () } shared_ptr content; - + try { shared_ptr content (new ImageContent (_film, path)); content->set_video_frame_rate (frame_rate); @@ -331,7 +331,7 @@ ContentPanel::timeline_clicked () _timeline_dialog->Destroy (); _timeline_dialog = 0; } - + _timeline_dialog = new TimelineDialog (this, _film); _timeline_dialog->Show (); } @@ -432,7 +432,7 @@ ContentPanel::film_content_changed (int property) if (property == ContentProperty::PATH || property == ContentProperty::POSITION || property == DCPContentProperty::CAN_BE_PLAYED) { setup (); } - + for (list::iterator i = _panels.begin(); i != _panels.end(); ++i) { (*i)->film_content_changed (property); } @@ -443,7 +443,7 @@ ContentPanel::setup () { ContentList content = _film->content (); sort (content.begin(), content.end(), ContentSorter ()); - + /* First, check to see if anything has changed and bail if not; this avoids flickering on OS X. */ @@ -461,22 +461,22 @@ ContentPanel::setup () if (!valid) { s = _("MISSING: ") + s; } - + proposed.push_back (s); } - + if (existing == proposed) { return; } - + /* Something has changed: set up the control */ - + string selected_summary; int const s = _content->GetNextItem (-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); if (s != -1) { selected_summary = wx_to_std (_content->GetItemText (s)); } - + _content->DeleteAllItems (); for (ContentList::iterator i = content.begin(); i != content.end(); ++i) { @@ -486,7 +486,7 @@ ContentPanel::setup () bool const needs_kdm = dcp && !dcp->can_be_played (); string s = (*i)->summary (); - + if (!valid) { s = _("MISSING: ") + s; } @@ -518,7 +518,7 @@ ContentPanel::files_dropped (wxDropFilesEvent& event) if (!_film) { return; } - + wxString* paths = event.GetFiles (); list path_list; for (int i = 0; i < event.GetNumberOfFiles(); i++) { @@ -534,7 +534,7 @@ ContentPanel::add_files (list paths) /* It has been reported that the paths returned from e.g. wxFileDialog are not always sorted; I can't reproduce that, but sort them anyway. */ - + paths.sort (ImageFilenameSorter ()); /* XXX: check for lots of files here and do something */ diff --git a/src/wx/content_panel.h b/src/wx/content_panel.h index bb7353a9b..452d4a4f8 100644 --- a/src/wx/content_panel.h +++ b/src/wx/content_panel.h @@ -65,8 +65,8 @@ public: FFmpegContentList selected_ffmpeg (); void add_file_clicked (); - -private: + +private: void selection_changed (); void add_folder_clicked (); void remove_clicked (); diff --git a/src/wx/content_properties_dialog.cc b/src/wx/content_properties_dialog.cc index feb2c6a46..7fb0cccba 100644 --- a/src/wx/content_properties_dialog.cc +++ b/src/wx/content_properties_dialog.cc @@ -54,7 +54,7 @@ ContentPropertiesDialog::ContentPropertiesDialog (wxWindow* parent, shared_ptr single = dynamic_pointer_cast (content); if (single) { add_property ( @@ -62,7 +62,7 @@ ContentPropertiesDialog::ContentPropertiesDialog (wxWindow* parent, shared_ptr (single->audio_stream()->channels ())) ); } - + layout (); } diff --git a/src/wx/content_widget.h b/src/wx/content_widget.h index 6f406dadb..3fa1f0ddc 100644 --- a/src/wx/content_widget.h +++ b/src/wx/content_widget.h @@ -90,7 +90,7 @@ public: } _connections.clear (); - + _content = content; _wrapped->Enable (!_content.empty ()); @@ -141,9 +141,9 @@ public: } _ignore_model_changes = false; } - + private: - + void set_single () { if (_wrapped->IsShown ()) { @@ -162,7 +162,7 @@ private: if (_button->IsShown ()) { return; } - + _wrapped->Hide (); _sizer->Detach (_wrapped); _button->Show (); @@ -184,7 +184,7 @@ private: update_from_model (); } } - + T* _wrapped; wxGridBagSizer* _sizer; wxGBPosition _position; diff --git a/src/wx/dcp_panel.cc b/src/wx/dcp_panel.cc index 11db3466f..0f5ec5afc 100644 --- a/src/wx/dcp_panel.cc +++ b/src/wx/dcp_panel.cc @@ -61,16 +61,16 @@ DCPPanel::DCPPanel (wxNotebook* n, boost::shared_ptr film) _sizer->Add (grid, 0, wxEXPAND | wxALL, 8); int r = 0; - + add_label_to_grid_bag_sizer (grid, _panel, _("Name"), true, wxGBPosition (r, 0)); _name = new wxTextCtrl (_panel, wxID_ANY); grid->Add (_name, wxGBPosition(r, 1), wxDefaultSpan, wxEXPAND | wxLEFT | wxRIGHT); ++r; - + int flags = wxALIGN_CENTER_VERTICAL; #ifdef __WXOSX__ flags |= wxALIGN_RIGHT; -#endif +#endif _use_isdcf_name = new wxCheckBox (_panel, wxID_ANY, _("Use ISDCF name")); grid->Add (_use_isdcf_name, wxGBPosition (r, 0), wxDefaultSpan, flags); @@ -106,11 +106,11 @@ DCPPanel::DCPPanel (wxNotebook* n, boost::shared_ptr film) _notebook->AddPage (make_video_panel (), _("Video"), false); _notebook->AddPage (make_audio_panel (), _("Audio"), false); - + _signed = new wxCheckBox (_panel, wxID_ANY, _("Signed")); grid->Add (_signed, wxGBPosition (r, 0), wxGBSpan (1, 2)); ++r; - + _encrypted = new wxCheckBox (_panel, wxID_ANY, _("Encrypted")); grid->Add (_encrypted, wxGBPosition (r, 0), wxGBSpan (1, 2)); ++r; @@ -129,7 +129,7 @@ DCPPanel::DCPPanel (wxNotebook* n, boost::shared_ptr film) grid->Add (s, wxGBPosition (r, 1)); ++r; } - + add_label_to_grid_bag_sizer (grid, _panel, _("Standard"), true, wxGBPosition (r, 0)); _standard = new wxChoice (_panel, wxID_ANY); grid->Add (_standard, wxGBPosition (r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL); @@ -182,7 +182,7 @@ DCPPanel::j2k_bandwidth_changed () if (!_film) { return; } - + _film->set_j2k_bandwidth (_j2k_bandwidth->GetValue() * 1000000); } @@ -215,7 +215,7 @@ DCPPanel::encrypted_toggled () _film->set_encrypted (_encrypted->GetValue ()); } - + /** Called when the frame rate choice widget has been changed */ void DCPPanel::frame_rate_choice_changed () @@ -400,7 +400,7 @@ DCPPanel::setup_container () ++i; ++n; } - + if (i == ratios.end()) { checked_set (_container, -1); checked_set (_container_size, wxT ("")); @@ -409,9 +409,9 @@ DCPPanel::setup_container () dcp::Size const size = fit_ratio_within (_film->container()->ratio(), _film->full_frame ()); checked_set (_container_size, wxString::Format ("%dx%d", size.width, size.height)); } - + setup_dcp_name (); -} +} /** Called when the container widget has been changed */ void @@ -447,7 +447,7 @@ void DCPPanel::set_film (shared_ptr film) { _film = film; - + film_changed (Film::NAME); film_changed (Film::USE_ISDCF_NAME); film_changed (Film::CONTENT); @@ -483,7 +483,7 @@ DCPPanel::set_general_sensitivity (bool s) } _burn_subtitles->Enable (s); _signed->Enable (si); - + _encrypted->Enable (s); _key->Enable (s && _film && _film->encrypted ()); _edit_key->Enable (s && _film && _film->encrypted ()); @@ -534,7 +534,7 @@ DCPPanel::best_frame_rate_clicked () if (!_film) { return; } - + _film->set_video_frame_rate (_film->best_video_frame_rate ()); } @@ -579,7 +579,7 @@ DCPPanel::make_video_panel () panel->SetSizer (sizer); int r = 0; - + add_label_to_grid_bag_sizer (grid, panel, _("Container"), true, wxGBPosition (r, 0)); { wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL); @@ -671,7 +671,7 @@ DCPPanel::minimum_allowed_audio_channels () const } return min; -} +} void DCPPanel::setup_audio_channels_choice () @@ -694,7 +694,7 @@ DCPPanel::make_audio_panel () panel->SetSizer (sizer); int r = 0; - + add_label_to_grid_bag_sizer (grid, panel, _("Channels"), true, wxGBPosition (r, 0)); _audio_channels = new wxChoice (panel, wxID_ANY); setup_audio_channels_choice (); @@ -750,7 +750,7 @@ DCPPanel::show_audio_clicked () _audio_dialog->Destroy (); _audio_dialog = 0; } - + AudioDialog* d = new AudioDialog (_panel, _film); d->Show (); } diff --git a/src/wx/dcp_panel.h b/src/wx/dcp_panel.h index ac6792ddd..055de67a6 100644 --- a/src/wx/dcp_panel.h +++ b/src/wx/dcp_panel.h @@ -72,7 +72,7 @@ private: void edit_key_clicked (); void audio_processor_changed (); void show_audio_clicked (); - + void setup_frame_rate_widget (); void setup_container (); void setup_dcp_name (); diff --git a/src/wx/dir_picker_ctrl.cc b/src/wx/dir_picker_ctrl.cc index fad545283..fe4937edf 100644 --- a/src/wx/dir_picker_ctrl.cc +++ b/src/wx/dir_picker_ctrl.cc @@ -46,7 +46,7 @@ void DirPickerCtrl::SetPath (wxString p) { _path = p; - + if (_path == wxStandardPaths::Get().GetDocumentsDir()) { _folder->SetLabel (_("My Documents")); } else { diff --git a/src/wx/dir_picker_ctrl.h b/src/wx/dir_picker_ctrl.h index 8d596cefc..df6cbffa6 100644 --- a/src/wx/dir_picker_ctrl.h +++ b/src/wx/dir_picker_ctrl.h @@ -29,7 +29,7 @@ public: private: void browse_clicked (); - + wxStaticText* _folder; wxButton* _browse; wxString _path; diff --git a/src/wx/dolby_certificate_dialog.cc b/src/wx/dolby_certificate_dialog.cc index ad43f6479..49c2f01d7 100644 --- a/src/wx/dolby_certificate_dialog.cc +++ b/src/wx/dolby_certificate_dialog.cc @@ -39,7 +39,7 @@ DolbyCertificateDialog::DolbyCertificateDialog (wxWindow* parent, boost::functio add (_("Country"), true); _country = add (new wxChoice (this, wxID_ANY)); _country->Append (N_("Hashemite Kingdom of Jordan")); - + add (_("Cinema"), true); _cinema = add (new wxChoice (this, wxID_ANY)); _cinema->Append (N_("Motion Picture Solutions London Mobile & QC")); @@ -72,7 +72,7 @@ DolbyCertificateDialog::setup_countries () /* Already set up */ return; } - + _country->Append (_("Fetching...")); _country->SetSelection (0); @@ -102,7 +102,7 @@ DolbyCertificateDialog::country_selected () #ifdef DCPOMATIC_OSX wxMilliSleep (200); -#endif +#endif signal_manager->when_idle (boost::bind (&DolbyCertificateDialog::finish_country_selected, this)); } diff --git a/src/wx/doremi_certificate_dialog.cc b/src/wx/doremi_certificate_dialog.cc index 578a7a72d..74f19fcc9 100644 --- a/src/wx/doremi_certificate_dialog.cc +++ b/src/wx/doremi_certificate_dialog.cc @@ -54,10 +54,10 @@ DoremiCertificateDialog::download () downloaded (false); _message->SetLabel (_("Downloading certificate")); -#ifdef DCPOMATIC_OSX +#ifdef DCPOMATIC_OSX /* This is necessary on OS X, otherwise the SetLabel() above has no visible effect */ wxMilliSleep (200); -#endif +#endif signal_manager->when_idle (boost::bind (&DoremiCertificateDialog::finish_download, this, serial)); } diff --git a/src/wx/download_certificate_dialog.cc b/src/wx/download_certificate_dialog.cc index a0c41fd76..90d383298 100644 --- a/src/wx/download_certificate_dialog.cc +++ b/src/wx/download_certificate_dialog.cc @@ -45,7 +45,7 @@ DownloadCertificateDialog::add_common_widgets () font.SetStyle (wxFONTSTYLE_ITALIC); font.SetPointSize (font.GetPointSize() - 1); _message->SetFont (font); - + _download->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&DownloadCertificateDialog::download, this)); _download->Enable (false); @@ -62,4 +62,4 @@ DownloadCertificateDialog::downloaded (bool done) ok->Enable (done); } - + diff --git a/src/wx/download_certificate_dialog.h b/src/wx/download_certificate_dialog.h index 40e11de45..85d8f15ab 100644 --- a/src/wx/download_certificate_dialog.h +++ b/src/wx/download_certificate_dialog.h @@ -33,7 +33,7 @@ public: protected: void add_common_widgets (); void downloaded (bool done); - + boost::function _load; wxStaticText* _message; wxButton* _download; diff --git a/src/wx/editable_list.h b/src/wx/editable_list.h index c6cb28a45..be79f67e6 100644 --- a/src/wx/editable_list.h +++ b/src/wx/editable_list.h @@ -85,14 +85,14 @@ public: void refresh () { _list->DeleteAllItems (); - + std::vector current = _get (); for (typename std::vector::iterator i = current.begin (); i != current.end(); ++i) { add_to_control (*i); } - } + } -private: +private: void add_to_control (T item) { @@ -121,11 +121,11 @@ private: dialog->ShowModal (); add_to_control (dialog->get ()); - + std::vector all = _get (); all.push_back (dialog->get ()); _set (all); - + dialog->Destroy (); } @@ -141,7 +141,7 @@ private: T copy (all[item]); add_to_control (copy); - + all.push_back (copy); _set (all); } @@ -161,7 +161,7 @@ private: dialog->ShowModal (); all[item] = dialog->get (); dialog->Destroy (); - + for (int i = 0; i < _columns; ++i) { _list->SetItem (item, i, std_to_wx (_column (all[item], i))); } @@ -175,7 +175,7 @@ private: if (i == -1) { return; } - + _list->DeleteItem (i); std::vector all = _get (); all.erase (all.begin() + i); diff --git a/src/wx/film_editor.cc b/src/wx/film_editor.cc index ce3791faa..545eaf56e 100644 --- a/src/wx/film_editor.cc +++ b/src/wx/film_editor.cc @@ -49,7 +49,7 @@ FilmEditor::FilmEditor (wxWindow* parent, FilmViewer* viewer) _main_notebook->AddPage (_content_panel->panel (), _("Content"), true); _dcp_panel = new DCPPanel (_main_notebook, _film); _main_notebook->AddPage (_dcp_panel->panel (), _("DCP"), false); - + JobManager::instance()->ActiveJobsChanged.connect ( bind (&FilmEditor::active_jobs_changed, this, _1) ); @@ -67,7 +67,7 @@ void FilmEditor::film_changed (Film::Property p) { ensure_ui_thread (); - + if (!_film) { return; } @@ -85,7 +85,7 @@ void FilmEditor::film_content_changed (int property) { ensure_ui_thread (); - + if (!_film) { /* We call this method ourselves (as well as using it as a signal handler) so _film can be 0. @@ -106,7 +106,7 @@ FilmEditor::set_film (shared_ptr film) if (_film == film) { return; } - + _film = film; _content_panel->set_film (_film); diff --git a/src/wx/film_editor.h b/src/wx/film_editor.h index 768be9d3c..43a1214c2 100644 --- a/src/wx/film_editor.h +++ b/src/wx/film_editor.h @@ -16,7 +16,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - + /** @file src/wx/film_editor.h * @brief FilmEditor class. */ @@ -48,7 +48,7 @@ public: ContentPanel* content_panel () const { return _content_panel; } - + boost::shared_ptr film () const { return _film; } diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc index a9b0907a1..4e155e05d 100644 --- a/src/wx/film_viewer.cc +++ b/src/wx/film_viewer.cc @@ -71,9 +71,9 @@ FilmViewer::FilmViewer (wxWindow* p) #ifndef __WXOSX__ _panel->SetDoubleBuffered (true); #endif - + _panel->SetBackgroundStyle (wxBG_STYLE_PAINT); - + _v_sizer = new wxBoxSizer (wxVERTICAL); SetSizer (_v_sizer); @@ -111,7 +111,7 @@ FilmViewer::FilmViewer (wxWindow* p) _forward_button->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&FilmViewer::forward_clicked, this)); set_film (shared_ptr ()); - + JobManager::instance()->ActiveJobsChanged.connect ( bind (&FilmViewer::active_jobs_changed, this, _1) ); @@ -129,10 +129,10 @@ FilmViewer::set_film (shared_ptr film) _film = film; _frame.reset (); - + update_position_slider (); update_position_label (); - + if (!_film) { return; } @@ -149,7 +149,7 @@ FilmViewer::set_film (shared_ptr film) in the preview. */ _player->set_burn_subtitles (true); - + _film_connection = _film->Changed.connect (boost::bind (&FilmViewer::film_changed, this, _1)); _player_connection = _player->Changed.connect (boost::bind (&FilmViewer::player_changed, this, _1)); @@ -180,7 +180,7 @@ FilmViewer::get (DCPTime p, bool accurate) } catch (exception& e) { error_dialog (this, wxString::Format (_("Could not get video for view (%s)"), std_to_wx(e.what()).data())); } - + if (!pvf.empty ()) { try { _frame = pvf.front()->image (PIX_FMT_RGB24, true, boost::bind (&Log::dcp_log, _film->log().get(), _1, _2)); @@ -189,7 +189,7 @@ FilmViewer::get (DCPTime p, bool accurate) if (pvf.front()->colour_conversion()) { yuv_to_rgb = pvf.front()->colour_conversion().get().yuv_to_rgb(); } - + _frame = _frame->scale (_frame->size(), yuv_to_rgb, PIX_FMT_RGB24, false); _position = pvf.front()->time (); _inter_position = pvf.front()->inter_position (); @@ -229,7 +229,7 @@ FilmViewer::timer () } else { get (_position + frame, true); } - + update_position_label (); update_position_slider (); } @@ -308,10 +308,10 @@ FilmViewer::calculate_sizes () } Ratio const * container = _film->container (); - + float const panel_ratio = _panel_size.ratio (); float const film_ratio = container ? container->ratio () : 1.78; - + if (panel_ratio < film_ratio) { /* panel is less widscreen than the film; clamp width */ _out_size.width = _panel_size.width; @@ -341,7 +341,7 @@ FilmViewer::check_play_state () if (!_film || _film->video_frame_rate() == 0) { return; } - + if (_play_button->GetValue()) { _timer.Start (1000 / _film->video_frame_rate()); } else { @@ -356,7 +356,7 @@ FilmViewer::update_position_slider () _slider->SetValue (0); return; } - + DCPTime const len = _film->length (); if (len.get ()) { @@ -387,17 +387,17 @@ FilmViewer::active_jobs_changed (bool a) { if (a) { list > jobs = JobManager::instance()->get (); - list >::iterator i = jobs.begin (); + list >::iterator i = jobs.begin (); while (i != jobs.end() && boost::dynamic_pointer_cast (*i) == 0) { ++i; } - + if (i == jobs.end() || (*i)->finished()) { /* no examine content job running, so we're ok to use the viewer */ a = false; } } - + _slider->Enable (!a); _play_button->Enable (!a); } @@ -440,7 +440,7 @@ void FilmViewer::setup_sensitivity () { bool const c = _film && !_film->content().empty (); - + _slider->Enable (c); _back_button->Enable (c); _forward_button->Enable (c); diff --git a/src/wx/filter_dialog.cc b/src/wx/filter_dialog.cc index 13907ae0c..306ee749d 100644 --- a/src/wx/filter_dialog.cc +++ b/src/wx/filter_dialog.cc @@ -46,7 +46,7 @@ FilterDialog::FilterDialog (wxWindow* parent, vector const & f) sizer->Layout (); sizer->SetSizeHints (this); } - + void FilterDialog::active_changed () diff --git a/src/wx/filter_dialog.h b/src/wx/filter_dialog.h index d54e6f2e4..6ca1f6886 100644 --- a/src/wx/filter_dialog.h +++ b/src/wx/filter_dialog.h @@ -40,6 +40,6 @@ public: private: void active_changed (); - + FilterEditor* _filters; }; diff --git a/src/wx/filter_editor.cc b/src/wx/filter_editor.cc index 4dd18004b..6b5b8505e 100644 --- a/src/wx/filter_editor.cc +++ b/src/wx/filter_editor.cc @@ -34,7 +34,7 @@ FilterEditor::FilterEditor (wxWindow* parent, vector const & act { wxBoxSizer* sizer = new wxBoxSizer (wxVERTICAL); SetSizer (sizer); - + vector filters = Filter::all (); typedef map > CategoryMap; diff --git a/src/wx/fonts_dialog.cc b/src/wx/fonts_dialog.cc index aa9fd1540..092faf9e6 100644 --- a/src/wx/fonts_dialog.cc +++ b/src/wx/fonts_dialog.cc @@ -41,7 +41,7 @@ FontsDialog::FontsDialog (wxWindow* parent, shared_ptr content) ip.SetWidth (100); _fonts->InsertColumn (0, ip); } - + { wxListItem ip; ip.SetId (1); @@ -85,7 +85,7 @@ FontsDialog::setup () if (!content) { return; } - + _fonts->DeleteAllItems (); list > fonts = content->fonts (); size_t n = 0; @@ -113,7 +113,7 @@ FontsDialog::set_file_clicked () if (item == -1) { return; } - + /* The wxFD_CHANGE_DIR here prevents a `could not set working directory' error 123 on Windows when using non-Latin filenames or paths. */ diff --git a/src/wx/fonts_dialog.h b/src/wx/fonts_dialog.h index 76eae3ec2..0d4bcfd7e 100644 --- a/src/wx/fonts_dialog.h +++ b/src/wx/fonts_dialog.h @@ -33,7 +33,7 @@ private: void set_file_clicked (); void update_sensitivity (); void selection_changed (); - + boost::weak_ptr _content; wxListCtrl* _fonts; wxButton* _set_file; diff --git a/src/wx/gain_calculator_dialog.cc b/src/wx/gain_calculator_dialog.cc index d49dfae70..133d84c21 100644 --- a/src/wx/gain_calculator_dialog.cc +++ b/src/wx/gain_calculator_dialog.cc @@ -41,7 +41,7 @@ GainCalculatorDialog::wanted_fader () const if (_wanted->GetValue().IsEmpty()) { return 0; } - + return lexical_cast (wx_to_std (_wanted->GetValue ())); } diff --git a/src/wx/hints_dialog.cc b/src/wx/hints_dialog.cc index 40f1f3377..36c9eb6c8 100644 --- a/src/wx/hints_dialog.cc +++ b/src/wx/hints_dialog.cc @@ -63,14 +63,14 @@ HintsDialog::film_changed () { _text->Clear (); bool hint = false; - + boost::shared_ptr film = _film.lock (); if (!film) { return; } ContentList content = film->content (); - + _text->BeginStandardBullet (N_("standard/circle"), 1, 50); bool big_font_files = false; @@ -132,7 +132,7 @@ HintsDialog::film_changed () _text->WriteText (_("All of your content is at 1.85:1 or narrower but your DCP's container is Scope (2.39:1). This will pillar-box your content inside a Flat (1.85:1) frame. You may prefer to set your DCP's container to Flat (1.85:1) in the \"DCP\" tab.")); _text->Newline (); } - + if (film->video_frame_rate() != 24 && film->video_frame_rate() != 48) { hint = true; _text->WriteText (wxString::Format (_("Your DCP frame rate (%d fps) may cause problems in a few (mostly older) projectors. Use 24 or 48 frames per second to be on the safe side."), film->video_frame_rate())); diff --git a/src/wx/hints_dialog.h b/src/wx/hints_dialog.h index 88b2fa1ba..f4ef00aa2 100644 --- a/src/wx/hints_dialog.h +++ b/src/wx/hints_dialog.h @@ -30,7 +30,7 @@ public: private: void film_changed (); - + boost::weak_ptr _film; wxRichTextCtrl* _text; diff --git a/src/wx/isdcf_metadata_dialog.cc b/src/wx/isdcf_metadata_dialog.cc index 3df393a30..47d159cb9 100644 --- a/src/wx/isdcf_metadata_dialog.cc +++ b/src/wx/isdcf_metadata_dialog.cc @@ -37,7 +37,7 @@ ISDCFMetadataDialog::ISDCFMetadataDialog (wxWindow* parent, ISDCFMetadata dm) add (_("Subtitle Language (e.g. FR)"), true); _subtitle_language = add (new wxTextCtrl (this, wxID_ANY)); - + add (_("Territory (e.g. UK)"), true); _territory = add (new wxTextCtrl (this, wxID_ANY)); @@ -70,7 +70,7 @@ ISDCFMetadataDialog::ISDCFMetadataDialog (wxWindow* parent, ISDCFMetadata dm) add (_("Mastered luminance (e.g. 14fl)"), true); _mastered_luminance = add (new wxTextCtrl (this, wxID_ANY)); - + _content_version->SetRange (1, 1024); _content_version->SetValue (dm.content_version); diff --git a/src/wx/job_manager_view.cc b/src/wx/job_manager_view.cc index 826c46811..24cacf6b0 100644 --- a/src/wx/job_manager_view.cc +++ b/src/wx/job_manager_view.cc @@ -55,26 +55,26 @@ public: gauge_message->Add (_message, 1, wxEXPAND | wxALIGN_CENTER_VERTICAL | wxALL, 6); table->Insert (n, gauge_message, 1, wxEXPAND | wxLEFT | wxRIGHT); ++n; - + _cancel = new wxButton (panel, wxID_ANY, _("Cancel")); _cancel->Bind (wxEVT_COMMAND_BUTTON_CLICKED, &JobRecord::cancel_clicked, this); table->Insert (n, _cancel, 1, wxALIGN_CENTER_VERTICAL | wxALL, 3); ++n; - + _pause = new wxButton (_panel, wxID_ANY, _("Pause")); _pause->Bind (wxEVT_COMMAND_BUTTON_CLICKED, &JobRecord::pause_clicked, this); table->Insert (n, _pause, 1, wxALIGN_CENTER_VERTICAL | wxALL, 3); ++n; - + _details = new wxButton (_panel, wxID_ANY, _("Details...")); _details->Bind (wxEVT_COMMAND_BUTTON_CLICKED, &JobRecord::details_clicked, this); _details->Enable (false); table->Insert (n, _details, 1, wxALIGN_CENTER_VERTICAL | wxALL, 3); ++n; - + _progress_connection = job->Progress.connect (boost::bind (&JobRecord::progress, this)); _finished_connection = job->Finished.connect (boost::bind (&JobRecord::finished, this)); - + table->Layout (); } @@ -106,11 +106,11 @@ private: void finished () { progress (); - + if (!_job->finished_cancelled ()) { _gauge->SetValue (100); } - + _cancel->Enable (false); _pause->Enable (false); if (!_job->error_details().empty ()) { @@ -124,7 +124,7 @@ private: s[0] = toupper (s[0]); error_dialog (_window, std_to_wx (String::compose ("%1.\n\n%2", s, _job->error_details()))); } - + void cancel_clicked (wxCommandEvent &) { _job->cancel (); @@ -140,7 +140,7 @@ private: _pause->SetLabel (_("Resume")); } } - + boost::shared_ptr _job; wxScrolledWindow* _window; wxPanel* _panel; diff --git a/src/wx/job_manager_view.h b/src/wx/job_manager_view.h index 244299a40..a83b481dc 100644 --- a/src/wx/job_manager_view.h +++ b/src/wx/job_manager_view.h @@ -43,6 +43,6 @@ private: wxPanel* _panel; wxFlexGridSizer* _table; boost::shared_ptr _timer; - + std::list > _job_records; }; diff --git a/src/wx/kdm_dialog.cc b/src/wx/kdm_dialog.cc index 8f4f8622d..67e1a9951 100644 --- a/src/wx/kdm_dialog.cc +++ b/src/wx/kdm_dialog.cc @@ -60,7 +60,7 @@ KDMDialog::KDMDialog (wxWindow* parent, boost::shared_ptr film) wxStaticText* h = new wxStaticText (this, wxID_ANY, _("Screens")); h->SetFont (subheading_font); vertical->Add (h, 0, wxALIGN_CENTER_VERTICAL); - + wxBoxSizer* targets = new wxBoxSizer (wxHORIZONTAL); _targets = new wxTreeCtrl (this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTR_HIDE_ROOT | wxTR_MULTIPLE | wxTR_HAS_BUTTONS); targets->Add (_targets, 1, wxEXPAND | wxTOP | wxRIGHT, DCPOMATIC_SIZER_GAP); @@ -82,7 +82,7 @@ KDMDialog::KDMDialog (wxWindow* parent, boost::shared_ptr film) target_buttons->Add (_edit_cinema, 1, wxEXPAND | wxALL, DCPOMATIC_BUTTON_STACK_GAP); _remove_cinema = new wxButton (this, wxID_ANY, _("Remove Cinema")); target_buttons->Add (_remove_cinema, 1, wxEXPAND | wxALL, DCPOMATIC_BUTTON_STACK_GAP); - + _add_screen = new wxButton (this, wxID_ANY, _("Add Screen...")); target_buttons->Add (_add_screen, 1, wxEXPAND | wxALL, DCPOMATIC_BUTTON_STACK_GAP); _edit_screen = new wxButton (this, wxID_ANY, _("Edit Screen...")); @@ -99,7 +99,7 @@ KDMDialog::KDMDialog (wxWindow* parent, boost::shared_ptr film) h = new wxStaticText (this, wxID_ANY, S_("KDM|Timing")); h->SetFont (subheading_font); vertical->Add (h, 0, wxALIGN_CENTER_VERTICAL | wxTOP, DCPOMATIC_SIZER_Y_GAP * 2); - + wxFlexGridSizer* table = new wxFlexGridSizer (3, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP); add_label_to_sizer (table, this, _("From"), true); wxDateTime from; @@ -125,7 +125,7 @@ KDMDialog::KDMDialog (wxWindow* parent, boost::shared_ptr film) h = new wxStaticText (this, wxID_ANY, _("CPL")); h->SetFont (subheading_font); vertical->Add (h, 0, wxALIGN_CENTER_VERTICAL | wxTOP, DCPOMATIC_SIZER_Y_GAP * 2); - + /* CPL choice */ wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL); add_label_to_sizer (s, this, _("CPL"), true); @@ -147,16 +147,16 @@ KDMDialog::KDMDialog (wxWindow* parent, boost::shared_ptr film) _cpl_annotation_text = new wxStaticText (this, wxID_ANY, ""); table->Add (_cpl_annotation_text); vertical->Add (table, 0, wxEXPAND | wxTOP, DCPOMATIC_SIZER_GAP + 2); - + _cpls = film->cpls (); update_cpl_choice (); - + /* Sub-heading: Output */ h = new wxStaticText (this, wxID_ANY, _("Output")); h->SetFont (subheading_font); vertical->Add (h, 0, wxALIGN_CENTER_VERTICAL | wxTOP, DCPOMATIC_SIZER_Y_GAP * 2); - + table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, 0); add_label_to_sizer (table, this, _("KDM type"), true); @@ -173,19 +173,19 @@ KDMDialog::KDMDialog (wxWindow* parent, boost::shared_ptr film) table->Add (_write_to, 1, wxEXPAND); #ifdef DCPOMATIC_USE_OWN_DIR_PICKER - _folder = new DirPickerCtrl (this); -#else + _folder = new DirPickerCtrl (this); +#else _folder = new wxDirPickerCtrl (this, wxID_ANY, wxEmptyString, wxDirSelectorPromptStr, wxDefaultPosition, wxSize (300, -1)); #endif _folder->SetPath (wxStandardPaths::Get().GetDocumentsDir()); - + table->Add (_folder, 1, wxEXPAND); _email = new wxRadioButton (this, wxID_ANY, _("Send by email")); table->Add (_email, 1, wxEXPAND); table->AddSpacer (0); - + vertical->Add (table, 0, wxEXPAND | wxTOP, DCPOMATIC_SIZER_GAP); /* Make an overall sizer to get a nice border, and put some buttons in */ @@ -265,10 +265,10 @@ KDMDialog::setup_sensitivity () bool const sc = selected_cinemas().size() == 1; bool const ss = selected_screens().size() == 1; bool const sd = _cpl->GetSelection() != -1; - + _edit_cinema->Enable (sc); _remove_cinema->Enable (sc); - + _add_screen->Enable (sc); _edit_screen->Enable (ss); _remove_screen->Enable (ss); @@ -328,7 +328,7 @@ KDMDialog::edit_cinema_clicked () } pair > c = selected_cinemas().front(); - + CinemaDialog* d = new CinemaDialog (this, "Edit cinema", c.second->name, c.second->email); if (d->ShowModal () == wxID_OK) { c.second->name = d->name (); @@ -337,7 +337,7 @@ KDMDialog::edit_cinema_clicked () Config::instance()->changed (); } - d->Destroy (); + d->Destroy (); } void @@ -361,7 +361,7 @@ KDMDialog::add_screen_clicked () } shared_ptr c = selected_cinemas().front().second; - + ScreenDialog* d = new ScreenDialog (this, "Add Screen"); if (d->ShowModal () != wxID_OK) { return; @@ -384,7 +384,7 @@ KDMDialog::edit_screen_clicked () } pair > s = selected_screens().front(); - + ScreenDialog* d = new ScreenDialog (this, "Edit screen", s.second->name, s.second->certificate); if (d->ShowModal () == wxID_OK) { s.second->name = d->name (); @@ -500,7 +500,7 @@ void KDMDialog::update_cpl_choice () { _cpl->Clear (); - + for (vector::const_iterator i = _cpls.begin(); i != _cpls.end(); ++i) { _cpl->Append (std_to_wx (i->cpl_id)); @@ -556,7 +556,7 @@ KDMDialog::cpl_browse_clicked () error_dialog (this, _("This is not a valid CPL file")); return; } - + update_cpl_choice (); _cpl->SetSelection (_cpls.size() - 1); update_cpl_summary (); diff --git a/src/wx/kdm_dialog.h b/src/wx/kdm_dialog.h index 0fc95db84..1cf4ddde8 100644 --- a/src/wx/kdm_dialog.h +++ b/src/wx/kdm_dialog.h @@ -44,7 +44,7 @@ public: boost::posix_time::ptime from () const; /** @return KDM until time in local time */ boost::posix_time::ptime until () const; - + boost::filesystem::path cpl () const; boost::filesystem::path directory () const; bool write_to () const; @@ -67,7 +67,7 @@ private: void cpl_browse_clicked (); static boost::posix_time::ptime posix_time (wxDatePickerCtrl *, wxTimePickerCtrl *); - + wxTreeCtrl* _targets; wxButton* _add_cinema; wxButton* _edit_cinema; diff --git a/src/wx/key_dialog.cc b/src/wx/key_dialog.cc index 70229c7a9..6133e8583 100644 --- a/src/wx/key_dialog.cc +++ b/src/wx/key_dialog.cc @@ -40,7 +40,7 @@ KeyDialog::KeyDialog (wxWindow* parent, dcp::Key key) } validator.SetIncludes (list); - + _key = add (new wxTextCtrl (this, wxID_ANY, _(""), wxDefaultPosition, size, 0, validator)); _key->SetValue (std_to_wx (key.hex ())); _key->SetMaxLength (32); diff --git a/src/wx/key_dialog.h b/src/wx/key_dialog.h index 81402d46e..b04566212 100644 --- a/src/wx/key_dialog.h +++ b/src/wx/key_dialog.h @@ -30,7 +30,7 @@ public: private: void key_changed (); void random (); - + wxTextCtrl* _key; wxButton* _random; }; diff --git a/src/wx/make_signer_chain_dialog.h b/src/wx/make_signer_chain_dialog.h index fc6391a94..6d018c0dc 100644 --- a/src/wx/make_signer_chain_dialog.h +++ b/src/wx/make_signer_chain_dialog.h @@ -44,7 +44,7 @@ public: std::string leaf_common_name () const { return wx_to_std (_leaf_common_name->GetValue ()); } - + private: wxTextCtrl* _organisation; @@ -53,4 +53,4 @@ private: wxTextCtrl* _intermediate_common_name; wxTextCtrl* _leaf_common_name; }; - + diff --git a/src/wx/new_film_dialog.cc b/src/wx/new_film_dialog.cc index 8f317f42f..96c8a0b0c 100644 --- a/src/wx/new_film_dialog.cc +++ b/src/wx/new_film_dialog.cc @@ -40,15 +40,15 @@ NewFilmDialog::NewFilmDialog (wxWindow* parent) add (_("Create in folder"), true); #ifdef DCPOMATIC_USE_OWN_DIR_PICKER - _folder = new DirPickerCtrl (this); -#else + _folder = new DirPickerCtrl (this); +#else _folder = new wxDirPickerCtrl (this, wxID_ANY, wxEmptyString, wxDirSelectorPromptStr, wxDefaultPosition, wxSize (300, -1)); #endif if (!_directory) { _directory = Config::instance()->default_directory_or (wx_to_std (wxStandardPaths::Get().GetDocumentsDir())); } - + _folder->SetPath (std_to_wx (_directory.get().string())); add (_folder); diff --git a/src/wx/new_film_dialog.h b/src/wx/new_film_dialog.h index 5ec5863c6..6ce3d6e3a 100644 --- a/src/wx/new_film_dialog.h +++ b/src/wx/new_film_dialog.h @@ -36,8 +36,8 @@ private: wxTextCtrl* _name; #ifdef DCPOMATIC_USE_OWN_DIR_PICKER DirPickerCtrl* _folder; -#else +#else wxDirPickerCtrl* _folder; -#endif +#endif static boost::optional _directory; }; diff --git a/src/wx/report_problem_dialog.cc b/src/wx/report_problem_dialog.cc index ae9b1d3ed..971619daf 100644 --- a/src/wx/report_problem_dialog.cc +++ b/src/wx/report_problem_dialog.cc @@ -49,7 +49,7 @@ ReportProblemDialog::ReportProblemDialog (wxWindow* parent, shared_ptr fil #ifdef __WXOSX__ flags |= wxALIGN_RIGHT; t += wxT (":"); -#endif +#endif wxStaticText* m = new wxStaticText (this, wxID_ANY, t); _table->Add (m, 1, flags, 6); diff --git a/src/wx/screen_dialog.h b/src/wx/screen_dialog.h index 3e110d230..69d0fff81 100644 --- a/src/wx/screen_dialog.h +++ b/src/wx/screen_dialog.h @@ -31,13 +31,13 @@ public: std::string name () const; boost::optional certificate () const; - + private: void select_certificate (); void load_certificate (boost::filesystem::path); void download_certificate (); void setup_sensitivity (); - + wxTextCtrl* _name; wxChoice* _manufacturer; wxButton* _load_certificate; diff --git a/src/wx/servers_list_dialog.cc b/src/wx/servers_list_dialog.cc index 299ce2f20..13c6df707 100644 --- a/src/wx/servers_list_dialog.cc +++ b/src/wx/servers_list_dialog.cc @@ -31,7 +31,7 @@ ServersListDialog::ServersListDialog (wxWindow* parent) { wxBoxSizer* s = new wxBoxSizer (wxVERTICAL); SetSizer (s); - + _list = new wxListCtrl (this, wxID_ANY, wxDefaultPosition, wxSize (400, 200), wxLC_REPORT | wxLC_SINGLE_SEL); { @@ -60,7 +60,7 @@ ServersListDialog::ServersListDialog (wxWindow* parent) SetSizer (s); s->Layout (); s->SetSizeHints (this); - + _server_finder_connection = ServerFinder::instance()->connect (boost::bind (&ServersListDialog::server_found, this, _1)); } diff --git a/src/wx/subtitle_panel.cc b/src/wx/subtitle_panel.cc index 1e137f233..9823df7a7 100644 --- a/src/wx/subtitle_panel.cc +++ b/src/wx/subtitle_panel.cc @@ -67,7 +67,7 @@ SubtitlePanel::SubtitlePanel (ContentPanel* p) add_label_to_sizer (s, this, _("%"), false); grid->Add (s); } - + { add_label_to_sizer (grid, this, _("X Scale"), true); wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL); @@ -89,7 +89,7 @@ SubtitlePanel::SubtitlePanel (ContentPanel* p) add_label_to_sizer (grid, this, _("Language"), true); _language = new wxTextCtrl (this, wxID_ANY); grid->Add (_language, 1, wxEXPAND); - + add_label_to_sizer (grid, this, _("Stream"), true); _stream = new wxChoice (this, wxID_ANY); grid->Add (_stream, 1, wxEXPAND); @@ -101,7 +101,7 @@ SubtitlePanel::SubtitlePanel (ContentPanel* p) _fonts_dialog_button = new wxButton (this, wxID_ANY, _("Fonts...")); grid->Add (_fonts_dialog_button); grid->AddSpacer (0); - + _x_offset->SetRange (-100, 100); _y_offset->SetRange (-100, 100); _x_scale->SetRange (10, 1000); @@ -149,7 +149,7 @@ SubtitlePanel::film_content_changed (int property) for (vector >::iterator i = s.begin(); i != s.end(); ++i) { _stream->Append (std_to_wx ((*i)->name), new wxStringClientData (std_to_wx ((*i)->identifier ()))); } - + if (fcs->subtitle_stream()) { checked_set (_stream, fcs->subtitle_stream()->identifier ()); } else { @@ -205,10 +205,10 @@ SubtitlePanel::setup_sensitivity () ++any_subs; } } - + _use->Enable (any_subs > 0); bool const use = _use->GetValue (); - + _x_offset->Enable (any_subs > 0 && use); _y_offset->Enable (any_subs > 0 && use); _x_scale->Enable (any_subs > 0 && use); @@ -228,7 +228,7 @@ SubtitlePanel::stream_changed () } shared_ptr fcs = fc.front (); - + vector > a = fcs->subtitle_streams (); vector >::iterator i = a.begin (); string const s = string_client_data (_stream->GetClientObject (_stream->GetSelection ())); @@ -311,17 +311,17 @@ SubtitlePanel::subtitle_view_clicked () DCPOMATIC_ASSERT (c.size() == 1); shared_ptr decoder; - + shared_ptr sr = dynamic_pointer_cast (c.front ()); if (sr) { decoder.reset (new SubRipDecoder (sr)); } - + shared_ptr dc = dynamic_pointer_cast (c.front ()); if (dc) { decoder.reset (new DCPSubtitleDecoder (dc)); } - + if (decoder) { _subtitle_view = new SubtitleView (this, _parent->film(), decoder, c.front()->position ()); _subtitle_view->Show (); diff --git a/src/wx/subtitle_panel.h b/src/wx/subtitle_panel.h index ef94adb54..5a39f3bcd 100644 --- a/src/wx/subtitle_panel.h +++ b/src/wx/subtitle_panel.h @@ -32,7 +32,7 @@ public: void film_changed (Film::Property); void film_content_changed (int); void content_selection_changed (); - + private: void use_toggled (); void x_offset_changed (); @@ -45,7 +45,7 @@ private: void fonts_dialog_clicked (); void setup_sensitivity (); - + wxCheckBox* _use; wxSpinCtrl* _x_offset; wxSpinCtrl* _y_offset; diff --git a/src/wx/subtitle_view.cc b/src/wx/subtitle_view.cc index b58af3019..33ef7cfda 100644 --- a/src/wx/subtitle_view.cc +++ b/src/wx/subtitle_view.cc @@ -47,7 +47,7 @@ SubtitleView::SubtitleView (wxWindow* parent, shared_ptr film, shared_ptr< ip.SetText (_("End")); ip.SetWidth (100); _list->InsertColumn (1, ip); - } + } { wxListItem ip; diff --git a/src/wx/subtitle_view.h b/src/wx/subtitle_view.h index 338742afc..f5a61890b 100644 --- a/src/wx/subtitle_view.h +++ b/src/wx/subtitle_view.h @@ -28,6 +28,6 @@ class SubtitleView : public wxDialog public: SubtitleView (wxWindow *, boost::shared_ptr, boost::shared_ptr, DCPTime position); -private: +private: wxListCtrl* _list; }; diff --git a/src/wx/table_dialog.cc b/src/wx/table_dialog.cc index 571fcf3a4..b3937fd18 100644 --- a/src/wx/table_dialog.cc +++ b/src/wx/table_dialog.cc @@ -35,7 +35,7 @@ TableDialog::TableDialog (wxWindow* parent, wxString title, int columns, bool ca if (cancel) { flags |= wxCANCEL; } - + wxSizer* buttons = CreateSeparatedButtonSizer (flags); if (buttons) { _overall_sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder()); diff --git a/src/wx/table_dialog.h b/src/wx/table_dialog.h index 23017c3b6..f04c2027c 100644 --- a/src/wx/table_dialog.h +++ b/src/wx/table_dialog.h @@ -36,10 +36,10 @@ protected: void add (wxString text, bool label); void add_spacer (); - + void layout (); -private: +private: wxSizer* _overall_sizer; wxFlexGridSizer* _table; }; diff --git a/src/wx/timecode.cc b/src/wx/timecode.cc index 291a6ba58..8029d2f6a 100644 --- a/src/wx/timecode.cc +++ b/src/wx/timecode.cc @@ -30,7 +30,7 @@ TimecodeBase::TimecodeBase (wxWindow* parent) : wxPanel (parent) { wxSize const s = TimecodeBase::size (parent); - + wxTextValidator validator (wxFILTER_INCLUDE_CHAR_LIST); wxArrayString list; @@ -42,7 +42,7 @@ TimecodeBase::TimecodeBase (wxWindow* parent) validator.SetIncludes (list); _sizer = new wxBoxSizer (wxHORIZONTAL); - + _editable = new wxPanel (this); wxSizer* editable_sizer = new wxBoxSizer (wxHORIZONTAL); _hours = new wxTextCtrl (_editable, wxID_ANY, wxT(""), wxDefaultPosition, s, 0, validator); @@ -66,7 +66,7 @@ TimecodeBase::TimecodeBase (wxWindow* parent) _sizer->Add (_editable); _fixed = add_label_to_sizer (_sizer, this, wxT ("42"), false); - + _hours->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&TimecodeBase::changed, this)); _minutes->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&TimecodeBase::changed, this)); _seconds->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&TimecodeBase::changed, this)); diff --git a/src/wx/timecode.h b/src/wx/timecode.h index 620782567..45a421c4d 100644 --- a/src/wx/timecode.h +++ b/src/wx/timecode.h @@ -42,7 +42,7 @@ public: protected: void changed (); void set_clicked (); - + wxSizer* _sizer; wxPanel* _editable; wxTextCtrl* _hours; @@ -70,12 +70,12 @@ public: int s; int f; t.split (fps, h, m, s, f); - + checked_set (_hours, boost::lexical_cast (h)); checked_set (_minutes, boost::lexical_cast (m)); checked_set (_seconds, boost::lexical_cast (s)); checked_set (_frames, boost::lexical_cast (f)); - + checked_set (_fixed, t.timecode (fps)); } @@ -90,7 +90,7 @@ public: t += T::from_seconds (boost::lexical_cast (s.empty() ? "0" : s)); std::string const f = wx_to_std (_frames->GetValue()); t += T::from_seconds (boost::lexical_cast (f.empty() ? "0" : f) / fps); - + return t; } }; diff --git a/src/wx/timeline.cc b/src/wx/timeline.cc index 8c8692aa1..4f0eef0e1 100644 --- a/src/wx/timeline.cc +++ b/src/wx/timeline.cc @@ -55,7 +55,7 @@ Timeline::Timeline (wxWindow* parent, ContentPanel* cp, shared_ptr film) { #ifndef __WXOSX__ SetDoubleBuffered (true); -#endif +#endif Bind (wxEVT_PAINT, boost::bind (&Timeline::paint, this)); Bind (wxEVT_LEFT_DOWN, boost::bind (&Timeline::left_down, this, _1)); @@ -176,21 +176,21 @@ Timeline::assign_tracks () ++j; continue; } - + shared_ptr test_content = test->content(); - + if (test && test->track() && test->track().get() == t) { bool const no_overlap = (content->position() < test_content->position() && content->end() < test_content->position()) || (content->position() > test_content->end() && content->end() > test_content->end()); - + if (!no_overlap) { /* we have an overlap on track `t' */ ++t; break; } } - + ++j; } @@ -258,11 +258,11 @@ Timeline::left_down (wxMouseEvent& ev) if (!cv) { continue; } - + if (!ev.ShiftDown ()) { cv->set_selected (view == *i); } - + if (view == *i) { _content_panel->set_selection (cv->content ()); } @@ -360,9 +360,9 @@ Timeline::set_position_from_event (wxMouseEvent& ev) if (!_down_view) { return; } - + DCPTime new_position = _down_view_position + DCPTime::from_seconds ((p.x - _down_point.x) / pps); - + if (_snap) { DCPTime const new_end = new_position + _down_view->content()->length_after_trim () - DCPTime (1); @@ -370,7 +370,7 @@ Timeline::set_position_from_event (wxMouseEvent& ev) positive is right). */ optional nearest_distance; - + /* Find the nearest content edge; this is inefficient */ for (TimelineViewList::iterator i = _views.begin(); i != _views.end(); ++i) { shared_ptr cv = dynamic_pointer_cast (*i); @@ -383,7 +383,7 @@ Timeline::set_position_from_event (wxMouseEvent& ev) maybe_snap (cv->content()->end() + DCPTime (1), new_position, nearest_distance); maybe_snap (cv->content()->end() + DCPTime (1), new_end, nearest_distance); } - + if (nearest_distance) { /* Snap if it's close; `close' means within a proportion of the time on the timeline */ if (nearest_distance.get().abs() < DCPTime::from_seconds ((width() / pps) / 64)) { @@ -391,13 +391,13 @@ Timeline::set_position_from_event (wxMouseEvent& ev) } } } - + if (new_position < DCPTime ()) { new_position = DCPTime (); } _down_view->content()->set_position (new_position); - + shared_ptr film = _film.lock (); DCPOMATIC_ASSERT (film); film->set_sequence_video (false); @@ -436,7 +436,7 @@ TimelineContentViewList Timeline::selected_views () const { TimelineContentViewList sel; - + for (TimelineViewList::const_iterator i = _views.begin(); i != _views.end(); ++i) { shared_ptr cv = dynamic_pointer_cast (*i); if (cv && cv->selected()) { @@ -452,7 +452,7 @@ Timeline::selected_content () const { ContentList sel; TimelineContentViewList views = selected_views (); - + for (TimelineContentViewList::const_iterator i = views.begin(); i != views.end(); ++i) { sel.push_back ((*i)->content ()); } diff --git a/src/wx/timeline_audio_content_view.h b/src/wx/timeline_audio_content_view.h index 23c5c6d85..6f1a383de 100644 --- a/src/wx/timeline_audio_content_view.h +++ b/src/wx/timeline_audio_content_view.h @@ -26,7 +26,7 @@ class TimelineAudioContentView : public TimelineContentView { public: TimelineAudioContentView (Timeline& tl, boost::shared_ptr c); - + private: wxString type () const; wxColour background_colour () const; diff --git a/src/wx/timeline_content_view.cc b/src/wx/timeline_content_view.cc index b72ba48c8..df0772be9 100644 --- a/src/wx/timeline_content_view.cc +++ b/src/wx/timeline_content_view.cc @@ -37,13 +37,13 @@ dcpomatic::Rect TimelineContentView::bbox () const { DCPOMATIC_ASSERT (_track); - + shared_ptr film = _timeline.film (); shared_ptr content = _content.lock (); if (!film || !content) { return dcpomatic::Rect (); } - + return dcpomatic::Rect ( time_x (content->position ()) - 8, y_pos (_track.get()) - 8, @@ -93,18 +93,18 @@ void TimelineContentView::do_paint (wxGraphicsContext* gc) { DCPOMATIC_ASSERT (_track); - + shared_ptr film = _timeline.film (); shared_ptr cont = content (); if (!film || !cont) { return; } - + DCPTime const position = cont->position (); DCPTime const len = cont->length_after_trim (); - + wxColour selected (background_colour().Red() / 2, background_colour().Green() / 2, background_colour().Blue() / 2); - + gc->SetPen (*wxThePenList->FindOrCreatePen (foreground_colour(), 4, wxPENSTYLE_SOLID)); if (_selected) { gc->SetBrush (*wxTheBrushList->FindOrCreateBrush (selected, wxBRUSHSTYLE_SOLID)); @@ -120,14 +120,14 @@ TimelineContentView::do_paint (wxGraphicsContext* gc) path.AddLineToPoint (time_x (position), y_pos (_track.get()) + 4); gc->StrokePath (path); gc->FillPath (path); - + wxString name = wxString::Format (wxT ("%s [%s]"), std_to_wx (cont->summary()).data(), type().data()); wxDouble name_width; wxDouble name_height; wxDouble name_descent; wxDouble name_leading; gc->GetTextExtent (name, &name_width, &name_height, &name_descent, &name_leading); - + gc->Clip (wxRegion (time_x (position), y_pos (_track.get()), len.seconds() * _timeline.pixels_per_second().get_value_or(0), _timeline.track_height())); gc->SetFont (gc->CreateFont (*wxNORMAL_FONT, foreground_colour ())); gc->DrawText (name, time_x (position) + 12, y_pos (_track.get() + 1) - name_height - 4); @@ -144,11 +144,11 @@ void TimelineContentView::content_changed (int p, bool frequent) { ensure_ui_thread (); - + if (p == ContentProperty::POSITION || p == ContentProperty::LENGTH) { force_redraw (); } - + if (!frequent) { _timeline.setup_pixels_per_second (); _timeline.Refresh (); diff --git a/src/wx/timeline_content_view.h b/src/wx/timeline_content_view.h index d5c9126c0..3262f13f3 100644 --- a/src/wx/timeline_content_view.h +++ b/src/wx/timeline_content_view.h @@ -46,7 +46,7 @@ public: virtual wxString type () const = 0; virtual wxColour background_colour () const = 0; virtual wxColour foreground_colour () const = 0; - + private: void do_paint (wxGraphicsContext* gc); diff --git a/src/wx/timeline_dialog.cc b/src/wx/timeline_dialog.cc index 6ec52ff38..ab2162b39 100644 --- a/src/wx/timeline_dialog.cc +++ b/src/wx/timeline_dialog.cc @@ -70,7 +70,7 @@ TimelineDialog::sequence_video_toggled () if (!film) { return; } - + film->set_sequence_video (_sequence_video->GetValue ()); } diff --git a/src/wx/timeline_dialog.h b/src/wx/timeline_dialog.h index 0ee345154..b760c2c5b 100644 --- a/src/wx/timeline_dialog.h +++ b/src/wx/timeline_dialog.h @@ -33,7 +33,7 @@ private: void snap_toggled (); void sequence_video_toggled (); void film_changed (Film::Property); - + boost::weak_ptr _film; Timeline _timeline; wxCheckBox* _snap; diff --git a/src/wx/timeline_subtitle_content_view.cc b/src/wx/timeline_subtitle_content_view.cc index 407997b0f..3d1766391 100644 --- a/src/wx/timeline_subtitle_content_view.cc +++ b/src/wx/timeline_subtitle_content_view.cc @@ -42,7 +42,7 @@ TimelineSubtitleContentView::background_colour () const if (!sc || !sc->use_subtitles ()) { return wxColour (210, 210, 210, 128); } - + return wxColour (163, 255, 154, 255); } @@ -53,6 +53,6 @@ TimelineSubtitleContentView::foreground_colour () const if (!sc || !sc->use_subtitles ()) { return wxColour (180, 180, 180, 128); } - + return wxColour (0, 0, 0, 255); } diff --git a/src/wx/timeline_time_axis_view.cc b/src/wx/timeline_time_axis_view.cc index 88236c64f..7882c1231 100644 --- a/src/wx/timeline_time_axis_view.cc +++ b/src/wx/timeline_time_axis_view.cc @@ -28,7 +28,7 @@ TimelineTimeAxisView::TimelineTimeAxisView (Timeline& tl, int y) { } - + dcpomatic::Rect TimelineTimeAxisView::bbox () const { @@ -48,11 +48,11 @@ TimelineTimeAxisView::do_paint (wxGraphicsContext* gc) if (!_timeline.pixels_per_second()) { return; } - + double const pps = _timeline.pixels_per_second().get (); - + gc->SetPen (*wxThePenList->FindOrCreatePen (wxColour (0, 0, 0), 1, wxPENSTYLE_SOLID)); - + double mark_interval = rint (128 / pps); if (mark_interval > 5) { mark_interval -= int (rint (mark_interval)) % 5; @@ -66,18 +66,18 @@ TimelineTimeAxisView::do_paint (wxGraphicsContext* gc) if (mark_interval > 3600) { mark_interval -= int (rint (mark_interval)) % 3600; } - + if (mark_interval < 1) { mark_interval = 1; } - + wxGraphicsPath path = gc->CreatePath (); path.MoveToPoint (_timeline.x_offset(), _y); path.AddLineToPoint (_timeline.width(), _y); gc->StrokePath (path); - + gc->SetFont (gc->CreateFont (*wxNORMAL_FONT)); - + /* Time in seconds */ DCPTime t; while ((t.seconds() * pps) < _timeline.width()) { @@ -85,26 +85,26 @@ TimelineTimeAxisView::do_paint (wxGraphicsContext* gc) path.MoveToPoint (time_x (t), _y - 4); path.AddLineToPoint (time_x (t), _y + 4); gc->StrokePath (path); - + double tc = t.seconds (); int const h = tc / 3600; tc -= h * 3600; int const m = tc / 60; tc -= m * 60; int const s = tc; - + wxString str = wxString::Format (wxT ("%02d:%02d:%02d"), h, m, s); wxDouble str_width; wxDouble str_height; wxDouble str_descent; wxDouble str_leading; gc->GetTextExtent (str, &str_width, &str_height, &str_descent, &str_leading); - + int const tx = _timeline.x_offset() + t.seconds() * pps; if ((tx + str_width) < _timeline.width()) { gc->DrawText (str, time_x (t), _y + 16); } - + t += DCPTime::from_seconds (mark_interval); } } diff --git a/src/wx/timeline_time_axis_view.h b/src/wx/timeline_time_axis_view.h index 4b17c099d..f72acd4a7 100644 --- a/src/wx/timeline_time_axis_view.h +++ b/src/wx/timeline_time_axis_view.h @@ -27,7 +27,7 @@ public: dcpomatic::Rect bbox () const; void set_y (int y); -private: +private: void do_paint (wxGraphicsContext* gc); private: diff --git a/src/wx/timeline_video_content_view.h b/src/wx/timeline_video_content_view.h index 667c54485..3dd76140a 100644 --- a/src/wx/timeline_video_content_view.h +++ b/src/wx/timeline_video_content_view.h @@ -27,7 +27,7 @@ class TimelineVideoContentView : public TimelineContentView public: TimelineVideoContentView (Timeline& tl, boost::shared_ptr c); -private: +private: wxString type () const; wxColour background_colour () const; wxColour foreground_colour () const; diff --git a/src/wx/timeline_view.cc b/src/wx/timeline_view.cc index dbcbe0259..0d2fca381 100644 --- a/src/wx/timeline_view.cc +++ b/src/wx/timeline_view.cc @@ -26,7 +26,7 @@ TimelineView::TimelineView (Timeline& t) : _timeline (t) { - + } void diff --git a/src/wx/timeline_view.h b/src/wx/timeline_view.h index e52e28d47..55fd64d51 100644 --- a/src/wx/timeline_view.h +++ b/src/wx/timeline_view.h @@ -35,7 +35,7 @@ class TimelineView : public boost::noncopyable public: TimelineView (Timeline& t); virtual ~TimelineView () {} - + void paint (wxGraphicsContext* g); void force_redraw (); @@ -43,9 +43,9 @@ public: protected: virtual void do_paint (wxGraphicsContext *) = 0; - + int time_x (DCPTime t) const; - + Timeline& _timeline; private: diff --git a/src/wx/timing_panel.cc b/src/wx/timing_panel.cc index 03189ecf5..4baafe9db 100644 --- a/src/wx/timing_panel.cc +++ b/src/wx/timing_panel.cc @@ -43,35 +43,35 @@ TimingPanel::TimingPanel (ContentPanel* p, FilmViewer* viewer) _sizer->Add (grid, 0, wxALL, 8); wxSize size = TimecodeBase::size (this); - + wxSizer* labels = new wxBoxSizer (wxHORIZONTAL); //// TRANSLATORS: this is an abbreviation for "hours" wxStaticText* t = new wxStaticText (this, wxID_ANY, _("h"), wxDefaultPosition, size, wxALIGN_CENTRE_HORIZONTAL); #ifdef DCPOMATIC_LINUX /* Hack to work around failure to centre text on GTK */ gtk_label_set_line_wrap (GTK_LABEL (t->GetHandle()), FALSE); -#endif +#endif labels->Add (t, 1, wxEXPAND); add_label_to_sizer (labels, this, wxT (":"), false); //// TRANSLATORS: this is an abbreviation for "minutes" t = new wxStaticText (this, wxID_ANY, _("m"), wxDefaultPosition, size, wxALIGN_CENTRE_HORIZONTAL); #ifdef DCPOMATIC_LINUX gtk_label_set_line_wrap (GTK_LABEL (t->GetHandle()), FALSE); -#endif +#endif labels->Add (t, 1, wxEXPAND); add_label_to_sizer (labels, this, wxT (":"), false); //// TRANSLATORS: this is an abbreviation for "seconds" t = new wxStaticText (this, wxID_ANY, _("s"), wxDefaultPosition, size, wxALIGN_CENTRE_HORIZONTAL); #ifdef DCPOMATIC_LINUX gtk_label_set_line_wrap (GTK_LABEL (t->GetHandle()), FALSE); -#endif +#endif labels->Add (t, 1, wxEXPAND); add_label_to_sizer (labels, this, wxT (":"), false); //// TRANSLATORS: this is an abbreviation for "frames" t = new wxStaticText (this, wxID_ANY, _("f"), wxDefaultPosition, size, wxALIGN_CENTRE_HORIZONTAL); #ifdef DCPOMATIC_LINUX gtk_label_set_line_wrap (GTK_LABEL (t->GetHandle()), FALSE); -#endif +#endif labels->Add (t, 1, wxEXPAND); grid->Add (new wxStaticText (this, wxID_ANY, wxT (""))); grid->Add (labels); @@ -128,7 +128,7 @@ TimingPanel::TimingPanel (ContentPanel* p, FilmViewer* viewer) ++current; } } - + t = new wxStaticText (this, wxID_ANY, wxT ("")); t->SetLabelMarkup (out); grid->Add (t, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 6); @@ -153,7 +153,7 @@ TimingPanel::update_full_length () for (ContentList::const_iterator i = cl.begin (); i != cl.end(); ++i) { check.insert ((*i)->full_length ()); } - + if (check.size() == 1) { _full_length->set (cl.front()->full_length (), _parent->film()->video_frame_rate ()); } else { @@ -170,7 +170,7 @@ TimingPanel::update_play_length () for (ContentList::const_iterator i = cl.begin (); i != cl.end(); ++i) { check.insert ((*i)->length_after_trim ()); } - + if (check.size() == 1) { _play_length->set (cl.front()->length_after_trim (), _parent->film()->video_frame_rate ()); } else { @@ -187,7 +187,7 @@ TimingPanel::film_content_changed (int property) /* Here we check to see if we have exactly one different value of various properties, and fill the controls with that value if so. */ - + if (property == ContentProperty::POSITION) { set check; @@ -200,7 +200,7 @@ TimingPanel::film_content_changed (int property) } else { _position->clear (); } - + } else if ( property == ContentProperty::LENGTH || property == VideoContentProperty::VIDEO_FRAME_RATE || @@ -215,20 +215,20 @@ TimingPanel::film_content_changed (int property) for (ContentList::const_iterator i = cl.begin (); i != cl.end(); ++i) { check.insert ((*i)->trim_start ()); } - + if (check.size() == 1) { _trim_start->set (cl.front()->trim_start (), film_video_frame_rate); } else { _trim_start->clear (); } - + } else if (property == ContentProperty::TRIM_END) { set check; for (ContentList::const_iterator i = cl.begin (); i != cl.end(); ++i) { check.insert ((*i)->trim_end ()); } - + if (check.size() == 1) { _trim_end->set (cl.front()->trim_end (), film_video_frame_rate); } else { @@ -359,7 +359,7 @@ TimingPanel::content_selection_changed () _trim_end->Enable (e); _play_length->Enable (e); _video_frame_rate->Enable (e); - + film_content_changed (ContentProperty::POSITION); film_content_changed (ContentProperty::LENGTH); film_content_changed (ContentProperty::TRIM_START); @@ -395,6 +395,6 @@ TimingPanel::trim_end_to_playhead_clicked () if (i->position() < ph && ph < i->end ()) { i->set_trim_end (i->position() + i->full_length() - i->trim_start() - ph); } - + } } diff --git a/src/wx/timing_panel.h b/src/wx/timing_panel.h index e300e4975..100945731 100644 --- a/src/wx/timing_panel.h +++ b/src/wx/timing_panel.h @@ -30,7 +30,7 @@ public: void film_changed (Film::Property); void film_content_changed (int); void content_selection_changed (); - + private: void position_changed (); void full_length_changed (); @@ -45,7 +45,7 @@ private: void update_play_length (); FilmViewer* _viewer; - + Timecode* _position; Timecode* _full_length; Timecode* _trim_start; diff --git a/src/wx/update_dialog.cc b/src/wx/update_dialog.cc index c8c90d86e..e0c08ef15 100644 --- a/src/wx/update_dialog.cc +++ b/src/wx/update_dialog.cc @@ -46,19 +46,19 @@ UpdateDialog::UpdateDialog (wxWindow* parent, optional stable, optional< wxHyperlinkCtrl* h = new wxHyperlinkCtrl (this, wxID_ANY, "dcpomatic.com/download", "http://dcpomatic.com/download"); table->Add (h); } - + if (test) { add_label_to_sizer (table, this, _("Test version ") + std_to_wx (test.get ()), true); wxHyperlinkCtrl* h = new wxHyperlinkCtrl (this, wxID_ANY, "dcpomatic.com/test-download", "http://dcpomatic.com/test-download"); table->Add (h); } - + overall_sizer->Add (table, 1, wxEXPAND | wxLEFT | wxRIGHT | wxTOP, DCPOMATIC_DIALOG_BORDER); wxSizer* buttons = CreateButtonSizer (wxOK); if (buttons) { overall_sizer->Add (buttons, 1, wxEXPAND | wxALL); } - + SetSizerAndFit (overall_sizer); } diff --git a/src/wx/video_panel.cc b/src/wx/video_panel.cc index 0cef2504f..a0775023c 100644 --- a/src/wx/video_panel.cc +++ b/src/wx/video_panel.cc @@ -114,7 +114,7 @@ VideoPanel::VideoPanel (ContentPanel* p) _right_crop->add (crop, wxGBPosition (cr, 3)); ++cr; - + add_label_to_grid_bag_sizer (crop, this, _("Top"), true, wxGBPosition (cr, 0)); _top_crop = new ContentSpinCtrl ( this, @@ -147,7 +147,7 @@ VideoPanel::VideoPanel (ContentPanel* p) _fade_out = new Timecode (this); grid->Add (_fade_out, wxGBPosition (r, 1), wxGBSpan (1, 3)); ++r; - + add_label_to_grid_bag_sizer (grid, this, _("Scale to"), true, wxGBPosition (r, 0)); _scale = new ContentChoice ( this, @@ -189,10 +189,10 @@ VideoPanel::VideoPanel (ContentPanel* p) } _colour_conversion->Append (_("Custom")); s->Add (_colour_conversion, 1, wxEXPAND | wxALIGN_CENTER_VERTICAL | wxTOP | wxBOTTOM | wxRIGHT, 6); - + _edit_colour_conversion_button = new wxButton (this, wxID_ANY, _("Edit...")); s->Add (_edit_colour_conversion_button, 0, wxALIGN_CENTER_VERTICAL); - + grid->Add (s, wxGBPosition (r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL); } ++r; @@ -225,7 +225,7 @@ VideoPanel::VideoPanel (ContentPanel* p) _fade_in->Changed.connect (boost::bind (&VideoPanel::fade_in_changed, this)); _fade_out->Changed.connect (boost::bind (&VideoPanel::fade_out_changed, this)); - + _filters_button->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&VideoPanel::edit_filters_clicked, this)); _colour_conversion->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&VideoPanel::colour_conversion_changed, this)); _edit_colour_conversion_button->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&VideoPanel::edit_colour_conversion_clicked, this)); @@ -255,7 +255,7 @@ VideoPanel::film_content_changed (int property) vcs = vc.front (); fcs = dynamic_pointer_cast (vcs); } - + if (property == VideoContentProperty::VIDEO_FRAME_TYPE) { setup_description (); } else if (property == VideoContentProperty::VIDEO_CROP) { @@ -299,7 +299,7 @@ VideoPanel::film_content_changed (int property) for (VideoContentList::const_iterator i = vc.begin (); i != vc.end(); ++i) { check.insert ((*i)->fade_in ()); } - + if (check.size() == 1) { _fade_in->set (ContentTime::from_frames (vc.front()->fade_in (), vc.front()->video_frame_rate ()), vc.front()->video_frame_rate ()); } else { @@ -310,7 +310,7 @@ VideoPanel::film_content_changed (int property) for (VideoContentList::const_iterator i = vc.begin (); i != vc.end(); ++i) { check.insert ((*i)->fade_out ()); } - + if (check.size() == 1) { _fade_out->set (ContentTime::from_frames (vc.front()->fade_out (), vc.front()->video_frame_rate ()), vc.front()->video_frame_rate ()); } else { @@ -397,7 +397,7 @@ VideoPanel::content_selection_changed () { VideoContentList video_sel = _parent->selected_video (); FFmpegContentList ffmpeg_sel = _parent->selected_ffmpeg (); - + bool const single = video_sel.size() == 1; _frame_type->set_content (video_sel); diff --git a/src/wx/wx_util.cc b/src/wx/wx_util.cc index 218b24b02..c05a271f7 100644 --- a/src/wx/wx_util.cc +++ b/src/wx/wx_util.cc @@ -52,7 +52,7 @@ add_label_to_sizer (wxSizer* s, wxWindow* p, wxString t, bool, int prop) flags |= wxALIGN_RIGHT; t += wxT (":"); } -#endif +#endif wxStaticText* m = new wxStaticText (p, wxID_ANY, t); s->Add (m, prop, flags, 6); return m; @@ -71,7 +71,7 @@ add_label_to_grid_bag_sizer (wxGridBagSizer* s, wxWindow* p, wxString t, bool, w flags |= wxALIGN_RIGHT; t += wxT (":"); } -#endif +#endif wxStaticText* m = new wxStaticText (p, wxID_ANY, t); s->Add (m, pos, span, flags); return m; @@ -97,7 +97,7 @@ confirm_dialog (wxWindow* parent, wxString m) d->Destroy (); return r == wxID_YES; } - + /** @param s wxWidgets string. * @return Corresponding STL string. @@ -169,7 +169,7 @@ checked_set (wxChoice* widget, string value) if (widget->GetSelection() != -1) { o = widget->GetClientObject (widget->GetSelection ()); } - + if (!o || string_client_data(o) != value) { for (unsigned int i = 0; i < widget->GetCount(); ++i) { if (string_client_data (widget->GetClientObject (i)) == value) { @@ -269,7 +269,7 @@ dcpomatic_setup_i18n () #ifdef DCPOMATIC_WINDOWS locale->AddCatalogLookupPathPrefix (std_to_wx (mo_path().string())); -#endif +#endif #ifdef DCPOMATIC_LINUX locale->AddCatalogLookupPathPrefix (LINUX_LOCALE_PREFIX); @@ -279,11 +279,11 @@ dcpomatic_setup_i18n () of wxWidgets. */ locale->AddCatalog (wxT ("dcpomatic2-wxstd")); -#endif - +#endif + locale->AddCatalog (wxT ("libdcpomatic2-wx")); locale->AddCatalog (wxT ("dcpomatic2")); - + if (!locale->IsOk()) { delete locale; locale = new wxLocale (wxLANGUAGE_ENGLISH); diff --git a/test/audio_analysis_test.cc b/test/audio_analysis_test.cc index 6c05916ab..94ad96a29 100644 --- a/test/audio_analysis_test.cc +++ b/test/audio_analysis_test.cc @@ -44,9 +44,9 @@ BOOST_AUTO_TEST_CASE (audio_analysis_serialisation_test) { int const channels = 3; int const points = 4096; - + srand (1); - + AudioAnalysis a (3); for (int i = 0; i < channels; ++i) { for (int j = 0; j < points; ++j) { @@ -74,7 +74,7 @@ BOOST_AUTO_TEST_CASE (audio_analysis_serialisation_test) BOOST_CHECK_CLOSE (p[AudioPoint::RMS], random_float (), 1); } } - + BOOST_CHECK (b.peak ()); BOOST_CHECK_CLOSE (b.peak().get(), peak, 1); BOOST_CHECK (b.peak_time ()); @@ -114,7 +114,7 @@ BOOST_AUTO_TEST_CASE (audio_analysis_negative_delay_test) c->set_audio_delay (-250); film->examine_and_add_content (c); wait_for_jobs (); - + shared_ptr job (new AnalyseAudioJob (film)); job->Finished.connect (boost::bind (&finished)); JobManager::instance()->add (job); @@ -129,7 +129,7 @@ BOOST_AUTO_TEST_CASE (audio_analysis_test2) shared_ptr c (new FFmpegContent (film, private_data / "3d_thx_broadway_2010_lossless.m2ts")); film->examine_and_add_content (c); wait_for_jobs (); - + shared_ptr job (new AnalyseAudioJob (film)); job->Finished.connect (boost::bind (&finished)); JobManager::instance()->add (job); diff --git a/test/audio_buffers_test.cc b/test/audio_buffers_test.cc index 15f918470..044a4c22c 100644 --- a/test/audio_buffers_test.cc +++ b/test/audio_buffers_test.cc @@ -98,7 +98,7 @@ BOOST_AUTO_TEST_CASE (audio_buffers_make_silent_test) random_fill (buffers); buffers.make_silent (); - + for (int i = 0; i < 9933; ++i) { for (int c = 0; c < 9; ++c) { BOOST_CHECK_EQUAL (buffers.data(c)[i], 0); @@ -248,7 +248,7 @@ BOOST_AUTO_TEST_CASE (audio_buffers_move) for (int i = 0; i < from * 7; ++i) { random_float (); } - + random_check (buffers, to, frames); } @@ -258,7 +258,7 @@ BOOST_AUTO_TEST_CASE (audio_buffers_accumulate_channel) AudioBuffers a (3, 256); srand (38); random_fill (a); - + AudioBuffers b (3, 256); random_fill (b); @@ -283,7 +283,7 @@ BOOST_AUTO_TEST_CASE (audio_buffers_accumulate_frames) AudioBuffers a (3, 256); srand (38); random_fill (a); - + AudioBuffers b (3, 256); random_fill (b); diff --git a/test/audio_decoder_test.cc b/test/audio_decoder_test.cc index cd86b73e7..6816c1fbb 100644 --- a/test/audio_decoder_test.cc +++ b/test/audio_decoder_test.cc @@ -49,7 +49,7 @@ public: DCPTime full_length () const { return DCPTime::from_seconds (float (audio_length()) / audio_stream()->frame_rate ()); } - + Frame audio_length () const { return rint (61.2942 * audio_stream()->frame_rate ()); } @@ -125,7 +125,7 @@ BOOST_AUTO_TEST_CASE (audio_decoder_get_audio_test) content.reset (new TestAudioContent (film)); decoder.reset (new TestAudioDecoder (content)); - + /* Simple reads */ check (0, 48000); check (44, 9123); @@ -136,7 +136,7 @@ BOOST_AUTO_TEST_CASE (audio_decoder_get_audio_test) Frame const from = content->resampled_audio_frame_rate() * 61; Frame const length = content->resampled_audio_frame_rate() * 4; ContentAudio ca = get (from, length); - + for (int i = 0; i < content->audio_stream()->channels(); ++i) { for (int j = 0; j < ca.audio->frames(); ++j) { BOOST_REQUIRE_EQUAL (ca.audio->data(i)[j], j + from); diff --git a/test/audio_delay_test.cc b/test/audio_delay_test.cc index 05384873f..d36672a8a 100644 --- a/test/audio_delay_test.cc +++ b/test/audio_delay_test.cc @@ -44,7 +44,7 @@ static void test_audio_delay (int delay_in_ms) { BOOST_TEST_MESSAGE ("Testing delay of " << delay_in_ms); - + string const film_name = "audio_delay_test_" + lexical_cast (delay_in_ms); shared_ptr film = new_test_film (film_name); film->set_dcp_content_type (DCPContentType::from_isdcf_name ("FTR")); @@ -78,7 +78,7 @@ void test_audio_delay (int delay_in_ms) while (n < sound_asset->asset()->intrinsic_duration()) { shared_ptr sound_frame = sound_asset->asset()->get_frame (frame++); uint8_t const * d = sound_frame->data (); - + for (int i = 0; i < sound_frame->size(); i += (3 * sound_asset->asset()->channels())) { /* Mono input so it will appear on centre */ diff --git a/test/audio_filter_test.cc b/test/audio_filter_test.cc index bcd16fd4e..c3d799b3b 100644 --- a/test/audio_filter_test.cc +++ b/test/audio_filter_test.cc @@ -40,7 +40,7 @@ audio_filter_impulse_test_one (AudioFilter& f, int block_size, int num_blocks) } shared_ptr out = f.run (in); - + for (int j = 0; j < out->frames(); ++j) { BOOST_CHECK_EQUAL (out->data()[0][j], c + j); } @@ -77,7 +77,7 @@ BOOST_AUTO_TEST_CASE (audio_filter_impulse_input_test) shared_ptr in (new AudioBuffers (1, 1751)); in->make_silent (); in->data(0)[0] = 1; - + shared_ptr out = lpf.run (in); for (int j = 0; j < out->frames(); ++j) { if (j <= lpf._M) { @@ -92,7 +92,7 @@ BOOST_AUTO_TEST_CASE (audio_filter_impulse_input_test) in.reset (new AudioBuffers (1, 9133)); in->make_silent (); in->data(0)[0] = 1; - + out = hpf.run (in); for (int j = 0; j < out->frames(); ++j) { if (j <= hpf._M) { diff --git a/test/client_server_test.cc b/test/client_server_test.cc index 511e913d9..e97abcec5 100644 --- a/test/client_server_test.cc +++ b/test/client_server_test.cc @@ -45,7 +45,7 @@ do_remote_encode (shared_ptr frame, ServerDescription description, Dat { Data remotely_encoded; BOOST_CHECK_NO_THROW (remotely_encoded = frame->encode_remotely (description)); - + BOOST_CHECK_EQUAL (locally_encoded.size(), remotely_encoded.size()); BOOST_CHECK_EQUAL (memcmp (locally_encoded.data().get(), remotely_encoded.data().get(), locally_encoded.size()), 0); } @@ -54,7 +54,7 @@ BOOST_AUTO_TEST_CASE (client_server_test_rgb) { shared_ptr image (new Image (PIX_FMT_RGB24, dcp::Size (1998, 1080), true)); uint8_t* p = image->data()[0]; - + for (int y = 0; y < 1080; ++y) { uint8_t* q = p; for (int x = 0; x < 1998; ++x) { @@ -109,7 +109,7 @@ BOOST_AUTO_TEST_CASE (client_server_test_rgb) ); Data locally_encoded = frame->encode_locally (boost::bind (&Log::dcp_log, log.get(), _1, _2)); - + Server* server = new Server (log, true); new thread (boost::bind (&Server::run, server, 2)); @@ -191,7 +191,7 @@ BOOST_AUTO_TEST_CASE (client_server_test_yuv) ); Data locally_encoded = frame->encode_locally (boost::bind (&Log::dcp_log, log.get(), _1, _2)); - + Server* server = new Server (log, true); new thread (boost::bind (&Server::run, server, 2)); diff --git a/test/ffmpeg_audio_test.cc b/test/ffmpeg_audio_test.cc index 2c34c437d..aac32edc0 100644 --- a/test/ffmpeg_audio_test.cc +++ b/test/ffmpeg_audio_test.cc @@ -47,7 +47,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_audio_test) film->examine_and_add_content (c); wait_for_jobs (); - + c->set_scale (VideoContentScale (Ratio::from_id ("185"))); film->set_container (Ratio::from_id ("185")); @@ -76,7 +76,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_audio_test) while (n < sound_asset->asset()->intrinsic_duration()) { shared_ptr sound_frame = sound_asset->asset()->get_frame (frame++); uint8_t const * d = sound_frame->data (); - + for (int i = 0; i < sound_frame->size(); i += (3 * sound_asset->asset()->channels())) { if (sound_asset->asset()->channels() > 0) { @@ -90,7 +90,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_audio_test) int const sample = d[i + 2] | (d[i + 3] << 8); BOOST_CHECK_EQUAL (sample, 0); } - + if (sound_asset->asset()->channels() > 2) { /* Mono input so it will appear on centre */ int const sample = d[i + 7] | (d[i + 8] << 8); diff --git a/test/ffmpeg_dcp_test.cc b/test/ffmpeg_dcp_test.cc index 797af8736..ce8ecad6b 100644 --- a/test/ffmpeg_dcp_test.cc +++ b/test/ffmpeg_dcp_test.cc @@ -42,9 +42,9 @@ BOOST_AUTO_TEST_CASE (ffmpeg_dcp_test) film->examine_and_add_content (c); wait_for_jobs (); - + c->set_scale (VideoContentScale (Ratio::from_id ("185"))); - + film->set_container (Ratio::from_id ("185")); film->set_dcp_content_type (DCPContentType::from_pretty_name ("Test")); film->make_dcp (); @@ -70,6 +70,6 @@ BOOST_AUTO_TEST_CASE (ffmpeg_have_dcp_test) if (i != boost::filesystem::directory_iterator ()) { boost::filesystem::remove (i->path ()); } - + BOOST_CHECK (film->cpls().empty()); } diff --git a/test/ffmpeg_decoder_seek_test.cc b/test/ffmpeg_decoder_seek_test.cc index c15bf8c98..c81b7389c 100644 --- a/test/ffmpeg_decoder_seek_test.cc +++ b/test/ffmpeg_decoder_seek_test.cc @@ -59,7 +59,7 @@ test (boost::filesystem::path file, vector frames) } shared_ptr film = new_test_film ("ffmpeg_decoder_seek_test_" + file.string()); - shared_ptr content (new FFmpegContent (film, path)); + shared_ptr content (new FFmpegContent (film, path)); film->examine_and_add_content (content); wait_for_jobs (); shared_ptr log (new NullLog); @@ -73,7 +73,7 @@ test (boost::filesystem::path file, vector frames) BOOST_AUTO_TEST_CASE (ffmpeg_decoder_seek_test) { vector frames; - + frames.clear (); frames.push_back (0); frames.push_back (42); @@ -82,13 +82,13 @@ BOOST_AUTO_TEST_CASE (ffmpeg_decoder_seek_test) test ("boon_telly.mkv", frames); test ("Sintel_Trailer1.480p.DivX_Plus_HD.mkv", frames); - + frames.clear (); frames.push_back (15); frames.push_back (42); frames.push_back (999); frames.push_back (15); - + test ("prophet_clip.mkv", frames); } diff --git a/test/ffmpeg_decoder_sequential_test.cc b/test/ffmpeg_decoder_sequential_test.cc index 98c7bf9e2..601dd1c59 100644 --- a/test/ffmpeg_decoder_sequential_test.cc +++ b/test/ffmpeg_decoder_sequential_test.cc @@ -46,25 +46,25 @@ test (boost::filesystem::path file, float fps, int gaps) } shared_ptr film = new_test_film ("ffmpeg_decoder_seek_test_" + file.string()); - shared_ptr content (new FFmpegContent (film, path)); + shared_ptr content (new FFmpegContent (film, path)); film->examine_and_add_content (content); wait_for_jobs (); shared_ptr log (new NullLog); shared_ptr decoder (new FFmpegDecoder (content, log)); BOOST_CHECK_CLOSE (decoder->video_content()->video_frame_rate(), fps, 0.01); - + Frame const N = decoder->video_content()->video_length(); -#ifdef DCPOMATIC_DEBUG +#ifdef DCPOMATIC_DEBUG decoder->test_gaps = 0; -#endif +#endif for (Frame i = 0; i < N; ++i) { list v; v = decoder->get_video (i, true); BOOST_CHECK_EQUAL (v.size(), 1U); BOOST_CHECK_EQUAL (v.front().frame, i); } -#ifdef DCPOMATIC_DEBUG +#ifdef DCPOMATIC_DEBUG BOOST_CHECK_EQUAL (decoder->test_gaps, gaps); #endif } diff --git a/test/file_group_test.cc b/test/file_group_test.cc index 888834511..9b70bd944 100644 --- a/test/file_group_test.cc +++ b/test/file_group_test.cc @@ -36,7 +36,7 @@ BOOST_AUTO_TEST_CASE (file_group_test) for (int i = 0; i < 65536; ++i) { data[i] = rand() & 0xff; } - + int const num_files = 4; int length[] = { diff --git a/test/film_metadata_test.cc b/test/film_metadata_test.cc index 851fffb3f..423bc4ccc 100644 --- a/test/film_metadata_test.cc +++ b/test/film_metadata_test.cc @@ -58,7 +58,7 @@ BOOST_AUTO_TEST_CASE (film_metadata_test) BOOST_CHECK_EQUAL (g->name(), "fred"); BOOST_CHECK_EQUAL (g->dcp_content_type(), DCPContentType::from_pretty_name ("Short")); BOOST_CHECK_EQUAL (g->container(), Ratio::from_id ("185")); - + g->write_metadata (); check_xml ("test/data/metadata.xml.ref", dir.string() + "/metadata.xml", ignore); } diff --git a/test/frame_rate_test.cc b/test/frame_rate_test.cc index cf3dc2612..0133431ee 100644 --- a/test/frame_rate_test.cc +++ b/test/frame_rate_test.cc @@ -43,9 +43,9 @@ BOOST_AUTO_TEST_CASE (best_dcp_frame_rate_test_single) shared_ptr content (new FFmpegContent (film, "test/data/test.mp4")); film->add_content (content); wait_for_jobs (); - + /* Run some tests with a limited range of allowed rates */ - + std::list afr; afr.push_back (24); afr.push_back (25); @@ -60,7 +60,7 @@ BOOST_AUTO_TEST_CASE (best_dcp_frame_rate_test_single) BOOST_CHECK_EQUAL (frc.repeat, 1); BOOST_CHECK_EQUAL (frc.change_speed, false); BOOST_CHECK_CLOSE (frc.speed_up, 1, 0.1); - + content->_video_frame_rate = 50; best = film->best_video_frame_rate (); frc = FrameRateChange (50, best); @@ -96,7 +96,7 @@ BOOST_AUTO_TEST_CASE (best_dcp_frame_rate_test_single) BOOST_CHECK_EQUAL (frc.repeat, 1); BOOST_CHECK_EQUAL (frc.change_speed, true); BOOST_CHECK_CLOSE (frc.speed_up, 30 / 29.97, 0.1); - + content->_video_frame_rate = 25; best = film->best_video_frame_rate (); frc = FrameRateChange (25, best); @@ -168,7 +168,7 @@ BOOST_AUTO_TEST_CASE (best_dcp_frame_rate_test_single) BOOST_CHECK_EQUAL (frc.repeat, 1); BOOST_CHECK_EQUAL (frc.change_speed, false); BOOST_CHECK_CLOSE (frc.speed_up, 1, 0.1); - + content->_video_frame_rate = 50; best = film->best_video_frame_rate (); frc = FrameRateChange (50, best); @@ -188,7 +188,7 @@ BOOST_AUTO_TEST_CASE (best_dcp_frame_rate_test_single) BOOST_CHECK_CLOSE (frc.speed_up, 1, 0.1); /* Check some out-there conversions (not the best) */ - + frc = FrameRateChange (14.99, 24); BOOST_CHECK_EQUAL (frc.skip, false); BOOST_CHECK_EQUAL (frc.repeat, 2); @@ -225,7 +225,7 @@ BOOST_AUTO_TEST_CASE (best_dcp_frame_rate_test_double) wait_for_jobs (); /* Run some tests with a limited range of allowed rates */ - + std::list afr; afr.push_back (24); afr.push_back (25); @@ -244,7 +244,7 @@ BOOST_AUTO_TEST_CASE (audio_sampling_rate_test) shared_ptr content (new FFmpegContent (film, "test/data/test.mp4")); film->examine_and_add_content (content); wait_for_jobs (); - + std::list afr; afr.push_back (24); afr.push_back (25); @@ -286,7 +286,7 @@ BOOST_AUTO_TEST_CASE (audio_sampling_rate_test) BOOST_CHECK_EQUAL (content->resampled_audio_frame_rate(), 50000); /* Check some out-there conversions (not the best) */ - + content->_video_frame_rate = 14.99; film->set_video_frame_rate (25); stream->_frame_rate = 16000; diff --git a/test/image_test.cc b/test/image_test.cc index 5561f021c..21363b5ef 100644 --- a/test/image_test.cc +++ b/test/image_test.cc @@ -186,7 +186,7 @@ crop_scale_window_single (AVPixelFormat in_format, dcp::Size in_size, Crop crop, } } } - + /* Convert using separate methods */ boost::shared_ptr sep = test->crop (crop, true); sep = sep->scale (inter_size, dcp::YUV_TO_RGB_REC601, PIX_FMT_RGB24, true); @@ -235,7 +235,7 @@ BOOST_AUTO_TEST_CASE (crop_scale_window_test) BOOST_AUTO_TEST_CASE (alpha_blend_test) { int const stride = 48 * 4; - + shared_ptr A (new Image (AV_PIX_FMT_RGBA, dcp::Size (48, 48), false)); A->make_black (); uint8_t* a = A->data()[0]; @@ -289,7 +289,7 @@ BOOST_AUTO_TEST_CASE (alpha_blend_test) BOOST_AUTO_TEST_CASE (merge_test1) { int const stride = 48 * 4; - + shared_ptr A (new Image (AV_PIX_FMT_RGBA, dcp::Size (48, 48), false)); A->make_transparent (); uint8_t* a = A->data()[0]; diff --git a/test/isdcf_name_test.cc b/test/isdcf_name_test.cc index b54ce205f..38cd54569 100644 --- a/test/isdcf_name_test.cc +++ b/test/isdcf_name_test.cc @@ -84,7 +84,7 @@ BOOST_AUTO_TEST_CASE (isdcf_name_test) film->set_dcp_content_type (DCPContentType::from_isdcf_name ("XSN")); BOOST_CHECK_EQUAL (film->isdcf_name(false), "MyNiceFilmWith_XSN-2_F-133_DE-FR_US-R_4K_DI_20140704_PP_SMPTE_VF"); - + /* Test 3D */ film->set_three_d (true); @@ -123,7 +123,7 @@ BOOST_AUTO_TEST_CASE (isdcf_name_test) BOOST_CHECK_EQUAL (film->isdcf_name(false), "LikeShouting_XSN-2_F-133_DE-FR_US-R_4K_DI_20140704_PP_SMPTE_VF"); /* Test audio channel markup */ - + film->set_audio_channels (6); shared_ptr sound (new SndfileContent (film, "test/data/sine_440.wav")); film->examine_and_add_content (sound); diff --git a/test/make_black_test.cc b/test/make_black_test.cc index b0243310b..ec5aa6999 100644 --- a/test/make_black_test.cc +++ b/test/make_black_test.cc @@ -75,13 +75,13 @@ BOOST_AUTO_TEST_CASE (make_black_test) pix_fmts.push_back (AV_PIX_FMT_YUVA422P16LE); pix_fmts.push_back (AV_PIX_FMT_YUVA444P16LE); pix_fmts.push_back (AV_PIX_FMT_RGB555LE); // 46 - + int N = 0; for (list::const_iterator i = pix_fmts.begin(); i != pix_fmts.end(); ++i) { boost::shared_ptr foo (new Image (*i, in_size, true)); foo->make_black (); boost::shared_ptr bar = foo->scale (out_size, dcp::YUV_TO_RGB_REC601, PIX_FMT_RGB24, true); - + uint8_t* p = bar->data()[0]; for (int y = 0; y < bar->size().height; ++y) { uint8_t* q = p; diff --git a/test/pixel_formats_test.cc b/test/pixel_formats_test.cc index 68d225e6e..f99bd717c 100644 --- a/test/pixel_formats_test.cc +++ b/test/pixel_formats_test.cc @@ -51,7 +51,7 @@ struct Case bpp[1] = b1; bpp[2] = b2; } - + AVPixelFormat format; int components; int lines[3]; diff --git a/test/play_test.cc b/test/play_test.cc index dcf8e7f6d..8ad2180b8 100644 --- a/test/play_test.cc +++ b/test/play_test.cc @@ -62,7 +62,7 @@ public: if (_queue.empty ()) { return optional