Merge master.
authorCarl Hetherington <cth@carlh.net>
Tue, 4 Feb 2014 09:59:38 +0000 (09:59 +0000)
committerCarl Hetherington <cth@carlh.net>
Tue, 4 Feb 2014 09:59:38 +0000 (09:59 +0000)
1  2 
src/lib/encoder.cc
src/lib/exceptions.h
src/lib/ffmpeg_content.cc
src/lib/film.cc
src/lib/player.cc
src/lib/subrip_content.cc
src/lib/transcode_job.cc
src/wx/film_editor.cc
wscript

Simple merge
Simple merge
Simple merge
diff --cc src/lib/film.cc
Simple merge
index cb6d519842c5c6cfce1ac92d5f1fe83f74a04e0c,e661a7b3693930eac8b0348fd250de185a098706..3e6a1598d17e76559c64b7ca0cde2837ec905b64
@@@ -547,10 -521,13 +547,14 @@@ Player::content_changed (weak_ptr<Conte
                _have_valid_pieces = false;
                Changed (frequent);
  
-       } else if (property == SubtitleContentProperty::SUBTITLE_OFFSET || property == SubtitleContentProperty::SUBTITLE_SCALE) {
+       } else if (
+               property == SubtitleContentProperty::SUBTITLE_X_OFFSET ||
+               property == SubtitleContentProperty::SUBTITLE_Y_OFFSET ||
+               property == SubtitleContentProperty::SUBTITLE_SCALE
+               ) {
  
 -              update_subtitle ();
 +              update_subtitle_from_image ();
 +              update_subtitle_from_text ();
                Changed (frequent);
  
        } else if (
@@@ -648,10 -659,11 +652,11 @@@ Player::update_subtitle_from_image (
        shared_ptr<SubtitleContent> sc = dynamic_pointer_cast<SubtitleContent> (piece->content);
        assert (sc);
  
 -      dcpomatic::Rect<double> in_rect = _in_subtitle.rect;
 +      dcpomatic::Rect<double> in_rect = _image_subtitle.subtitle->rect;
        libdcp::Size scaled_size;
  
-       in_rect.y += sc->subtitle_offset ();
+       in_rect.x += sc->subtitle_x_offset ();
+       in_rect.y += sc->subtitle_y_offset ();
  
        /* We will scale the subtitle up to fit _video_container_size, and also by the additional subtitle_scale */
        scaled_size.width = in_rect.width * _video_container_size.width * sc->subtitle_scale ();
        _out_subtitle.position.x = rint (_video_container_size.width * (in_rect.x + (in_rect.width * (1 - sc->subtitle_scale ()) / 2)));
        _out_subtitle.position.y = rint (_video_container_size.height * (in_rect.y + (in_rect.height * (1 - sc->subtitle_scale ()) / 2)));
        
 -      _out_subtitle.image = _in_subtitle.image->scale (
 +      _out_subtitle.image = _image_subtitle.subtitle->image->scale (
                scaled_size,
                Scaler::from_id ("bicubic"),
 -              _in_subtitle.image->pixel_format (),
 +              _image_subtitle.subtitle->image->pixel_format (),
                true
                );
 -
 -      /* XXX: hack */
 -      Time from = _in_subtitle.from;
 -      Time to = _in_subtitle.to;
 -      shared_ptr<VideoContent> vc = dynamic_pointer_cast<VideoContent> (piece->content);
 -      if (vc) {
 -              from = rint (from * vc->video_frame_rate() / _film->video_frame_rate());
 -              to = rint (to * vc->video_frame_rate() / _film->video_frame_rate());
 -      }
        
-       _out_subtitle.from = _image_subtitle.subtitle->dcp_time;
-       _out_subtitle.to = _image_subtitle.subtitle->dcp_time_to;
 -      _out_subtitle.from = from + piece->content->position ();
 -      _out_subtitle.to = to + piece->content->position ();
++      _out_subtitle.from = _image_subtitle.subtitle->dcp_time + piece->content->position ();
++      _out_subtitle.to = _image_subtitle.subtitle->dcp_time_to + piece->content->position ();
  }
  
  /** Re-emit the last frame that was emitted, using current settings for crop, ratio, scaler and subtitles.
index 48d3528e14d881265dd93466b622038c207492a1,0000000000000000000000000000000000000000..73499a5f69c384a17bc5e2ed39787afd31882af3
mode 100644,000000..100644
--- /dev/null
@@@ -1,99 -1,0 +1,100 @@@
- SubRipContent::SubRipContent (shared_ptr<const Film> film, shared_ptr<const cxml::Node> node, int)
 +/*
 +    Copyright (C) 2014 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
 +    the Free Software Foundation; either version 2 of the License, or
 +    (at your option) any later version.
 +
 +    This program is distributed in the hope that it will be useful,
 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 +    GNU General Public License for more details.
 +
 +    You should have received a copy of the GNU General Public License
 +    along with this program; if not, write to the Free Software
 +    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 +
 +*/
 +
 +#include "subrip_content.h"
 +#include "util.h"
 +#include "subrip.h"
 +
 +#include "i18n.h"
 +
 +using std::stringstream;
 +using std::string;
 +using boost::shared_ptr;
 +
 +SubRipContent::SubRipContent (shared_ptr<const Film> film, boost::filesystem::path path)
 +      : Content (film, path)
 +      , SubtitleContent (film, path)
 +{
 +
 +}
 +
-       , SubtitleContent (film, node)
++SubRipContent::SubRipContent (shared_ptr<const Film> film, shared_ptr<const cxml::Node> node, int version)
 +      : Content (film, node)
-         << "_" << subtitle_offset();
++      , SubtitleContent (film, node, version)
 +{
 +
 +}
 +
 +void
 +SubRipContent::examine (boost::shared_ptr<Job> job)
 +{
 +      Content::examine (job);
 +      SubRip s (shared_from_this ());
 +      boost::mutex::scoped_lock lm (_mutex);
 +      _length = s.length ();
 +}
 +
 +string
 +SubRipContent::summary () const
 +{
 +      return path_summary() + " " + _("[subtitles]");
 +}
 +
 +string
 +SubRipContent::technical_summary () const
 +{
 +      return Content::technical_summary() + " - " + _("SubRip subtitles");
 +}
 +
 +string
 +SubRipContent::information () const
 +{
 +      
 +}
 +      
 +void
 +SubRipContent::as_xml (xmlpp::Node* node)
 +{
 +      node->add_child("Type")->add_child_text ("SubRip");
 +      Content::as_xml (node);
 +      SubtitleContent::as_xml (node);
 +}
 +
 +DCPTime
 +SubRipContent::full_length () const
 +{
 +      /* XXX: this assumes that the timing of the SubRip file is appropriate
 +         for the DCP's frame rate.
 +      */
 +      return _length;
 +}
 +
 +string
 +SubRipContent::identifier () const
 +{
 +      LocaleGuard lg;
 +
 +      stringstream s;
 +      s << Content::identifier()
 +        << "_" << subtitle_scale()
++        << "_" << subtitle_x_offset()
++        << "_" << subtitle_y_offset();
 +
 +      return s.str ();
 +}
Simple merge
Simple merge
diff --cc wscript
Simple merge