summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2012-12-03 20:27:51 +0000
committerCarl Hetherington <cth@carlh.net>2012-12-03 20:27:51 +0000
commitd7fe5fa4178af87b5f1e5a571a78313fa00c3327 (patch)
tree62a0aa38043fbd3458401634e9d584a678a94ea2 /src/lib
parentc1cfb24a12ad8109ec9e86cbff5646071ad2e85a (diff)
Remove film player, DVD ripping, alignment, screen configs; never finished and not really very likely to be.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/config.cc7
-rw-r--r--src/lib/config.h11
-rw-r--r--src/lib/copy_from_dvd_job.cc124
-rw-r--r--src/lib/copy_from_dvd_job.h36
-rw-r--r--src/lib/dvd.cc95
-rw-r--r--src/lib/dvd.h36
-rw-r--r--src/lib/film.cc8
-rw-r--r--src/lib/film.h3
-rw-r--r--src/lib/player.cc226
-rw-r--r--src/lib/player.h70
-rw-r--r--src/lib/player_manager.cc136
-rw-r--r--src/lib/player_manager.h59
-rw-r--r--src/lib/scaler.cc22
-rw-r--r--src/lib/scaler.h8
-rw-r--r--src/lib/screen.cc104
-rw-r--r--src/lib/screen.h68
-rw-r--r--src/lib/util.cc52
-rw-r--r--src/lib/wscript6
18 files changed, 11 insertions, 1060 deletions
diff --git a/src/lib/config.cc b/src/lib/config.cc
index 7c52dc170..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") {
@@ -139,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 c57e6b953..5113236d6 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;
}
@@ -140,10 +135,6 @@ public:
_servers = s;
}
- void set_screens (std::vector<boost::shared_ptr<Screen> > s) {
- _screens = s;
- }
-
void set_reference_scaler (Scaler const * s) {
_reference_scaler = s;
}
@@ -195,8 +186,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/copy_from_dvd_job.cc b/src/lib/copy_from_dvd_job.cc
deleted file mode 100644
index dcf53ac54..000000000
--- a/src/lib/copy_from_dvd_job.cc
+++ /dev/null
@@ -1,124 +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.
-
-*/
-
-/** @file src/copy_from_dvd_job.cc
- * @brief A job to copy a film from a DVD.
- */
-
-#include <stdio.h>
-#include <boost/algorithm/string.hpp>
-#include <boost/filesystem.hpp>
-#include "copy_from_dvd_job.h"
-#include "dvd.h"
-#include "cross.h"
-#include "film.h"
-
-using std::string;
-using std::list;
-using std::stringstream;
-using boost::shared_ptr;
-
-/** @param f Film to write DVD data into.
- */
-CopyFromDVDJob::CopyFromDVDJob (shared_ptr<Film> f, shared_ptr<Job> req)
- : Job (f, req)
-{
-
-}
-
-string
-CopyFromDVDJob::name () const
-{
- return "Copy film from DVD";
-}
-
-void
-CopyFromDVDJob::run ()
-{
- /* Remove any old DVD rips */
- boost::filesystem::remove_all (_film->dir ("dvd"));
-
- string const dvd = find_dvd ();
- if (dvd.empty ()) {
- set_error ("could not find DVD");
- set_state (FINISHED_ERROR);
- }
-
- list<DVDTitle> const t = dvd_titles (dvd);
- if (t.empty ()) {
- set_error ("no titles found on DVD");
- set_state (FINISHED_ERROR);
- }
-
- int longest_title = 0;
- uint64_t longest_size = 0;
- for (list<DVDTitle>::const_iterator i = t.begin(); i != t.end(); ++i) {
- if (longest_size < i->size) {
- longest_size = i->size;
- longest_title = i->number;
- }
- }
-
- stringstream c;
- c << "vobcopy -n " << longest_title << " -l -o \"" << _film->dir ("dvd") << "\" 2>&1";
-
- FILE* f = popen (c.str().c_str(), "r");
- if (f == 0) {
- set_error ("could not run vobcopy command");
- set_state (FINISHED_ERROR);
- return;
- }
-
- while (!feof (f)) {
- char buf[256];
- if (fscanf (f, "%s", buf)) {
- string s (buf);
- if (!s.empty () && s[s.length() - 1] == '%') {
- set_progress (atof (s.substr(0, s.length() - 1).c_str()) / 100.0);
- }
- }
- }
-
- const string dvd_dir = _film->dir ("dvd");
-
- string largest_file;
- uintmax_t largest_size = 0;
- for (boost::filesystem::directory_iterator i = boost::filesystem::directory_iterator (dvd_dir); i != boost::filesystem::directory_iterator(); ++i) {
- uintmax_t const s = boost::filesystem::file_size (*i);
- if (s > largest_size) {
-
-#if BOOST_FILESYSTEM_VERSION == 3
- largest_file = boost::filesystem::path(*i).generic_string();
-#else
- largest_file = i->string ();
-#endif
- largest_size = s;
- }
- }
-
- _film->set_content (largest_file);
-
- int const r = pclose (f);
- if (WEXITSTATUS (r) != 0) {
- set_error ("call to vobcopy failed");
- set_state (FINISHED_ERROR);
- } else {
- set_state (FINISHED_OK);
- }
-}
diff --git a/src/lib/copy_from_dvd_job.h b/src/lib/copy_from_dvd_job.h
deleted file mode 100644
index 063e94358..000000000
--- a/src/lib/copy_from_dvd_job.h
+++ /dev/null
@@ -1,36 +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.
-
-*/
-
-/** @file src/copy_from_dvd_job.h
- * @brief A job to copy a film from a DVD.
- */
-
-#include "job.h"
-
-/** @class CopyFromDVDJob
- * @brief A job to copy a film from a DVD using `vobcopy'.
- */
-class CopyFromDVDJob : public Job
-{
-public:
- CopyFromDVDJob (boost::shared_ptr<Film>, boost::shared_ptr<Job> req);
-
- std::string name () const;
- void run ();
-};
diff --git a/src/lib/dvd.cc b/src/lib/dvd.cc
deleted file mode 100644
index 19b59b588..000000000
--- a/src/lib/dvd.cc
+++ /dev/null
@@ -1,95 +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 <fstream>
-#include <boost/filesystem.hpp>
-#include <boost/algorithm/string.hpp>
-#include "dvd.h"
-
-using namespace std;
-using namespace boost;
-
-string
-find_dvd ()
-{
- ifstream f ("/etc/mtab");
- while (f.good ()) {
- string s;
- getline (f, s);
- vector<string> b;
- split (b, s, is_any_of (" "));
- if (b.size() >= 3 && b[2] == "udf") {
- replace_all (b[1], "\\040", " ");
- return b[1];
- }
- }
-
- return "";
-}
-
-list<DVDTitle>
-dvd_titles (string dvd)
-{
- filesystem::path video (dvd);
- video /= "VIDEO_TS";
-
- list<DVDTitle> titles;
-
- for (filesystem::directory_iterator i = filesystem::directory_iterator (video); i != filesystem::directory_iterator(); ++i) {
-#if BOOST_FILESYSTEM_VERSION == 3
- string const n = filesystem::path(*i).filename().generic_string();
-#else
- string const n = filesystem::path(*i).filename();
-#endif
- if (starts_with (n, "VTS_") && ends_with (n, ".VOB")) {
- uint64_t const size = filesystem::file_size (filesystem::path (*i));
- vector<string> p;
- split (p, n, is_any_of ("_."));
- if (p.size() == 4) {
- int const a = atoi (p[1].c_str ());
- int const b = atoi (p[2].c_str ());
- if (b == 0) {
- continue;
- }
-
- list<DVDTitle>::iterator j = titles.begin ();
- while (j != titles.end() && j->number != a) {
- ++j;
- }
-
- if (j == titles.end ()) {
- titles.push_back (DVDTitle (a, size));
- } else {
- j->size += size;
- }
- }
- }
- }
-
- titles.sort ();
-
- return titles;
-}
-
-
-bool
-operator< (DVDTitle const & a, DVDTitle const & b)
-{
- return a.number < b.number;
-}
diff --git a/src/lib/dvd.h b/src/lib/dvd.h
deleted file mode 100644
index 28fef4d16..000000000
--- a/src/lib/dvd.h
+++ /dev/null
@@ -1,36 +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 <stdint.h>
-
-class DVDTitle
-{
-public:
- DVDTitle () : number (-1), size (0) {}
- DVDTitle (int n, int s) : number (n), size (s) {}
-
- int number;
- uint64_t size;
-};
-
-extern bool operator< (DVDTitle const &, DVDTitle const &);
-
-extern std::list<DVDTitle> dvd_titles (std::string);
-extern std::string find_dvd ();
diff --git a/src/lib/film.cc b/src/lib/film.cc
index d5bf79d09..902306fb8 100644
--- a/src/lib/film.cc
+++ b/src/lib/film.cc
@@ -40,7 +40,6 @@
#include "ab_transcode_job.h"
#include "transcode_job.h"
#include "scp_dcp_job.h"
-#include "copy_from_dvd_job.h"
#include "make_dcp_job.h"
#include "log.h"
#include "options.h"
@@ -328,13 +327,6 @@ Film::send_dcp_to_tms ()
JobManager::instance()->add (j);
}
-void
-Film::copy_from_dvd ()
-{
- shared_ptr<Job> j (new CopyFromDVDJob (shared_from_this(), shared_ptr<Job> ()));
- JobManager::instance()->add (j);
-}
-
/** Count the number of frames that have been encoded for this film.
* @return frame count.
*/
diff --git a/src/lib/film.h b/src/lib/film.h
index 32456dfda..64e7a3a70 100644
--- a/src/lib/film.h
+++ b/src/lib/film.h
@@ -64,7 +64,6 @@ public:
void examine_content ();
void send_dcp_to_tms ();
- void copy_from_dvd ();
void make_dcp (bool);
@@ -83,8 +82,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;
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 219441865..6179eedac 100644
--- a/src/lib/util.cc
+++ b/src/lib/util.cc
@@ -56,11 +56,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;
@@ -191,34 +187,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.
*/
@@ -236,7 +204,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()) << ", "
@@ -256,17 +223,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.
*/
@@ -280,14 +236,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
}
string
diff --git a/src/lib/wscript b/src/lib/wscript
index 969a69606..2d31e09a2 100644
--- a/src/lib/wscript
+++ b/src/lib/wscript
@@ -10,7 +10,6 @@ def build(bld):
ab_transcoder.cc
check_hashes_job.cc
config.cc
- copy_from_dvd_job.cc
cross.cc
dcp_content_type.cc
dcp_video_frame.cc
@@ -18,7 +17,6 @@ def build(bld):
decoder_factory.cc
delay_line.cc
dolby_cp750.cc
- dvd.cc
encoder.cc
encoder_factory.cc
examine_content_job.cc
@@ -40,7 +38,6 @@ def build(bld):
make_dcp_job.cc
scp_dcp_job.cc
scaler.cc
- screen.cc
server.cc
sound_processor.cc
stream.cc
@@ -54,7 +51,4 @@ def build(bld):
version.cc
"""
- if not bld.env.DISABLE_PLAYER:
- obj.source += " player.cc player_manager.cc"
-
obj.target = 'dvdomatic'