diff options
| author | Carl Hetherington <cth@carlh.net> | 2012-12-04 19:51:03 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2012-12-04 19:51:03 +0000 |
| commit | 288e7e64e9be84b8dbe11f5acb490e64a29d9378 (patch) | |
| tree | 4535e3c21804444e50eb2fbbf03699fb941a40bd /src/lib | |
| parent | 3ba89a00859e8108017a0d6f2275f0658173b80f (diff) | |
| parent | 3e915b00219ee8c97e50bbc775d90d0dddce87b6 (diff) | |
Merge master.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/config.cc | 9 | ||||
| -rw-r--r-- | src/lib/config.h | 26 | ||||
| -rw-r--r-- | src/lib/encoder.h | 1 | ||||
| -rw-r--r-- | src/lib/film.h | 4 | ||||
| -rw-r--r-- | src/lib/job.h | 1 | ||||
| -rw-r--r-- | src/lib/log.h | 1 | ||||
| -rw-r--r-- | src/lib/player.cc | 226 | ||||
| -rw-r--r-- | src/lib/player.h | 70 | ||||
| -rw-r--r-- | src/lib/player_manager.cc | 136 | ||||
| -rw-r--r-- | src/lib/player_manager.h | 59 | ||||
| -rw-r--r-- | src/lib/scaler.cc | 22 | ||||
| -rw-r--r-- | src/lib/scaler.h | 8 | ||||
| -rw-r--r-- | src/lib/screen.cc | 104 | ||||
| -rw-r--r-- | src/lib/screen.h | 68 | ||||
| -rw-r--r-- | src/lib/util.cc | 52 | ||||
| -rw-r--r-- | src/lib/wscript | 4 |
16 files changed, 15 insertions, 776 deletions
diff --git a/src/lib/config.cc b/src/lib/config.cc index 50b5ae941..d19adc2a4 100644 --- a/src/lib/config.cc +++ b/src/lib/config.cc @@ -25,7 +25,6 @@ #include "config.h" #include "server.h" #include "scaler.h" -#include "screen.h" #include "filter.h" #include "sound_processor.h" @@ -82,8 +81,6 @@ Config::Config () _reference_filters.push_back (Filter::from_id (v)); } else if (k == "server") { _servers.push_back (ServerDescription::create_from_metadata (v)); - } else if (k == "screen") { - _screens.push_back (Screen::create_from_metadata (v)); } else if (k == "tms_ip") { _tms_ip = v; } else if (k == "tms_path") { @@ -96,8 +93,6 @@ Config::Config () _sound_processor = SoundProcessor::from_id (v); } } - - Changed (); } /** @return Filename to write configuration to */ @@ -141,10 +136,6 @@ Config::write () const f << "server " << (*i)->as_metadata () << "\n"; } - for (vector<shared_ptr<Screen> >::const_iterator i = _screens.begin(); i != _screens.end(); ++i) { - f << "screen " << (*i)->as_metadata () << "\n"; - } - f << "tms_ip " << _tms_ip << "\n"; f << "tms_path " << _tms_path << "\n"; f << "tms_user " << _tms_user << "\n"; diff --git a/src/lib/config.h b/src/lib/config.h index 62cababfb..4575cb54d 100644 --- a/src/lib/config.h +++ b/src/lib/config.h @@ -29,7 +29,6 @@ #include <boost/signals2.hpp> class ServerDescription; -class Screen; class Scaler; class Filter; class SoundProcessor; @@ -75,10 +74,6 @@ public: return _servers; } - std::vector<boost::shared_ptr<Screen> > screens () const { - return _screens; - } - Scaler const * reference_scaler () const { return _reference_scaler; } @@ -115,81 +110,62 @@ public: /** @param n New number of local encoding threads */ void set_num_local_encoding_threads (int n) { _num_local_encoding_threads = n; - Changed (); } void set_default_directory (std::string d) { _default_directory = d; - Changed (); } /** @param p New server port */ void set_server_port (int p) { _server_port = p; - Changed (); } /** @param i New colour LUT index */ void set_colour_lut_index (int i) { _colour_lut_index = i; - Changed (); } /** @param b New J2K bandwidth */ void set_j2k_bandwidth (int b) { _j2k_bandwidth = b; - Changed (); } /** @param s New list of servers */ void set_servers (std::vector<ServerDescription*> s) { _servers = s; - Changed (); - } - - void set_screens (std::vector<boost::shared_ptr<Screen> > s) { - _screens = s; - Changed (); } void set_reference_scaler (Scaler const * s) { _reference_scaler = s; - Changed (); } void set_reference_filters (std::vector<Filter const *> const & f) { _reference_filters = f; - Changed (); } /** @param i IP address of a TMS that we can copy DCPs to */ void set_tms_ip (std::string i) { _tms_ip = i; - Changed (); } /** @param p Path on a TMS that we should write DCPs to */ void set_tms_path (std::string p) { _tms_path = p; - Changed (); } /** @param u User name to log into the TMS with */ void set_tms_user (std::string u) { _tms_user = u; - Changed (); } /** @param p Password to log into the TMS with */ void set_tms_password (std::string p) { _tms_password = p; - Changed (); } void write () const; - boost::signals2::signal<void()> Changed; - static Config* instance (); private: @@ -211,8 +187,6 @@ private: /** J2K encoding servers to use */ std::vector<ServerDescription *> _servers; - /** Screen definitions */ - std::vector<boost::shared_ptr<Screen> > _screens; /** Scaler to use for the "A" part of A/B comparisons */ Scaler const * _reference_scaler; /** Filters to use for the "A" part of A/B comparisons */ diff --git a/src/lib/encoder.h b/src/lib/encoder.h index 68a5f6139..b12bd0d48 100644 --- a/src/lib/encoder.h +++ b/src/lib/encoder.h @@ -55,6 +55,7 @@ class Encoder : public VideoSink, public AudioSink { public: Encoder (boost::shared_ptr<const Film> f, boost::shared_ptr<const Options> o); + virtual ~Encoder () {} /** Called to indicate that a processing run is about to begin */ virtual void process_begin () {} diff --git a/src/lib/film.h b/src/lib/film.h index 76fe98710..2e81575e4 100644 --- a/src/lib/film.h +++ b/src/lib/film.h @@ -83,8 +83,6 @@ public: std::string content_path () const; ContentType content_type () const; - bool content_is_dvd () const; - std::string thumb_file (int) const; std::string thumb_base (int) const; SourceFrame thumb_frame (int) const; @@ -330,7 +328,7 @@ public: void set_directory (std::string); void set_name (std::string); void set_use_dci_name (bool); - virtual void set_content (std::string); + void set_content (std::string); void set_dcp_content_type (DCPContentType const *); void set_format (Format const *); void set_crop (Crop); diff --git a/src/lib/job.h b/src/lib/job.h index b09964cf9..41cefb9be 100644 --- a/src/lib/job.h +++ b/src/lib/job.h @@ -39,6 +39,7 @@ class Job : public boost::enable_shared_from_this<Job> { public: Job (boost::shared_ptr<Film> s, boost::shared_ptr<Job> req); + virtual ~Job() {} /** @return user-readable name of this job */ virtual std::string name () const = 0; diff --git a/src/lib/log.h b/src/lib/log.h index 2e5d69a08..298b425cd 100644 --- a/src/lib/log.h +++ b/src/lib/log.h @@ -34,6 +34,7 @@ class Log { public: Log (); + virtual ~Log () {} enum Level { STANDARD = 0, diff --git a/src/lib/player.cc b/src/lib/player.cc deleted file mode 100644 index 67aba36f2..000000000 --- a/src/lib/player.cc +++ /dev/null @@ -1,226 +0,0 @@ -/* - Copyright (C) 2012 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 <sstream> -#include <sys/types.h> -#include <sys/stat.h> -#include <signal.h> -#include <fcntl.h> -#include <poll.h> -#include <boost/thread.hpp> -#include <boost/algorithm/string.hpp> -#include "player.h" -#include "filter.h" -#include "screen.h" -#include "exceptions.h" - -using namespace std; -using namespace boost; - -Player::Player (shared_ptr<const FilmState> fs, shared_ptr<const Screen> screen, Split split) - : _stdout_reader_should_run (true) - , _position (0) - , _paused (false) -{ - assert (fs->format); - - if (pipe (_mplayer_stdin) < 0) { - throw PlayError ("could not create pipe"); - } - - if (pipe (_mplayer_stdout) < 0) { - throw PlayError ("could not create pipe"); - } - - if (pipe (_mplayer_stderr) < 0) { - throw PlayError ("could not create pipe"); - } - - int const p = fork (); - if (p < 0) { - throw PlayError ("could not fork for mplayer"); - } else if (p == 0) { - close (_mplayer_stdin[1]); - dup2 (_mplayer_stdin[0], STDIN_FILENO); - - close (_mplayer_stdout[0]); - dup2 (_mplayer_stdout[1], STDOUT_FILENO); - - close (_mplayer_stderr[0]); - dup2 (_mplayer_stderr[1], STDERR_FILENO); - - char* p[] = { strdup ("TERM=xterm"), strdup ("DISPLAY=:0"), 0 }; - environ = p; - - stringstream s; - s << "/usr/local/bin/mplayer"; - - s << " -vo x11 -noaspect -noautosub -nosub -vo x11 -noborder -slave -quiet -input nodefault-bindings:conf=/dev/null"; - s << " -sws " << fs->scaler->mplayer_id (); - - stringstream vf; - - Position position = screen->position (fs->format); - Size screen_size = screen->size (fs->format); - Size const cropped_size = fs->cropped_size (fs->size); - switch (split) { - case SPLIT_NONE: - vf << crop_string (Position (fs->left_crop, fs->top_crop), cropped_size); - s << " -geometry " << position.x << ":" << position.y; - break; - case SPLIT_LEFT: - { - Size split_size = cropped_size; - split_size.width /= 2; - vf << crop_string (Position (fs->left_crop, fs->top_crop), split_size); - screen_size.width /= 2; - s << " -geometry " << position.x << ":" << position.y; - break; - } - case SPLIT_RIGHT: - { - Size split_size = cropped_size; - split_size.width /= 2; - vf << crop_string (Position (fs->left_crop + split_size.width, fs->top_crop), split_size); - screen_size.width /= 2; - s << " -geometry " << (position.x + screen_size.width) << ":" << position.y; - break; - } - } - - vf << ",scale=" << screen_size.width << ":" << screen_size.height; - - pair<string, string> filters = Filter::ffmpeg_strings (fs->filters); - - if (!filters.first.empty()) { - vf << "," << filters.first; - } - - if (!filters.second.empty ()) { - vf << ",pp=" << filters.second; - } - - s << " -vf " << vf.str(); - s << " \"" << fs->content_path() << "\" "; - - string cmd (s.str ()); - - vector<string> b = split_at_spaces_considering_quotes (cmd); - - char** cl = new char*[b.size() + 1]; - for (vector<string>::size_type i = 0; i < b.size(); ++i) { - cl[i] = strdup (b[i].c_str ()); - } - cl[b.size()] = 0; - - execv (cl[0], cl); - - stringstream e; - e << "exec of mplayer failed " << strerror (errno); - throw PlayError (e.str ()); - - } else { - _mplayer_pid = p; - command ("pause"); - - _stdout_reader = new boost::thread (boost::bind (&Player::stdout_reader, this)); - } -} - -Player::~Player () -{ - _stdout_reader_should_run = false; - _stdout_reader->join (); - delete _stdout_reader; - - close (_mplayer_stdin[0]); - close (_mplayer_stdout[1]); - kill (_mplayer_pid, SIGTERM); -} - -void -Player::command (string c) -{ - char buf[64]; - snprintf (buf, sizeof (buf), "%s\n", c.c_str ()); - write (_mplayer_stdin[1], buf, strlen (buf)); -} - -void -Player::stdout_reader () -{ - while (_stdout_reader_should_run) { - char buf[1024]; - int r = read (_mplayer_stdout[0], buf, sizeof (buf)); - if (r > 0) { - stringstream s (buf); - while (s.good ()) { - string line; - getline (s, line); - - vector<string> b; - split (b, line, is_any_of ("=")); - if (b.size() < 2) { - continue; - } - - if (b[0] == "ANS_time_pos") { - set_position (atof (b[1].c_str ())); - } else if (b[0] == "ANS_pause") { - set_paused (b[1] == "yes"); - } - } - } - - usleep (5e5); - - snprintf (buf, sizeof (buf), "pausing_keep_force get_property time_pos\npausing_keep_force get_property pause\n"); - write (_mplayer_stdin[1], buf, strlen (buf)); - } -} - -void -Player::set_position (float p) -{ - /* XXX: could be an atomic */ - boost::mutex::scoped_lock lm (_state_mutex); - _position = p; -} - -void -Player::set_paused (bool p) -{ - /* XXX: could be an atomic */ - boost::mutex::scoped_lock lm (_state_mutex); - _paused = p; -} - -float -Player::position () const -{ - boost::mutex::scoped_lock lm (_state_mutex); - return _position; -} - -bool -Player::paused () const -{ - boost::mutex::scoped_lock lm (_state_mutex); - return _paused; -} diff --git a/src/lib/player.h b/src/lib/player.h deleted file mode 100644 index fc08deb9f..000000000 --- a/src/lib/player.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - Copyright (C) 2012 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. - -*/ - -#ifndef DVDOMATIC_PLAYER_H -#define DVDOMATIC_PLAYER_H - -#include <boost/shared_ptr.hpp> -#include <boost/thread.hpp> -#include <boost/thread/mutex.hpp> - -class FilmState; -class Screen; - -class Player -{ -public: - enum Split { - SPLIT_NONE, - SPLIT_LEFT, - SPLIT_RIGHT - }; - - Player (boost::shared_ptr<const FilmState>, boost::shared_ptr<const Screen>, Split); - ~Player (); - - void command (std::string); - - float position () const; - bool paused () const; - - pid_t mplayer_pid () const { - return _mplayer_pid; - } - -private: - void stdout_reader (); - void set_position (float); - void set_paused (bool); - - int _mplayer_stdin[2]; - int _mplayer_stdout[2]; - int _mplayer_stderr[2]; - pid_t _mplayer_pid; - - boost::thread* _stdout_reader; - /* XXX: should probably be atomically accessed */ - bool _stdout_reader_should_run; - - mutable boost::mutex _state_mutex; - float _position; - bool _paused; -}; - -#endif diff --git a/src/lib/player_manager.cc b/src/lib/player_manager.cc deleted file mode 100644 index d22ef1064..000000000 --- a/src/lib/player_manager.cc +++ /dev/null @@ -1,136 +0,0 @@ -/* - Copyright (C) 2012 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 "player_manager.h" -#include "player.h" -#include "screen.h" - -using namespace std; -using namespace boost; - -PlayerManager* PlayerManager::_instance = 0; - -PlayerManager::PlayerManager () -{ - -} - -PlayerManager * -PlayerManager::instance () -{ - if (_instance == 0) { - _instance = new PlayerManager (); - } - - return _instance; -} - -void -PlayerManager::setup (shared_ptr<const Film> f, shared_ptr<const Screen> sc) -{ - boost::mutex::scoped_lock lm (_players_mutex); - - _players.clear (); - _players.push_back (shared_ptr<Player> (new Player (f, sc, Player::SPLIT_NONE))); -} - -void -PlayerManager::setup (shared_ptr<const Film> fs_a, shared_ptr<const Film> fs_b, shared_ptr<const Screen> sc) -{ - boost::mutex::scoped_lock lm (_players_mutex); - - _players.clear (); - - _players.push_back (shared_ptr<Player> (new Player (fs_a, sc, Player::SPLIT_LEFT))); - _players.push_back (shared_ptr<Player> (new Player (fs_b, sc, Player::SPLIT_RIGHT))); -} - -void -PlayerManager::pause_or_unpause () -{ - boost::mutex::scoped_lock lm (_players_mutex); - - for (list<shared_ptr<Player> >::iterator i = _players.begin(); i != _players.end(); ++i) { - (*i)->command ("pause"); - } -} - -void -PlayerManager::set_position (float p) -{ - boost::mutex::scoped_lock lm (_players_mutex); - - stringstream s; - s << "pausing_keep_force seek " << p << " 2"; - for (list<shared_ptr<Player> >::iterator i = _players.begin(); i != _players.end(); ++i) { - (*i)->command (s.str ()); - } -} - -float -PlayerManager::position () const -{ - boost::mutex::scoped_lock lm (_players_mutex); - - if (_players.empty ()) { - return 0; - } - - return _players.front()->position (); -} - -void -PlayerManager::child_exited (pid_t pid) -{ - boost::mutex::scoped_lock lm (_players_mutex); - - list<shared_ptr<Player> >::iterator i = _players.begin(); - while (i != _players.end() && (*i)->mplayer_pid() != pid) { - ++i; - } - - if (i == _players.end()) { - return; - } - - _players.erase (i); -} - -PlayerManager::State -PlayerManager::state () const -{ - boost::mutex::scoped_lock lm (_players_mutex); - - if (_players.empty ()) { - return QUIESCENT; - } - - if (_players.front()->paused ()) { - return PAUSED; - } - - return PLAYING; -} - -void -PlayerManager::stop () -{ - boost::mutex::scoped_lock lm (_players_mutex); - _players.clear (); -} diff --git a/src/lib/player_manager.h b/src/lib/player_manager.h deleted file mode 100644 index 70a31b229..000000000 --- a/src/lib/player_manager.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - Copyright (C) 2012 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 <list> -#include <boost/shared_ptr.hpp> -#include "player.h" - -class Player; -class FilmState; -class Screen; - -class PlayerManager -{ -public: - - void setup (boost::shared_ptr<const FilmState>, boost::shared_ptr<const Screen>); - void setup (boost::shared_ptr<const FilmState>, boost::shared_ptr<const FilmState>, boost::shared_ptr<const Screen>); - void pause_or_unpause (); - void stop (); - - float position () const; - void set_position (float); - - enum State { - QUIESCENT, - PLAYING, - PAUSED - }; - - State state () const; - - void child_exited (pid_t); - - static PlayerManager* instance (); - -private: - PlayerManager (); - - mutable boost::mutex _players_mutex; - std::list<boost::shared_ptr<Player> > _players; - - static PlayerManager* _instance; -}; diff --git a/src/lib/scaler.cc b/src/lib/scaler.cc index 1e63d66b3..c81456a15 100644 --- a/src/lib/scaler.cc +++ b/src/lib/scaler.cc @@ -33,13 +33,11 @@ using namespace std; vector<Scaler const *> Scaler::_scalers; /** @param f FFmpeg id. - * @param m mplayer command line id. * @param i Our id. * @param n User-visible name. */ -Scaler::Scaler (int f, int m, string i, string n) +Scaler::Scaler (int f, string i, string n) : _ffmpeg_id (f) - , _mplayer_id (m) , _id (i) , _name (n) { @@ -59,15 +57,15 @@ Scaler::all () void Scaler::setup_scalers () { - _scalers.push_back (new Scaler (SWS_BICUBIC, 2, "bicubic", "Bicubic")); - _scalers.push_back (new Scaler (SWS_X, 3, "x", "X")); - _scalers.push_back (new Scaler (SWS_AREA, 5, "area", "Area")); - _scalers.push_back (new Scaler (SWS_GAUSS, 7, "gauss", "Gaussian")); - _scalers.push_back (new Scaler (SWS_LANCZOS, 9, "lanczos", "Lanczos")); - _scalers.push_back (new Scaler (SWS_SINC, 8, "sinc", "Sinc")); - _scalers.push_back (new Scaler (SWS_SPLINE, 10, "spline", "Spline")); - _scalers.push_back (new Scaler (SWS_BILINEAR, 1, "bilinear", "Bilinear")); - _scalers.push_back (new Scaler (SWS_FAST_BILINEAR, 0, "fastbilinear", "Fast Bilinear")); + _scalers.push_back (new Scaler (SWS_BICUBIC, "bicubic", "Bicubic")); + _scalers.push_back (new Scaler (SWS_X, "x", "X")); + _scalers.push_back (new Scaler (SWS_AREA, "area", "Area")); + _scalers.push_back (new Scaler (SWS_GAUSS, "gauss", "Gaussian")); + _scalers.push_back (new Scaler (SWS_LANCZOS, "lanczos", "Lanczos")); + _scalers.push_back (new Scaler (SWS_SINC, "sinc", "Sinc")); + _scalers.push_back (new Scaler (SWS_SPLINE, "spline", "Spline")); + _scalers.push_back (new Scaler (SWS_BILINEAR, "bilinear", "Bilinear")); + _scalers.push_back (new Scaler (SWS_FAST_BILINEAR, "fastbilinear", "Fast Bilinear")); } /** @param id One of our ids. diff --git a/src/lib/scaler.h b/src/lib/scaler.h index d5a83f732..c80f4b7db 100644 --- a/src/lib/scaler.h +++ b/src/lib/scaler.h @@ -33,18 +33,13 @@ class Scaler { public: - Scaler (int f, int m, std::string i, std::string n); + Scaler (int f, std::string i, std::string n); /** @return id used for calls to FFmpeg's pp_postprocess */ int ffmpeg_id () const { return _ffmpeg_id; } - /** @return number to use on an mplayer command line */ - int mplayer_id () const { - return _mplayer_id; - } - /** @return id for our use */ std::string id () const { return _id; @@ -65,7 +60,6 @@ private: /** id used for calls to FFmpeg's pp_postprocess */ int _ffmpeg_id; - int _mplayer_id; /** id for our use */ std::string _id; /** user-visible name for this scaler */ diff --git a/src/lib/screen.cc b/src/lib/screen.cc deleted file mode 100644 index 25e44f77d..000000000 --- a/src/lib/screen.cc +++ /dev/null @@ -1,104 +0,0 @@ -/* - Copyright (C) 2012 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 <boost/algorithm/string.hpp> -#include "screen.h" -#include "format.h" -#include "exceptions.h" - -using namespace std; -using namespace boost; - -Screen::Screen (string n) - : _name (n) -{ - vector<Format const *> f = Format::all (); - for (vector<Format const *>::iterator i = f.begin(); i != f.end(); ++i) { - set_geometry (*i, Position (0, 0), Size (2048, 1080)); - } -} - -void -Screen::set_geometry (Format const * f, Position p, Size s) -{ - _geometries[f] = Geometry (p, s); -} - -Position -Screen::position (Format const * f) const -{ - GeometryMap::const_iterator i = _geometries.find (f); - if (i == _geometries.end ()) { - throw PlayError ("format not found for screen"); - } - - return i->second.position; -} - -Size -Screen::size (Format const * f) const -{ - GeometryMap::const_iterator i = _geometries.find (f); - if (i == _geometries.end ()) { - throw PlayError ("format not found for screen"); - } - - return i->second.size; -} - -string -Screen::as_metadata () const -{ - stringstream s; - s << "\"" << _name << "\""; - - for (GeometryMap::const_iterator i = _geometries.begin(); i != _geometries.end(); ++i) { - s << " " << i->first->as_metadata() - << " " << i->second.position.x << " " << i->second.position.y - << " " << i->second.size.width << " " << i->second.size.height; - } - - return s.str (); -} - -shared_ptr<Screen> -Screen::create_from_metadata (string v) -{ - vector<string> b = split_at_spaces_considering_quotes (v); - - if (b.size() < 1) { - return shared_ptr<Screen> (); - } - - shared_ptr<Screen> s (new Screen (b[0])); - - vector<string>::size_type i = 1; - while (b.size() > i) { - if (b.size() >= (i + 5)) { - s->set_geometry ( - Format::from_metadata (b[i].c_str()), - Position (atoi (b[i+1].c_str()), atoi (b[i+2].c_str())), - Size (atoi (b[i+3].c_str()), atoi (b[i+4].c_str())) - ); - } - i += 5; - } - - return s; -} diff --git a/src/lib/screen.h b/src/lib/screen.h deleted file mode 100644 index 663b3c3c4..000000000 --- a/src/lib/screen.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - Copyright (C) 2012 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 <string> -#include <vector> -#include <map> -#include "util.h" - -class Format; - -class Screen -{ -public: - Screen (std::string); - - void set_geometry (Format const *, Position, Size); - - std::string name () const { - return _name; - } - - void set_name (std::string n) { - _name = n; - } - - struct Geometry { - Geometry () {} - - Geometry (Position p, Size s) - : position (p) - , size (s) - {} - - Position position; - Size size; - }; - - typedef std::map<Format const *, Geometry> GeometryMap; - GeometryMap geometries () const { - return _geometries; - } - - Position position (Format const *) const; - Size size (Format const *) const; - - std::string as_metadata () const; - static boost::shared_ptr<Screen> create_from_metadata (std::string); - -private: - std::string _name; - GeometryMap _geometries; -}; diff --git a/src/lib/util.cc b/src/lib/util.cc index bb33eb431..b69581eba 100644 --- a/src/lib/util.cc +++ b/src/lib/util.cc @@ -57,11 +57,7 @@ extern "C" { #include "format.h" #include "dcp_content_type.h" #include "filter.h" -#include "screen.h" #include "sound_processor.h" -#ifndef DVDOMATIC_DISABLE_PLAYER -#include "player_manager.h" -#endif using namespace std; using namespace boost; @@ -192,34 +188,6 @@ stacktrace (ostream& out, int levels) } #endif -/** @return Version of vobcopy that is on the path (and hence that we will use) */ -static string -vobcopy_version () -{ - FILE* f = popen ("vobcopy -V 2>&1", "r"); - if (f == 0) { - throw EncodeError ("could not run vobcopy to check version"); - } - - string version = "unknown"; - - while (!feof (f)) { - char buf[256]; - if (fgets (buf, sizeof (buf), f)) { - string s (buf); - vector<string> b; - split (b, s, is_any_of (" ")); - if (b.size() >= 2 && b[0] == "Vobcopy") { - version = b[1]; - } - } - } - - pclose (f); - - return version; -} - /** @param v Version as used by FFmpeg. * @return A string representation of v. */ @@ -237,7 +205,6 @@ dependency_version_summary () { stringstream s; s << "libopenjpeg " << opj_version () << ", " - << "vobcopy " << vobcopy_version() << ", " << "libavcodec " << ffmpeg_version_to_string (avcodec_version()) << ", " << "libavfilter " << ffmpeg_version_to_string (avfilter_version()) << ", " << "libavformat " << ffmpeg_version_to_string (avformat_version()) << ", " @@ -257,17 +224,6 @@ seconds (struct timeval t) return t.tv_sec + (double (t.tv_usec) / 1e6); } - -#ifdef DVDOMATIC_POSIX -void -sigchld_handler (int, siginfo_t* info, void *) -{ -#ifndef DVDOMATIC_DISABLE_PLAYER - PlayerManager::instance()->child_exited (info->si_pid); -#endif -} -#endif - /** Call the required functions to set up DVD-o-matic's static arrays, etc. * Must be called from the UI thread, if there is one. */ @@ -281,14 +237,6 @@ dvdomatic_setup () SoundProcessor::setup_sound_processors (); ui_thread = this_thread::get_id (); - -#ifdef DVDOMATIC_POSIX - struct sigaction sa; - sa.sa_flags = SA_SIGINFO; - sigemptyset (&sa.sa_mask); - sa.sa_sigaction = sigchld_handler; - sigaction (SIGCHLD, &sa, 0); -#endif } /** @param start Start position for the crop within the image. diff --git a/src/lib/wscript b/src/lib/wscript index 942975b32..0d3c7d99d 100644 --- a/src/lib/wscript +++ b/src/lib/wscript @@ -44,7 +44,6 @@ def build(bld): matcher.cc scp_dcp_job.cc scaler.cc - screen.cc server.cc sound_processor.cc stream.cc @@ -59,7 +58,4 @@ def build(bld): video_source.cc """ - if not bld.env.DISABLE_PLAYER: - obj.source += " player.cc player_manager.cc" - obj.target = 'dvdomatic' |
