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);
}
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 {
/** 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)
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 ();
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);
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)
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;
{
_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));
}
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_);