summaryrefslogtreecommitdiffstats
path: root/src/app/captureFrame.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/app/captureFrame.cpp')
-rw-r--r--src/app/captureFrame.cpp21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/app/captureFrame.cpp b/src/app/captureFrame.cpp
index 41796b9..119e729 100644
--- a/src/app/captureFrame.cpp
+++ b/src/app/captureFrame.cpp
@@ -255,25 +255,30 @@ VideoWindow::captureFrame() const
return TQImage();
int yuv_size = ((w + 8) * (h + 1)) * 2;
- uint8_t *yuv = new uint8_t[yuv_size];
- if( yuv == 0 ) {
+ uint8_t *yuv = new(std::nothrow) uint8_t[yuv_size];
+ if (yuv == nullptr) {
Debug::error() << "Not enough memory to make screenframe!\n";
- return TQImage(); }
+ return TQImage();
+ }
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;
+ uint8_t *y = nullptr;
+ uint8_t *u = nullptr;
+ uint8_t *v = nullptr;
+
switch( format )
{
case XINE_IMGFMT_YUY2: {
uint8_t *yuy2 = yuv;
- yuv = new uint8_t[(w * h * 2)];
- if( yuv == 0 ) {
+ yuv = new(std::nothrow) uint8_t[(w * h * 2)];
+ if (yuv == nullptr) {
Debug::error() << "Not enough memory to make screenframe!\n";
delete [] yuy2;
- return TQImage(); }
+ return TQImage();
+ }
y = yuv;
u = yuv + w * h;
@@ -298,7 +303,7 @@ VideoWindow::captureFrame() const
// convert to rgb
uchar *rgb = yv12ToRgb( y, u, v, w, h );
- TQImage frame( rgb, w, h, 32, 0, 0, TQImage::IgnoreEndian );
+ TQImage frame( rgb, w, h, 32, nullptr, 0, TQImage::IgnoreEndian );
delete [] yuv;
return frame;