diff options
| author | Carl Hetherington <cth@carlh.net> | 2013-05-06 14:10:14 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2013-05-06 14:10:14 +0100 |
| commit | 454a961e1a03f60cf05040b832c4f8f01b481fa7 (patch) | |
| tree | c1e50792318179d99f4a0750ec3f4bac2dac6346 /src/lib | |
| parent | ee191ec1dbea1fda4a93338c5a86e5f53c35efdc (diff) | |
Add basic timeline window.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/audio_content.cc | 6 | ||||
| -rw-r--r-- | src/lib/audio_content.h | 2 | ||||
| -rw-r--r-- | src/lib/content.h | 2 | ||||
| -rw-r--r-- | src/lib/ffmpeg_content.cc | 6 | ||||
| -rw-r--r-- | src/lib/ffmpeg_content.h | 1 | ||||
| -rw-r--r-- | src/lib/film.cc | 7 | ||||
| -rw-r--r-- | src/lib/film.h | 1 | ||||
| -rw-r--r-- | src/lib/types.h | 1 | ||||
| -rw-r--r-- | src/lib/video_content.cc | 6 | ||||
| -rw-r--r-- | src/lib/video_content.h | 1 |
10 files changed, 33 insertions, 0 deletions
diff --git a/src/lib/audio_content.cc b/src/lib/audio_content.cc index 9968f4725..dfa48d97e 100644 --- a/src/lib/audio_content.cc +++ b/src/lib/audio_content.cc @@ -43,3 +43,9 @@ AudioContent::AudioContent (AudioContent const & o) { } + +Time +AudioContent::temporal_length () const +{ + return audio_length() / audio_frame_rate(); +} diff --git a/src/lib/audio_content.h b/src/lib/audio_content.h index 2362786d9..18107843c 100644 --- a/src/lib/audio_content.h +++ b/src/lib/audio_content.h @@ -45,6 +45,8 @@ public: virtual int audio_channels () const = 0; virtual ContentAudioFrame audio_length () const = 0; virtual int audio_frame_rate () const = 0; + + Time temporal_length () const; }; #endif diff --git a/src/lib/content.h b/src/lib/content.h index d39fc9e1a..e1cf41df0 100644 --- a/src/lib/content.h +++ b/src/lib/content.h @@ -25,6 +25,7 @@ #include <boost/thread/mutex.hpp> #include <boost/enable_shared_from_this.hpp> #include <libxml++/libxml++.h> +#include "types.h" namespace cxml { class Node; @@ -45,6 +46,7 @@ public: virtual std::string information () const = 0; virtual void as_xml (xmlpp::Node *) const; virtual boost::shared_ptr<Content> clone () const = 0; + virtual Time temporal_length () const = 0; boost::filesystem::path file () const { boost::mutex::scoped_lock lm (_mutex); diff --git a/src/lib/ffmpeg_content.cc b/src/lib/ffmpeg_content.cc index 719c4cb53..a61f777c8 100644 --- a/src/lib/ffmpeg_content.cc +++ b/src/lib/ffmpeg_content.cc @@ -280,3 +280,9 @@ FFmpegContent::clone () const { return shared_ptr<Content> (new FFmpegContent (*this)); } + +double +FFmpegContent::temporal_length () const +{ + return video_length() / video_frame_rate(); +} diff --git a/src/lib/ffmpeg_content.h b/src/lib/ffmpeg_content.h index 8bf4d42a5..6d7151498 100644 --- a/src/lib/ffmpeg_content.h +++ b/src/lib/ffmpeg_content.h @@ -89,6 +89,7 @@ public: std::string information () const; void as_xml (xmlpp::Node *) const; boost::shared_ptr<Content> clone () const; + double temporal_length () const; /* AudioContent */ int audio_channels () const; diff --git a/src/lib/film.cc b/src/lib/film.cc index 2dc97c1b3..a385625e7 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -1075,6 +1075,13 @@ Film::player () const return shared_ptr<Player> (new Player (shared_from_this (), _playlist)); } +shared_ptr<Playlist> +Film::playlist () const +{ + boost::mutex::scoped_lock lm (_state_mutex); + return _playlist; +} + ContentList Film::content () const { diff --git a/src/lib/film.h b/src/lib/film.h index 8748e18f5..e2f9b101a 100644 --- a/src/lib/film.h +++ b/src/lib/film.h @@ -103,6 +103,7 @@ public: bool have_dcp () const; boost::shared_ptr<Player> player () const; + boost::shared_ptr<Playlist> playlist () const; /* Proxies for some Playlist methods */ diff --git a/src/lib/types.h b/src/lib/types.h index c2bb9d853..f9e9b2f4b 100644 --- a/src/lib/types.h +++ b/src/lib/types.h @@ -29,6 +29,7 @@ class Content; typedef std::vector<boost::shared_ptr<Content> > ContentList; typedef int64_t ContentAudioFrame; typedef int ContentVideoFrame; +typedef double Time; /** @struct Crop * @brief A description of the crop of an image or video. diff --git a/src/lib/video_content.cc b/src/lib/video_content.cc index 9fb2b9bce..2af6ba908 100644 --- a/src/lib/video_content.cc +++ b/src/lib/video_content.cc @@ -104,3 +104,9 @@ VideoContent::information () const return s.str (); } + +Time +VideoContent::temporal_length () const +{ + return video_length() / video_frame_rate(); +} diff --git a/src/lib/video_content.h b/src/lib/video_content.h index 75e507d4d..b2ec87e2b 100644 --- a/src/lib/video_content.h +++ b/src/lib/video_content.h @@ -42,6 +42,7 @@ public: void as_xml (xmlpp::Node *) const; virtual std::string information () const; + Time temporal_length () const; ContentVideoFrame video_length () const { boost::mutex::scoped_lock lm (_mutex); |
