#include "config.h"
#include "server.h"
#include "scaler.h"
-#include "screen.h"
#include "filter.h"
#include "sound_processor.h"
_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") {
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";
#include <boost/signals2.hpp>
class ServerDescription;
-class Screen;
class Scaler;
class Filter;
class SoundProcessor;
return _servers;
}
- std::vector<boost::shared_ptr<Screen> > screens () const {
- return _screens;
- }
-
Scaler const * reference_scaler () const {
return _reference_scaler;
}
_servers = s;
}
- void set_screens (std::vector<boost::shared_ptr<Screen> > s) {
- _screens = s;
- }
-
void set_reference_scaler (Scaler const * s) {
_reference_scaler = s;
}
/** 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 */
+++ /dev/null
-/*
- 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);
- }
-}
+++ /dev/null
-/*
- 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 ();
-};
+++ /dev/null
-/*
- 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;
-}
+++ /dev/null
-/*
- 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 ();
#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"
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.
*/
void examine_content ();
void send_dcp_to_tms ();
- void copy_from_dvd ();
void make_dcp (bool);
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;
+++ /dev/null
-/*
- 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;
-}
+++ /dev/null
-/*
- 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
+++ /dev/null
-/*
- 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 ();
-}
+++ /dev/null
-/*
- 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;
-};
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)
{
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.
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;
/** 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 */
+++ /dev/null
-/*
- 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;
-}
+++ /dev/null
-/*
- 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;
-};
#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;
}
#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.
*/
{
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()) << ", "
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.
*/
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
ab_transcoder.cc
check_hashes_job.cc
config.cc
- copy_from_dvd_job.cc
cross.cc
dcp_content_type.cc
dcp_video_frame.cc
decoder_factory.cc
delay_line.cc
dolby_cp750.cc
- dvd.cc
encoder.cc
encoder_factory.cc
examine_content_job.cc
make_dcp_job.cc
scp_dcp_job.cc
scaler.cc
- screen.cc
server.cc
sound_processor.cc
stream.cc
version.cc
"""
- if not bld.env.DISABLE_PLAYER:
- obj.source += " player.cc player_manager.cc"
-
obj.target = 'dvdomatic'
+++ /dev/null
-/*
- 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;
-}
#include "wx/job_manager_view.h"
#include "wx/config_dialog.h"
#include "wx/job_wrapper.h"
-//#include "gtk/dvd_title_dialog.h"
#include "wx/wx_util.h"
#include "wx/new_film_dialog.h"
#include "wx/properties_dialog.h"
ID_edit_preferences,
ID_jobs_make_dcp,
ID_jobs_send_dcp_to_tms,
- ID_jobs_copy_from_dvd,
ID_jobs_examine_content,
ID_jobs_make_dcp_from_existing_transcode,
ID_help_about
wxMenu* jobs = new wxMenu;
add_item (jobs, "&Make DCP", ID_jobs_make_dcp, NEEDS_FILM);
add_item (jobs, "&Send DCP to TMS", ID_jobs_send_dcp_to_tms, NEEDS_FILM);
-#ifdef DVDOMATIC_POSIX
- add_item (jobs, "Copy from &DVD...", ID_jobs_copy_from_dvd, NEEDS_FILM);
-#endif
jobs->AppendSeparator ();
add_item (jobs, "&Examine content", ID_jobs_examine_content, NEEDS_FILM);
add_item (jobs, "Make DCP from existing &transcode", ID_jobs_make_dcp_from_existing_transcode, NEEDS_FILM);
Connect (ID_edit_preferences, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler (Frame::edit_preferences));
Connect (ID_jobs_make_dcp, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler (Frame::jobs_make_dcp));
Connect (ID_jobs_send_dcp_to_tms, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler (Frame::jobs_send_dcp_to_tms));
- Connect (ID_jobs_copy_from_dvd, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler (Frame::jobs_copy_from_dvd));
Connect (ID_jobs_examine_content, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler (Frame::jobs_examine_content));
Connect (ID_jobs_make_dcp_from_existing_transcode, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler (Frame::jobs_make_dcp_from_existing_transcode));
Connect (ID_help_about, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler (Frame::help_about));
JobWrapper::make_dcp (this, film, false);
}
- void jobs_copy_from_dvd (wxCommandEvent &)
- {
- try {
-
-// DVDTitleDialog d;
-// if (d.run () != Gtk::RESPONSE_OK) {
-// return;
-// }
- film->copy_from_dvd ();
- } catch (DVDError& e) {
- error_dialog (this, e.what ());
- }
- }
-
void jobs_send_dcp_to_tms (wxCommandEvent &)
{
film->send_dcp_to_tms ();
+++ /dev/null
-/*
- 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;
-}
-
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']
+++ /dev/null
-/*
- 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 <gtkmm.h>
-#include <cairomm/cairomm.h>
-#include "alignment.h"
-
-using namespace std;
-
-class AlignmentWidget : public Gtk::DrawingArea
-{
-public:
- void set_text_line (int n, string t)
- {
- if (int(_text.size()) < (n + 1)) {
- _text.resize (n + 1);
- }
-
- _text[n] = t;
- queue_draw ();
- }
-
-private:
- bool on_expose_event (GdkEventExpose* ev)
- {
- if (!get_window ()) {
- return false;
- }
-
- Cairo::RefPtr<Cairo::Context> c = get_window()->create_cairo_context ();
-
- Gtk::Allocation a = get_allocation ();
- int const w = a.get_width ();
- int const h = a.get_height ();
-
- c->rectangle (0, 0, w, h);
- c->set_source_rgb (0, 0, 0);
- c->fill ();
-
- c->set_source_rgb (1, 1, 1);
- c->set_line_width (1);
-
- int const arrow_size = h / 8;
- int const head_size = h / 32;
-
- /* arrow to left edge */
- c->move_to (arrow_size, h / 2);
- c->line_to (0, h / 2);
- c->rel_line_to (head_size, head_size);
- c->move_to (0, h / 2);
- c->rel_line_to (head_size, -head_size);
- c->stroke ();
-
- /* arrow to right edge */
- c->move_to (w - arrow_size, h / 2);
- c->line_to (w, h / 2);
- c->rel_line_to (-head_size, head_size);
- c->move_to (w, h / 2);
- c->rel_line_to (-head_size, -head_size);
- c->stroke ();
-
- /* arrow to top edge */
- c->move_to (w / 2, arrow_size);
- c->line_to (w / 2, 0);
- c->rel_line_to (head_size, head_size);
- c->move_to (w / 2, 0);
- c->rel_line_to (-head_size, head_size);
- c->stroke ();
-
- /* arrow to bottom edge */
- c->move_to (w / 2, h - h / 8);
- c->line_to (w / 2, h);
- c->rel_line_to (head_size, -head_size);
- c->move_to (w / 2, h);
- c->rel_line_to (-head_size, -head_size);
- c->stroke ();
-
- /* arrow to top-left corner */
- c->move_to (arrow_size, arrow_size);
- c->line_to (0, 0);
- c->rel_line_to (head_size, 0);
- c->move_to (0, 0);
- c->rel_line_to (0, head_size);
- c->stroke ();
-
- /* arrow to top-right corner */
- c->move_to (w - arrow_size, arrow_size);
- c->line_to (w, 0);
- c->rel_line_to (0, head_size);
- c->move_to (w, 0);
- c->rel_line_to (-head_size, 0);
- c->stroke ();
-
- /* arrow to bottom-left corner */
- c->move_to (arrow_size, h - arrow_size);
- c->line_to (0, h);
- c->rel_line_to (head_size, 0);
- c->move_to (0, h);
- c->rel_line_to (0, -head_size);
- c->stroke ();
-
- /* arrow to bottom-right corner */
- c->move_to (w - arrow_size, h - arrow_size);
- c->line_to (w, h);
- c->rel_line_to (-head_size, 0);
- c->line_to (w, h);
- c->rel_line_to (0, -head_size);
- c->stroke ();
-
- /* text */
- int max_height = 0;
- for (vector<string>::iterator i = _text.begin(); i != _text.end(); ++i) {
- Cairo::TextExtents e;
- c->get_text_extents (*i, e);
- max_height = max (max_height, int (e.height));
- }
-
- int total_height = max_height * _text.size() * 2;
-
- for (vector<string>::size_type i = 0; i < _text.size(); ++i) {
- Cairo::TextExtents e;
- c->get_text_extents (_text[i], e);
- c->move_to ((w - e.width) / 2, ((h - total_height) / 2) + ((i * 2) + 1) * max_height);
- c->text_path (_text[i]);
- c->stroke ();
- }
-
- return true;
- }
-
- std::vector<std::string> _text;
-};
-
-Alignment::Alignment (Position p, Size s)
-{
- _widget = Gtk::manage (new AlignmentWidget);
- add (*_widget);
- show_all ();
-
- set_decorated (false);
- set_resizable (false);
- set_size_request (s.width, s.height);
- move (p.x, p.y);
-}
-
-void
-Alignment::set_text_line (int n, string t)
-{
- _widget->set_text_line (n, t);
-}
+++ /dev/null
-/*
- 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 <string>
-#include "lib/util.h"
-
-class AlignmentWidget;
-
-class Alignment : public Gtk::Window
-{
-public:
- Alignment (Position, Size);
-
- void set_text_line (int, std::string);
-
-private:
- AlignmentWidget* _widget;
-};
#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"
class DirPickerCtrl;
-class Screen;
class ServerDescription;
/** @class ConfigDialog
+++ /dev/null
-/*
- 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 <cassert>
-#include <iostream>
-#include "lib/exceptions.h"
-#include "dvd_title_dialog.h"
-#include "gtk_util.h"
-
-using namespace std;
-
-DVDTitleDialog::DVDTitleDialog ()
-{
- string const dvd = find_dvd ();
- if (dvd.empty ()) {
- throw DVDError ("could not find DVD");
- }
-
- list<DVDTitle> t = dvd_titles (dvd);
- if (t.empty ()) {
- throw DVDError ("no titles found on DVD");
- }
-
- set_title ("Choose DVD title");
- get_vbox()->set_border_width (6);
- get_vbox()->set_spacing (3);
-
- Gtk::RadioButtonGroup g;
- for (list<DVDTitle>::const_iterator i = t.begin(); i != t.end(); ++i) {
- Gtk::RadioButton* b = manage (new Gtk::RadioButton);
- stringstream s;
-#if HAVE_G_FORMAT_SIZE
- s << "Title " << i->number << ": " << g_format_size (i->size);
-#else
- s << "Title " << i->number << ": " << g_format_size_for_display (i->size);
-#endif
- b->set_label (s.str ());
- if (i == t.begin ()) {
- b->set_active ();
- g = b->get_group ();
- } else {
- b->set_group (g);
- }
- get_vbox()->pack_start (*b);
- _buttons[*i] = b;
- }
-
- add_button ("Cancel", Gtk::RESPONSE_CANCEL);
- add_button ("Copy Title", Gtk::RESPONSE_OK);
-
- show_all ();
-}
-
-DVDTitle
-DVDTitleDialog::selected ()
-{
- std::map<DVDTitle, Gtk::RadioButton *>::const_iterator i = _buttons.begin ();
- while (i != _buttons.end() && i->second->get_active() == false) {
- ++i;
- }
-
- assert (i != _buttons.end ());
- return i->first;
-}
+++ /dev/null
-/*
- 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/dvd.h"
-
-class DVDTitleDialog : public Gtk::Dialog
-{
-public:
- DVDTitleDialog ();
-
- DVDTitle selected ();
-
-private:
- std::map<DVDTitle, Gtk::RadioButton *> _buttons;
-};
#include "lib/ab_transcode_job.h"
#include "lib/job_manager.h"
#include "lib/filter.h"
-#include "lib/screen.h"
#include "lib/config.h"
#include "filter_dialog.h"
#include "wx_util.h"
+++ /dev/null
-/*
- 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);
-}
+++ /dev/null
-/*
- 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;
-};
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'
#include "job_manager.h"
#include "util.h"
#include "exceptions.h"
-#include "dvd.h"
#include "delay_line.h"
#include "image.h"
#include "log.h"
BOOST_CHECK_EQUAL (*i++, "them");
}
-BOOST_AUTO_TEST_CASE (dvd_test)
-{
- list<DVDTitle> const t = dvd_titles ("test/dvd");
- BOOST_CHECK_EQUAL (t.size(), 3);
- list<DVDTitle>::const_iterator i = t.begin ();
-
- BOOST_CHECK_EQUAL (i->number, 1);
- BOOST_CHECK_EQUAL (i->size, 0);
- ++i;
-
- BOOST_CHECK_EQUAL (i->number, 2);
- BOOST_CHECK_EQUAL (i->size, 14);
- ++i;
-
- BOOST_CHECK_EQUAL (i->number, 3);
- BOOST_CHECK_EQUAL (i->size, 7);
-}
-
void
do_positive_delay_line_test (int delay_length, int data_length)
{
opt.add_option('--enable-debug', action='store_true', default = False, help = 'build with debugging information and without optimisation')
opt.add_option('--disable-gui', action='store_true', default = False, help = 'disable building of GUI tools')
- opt.add_option('--disable-player', action='store_true', default = False, help = 'disable building of the player components')
opt.add_option('--target-windows', action='store_true', default = False, help = 'set up to do a cross-compile to Windows')
def configure(conf):
conf.env.append_value('CXXFLAGS', ['-D__STDC_CONSTANT_MACROS', '-msse', '-mfpmath=sse', '-ffast-math', '-fno-strict-aliasing', '-Wall', '-Wno-attributes'])
- # Turn off player for now
- conf.options.disable_player = True
-
if conf.options.target_windows:
conf.env.append_value('CXXFLAGS', ['-DDVDOMATIC_WINDOWS', '-DWIN32_LEAN_AND_MEAN', '-DBOOST_USE_WINDOWS_H'])
wxrc = os.popen('wx-config --rescomp').read().split()[1:]
if conf.options.enable_debug:
conf.env.append_value('CXXFLAGS', ['-mconsole'])
conf.env.append_value('LINKFLAGS', ['-mconsole'])
- conf.options.disable_player = True
conf.check(lib = 'ws2_32', uselib_store = 'WINSOCK2', msg = "Checking for library winsock2")
boost_lib_suffix = '-mt'
boost_thread = 'boost_thread_win32-mt'
conf.env.TARGET_WINDOWS = conf.options.target_windows
conf.env.DISABLE_GUI = conf.options.disable_gui
- conf.env.DISABLE_PLAYER = conf.options.disable_player
conf.env.VERSION = VERSION
- if conf.options.disable_player:
- conf.env.append_value('CXXFLAGS', '-DDVDOMATIC_DISABLE_PLAYER')
-
if conf.options.enable_debug:
conf.env.append_value('CXXFLAGS', ['-g', '-DDVDOMATIC_DEBUG'])
else: