FrameRateChange const frc (film, shared_from_this());
return DCPTime::from_frames (llrint (_length * frc.factor()), film->video_frame_rate());
}
+
+DCPTime
+AtmosMXFContent::approximate_length () const
+{
+ return DCPTime::from_frames (_length, 24);
+}
std::string summary () const;
void as_xml (xmlpp::Node* node, bool with_path) const;
DCPTime full_length (boost::shared_ptr<const Film> film) const;
+ DCPTime approximate_length () const;
static bool valid_mxf (boost::filesystem::path path);
virtual void as_xml (xmlpp::Node *, bool with_paths) const;
virtual DCPTime full_length (boost::shared_ptr<const Film>) const = 0;
+ virtual DCPTime approximate_length () const = 0;
virtual std::string identifier () const;
/** @return points at which to split this content when
* REELTYPE_BY_VIDEO_CONTENT is in use.
AudioStreamPtr as (new AudioStream (examiner->audio_frame_rate(), examiner->audio_length(), examiner->audio_channels()));
audio->set_stream (as);
AudioMapping m = as->mapping ();
- m.make_default (film->audio_processor());
+ m.make_default (film ? film->audio_processor() : 0);
as->set_mapping (m);
}
return DCPTime::from_frames (llrint(video->length() * frc.factor()), film->video_frame_rate());
}
+DCPTime
+DCPContent::approximate_length () const
+{
+ if (!video) {
+ return DCPTime();
+ }
+ return DCPTime::from_frames (video->length(), 24);
+}
+
string
DCPContent::identifier () const
{
}
DCPTime full_length (boost::shared_ptr<const Film> film) const;
+ DCPTime approximate_length () const;
void examine (boost::shared_ptr<const Film> film, boost::shared_ptr<Job>);
std::string summary () const;
return DCPTime (_length, frc);
}
+DCPTime
+DCPSubtitleContent::approximate_length () const
+{
+ return DCPTime (_length, FrameRateChange());
+}
+
string
DCPSubtitleContent::summary () const
{
std::string technical_summary () const;
void as_xml (xmlpp::Node *, bool with_paths) const;
DCPTime full_length (boost::shared_ptr<const Film> film) const;
+ DCPTime approximate_length () const;
private:
ContentTime _length;
AudioStreamPtr as = audio->streams().front();
AudioMapping m = as->mapping ();
- m.make_default (film->audio_processor(), first_path);
+ m.make_default (film ? film->audio_processor() : 0, first_path);
as->set_mapping (m);
}
return longest;
}
+DCPTime
+FFmpegContent::approximate_length () const
+{
+ if (video) {
+ return DCPTime::from_frames (video->length_after_3d_combine(), 24);
+ }
+
+ DCPOMATIC_ASSERT (audio);
+
+ Frame longest = 0;
+ BOOST_FOREACH (AudioStreamPtr i, audio->streams ()) {
+ longest = max (longest, Frame(llrint(i->length())));
+ }
+
+ return DCPTime::from_frames (longest, 24);
+}
+
void
FFmpegContent::set_filters (vector<Filter const *> const & filters)
{
std::string technical_summary () const;
void as_xml (xmlpp::Node *, bool with_paths) const;
DCPTime full_length (boost::shared_ptr<const Film> film) const;
+ DCPTime approximate_length () const;
std::string identifier () const;
return (fabs (a - b) < VIDEO_FRAME_RATE_EPSILON);
}
+FrameRateChange::FrameRateChange ()
+ : skip (false)
+ , repeat (1)
+ , change_speed (false)
+ , source (24)
+ , dcp (24)
+ , speed_up (1)
+{
+
+}
+
FrameRateChange::FrameRateChange (double source_, int dcp_)
: skip (false)
, repeat (1)
class FrameRateChange
{
public:
+ FrameRateChange ();
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 DCPTime::from_frames (llrint(video->length_after_3d_combine() * frc.factor()), film->video_frame_rate());
}
+DCPTime
+ImageContent::approximate_length () const
+{
+ return DCPTime::from_frames (video->length_after_3d_combine(), 24);
+}
+
string
ImageContent::identifier () const
{
std::string technical_summary () const;
void as_xml (xmlpp::Node *, bool with_paths) const;
DCPTime full_length (boost::shared_ptr<const Film> film) const;
+ DCPTime approximate_length () const;
std::string identifier () const;
FrameRateChange const frc (film, shared_from_this());
return DCPTime (_length, frc);
}
+
+DCPTime
+StringTextFileContent::approximate_length () const
+{
+ return DCPTime (_length, FrameRateChange());
+}
std::string technical_summary () const;
void as_xml (xmlpp::Node *, bool with_paths) const;
DCPTime full_length (boost::shared_ptr<const Film> film) const;
+ DCPTime approximate_length () const;
private:
ContentTime _length;
return DCPTime::from_frames (llrint (video->length_after_3d_combine() * frc.factor()), film->video_frame_rate());
}
+DCPTime
+VideoMXFContent::approximate_length () const
+{
+ return DCPTime::from_frames (video->length_after_3d_combine(), 24);
+}
+
void
VideoMXFContent::add_properties (list<UserProperty>& p) const
{
std::string identifier () const;
void as_xml (xmlpp::Node* node, bool with_paths) const;
DCPTime full_length (boost::shared_ptr<const Film> film) const;
+ DCPTime approximate_length () const;
void add_properties (std::list<UserProperty>& p) const;
static bool valid_mxf (boost::filesystem::path path);
public:
ContentDialog (wxWindow* parent, weak_ptr<Film> film)
: wxDialog (parent, wxID_ANY, _("Add content"), wxDefaultPosition, wxSize(800, 640))
- , _content_view (new ContentView(this, film))
+ , _content_view (new ContentView(this))
{
_content_view->update ();
using boost::optional;
using boost::dynamic_pointer_cast;
-ContentView::ContentView (wxWindow* parent, weak_ptr<Film> film)
+ContentView::ContentView (wxWindow* parent)
: wxListCtrl (parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT | wxLC_NO_HEADER)
- , _film (film)
{
AppendColumn (wxT(""), wxLIST_FORMAT_LEFT, 80);
/* type */
void
ContentView::update ()
{
- shared_ptr<Film> film = _film.lock ();
- if (!film) {
- return;
- }
-
using namespace boost::filesystem;
DeleteAllItems ();
}
if (content) {
- shared_ptr<ExamineContentJob> job(new ExamineContentJob(film, content));
+ shared_ptr<ExamineContentJob> job(new ExamineContentJob(shared_ptr<Film>(), content));
jm->add (job);
jobs.push_back (job);
}
{
int const N = GetItemCount();
- shared_ptr<Film> film = _film.lock ();
- DCPOMATIC_ASSERT (film);
-
wxListItem it;
it.SetId(N);
it.SetColumn(0);
- DCPTime length = content->length_after_trim (film);
+ DCPTime length = content->approximate_length ();
int h, m, s, f;
length.split (24, h, m, s, f);
it.SetText(wxString::Format("%02d:%02d:%02d", h, m, s));
return shared_ptr<Content>();
}
-
-void
-ContentView::set_film (weak_ptr<Film> film)
-{
- if (_film.lock() == film.lock()) {
- return;
- }
-
- _film = film;
- update ();
-}
class ContentView : public wxListCtrl, public ContentStore
{
public:
- ContentView (wxWindow* parent, boost::weak_ptr<Film> film);
+ ContentView (wxWindow* parent);
boost::shared_ptr<Content> selected () const;
void update ();
boost::shared_ptr<Content> get (std::string digest) const;
- void set_film (boost::weak_ptr<Film> film);
private:
void add (boost::shared_ptr<Content> content);
left_sizer->Add (_spl_view, 1, wxALL | wxEXPAND, DCPOMATIC_SIZER_GAP);
- _content_view = new ContentView (this, _film);
+ _content_view = new ContentView (this);
left_sizer->Add (_content_view, 1, wxALL | wxEXPAND, DCPOMATIC_SIZER_GAP);
_current_spl_view = new wxListCtrl (this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT | wxLC_NO_HEADER);
SwaroopControls::set_film (shared_ptr<Film> film)
{
Controls::set_film (film);
-
- _content_view->set_film (film);
update_playlist_directory ();
-
setup_sensitivity ();
}