Remove apply crop flag.
authorCarl Hetherington <cth@carlh.net>
Sun, 16 Dec 2012 12:55:27 +0000 (12:55 +0000)
committerCarl Hetherington <cth@carlh.net>
Sun, 16 Dec 2012 12:55:27 +0000 (12:55 +0000)
src/lib/examine_content_job.cc
src/lib/ffmpeg_decoder.cc
src/lib/filter_graph.cc
src/lib/filter_graph.h
src/lib/options.h
src/lib/video_decoder.cc
src/tools/servomatictest.cc

index 5c565cd88a333a5e00e1c11aa0171a27cb8f28a5..eaf1033d9830d262192c08d12517b846d3a8e0fb 100644 (file)
@@ -65,10 +65,10 @@ ExamineContentJob::run ()
           will be messed up.
        */
        _film->unset_length ();
+       _film->set_crop (Crop ());
        
        shared_ptr<Options> o (new Options ("", "", ""));
        o->out_size = Size (512, 512);
-       o->apply_crop = false;
        o->decode_audio = false;
 
        descend (1);
index c7c96ce68aafcfb78e35b5939a788bcce11b2c4c..7b97a422e9afa6b1992b22d1e4d56adb086d4e6d 100644 (file)
@@ -534,7 +534,7 @@ FFmpegDecoder::filter_and_emit_video (AVFrame* frame)
        }
 
        if (i == _filter_graphs.end ()) {
-               graph.reset (new FilterGraph (_film, this, _opt->apply_crop, Size (frame->width, frame->height), (AVPixelFormat) frame->format));
+               graph.reset (new FilterGraph (_film, this, Size (frame->width, frame->height), (AVPixelFormat) frame->format));
                _filter_graphs.push_back (graph);
                _film->log()->log (String::compose ("New graph for %1x%2, pixel format %3", frame->width, frame->height, frame->format));
        } else {
index 7320070fe6f4c69b18e0247fff28dc7105ff5443..17107a05bd4a0246a3cc521c19a6edd1a9ae658d 100644 (file)
@@ -49,11 +49,10 @@ using boost::shared_ptr;
 /** Construct a FilterGraph for the settings in a film.
  *  @param film Film.
  *  @param decoder Decoder that we are using.
- *  @param crop true to apply crop, otherwise false.
  *  @param s Size of the images to process.
  *  @param p Pixel format of the images to process.
  */
-FilterGraph::FilterGraph (shared_ptr<Film> film, FFmpegDecoder* decoder, bool crop, Size s, AVPixelFormat p)
+FilterGraph::FilterGraph (shared_ptr<Film> film, FFmpegDecoder* decoder, Size s, AVPixelFormat p)
        : _buffer_src_context (0)
        , _buffer_sink_context (0)
        , _size (s)
@@ -64,11 +63,7 @@ FilterGraph::FilterGraph (shared_ptr<Film> film, FFmpegDecoder* decoder, bool cr
                filters += ",";
        }
 
-       if (crop) {
-               filters += crop_string (Position (film->crop().left, film->crop().top), film->cropped_size (decoder->native_size()));
-       } else {
-               filters += crop_string (Position (0, 0), decoder->native_size());
-       }
+       filters += crop_string (Position (film->crop().left, film->crop().top), film->cropped_size (decoder->native_size()));
 
        avfilter_register_all ();
        
index 3842e9f7dbb15be137da617ef1e6c329a5791492..a4b9ef75fb68bd44ed9e9319d15359986c15c600 100644 (file)
@@ -36,7 +36,7 @@ class FFmpegDecoder;
 class FilterGraph
 {
 public:
-       FilterGraph (boost::shared_ptr<Film> film, FFmpegDecoder* decoder, bool crop, Size s, AVPixelFormat p);
+       FilterGraph (boost::shared_ptr<Film> film, FFmpegDecoder* decoder, Size s, AVPixelFormat p);
 
        bool can_process (Size s, AVPixelFormat p) const;
        std::list<boost::shared_ptr<Image> > process (AVFrame const * frame);
index 65c7b9ebc802bed72a5cc6de493076fd4e2bdb51..9b3866dcb5c886793db6ee581db04ec427946233 100644 (file)
@@ -39,7 +39,6 @@ public:
 
        Options (std::string f, std::string e, std::string m)
                : padding (0)
-               , apply_crop (true)
                , decode_video_skip (0)
                , decode_audio (true)
                , decode_subtitles (false)
@@ -97,7 +96,6 @@ public:
        Size out_size;              ///< size of output images
        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
 
        /** Range of video frames to decode */
        boost::optional<std::pair<SourceFrame, SourceFrame> > video_decode_range;
index 23a69f9586c08a96a39f6e6aa792640f1792de0d..03a697865cbd8c7781ee687ecc0ae9e752a596cd 100644 (file)
@@ -77,7 +77,7 @@ VideoDecoder::emit_subtitle (shared_ptr<TimedSubtitle> s)
 {
        _timed_subtitle = s;
        
-       if (_timed_subtitle && _opt->apply_crop) {
+       if (_timed_subtitle) {
                Position const p = _timed_subtitle->subtitle()->position ();
                _timed_subtitle->subtitle()->set_position (Position (p.x - _film->crop().left, p.y - _film->crop().top));
        }
index d6804c981bac2fd2a130888650e5d842badd6e47..41ec8075d174396f4dcee631ed390fcda281f178 100644 (file)
@@ -135,7 +135,6 @@ main (int argc, char* argv[])
 
        shared_ptr<Options> opt (new Options ("fred", "jim", "sheila"));
        opt->out_size = Size (1024, 1024);
-       opt->apply_crop = false;
        opt->decode_audio = false;
 
        shared_ptr<Decoder> decoder = decoder_factory (film.state_copy(), opt, 0, &log_);