summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2012-12-04 19:51:03 +0000
committerCarl Hetherington <cth@carlh.net>2012-12-04 19:51:03 +0000
commit288e7e64e9be84b8dbe11f5acb490e64a29d9378 (patch)
tree4535e3c21804444e50eb2fbbf03699fb941a40bd /src
parent3ba89a00859e8108017a0d6f2275f0658173b80f (diff)
parent3e915b00219ee8c97e50bbc775d90d0dddce87b6 (diff)
Merge master.
Diffstat (limited to 'src')
-rw-r--r--src/lib/config.cc9
-rw-r--r--src/lib/config.h26
-rw-r--r--src/lib/encoder.h1
-rw-r--r--src/lib/film.h4
-rw-r--r--src/lib/job.h1
-rw-r--r--src/lib/log.h1
-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/wscript4
-rw-r--r--src/tools/alignomatic.cc317
-rw-r--r--src/tools/playomatic.cc67
-rw-r--r--src/tools/wscript6
-rw-r--r--src/wx/config_dialog.cc1
-rw-r--r--src/wx/config_dialog.h1
-rw-r--r--src/wx/film_editor.cc1
-rw-r--r--src/wx/film_player.cc310
-rw-r--r--src/wx/film_player.h63
-rw-r--r--src/wx/film_viewer.cc1
-rw-r--r--src/wx/wscript7
26 files changed, 17 insertions, 1548 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'
diff --git a/src/tools/alignomatic.cc b/src/tools/alignomatic.cc
deleted file mode 100644
index 9cab6c430..000000000
--- a/src/tools/alignomatic.cc
+++ /dev/null
@@ -1,317 +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 <gtkmm.h>
-#include "lib/util.h"
-#include "lib/config.h"
-#include "lib/screen.h"
-#include "lib/format.h"
-#include "gtk/gtk_util.h"
-#include "gtk/alignment.h"
-
-using namespace std;
-using namespace boost;
-
-static Alignment* alignment = 0;
-static Gtk::ComboBoxText* format_combo = 0;
-static Format const * format = 0;
-static Gtk::ComboBoxText* screen_combo = 0;
-static shared_ptr<Screen> screen;
-static Gtk::Button* add_screen = 0;
-static Gtk::Entry* screen_name = 0;
-static Gtk::SpinButton* x_position = 0;
-static Gtk::SpinButton* y_position = 0;
-static Gtk::SpinButton* width = 0;
-static Gtk::Button* calculate_width = 0;
-static Gtk::SpinButton* height = 0;
-static Gtk::Button* calculate_height = 0;
-static Gtk::Button* save = 0;
-static bool screen_dirty = false;
-
-enum GeometryPart {
- GEOMETRY_PART_X,
- GEOMETRY_PART_Y,
- GEOMETRY_PART_WIDTH,
- GEOMETRY_PART_HEIGHT
-};
-
-void
-update_sensitivity ()
-{
- bool const dims = format && screen;
-
- x_position->set_sensitive (dims);
- y_position->set_sensitive (dims);
- width->set_sensitive (dims);
- calculate_width->set_sensitive (dims);
- height->set_sensitive (dims);
- calculate_height->set_sensitive (dims);
-
- screen_name->set_sensitive (screen);
- save->set_sensitive (screen_dirty);
-}
-
-void
-update_alignment ()
-{
- if (!screen || !format) {
- return;
- }
-
- delete alignment;
- alignment = new Alignment (screen->position (format), screen->size (format));
- alignment->set_text_line (0, screen->name ());
- alignment->set_text_line (1, format->name ());
-}
-
-void
-update_entries ()
-{
- if (!screen || !format) {
- return;
- }
-
- Position p = screen->position (format);
- x_position->set_value (p.x);
- y_position->set_value (p.y);
- Size s = screen->size (format);
- width->set_value (s.width);
- height->set_value (s.height);
-
- update_sensitivity ();
-}
-
-void
-screen_changed ()
-{
- if (screen_combo->get_active_row_number() < 0) {
- return;
- }
-
- vector<shared_ptr<Screen> > screens = Config::instance()->screens ();
-
- if (screens[screen_combo->get_active_row_number()] == screen) {
- return;
- }
-
- screen = screens[screen_combo->get_active_row_number()];
-
- update_entries ();
- update_alignment ();
-
- screen_name->set_text (screen->name ());
-
- screen_dirty = false;
- update_sensitivity ();
-}
-
-void
-format_changed ()
-{
- vector<Format const *> formats = Format::all ();
-
- if (formats[format_combo->get_active_row_number()] == format) {
- return;
- }
-
- format = formats[format_combo->get_active_row_number()];
-
- update_entries ();
- update_alignment ();
- update_sensitivity ();
-}
-
-void
-geometry_changed (GeometryPart p)
-{
- if (p == GEOMETRY_PART_X && screen->position(format).x == x_position->get_value_as_int()) {
- return;
- }
-
- if (p == GEOMETRY_PART_Y && screen->position(format).y == y_position->get_value_as_int()) {
- return;
- }
-
- if (p == GEOMETRY_PART_WIDTH && screen->size(format).width == width->get_value_as_int()) {
- return;
- }
-
- if (p == GEOMETRY_PART_HEIGHT && screen->size(format).height == height->get_value_as_int()) {
- return;
- }
-
- screen->set_geometry (
- format,
- Position (x_position->get_value_as_int(), y_position->get_value_as_int()),
- Size (width->get_value_as_int(), height->get_value_as_int())
- );
-
- update_alignment ();
-
- screen_dirty = true;
- update_sensitivity ();
-}
-
-void
-save_clicked ()
-{
- Config::instance()->write ();
- screen_dirty = false;
- update_sensitivity ();
-}
-
-void
-calculate_width_clicked ()
-{
- width->set_value (height->get_value_as_int() * format->ratio_as_float ());
-}
-
-void
-calculate_height_clicked ()
-{
- height->set_value (width->get_value_as_int() / format->ratio_as_float ());
-}
-
-void
-update_screen_combo ()
-{
- screen_combo->clear ();
-
- vector<shared_ptr<Screen> > screens = Config::instance()->screens ();
- for (vector<shared_ptr<Screen> >::iterator i = screens.begin(); i != screens.end(); ++i) {
- screen_combo->append_text ((*i)->name ());
- }
-}
-
-void
-screen_name_changed ()
-{
- screen->set_name (screen_name->get_text ());
-
- int const r = screen_combo->get_active_row_number ();
- update_screen_combo ();
- screen_combo->set_active (r);
-
- screen_dirty = true;
- update_sensitivity ();
-}
-
-void
-add_screen_clicked ()
-{
- shared_ptr<Screen> s (new Screen ("New Screen"));
- vector<shared_ptr<Screen> > screens = Config::instance()->screens ();
- screens.push_back (s);
- Config::instance()->set_screens (screens);
- update_screen_combo ();
- screen_combo->set_active (screens.size() - 1);
-}
-
-int
-main (int argc, char* argv[])
-{
- dvdomatic_setup ();
-
- Gtk::Main kit (argc, argv);
-
- Gtk::Dialog dialog ("Align-o-matic");
-
- screen_combo = Gtk::manage (new Gtk::ComboBoxText);
- update_screen_combo ();
- screen_combo->signal_changed().connect (sigc::ptr_fun (&screen_changed));
-
- add_screen = Gtk::manage (new Gtk::Button ("Add"));
- add_screen->signal_clicked().connect (sigc::ptr_fun (&add_screen_clicked));
-
- screen_name = Gtk::manage (new Gtk::Entry ());
- screen_name->signal_changed().connect (sigc::ptr_fun (&screen_name_changed));
-
- format_combo = Gtk::manage (new Gtk::ComboBoxText);
- vector<Format const *> formats = Format::all ();
- for (vector<Format const *>::iterator i = formats.begin(); i != formats.end(); ++i) {
- format_combo->append_text ((*i)->name ());
- }
-
- format_combo->signal_changed().connect (sigc::ptr_fun (&format_changed));
-
- save = Gtk::manage (new Gtk::Button ("Save"));
- save->signal_clicked().connect (sigc::ptr_fun (&save_clicked));
-
- x_position = Gtk::manage (new Gtk::SpinButton ());
- x_position->signal_value_changed().connect (sigc::bind (ptr_fun (&geometry_changed), GEOMETRY_PART_X));
- x_position->set_range (0, 2048);
- x_position->set_increments (1, 16);
- y_position = Gtk::manage (new Gtk::SpinButton ());
- y_position->signal_value_changed().connect (sigc::bind (sigc::ptr_fun (&geometry_changed), GEOMETRY_PART_Y));
- y_position->set_range (0, 1080);
- y_position->set_increments (1, 16);
- width = Gtk::manage (new Gtk::SpinButton ());
- width->signal_value_changed().connect (sigc::bind (sigc::ptr_fun (&geometry_changed), GEOMETRY_PART_WIDTH));
- width->set_range (0, 2048);
- width->set_increments (1, 16);
- height = Gtk::manage (new Gtk::SpinButton ());
- height->signal_value_changed().connect (sigc::bind (sigc::ptr_fun (&geometry_changed), GEOMETRY_PART_HEIGHT));
- height->set_range (0, 1080);
- height->set_increments (1, 16);
-
- calculate_width = Gtk::manage (new Gtk::Button ("Calculate"));
- calculate_width->signal_clicked().connect (sigc::ptr_fun (&calculate_width_clicked));
- calculate_height = Gtk::manage (new Gtk::Button ("Calculate"));
- calculate_height->signal_clicked().connect (sigc::ptr_fun (&calculate_height_clicked));
-
- Gtk::Table table;
- table.set_row_spacings (12);
- table.set_col_spacings (12);
- table.set_border_width (12);
-
- int n = 0;
- table.attach (left_aligned_label ("Screen"), 0, 1, n, n + 1);
- table.attach (*screen_combo, 1, 2, n, n + 1);
- table.attach (*add_screen, 2, 3, n, n + 1);
- ++n;
- table.attach (left_aligned_label ("Screen Name"), 0, 1, n, n + 1);
- table.attach (*screen_name, 1, 2, n, n + 1);
- ++n;
- table.attach (left_aligned_label ("Format"), 0, 1, n, n + 1);
- table.attach (*format_combo, 1, 2, n, n + 1);
- ++n;
- table.attach (left_aligned_label ("x"), 0, 1, n, n + 1);
- table.attach (*x_position, 1, 2, n, n + 1);
- ++n;
- table.attach (left_aligned_label ("y"), 0, 1, n, n + 1);
- table.attach (*y_position, 1, 2, n, n + 1);
- ++n;
- table.attach (left_aligned_label ("Width"), 0, 1, n, n + 1);
- table.attach (*width, 1, 2, n, n + 1);
- table.attach (*calculate_width, 2, 3, n, n + 1);
- ++n;
- table.attach (left_aligned_label ("Height"), 0, 1, n, n + 1);
- table.attach (*height, 1, 2, n, n + 1);
- table.attach (*calculate_height, 2, 3, n, n + 1);
- ++n;
-
- dialog.get_vbox()->pack_start (table, false, false);
- dialog.add_action_widget (*save, 0);
- update_sensitivity ();
- dialog.show_all ();
-
- Gtk::Main::run (dialog);
-
- return 0;
-}
diff --git a/src/tools/playomatic.cc b/src/tools/playomatic.cc
deleted file mode 100644
index b6fcd43cd..000000000
--- a/src/tools/playomatic.cc
+++ /dev/null
@@ -1,67 +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 <iostream>
-#include "lib/util.h"
-#include "gtk/film_player.h"
-#include "gtk/film_list.h"
-
-using namespace std;
-
-static FilmPlayer* film_player = 0;
-
-void
-film_changed (Film const * f)
-{
- film_player->set_film (f);
-}
-
-int
-main (int argc, char* argv[])
-{
- dvdomatic_setup ();
-
- Gtk::Main kit (argc, argv);
-
- if (argc != 2) {
- cerr << "Syntax: " << argv[0] << " <directory>\n";
- exit (EXIT_FAILURE);
- }
-
- Gtk::Window* window = new Gtk::Window ();
-
- FilmList* film_list = new FilmList (argv[1]);
- film_player = new FilmPlayer ();
-
- Gtk::HBox hbox;
- hbox.pack_start (film_list->widget(), true, true);
- hbox.pack_start (film_player->widget(), true, true);
-
- film_list->SelectionChanged.connect (sigc::ptr_fun (&film_changed));
-
- window->set_title ("Play-o-matic");
- window->add (hbox);
- window->show_all ();
-
- window->maximize ();
- Gtk::Main::run (*window);
-
- return 0;
-}
-
diff --git a/src/tools/wscript b/src/tools/wscript
index 048bdff07..9c1ca7524 100644
--- a/src/tools/wscript
+++ b/src/tools/wscript
@@ -8,11 +8,7 @@ def build(bld):
obj.target = t
if not bld.env.DISABLE_GUI:
-# p = ['dvdomatic', 'alignomatic']
- p = ['dvdomatic', 'servomatic_gui']
- if not bld.env.DISABLE_PLAYER:
- p.append('playomatic')
- for t in p:
+ for t in ['dvdomatic', 'servomatic_gui']:
obj = bld(features = 'cxx cxxprogram')
obj.includes = ['..']
obj.use = ['libdvdomatic', 'libdvdomatic-wx']
diff --git a/src/wx/config_dialog.cc b/src/wx/config_dialog.cc
index ef09b288e..9408be970 100644
--- a/src/wx/config_dialog.cc
+++ b/src/wx/config_dialog.cc
@@ -27,7 +27,6 @@
#include <wx/stdpaths.h>
#include "lib/config.h"
#include "lib/server.h"
-#include "lib/screen.h"
#include "lib/format.h"
#include "lib/scaler.h"
#include "lib/filter.h"
diff --git a/src/wx/config_dialog.h b/src/wx/config_dialog.h
index 8e85db653..615d36f83 100644
--- a/src/wx/config_dialog.h
+++ b/src/wx/config_dialog.h
@@ -28,7 +28,6 @@
class DirPickerCtrl;
-class Screen;
class ServerDescription;
/** @class ConfigDialog
diff --git a/src/wx/film_editor.cc b/src/wx/film_editor.cc
index f2831d75a..396958719 100644
--- a/src/wx/film_editor.cc
+++ b/src/wx/film_editor.cc
@@ -35,7 +35,6 @@
#include "lib/ab_transcode_job.h"
#include "lib/job_manager.h"
#include "lib/filter.h"
-#include "lib/screen.h"
#include "lib/config.h"
#include "lib/ffmpeg_decoder.h"
#include "lib/external_audio_decoder.h"
diff --git a/src/wx/film_player.cc b/src/wx/film_player.cc
deleted file mode 100644
index 53779d650..000000000
--- a/src/wx/film_player.cc
+++ /dev/null
@@ -1,310 +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 "lib/screen.h"
-#include "lib/config.h"
-#include "lib/player_manager.h"
-#include "lib/film.h"
-#include "film_player.h"
-#include "gtk_util.h"
-
-using namespace std;
-using namespace boost;
-
-FilmPlayer::FilmPlayer (Film const * f)
- : _play ("Play")
- , _pause ("Pause")
- , _stop ("Stop")
- , _ab ("A/B")
- , _ignore_position_changed (false)
-{
- set_film (f);
-
- vector<shared_ptr<Screen> > const scr = Config::instance()->screens ();
- for (vector<shared_ptr<Screen> >::const_iterator i = scr.begin(); i != scr.end(); ++i) {
- _screen.append_text ((*i)->name ());
- }
-
- if (!scr.empty ()) {
- _screen.set_active (0);
- }
-
- _status.set_use_markup (true);
-
- _position.set_digits (0);
-
- _main_vbox.set_spacing (12);
-
- Gtk::HBox* l = manage (new Gtk::HBox);
- l->pack_start (_play);
- l->pack_start (_pause);
- l->pack_start (_stop);
-
- Gtk::VBox* r = manage (new Gtk::VBox);
- r->pack_start (_screen, false, false);
- r->pack_start (_ab, false, false);
- r->pack_start (*manage (new Gtk::Label ("")), true, true);
-
- Gtk::HBox* t = manage (new Gtk::HBox);
- t->pack_start (*l, true, true);
- t->pack_start (*r, false, false);
-
- _main_vbox.pack_start (*t, true, true);
- _main_vbox.pack_start (_position, false, false);
- _main_vbox.pack_start (_status, false, false);
-
- _play.signal_clicked().connect (sigc::mem_fun (*this, &FilmPlayer::play_clicked));
- _pause.signal_clicked().connect (sigc::mem_fun (*this, &FilmPlayer::pause_clicked));
- _stop.signal_clicked().connect (sigc::mem_fun (*this, &FilmPlayer::stop_clicked));
- _position.signal_value_changed().connect (sigc::mem_fun (*this, &FilmPlayer::position_changed));
- _position.signal_format_value().connect (sigc::mem_fun (*this, &FilmPlayer::format_position));
-
- set_button_states ();
- Glib::signal_timeout().connect (sigc::bind_return (sigc::mem_fun (*this, &FilmPlayer::update), true), 1000);
-
- Config::instance()->Changed.connect (sigc::mem_fun (*this, &FilmPlayer::update_screens));
-}
-
-void
-FilmPlayer::set_film (Film const * f)
-{
- _film = f;
-
- if (_film && _film->length() != 0 && _film->frames_per_second() != 0) {
- _position.set_range (0, _film->length() / _film->frames_per_second());
- }
-
- if (_film) {
- _film->Changed.connect (sigc::mem_fun (*this, &FilmPlayer::film_changed));
- }
-}
-
-Gtk::Widget &
-FilmPlayer::widget ()
-{
- return _main_vbox;
-}
-
-void
-FilmPlayer::set_button_states ()
-{
- if (_film == 0) {
- _play.set_sensitive (false);
- _pause.set_sensitive (false);
- _stop.set_sensitive (false);
- _screen.set_sensitive (false);
- _position.set_sensitive (false);
- _ab.set_sensitive (false);
- return;
- }
-
- PlayerManager::State s = PlayerManager::instance()->state ();
-
- switch (s) {
- case PlayerManager::QUIESCENT:
- _play.set_sensitive (true);
- _pause.set_sensitive (false);
- _stop.set_sensitive (false);
- _screen.set_sensitive (true);
- _position.set_sensitive (false);
- _ab.set_sensitive (true);
- break;
- case PlayerManager::PLAYING:
- _play.set_sensitive (false);
- _pause.set_sensitive (true);
- _stop.set_sensitive (true);
- _screen.set_sensitive (false);
- _position.set_sensitive (true);
- _ab.set_sensitive (false);
- break;
- case PlayerManager::PAUSED:
- _play.set_sensitive (true);
- _pause.set_sensitive (false);
- _stop.set_sensitive (true);
- _screen.set_sensitive (false);
- _position.set_sensitive (false);
- _ab.set_sensitive (false);
- break;
- }
-}
-
-void
-FilmPlayer::play_clicked ()
-{
- PlayerManager* p = PlayerManager::instance ();
-
- switch (p->state ()) {
- case PlayerManager::QUIESCENT:
- _last_play_fs = _film->state_copy ();
- if (_ab.get_active ()) {
- shared_ptr<Film> fs_a = _film->state_copy ();
- fs_a->filters.clear ();
- /* This is somewhat arbitrary, but hey ho */
- fs_a->scaler = Scaler::from_id ("bicubic");
- p->setup (fs_a, _last_play_fs, screen ());
- } else {
- p->setup (_last_play_fs, screen ());
- }
- p->pause_or_unpause ();
- break;
- case PlayerManager::PLAYING:
- break;
- case PlayerManager::PAUSED:
- p->pause_or_unpause ();
- break;
- }
-}
-
-void
-FilmPlayer::pause_clicked ()
-{
- PlayerManager* p = PlayerManager::instance ();
-
- switch (p->state ()) {
- case PlayerManager::QUIESCENT:
- break;
- case PlayerManager::PLAYING:
- p->pause_or_unpause ();
- break;
- case PlayerManager::PAUSED:
- break;
- }
-}
-
-void
-FilmPlayer::stop_clicked ()
-{
- PlayerManager::instance()->stop ();
-}
-
-shared_ptr<Screen>
-FilmPlayer::screen () const
-{
- vector<shared_ptr<Screen> > const s = Config::instance()->screens ();
- if (s.empty ()) {
- return shared_ptr<Screen> ();
- }
-
- int const r = _screen.get_active_row_number ();
- if (r >= int (s.size ())) {
- return s[0];
- }
-
- return s[r];
-}
-
-void
-FilmPlayer::update ()
-{
- set_button_states ();
- set_status ();
-}
-
-void
-FilmPlayer::set_status ()
-{
- PlayerManager::State s = PlayerManager::instance()->state ();
-
- stringstream m;
- switch (s) {
- case PlayerManager::QUIESCENT:
- m << "Idle";
- break;
- case PlayerManager::PLAYING:
- m << "<span foreground=\"red\" weight=\"bold\">PLAYING</span>";
- break;
- case PlayerManager::PAUSED:
- m << "<b>Paused</b>";
- break;
- }
-
- _ignore_position_changed = true;
-
- if (s != PlayerManager::QUIESCENT) {
- float const p = PlayerManager::instance()->position ();
- if (_last_play_fs->frames_per_second != 0 && _last_play_fs->length != 0) {
- m << " <i>(" << seconds_to_hms (_last_play_fs->length / _last_play_fs->frames_per_second - p) << " remaining)</i>";
- }
-
- _position.set_value (p);
- } else {
- _position.set_value (0);
- }
-
- _ignore_position_changed = false;
-
- _status.set_markup (m.str ());
-}
-
-void
-FilmPlayer::position_changed ()
-{
- if (_ignore_position_changed) {
- return;
- }
-
- PlayerManager::instance()->set_position (_position.get_value ());
-}
-
-string
-FilmPlayer::format_position (double v)
-{
- return seconds_to_hms (v);
-}
-
-void
-FilmPlayer::update_screens ()
-{
- string const c = _screen.get_active_text ();
-
- _screen.clear ();
-
- vector<shared_ptr<Screen> > const scr = Config::instance()->screens ();
- bool have_last_active_text = false;
- for (vector<shared_ptr<Screen> >::const_iterator i = scr.begin(); i != scr.end(); ++i) {
- _screen.append_text ((*i)->name ());
- if ((*i)->name() == c) {
- have_last_active_text = true;
- }
- }
-
- if (have_last_active_text) {
- _screen.set_active_text (c);
- } else if (!scr.empty ()) {
- _screen.set_active (0);
- }
-}
-
-void
-FilmPlayer::film_changed (Film::Property p)
-{
- if (p == Film::CONTENT) {
- setup_visibility ();
- }
-}
-
-void
-FilmPlayer::setup_visibility ()
-{
- if (!_film) {
- return;
- }
-
- widget().property_visible() = (_film->content_type() == VIDEO);
-}
diff --git a/src/wx/film_player.h b/src/wx/film_player.h
deleted file mode 100644
index bb60eeb3b..000000000
--- a/src/wx/film_player.h
+++ /dev/null
@@ -1,63 +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 <gtkmm.h>
-#include "lib/film.h"
-
-class Film;
-class Screen;
-class FilmState;
-
-class FilmPlayer
-{
-public:
- FilmPlayer (Film const * f = 0);
-
- Gtk::Widget& widget ();
-
- void set_film (Film const *);
- void setup_visibility ();
-
-private:
- void play_clicked ();
- void pause_clicked ();
- void stop_clicked ();
- void position_changed ();
- std::string format_position (double);
- void film_changed (Film::Property);
-
- void set_button_states ();
- boost::shared_ptr<Screen> screen () const;
- void set_status ();
- void update ();
- void update_screens ();
-
- Film const * _film;
- boost::shared_ptr<const FilmState> _last_play_fs;
-
- Gtk::VBox _main_vbox;
- Gtk::Button _play;
- Gtk::Button _pause;
- Gtk::Button _stop;
- Gtk::Label _status;
- Gtk::CheckButton _ab;
- Gtk::ComboBoxText _screen;
- Gtk::HScale _position;
- bool _ignore_position_changed;
-};
diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc
index 79de49406..a82132358 100644
--- a/src/wx/film_viewer.cc
+++ b/src/wx/film_viewer.cc
@@ -43,6 +43,7 @@ public:
ThumbPanel (wxPanel* parent, shared_ptr<Film> film)
: wxPanel (parent)
, _film (film)
+ , _index (0)
, _frame_rebuild_needed (false)
, _composition_needed (false)
{}
diff --git a/src/wx/wscript b/src/wx/wscript
index e5431460f..d425c3e05 100644
--- a/src/wx/wscript
+++ b/src/wx/wscript
@@ -26,11 +26,4 @@ def build(bld):
wx_ui_signaller.cc
"""
-# alignment.cc
-# film_list.cc
-# dvd_title_dialog.cc
-
- if not bld.env.DISABLE_PLAYER:
- obj.source += " film_player.cc"
-
obj.target = 'dvdomatic-wx'