summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2021-09-11 18:52:05 +0200
committerCarl Hetherington <cth@carlh.net>2021-09-27 13:41:46 +0200
commit7245e46453a82886739a45bd78fcdf9e8401367c (patch)
treed8f8b3d420eecfc958ac78df40c26f77d34f47d3 /src/lib
parente9ae050b0b15c91c3f591ad84938e60d271357b3 (diff)
When the player is used in OpenGL mode, pass unscaled XYZ data through to the shader and do colourspace conversion there.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/butler.cc2
-rw-r--r--src/lib/butler.h11
-rw-r--r--src/lib/j2k_image_proxy.cc2
-rw-r--r--src/lib/player_video.cc12
-rw-r--r--src/lib/player_video.h3
5 files changed, 25 insertions, 5 deletions
diff --git a/src/lib/butler.cc b/src/lib/butler.cc
index 5a8e646aa..cbd5ba15d 100644
--- a/src/lib/butler.cc
+++ b/src/lib/butler.cc
@@ -323,7 +323,7 @@ try
/* If the weak_ptr cannot be locked the video obviously no longer requires any work */
if (video) {
LOG_TIMING("start-prepare in %1", thread_id());
- video->prepare (_pixel_format, _video_range, _aligned, _fast);
+ video->prepare (_pixel_format, _video_range, _aligned, _fast, _prepare_only_proxy);
LOG_TIMING("finish-prepare in %1", thread_id());
}
}
diff --git a/src/lib/butler.h b/src/lib/butler.h
index a231fd099..d31442f6c 100644
--- a/src/lib/butler.h
+++ b/src/lib/butler.h
@@ -80,6 +80,9 @@ public:
boost::optional<TextRingBuffers::Data> get_closed_caption ();
void disable_audio ();
+ void set_prepare_only_proxy (bool p) {
+ _prepare_only_proxy = p;
+ }
std::pair<size_t, std::string> memory_used () const;
@@ -127,6 +130,14 @@ private:
bool _aligned;
bool _fast;
+ /** true to ask PlayerVideo::prepare to only prepare the ImageProxy and not also
+ * the final image. We want to do this when the viewer is intending to call
+ * PlayerVideo::raw_image() and do the things in PlayerVideo::make_imgae() itself:
+ * this is the case for the GLVideoView which can do scale, pixfmt conversion etc.
+ * in the shader.
+ */
+ bool _prepare_only_proxy = false;
+
/** If we are waiting to be refilled following a seek, this is the time we were
seeking to.
*/
diff --git a/src/lib/j2k_image_proxy.cc b/src/lib/j2k_image_proxy.cc
index 144da396d..c98273ad2 100644
--- a/src/lib/j2k_image_proxy.cc
+++ b/src/lib/j2k_image_proxy.cc
@@ -145,7 +145,7 @@ J2KImageProxy::prepare (optional<dcp::Size> target_size) const
try {
/* XXX: should check that potentially trashing _data here doesn't matter */
auto decompressed = dcp::decompress_j2k (const_cast<uint8_t*>(_data->data()), _data->size(), reduce);
- _image.reset (new Image (_pixel_format, decompressed->size(), true));
+ _image.reset (new Image (_pixel_format, decompressed->size(), false));
int const shift = 16 - decompressed->precision (0);
diff --git a/src/lib/player_video.cc b/src/lib/player_video.cc
index b0e75972c..0a6ce0d99 100644
--- a/src/lib/player_video.cc
+++ b/src/lib/player_video.cc
@@ -121,6 +121,14 @@ PlayerVideo::image (function<AVPixelFormat (AVPixelFormat)> pixel_format, VideoR
return _image;
}
+
+shared_ptr<Image>
+PlayerVideo::raw_image () const
+{
+ return _in->image(_inter_size).image;
+}
+
+
/** Create an image for this frame. A lock must be held on _mutex.
* @param pixel_format Function which is called to decide what pixel format the output image should be;
* it is passed the pixel format of the input image from the ImageProxy, and should return the desired
@@ -290,11 +298,11 @@ PlayerVideo::keep_xyz_or_rgb (AVPixelFormat p)
}
void
-PlayerVideo::prepare (function<AVPixelFormat (AVPixelFormat)> pixel_format, VideoRange video_range, bool aligned, bool fast)
+PlayerVideo::prepare (function<AVPixelFormat (AVPixelFormat)> pixel_format, VideoRange video_range, bool aligned, bool fast, bool proxy_only)
{
_in->prepare (_inter_size);
boost::mutex::scoped_lock lm (_mutex);
- if (!_image) {
+ if (!_image && !proxy_only) {
make_image (pixel_format, video_range, aligned, fast);
}
}
diff --git a/src/lib/player_video.h b/src/lib/player_video.h
index f29684832..8134c8d4e 100644
--- a/src/lib/player_video.h
+++ b/src/lib/player_video.h
@@ -71,8 +71,9 @@ public:
void set_text (PositionImage);
- void prepare (std::function<AVPixelFormat (AVPixelFormat)> pixel_format, VideoRange video_range, bool aligned, bool fast);
+ void prepare (std::function<AVPixelFormat (AVPixelFormat)> pixel_format, VideoRange video_range, bool aligned, bool fast, bool proxy_only);
std::shared_ptr<Image> image (std::function<AVPixelFormat (AVPixelFormat)> pixel_format, VideoRange video_range, bool aligned, bool fast) const;
+ std::shared_ptr<Image> raw_image () const;
static AVPixelFormat force (AVPixelFormat, AVPixelFormat);
static AVPixelFormat keep_xyz_or_rgb (AVPixelFormat);