DCPTime
AtmosMXFContent::full_length (shared_ptr<const Film> film) const
{
- FrameRateChange const frc (active_video_frame_rate(film), film->video_frame_rate());
+ FrameRateChange const frc (film, shared_from_this());
return DCPTime::from_frames (llrint (_length * frc.factor()), film->video_frame_rate());
}
return boost::dynamic_pointer_cast<AtmosMXFContent> (Content::shared_from_this ());
}
+ boost::shared_ptr<const AtmosMXFContent> shared_from_this () const {
+ return boost::dynamic_pointer_cast<const AtmosMXFContent> (Content::shared_from_this ());
+ }
+
void examine (boost::shared_ptr<const Film> film, boost::shared_ptr<Job> job);
std::string summary () const;
void as_xml (xmlpp::Node* node, bool with_path) const;
/* Resample to a DCI-approved sample rate */
double t = has_rate_above_48k() ? 96000 : 48000;
- FrameRateChange frc (_parent->active_video_frame_rate(film), film->video_frame_rate());
+ FrameRateChange frc (film, _parent);
/* Compensate if the DCP is being run at a different frame rate
to the source; that is, if the video is run such that it will
if (!video) {
return DCPTime();
}
- FrameRateChange const frc (active_video_frame_rate(film), film->video_frame_rate());
+ FrameRateChange const frc (film, shared_from_this());
return DCPTime::from_frames (llrint(video->length() * frc.factor()), film->video_frame_rate());
}
DCPTime
DCPSubtitleContent::full_length (shared_ptr<const Film> film) const
{
- FrameRateChange const frc (active_video_frame_rate(film), film->video_frame_rate());
+ FrameRateChange const frc (film, shared_from_this());
return DCPTime (_length, frc);
}
DCPTime
FFmpegContent::full_length (shared_ptr<const Film> film) const
{
- FrameRateChange const frc (active_video_frame_rate(film), film->video_frame_rate());
+ FrameRateChange const frc (film, shared_from_this());
if (video) {
return DCPTime::from_frames (llrint (video->length_after_3d_combine() * frc.factor()), film->video_frame_rate());
}
return boost::dynamic_pointer_cast<FFmpegContent> (Content::shared_from_this ());
}
+ boost::shared_ptr<const FFmpegContent> shared_from_this () const {
+ return boost::dynamic_pointer_cast<const FFmpegContent> (Content::shared_from_this ());
+ }
+
void examine (boost::shared_ptr<const Film> film, boost::shared_ptr<Job>);
void take_settings_from (boost::shared_ptr<const Content> c);
std::string summary () const;
#include "frame_rate_change.h"
#include "types.h"
+#include "content.h"
+#include "film.h"
#include "compose.hpp"
#include <cmath>
#include "i18n.h"
using std::string;
+using boost::shared_ptr;
static bool
about_equal (double a, double b)
return (fabs (a - b) < VIDEO_FRAME_RATE_EPSILON);
}
-
FrameRateChange::FrameRateChange (double source_, int dcp_)
- : source (source_)
- , dcp (dcp_)
- , skip (false)
+ : skip (false)
, repeat (1)
, change_speed (false)
{
+ construct (source_, dcp_);
+}
+
+void
+FrameRateChange::construct (double source_, int dcp_)
+{
+ source = source_;
+ dcp = dcp_;
+
if (fabs (source / 2.0 - dcp) < fabs (source - dcp)) {
/* The difference between source and DCP frame rate will be lower
(i.e. better) if we skip.
change_speed = !about_equal (speed_up, 1.0);
}
+FrameRateChange::FrameRateChange (shared_ptr<const Film> film, shared_ptr<const Content> content)
+{
+ construct (content->active_video_frame_rate(film), film->video_frame_rate());
+}
+
+FrameRateChange::FrameRateChange (shared_ptr<const Film> film, Content const * content)
+{
+ construct (content->active_video_frame_rate(film), film->video_frame_rate());
+}
+
string
FrameRateChange::description () const
{
#ifndef DCPOMATIC_FRAME_RATE_CHANGE_H
#define DCPOMATIC_FRAME_RATE_CHANGE_H
+#include <boost/shared_ptr.hpp>
#include <string>
-struct FrameRateChange
+class Film;
+class Content;
+
+class FrameRateChange
{
+public:
FrameRateChange (double, int);
+ FrameRateChange (boost::shared_ptr<const Film> film, boost::shared_ptr<const Content> content);
+ FrameRateChange (boost::shared_ptr<const Film> film, Content const * content);
/** @return factor by which to multiply a source frame rate
to get the effective rate after any skip or repeat has happened.
double speed_up;
std::string description () const;
+
+private:
+ void construct (double source_, int dcp_);
};
#endif
DCPTime
ImageContent::full_length (shared_ptr<const Film> film) const
{
- FrameRateChange const frc (active_video_frame_rate(film), film->video_frame_rate());
+ FrameRateChange const frc (film, shared_from_this());
return DCPTime::from_frames (llrint(video->length_after_3d_combine() * frc.factor()), film->video_frame_rate());
}
return boost::dynamic_pointer_cast<ImageContent> (Content::shared_from_this ());
};
+ boost::shared_ptr<const ImageContent> shared_from_this () const {
+ return boost::dynamic_pointer_cast<const ImageContent> (Content::shared_from_this ());
+ };
+
void examine (boost::shared_ptr<const Film> film, boost::shared_ptr<Job>);
std::string summary () const;
std::string technical_summary () const;
}
shared_ptr<Decoder> decoder = decoder_factory (_film, i, _fast);
- FrameRateChange frc (i->active_video_frame_rate(_film), _film->video_frame_rate());
+ FrameRateChange frc (_film, i);
if (!decoder) {
/* Not something that we can decode; e.g. Atmos content */
return;
}
- FrameRateChange frc(piece->content->active_video_frame_rate(_film), _film->video_frame_rate());
+ FrameRateChange frc (_film, piece->content);
if (frc.skip && (video.frame % 2) == 1) {
return;
}
DCPTime
StringTextFileContent::full_length (shared_ptr<const Film> film) const
{
- FrameRateChange const frc (active_video_frame_rate(film), film->video_frame_rate());
+ FrameRateChange const frc (film, shared_from_this());
return DCPTime (_length, frc);
}
return boost::dynamic_pointer_cast<StringTextFileContent> (Content::shared_from_this ());
}
+ boost::shared_ptr<const StringTextFileContent> shared_from_this () const {
+ return boost::dynamic_pointer_cast<const StringTextFileContent> (Content::shared_from_this ());
+ }
+
void examine (boost::shared_ptr<const Film> film, boost::shared_ptr<Job>);
std::string summary () const;
std::string technical_summary () const;
DCPTime
VideoMXFContent::full_length (shared_ptr<const Film> film) const
{
- FrameRateChange const frc (active_video_frame_rate(film), film->video_frame_rate());
+ FrameRateChange const frc (film, shared_from_this());
return DCPTime::from_frames (llrint (video->length_after_3d_combine() * frc.factor()), film->video_frame_rate());
}
return boost::dynamic_pointer_cast<VideoMXFContent> (Content::shared_from_this ());
}
+ boost::shared_ptr<const VideoMXFContent> shared_from_this () const {
+ return boost::dynamic_pointer_cast<const VideoMXFContent> (Content::shared_from_this ());
+ }
+
void examine (boost::shared_ptr<const Film> film, boost::shared_ptr<Job> job);
std::string summary () const;
std::string technical_summary () const;
{
ContentList const sel = _film_editor->content_panel()->selected();
DCPOMATIC_ASSERT (sel.size() == 1);
- _clipboard = sel.front()->clone();
+ _clipboard = sel.front()->clone(_film);
}
void edit_paste ()
{
ContentList vc = _film_editor->content_panel()->selected_video ();
for (ContentList::iterator i = vc.begin(); i != vc.end(); ++i) {
- (*i)->video->scale_and_crop_to_fit_width ();
+ (*i)->video->scale_and_crop_to_fit_width (_film);
}
}
{
ContentList vc = _film_editor->content_panel()->selected_video ();
for (ContentList::iterator i = vc.begin(); i != vc.end(); ++i) {
- (*i)->video->scale_and_crop_to_fit_height ();
+ (*i)->video->scale_and_crop_to_fit_height (_film);
}
}
if (!_film_to_create.empty ()) {
_frame->new_film (_film_to_create, optional<string> ());
if (!_content_to_add.empty ()) {
- BOOST_FOREACH (shared_ptr<Content> i, content_factory (_frame->film(), _content_to_add)) {
+ BOOST_FOREACH (shared_ptr<Content> i, content_factory(_content_to_add)) {
_frame->film()->examine_and_add_content (i);
}
}
if (!_dcp_to_add.empty ()) {
- _frame->film()->examine_and_add_content (shared_ptr<DCPContent> (new DCPContent (_frame->film(), _dcp_to_add)));
+ _frame->film()->examine_and_add_content(shared_ptr<DCPContent>(new DCPContent(_dcp_to_add)));
}
}
cout << "\n"
<< c->path(0) << "\n"
<< "\tat " << c->position().seconds ()
- << " length " << c->full_length().seconds ()
+ << " length " << c->full_length(film).seconds ()
<< " start trim " << c->trim_start().seconds ()
<< " end trim " << c->trim_end().seconds () << "\n";
if (c->video) {
cout << "\t" << c->video->size().width << "x" << c->video->size().height << "\n"
- << "\t" << c->active_video_frame_rate() << "fps\n"
+ << "\t" << c->active_video_frame_rate(film) << "fps\n"
<< "\tcrop left " << c->video->left_crop()
<< " right " << c->video->right_crop()
<< " top " << c->video->top_crop()
list<shared_ptr<Content> > content;
if (boost::filesystem::exists (can / "ASSETMAP") || (boost::filesystem::exists (can / "ASSETMAP.xml"))) {
- content.push_back (shared_ptr<DCPContent> (new DCPContent (film, can)));
+ content.push_back (shared_ptr<DCPContent>(new DCPContent(can)));
} else {
/* I guess it's not a DCP */
- content = content_factory (film, can);
+ content = content_factory (can);
}
BOOST_FOREACH (shared_ptr<Content> j, content) {