diff options
author | mio <stigma@disroot.org> | 2024-08-22 16:33:37 +1000 |
---|---|---|
committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2024-08-22 18:04:02 +0900 |
commit | 55214aea7cf8d37849d1566535a4f13eb04f2528 (patch) | |
tree | 4cfdf407a0ba2e3f31c539107db93a0ba6bc11ac | |
parent | 9cec7f890e878eb79345e9bf3c73552028d54900 (diff) | |
download | codeine-55214aea7cf8d37849d1566535a4f13eb04f2528.tar.gz codeine-55214aea7cf8d37849d1566535a4f13eb04f2528.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>
(cherry picked from commit 5e965846d17f7053dca99f3366ce5d8f21e8f649)
-rw-r--r-- | src/app/captureFrame.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/app/captureFrame.cpp b/src/app/captureFrame.cpp index 4988999..41796b9 100644 --- a/src/app/captureFrame.cpp +++ b/src/app/captureFrame.cpp @@ -251,15 +251,16 @@ VideoWindow::captureFrame() const DEBUG_BLOCK int ratio, format, w, h; - if( !xine_get_current_frame( *engine(), &w, &h, &ratio, &format, NULL ) ) + if (!xine_get_current_frame_s(*engine(), &w, &h, &ratio, &format, nullptr, nullptr)) return TQImage(); - uint8_t *yuv = new uint8_t[((w+8) * (h+1) * 2)]; + int yuv_size = ((w + 8) * (h + 1)) * 2; + uint8_t *yuv = new uint8_t[yuv_size]; if( yuv == 0 ) { Debug::error() << "Not enough memory to make screenframe!\n"; return TQImage(); } - xine_get_current_frame( *engine(), &w, &h, &ratio, &format, yuv ); + xine_get_current_frame_s(*engine(), &w, &h, &ratio, &format, yuv, &yuv_size); // convert to yv12 if necessary uint8_t *y = 0, *u = 0, *v = 0; |