boost::signals2::signal<void (boost::weak_ptr<Content>, int, bool)> Changed;
-protected:
+ boost::shared_ptr<VideoContent> video;
+
void signal_changed (int);
+protected:
+
virtual void add_properties (std::list<UserProperty> &) const {}
boost::weak_ptr<const Film> _film;
: Content (film)
, SingleStreamAudioContent (film)
, SubtitleContent (film)
- , video (new VideoContent (film))
, _has_subtitles (false)
, _encrypted (false)
, _kdm_valid (false)
, _reference_audio (false)
, _reference_subtitle (false)
{
+ video.reset (new VideoContent (this, film));
+
read_directory (p);
set_default_colour_conversion ();
}
: Content (film, node)
, SingleStreamAudioContent (film, node, version)
, SubtitleContent (film, node, version)
- , video (new VideoContent (film, node, version))
{
+ video.reset (new VideoContent (this, film, node, version));
+
_name = node->string_child ("Name");
_has_subtitles = node->bool_child ("HasSubtitles");
_encrypted = node->bool_child ("Encrypted");
DCPContent::full_length () const
{
FrameRateChange const frc (video->video_frame_rate (), film()->video_frame_rate ());
- return DCPTime::from_frames (llrint (video_length () * frc.factor ()), film()->video_frame_rate ());
+ return DCPTime::from_frames (llrint (video->video_length () * frc.factor ()), film()->video_frame_rate ());
}
string
list<DCPTimePeriod> p;
scoped_ptr<DCPDecoder> decoder;
try {
- decoder.reset (new DCPDecoder (shared_from_this(), false));
+ decoder.reset (new DCPDecoder (shared_from_this(), film()->log(), false));
} catch (...) {
/* Could not load the DCP; guess reels */
list<DCPTimePeriod> p;
bool
DCPContent::can_reference_video (list<string>& why_not) const
{
- return can_reference<VideoContent> (_("There is other video content overlapping this DCP; remove it."), why_not);
+ /* XXX: this needs to be fixed */
+ return true;
}
bool
DCPContent::can_reference_audio (list<string>& why_not) const
{
- DCPDecoder decoder (shared_from_this(), false);
+ DCPDecoder decoder (shared_from_this(), film()->log(), false);
BOOST_FOREACH (shared_ptr<dcp::Reel> i, decoder.reels()) {
if (!i->main_sound()) {
why_not.push_back (_("The DCP does not have sound in all reels."));
bool
DCPContent::can_reference_subtitle (list<string>& why_not) const
{
- DCPDecoder decoder (shared_from_this(), false);
+ DCPDecoder decoder (shared_from_this(), film()->log(), false);
BOOST_FOREACH (shared_ptr<dcp::Reel> i, decoder.reels()) {
if (!i->main_subtitle()) {
why_not.push_back (_("The DCP does not have subtitles in all reels."));
bool can_reference_subtitle (std::list<std::string> &) const;
- boost::shared_ptr<VideoContent> video;
-
protected:
void add_properties (std::list<UserProperty>& p) const;
using boost::shared_ptr;
using boost::dynamic_pointer_cast;
-DCPDecoder::DCPDecoder (shared_ptr<const DCPContent> c, bool fast)
- : VideoDecoder (c->video)
+DCPDecoder::DCPDecoder (shared_ptr<const DCPContent> c, shared_ptr<Log> log, bool fast)
+ : VideoDecoder (c->video, log)
, AudioDecoder (c, fast)
, SubtitleDecoder (c)
, _dcp_content (c)
/*
- Copyright (C) 2014 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2014-2016 Carl Hetherington <cth@carlh.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
class DCPDecoder : public VideoDecoder, public AudioDecoder, public SubtitleDecoder
{
public:
- DCPDecoder (boost::shared_ptr<const DCPContent>, bool fast);
+ DCPDecoder (boost::shared_ptr<const DCPContent>, boost::shared_ptr<Log> log, bool fast);
std::list<boost::shared_ptr<dcp::Reel> > reels () const {
return _reels;
: Content (film, p)
, AudioContent (film, p)
, SubtitleContent (film, p)
- , video (new VideoContent (film))
{
+ video.reset (new VideoContent (this, film));
+
set_default_colour_conversion ();
}
: Content (film, node)
, AudioContent (film, node)
, SubtitleContent (film, node, version)
- , video (new VideoContent (film, node, version))
{
+ video.reset (new VideoContent (this, film, node, version));
+
list<cxml::NodePtr> c = node->node_children ("SubtitleStream");
for (list<cxml::NodePtr>::const_iterator i = c.begin(); i != c.end(); ++i) {
_subtitle_streams.push_back (shared_ptr<FFmpegSubtitleStream> (new FFmpegSubtitleStream (*i, version)));
: Content (film, c)
, AudioContent (film, c)
, SubtitleContent (film, c)
- , video (new VideoContent (film, c))
{
+ video.reset (new VideoContent (this, film, c));
+
shared_ptr<FFmpegContent> ref = dynamic_pointer_cast<FFmpegContent> (c[0]);
DCPOMATIC_ASSERT (ref);
Content::examine (job);
shared_ptr<FFmpegExaminer> examiner (new FFmpegExaminer (shared_from_this (), job));
- take_from_video_examiner (examiner);
+ video->take_from_video_examiner (examiner);
set_default_colour_conversion ();
{
DCPTime
FFmpegContent::full_length () const
{
- FrameRateChange const frc (video_frame_rate (), film()->video_frame_rate ());
- return DCPTime::from_frames (llrint (video_length_after_3d_combine() * frc.factor()), film()->video_frame_rate());
+ FrameRateChange const frc (video->video_frame_rate (), film()->video_frame_rate ());
+ return DCPTime::from_frames (llrint (video->video_length_after_3d_combine() * frc.factor()), film()->video_frame_rate());
}
void
void
FFmpegContent::set_default_colour_conversion ()
{
- dcp::Size const s = video_size ();
+ dcp::Size const s = video->video_size ();
boost::mutex::scoped_lock lm (_mutex);
if (s.width < 1080) {
- _colour_conversion = PresetColourConversion::from_id ("rec601").conversion;
+ video->set_colour_conversion (PresetColourConversion::from_id ("rec601").conversion);
} else {
- _colour_conversion = PresetColourConversion::from_id ("rec709").conversion;
+ video->set_colour_conversion (PresetColourConversion::from_id ("rec709").conversion);
}
}
void signal_subtitle_stream_changed ();
- boost::shared_ptr<VideoContent> video;
-
protected:
void add_properties (std::list<UserProperty> &) const;
using dcp::Size;
FFmpegDecoder::FFmpegDecoder (shared_ptr<const FFmpegContent> c, shared_ptr<Log> log, bool fast)
- : VideoDecoder (c)
+ : VideoDecoder (c->video, log)
, AudioDecoder (c, fast)
, SubtitleDecoder (c)
, FFmpeg (c)
, _log (log)
- , _pts_offset (pts_offset (c->ffmpeg_audio_streams(), c->first_video(), c->video_frame_rate()))
+ , _pts_offset (pts_offset (c->ffmpeg_audio_streams(), c->first_video(), c->video->video_frame_rate()))
{
}
double const pts = i->second * av_q2d (_format_context->streams[_video_stream]->time_base) + _pts_offset.seconds ();
video (
shared_ptr<ImageProxy> (new RawImageProxy (image)),
- llrint (pts * _ffmpeg_content->video_frame_rate ())
+ llrint (pts * _ffmpeg_content->video->video_frame_rate ())
);
} else {
LOG_WARNING_NC ("Dropping frame without PTS");
out_p += image->stride()[0] / sizeof (uint32_t);
}
- dcp::Size const vs = _ffmpeg_content->video_size ();
+ dcp::Size const vs = _ffmpeg_content->video->video_size ();
dcpomatic::Rect<double> const scaled_rect (
static_cast<double> (rect->x) / vs.width,
static_cast<double> (rect->y) / vs.height,
class FFmpegAudioStream;
class FFmpegSubtitleStream;
+class Job;
class FFmpegExaminer : public FFmpeg, public VideoExaminer
{
if (dcp_content_type() && dcp_content_type()->libdcp_kind() != dcp::TRAILER) {
Ratio const * content_ratio = 0;
BOOST_FOREACH (shared_ptr<Content> i, content ()) {
- shared_ptr<VideoContent> vc = dynamic_pointer_cast<VideoContent> (i);
- if (vc) {
+ if (i->video) {
/* Here's the first piece of video content */
- if (vc->scale().ratio ()) {
- content_ratio = vc->scale().ratio ();
+ if (i->video->scale().ratio ()) {
+ content_ratio = i->video->scale().ratio ();
} else {
- content_ratio = Ratio::from_ratio (vc->video_size().ratio ());
+ content_ratio = Ratio::from_ratio (i->video->video_size().ratio ());
}
break;
}
Film::add_content (shared_ptr<Content> c)
{
/* Add {video,subtitle} content after any existing {video,subtitle} content */
- if (dynamic_pointer_cast<VideoContent> (c)) {
+ if (c->video) {
c->set_position (_playlist->video_end ());
} else if (dynamic_pointer_cast<SubtitleContent> (c)) {
c->set_position (_playlist->subtitle_end ());
case REELTYPE_BY_VIDEO_CONTENT:
{
optional<DCPTime> last_split;
- shared_ptr<VideoContent> last_video;
+ shared_ptr<Content> last_video;
ContentList cl = content ();
BOOST_FOREACH (shared_ptr<Content> c, content ()) {
- shared_ptr<VideoContent> v = dynamic_pointer_cast<VideoContent> (c);
- if (v) {
- BOOST_FOREACH (DCPTime t, v->reel_split_points()) {
+ if (c->video) {
+ BOOST_FOREACH (DCPTime t, c->reel_split_points()) {
if (last_split) {
p.push_back (DCPTimePeriod (last_split.get(), t));
}
last_split = t;
}
- last_video = v;
+ last_video = c;
}
}
ImageContent::ImageContent (shared_ptr<const Film> film, boost::filesystem::path p)
: Content (film)
- , video (new VideoContent (film))
{
+ video.reset (new VideoContent (this, film));
+
if (boost::filesystem::is_regular_file (p) && valid_image_file (p)) {
_paths.push_back (p);
} else {
ImageContent::ImageContent (shared_ptr<const Film> film, cxml::ConstNodePtr node, int version)
: Content (film, node)
- , video (new VideoContent (film, node, version))
{
-
+ video.reset (new VideoContent (this, film, node, version));
}
string
DCPOMATIC_ASSERT (film);
shared_ptr<ImageExaminer> examiner (new ImageExaminer (film, shared_from_this(), job));
- take_from_video_examiner (examiner);
+ video->take_from_video_examiner (examiner);
set_default_colour_conversion ();
}
-void
-ImageContent::set_video_length (Frame len)
-{
- {
- boost::mutex::scoped_lock lm (_mutex);
- _video_length = len;
- }
-
- signal_changed (ContentProperty::LENGTH);
-}
-
DCPTime
ImageContent::full_length () const
{
shared_ptr<const Film> film = _film.lock ();
DCPOMATIC_ASSERT (film);
- FrameRateChange const frc (video_frame_rate(), film->video_frame_rate());
- return DCPTime::from_frames (llrint (video_length_after_3d_combine() * frc.factor ()), film->video_frame_rate ());
+ FrameRateChange const frc (video->video_frame_rate(), film->video_frame_rate());
+ return DCPTime::from_frames (llrint (video->video_length_after_3d_combine() * frc.factor ()), film->video_frame_rate ());
}
string
SafeStringStream s;
s << Content::identifier();
s << "_" << video->identifier ();
- s << "_" << video_length();
+ s << "_" << video->video_length();
return s.str ();
}
BOOST_FOREACH (boost::filesystem::path i, _paths) {
if (valid_j2k_file (i)) {
/* We default to no colour conversion if we have JPEG2000 files */
- unset_colour_conversion ();
+ video->unset_colour_conversion ();
return;
}
}
boost::mutex::scoped_lock lm (_mutex);
if (s) {
- _colour_conversion = PresetColourConversion::from_id ("srgb").conversion;
+ video->set_colour_conversion (PresetColourConversion::from_id ("srgb").conversion);
} else {
- _colour_conversion = PresetColourConversion::from_id ("rec709").conversion;
+ video->set_colour_conversion (PresetColourConversion::from_id ("rec709").conversion);
}
}
void set_default_colour_conversion ();
- void set_video_length (Frame);
bool still () const;
-
- boost::shared_ptr<VideoContent> video;
};
#endif
using boost::shared_ptr;
using dcp::Size;
-ImageDecoder::ImageDecoder (shared_ptr<const ImageContent> c)
- : VideoDecoder (c)
+ImageDecoder::ImageDecoder (shared_ptr<const ImageContent> c, shared_ptr<Log> log)
+ : VideoDecoder (c->video, log)
, _image_content (c)
, _video_position (0)
{
bool
ImageDecoder::pass (PassReason, bool)
{
- if (_video_position >= _image_content->video_length()) {
+ if (_video_position >= _image_content->video->video_length()) {
return true;
}
/* We can't extract image size from a JPEG2000 codestream without decoding it,
so pass in the image content's size here.
*/
- _image.reset (new J2KImageProxy (path, _image_content->video_size ()));
+ _image.reset (new J2KImageProxy (path, _image_content->video->video_size ()));
} else {
_image.reset (new MagickImageProxy (path));
}
ImageDecoder::seek (ContentTime time, bool accurate)
{
VideoDecoder::seek (time, accurate);
- _video_position = time.frames_round (_image_content->video_frame_rate ());
+ _video_position = time.frames_round (_image_content->video->video_frame_rate ());
}
/*
- Copyright (C) 2012-2013 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2016 Carl Hetherington <cth@carlh.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
class ImageDecoder : public VideoDecoder
{
public:
- ImageDecoder (boost::shared_ptr<const ImageContent> c);
+ ImageDecoder (boost::shared_ptr<const ImageContent> c, boost::shared_ptr<Log> log);
boost::shared_ptr<const ImageContent> content () {
return _image_content;
optional<double>
ImageExaminer::video_frame_rate () const
{
- if (_image_content->has_own_video_frame_rate()) {
+ if (_image_content->video->has_own_video_frame_rate()) {
/* The content already knows what frame rate it should be */
- return _image_content->video_frame_rate();
+ return _image_content->video->video_frame_rate();
}
/* Don't know */
shared_ptr<const FFmpegContent> fc = dynamic_pointer_cast<const FFmpegContent> (i);
if (fc) {
decoder.reset (new FFmpegDecoder (fc, _film->log(), _fast));
- frc = FrameRateChange (fc->video_frame_rate(), _film->video_frame_rate());
+ frc = FrameRateChange (fc->video->video_frame_rate(), _film->video_frame_rate());
}
shared_ptr<const DCPContent> dc = dynamic_pointer_cast<const DCPContent> (i);
if (dc) {
- decoder.reset (new DCPDecoder (dc, _fast));
- frc = FrameRateChange (dc->video_frame_rate(), _film->video_frame_rate());
+ decoder.reset (new DCPDecoder (dc, _film->log(), _fast));
+ frc = FrameRateChange (dc->video->video_frame_rate(), _film->video_frame_rate());
}
/* ImageContent */
}
if (!decoder) {
- decoder.reset (new ImageDecoder (ic));
+ decoder.reset (new ImageDecoder (ic, _film->log()));
}
- frc = FrameRateChange (ic->video_frame_rate(), _film->video_frame_rate());
+ frc = FrameRateChange (ic->video->video_frame_rate(), _film->video_frame_rate());
}
/* SndfileContent */
/* Work out a FrameRateChange for the best overlap video for this content */
DCPTime best_overlap_t;
- shared_ptr<VideoContent> best_overlap;
+ shared_ptr<Content> best_overlap;
BOOST_FOREACH (shared_ptr<Content> j, _playlist->content ()) {
- shared_ptr<VideoContent> vc = dynamic_pointer_cast<VideoContent> (j);
- if (!vc) {
+ if (!j->video) {
continue;
}
- DCPTime const overlap = min (vc->end(), i->end()) - max (vc->position(), i->position());
+ DCPTime const overlap = min (j->end(), i->end()) - max (j->position(), i->position());
if (overlap > best_overlap_t) {
- best_overlap = vc;
+ best_overlap = j;
best_overlap_t = overlap;
}
}
if (best_overlap) {
- frc = FrameRateChange (best_overlap->video_frame_rate(), _film->video_frame_rate ());
+ frc = FrameRateChange (best_overlap->video->video_frame_rate(), _film->video_frame_rate ());
} else {
/* No video overlap; e.g. if the DCP is just audio */
frc = FrameRateChange (_film->video_frame_rate(), _film->video_frame_rate ());
} else {
/* Some video content at this time */
shared_ptr<Piece> last = *(ov.rbegin ());
- VideoFrameType const last_type = dynamic_pointer_cast<VideoContent> (last->content)->video_frame_type ();
+ VideoFrameType const last_type = last->content->video->video_frame_type ();
/* Get video from appropriate piece(s) */
BOOST_FOREACH (shared_ptr<Piece> piece, ov) {
shared_ptr<VideoDecoder> decoder = dynamic_pointer_cast<VideoDecoder> (piece->decoder);
DCPOMATIC_ASSERT (decoder);
- shared_ptr<VideoContent> video_content = dynamic_pointer_cast<VideoContent> (piece->content);
- DCPOMATIC_ASSERT (video_content);
- shared_ptr<DCPContent> dcp_content = dynamic_pointer_cast<DCPContent> (video_content);
+ shared_ptr<DCPContent> dcp_content = dynamic_pointer_cast<DCPContent> (piece->content);
if (dcp_content && dcp_content->reference_video () && !_play_referenced) {
continue;
}
/* always use the last video */
piece == last ||
/* with a corresponding L/R eye if appropriate */
- (last_type == VIDEO_FRAME_TYPE_3D_LEFT && video_content->video_frame_type() == VIDEO_FRAME_TYPE_3D_RIGHT) ||
- (last_type == VIDEO_FRAME_TYPE_3D_RIGHT && video_content->video_frame_type() == VIDEO_FRAME_TYPE_3D_LEFT);
+ (last_type == VIDEO_FRAME_TYPE_3D_LEFT && piece->content->video->video_frame_type() == VIDEO_FRAME_TYPE_3D_RIGHT) ||
+ (last_type == VIDEO_FRAME_TYPE_3D_RIGHT && piece->content->video->video_frame_type() == VIDEO_FRAME_TYPE_3D_LEFT);
if (use) {
/* We want to use this piece */
if (content_video.empty ()) {
pvf.push_back (black_player_video_frame (time));
} else {
- dcp::Size image_size = video_content->scale().size (video_content, _video_container_size, _film->frame_size ());
+ dcp::Size image_size = piece->content->video->scale().size (
+ piece->content->video, _video_container_size, _film->frame_size ()
+ );
for (list<ContentVideo>::const_iterator i = content_video.begin(); i != content_video.end(); ++i) {
pvf.push_back (
new PlayerVideo (
i->image,
content_video_to_dcp (piece, i->frame),
- video_content->crop (),
- video_content->fade (i->frame),
+ piece->content->video->crop (),
+ piece->content->video->fade (i->frame),
image_size,
_video_container_size,
i->eyes,
i->part,
- video_content->colour_conversion ()
+ piece->content->video->colour_conversion ()
)
)
);
scoped_ptr<DCPDecoder> decoder;
try {
- decoder.reset (new DCPDecoder (j, false));
+ decoder.reset (new DCPDecoder (j, _film->log(), false));
} catch (...) {
return a;
}
DCPTime next_left;
DCPTime next_right;
BOOST_FOREACH (shared_ptr<Content> i, _content) {
- shared_ptr<VideoContent> vc = dynamic_pointer_cast<VideoContent> (i);
- if (!vc) {
+ if (!i->video) {
continue;
}
- if (vc->video_frame_type() == VIDEO_FRAME_TYPE_3D_RIGHT) {
- vc->set_position (next_right);
- next_right = vc->end();
+ if (i->video->video_frame_type() == VIDEO_FRAME_TYPE_3D_RIGHT) {
+ i->set_position (next_right);
+ next_right = i->end();
} else {
- vc->set_position (next_left);
- next_left = vc->end();
+ i->set_position (next_left);
+ next_left = i->end();
}
- placed.push_back (vc);
+ placed.push_back (i);
}
/* Subtitles */
float this_error = 0;
BOOST_FOREACH (shared_ptr<Content> j, _content) {
- shared_ptr<VideoContent> vc = dynamic_pointer_cast<VideoContent> (j);
- if (!vc || !vc->has_own_video_frame_rate()) {
+ if (!j->video || !j->video->has_own_video_frame_rate()) {
continue;
}
/* Best error for this content; we could use the content as-is or double its rate */
float best_error = min (
- float (fabs (i->source - vc->video_frame_rate ())),
- float (fabs (i->source - vc->video_frame_rate () * 2))
+ float (fabs (i->source - j->video->video_frame_rate ())),
+ float (fabs (i->source - j->video->video_frame_rate () * 2))
);
/* Use the largest difference between DCP and source as the "error" */
Playlist::active_frame_rate_change (DCPTime t, int dcp_video_frame_rate) const
{
for (ContentList::const_reverse_iterator i = _content.rbegin(); i != _content.rend(); ++i) {
- shared_ptr<const VideoContent> vc = dynamic_pointer_cast<const VideoContent> (*i);
- if (!vc) {
+ if (!(*i)->video) {
continue;
}
- if (vc->position() <= t) {
+ if ((*i)->position() <= t) {
/* This is the first piece of content (going backwards...) that starts before t,
so it's the active one.
*/
- return FrameRateChange (vc->video_frame_rate(), dcp_video_frame_rate);
+ return FrameRateChange ((*i)->video->video_frame_rate(), dcp_video_frame_rate);
}
}
}
/* Put video before audio if they start at the same time */
- if (dynamic_pointer_cast<VideoContent>(a) && !dynamic_pointer_cast<VideoContent>(b)) {
+ if (a->video && !b->video) {
return true;
- } else if (!dynamic_pointer_cast<VideoContent>(a) && dynamic_pointer_cast<VideoContent>(b)) {
+ } else if (!a->video && b->video) {
return false;
}
#define SERVER_LINK_VERSION (64+0)
typedef std::vector<boost::shared_ptr<Content> > ContentList;
-typedef std::vector<boost::shared_ptr<VideoContent> > VideoContentList;
typedef std::vector<boost::shared_ptr<AudioContent> > AudioContentList;
typedef std::vector<boost::shared_ptr<SubtitleContent> > SubtitleContentList;
typedef std::vector<boost::shared_ptr<FFmpegContent> > FFmpegContentList;
*/
#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);
+}
#include "video_content_scale.h"
#include "dcpomatic_time.h"
#include "user_property.h"
+#include "types.h"
#include <boost/thread/mutex.hpp>
#include <boost/weak_ptr.hpp>
+#include <boost/enable_shared_from_this.hpp>
class VideoExaminer;
class Ratio;
class Film;
+class Content;
class VideoContentProperty
{
static int const VIDEO_FADE_OUT;
};
-class VideoContent
+class VideoContent : public boost::enable_shared_from_this<VideoContent>
{
public:
- VideoContent (boost::shared_ptr<const Film>);
- VideoContent (boost::shared_ptr<const Film>, cxml::ConstNodePtr, int);
- VideoContent (boost::shared_ptr<const Film>, std::vector<boost::shared_ptr<Content> >);
+ VideoContent (Content* parent, boost::shared_ptr<const Film>);
+ VideoContent (Content* parent, boost::shared_ptr<const Film>, cxml::ConstNodePtr, int);
+ VideoContent (Content* parent, boost::shared_ptr<const Film>, std::vector<boost::shared_ptr<Content> >);
void as_xml (xmlpp::Node *) const;
std::string technical_summary () const;
std::string processing_description () const;
-private:
+ void set_video_length (Frame);
+
void take_from_video_examiner (boost::shared_ptr<VideoExaminer>);
void add_properties (std::list<UserProperty> &) const;
+private:
+
+ Content* _parent;
boost::weak_ptr<const Film> _film;
mutable boost::mutex _mutex;
Frame _video_length;
using boost::shared_ptr;
using boost::optional;
-VideoDecoder::VideoDecoder (shared_ptr<const VideoContent> c)
+VideoDecoder::VideoDecoder (shared_ptr<const VideoContent> c, shared_ptr<Log> log)
#ifdef DCPOMATIC_DEBUG
: test_gaps (0)
, _video_content (c)
#else
: _video_content (c)
#endif
+ , _log (log)
, _last_seek_accurate (true)
, _ignore_video (false)
{
one after the end of _decoded_video we need to seek.
*/
- _video_content->film()->log()->log (String::compose ("VD has request for %1", frame), LogEntry::TYPE_DEBUG_DECODE);
+ _log->log (String::compose ("VD has request for %1", frame), LogEntry::TYPE_DEBUG_DECODE);
if (_decoded_video.empty() || frame < _decoded_video.front().frame || frame > (_decoded_video.back().frame + 1)) {
seek (ContentTime::from_frames (frame, _video_content->video_frame_rate()), accurate);
return;
}
- _video_content->film()->log()->log (String::compose ("VD receives %1", frame), LogEntry::TYPE_DEBUG_DECODE);
+ _log->log (String::compose ("VD receives %1", frame), LogEntry::TYPE_DEBUG_DECODE);
/* Work out what we are going to push into _decoded_video next */
list<ContentVideo> to_push;
class VideoContent;
class ImageProxy;
class Image;
+class Log;
/** @class VideoDecoder
* @brief Parent for classes which decode video.
class VideoDecoder : public virtual Decoder
{
public:
- VideoDecoder (boost::shared_ptr<const VideoContent> c);
+ VideoDecoder (boost::shared_ptr<const VideoContent> c, boost::shared_ptr<Log> log);
std::list<ContentVideo> get_video (Frame frame, bool accurate);
void fill_both_eyes (Frame from, Frame to, Eyes);
boost::shared_ptr<const VideoContent> _video_content;
+ boost::shared_ptr<Log> _log;
std::list<ContentVideo> _decoded_video;
boost::shared_ptr<Image> _black_image;
boost::optional<ContentTime> _last_seek_time;
#include "lib/config.h"
#include "lib/util.h"
#include "lib/video_content.h"
+#include "lib/content.h"
#include "lib/version.h"
#include "lib/signal_manager.h"
#include "lib/log.h"
void content_scale_to_fit_width ()
{
- VideoContentList vc = _film_editor->content_panel()->selected_video ();
- for (VideoContentList::iterator i = vc.begin(); i != vc.end(); ++i) {
- (*i)->scale_and_crop_to_fit_width ();
+ 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 ();
}
}
void content_scale_to_fit_height ()
{
- VideoContentList vc = _film_editor->content_panel()->selected_video ();
- for (VideoContentList::iterator i = vc.begin(); i != vc.end(); ++i) {
- (*i)->scale_and_crop_to_fit_height ();
+ 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 ();
}
}
/*
- Copyright (C) 2013-2015 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2013-2016 Carl Hetherington <cth@carlh.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include "lib/dcp_content_type.h"
#include "lib/ratio.h"
#include "lib/image_content.h"
+#include "lib/video_content.h"
#include <libxml++/libxml++.h>
#include <boost/filesystem.hpp>
#include <getopt.h>
for (int i = optind; i < argc; ++i) {
shared_ptr<Content> c = content_factory (film, boost::filesystem::canonical (argv[i]));
- shared_ptr<VideoContent> vc = dynamic_pointer_cast<VideoContent> (c);
- if (vc) {
- vc->set_scale (VideoContentScale (content_ratio));
+ if (c->video) {
+ c->video->set_scale (VideoContentScale (content_ratio));
}
film->examine_and_add_content (c);
}
for (ContentList::iterator i = content.begin(); i != content.end(); ++i) {
shared_ptr<ImageContent> ic = dynamic_pointer_cast<ImageContent> (*i);
if (ic) {
- ic->set_video_length (still_length * 24);
+ ic->video->set_video_length (still_length * 24);
}
}
return sel;
}
-VideoContentList
+ContentList
ContentPanel::selected_video ()
{
- VideoContentList vc;
+ ContentList vc;
BOOST_FOREACH (shared_ptr<Content> i, selected ()) {
- shared_ptr<VideoContent> t = dynamic_pointer_cast<VideoContent> (i);
- if (t) {
- vc.push_back (t);
+ if (i->video) {
+ vc.push_back (i);
}
}
return;
}
- ic->set_video_frame_rate (frame_rate);
+ ic->video->set_video_frame_rate (frame_rate);
}
_film->examine_and_add_content (content);
_add_folder->Enable (_generally_sensitive);
ContentList selection = selected ();
- VideoContentList video_selection = selected_video ();
+ ContentList video_selection = selected_video ();
AudioContentList audio_selection = selected_audio ();
_remove->Enable (!selection.empty() && _generally_sensitive);
}
ContentList selected ();
- VideoContentList selected_video ();
+ ContentList selected_video ();
AudioContentList selected_audio ();
SubtitleContentList selected_subtitle ();
FFmpegContentList selected_ffmpeg ();
/*
- Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2016 Carl Hetherington <cth@carlh.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include "lib/film.h"
#include "lib/ffmpeg_content.h"
#include "lib/audio_processor.h"
+#include "lib/video_content.h"
#include "lib/dcp_content.h"
#include <dcp/key.h>
#include <dcp/raw_convert.h>
_views.push_back (_labels_view);
BOOST_FOREACH (shared_ptr<Content> i, film->content ()) {
- if (dynamic_pointer_cast<VideoContent> (i)) {
+ if (i->video) {
_views.push_back (shared_ptr<TimelineView> (new TimelineVideoContentView (*this, i)));
}
#include "lib/dcp_subtitle_content.h"
#include "lib/audio_content.h"
#include "lib/text_subtitle_content.h"
+#include "lib/video_content.h"
#include <boost/foreach.hpp>
#include <set>
#include <iostream>
if (property == VideoContentProperty::VIDEO_FRAME_RATE || property == SubtitleContentProperty::SUBTITLE_VIDEO_FRAME_RATE) {
set<double> check_vc;
- shared_ptr<const VideoContent> vc;
+ shared_ptr<const Content> vc;
int count_ac = 0;
- shared_ptr<const AudioContent> ac;
+ shared_ptr<const Content> ac;
int count_sc = 0;
shared_ptr<const SubtitleContent> sc;
BOOST_FOREACH (shared_ptr<const Content> i, _parent->selected ()) {
- shared_ptr<const VideoContent> vt = dynamic_pointer_cast<const VideoContent> (i);
- if (vt) {
- check_vc.insert (vt->video_frame_rate ());
- vc = vt;
+ if (i->video) {
+ check_vc.insert (i->video->video_frame_rate ());
+ vc = i;
}
shared_ptr<const AudioContent> at = dynamic_pointer_cast<const AudioContent> (i);
if (at) {
if ((check_vc.size() == 1 || count_ac == 1 || count_sc == 1) && !single_frame_image_content) {
if (vc) {
- checked_set (_video_frame_rate, raw_convert<string> (vc->video_frame_rate (), 5));
+ checked_set (_video_frame_rate, raw_convert<string> (vc->video->video_frame_rate (), 5));
} else if (ac) {
- checked_set (_video_frame_rate, raw_convert<string> (ac->audio_video_frame_rate (), 5));
+ checked_set (_video_frame_rate, raw_convert<string> (ac->audio->audio_video_frame_rate (), 5));
} else if (sc) {
checked_set (_video_frame_rate, raw_convert<string> (sc->subtitle_video_frame_rate (), 5));
}
shared_ptr<ImageContent> ic = dynamic_pointer_cast<ImageContent> (i);
if (ic && ic->still ()) {
int const vfr = _parent->film()->video_frame_rate ();
- ic->set_video_length (_full_length->get (vfr).frames_round (vfr));
+ ic->video->set_video_length (_full_length->get (vfr).frames_round (vfr));
}
}
}
/*
- Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2016 Carl Hetherington <cth@carlh.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include "lib/ratio.h"
#include "lib/frame_rate_change.h"
#include "lib/dcp_content.h"
+#include "lib/video_content.h"
#include <wx/spinctrl.h>
#include <boost/foreach.hpp>
#include <set>
void
VideoPanel::film_content_changed (int property)
{
- VideoContentList vc = _parent->selected_video ();
- shared_ptr<VideoContent> vcs;
+ ContentList vc = _parent->selected_video ();
+ shared_ptr<Content> vcs;
shared_ptr<FFmpegContent> fcs;
if (!vc.empty ()) {
vcs = vc.front ();
} else if (property == VideoContentProperty::VIDEO_FRAME_RATE) {
setup_description ();
} else if (property == VideoContentProperty::COLOUR_CONVERSION) {
- if (vcs && vcs->colour_conversion ()) {
- optional<size_t> preset = vcs->colour_conversion().get().preset ();
+ if (vcs && vcs->video->colour_conversion ()) {
+ optional<size_t> preset = vcs->video->colour_conversion().get().preset ();
vector<PresetColourConversion> cc = PresetColourConversion::all ();
if (preset) {
checked_set (_colour_conversion, preset.get() + 1);
}
} else if (property == VideoContentProperty::VIDEO_FADE_IN) {
set<Frame> check;
- BOOST_FOREACH (shared_ptr<const VideoContent> i, vc) {
- check.insert (i->fade_in ());
+ BOOST_FOREACH (shared_ptr<const Content> i, vc) {
+ check.insert (i->video->fade_in ());
}
if (check.size() == 1) {
- _fade_in->set (ContentTime::from_frames (vc.front()->fade_in (), vc.front()->video_frame_rate ()), vc.front()->video_frame_rate ());
+ _fade_in->set (
+ ContentTime::from_frames (vc.front()->video->fade_in (), vc.front()->video->video_frame_rate ()),
+ vc.front()->video->video_frame_rate ()
+ );
} else {
_fade_in->clear ();
}
} else if (property == VideoContentProperty::VIDEO_FADE_OUT) {
set<Frame> check;
- BOOST_FOREACH (shared_ptr<const VideoContent> i, vc) {
- check.insert (i->fade_out ());
+ BOOST_FOREACH (shared_ptr<const Content> i, vc) {
+ check.insert (i->video->fade_out ());
}
if (check.size() == 1) {
- _fade_out->set (ContentTime::from_frames (vc.front()->fade_out (), vc.front()->video_frame_rate ()), vc.front()->video_frame_rate ());
+ _fade_out->set (
+ ContentTime::from_frames (vc.front()->video->fade_out (), vc.front()->video->video_frame_rate ()),
+ vc.front()->video->video_frame_rate ()
+ );
} else {
_fade_out->clear ();
}
void
VideoPanel::setup_description ()
{
- VideoContentList vc = _parent->selected_video ();
+ ContentList vc = _parent->selected_video ();
if (vc.empty ()) {
checked_set (_description, wxT (""));
return;
return;
}
- string d = vc.front()->processing_description ();
+ string d = vc.front()->video->processing_description ();
size_t lines = count (d.begin(), d.end(), '\n');
for (int i = lines; i < 6; ++i) {
void
VideoPanel::colour_conversion_changed ()
{
- VideoContentList vc = _parent->selected_video ();
+ ContentList vc = _parent->selected_video ();
if (vc.size() != 1) {
return;
}
vector<PresetColourConversion> all = PresetColourConversion::all ();
if (s == 0) {
- vc.front()->unset_colour_conversion ();
+ vc.front()->video->unset_colour_conversion ();
} else if (s == int (all.size() + 1)) {
edit_colour_conversion_clicked ();
} else {
- vc.front()->set_colour_conversion (all[s - 1].conversion);
+ vc.front()->video->set_colour_conversion (all[s - 1].conversion);
}
}
void
VideoPanel::edit_colour_conversion_clicked ()
{
- VideoContentList vc = _parent->selected_video ();
+ ContentList vc = _parent->selected_video ();
if (vc.size() != 1) {
return;
}
ContentColourConversionDialog* d = new ContentColourConversionDialog (this, vc.front()->yuv ());
- d->set (vc.front()->colour_conversion().get_value_or (PresetColourConversion::all().front ().conversion));
+ d->set (vc.front()->video->colour_conversion().get_value_or (PresetColourConversion::all().front ().conversion));
d->ShowModal ();
- vc.front()->set_colour_conversion (d->get ());
+ vc.front()->video->set_colour_conversion (d->get ());
d->Destroy ();
}
void
VideoPanel::content_selection_changed ()
{
- VideoContentList video_sel = _parent->selected_video ();
+ ContentList video_sel = _parent->selected_video ();
_frame_type->set_content (video_sel);
_left_crop->set_content (video_sel);
_filters_button->Enable (false);
_colour_conversion->Enable (false);
} else {
- VideoContentList video_sel = _parent->selected_video ();
+ ContentList video_sel = _parent->selected_video ();
FFmpegContentList ffmpeg_sel = _parent->selected_ffmpeg ();
bool const single = video_sel.size() == 1;
_colour_conversion->Enable (single && !video_sel.empty ());
}
- VideoContentList vc = _parent->selected_video ();
- shared_ptr<VideoContent> vcs;
+ ContentList vc = _parent->selected_video ();
+ shared_ptr<Content> vcs;
if (!vc.empty ()) {
vcs = vc.front ();
}
- if (vcs && vcs->colour_conversion ()) {
+ if (vcs && vcs->video->colour_conversion ()) {
_edit_colour_conversion_button->Enable (!vcs->colour_conversion().get().preset());
} else {
_edit_colour_conversion_button->Enable (false);
#include "lib/film.h"
#include "lib/ffmpeg_content.h"
#include "lib/dcp_content_type.h"
+#include "lib/video_content.h"
#include "lib/ratio.h"
#include "test.h"
shared_ptr<Film> film = new_test_film ("4k_test");
film->set_name ("4k_test");
shared_ptr<FFmpegContent> c (new FFmpegContent (film, "test/data/test.mp4"));
- c->set_scale (VideoContentScale (Ratio::from_id ("185")));
+ c->video->set_scale (VideoContentScale (Ratio::from_id ("185")));
film->set_resolution (RESOLUTION_4K);
film->set_dcp_content_type (DCPContentType::from_isdcf_name ("FTR"));
film->set_container (Ratio::from_id ("185"));
/*
- Copyright (C) 2013-2014 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2013-2016 Carl Hetherington <cth@carlh.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include "lib/dcp_content_type.h"
#include "lib/film.h"
#include "lib/ratio.h"
+#include "lib/video_content.h"
#include "test.h"
/** @file test/black_fill_test.cc
film->examine_and_add_content (contentB);
wait_for_jobs ();
- contentA->set_scale (VideoContentScale (Ratio::from_id ("185")));
- contentA->set_video_length (3);
+ contentA->video->set_scale (VideoContentScale (Ratio::from_id ("185")));
+ contentA->video->set_video_length (3);
contentA->set_position (DCPTime::from_frames (2, film->video_frame_rate ()));
- contentB->set_scale (VideoContentScale (Ratio::from_id ("185")));
- contentB->set_video_length (1);
+ contentB->video->set_scale (VideoContentScale (Ratio::from_id ("185")));
+ contentB->video->set_video_length (1);
contentB->set_position (DCPTime::from_frames (7, film->video_frame_rate ()));
film->make_dcp ();
film->examine_and_add_content (content);
wait_for_jobs ();
- shared_ptr<DCPDecoder> decoder (new DCPDecoder (content, false));
+ shared_ptr<DCPDecoder> decoder (new DCPDecoder (content, film->log(), false));
list<ContentTimePeriod> ctp = decoder->text_subtitles_during (
ContentTimePeriod (
#include "lib/sndfile_content.h"
#include "lib/film.h"
#include "lib/dcp_content_type.h"
+#include "lib/video_content.h"
#include "lib/ratio.h"
#include "lib/ffmpeg_content.h"
#include "test.h"
wait_for_jobs ();
- c->set_scale (VideoContentScale (Ratio::from_id ("185")));
+ c->video->set_scale (VideoContentScale (Ratio::from_id ("185")));
film->set_container (Ratio::from_id ("185"));
film->set_audio_channels (6);
#include "lib/ffmpeg_content.h"
#include "lib/ratio.h"
#include "lib/dcp_content_type.h"
+#include "lib/video_content.h"
#include "test.h"
using boost::shared_ptr;
wait_for_jobs ();
- c->set_scale (VideoContentScale (Ratio::from_id ("185")));
+ c->video->set_scale (VideoContentScale (Ratio::from_id ("185")));
film->set_container (Ratio::from_id ("185"));
film->set_dcp_content_type (DCPContentType::from_pretty_name ("Test"));
shared_ptr<Film> film = new_test_film ("ffmpeg_pts_offset_test");
shared_ptr<FFmpegContent> content (new FFmpegContent (film, "test/data/test.mp4"));
content->_audio_streams.push_back (shared_ptr<FFmpegAudioStream> (new FFmpegAudioStream));
- content->_video_frame_rate = 24;
+ content->video->_video_frame_rate = 24;
{
/* Sound == video so no offset required */
#include "lib/playlist.h"
#include "lib/ffmpeg_audio_stream.h"
#include "lib/frame_rate_change.h"
+#include "lib/video_content.h"
#include "test.h"
using boost::shared_ptr;
afr.push_back (30);
Config::instance()->set_allowed_dcp_frame_rates (afr);
- content->_video_frame_rate = 60;
+ content->video->_video_frame_rate = 60;
int best = film->best_video_frame_rate ();
FrameRateChange frc = FrameRateChange (60, best);
BOOST_CHECK_EQUAL (best, 30);
BOOST_CHECK_EQUAL (frc.change_speed, false);
BOOST_CHECK_CLOSE (frc.speed_up, 1, 0.1);
- content->_video_frame_rate = 50;
+ content->video->_video_frame_rate = 50;
best = film->best_video_frame_rate ();
frc = FrameRateChange (50, best);
BOOST_CHECK_EQUAL (best, 25);
BOOST_CHECK_EQUAL (frc.change_speed, false);
BOOST_CHECK_CLOSE (frc.speed_up, 1, 0.1);
- content->_video_frame_rate = 48;
+ content->video->_video_frame_rate = 48;
best = film->best_video_frame_rate ();
frc = FrameRateChange (48, best);
BOOST_CHECK_EQUAL (best, 24);
BOOST_CHECK_EQUAL (frc.change_speed, false);
BOOST_CHECK_CLOSE (frc.speed_up, 1, 0.1);
- content->_video_frame_rate = 30;
+ content->video->_video_frame_rate = 30;
best = film->best_video_frame_rate ();
frc = FrameRateChange (30, best);
BOOST_CHECK_EQUAL (best, 30);
BOOST_CHECK_EQUAL (frc.change_speed, false);
BOOST_CHECK_CLOSE (frc.speed_up, 1, 0.1);
- content->_video_frame_rate = 29.97;
+ content->video->_video_frame_rate = 29.97;
best = film->best_video_frame_rate ();
frc = FrameRateChange (29.97, best);
BOOST_CHECK_EQUAL (best, 30);
BOOST_CHECK_EQUAL (frc.change_speed, true);
BOOST_CHECK_CLOSE (frc.speed_up, 30 / 29.97, 0.1);
- content->_video_frame_rate = 25;
+ content->video->_video_frame_rate = 25;
best = film->best_video_frame_rate ();
frc = FrameRateChange (25, best);
BOOST_CHECK_EQUAL (best, 25);
BOOST_CHECK_EQUAL (frc.change_speed, false);
BOOST_CHECK_CLOSE (frc.speed_up, 1, 0.1);
- content->_video_frame_rate = 24;
+ content->video->_video_frame_rate = 24;
best = film->best_video_frame_rate ();
frc = FrameRateChange (24, best);
BOOST_CHECK_EQUAL (best, 24);
BOOST_CHECK_EQUAL (frc.change_speed, false);
BOOST_CHECK_CLOSE (frc.speed_up, 1, 0.1);
- content->_video_frame_rate = 14.5;
+ content->video->_video_frame_rate = 14.5;
best = film->best_video_frame_rate ();
frc = FrameRateChange (14.5, best);
BOOST_CHECK_EQUAL (best, 30);
BOOST_CHECK_EQUAL (frc.change_speed, true);
BOOST_CHECK_CLOSE (frc.speed_up, 15 / 14.5, 0.1);
- content->_video_frame_rate = 12.6;
+ content->video->_video_frame_rate = 12.6;
best = film->best_video_frame_rate ();
frc = FrameRateChange (12.6, best);
BOOST_CHECK_EQUAL (best, 25);
BOOST_CHECK_EQUAL (frc.change_speed, true);
BOOST_CHECK_CLOSE (frc.speed_up, 25 / 25.2, 0.1);
- content->_video_frame_rate = 12.4;
+ content->video->_video_frame_rate = 12.4;
best = film->best_video_frame_rate ();
frc = FrameRateChange (12.4, best);
BOOST_CHECK_EQUAL (best, 25);
BOOST_CHECK_EQUAL (frc.change_speed, true);
BOOST_CHECK_CLOSE (frc.speed_up, 25 / 24.8, 0.1);
- content->_video_frame_rate = 12;
+ content->video->_video_frame_rate = 12;
best = film->best_video_frame_rate ();
frc = FrameRateChange (12, best);
BOOST_CHECK_EQUAL (best, 24);
afr.push_back (60);
Config::instance()->set_allowed_dcp_frame_rates (afr);
- content->_video_frame_rate = 60;
+ content->video->_video_frame_rate = 60;
best = film->best_video_frame_rate ();
frc = FrameRateChange (60, best);
BOOST_CHECK_EQUAL (best, 60);
BOOST_CHECK_EQUAL (frc.change_speed, false);
BOOST_CHECK_CLOSE (frc.speed_up, 1, 0.1);
- content->_video_frame_rate = 50;
+ content->video->_video_frame_rate = 50;
best = film->best_video_frame_rate ();
frc = FrameRateChange (50, best);
BOOST_CHECK_EQUAL (best, 50);
BOOST_CHECK_EQUAL (frc.change_speed, false);
BOOST_CHECK_CLOSE (frc.speed_up, 1, 0.1);
- content->_video_frame_rate = 48;
+ content->video->_video_frame_rate = 48;
best = film->best_video_frame_rate ();
frc = FrameRateChange (48, best);
BOOST_CHECK_EQUAL (best, 48);
afr.push_back (24);
Config::instance()->set_allowed_dcp_frame_rates (afr);
- content->_video_frame_rate = 25;
+ content->video->_video_frame_rate = 25;
best = film->best_video_frame_rate ();
frc = FrameRateChange (25, best);
BOOST_CHECK_EQUAL (best, 24);
afr.push_back (30);
Config::instance()->set_allowed_dcp_frame_rates (afr);
- A->_video_frame_rate = 30;
- B->_video_frame_rate = 24;
+ A->video->_video_frame_rate = 30;
+ B->video->_video_frame_rate = 24;
BOOST_CHECK_EQUAL (film->best_video_frame_rate(), 25);
- A->_video_frame_rate = 24;
- B->_video_frame_rate = 24;
+ A->video->_video_frame_rate = 24;
+ B->video->_video_frame_rate = 24;
BOOST_CHECK_EQUAL (film->best_video_frame_rate(), 24);
- A->_video_frame_rate = 24;
- B->_video_frame_rate = 48;
+ A->video->_video_frame_rate = 24;
+ B->video->_video_frame_rate = 48;
BOOST_CHECK_EQUAL (film->best_video_frame_rate(), 24);
}
shared_ptr<FFmpegAudioStream> stream (new FFmpegAudioStream ("foo", 0, 0, 0));
content->_audio_streams.push_back (stream);
- content->_video_frame_rate = 24;
+ content->video->_video_frame_rate = 24;
film->set_video_frame_rate (24);
stream->_frame_rate = 48000;
BOOST_CHECK_EQUAL (content->resampled_audio_frame_rate(), 48000);
stream->_frame_rate = 80000;
BOOST_CHECK_EQUAL (content->resampled_audio_frame_rate(), 96000);
- content->_video_frame_rate = 23.976;
+ content->video->_video_frame_rate = 23.976;
film->set_video_frame_rate (24);
stream->_frame_rate = 48000;
BOOST_CHECK_EQUAL (content->resampled_audio_frame_rate(), 47952);
- content->_video_frame_rate = 29.97;
+ content->video->_video_frame_rate = 29.97;
film->set_video_frame_rate (30);
BOOST_CHECK_EQUAL (film->video_frame_rate (), 30);
stream->_frame_rate = 48000;
BOOST_CHECK_EQUAL (content->resampled_audio_frame_rate(), 47952);
- content->_video_frame_rate = 25;
+ content->video->_video_frame_rate = 25;
film->set_video_frame_rate (24);
stream->_frame_rate = 48000;
BOOST_CHECK_EQUAL (content->resampled_audio_frame_rate(), 50000);
- content->_video_frame_rate = 25;
+ content->video->_video_frame_rate = 25;
film->set_video_frame_rate (24);
stream->_frame_rate = 44100;
BOOST_CHECK_EQUAL (content->resampled_audio_frame_rate(), 50000);
/* Check some out-there conversions (not the best) */
- content->_video_frame_rate = 14.99;
+ content->video->_video_frame_rate = 14.99;
film->set_video_frame_rate (25);
stream->_frame_rate = 16000;
/* The FrameRateChange within resampled_audio_frame_rate should choose to double-up
/*
- Copyright (C) 2014-2015 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2014-2016 Carl Hetherington <cth@carlh.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include "lib/dcp_content_type.h"
#include "lib/image_content.h"
#include "lib/sndfile_content.h"
+#include "lib/video_content.h"
#include "test.h"
#include <iostream>
shared_ptr<ImageContent> content (new ImageContent (film, "test/data/simple_testcard_640x480.png"));
film->examine_and_add_content (content);
wait_for_jobs ();
- content->set_scale (VideoContentScale (Ratio::from_id ("133")));
+ content->video->set_scale (VideoContentScale (Ratio::from_id ("133")));
film->set_container (Ratio::from_id ("185"));
BOOST_CHECK_EQUAL (film->isdcf_name(false), "MyNiceFilmWith_TLR-2_F_DE-fr_US-R_4K_DI_20140704_PP_SMPTE_OV");