Remove erroneous trimmer.cc; use copy for FFMpeg filter passthrough.
authorCarl Hetherington <cth@carlh.net>
Wed, 10 Jul 2013 12:35:36 +0000 (13:35 +0100)
committerCarl Hetherington <cth@carlh.net>
Wed, 10 Jul 2013 12:35:36 +0000 (13:35 +0100)
src/lib/encoder.cc
src/lib/filter_graph.cc
src/lib/trimmer.cc [deleted file]
src/lib/util.cc
src/lib/util.h
src/wx/wx_util.cc

index d3181acd9b1f7df35f0224a96be318b6203f5f1d..ed14f2755f5798013d20ae1048118e7f2e985f1d 100644 (file)
@@ -200,7 +200,6 @@ Encoder::process_video (shared_ptr<const Image> image, bool same)
        } else {
                /* Queue this new frame for encoding */
                TIMING ("adding to queue of %1", _queue.size ());
-               /* XXX: padding */
                _queue.push_back (shared_ptr<DCPVideoFrame> (
                                          new DCPVideoFrame (
                                                  image, _video_frames_out, _film->dcp_video_frame_rate(),
index 275c469096afb33507f78a885d70172643f64dc0..cc16b279d9e71e24d85e9a5dc761c6aa7af87ccc 100644 (file)
@@ -58,13 +58,10 @@ FilterGraph::FilterGraph (shared_ptr<const FFmpegContent> content, libdcp::Size
        _frame = av_frame_alloc ();
        
        string filters = Filter::ffmpeg_strings (content->filters()).first;
-       if (!filters.empty ()) {
-               filters += ",";
+       if (filters.empty ()) {
+               filters = "copy";
        }
 
-       /* XXX; remove */
-       filters += crop_string (Position (), _size);
-
        AVFilterGraph* graph = avfilter_graph_alloc();
        if (graph == 0) {
                throw DecodeError (N_("could not create filter graph."));
diff --git a/src/lib/trimmer.cc b/src/lib/trimmer.cc
deleted file mode 100644 (file)
index 99f0479..0000000
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
-    Copyright (C) 2013 Carl Hetherington <cth@carlh.net>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#include <boost/shared_ptr.hpp>
-#include <stdint.h>
-#include "trimmer.h"
-
-using std::cout;
-using std::max;
-using boost::shared_ptr;
-
-/** @param audio_sample_rate Audio sampling rate, or 0 if there is no audio */
-Trimmer::Trimmer (
-       shared_ptr<Log> log,
-       int video_trim_start,
-       int video_trim_end,
-       int video_length,
-       int audio_sample_rate,
-       float frames_per_second,
-       int dcp_frames_per_second
-       )
-       : AudioVideoProcessor (log)
-       , _video_start (video_trim_start)
-       , _video_end (video_length - video_trim_end)
-       , _video_in (0)
-       , _audio_in (0)
-{
-       FrameRateConversion frc (frames_per_second, dcp_frames_per_second);
-
-       if (frc.skip) {
-               _video_start /= 2;
-               _video_end /= 2;
-       } else if (frc.repeat) {
-               _video_start *= 2;
-               _video_end *= 2;
-       }
-
-       if (audio_sample_rate) {
-               _audio_start = video_frames_to_audio_frames (_video_start, audio_sample_rate, frames_per_second);
-               _audio_end = video_frames_to_audio_frames (_video_end, audio_sample_rate, frames_per_second);
-       }
-
-       /* XXX: this is a hack; if there is no trim at the end, set
-          the audio end point to infinity so that
-          shorter-video-than-audio does not trim audio (which breaks
-          the current set of regression tests).  This could be
-          removed if a) the regression tests are regenerated and b) I
-          can work out what DCP length should be.
-
-          There is also a problem whereby black video frames inserted
-          at the start of the output by the matcher are not taken into account,
-          so if black frames are inserted it means more gets trimmed off the
-          end than should be.  Hack around this in similar fashion with the
-          _video_end = INT_MAX line.
-       */
-       if (video_trim_end == 0) {
-               _video_end = INT_MAX;
-               _audio_end = INT64_MAX;
-       }
-}
-
-void
-Trimmer::process_video (shared_ptr<const Image> image, bool same, shared_ptr<Subtitle> sub)
-{
-       if (_video_in >= _video_start && _video_in < _video_end) {
-               Video (image, same, sub);
-       }
-       
-       ++_video_in;
-}
-
-void
-Trimmer::process_audio (shared_ptr<const AudioBuffers> audio)
-{
-       int64_t offset = _audio_start - _audio_in;
-       if (offset > audio->frames()) {
-               /* we haven't reached the start of the untrimmed section yet */
-               _audio_in += audio->frames ();
-               return;
-       }
-
-       if (offset < 0) {
-               offset = 0;
-       }
-
-       int64_t length = _audio_end - max (_audio_in, _audio_start);
-       if (length < 0) {
-               _audio_in += audio->frames ();
-               return;
-       }
-
-       if (length > (audio->frames() - offset)) {
-               length = audio->frames () - offset;
-       }
-
-       _audio_in += audio->frames ();
-       
-       if (offset != 0 || length != audio->frames ()) {
-               shared_ptr<AudioBuffers> copy (new AudioBuffers (audio));
-               copy->move (offset, 0, length);
-               copy->set_frames (length);
-               audio = copy;
-       }
-       
-       Audio (audio);
-}
-
index d425fc8fefe009c3f0ee44ed94eab18c1d969285..2e4abe64dc30f2f49a4aad27c9b444d290ac7cb4 100644 (file)
@@ -270,7 +270,7 @@ LONG WINAPI exception_handler(struct _EXCEPTION_POINTERS *)
 }
 #endif
 
-/** Call the required functions to set up DVD-o-matic's static arrays, etc.
+/** Call the required functions to set up DCP-o-matic's static arrays, etc.
  *  Must be called from the UI thread, if there is one.
  */
 void
@@ -338,18 +338,6 @@ dcpomatic_setup_gettext_i18n (string lang)
 #endif
 }
 
-/** @param start Start position for the crop within the image.
- *  @param size Size of the cropped area.
- *  @return FFmpeg crop filter string.
- */
-string
-crop_string (Position start, libdcp::Size size)
-{
-       stringstream s;
-       s << N_("crop=") << size.width << N_(":") << size.height << N_(":") << start.x << N_(":") << start.y;
-       return s.str ();
-}
-
 /** @param s A string.
  *  @return Parts of the string split at spaces, except when a space is within quotation marks.
  */
index 7af8ffedf27b07e357011bfaa467c6b8a0eb9ff5..57dc0f783e087b3905a0c51cd16222fc4ac0783c 100644 (file)
@@ -106,7 +106,6 @@ struct FrameRateConversion
        std::string description;
 };
 
-extern std::string crop_string (Position, libdcp::Size);
 extern int dcp_audio_frame_rate (int);
 extern std::string colour_lut_index_to_name (int index);
 extern int stride_round_up (int, int const *, int);
index c5887e17d80b5f3f8b5faade084fac29c73978ec..1a15b0e9875f91444489ffdb4903b9b848d239b3 100644 (file)
@@ -40,7 +40,11 @@ using namespace boost;
  *  @param prop Proportion to pass when calling Add() on the wxSizer.
  */
 wxStaticText *
+#ifdef __WXOSX__
 add_label_to_sizer (wxSizer* s, wxWindow* p, wxString t, bool left, int prop)
+#else
+add_label_to_sizer (wxSizer* s, wxWindow* p, wxString t, bool, int prop)
+#endif
 {
        int flags = wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT;
 #ifdef __WXOSX__
@@ -55,7 +59,11 @@ add_label_to_sizer (wxSizer* s, wxWindow* p, wxString t, bool left, int prop)
 }
 
 wxStaticText *
+#ifdef __WXOSX__
 add_label_to_grid_bag_sizer (wxGridBagSizer* s, wxWindow* p, wxString t, bool left, wxGBPosition pos, wxGBSpan span)
+#else
+add_label_to_grid_bag_sizer (wxGridBagSizer* s, wxWindow* p, wxString t, bool, wxGBPosition pos, wxGBSpan span)
+#endif
 {
        int flags = wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT;
 #ifdef __WXOSX__