return VideoRange::FULL;
}
+ PixelQuanta pixel_quanta () const {
+ return {};
+ }
+
std::string name () const {
return _name;
}
return VideoRange::FULL;
}
}
+
+
+PixelQuanta
+FFmpegExaminer::pixel_quanta () const
+{
+ auto const desc = av_pix_fmt_desc_get(video_codec_context()->pix_fmt);
+ return { 1 << desc->log2_chroma_w, 1 << desc->log2_chroma_h };
+}
+
VideoRange range () const;
+ PixelQuanta pixel_quanta () const;
+
AVColorRange color_range () const {
return video_codec_context()->color_range;
}
VideoRange range () const {
return VideoRange::FULL;
}
+ PixelQuanta pixel_quanta () const {
+ /* See ::yuv - we're assuming the image is not YUV and so not subsampled */
+ return {};
+ }
private:
std::weak_ptr<const Film> _film;
--- /dev/null
+/*
+ Copyright (C) 2021 Carl Hetherington <cth@carlh.net>
+
+ This file is part of DCP-o-matic.
+
+ DCP-o-matic 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.
+
+ DCP-o-matic 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 DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+
+#include "pixel_quanta.h"
+#include <dcp/raw_convert.h>
+
+
+PixelQuanta::PixelQuanta (cxml::ConstNodePtr node)
+ : x(node->number_child<int>("X"))
+ , y(node->number_child<int>("Y"))
+{
+
+}
+
+
+void
+PixelQuanta::as_xml (xmlpp::Element* node) const
+{
+ node->add_child("X")->add_child_text(dcp::raw_convert<std::string>(x));
+ node->add_child("Y")->add_child_text(dcp::raw_convert<std::string>(y));
+}
+
+
+PixelQuanta
+max (PixelQuanta const& a, PixelQuanta const& b)
+{
+ return { std::max(a.x, b.x), std::max(a.y, b.y) };
+}
+
--- /dev/null
+/*
+ Copyright (C) 2021 Carl Hetherington <cth@carlh.net>
+
+ This file is part of DCP-o-matic.
+
+ DCP-o-matic 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.
+
+ DCP-o-matic 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 DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+
+#ifndef DCPOMATIC_PIXEL_QUANTA_H
+#define DCPOMATIC_PIXEL_QUANTA_H
+
+
+#include "warnings.h"
+
+#include <libcxml/cxml.h>
+DCPOMATIC_DISABLE_WARNINGS
+#include <libxml++/libxml++.h>
+DCPOMATIC_ENABLE_WARNINGS
+
+
+class PixelQuanta
+{
+public:
+ PixelQuanta ()
+ : x(1)
+ , y(1)
+ {}
+
+ /** @param x number of pixels that must not be split in the x direction; e.g. if x=2 scale should
+ * only happen to multiples of 2 width, and x crop should only happen at multiples of 2 position.
+ * @param y similar value for y / height.
+ */
+ PixelQuanta (int x_, int y_)
+ : x(x_)
+ , y(y_)
+ {}
+
+ PixelQuanta (cxml::ConstNodePtr node);
+
+ void as_xml (xmlpp::Element* node) const;
+
+ int x;
+ int y;
+};
+
+
+PixelQuanta max (PixelQuanta const& a, PixelQuanta const& b);
+
+#endif
+
_range = VideoRange::VIDEO;
}
+ if (auto pixel_quanta = node->optional_node_child("PixelQuanta")) {
+ _pixel_quanta = PixelQuanta(pixel_quanta);
+ }
+
auto burnt = node->optional_string_child("BurntSubtitleLanguage");
if (burnt) {
_burnt_subtitle_language = dcp::LanguageTag (*burnt);
if (c[i]->video->yuv ()) {
_yuv = true;
}
+
+ _pixel_quanta = max(_pixel_quanta, c[i]->video->_pixel_quanta);
}
_use = ref->use ();
node->add_child("FadeIn")->add_child_text (raw_convert<string> (_fade_in));
node->add_child("FadeOut")->add_child_text (raw_convert<string> (_fade_out));
node->add_child("Range")->add_child_text(_range == VideoRange::FULL ? "full" : "video");
+ _pixel_quanta.as_xml(node->add_child("PixelQuanta"));
if (_burnt_subtitle_language) {
node->add_child("BurntSubtitleLanguage")->add_child_text(_burnt_subtitle_language->to_string());
}
auto const ar = d->sample_aspect_ratio ();
auto const yuv = d->yuv ();
auto const range = d->range ();
+ auto const pixel_quanta = d->pixel_quanta ();
ContentChangeSignaller cc1 (_parent, VideoContentProperty::SIZE);
ContentChangeSignaller cc2 (_parent, ContentProperty::LENGTH);
_sample_aspect_ratio = ar;
_yuv = yuv;
_range = range;
+ _pixel_quanta = pixel_quanta;
}
LOG_GENERAL ("Video length obtained from header as %1 frames", _length);
#include "colour_conversion.h"
#include "content_part.h"
#include "dcpomatic_time.h"
+#include "pixel_quanta.h"
#include "types.h"
#include "user_property.h"
#include <dcp/language_tag.h>
/** fade out time in content frames */
Frame _fade_out;
VideoRange _range;
+ PixelQuanta _pixel_quanta;
boost::optional<dcp::LanguageTag> _burnt_subtitle_language;
};
/*
- Copyright (C) 2013-2016 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2013-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
/** @file src/lib/video_examiner.h
* @brief VideoExaminer class.
*/
+
+#include "pixel_quanta.h"
#include "types.h"
#include "video_content.h"
#include <dcp/types.h>
+
/** @class VideoExaminer
* @brief Parent for classes which examine video sources and obtain information about them.
*/
/** @return true if this video is in YUV; must not be called if has_video() == false */
virtual bool yuv () const = 0;
virtual VideoRange range () const = 0;
+ virtual PixelQuanta pixel_quanta () const = 0;
};
VideoRange range () const {
return VideoRange::FULL;
}
+ PixelQuanta pixel_quanta () const {
+ return {};
+ }
private:
std::shared_ptr<dcp::PictureAsset> _asset;
log_entry.cc
mid_side_decoder.cc
overlaps.cc
+ pixel_quanta.cc
player.cc
player_text.cc
player_video.cc