diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2005-12-29 14:51:59 +0100 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2005-12-29 14:51:59 +0100 |
commit | cb428520e6f5cb7f5e56f4ba06f54b1ce7b47c23 (patch) | |
tree | 5ff205432bb58eaeb831ac9a789559a2bdb7a42b /device.c | |
parent | 5f7df33b1cabf1366eb414de1ac650c406d01ae3 (diff) | |
download | vdr-cb428520e6f5cb7f5e56f4ba06f54b1ce7b47c23.tar.gz vdr-cb428520e6f5cb7f5e56f4ba06f54b1ce7b47c23.tar.bz2 |
cDevice::GrabImage() now returns a pointer to the image in memory; cDevice::GrabImageFile() grabs the image to a file
Diffstat (limited to 'device.c')
-rw-r--r-- | device.c | 33 |
1 files changed, 30 insertions, 3 deletions
@@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: device.c 1.112 2005/11/26 12:56:09 kls Exp $ + * $Id: device.c 1.113 2005/12/29 14:51:41 kls Exp $ */ #include "device.h" @@ -322,9 +322,36 @@ void cDevice::Shutdown(void) } } -bool cDevice::GrabImage(const char *FileName, bool Jpeg, int Quality, int SizeX, int SizeY) +uchar *cDevice::GrabImage(int &Size, bool Jpeg, int Quality, int SizeX, int SizeY) { - return false; + return NULL; +} + +bool cDevice::GrabImageFile(const char *FileName, bool Jpeg, int Quality, int SizeX, int SizeY) +{ + int result = 0; + FILE *f = fopen(FileName, "wb"); + if (f) { + int ImageSize; + uchar *Image = GrabImage(ImageSize, Jpeg, Quality, SizeX, SizeY); + if (Image) { + if (fwrite(Image, ImageSize, 1, f) == 1) + isyslog("grabbed image to %s", FileName); + else { + LOG_ERROR_STR(FileName); + result |= 1; + } + free(Image); + } + else + result |= 1; + fclose(f); + } + else { + LOG_ERROR_STR(FileName); + result |= 1; + } + return result == 0; } void cDevice::SetVideoDisplayFormat(eVideoDisplayFormat VideoDisplayFormat) |