From 8f7d0cf115980cb357bc3da410842503930e66b8 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 14 May 2014 10:05:56 +0100 Subject: Rename PlayerImage to PlayerVideoFrame and give it its own file. --- src/lib/transcoder.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/lib/transcoder.cc') diff --git a/src/lib/transcoder.cc b/src/lib/transcoder.cc index 1c8f7e3eb..cd729fc22 100644 --- a/src/lib/transcoder.cc +++ b/src/lib/transcoder.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2012 Carl Hetherington + Copyright (C) 2012-2014 Carl Hetherington 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 @@ -40,7 +40,7 @@ using boost::weak_ptr; using boost::dynamic_pointer_cast; static void -video_proxy (weak_ptr encoder, shared_ptr image, Eyes eyes, ColourConversion conversion, bool same) +video_proxy (weak_ptr encoder, shared_ptr image, Eyes eyes, ColourConversion conversion, bool same) { shared_ptr e = encoder.lock (); if (e) { -- cgit v1.2.3 From 5c09a82e483593fb37da0cad20679be735887613 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 14 May 2014 11:27:17 +0100 Subject: Move Eyes and ColourConversion into PlayerVideoFrame. --- src/lib/encoder.cc | 16 ++++++++-------- src/lib/encoder.h | 6 +++--- src/lib/player.cc | 12 ++++++++---- src/lib/player.h | 8 +++----- src/lib/player_video_frame.cc | 6 +++++- src/lib/player_video_frame.h | 13 ++++++++++++- src/lib/transcoder.cc | 6 +++--- src/tools/server_test.cc | 8 ++++---- src/wx/film_viewer.cc | 8 ++++---- src/wx/film_viewer.h | 2 +- test/play_test.cc | 4 ++-- 11 files changed, 53 insertions(+), 36 deletions(-) (limited to 'src/lib/transcoder.cc') diff --git a/src/lib/encoder.cc b/src/lib/encoder.cc index bb2fe6822..8ae402797 100644 --- a/src/lib/encoder.cc +++ b/src/lib/encoder.cc @@ -180,7 +180,7 @@ Encoder::frame_done () } void -Encoder::process_video (shared_ptr image, Eyes eyes, ColourConversion conversion, bool same) +Encoder::process_video (shared_ptr pvf, bool same) { _waker.nudge (); @@ -207,28 +207,28 @@ Encoder::process_video (shared_ptr image, Eyes eyes, ColourCon rethrow (); if (_writer->can_fake_write (_video_frames_out)) { - _writer->fake_write (_video_frames_out, eyes); - _have_a_real_frame[eyes] = false; + _writer->fake_write (_video_frames_out, pvf->eyes ()); + _have_a_real_frame[pvf->eyes()] = false; frame_done (); - } else if (same && _have_a_real_frame[eyes]) { + } else if (same && _have_a_real_frame[pvf->eyes()]) { /* Use the last frame that we encoded. */ - _writer->repeat (_video_frames_out, eyes); + _writer->repeat (_video_frames_out, pvf->eyes()); frame_done (); } else { /* Queue this new frame for encoding */ TIMING ("adding to queue of %1", _queue.size ()); _queue.push_back (shared_ptr ( new DCPVideoFrame ( - image->image(), _video_frames_out, eyes, conversion, _film->video_frame_rate(), + pvf->image(), _video_frames_out, pvf->eyes(), pvf->colour_conversion(), _film->video_frame_rate(), _film->j2k_bandwidth(), _film->resolution(), _film->log() ) )); _condition.notify_all (); - _have_a_real_frame[eyes] = true; + _have_a_real_frame[pvf->eyes()] = true; } - if (eyes != EYES_LEFT) { + if (pvf->eyes() != EYES_LEFT) { ++_video_frames_out; } } diff --git a/src/lib/encoder.h b/src/lib/encoder.h index 5cdda459d..a8ee220aa 100644 --- a/src/lib/encoder.h +++ b/src/lib/encoder.h @@ -67,10 +67,10 @@ public: void process_begin (); /** Call with a frame of video. - * @param i Video frame image. - * @param same true if i is the same as the last time we were called. + * @param pvf Video frame image. + * @param same true if pvf is the same as the last time we were called. */ - void process_video (boost::shared_ptr i, Eyes eyes, ColourConversion, bool same); + void process_video (boost::shared_ptr pvf, bool same); /** Call with some audio data */ void process_audio (boost::shared_ptr); diff --git a/src/lib/player.cc b/src/lib/player.cc index eb4a3d3a5..a50ab3a37 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -216,7 +216,9 @@ Player::process_video (weak_ptr weak_piece, shared_ptr image content->crop(), image_size, _video_container_size, - _film->scaler() + _film->scaler(), + eyes, + content->colour_conversion() ) ); @@ -252,7 +254,7 @@ Player::process_video (weak_ptr weak_piece, shared_ptr image _last_video = piece->content; #endif - Video (pi, eyes, content->colour_conversion(), same, time); + Video (pi, same, time); _last_emit_was_black = false; _video_position = piece->video_position = (time + TIME_HZ / _film->video_frame_rate()); @@ -525,7 +527,9 @@ Player::set_video_container_size (libdcp::Size s) Crop(), _video_container_size, _video_container_size, - Scaler::from_id ("bicubic") + Scaler::from_id ("bicubic"), + EYES_BOTH, + ColourConversion () ) ); } @@ -560,7 +564,7 @@ Player::emit_black () _last_video.reset (); #endif - Video (_black_frame, EYES_BOTH, ColourConversion(), _last_emit_was_black, _video_position); + Video (_black_frame, _last_emit_was_black, _video_position); _video_position += _film->video_frames_to_time (1); _last_emit_was_black = true; } diff --git a/src/lib/player.h b/src/lib/player.h index 8f7d9a218..eddd8f6a2 100644 --- a/src/lib/player.h +++ b/src/lib/player.h @@ -65,12 +65,10 @@ public: /** Emitted when a video frame is ready. * First parameter is the video image. - * Second parameter is the eye(s) that should see this image. - * Third parameter is the colour conversion that should be used for this image. - * Fourth parameter is true if the image is the same as the last one that was emitted. - * Fifth parameter is the time. + * Second parameter is true if the frame is the same as the last one that was emitted. + * Third parameter is the time. */ - boost::signals2::signal, Eyes, ColourConversion, bool, Time)> Video; + boost::signals2::signal, bool, Time)> Video; /** Emitted when some audio data is ready */ boost::signals2::signal, Time)> Audio; diff --git a/src/lib/player_video_frame.cc b/src/lib/player_video_frame.cc index 1c456a253..571c18b6e 100644 --- a/src/lib/player_video_frame.cc +++ b/src/lib/player_video_frame.cc @@ -27,13 +27,17 @@ PlayerVideoFrame::PlayerVideoFrame ( Crop crop, libdcp::Size inter_size, libdcp::Size out_size, - Scaler const * scaler + Scaler const * scaler, + Eyes eyes, + ColourConversion colour_conversion ) : _in (in) , _crop (crop) , _inter_size (inter_size) , _out_size (out_size) , _scaler (scaler) + , _eyes (eyes) + , _colour_conversion (colour_conversion) { } diff --git a/src/lib/player_video_frame.h b/src/lib/player_video_frame.h index 51ec7664f..42d345c9a 100644 --- a/src/lib/player_video_frame.h +++ b/src/lib/player_video_frame.h @@ -20,6 +20,7 @@ #include #include "types.h" #include "position.h" +#include "colour_conversion.h" class Image; class Scaler; @@ -31,18 +32,28 @@ class Scaler; class PlayerVideoFrame { public: - PlayerVideoFrame (boost::shared_ptr, Crop, libdcp::Size, libdcp::Size, Scaler const *); + PlayerVideoFrame (boost::shared_ptr, Crop, libdcp::Size, libdcp::Size, Scaler const *, Eyes, ColourConversion); void set_subtitle (boost::shared_ptr, Position); boost::shared_ptr image (); + Eyes eyes () const { + return _eyes; + } + + ColourConversion colour_conversion () const { + return _colour_conversion; + } + private: boost::shared_ptr _in; Crop _crop; libdcp::Size _inter_size; libdcp::Size _out_size; Scaler const * _scaler; + Eyes _eyes; + ColourConversion _colour_conversion; boost::shared_ptr _subtitle_image; Position _subtitle_position; }; diff --git a/src/lib/transcoder.cc b/src/lib/transcoder.cc index cd729fc22..b11ce8be5 100644 --- a/src/lib/transcoder.cc +++ b/src/lib/transcoder.cc @@ -40,11 +40,11 @@ using boost::weak_ptr; using boost::dynamic_pointer_cast; static void -video_proxy (weak_ptr encoder, shared_ptr image, Eyes eyes, ColourConversion conversion, bool same) +video_proxy (weak_ptr encoder, shared_ptr pvf, bool same) { shared_ptr e = encoder.lock (); if (e) { - e->process_video (image, eyes, conversion, same); + e->process_video (pvf, same); } } @@ -66,7 +66,7 @@ Transcoder::Transcoder (shared_ptr f, shared_ptr j) , _encoder (new Encoder (f, j)) , _finishing (false) { - _player->Video.connect (bind (video_proxy, _encoder, _1, _2, _3, _4)); + _player->Video.connect (bind (video_proxy, _encoder, _1, _2)); _player->Audio.connect (bind (audio_proxy, _encoder, _1)); } diff --git a/src/tools/server_test.cc b/src/tools/server_test.cc index 48d817cfe..6a1e2fa41 100644 --- a/src/tools/server_test.cc +++ b/src/tools/server_test.cc @@ -48,10 +48,10 @@ static shared_ptr log_ (new FileLog ("servomatictest.log")); static int frame = 0; void -process_video (shared_ptr image, Eyes eyes, ColourConversion conversion, Time) +process_video (shared_ptr pvf) { - shared_ptr local (new DCPVideoFrame (image->image(), frame, eyes, conversion, film->video_frame_rate(), 250000000, RESOLUTION_2K, log_)); - shared_ptr remote (new DCPVideoFrame (image->image(), frame, eyes, conversion, film->video_frame_rate(), 250000000, RESOLUTION_2K, log_)); + shared_ptr local (new DCPVideoFrame (pvf->image(), frame, pvf->eyes(), pvf->colour_conversion(), film->video_frame_rate(), 250000000, RESOLUTION_2K, log_)); + shared_ptr remote (new DCPVideoFrame (pvf->image(), frame, pvf->eyes(), pvf->colour_conversion(), film->video_frame_rate(), 250000000, RESOLUTION_2K, log_)); cout << "Frame " << frame << ": "; cout.flush (); @@ -146,7 +146,7 @@ main (int argc, char* argv[]) shared_ptr player = film->make_player (); player->disable_audio (); - player->Video.connect (boost::bind (process_video, _1, _2, _3, _5)); + player->Video.connect (boost::bind (process_video, _1)); bool done = false; while (!done) { done = player->pass (); diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc index 79f46238c..ed1a2ce41 100644 --- a/src/wx/film_viewer.cc +++ b/src/wx/film_viewer.cc @@ -137,7 +137,7 @@ FilmViewer::set_film (shared_ptr f) } _player->disable_audio (); - _player->Video.connect (boost::bind (&FilmViewer::process_video, this, _1, _2, _5)); + _player->Video.connect (boost::bind (&FilmViewer::process_video, this, _1, _3)); _player->Changed.connect (boost::bind (&FilmViewer::player_changed, this, _1)); calculate_sizes (); @@ -289,13 +289,13 @@ FilmViewer::check_play_state () } void -FilmViewer::process_video (shared_ptr image, Eyes eyes, Time t) +FilmViewer::process_video (shared_ptr pvf, Time t) { - if (eyes == EYES_RIGHT) { + if (pvf->eyes() == EYES_RIGHT) { return; } - _frame = image->image (); + _frame = pvf->image (); _got_frame = true; set_position_text (t); diff --git a/src/wx/film_viewer.h b/src/wx/film_viewer.h index be8fd9f4e..1e5b6d34d 100644 --- a/src/wx/film_viewer.h +++ b/src/wx/film_viewer.h @@ -59,7 +59,7 @@ private: void slider_moved (); void play_clicked (); void timer (); - void process_video (boost::shared_ptr, Eyes, Time); + void process_video (boost::shared_ptr, Time); void calculate_sizes (); void check_play_state (); void fetch_current_frame_again (); diff --git a/test/play_test.cc b/test/play_test.cc index a0ad494d1..1ba2e7d88 100644 --- a/test/play_test.cc +++ b/test/play_test.cc @@ -44,10 +44,10 @@ public: PlayerWrapper (shared_ptr p) : _player (p) { - _player->Video.connect (bind (&PlayerWrapper::process_video, this, _1, _2, _5)); + _player->Video.connect (bind (&PlayerWrapper::process_video, this, _1, _3)); } - void process_video (shared_ptr i, bool, Time t) + void process_video (shared_ptr i, Time t) { Video v; v.content = _player->_last_video; -- cgit v1.2.3