diff options
author | mio <[email protected]> | 2024-08-22 16:33:37 +1000 |
---|---|---|
committer | mio <[email protected]> | 2024-08-22 16:33:37 +1000 |
commit | 5e965846d17f7053dca99f3366ce5d8f21e8f649 (patch) | |
tree | 1cfad870d7b96aa11c7db7dac8423ad734977da2 | |
parent | 54d1a665f806a745810670c3ef10695d4f7ad28a (diff) | |
download | codeine-5e965846d17f7053dca99f3366ce5d8f21e8f649.tar.gz codeine-5e965846d17f7053dca99f3366ce5d8f21e8f649.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 <[email protected]>
-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; |