From 15f23b356b757a9697bf1a9ec30c243ab8070404 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 1 Jul 2014 14:28:04 +0100 Subject: [PATCH] DCPVideoFrame -> DCPVideo and PlayerVideoFrame -> PlayerVideo. --- src/lib/{dcp_video_frame.cc => dcp_video.cc} | 18 +++++++------- src/lib/{dcp_video_frame.h => dcp_video.h} | 12 +++++----- src/lib/encoder.cc | 14 +++++------ src/lib/encoder.h | 8 +++---- src/lib/player.cc | 24 +++++++++---------- src/lib/player.h | 6 ++--- ...{player_video_frame.cc => player_video.cc} | 14 +++++------ .../{player_video_frame.h => player_video.h} | 6 ++--- src/lib/server.cc | 8 +++---- src/lib/transcoder.cc | 4 ++-- src/lib/writer.cc | 2 +- src/lib/wscript | 4 ++-- src/tools/dcpomatic_server_cli.cc | 2 +- src/tools/server_test.cc | 10 ++++---- src/wx/film_viewer.cc | 4 ++-- src/wx/film_viewer.h | 2 +- test/client_server_test.cc | 22 ++++++++--------- 17 files changed, 80 insertions(+), 80 deletions(-) rename src/lib/{dcp_video_frame.cc => dcp_video.cc} (95%) rename src/lib/{dcp_video_frame.h => dcp_video.h} (89%) rename src/lib/{player_video_frame.cc => player_video.cc} (91%) rename src/lib/{player_video_frame.h => player_video.h} (87%) diff --git a/src/lib/dcp_video_frame.cc b/src/lib/dcp_video.cc similarity index 95% rename from src/lib/dcp_video_frame.cc rename to src/lib/dcp_video.cc index 4054f05cd..8d4a5925f 100644 --- a/src/lib/dcp_video_frame.cc +++ b/src/lib/dcp_video.cc @@ -50,7 +50,7 @@ #include #include #include "film.h" -#include "dcp_video_frame.h" +#include "dcp_video.h" #include "config.h" #include "exceptions.h" #include "server.h" @@ -59,7 +59,7 @@ #include "image.h" #include "log.h" #include "cross.h" -#include "player_video_frame.h" +#include "player_video.h" #define LOG_GENERAL(...) _log->log (String::compose (__VA_ARGS__), Log::TYPE_GENERAL); @@ -81,8 +81,8 @@ using dcp::raw_convert; * @param bw J2K bandwidth to use (see Config::j2k_bandwidth ()) * @param l Log to write to. */ -DCPVideoFrame::DCPVideoFrame ( - shared_ptr frame, int index, int dcp_fps, int bw, Resolution r, shared_ptr l +DCPVideo::DCPVideo ( + shared_ptr frame, int index, int dcp_fps, int bw, Resolution r, shared_ptr l ) : _frame (frame) , _index (index) @@ -94,7 +94,7 @@ DCPVideoFrame::DCPVideoFrame ( } -DCPVideoFrame::DCPVideoFrame (shared_ptr frame, shared_ptr node, shared_ptr log) +DCPVideo::DCPVideo (shared_ptr frame, shared_ptr node, shared_ptr log) : _frame (frame) , _log (log) { @@ -108,7 +108,7 @@ DCPVideoFrame::DCPVideoFrame (shared_ptr frame, shared_p * @return Encoded data. */ shared_ptr -DCPVideoFrame::encode_locally () +DCPVideo::encode_locally () { shared_ptr in_lut = dcp::GammaLUT::cache.get ( 12, _frame->colour_conversion().input_gamma, _frame->colour_conversion().input_gamma_linearised @@ -259,7 +259,7 @@ DCPVideoFrame::encode_locally () * @return Encoded data. */ shared_ptr -DCPVideoFrame::encode_remotely (ServerDescription serv) +DCPVideo::encode_remotely (ServerDescription serv) { boost::asio::io_service io_service; boost::asio::ip::tcp::resolver resolver (io_service); @@ -299,7 +299,7 @@ DCPVideoFrame::encode_remotely (ServerDescription serv) } void -DCPVideoFrame::add_metadata (xmlpp::Element* el) const +DCPVideo::add_metadata (xmlpp::Element* el) const { el->add_child("Index")->add_child_text (raw_convert (_index)); el->add_child("FramesPerSecond")->add_child_text (raw_convert (_frames_per_second)); @@ -309,7 +309,7 @@ DCPVideoFrame::add_metadata (xmlpp::Element* el) const } Eyes -DCPVideoFrame::eyes () const +DCPVideo::eyes () const { return _frame->eyes (); } diff --git a/src/lib/dcp_video_frame.h b/src/lib/dcp_video.h similarity index 89% rename from src/lib/dcp_video_frame.h rename to src/lib/dcp_video.h index 7393efde6..7b01966bd 100644 --- a/src/lib/dcp_video_frame.h +++ b/src/lib/dcp_video.h @@ -31,7 +31,7 @@ class Scaler; class Image; class Log; class Subtitle; -class PlayerVideoFrame; +class PlayerVideo; /** @class EncodedData * @brief Container for J2K-encoded data. @@ -89,7 +89,7 @@ public: RemotelyEncodedData (int s); }; -/** @class DCPVideoFrame +/** @class DCPVideo * @brief A single frame of video destined for a DCP. * * Given an Image and some settings, this class knows how to encode @@ -98,11 +98,11 @@ public: * Objects of this class are used for the queue that we keep * of images that require encoding. */ -class DCPVideoFrame : public boost::noncopyable +class DCPVideo : public boost::noncopyable { public: - DCPVideoFrame (boost::shared_ptr, int, int, int, Resolution, boost::shared_ptr); - DCPVideoFrame (boost::shared_ptr, cxml::ConstNodePtr, boost::shared_ptr); + DCPVideo (boost::shared_ptr, int, int, int, Resolution, boost::shared_ptr); + DCPVideo (boost::shared_ptr, cxml::ConstNodePtr, boost::shared_ptr); boost::shared_ptr encode_locally (); boost::shared_ptr encode_remotely (ServerDescription); @@ -117,7 +117,7 @@ private: void add_metadata (xmlpp::Element *) const; - boost::shared_ptr _frame; + boost::shared_ptr _frame; int _index; ///< frame index within the DCP's intrinsic duration int _frames_per_second; ///< Frames per second that we will use for the DCP int _j2k_bandwidth; ///< J2K bandwidth to use diff --git a/src/lib/encoder.cc b/src/lib/encoder.cc index 0756586a9..2b1f1d9b3 100644 --- a/src/lib/encoder.cc +++ b/src/lib/encoder.cc @@ -29,13 +29,13 @@ #include "film.h" #include "log.h" #include "config.h" -#include "dcp_video_frame.h" +#include "dcp_video.h" #include "server.h" #include "cross.h" #include "writer.h" #include "server_finder.h" #include "player.h" -#include "player_video_frame.h" +#include "player_video.h" #include "i18n.h" @@ -125,7 +125,7 @@ Encoder::process_end () So just mop up anything left in the queue here. */ - for (list >::iterator i = _queue.begin(); i != _queue.end(); ++i) { + for (list >::iterator i = _queue.begin(); i != _queue.end(); ++i) { LOG_GENERAL (N_("Encode left-over frame %1"), (*i)->index ()); try { _writer->write ((*i)->encode_locally(), (*i)->index (), (*i)->eyes ()); @@ -181,7 +181,7 @@ Encoder::frame_done () } void -Encoder::process_video (shared_ptr pvf) +Encoder::process_video (shared_ptr pvf) { _waker.nudge (); @@ -213,8 +213,8 @@ Encoder::process_video (shared_ptr pvf) } else { /* Queue this new frame for encoding */ LOG_TIMING ("adding to queue of %1", _queue.size ()); - _queue.push_back (shared_ptr ( - new DCPVideoFrame ( + _queue.push_back (shared_ptr ( + new DCPVideo ( pvf, _video_frames_out, _film->video_frame_rate(), @@ -284,7 +284,7 @@ try } LOG_TIMING ("[%1] encoder thread wakes with queue of %2", boost::this_thread::get_id(), _queue.size()); - shared_ptr vf = _queue.front (); + shared_ptr vf = _queue.front (); LOG_TIMING ("[%1] encoder thread pops frame %2 (%3) from queue", boost::this_thread::get_id(), vf->index(), vf->eyes ()); _queue.pop_front (); diff --git a/src/lib/encoder.h b/src/lib/encoder.h index 6bb97012a..4502b7151 100644 --- a/src/lib/encoder.h +++ b/src/lib/encoder.h @@ -44,12 +44,12 @@ class Image; class AudioBuffers; class Film; class ServerDescription; -class DCPVideoFrame; +class DCPVideo; class EncodedData; class Writer; class Job; class ServerFinder; -class PlayerVideoFrame; +class PlayerVideo; /** @class Encoder * @brief Encoder to J2K and WAV for DCP. @@ -70,7 +70,7 @@ public: /** Call with a frame of video. * @param f Video frame. */ - void process_video (boost::shared_ptr f); + void process_video (boost::shared_ptr f); /** Call with some audio data */ void process_audio (boost::shared_ptr); @@ -107,7 +107,7 @@ private: int _video_frames_out; bool _terminate; - std::list > _queue; + std::list > _queue; std::list _threads; mutable boost::mutex _mutex; /** condition to manage thread wakeups when we have nothing to do */ diff --git a/src/lib/player.cc b/src/lib/player.cc index 380133b61..b634028ba 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -41,7 +41,7 @@ #include "render_subtitles.h" #include "config.h" #include "content_video.h" -#include "player_video_frame.h" +#include "player_video.h" #include "frame_rate_change.h" #define LOG_GENERAL(...) _film->log()->log (String::compose (__VA_ARGS__), Log::TYPE_GENERAL); @@ -292,11 +292,11 @@ Player::set_approximate_size () _approximate_size = true; } -shared_ptr +shared_ptr Player::black_player_video_frame () const { - return shared_ptr ( - new PlayerVideoFrame ( + return shared_ptr ( + new PlayerVideo ( shared_ptr (new RawImageProxy (_black_image, _film->log ())), Crop (), _video_container_size, @@ -309,8 +309,8 @@ Player::black_player_video_frame () const ); } -/** @return All PlayerVideoFrames at the given time (there may be two frames for 3D) */ -list > +/** @return All PlayerVideos at the given time (there may be two frames for 3D) */ +list > Player::get_video (DCPTime time, bool accurate) { if (!_have_valid_pieces) { @@ -322,13 +322,13 @@ Player::get_video (DCPTime time, bool accurate) time + DCPTime::from_frames (1, _film->video_frame_rate ()) ); - list > pvf; + list > pvf; if (ov.empty ()) { /* No video content at this time */ pvf.push_back (black_player_video_frame ()); } else { - /* Create a PlayerVideoFrame from the content's video at this time */ + /* Create a PlayerVideo from the content's video at this time */ shared_ptr piece = ov.back (); shared_ptr decoder = dynamic_pointer_cast (piece->decoder); @@ -350,8 +350,8 @@ Player::get_video (DCPTime time, bool accurate) for (list::const_iterator i = content_video.begin(); i != content_video.end(); ++i) { pvf.push_back ( - shared_ptr ( - new PlayerVideoFrame ( + shared_ptr ( + new PlayerVideo ( i->image, content->crop (), image_size, @@ -366,7 +366,7 @@ Player::get_video (DCPTime time, bool accurate) } } - /* Add subtitles to whatever PlayerVideoFrames we got */ + /* Add subtitles to whatever PlayerVideos we got */ list > subs = overlaps ( time, @@ -404,7 +404,7 @@ Player::get_video (DCPTime time, bool accurate) } if (!sub_images.empty ()) { - for (list >::const_iterator i = pvf.begin(); i != pvf.end(); ++i) { + for (list >::const_iterator i = pvf.begin(); i != pvf.end(); ++i) { (*i)->set_subtitle (merge (sub_images)); } } diff --git a/src/lib/player.h b/src/lib/player.h index 6805dc8c7..04503c27a 100644 --- a/src/lib/player.h +++ b/src/lib/player.h @@ -42,7 +42,7 @@ class Piece; class Image; class Decoder; class Resampler; -class PlayerVideoFrame; +class PlayerVideo; class ImageProxy; class PlayerStatistics @@ -85,7 +85,7 @@ class Player : public boost::enable_shared_from_this, public boost::nonc public: Player (boost::shared_ptr, boost::shared_ptr); - std::list > get_video (DCPTime time, bool accurate); + std::list > get_video (DCPTime time, bool accurate); boost::shared_ptr get_audio (DCPTime time, DCPTime length, bool accurate); void set_video_container_size (dcp::Size); @@ -119,7 +119,7 @@ private: VideoFrame dcp_to_content_video (boost::shared_ptr piece, DCPTime t) const; AudioFrame dcp_to_content_audio (boost::shared_ptr piece, DCPTime t) const; ContentTime dcp_to_content_subtitle (boost::shared_ptr piece, DCPTime t) const; - boost::shared_ptr black_player_video_frame () const; + boost::shared_ptr black_player_video_frame () const; /** @return Pieces of content type C that overlap a specified time range in the DCP */ template diff --git a/src/lib/player_video_frame.cc b/src/lib/player_video.cc similarity index 91% rename from src/lib/player_video_frame.cc rename to src/lib/player_video.cc index 5463925bf..f8e4a3e66 100644 --- a/src/lib/player_video_frame.cc +++ b/src/lib/player_video.cc @@ -18,7 +18,7 @@ */ #include -#include "player_video_frame.h" +#include "player_video.h" #include "image.h" #include "image_proxy.h" #include "scaler.h" @@ -28,7 +28,7 @@ using std::cout; using boost::shared_ptr; using dcp::raw_convert; -PlayerVideoFrame::PlayerVideoFrame ( +PlayerVideo::PlayerVideo ( shared_ptr in, Crop crop, dcp::Size inter_size, @@ -50,7 +50,7 @@ PlayerVideoFrame::PlayerVideoFrame ( } -PlayerVideoFrame::PlayerVideoFrame (shared_ptr node, shared_ptr socket, shared_ptr log) +PlayerVideo::PlayerVideo (shared_ptr node, shared_ptr socket, shared_ptr log) { _crop = Crop (node); @@ -76,13 +76,13 @@ PlayerVideoFrame::PlayerVideoFrame (shared_ptr node, shared_ptr -PlayerVideoFrame::image () const +PlayerVideo::image () const { shared_ptr im = _in->image (); @@ -116,7 +116,7 @@ PlayerVideoFrame::image () const } void -PlayerVideoFrame::add_metadata (xmlpp::Node* node) const +PlayerVideo::add_metadata (xmlpp::Node* node) const { _crop.as_xml (node); _in->add_metadata (node->add_child ("In")); @@ -137,7 +137,7 @@ PlayerVideoFrame::add_metadata (xmlpp::Node* node) const } void -PlayerVideoFrame::send_binary (shared_ptr socket) const +PlayerVideo::send_binary (shared_ptr socket) const { _in->send_binary (socket); if (_subtitle.image) { diff --git a/src/lib/player_video_frame.h b/src/lib/player_video.h similarity index 87% rename from src/lib/player_video_frame.h rename to src/lib/player_video.h index 4c6a9c630..73557bbfd 100644 --- a/src/lib/player_video_frame.h +++ b/src/lib/player_video.h @@ -33,11 +33,11 @@ class Log; * bits still their raw form. We may want to combine the bits on a remote machine, * or maybe not even bother to combine them at all. */ -class PlayerVideoFrame +class PlayerVideo { public: - PlayerVideoFrame (boost::shared_ptr, Crop, dcp::Size, dcp::Size, Scaler const *, Eyes, Part, ColourConversion); - PlayerVideoFrame (boost::shared_ptr, boost::shared_ptr, boost::shared_ptr); + PlayerVideo (boost::shared_ptr, Crop, dcp::Size, dcp::Size, Scaler const *, Eyes, Part, ColourConversion); + PlayerVideo (boost::shared_ptr, boost::shared_ptr, boost::shared_ptr); void set_subtitle (PositionImage); diff --git a/src/lib/server.cc b/src/lib/server.cc index 9d1925de1..2469d4151 100644 --- a/src/lib/server.cc +++ b/src/lib/server.cc @@ -34,10 +34,10 @@ #include "util.h" #include "scaler.h" #include "image.h" -#include "dcp_video_frame.h" +#include "dcp_video.h" #include "config.h" #include "cross.h" -#include "player_video_frame.h" +#include "player_video.h" #include "i18n.h" @@ -112,9 +112,9 @@ Server::process (shared_ptr socket, struct timeval& after_read, struct t return -1; } - shared_ptr pvf (new PlayerVideoFrame (xml, socket, _log)); + shared_ptr pvf (new PlayerVideo (xml, socket, _log)); - DCPVideoFrame dcp_video_frame (pvf, xml, _log); + DCPVideo dcp_video_frame (pvf, xml, _log); gettimeofday (&after_read, 0); diff --git a/src/lib/transcoder.cc b/src/lib/transcoder.cc index a4cd36a4f..1177830be 100644 --- a/src/lib/transcoder.cc +++ b/src/lib/transcoder.cc @@ -61,8 +61,8 @@ Transcoder::go () DCPTime const frame = DCPTime::from_frames (1, _film->video_frame_rate ()); for (DCPTime t; t < _film->length(); t += frame) { - list > v = _player->get_video (t, true); - for (list >::const_iterator i = v.begin(); i != v.end(); ++i) { + list > v = _player->get_video (t, true); + for (list >::const_iterator i = v.begin(); i != v.end(); ++i) { _encoder->process_video (*i); } _encoder->process_audio (_player->get_audio (t, frame, true)); diff --git a/src/lib/writer.cc b/src/lib/writer.cc index 489135b84..ca9b63df4 100644 --- a/src/lib/writer.cc +++ b/src/lib/writer.cc @@ -34,7 +34,7 @@ #include "film.h" #include "ratio.h" #include "log.h" -#include "dcp_video_frame.h" +#include "dcp_video.h" #include "dcp_content_type.h" #include "player.h" #include "audio_mapping.h" diff --git a/src/lib/wscript b/src/lib/wscript index 407d9cde4..1f6a2aa4f 100644 --- a/src/lib/wscript +++ b/src/lib/wscript @@ -16,7 +16,7 @@ sources = """ content_subtitle.cc cross.cc dcp_content_type.cc - dcp_video_frame.cc + dcp_video.cc dcpomatic_time.cc dolby_cp750.cc encoder.cc @@ -48,7 +48,7 @@ sources = """ log.cc md5_digester.cc player.cc - player_video_frame.cc + player_video.cc playlist.cc ratio.cc render_subtitles.cc diff --git a/src/tools/dcpomatic_server_cli.cc b/src/tools/dcpomatic_server_cli.cc index e4ac85f4c..c74e258e8 100644 --- a/src/tools/dcpomatic_server_cli.cc +++ b/src/tools/dcpomatic_server_cli.cc @@ -33,7 +33,7 @@ #include #include #include "lib/config.h" -#include "lib/dcp_video_frame.h" +#include "lib/dcp_video.h" #include "lib/exceptions.h" #include "lib/util.h" #include "lib/config.h" diff --git a/src/tools/server_test.cc b/src/tools/server_test.cc index 5997caab6..acafa4a81 100644 --- a/src/tools/server_test.cc +++ b/src/tools/server_test.cc @@ -27,14 +27,14 @@ #include "lib/util.h" #include "lib/scaler.h" #include "lib/server.h" -#include "lib/dcp_video_frame.h" +#include "lib/dcp_video.h" #include "lib/decoder.h" #include "lib/exceptions.h" #include "lib/scaler.h" #include "lib/log.h" #include "lib/video_decoder.h" #include "lib/player.h" -#include "lib/player_video_frame.h" +#include "lib/player_video.h" using std::cout; using std::cerr; @@ -48,10 +48,10 @@ static shared_ptr log_ (new FileLog ("servomatictest.log")); static int frame_count = 0; void -process_video (shared_ptr pvf) +process_video (shared_ptr pvf) { - shared_ptr local (new DCPVideoFrame (pvf, frame_count, film->video_frame_rate(), 250000000, RESOLUTION_2K, log_)); - shared_ptr remote (new DCPVideoFrame (pvf, frame_count, film->video_frame_rate(), 250000000, RESOLUTION_2K, log_)); + shared_ptr local (new DCPVideo (pvf, frame_count, film->video_frame_rate(), 250000000, RESOLUTION_2K, log_)); + shared_ptr remote (new DCPVideo (pvf, frame_count, film->video_frame_rate(), 250000000, RESOLUTION_2K, log_)); cout << "Frame " << frame_count << ": "; cout.flush (); diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc index d84a0af34..dd3d9ebe9 100644 --- a/src/wx/film_viewer.cc +++ b/src/wx/film_viewer.cc @@ -34,7 +34,7 @@ #include "lib/examine_content_job.h" #include "lib/filter.h" #include "lib/player.h" -#include "lib/player_video_frame.h" +#include "lib/player_video.h" #include "lib/video_content.h" #include "lib/video_decoder.h" #include "lib/timer.h" @@ -151,7 +151,7 @@ FilmViewer::get (DCPTime p, bool accurate) return; } - list > pvf = _player->get_video (p, accurate); + list > pvf = _player->get_video (p, accurate); if (!pvf.empty ()) { _frame = pvf.front()->image (); _frame = _frame->scale (_frame->size(), Scaler::from_id ("fastbilinear"), PIX_FMT_RGB24, false); diff --git a/src/wx/film_viewer.h b/src/wx/film_viewer.h index c1c087a14..189b379bf 100644 --- a/src/wx/film_viewer.h +++ b/src/wx/film_viewer.h @@ -28,7 +28,7 @@ class wxToggleButton; class FFmpegPlayer; class Image; class RGBPlusAlphaImage; -class PlayerVideoFrame; +class PlayerVideo; /** @class FilmViewer * @brief A wx widget to view a preview of a Film. diff --git a/test/client_server_test.cc b/test/client_server_test.cc index 51594a47a..eab84cc39 100644 --- a/test/client_server_test.cc +++ b/test/client_server_test.cc @@ -30,9 +30,9 @@ #include "lib/server.h" #include "lib/image.h" #include "lib/cross.h" -#include "lib/dcp_video_frame.h" +#include "lib/dcp_video.h" #include "lib/scaler.h" -#include "lib/player_video_frame.h" +#include "lib/player_video.h" #include "lib/image_proxy.h" using std::list; @@ -40,7 +40,7 @@ using boost::shared_ptr; using boost::thread; void -do_remote_encode (shared_ptr frame, ServerDescription description, shared_ptr locally_encoded) +do_remote_encode (shared_ptr frame, ServerDescription description, shared_ptr locally_encoded) { shared_ptr remotely_encoded; BOOST_CHECK_NO_THROW (remotely_encoded = frame->encode_remotely (description)); @@ -80,8 +80,8 @@ BOOST_AUTO_TEST_CASE (client_server_test_rgb) shared_ptr log (new FileLog ("build/test/client_server_test_rgb.log")); - shared_ptr pvf ( - new PlayerVideoFrame ( + shared_ptr pvf ( + new PlayerVideo ( shared_ptr (new RawImageProxy (image, log)), Crop (), dcp::Size (1998, 1080), @@ -95,8 +95,8 @@ BOOST_AUTO_TEST_CASE (client_server_test_rgb) pvf->set_subtitle (PositionImage (sub_image, Position (50, 60))); - shared_ptr frame ( - new DCPVideoFrame ( + shared_ptr frame ( + new DCPVideo ( pvf, 0, 24, @@ -161,8 +161,8 @@ BOOST_AUTO_TEST_CASE (client_server_test_yuv) shared_ptr log (new FileLog ("build/test/client_server_test_yuv.log")); - shared_ptr pvf ( - new PlayerVideoFrame ( + shared_ptr pvf ( + new PlayerVideo ( shared_ptr (new RawImageProxy (image, log)), Crop (), dcp::Size (1998, 1080), @@ -176,8 +176,8 @@ BOOST_AUTO_TEST_CASE (client_server_test_yuv) pvf->set_subtitle (PositionImage (sub_image, Position (50, 60))); - shared_ptr frame ( - new DCPVideoFrame ( + shared_ptr frame ( + new DCPVideo ( pvf, 0, 24, -- 2.30.2