From: Carl Hetherington Date: Sun, 16 Dec 2012 12:55:27 +0000 (+0000) Subject: Remove apply crop flag. X-Git-Tag: v2.0.48~1424 X-Git-Url: https://git.carlh.net/gitweb/?a=commitdiff_plain;h=0813034d7193dc8869126d13a9d12d2c4d1e6c14;p=dcpomatic.git Remove apply crop flag. --- diff --git a/src/lib/examine_content_job.cc b/src/lib/examine_content_job.cc index 5c565cd88..eaf1033d9 100644 --- a/src/lib/examine_content_job.cc +++ b/src/lib/examine_content_job.cc @@ -65,10 +65,10 @@ ExamineContentJob::run () will be messed up. */ _film->unset_length (); + _film->set_crop (Crop ()); shared_ptr o (new Options ("", "", "")); o->out_size = Size (512, 512); - o->apply_crop = false; o->decode_audio = false; descend (1); diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc index c7c96ce68..7b97a422e 100644 --- a/src/lib/ffmpeg_decoder.cc +++ b/src/lib/ffmpeg_decoder.cc @@ -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 { diff --git a/src/lib/filter_graph.cc b/src/lib/filter_graph.cc index 7320070fe..17107a05b 100644 --- a/src/lib/filter_graph.cc +++ b/src/lib/filter_graph.cc @@ -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, FFmpegDecoder* decoder, bool crop, Size s, AVPixelFormat p) +FilterGraph::FilterGraph (shared_ptr 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, 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 (); diff --git a/src/lib/filter_graph.h b/src/lib/filter_graph.h index 3842e9f7d..a4b9ef75f 100644 --- a/src/lib/filter_graph.h +++ b/src/lib/filter_graph.h @@ -36,7 +36,7 @@ class FFmpegDecoder; class FilterGraph { public: - FilterGraph (boost::shared_ptr film, FFmpegDecoder* decoder, bool crop, Size s, AVPixelFormat p); + FilterGraph (boost::shared_ptr film, FFmpegDecoder* decoder, Size s, AVPixelFormat p); bool can_process (Size s, AVPixelFormat p) const; std::list > process (AVFrame const * frame); diff --git a/src/lib/options.h b/src/lib/options.h index 65c7b9ebc..9b3866dcb 100644 --- a/src/lib/options.h +++ b/src/lib/options.h @@ -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 > video_decode_range; diff --git a/src/lib/video_decoder.cc b/src/lib/video_decoder.cc index 23a69f958..03a697865 100644 --- a/src/lib/video_decoder.cc +++ b/src/lib/video_decoder.cc @@ -77,7 +77,7 @@ VideoDecoder::emit_subtitle (shared_ptr 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)); } diff --git a/src/tools/servomatictest.cc b/src/tools/servomatictest.cc index d6804c981..41ec8075d 100644 --- a/src/tools/servomatictest.cc +++ b/src/tools/servomatictest.cc @@ -135,7 +135,6 @@ main (int argc, char* argv[]) shared_ptr opt (new Options ("fred", "jim", "sheila")); opt->out_size = Size (1024, 1024); - opt->apply_crop = false; opt->decode_audio = false; shared_ptr decoder = decoder_factory (film.state_copy(), opt, 0, &log_);