diff options
| author | Carl Hetherington <cth@carlh.net> | 2013-04-02 23:33:46 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2013-04-02 23:33:46 +0100 |
| commit | 7ebb57db2013c9e929d44d0e547ab1f27c59cc7f (patch) | |
| tree | 19959172e24e2cf097a2814aeb9e2298805d8a2b /src/lib | |
| parent | 2343509c75673d3fad82a5d0eab9622a4d6902e3 (diff) | |
Add basic content information, and some other bits.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/content.h | 1 | ||||
| -rw-r--r-- | src/lib/ffmpeg_content.cc | 12 | ||||
| -rw-r--r-- | src/lib/ffmpeg_content.h | 1 | ||||
| -rw-r--r-- | src/lib/film.cc | 2 | ||||
| -rw-r--r-- | src/lib/imagemagick_content.cc | 1 | ||||
| -rw-r--r-- | src/lib/sndfile_content.cc | 6 | ||||
| -rw-r--r-- | src/lib/sndfile_content.h | 1 | ||||
| -rw-r--r-- | src/lib/video_content.cc | 20 | ||||
| -rw-r--r-- | src/lib/video_content.h | 1 |
9 files changed, 44 insertions, 1 deletions
diff --git a/src/lib/content.h b/src/lib/content.h index 3f348ca91..11c7438a6 100644 --- a/src/lib/content.h +++ b/src/lib/content.h @@ -41,6 +41,7 @@ public: virtual void examine (boost::shared_ptr<Film>, boost::shared_ptr<Job>, bool); virtual std::string summary () const = 0; + virtual std::string information () const = 0; virtual void as_xml (xmlpp::Node *) const; virtual boost::shared_ptr<Content> clone () const = 0; diff --git a/src/lib/ffmpeg_content.cc b/src/lib/ffmpeg_content.cc index 5bff1cecc..c6344d567 100644 --- a/src/lib/ffmpeg_content.cc +++ b/src/lib/ffmpeg_content.cc @@ -28,6 +28,7 @@ #include "i18n.h" using std::string; +using std::stringstream; using std::vector; using std::list; using boost::shared_ptr; @@ -162,6 +163,17 @@ FFmpegContent::summary () const return String::compose (_("Movie: %1"), file().filename ()); } +string +FFmpegContent::information () const +{ + stringstream s; + + s << String::compose (_("%1 frames; %2 frames per second"), video_length(), video_frame_rate()) << "\n"; + s << VideoContent::information (); + + return s.str (); +} + void FFmpegContent::set_subtitle_stream (FFmpegSubtitleStream s) { diff --git a/src/lib/ffmpeg_content.h b/src/lib/ffmpeg_content.h index 598ebf484..3d69a2f99 100644 --- a/src/lib/ffmpeg_content.h +++ b/src/lib/ffmpeg_content.h @@ -86,6 +86,7 @@ public: void examine (boost::shared_ptr<Film>, boost::shared_ptr<Job>, bool); std::string summary () const; + std::string information () const; void as_xml (xmlpp::Node *) const; boost::shared_ptr<Content> clone () const; diff --git a/src/lib/film.cc b/src/lib/film.cc index d58f7fd53..f71180157 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -95,7 +95,7 @@ Film::Film (string d, bool must_exist) , _use_dci_name (true) , _trust_content_headers (true) , _dcp_content_type (0) - , _format (0) + , _format (Format::from_id ("185")) , _scaler (Scaler::from_id ("bicubic")) , _trim_start (0) , _trim_end (0) diff --git a/src/lib/imagemagick_content.cc b/src/lib/imagemagick_content.cc index 5ad94db45..f7c76a34d 100644 --- a/src/lib/imagemagick_content.cc +++ b/src/lib/imagemagick_content.cc @@ -25,6 +25,7 @@ #include "i18n.h" using std::string; +using std::stringstream; using boost::shared_ptr; ImageMagickContent::ImageMagickContent (boost::filesystem::path f) diff --git a/src/lib/sndfile_content.cc b/src/lib/sndfile_content.cc index 657e7d519..cf7921a93 100644 --- a/src/lib/sndfile_content.cc +++ b/src/lib/sndfile_content.cc @@ -27,6 +27,12 @@ SndfileContent::summary () const return String::compose (_("Sound file: %1"), file().filename ()); } +string +SndfileContent::information () const +{ + return ""; +} + int SndfileContent::audio_channels () const { diff --git a/src/lib/sndfile_content.h b/src/lib/sndfile_content.h index 81a964ec8..ab8a04e4d 100644 --- a/src/lib/sndfile_content.h +++ b/src/lib/sndfile_content.h @@ -11,6 +11,7 @@ public: SndfileContent (boost::shared_ptr<const cxml::Node>); std::string summary () const; + std::string information () const; boost::shared_ptr<Content> clone () const; /* AudioContent */ diff --git a/src/lib/video_content.cc b/src/lib/video_content.cc index f48813f60..edb713466 100644 --- a/src/lib/video_content.cc +++ b/src/lib/video_content.cc @@ -2,11 +2,15 @@ #include "video_content.h" #include "video_decoder.h" +#include "i18n.h" + int const VideoContentProperty::VIDEO_LENGTH = 0; int const VideoContentProperty::VIDEO_SIZE = 1; int const VideoContentProperty::VIDEO_FRAME_RATE = 2; using std::string; +using std::stringstream; +using std::setprecision; using boost::shared_ptr; using boost::lexical_cast; @@ -61,3 +65,19 @@ VideoContent::take_from_video_decoder (shared_ptr<VideoDecoder> d) Changed (VideoContentProperty::VIDEO_SIZE); Changed (VideoContentProperty::VIDEO_FRAME_RATE); } + + +string +VideoContent::information () const +{ + stringstream s; + + s << String::compose ( + _("%1x%2 pixels (%3:1)"), + video_size().width, + video_size().height, + setprecision (3), float (video_size().width) / video_size().height + ); + + return s.str (); +} diff --git a/src/lib/video_content.h b/src/lib/video_content.h index 25cb28938..19b49e926 100644 --- a/src/lib/video_content.h +++ b/src/lib/video_content.h @@ -22,6 +22,7 @@ public: VideoContent (VideoContent const &); void as_xml (xmlpp::Node *) const; + virtual std::string information () const; ContentVideoFrame video_length () const { boost::mutex::scoped_lock lm (_mutex); |
