/*
- Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2014 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
#include "writer.h"
#include "server_finder.h"
#include "player.h"
+#include "player_video_frame.h"
#include "i18n.h"
}
void
-Encoder::process_video (shared_ptr<PlayerImage> image, Eyes eyes, ColourConversion conversion, bool same)
+Encoder::process_video (shared_ptr<PlayerVideoFrame> image, Eyes eyes, ColourConversion conversion, bool same)
{
_waker.nudge ();
/*
- Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2014 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
class Writer;
class Job;
class ServerFinder;
-class PlayerImage;
+class PlayerVideoFrame;
/** @class Encoder
* @brief Encoder to J2K and WAV for DCP.
* @param i Video frame image.
* @param same true if i is the same as the last time we were called.
*/
- void process_video (boost::shared_ptr<PlayerImage> i, Eyes eyes, ColourConversion, bool same);
+ void process_video (boost::shared_ptr<PlayerVideoFrame> i, Eyes eyes, ColourConversion, bool same);
/** Call with some audio data */
void process_audio (boost::shared_ptr<const AudioBuffers>);
#include "resampler.h"
#include "log.h"
#include "scaler.h"
+#include "player_video_frame.h"
using std::list;
using std::cout;
Time const time = content->position() + relative_time + extra - content->trim_start ();
libdcp::Size const image_size = content->scale().size (content, _video_container_size, _film->frame_size ());
- shared_ptr<PlayerImage> pi (
- new PlayerImage (
+ shared_ptr<PlayerVideoFrame> pi (
+ new PlayerVideoFrame (
image,
content->crop(),
image_size,
im->make_black ();
_black_frame.reset (
- new PlayerImage (
+ new PlayerVideoFrame (
im,
Crop(),
_video_container_size,
return true;
}
-
-PlayerImage::PlayerImage (
- shared_ptr<const Image> in,
- Crop crop,
- libdcp::Size inter_size,
- libdcp::Size out_size,
- Scaler const * scaler
- )
- : _in (in)
- , _crop (crop)
- , _inter_size (inter_size)
- , _out_size (out_size)
- , _scaler (scaler)
-{
-
-}
-
-void
-PlayerImage::set_subtitle (shared_ptr<const Image> image, Position<int> pos)
-{
- _subtitle_image = image;
- _subtitle_position = pos;
-}
-
-shared_ptr<Image>
-PlayerImage::image ()
-{
- shared_ptr<Image> out = _in->crop_scale_window (_crop, _inter_size, _out_size, _scaler, PIX_FMT_RGB24, false);
-
- Position<int> const container_offset ((_out_size.width - _inter_size.width) / 2, (_out_size.height - _inter_size.width) / 2);
-
- if (_subtitle_image) {
- out->alpha_blend (_subtitle_image, _subtitle_position);
- }
-
- return out;
-}
class Piece;
class Image;
class Resampler;
-
-/** A wrapper for an Image which contains some pending operations; these may
- * not be necessary if the receiver of the PlayerImage throws it away.
- */
-class PlayerImage
-{
-public:
- PlayerImage (boost::shared_ptr<const Image>, Crop, libdcp::Size, libdcp::Size, Scaler const *);
-
- void set_subtitle (boost::shared_ptr<const Image>, Position<int>);
-
- boost::shared_ptr<Image> image ();
-
-private:
- boost::shared_ptr<const Image> _in;
- Crop _crop;
- libdcp::Size _inter_size;
- libdcp::Size _out_size;
- Scaler const * _scaler;
- boost::shared_ptr<const Image> _subtitle_image;
- Position<int> _subtitle_position;
-};
+class PlayerVideoFrame;
/** @class Player
* @brief A class which can `play' a Playlist; emitting its audio and video.
* Fourth parameter is true if the image is the same as the last one that was emitted.
* Fifth parameter is the time.
*/
- boost::signals2::signal<void (boost::shared_ptr<PlayerImage>, Eyes, ColourConversion, bool, Time)> Video;
+ boost::signals2::signal<void (boost::shared_ptr<PlayerVideoFrame>, Eyes, ColourConversion, bool, Time)> Video;
/** Emitted when some audio data is ready */
boost::signals2::signal<void (boost::shared_ptr<const AudioBuffers>, Time)> Audio;
AudioMerger<Time, AudioContent::Frame> _audio_merger;
libdcp::Size _video_container_size;
- boost::shared_ptr<PlayerImage> _black_frame;
+ boost::shared_ptr<PlayerVideoFrame> _black_frame;
std::map<boost::shared_ptr<AudioContent>, boost::shared_ptr<Resampler> > _resamplers;
std::list<Subtitle> _subtitles;
--- /dev/null
+/*
+ Copyright (C) 2013-2014 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_video_frame.h"
+#include "image.h"
+
+using boost::shared_ptr;
+
+PlayerVideoFrame::PlayerVideoFrame (
+ shared_ptr<const Image> in,
+ Crop crop,
+ libdcp::Size inter_size,
+ libdcp::Size out_size,
+ Scaler const * scaler
+ )
+ : _in (in)
+ , _crop (crop)
+ , _inter_size (inter_size)
+ , _out_size (out_size)
+ , _scaler (scaler)
+{
+
+}
+
+void
+PlayerVideoFrame::set_subtitle (shared_ptr<const Image> image, Position<int> pos)
+{
+ _subtitle_image = image;
+ _subtitle_position = pos;
+}
+
+shared_ptr<Image>
+PlayerVideoFrame::image ()
+{
+ shared_ptr<Image> out = _in->crop_scale_window (_crop, _inter_size, _out_size, _scaler, PIX_FMT_RGB24, false);
+
+ Position<int> const container_offset ((_out_size.width - _inter_size.width) / 2, (_out_size.height - _inter_size.width) / 2);
+
+ if (_subtitle_image) {
+ out->alpha_blend (_subtitle_image, _subtitle_position);
+ }
+
+ return out;
+}
--- /dev/null
+/*
+ Copyright (C) 2013-2014 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/shared_ptr.hpp>
+#include "types.h"
+#include "position.h"
+
+class Image;
+class Scaler;
+
+/** Everything needed to describe a video frame coming out of the player, but with the
+ * 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
+{
+public:
+ PlayerVideoFrame (boost::shared_ptr<const Image>, Crop, libdcp::Size, libdcp::Size, Scaler const *);
+
+ void set_subtitle (boost::shared_ptr<const Image>, Position<int>);
+
+ boost::shared_ptr<Image> image ();
+
+private:
+ boost::shared_ptr<const Image> _in;
+ Crop _crop;
+ libdcp::Size _inter_size;
+ libdcp::Size _out_size;
+ Scaler const * _scaler;
+ boost::shared_ptr<const Image> _subtitle_image;
+ Position<int> _subtitle_position;
+};
/*
- Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2014 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
using boost::dynamic_pointer_cast;
static void
-video_proxy (weak_ptr<Encoder> encoder, shared_ptr<PlayerImage> image, Eyes eyes, ColourConversion conversion, bool same)
+video_proxy (weak_ptr<Encoder> encoder, shared_ptr<PlayerVideoFrame> image, Eyes eyes, ColourConversion conversion, bool same)
{
shared_ptr<Encoder> e = encoder.lock ();
if (e) {
log.cc
piece.cc
player.cc
+ player_video_frame.cc
playlist.cc
ratio.cc
resampler.cc
#include "lib/log.h"
#include "lib/video_decoder.h"
#include "lib/player.h"
+#include "lib/player_video_frame.h"
using std::cout;
using std::cerr;
static int frame = 0;
void
-process_video (shared_ptr<PlayerImage> image, Eyes eyes, ColourConversion conversion, Time)
+process_video (shared_ptr<PlayerVideoFrame> image, Eyes eyes, ColourConversion conversion, Time)
{
shared_ptr<DCPVideoFrame> local (new DCPVideoFrame (image->image(), frame, eyes, conversion, film->video_frame_rate(), 250000000, RESOLUTION_2K, log_));
shared_ptr<DCPVideoFrame> remote (new DCPVideoFrame (image->image(), frame, eyes, conversion, film->video_frame_rate(), 250000000, RESOLUTION_2K, log_));
#include "lib/examine_content_job.h"
#include "lib/filter.h"
#include "lib/player.h"
+#include "lib/player_video_frame.h"
#include "lib/video_content.h"
#include "lib/video_decoder.h"
#include "film_viewer.h"
}
void
-FilmViewer::process_video (shared_ptr<PlayerImage> image, Eyes eyes, Time t)
+FilmViewer::process_video (shared_ptr<PlayerVideoFrame> image, Eyes eyes, Time t)
{
if (eyes == EYES_RIGHT) {
return;
class FFmpegPlayer;
class Image;
class RGBPlusAlphaImage;
-class PlayerImage;
+class PlayerVideoFrame;
/** @class FilmViewer
* @brief A wx widget to view a preview of a Film.
void slider_moved ();
void play_clicked ();
void timer ();
- void process_video (boost::shared_ptr<PlayerImage>, Eyes, Time);
+ void process_video (boost::shared_ptr<PlayerVideoFrame>, Eyes, Time);
void calculate_sizes ();
void check_play_state ();
void fetch_current_frame_again ();
/*
- Copyright (C) 2013 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2013-2014 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
#include "lib/player.h"
#include "lib/ratio.h"
#include "lib/dcp_content_type.h"
+#include "lib/player_video_frame.h"
#include "test.h"
/* This test needs stuff in Player that is only included in debug mode */
_player->Video.connect (bind (&PlayerWrapper::process_video, this, _1, _2, _5));
}
- void process_video (shared_ptr<PlayerImage> i, bool, Time t)
+ void process_video (shared_ptr<PlayerVideoFrame> i, bool, Time t)
{
Video v;
v.content = _player->_last_video;