summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormio <stigma@disroot.org>2024-08-22 20:57:37 +1000
committermio <stigma@disroot.org>2024-08-22 21:02:20 +1000
commitf0b65f432b2e602bd9a515bcc460bcd6790a4925 (patch)
treed00fc35e72b6d28964b05156d2f3ddf550c9b9dd
parenta41aeeed019e8e6277d19d87b1ea88eac6f740e9 (diff)
downloadkaffeine-f0b65f432b2e602bd9a515bcc460bcd6790a4925.tar.gz
kaffeine-f0b65f432b2e602bd9a515bcc460bcd6790a4925.zip
Use safer xine_get_current_frame_s
xine_get_current_frame was deprecated back in 2019 because it is "unsafe by design"[0]. The '_s' version was introduced in xine-lib 1.1.11, which was released in 2008, so there are no version checks. [0]: https://sourceforge.net/p/xine/xine-lib-1.2/ci/c1a154c1a89759a8d69a6895587085adf6868d50 Signed-off-by: mio <stigma@disroot.org>
-rw-r--r--kaffeine/src/player-parts/xine-part/kxinewidget.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/kaffeine/src/player-parts/xine-part/kxinewidget.cpp b/kaffeine/src/player-parts/xine-part/kxinewidget.cpp
index c6535e6..7361e19 100644
--- a/kaffeine/src/player-parts/xine-part/kxinewidget.cpp
+++ b/kaffeine/src/player-parts/xine-part/kxinewidget.cpp
@@ -3834,17 +3834,18 @@ void KXineWidget::getScreenshot(uchar*& rgb32BitData, int& videoWidth, int& vide
int width, height, ratio, format;
// double desired_ratio, image_ratio;
- if (!xine_get_current_frame(m_xineStream, &width, &height, &ratio, &format, NULL))
+ if (!xine_get_current_frame_s(m_xineStream, &width, &height, &ratio, &format, nullptr, nullptr))
return;
- yuv = new uint8_t[((width+8) * (height+1) * 2)];
+ int yuv_size = ((width + 8) * (height + 1)) * 2;
+ yuv = new uint8_t[yuv_size];
if (yuv == NULL)
{
errorOut("Not enough memory to make screenshot!");
return;
}
- xine_get_current_frame(m_xineStream, &width, &height, &ratio, &format, yuv);
+ xine_get_current_frame_s(m_xineStream, &width, &height, &ratio, &format, yuv, &yuv_size);
videoWidth = width;
videoHeight = height;