*/
#include "video_content.h"
+#include "content.h"
#include "video_examiner.h"
#include "compose.hpp"
#include "ratio.h"
using boost::optional;
using boost::dynamic_pointer_cast;
-VideoContent::VideoContent (shared_ptr<const Film> film)
- : _film (film)
+VideoContent::VideoContent (Content* parent, shared_ptr<const Film> film)
+ : _parent (parent)
+ , _film (film)
, _video_length (0)
, _video_frame_type (VIDEO_FRAME_TYPE_2D)
, _scale (VideoContentScale (Ratio::from_id ("178")))
}
-VideoContent::VideoContent (shared_ptr<const Film> film, cxml::ConstNodePtr node, int version)
- : _film (film)
+VideoContent::VideoContent (Content* parent, shared_ptr<const Film> film, cxml::ConstNodePtr node, int version)
+ : _parent (parent)
+ , _film (film)
{
_video_size.width = node->number_child<int> ("VideoWidth");
_video_size.height = node->number_child<int> ("VideoHeight");
}
}
-VideoContent::VideoContent (shared_ptr<const Film> film, vector<shared_ptr<Content> > c)
- : _film (film)
+VideoContent::VideoContent (Content* parent, shared_ptr<const Film> film, vector<shared_ptr<Content> > c)
+ : _parent (parent)
+ , _film (film)
, _video_length (0)
, _yuv (false)
{
DCPOMATIC_ASSERT (film);
LOG_GENERAL ("Video length obtained from header as %1 frames", _video_length);
- signal_changed (VideoContentProperty::VIDEO_SIZE);
- signal_changed (VideoContentProperty::VIDEO_FRAME_RATE);
- signal_changed (VideoContentProperty::VIDEO_SCALE);
- signal_changed (ContentProperty::LENGTH);
+ _parent->signal_changed (VideoContentProperty::VIDEO_SIZE);
+ _parent->signal_changed (VideoContentProperty::VIDEO_FRAME_RATE);
+ _parent->signal_changed (VideoContentProperty::VIDEO_SCALE);
+ _parent->signal_changed (ContentProperty::LENGTH);
}
void
_crop.left = c;
}
- signal_changed (VideoContentProperty::VIDEO_CROP);
+ _parent->signal_changed (VideoContentProperty::VIDEO_CROP);
}
void
_crop.right = c;
}
- signal_changed (VideoContentProperty::VIDEO_CROP);
+ _parent->signal_changed (VideoContentProperty::VIDEO_CROP);
}
void
_crop.top = c;
}
- signal_changed (VideoContentProperty::VIDEO_CROP);
+ _parent->signal_changed (VideoContentProperty::VIDEO_CROP);
}
void
_crop.bottom = c;
}
- signal_changed (VideoContentProperty::VIDEO_CROP);
+ _parent->signal_changed (VideoContentProperty::VIDEO_CROP);
}
void
_scale = s;
}
- signal_changed (VideoContentProperty::VIDEO_SCALE);
+ _parent->signal_changed (VideoContentProperty::VIDEO_SCALE);
}
/** @return string which includes everything about how this content looks */
_video_frame_type = t;
}
- signal_changed (VideoContentProperty::VIDEO_FRAME_TYPE);
+ _parent->signal_changed (VideoContentProperty::VIDEO_FRAME_TYPE);
}
string
_colour_conversion = boost::optional<ColourConversion> ();
}
- signal_changed (VideoContentProperty::COLOUR_CONVERSION);
+ _parent->signal_changed (VideoContentProperty::COLOUR_CONVERSION);
}
void
_colour_conversion = c;
}
- signal_changed (VideoContentProperty::COLOUR_CONVERSION);
+ _parent->signal_changed (VideoContentProperty::COLOUR_CONVERSION);
}
void
_fade_in = t;
}
- signal_changed (VideoContentProperty::VIDEO_FADE_IN);
+ _parent->signal_changed (VideoContentProperty::VIDEO_FADE_IN);
}
void
_fade_out = t;
}
- signal_changed (VideoContentProperty::VIDEO_FADE_OUT);
+ _parent->signal_changed (VideoContentProperty::VIDEO_FADE_OUT);
}
/** @return Video size after 3D split and crop */
_video_frame_rate = r;
}
- signal_changed (VideoContentProperty::VIDEO_FRAME_RATE);
+ _parent->signal_changed (VideoContentProperty::VIDEO_FRAME_RATE);
}
/** @param f Frame index within the whole (untrimmed) content */
{
DCPOMATIC_ASSERT (f >= 0);
- Frame const ts = trim_start().frames_round(video_frame_rate());
+ Frame const ts = _parent->trim_start().frames_round(video_frame_rate());
if ((f - ts) < fade_in()) {
return double (f - ts) / fade_in();
}
- Frame fade_out_start = video_length() - trim_end().frames_round(video_frame_rate()) - fade_out();
+ Frame fade_out_start = video_length() - _parent->trim_end().frames_round(video_frame_rate()) - fade_out();
if (f >= fade_out_start) {
return 1 - double (f - fade_out_start) / fade_out();
}
shared_ptr<const Film> film = _film.lock ();
DCPOMATIC_ASSERT (film);
dcp::Size const container_size = film->frame_size ();
- dcp::Size const scaled = scale().size (dynamic_pointer_cast<const VideoContent> (shared_from_this ()), container_size, container_size);
+ dcp::Size const scaled = scale().size (shared_from_this(), container_size, container_size);
if (scaled != video_size_after_crop ()) {
d << String::compose (
DCPOMATIC_ASSERT (film);
return _video_frame_rate.get_value_or (film->video_frame_rate ());
}
+
+void
+VideoContent::set_video_length (Frame len)
+{
+ {
+ boost::mutex::scoped_lock lm (_mutex);
+ _video_length = len;
+ }
+
+ _parent->signal_changed (ContentProperty::LENGTH);
+}