-ffmpeg content selected stream is really a playlist thing.
-
things to put back
frame rate description
trust content header?
#include "examine_content_job.h"
#include "log.h"
#include "content.h"
+#include "film.h"
#include "i18n.h"
ExamineContentJob::run ()
{
_content->examine (shared_from_this ());
+ _film->add_content (_content);
set_progress (1);
set_state (FINISHED_OK);
}
-/* -*- c-basic-offset: 8; default-tab-width: 8; -*- */
-
/*
Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
using std::list;
using boost::shared_ptr;
using boost::lexical_cast;
+using boost::dynamic_pointer_cast;
using boost::to_upper_copy;
using boost::ends_with;
using boost::starts_with;
JobManager::instance()->add (_analyse_audio_job);
}
-/** Start a job to examine a piece of content */
-void
-Film::examine_content (shared_ptr<Content> c)
-{
- shared_ptr<Job> j (new ExamineContentJob (shared_from_this(), c));
- JobManager::instance()->add (j);
-}
-
void
Film::analyse_audio_finished ()
{
return _playlist->content ();
}
+void
+Film::examine_and_add_content (shared_ptr<Content> c)
+{
+ shared_ptr<Job> j (new ExamineContentJob (shared_from_this(), c));
+ JobManager::instance()->add (j);
+}
+
void
Film::add_content (shared_ptr<Content> c)
{
+ /* Add video content after any existing content */
+ if (dynamic_pointer_cast<VideoContent> (c)) {
+ c->set_start (_playlist->video_end ());
+ }
+
_playlist->add (c);
- examine_content (c);
}
void
std::string internal_video_mxf_filename () const;
std::string audio_analysis_path () const;
- void examine_content (boost::shared_ptr<Content>);
std::string dcp_video_mxf_filename () const;
std::string dcp_audio_mxf_filename () const;
void set_directory (std::string);
void set_name (std::string);
void set_use_dci_name (bool);
+ void examine_and_add_content (boost::shared_ptr<Content>);
void add_content (boost::shared_ptr<Content>);
void remove_content (boost::shared_ptr<Content>);
void set_dcp_content_type (DCPContentType const *);
}
}
+Time
+Playlist::video_end () const
+{
+ Time end = 0;
+ for (ContentList::const_iterator i = _content.begin(); i != _content.end(); ++i) {
+ if (dynamic_pointer_cast<const VideoContent> (*i)) {
+ end = max (end, (*i)->end ());
+ }
+ }
+
+ return end;
+}
-/* -*- c-basic-offset: 8; default-tab-width: 8; -*- */
-
/*
Copyright (C) 2013 Carl Hetherington <cth@carlh.net>
Time length () const;
int best_dcp_frame_rate () const;
+ Time video_end () const;
mutable boost::signals2::signal<void ()> Changed;
mutable boost::signals2::signal<void (boost::weak_ptr<Content>, int)> ContentChanged;
for (unsigned int i = 0; i < paths.GetCount(); ++i) {
boost::filesystem::path p (wx_to_std (paths[i]));
+ shared_ptr<Content> c;
+
if (ImageMagickContent::valid_file (p)) {
- _film->add_content (shared_ptr<ImageMagickContent> (new ImageMagickContent (_film, p)));
+ c.reset (new ImageMagickContent (_film, p));
} else if (SndfileContent::valid_file (p)) {
- _film->add_content (shared_ptr<SndfileContent> (new SndfileContent (_film, p)));
+ c.reset (new SndfileContent (_film, p));
} else {
- _film->add_content (shared_ptr<FFmpegContent> (new FFmpegContent (_film, p)));
+ c.reset (new FFmpegContent (_film, p));
}
+
+ _film->examine_and_add_content (c);
}
}