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]:
c1a154c1a8/

Signed-off-by: mio <stigma@disroot.org>
pull/16/head
mio 3 months ago
parent 54d1a665f8
commit 5e965846d1

@ -251,15 +251,16 @@ VideoWindow::captureFrame() const
DEBUG_BLOCK DEBUG_BLOCK
int ratio, format, w, h; 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(); 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 ) { if( yuv == 0 ) {
Debug::error() << "Not enough memory to make screenframe!\n"; Debug::error() << "Not enough memory to make screenframe!\n";
return TQImage(); } 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 // convert to yv12 if necessary
uint8_t *y = 0, *u = 0, *v = 0; uint8_t *y = 0, *u = 0, *v = 0;

Loading…
Cancel
Save