Remove trim action settings.
authorCarl Hetherington <cth@carlh.net>
Sun, 4 Nov 2012 01:15:31 +0000 (01:15 +0000)
committerCarl Hetherington <cth@carlh.net>
Sun, 4 Nov 2012 01:15:31 +0000 (01:15 +0000)
src/lib/decoder.cc
src/lib/film.cc
src/lib/film.h
src/lib/options.h
src/lib/trim_action.h [deleted file]
src/wx/dcp_range_dialog.cc
src/wx/dcp_range_dialog.h
src/wx/film_editor.cc
src/wx/film_editor.h

index 6f5d63358641d803a73ea31021d846ebe4c5a4c4..32d0bab64a2df1c77228a45994e727dcd3a05578 100644 (file)
@@ -300,10 +300,6 @@ Decoder::process_video (AVFrame* frame)
        list<shared_ptr<Image> > images = graph->process (frame);
 
        for (list<shared_ptr<Image> >::iterator i = images.begin(); i != images.end(); ++i) {
-               if (_opt->black_after > 0 && _video_frame_index > _opt->black_after) {
-                       (*i)->make_black ();
-               }
-               
                shared_ptr<Subtitle> sub;
                if (_timed_subtitle && _timed_subtitle->displayed_at (double (video_frame_index()) / _film->frames_per_second())) {
                        sub = _timed_subtitle->subtitle ();
index 9c351a64df9f344090088da2f4038cc31f9f27fc..70c8f7db2e66457e9e408bb0a019385bb17e3163 100644 (file)
@@ -82,7 +82,6 @@ Film::Film (string d, bool must_exist)
        , _dcp_content_type (0)
        , _format (0)
        , _scaler (Scaler::from_id ("bicubic"))
-       , _dcp_trim_action (CUT)
        , _dcp_ab (false)
        , _audio_stream (-1)
        , _audio_gain (0)
@@ -143,7 +142,6 @@ Film::Film (Film const & o)
        , _filters           (o._filters)
        , _scaler            (o._scaler)
        , _dcp_frames        (o._dcp_frames)
-       , _dcp_trim_action   (o._dcp_trim_action)
        , _dcp_ab            (o._dcp_ab)
        , _audio_stream      (o._audio_stream)
        , _audio_gain        (o._audio_gain)
@@ -254,21 +252,6 @@ Film::make_dcp (bool transcode)
 
        shared_ptr<Options> o (new Options (j2k_dir(), ".j2c", dir ("wavs")));
        o->out_size = format()->dcp_size ();
-       if (!dcp_frames()) {
-               /* Decode the whole film, no blacking */
-               o->black_after = 0;
-       } else {
-               switch (dcp_trim_action()) {
-               case CUT:
-                       /* Decode only part of the film, no blacking */
-                       o->black_after = 0;
-                       break;
-               case BLACK_OUT:
-                       /* Decode the whole film, but black some frames out */
-                       o->black_after = dcp_frames().get ();
-               }
-       }
-       
        o->padding = format()->dcp_padding (shared_from_this ());
        o->ratio = format()->ratio_as_float (shared_from_this ());
        o->decode_subtitles = with_subtitles ();
@@ -420,17 +403,6 @@ Film::write_metadata () const
        }
        f << "scaler " << _scaler->id () << "\n";
        f << "dcp_frames " << _dcp_frames.get_value_or(0) << "\n";
-
-       f << "dcp_trim_action ";
-       switch (_dcp_trim_action) {
-       case CUT:
-               f << "cut\n";
-               break;
-       case BLACK_OUT:
-               f << "black_out\n";
-               break;
-       }
-       
        f << "dcp_ab " << (_dcp_ab ? "1" : "0") << "\n";
        f << "selected_audio_stream " << _audio_stream << "\n";
        f << "audio_gain " << _audio_gain << "\n";
@@ -514,12 +486,6 @@ Film::read_metadata ()
                        if (vv) {
                                _dcp_frames = vv;
                        }
-               } else if (k == "dcp_trim_action") {
-                       if (v == "cut") {
-                               _dcp_trim_action = CUT;
-                       } else if (v == "black_out") {
-                               _dcp_trim_action = BLACK_OUT;
-                       }
                } else if (k == "dcp_ab") {
                        _dcp_ab = (v == "1");
                } else if (k == "selected_audio_stream") {
@@ -1065,16 +1031,6 @@ Film::unset_dcp_frames ()
        signal_changed (DCP_FRAMES);
 }
 
-void
-Film::set_dcp_trim_action (TrimAction a)
-{
-       {
-               boost::mutex::scoped_lock lm (_state_mutex);
-               _dcp_trim_action = a;
-       }
-       signal_changed (DCP_TRIM_ACTION);
-}
-
 void
 Film::set_dcp_ab (bool a)
 {
index f3ddc652a7609a508a27e2e2fc3633993125541b..ff312fcb537155a27683351deeefa1aac5317d04 100644 (file)
@@ -38,7 +38,6 @@ extern "C" {
 #include "dcp_content_type.h"
 #include "util.h"
 #include "stream.h"
-#include "trim_action.h"
 
 class Format;
 class Job;
@@ -119,7 +118,6 @@ public:
                FILTERS,
                SCALER,
                DCP_FRAMES,
-               DCP_TRIM_ACTION,
                DCP_AB,
                AUDIO_STREAM,
                AUDIO_GAIN,
@@ -193,11 +191,6 @@ public:
                return _dcp_frames;
        }
 
-       TrimAction dcp_trim_action () const {
-               boost::mutex::scoped_lock lm (_state_mutex);
-               return _dcp_trim_action;
-       }
-
        bool dcp_ab () const {
                boost::mutex::scoped_lock lm (_state_mutex);
                return _dcp_ab;
@@ -353,7 +346,6 @@ public:
        void set_scaler (Scaler const *);
        void set_dcp_frames (int);
        void unset_dcp_frames ();
-       void set_dcp_trim_action (TrimAction);
        void set_dcp_ab (bool);
        void set_audio_stream (int);
        void set_audio_gain (float);
@@ -426,8 +418,6 @@ private:
        Scaler const * _scaler;
        /** Maximum number of frames to put in the DCP, if applicable */
        boost::optional<int> _dcp_frames;
-       /** What to do with audio when trimming DCPs */
-       TrimAction _dcp_trim_action;
        /** true to create an A/B comparison DCP, where the left half of the image
            is the video without any filters or post-processing, and the right half
            has the specified filters and post-processing.
index 86db35210a377cad8f3a0caa08059214f467751d..d8b99815d933167a5ef5cc3519c6d02203e548dd 100644 (file)
@@ -39,7 +39,6 @@ public:
        Options (std::string f, std::string e, std::string m)
                : padding (0)
                , apply_crop (true)
-               , black_after (0)
                , decode_video_frequency (0)
                , decode_audio (true)
                , decode_subtitles (false)
@@ -97,7 +96,6 @@ public:
        float ratio;                ///< ratio of the wanted output image (not considering padding)
        int padding;                ///< number of pixels of padding (in terms of the output size) each side of the image
        bool apply_crop;            ///< true to apply cropping
-       int black_after;            ///< first frame for which to output a black frame, rather than the actual video content, or 0 for none
        int decode_video_frequency; ///< skip frames so that this many are decoded in all (or 0) (for generating thumbnails)
        bool decode_audio;          ///< true to decode audio, otherwise false
        bool decode_subtitles;
diff --git a/src/lib/trim_action.h b/src/lib/trim_action.h
deleted file mode 100644 (file)
index 405d31b..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
-    Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#ifndef DVDOMATIC_TRIM_ACTION_H
-#define DVDOMATIC_TRIM_ACTION_H
-
-enum TrimAction {
-       CUT,        ///< cut everything out after dcp_frames
-       BLACK_OUT ///< black out after dcp_frames so that the film stays the same length (and audio continues)
-};
-
-#endif
index 509db121ed239ffa6132683c855329afd2bc325a..5ecd3168e8d2b5ac03d5970552b49280e57abee1 100644 (file)
@@ -43,14 +43,6 @@ DCPRangeDialog::DCPRangeDialog (wxWindow* p, shared_ptr<Film> f)
                table->Add (s);
        }
 
-       table->AddSpacer (0);
-       _cut = new wxRadioButton (this, wxID_ANY, _("Cut remainder"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP);
-       table->Add (_cut);
-
-       table->AddSpacer (0);
-       _black_out = new wxRadioButton (this, wxID_ANY, _("Black-out remainder"));
-       table->Add (_black_out);
-
        _n_frames->SetRange (1, INT_MAX - 1);
        if (_film->dcp_frames()) {
                _whole->SetValue (false);
@@ -62,12 +54,8 @@ DCPRangeDialog::DCPRangeDialog (wxWindow* p, shared_ptr<Film> f)
                _n_frames->SetValue (24);
        }
 
-       _black_out->Enable (_film->dcp_trim_action() == BLACK_OUT);
-       _cut->Enable (_film->dcp_trim_action() == CUT);
-
        _whole->Connect (wxID_ANY, wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler (DCPRangeDialog::whole_toggled), 0, this);
        _first->Connect (wxID_ANY, wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler (DCPRangeDialog::first_toggled), 0, this);
-       _cut->Connect (wxID_ANY, wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler (DCPRangeDialog::cut_toggled), 0, this);
        _n_frames->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (DCPRangeDialog::n_frames_changed), 0, this);
 
        wxBoxSizer* overall_sizer = new wxBoxSizer (wxVERTICAL);
@@ -102,15 +90,6 @@ void
 DCPRangeDialog::set_sensitivity ()
 {
        _n_frames->Enable (_first->GetValue ());
-       _black_out->Enable (_first->GetValue ());
-       _cut->Enable (_first->GetValue ());
-}
-
-void
-DCPRangeDialog::cut_toggled (wxCommandEvent &)
-{
-       set_sensitivity ();
-       emit_changed ();
 }
 
 void
@@ -127,10 +106,5 @@ DCPRangeDialog::emit_changed ()
                frames = _n_frames->GetValue ();
        }
 
-       TrimAction action = CUT;
-       if (_black_out->GetValue ()) {
-               action = BLACK_OUT;
-       }
-
-       Changed (frames, action);
+       Changed (frames);
 }
index 2c5c3cec24eb49de0c77bcc5988da3f32c49b34c..e3f875e516b3523c3ff35256f55d90ba6af12148 100644 (file)
@@ -20,7 +20,6 @@
 #include <wx/wx.h>
 #include <wx/spinctrl.h>
 #include <boost/signals2.hpp>
-#include "lib/trim_action.h"
 
 class Film;
 
@@ -29,12 +28,11 @@ class DCPRangeDialog : public wxDialog
 public:
        DCPRangeDialog (wxWindow *, boost::shared_ptr<Film>);
 
-       boost::signals2::signal<void (int, TrimAction)> Changed;
+       boost::signals2::signal<void (int)> Changed;
 
 private:
        void whole_toggled (wxCommandEvent &);
        void first_toggled (wxCommandEvent &);
-       void cut_toggled (wxCommandEvent &);
        void n_frames_changed (wxCommandEvent &);
        
        void set_sensitivity ();
@@ -44,6 +42,4 @@ private:
        wxRadioButton* _whole;
        wxRadioButton* _first;
        wxSpinCtrl* _n_frames;
-       wxRadioButton* _cut;
-       wxRadioButton* _black_out;
 };
index f8e914f2028faf04569eec75ba3f3f41b36f3b6f..8bcbd2beb66899fc5e140632db7952854dbe8305 100644 (file)
@@ -510,8 +510,6 @@ FilmEditor::film_changed (Film::Property p)
                }
                _sizer->Layout ();
                break;
-       case Film::DCP_TRIM_ACTION:
-               break;
        case Film::DCP_AB:
                _dcp_ab->SetValue (_film->dcp_ab ());
                break;
@@ -619,7 +617,6 @@ FilmEditor::set_film (shared_ptr<Film> f)
        film_changed (Film::CROP);
        film_changed (Film::FILTERS);
        film_changed (Film::DCP_FRAMES);
-       film_changed (Film::DCP_TRIM_ACTION);
        film_changed (Film::DCP_AB);
        film_changed (Film::SIZE);
        film_changed (Film::LENGTH);
@@ -767,20 +764,18 @@ void
 FilmEditor::change_dcp_range_clicked (wxCommandEvent &)
 {
        DCPRangeDialog* d = new DCPRangeDialog (this, _film);
-       d->Changed.connect (bind (&FilmEditor::dcp_range_changed, this, _1, _2));
+       d->Changed.connect (bind (&FilmEditor::dcp_range_changed, this, _1));
        d->ShowModal ();
 }
 
 void
-FilmEditor::dcp_range_changed (int frames, TrimAction action)
+FilmEditor::dcp_range_changed (int frames)
 {
        if (frames == 0) {
                _film->unset_dcp_frames ();
        } else {
                _film->set_dcp_frames (frames);
        }
-       
-       _film->set_dcp_trim_action (action);
 }
 
 void
index 2d3659615f7aadfbeee36a068168250100bee4a4..936dd7d6b5b020ead597a13c37b5f4866ffde5a9 100644 (file)
@@ -26,7 +26,6 @@
 #include <wx/filepicker.h>
 #include <wx/collpane.h>
 #include <boost/signals2.hpp>
-#include "lib/trim_action.h"
 #include "lib/film.h"
 
 class Film;
@@ -55,7 +54,7 @@ private:
        void bottom_crop_changed (wxCommandEvent &);
        void content_changed (wxCommandEvent &);
        void format_changed (wxCommandEvent &);
-       void dcp_range_changed (int, TrimAction);
+       void dcp_range_changed (int);
        void dcp_content_type_changed (wxCommandEvent &);
        void dcp_ab_toggled (wxCommandEvent &);
        void scaler_changed (wxCommandEvent &);