diff options
| author | Carl Hetherington <cth@carlh.net> | 2016-02-12 00:13:14 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2016-02-12 00:13:14 +0000 |
| commit | 80400212e939dc2f3b987cb6df57709929aa5178 (patch) | |
| tree | acffc7b335b79b27261610986fcf5fd95f6437ab /src/lib | |
| parent | db3cd90dadf60df72ebbd95c59b32954f29b9c38 (diff) | |
Rename SubRip -> TextSubtitle.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/content_factory.cc | 10 | ||||
| -rw-r--r-- | src/lib/exceptions.cc | 4 | ||||
| -rw-r--r-- | src/lib/exceptions.h | 8 | ||||
| -rw-r--r-- | src/lib/player.cc | 16 | ||||
| -rw-r--r-- | src/lib/text_subtitle.cc (renamed from src/lib/subrip.cc) | 10 | ||||
| -rw-r--r-- | src/lib/text_subtitle.h (renamed from src/lib/subrip.h) | 20 | ||||
| -rw-r--r-- | src/lib/text_subtitle_content.cc (renamed from src/lib/subrip_content.cc) | 50 | ||||
| -rw-r--r-- | src/lib/text_subtitle_content.h (renamed from src/lib/subrip_content.h) | 18 | ||||
| -rw-r--r-- | src/lib/text_subtitle_decoder.cc (renamed from src/lib/subrip_decoder.cc) | 24 | ||||
| -rw-r--r-- | src/lib/text_subtitle_decoder.h (renamed from src/lib/subrip_decoder.h) | 14 | ||||
| -rw-r--r-- | src/lib/wscript | 6 |
11 files changed, 90 insertions, 90 deletions
diff --git a/src/lib/content_factory.cc b/src/lib/content_factory.cc index 3aa8ca9d3..2b17d69e4 100644 --- a/src/lib/content_factory.cc +++ b/src/lib/content_factory.cc @@ -24,7 +24,7 @@ #include "ffmpeg_content.h" #include "image_content.h" #include "sndfile_content.h" -#include "subrip_content.h" +#include "text_subtitle_content.h" #include "dcp_content.h" #include "dcp_subtitle_content.h" #include "util.h" @@ -56,8 +56,8 @@ content_factory (shared_ptr<const Film> film, cxml::NodePtr node, int version, l content.reset (new ImageContent (film, node, version)); } else if (type == "Sndfile") { content.reset (new SndfileContent (film, node, version)); - } else if (type == "SubRip") { - content.reset (new SubRipContent (film, node, version)); + } else if (type == "SubRip" || type == "TextSubtitle") { + content.reset (new TextSubtitleContent (film, node, version)); } else if (type == "DCP") { content.reset (new DCPContent (film, node, version)); } else if (type == "DCPSubtitle") { @@ -118,8 +118,8 @@ content_factory (shared_ptr<const Film> film, boost::filesystem::path path) content.reset (new ImageContent (film, path)); } else if (SndfileContent::valid_file (path)) { content.reset (new SndfileContent (film, path)); - } else if (ext == ".srt") { - content.reset (new SubRipContent (film, path)); + } else if (ext == ".srt" || ext == ".ssa") { + content.reset (new TextSubtitleContent (film, path)); } else if (ext == ".xml") { content.reset (new DCPSubtitleContent (film, path)); } else if (ext == ".mxf" && dcp::SMPTESubtitleAsset::valid_mxf (path)) { diff --git a/src/lib/exceptions.cc b/src/lib/exceptions.cc index c15e134ee..968e81439 100644 --- a/src/lib/exceptions.cc +++ b/src/lib/exceptions.cc @@ -63,8 +63,8 @@ PixelFormatError::PixelFormatError (string o, AVPixelFormat f) } -SubRipError::SubRipError (string saw, string expecting, boost::filesystem::path f) - : FileError (String::compose (_("Error in SubRip file: saw %1 while expecting %2"), saw.empty() ? "[nothing]" : saw, expecting), f) +TextSubtitleError::TextSubtitleError (string saw, string expecting, boost::filesystem::path f) + : FileError (String::compose (_("Error in subtitle file: saw %1 while expecting %2"), saw.empty() ? "[nothing]" : saw, expecting), f) { } diff --git a/src/lib/exceptions.h b/src/lib/exceptions.h index da8761304..3e7289a50 100644 --- a/src/lib/exceptions.h +++ b/src/lib/exceptions.h @@ -211,13 +211,13 @@ public: PixelFormatError (std::string o, AVPixelFormat f); }; -/** @class SubRipError - * @brief An error that occurs while parsing a SubRip file. +/** @class TextSubtitleError + * @brief An error that occurs while parsing a TextSubtitleError file. */ -class SubRipError : public FileError +class TextSubtitleError : public FileError { public: - SubRipError (std::string, std::string, boost::filesystem::path); + TextSubtitleError (std::string, std::string, boost::filesystem::path); }; class DCPError : public std::runtime_error diff --git a/src/lib/player.cc b/src/lib/player.cc index ecf37b576..fc1332573 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -27,8 +27,8 @@ #include "sndfile_decoder.h" #include "sndfile_content.h" #include "subtitle_content.h" -#include "subrip_decoder.h" -#include "subrip_content.h" +#include "text_subtitle_decoder.h" +#include "text_subtitle_content.h" #include "dcp_content.h" #include "job.h" #include "image.h" @@ -174,10 +174,10 @@ Player::setup_pieces () as simultaneous video content (like we do with audio). */ - /* SubRipContent */ - shared_ptr<const SubRipContent> rc = dynamic_pointer_cast<const SubRipContent> (i); + /* TextSubtitleContent */ + shared_ptr<const TextSubtitleContent> rc = dynamic_pointer_cast<const TextSubtitleContent> (i); if (rc) { - decoder.reset (new SubRipDecoder (rc)); + decoder.reset (new TextSubtitleDecoder (rc)); frc = FrameRateChange (rc->subtitle_video_frame_rate(), _film->video_frame_rate()); } @@ -220,9 +220,9 @@ Player::playlist_content_changed (weak_ptr<Content> w, int property, bool freque property == ContentProperty::PATH || property == VideoContentProperty::VIDEO_FRAME_TYPE || property == DCPContentProperty::CAN_BE_PLAYED || - property == SubRipContentProperty::SUBTITLE_COLOUR || - property == SubRipContentProperty::SUBTITLE_OUTLINE || - property == SubRipContentProperty::SUBTITLE_OUTLINE_COLOUR + property == TextSubtitleContentProperty::TEXT_SUBTITLE_COLOUR || + property == TextSubtitleContentProperty::TEXT_SUBTITLE_OUTLINE || + property == TextSubtitleContentProperty::TEXT_SUBTITLE_OUTLINE_COLOUR ) { _have_valid_pieces = false; diff --git a/src/lib/subrip.cc b/src/lib/text_subtitle.cc index c4166cb28..d55ff68d7 100644 --- a/src/lib/subrip.cc +++ b/src/lib/text_subtitle.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2014 Carl Hetherington <cth@carlh.net> + Copyright (C) 2014-2016 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 @@ -17,10 +17,10 @@ */ -#include "subrip.h" +#include "text_subtitle.h" #include "cross.h" #include "exceptions.h" -#include "subrip_content.h" +#include "text_subtitle_content.h" #include <sub/subrip_reader.h> #include <sub/collect.h> #include <unicode/ucsdet.h> @@ -36,7 +36,7 @@ using boost::shared_ptr; using boost::scoped_array; using dcp::Data; -SubRip::SubRip (shared_ptr<const SubRipContent> content) +TextSubtitle::TextSubtitle (shared_ptr<const TextSubtitleContent> content) { Data in (content->path (0)); @@ -70,7 +70,7 @@ SubRip::SubRip (shared_ptr<const SubRipContent> content) } ContentTime -SubRip::length () const +TextSubtitle::length () const { if (_subtitles.empty ()) { return ContentTime (); diff --git a/src/lib/subrip.h b/src/lib/text_subtitle.h index 35687eb00..4614f6bd0 100644 --- a/src/lib/subrip.h +++ b/src/lib/text_subtitle.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2014 Carl Hetherington <cth@carlh.net> + Copyright (C) 2014-2016 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 @@ -17,24 +17,24 @@ */ -#ifndef DCPOMATIC_SUBRIP_H -#define DCPOMATIC_SUBRIP_H +#ifndef DCPOMATIC_TEXT_SUBTITLE_H +#define DCPOMATIC_TEXT_SUBTITLE_H #include "dcpomatic_time.h" #include <sub/subtitle.h> #include <boost/shared_ptr.hpp> #include <vector> -class SubRipContent; -class subrip_time_test; -class subrip_coordinate_test; -class subrip_content_test; -class subrip_parse_test; +class TextSubtitleContent; +class text_subtitle_time_test; +class text_subtitle_coordinate_test; +class text_subtitle_content_test; +class text_subtitle_parse_test; -class SubRip +class TextSubtitle { public: - SubRip (boost::shared_ptr<const SubRipContent>); + TextSubtitle (boost::shared_ptr<const TextSubtitleContent>); ContentTime length () const; diff --git a/src/lib/subrip_content.cc b/src/lib/text_subtitle_content.cc index a6eb07629..93ac1d091 100644 --- a/src/lib/subrip_content.cc +++ b/src/lib/text_subtitle_content.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2015 Carl Hetherington <cth@carlh.net> + Copyright (C) 2014-2016 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 @@ -17,9 +17,9 @@ */ -#include "subrip_content.h" +#include "text_subtitle_content.h" #include "util.h" -#include "subrip.h" +#include "text_subtitle.h" #include "film.h" #include "font.h" #include "raw_convert.h" @@ -33,13 +33,13 @@ using std::cout; using boost::shared_ptr; using boost::lexical_cast; -std::string const SubRipContent::font_id = "font"; +std::string const TextSubtitleContent::font_id = "font"; -int const SubRipContentProperty::SUBTITLE_COLOUR = 300; -int const SubRipContentProperty::SUBTITLE_OUTLINE = 301; -int const SubRipContentProperty::SUBTITLE_OUTLINE_COLOUR = 302; +int const TextSubtitleContentProperty::TEXT_SUBTITLE_COLOUR = 300; +int const TextSubtitleContentProperty::TEXT_SUBTITLE_OUTLINE = 301; +int const TextSubtitleContentProperty::TEXT_SUBTITLE_OUTLINE_COLOUR = 302; -SubRipContent::SubRipContent (shared_ptr<const Film> film, boost::filesystem::path path) +TextSubtitleContent::TextSubtitleContent (shared_ptr<const Film> film, boost::filesystem::path path) : Content (film, path) , SubtitleContent (film, path) , _colour (255, 255, 255) @@ -49,7 +49,7 @@ SubRipContent::SubRipContent (shared_ptr<const Film> film, boost::filesystem::pa } -SubRipContent::SubRipContent (shared_ptr<const Film> film, cxml::ConstNodePtr node, int version) +TextSubtitleContent::TextSubtitleContent (shared_ptr<const Film> film, cxml::ConstNodePtr node, int version) : Content (film, node) , SubtitleContent (film, node, version) , _length (node->number_child<ContentTime::Type> ("Length")) @@ -70,10 +70,10 @@ SubRipContent::SubRipContent (shared_ptr<const Film> film, cxml::ConstNodePtr no } void -SubRipContent::examine (boost::shared_ptr<Job> job) +TextSubtitleContent::examine (boost::shared_ptr<Job> job) { Content::examine (job); - SubRip s (shared_from_this ()); + TextSubtitle s (shared_from_this ()); /* Default to turning these subtitles on */ set_use_subtitles (true); @@ -84,21 +84,21 @@ SubRipContent::examine (boost::shared_ptr<Job> job) } string -SubRipContent::summary () const +TextSubtitleContent::summary () const { return path_summary() + " " + _("[subtitles]"); } string -SubRipContent::technical_summary () const +TextSubtitleContent::technical_summary () const { - return Content::technical_summary() + " - " + _("SubRip subtitles"); + return Content::technical_summary() + " - " + _("Text subtitles"); } void -SubRipContent::as_xml (xmlpp::Node* node) const +TextSubtitleContent::as_xml (xmlpp::Node* node) const { - node->add_child("Type")->add_child_text ("SubRip"); + node->add_child("Type")->add_child_text ("TextSubtitle"); Content::as_xml (node); SubtitleContent::as_xml (node); node->add_child("Length")->add_child_text (raw_convert<string> (_length.get ())); @@ -112,14 +112,14 @@ SubRipContent::as_xml (xmlpp::Node* node) const } DCPTime -SubRipContent::full_length () const +TextSubtitleContent::full_length () const { FrameRateChange const frc (subtitle_video_frame_rate(), film()->video_frame_rate ()); return DCPTime (_length, frc); } void -SubRipContent::set_subtitle_video_frame_rate (int r) +TextSubtitleContent::set_subtitle_video_frame_rate (int r) { { boost::mutex::scoped_lock lm (_mutex); @@ -130,7 +130,7 @@ SubRipContent::set_subtitle_video_frame_rate (int r) } double -SubRipContent::subtitle_video_frame_rate () const +TextSubtitleContent::subtitle_video_frame_rate () const { { boost::mutex::scoped_lock lm (_mutex); @@ -146,7 +146,7 @@ SubRipContent::subtitle_video_frame_rate () const } void -SubRipContent::set_colour (dcp::Colour colour) +TextSubtitleContent::set_colour (dcp::Colour colour) { { boost::mutex::scoped_lock lm (_mutex); @@ -157,11 +157,11 @@ SubRipContent::set_colour (dcp::Colour colour) _colour = colour; } - signal_changed (SubRipContentProperty::SUBTITLE_COLOUR); + signal_changed (TextSubtitleContentProperty::TEXT_SUBTITLE_COLOUR); } void -SubRipContent::set_outline (bool o) +TextSubtitleContent::set_outline (bool o) { { boost::mutex::scoped_lock lm (_mutex); @@ -172,11 +172,11 @@ SubRipContent::set_outline (bool o) _outline = o; } - signal_changed (SubRipContentProperty::SUBTITLE_OUTLINE); + signal_changed (TextSubtitleContentProperty::TEXT_SUBTITLE_OUTLINE); } void -SubRipContent::set_outline_colour (dcp::Colour colour) +TextSubtitleContent::set_outline_colour (dcp::Colour colour) { { boost::mutex::scoped_lock lm (_mutex); @@ -187,5 +187,5 @@ SubRipContent::set_outline_colour (dcp::Colour colour) _outline_colour = colour; } - signal_changed (SubRipContentProperty::SUBTITLE_OUTLINE_COLOUR); + signal_changed (TextSubtitleContentProperty::TEXT_SUBTITLE_OUTLINE_COLOUR); } diff --git a/src/lib/subrip_content.h b/src/lib/text_subtitle_content.h index 68864f58c..52d44ae54 100644 --- a/src/lib/subrip_content.h +++ b/src/lib/text_subtitle_content.h @@ -19,23 +19,23 @@ #include "subtitle_content.h" -class SubRipContentProperty +class TextSubtitleContentProperty { public: - static int const SUBTITLE_COLOUR; - static int const SUBTITLE_OUTLINE; - static int const SUBTITLE_OUTLINE_COLOUR; + static int const TEXT_SUBTITLE_COLOUR; + static int const TEXT_SUBTITLE_OUTLINE; + static int const TEXT_SUBTITLE_OUTLINE_COLOUR; }; -class SubRipContent : public SubtitleContent +class TextSubtitleContent : public SubtitleContent { public: - SubRipContent (boost::shared_ptr<const Film>, boost::filesystem::path); - SubRipContent (boost::shared_ptr<const Film>, cxml::ConstNodePtr, int); + TextSubtitleContent (boost::shared_ptr<const Film>, boost::filesystem::path); + TextSubtitleContent (boost::shared_ptr<const Film>, cxml::ConstNodePtr, int); - boost::shared_ptr<SubRipContent> shared_from_this () { - return boost::dynamic_pointer_cast<SubRipContent> (Content::shared_from_this ()); + boost::shared_ptr<TextSubtitleContent> shared_from_this () { + return boost::dynamic_pointer_cast<TextSubtitleContent> (Content::shared_from_this ()); } /* Content */ diff --git a/src/lib/subrip_decoder.cc b/src/lib/text_subtitle_decoder.cc index 2f8b8a5f3..893fd5d3c 100644 --- a/src/lib/subrip_decoder.cc +++ b/src/lib/text_subtitle_decoder.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2015 Carl Hetherington <cth@carlh.net> + Copyright (C) 2014-2016 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 @@ -17,8 +17,8 @@ */ -#include "subrip_decoder.h" -#include "subrip_content.h" +#include "text_subtitle_decoder.h" +#include "text_subtitle_content.h" #include <dcp/subtitle_string.h> #include <boost/foreach.hpp> #include <iostream> @@ -32,16 +32,16 @@ using boost::shared_ptr; using boost::optional; using boost::dynamic_pointer_cast; -SubRipDecoder::SubRipDecoder (shared_ptr<const SubRipContent> content) +TextSubtitleDecoder::TextSubtitleDecoder (shared_ptr<const TextSubtitleContent> content) : SubtitleDecoder (content) - , SubRip (content) + , TextSubtitle (content) , _next (0) { } void -SubRipDecoder::seek (ContentTime time, bool accurate) +TextSubtitleDecoder::seek (ContentTime time, bool accurate) { SubtitleDecoder::seek (time, accurate); @@ -52,7 +52,7 @@ SubRipDecoder::seek (ContentTime time, bool accurate) } bool -SubRipDecoder::pass (PassReason, bool) +TextSubtitleDecoder::pass (PassReason, bool) { if (_next >= _subtitles.size ()) { return true; @@ -60,7 +60,7 @@ SubRipDecoder::pass (PassReason, bool) /* XXX: we are ignoring positioning specified in the file */ - shared_ptr<const SubRipContent> content = dynamic_pointer_cast<const SubRipContent> (_subtitle_content); + shared_ptr<const TextSubtitleContent> content = dynamic_pointer_cast<const TextSubtitleContent> (_subtitle_content); DCPOMATIC_ASSERT (content); list<dcp::SubtitleString> out; @@ -77,7 +77,7 @@ SubRipDecoder::pass (PassReason, bool) BOOST_FOREACH (sub::Block j, i.blocks) { out.push_back ( dcp::SubtitleString ( - SubRipContent::font_id, + TextSubtitleContent::font_id, j.italic, /* force the colour to whatever is configured */ content->colour(), @@ -109,13 +109,13 @@ SubRipDecoder::pass (PassReason, bool) } list<ContentTimePeriod> -SubRipDecoder::image_subtitles_during (ContentTimePeriod, bool) const +TextSubtitleDecoder::image_subtitles_during (ContentTimePeriod, bool) const { return list<ContentTimePeriod> (); } list<ContentTimePeriod> -SubRipDecoder::text_subtitles_during (ContentTimePeriod p, bool starting) const +TextSubtitleDecoder::text_subtitles_during (ContentTimePeriod p, bool starting) const { /* XXX: inefficient */ @@ -132,7 +132,7 @@ SubRipDecoder::text_subtitles_during (ContentTimePeriod p, bool starting) const } ContentTimePeriod -SubRipDecoder::content_time_period (sub::Subtitle s) const +TextSubtitleDecoder::content_time_period (sub::Subtitle s) const { return ContentTimePeriod ( ContentTime::from_seconds (s.from.all_as_seconds()), diff --git a/src/lib/subrip_decoder.h b/src/lib/text_subtitle_decoder.h index f76d04aeb..67d2caca8 100644 --- a/src/lib/subrip_decoder.h +++ b/src/lib/text_subtitle_decoder.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2014 Carl Hetherington <cth@carlh.net> + Copyright (C) 2014-2016 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 @@ -17,18 +17,18 @@ */ -#ifndef DCPOMATIC_SUBRIP_DECODER_H -#define DCPOMATIC_SUBRIP_DECODER_H +#ifndef DCPOMATIC_TEXT_SUBTITLE_DECODER_H +#define DCPOMATIC_TEXT_SUBTITLE_DECODER_H #include "subtitle_decoder.h" -#include "subrip.h" +#include "text_subtitle.h" -class SubRipContent; +class TextSubtitleContent; -class SubRipDecoder : public SubtitleDecoder, public SubRip +class TextSubtitleDecoder : public SubtitleDecoder, public TextSubtitle { public: - SubRipDecoder (boost::shared_ptr<const SubRipContent>); + TextSubtitleDecoder (boost::shared_ptr<const TextSubtitleContent>); protected: void seek (ContentTime time, bool accurate); diff --git a/src/lib/wscript b/src/lib/wscript index 88cb9d4dc..f6ca52fb7 100644 --- a/src/lib/wscript +++ b/src/lib/wscript @@ -118,9 +118,9 @@ sources = """ sndfile_decoder.cc sndfile_examiner.cc string_log_entry.cc - subrip.cc - subrip_content.cc - subrip_decoder.cc + text_subtitle.cc + text_subtitle_content.cc + text_subtitle_decoder.cc subtitle_content.cc subtitle_decoder.cc timer.cc |
