diff options
Diffstat (limited to 'dxr3device.c')
-rw-r--r-- | dxr3device.c | 65 |
1 files changed, 0 insertions, 65 deletions
diff --git a/dxr3device.c b/dxr3device.c index eda81fc..7981ddb 100644 --- a/dxr3device.c +++ b/dxr3device.c @@ -360,71 +360,6 @@ void cDxr3Device::PlayAudio(const uchar *Data, int Length) } // addition functions -// ================================== -//! capture a single frame as an image -bool cDxr3Device::GrabImage(const char *FileName, bool Jpeg, int Quality, - int SizeX, int SizeY) -{ - int w = SizeX; - int h = SizeY; - unsigned char *Data = new unsigned char[w * h * 3]; - memset(Data, 0, w * h * 3); - - // we could get a I-Frame and save it - //m_DemuxDevice.StillPicture(Data, 100 * 1024); - - isyslog("grabbing to %s (%s %d %d %d)", - FileName, Jpeg ? "JPEG" : "PNM", Quality, w, h); - FILE *f = fopen(FileName, "wb"); - if (f) - { - if (Jpeg) - { - ///< write JPEG file: - struct jpeg_compress_struct cinfo; - struct jpeg_error_mgr jerr; - cinfo.err = jpeg_std_error(&jerr); - jpeg_create_compress(&cinfo); - jpeg_stdio_dest(&cinfo, f); - cinfo.image_width = w; - cinfo.image_height = h; - cinfo.input_components = 3; - cinfo.in_color_space = JCS_RGB; - - jpeg_set_defaults(&cinfo); - jpeg_set_quality(&cinfo, Quality, true); - jpeg_start_compress(&cinfo, true); - - int rs = w * 3; - JSAMPROW rp[h]; - for (int k = 0; k < h; k++) - { - rp[k] = &Data[rs * k]; - } - jpeg_write_scanlines(&cinfo, rp, h); - jpeg_finish_compress(&cinfo); - jpeg_destroy_compress(&cinfo); - - } - else - { - ///< write PNM file: - if (fprintf(f, "P6\n%d\n%d\n255\n", w, h) < 0 || - fwrite(Data, w * h * 3, 1, f) != 1) - { - LOG_ERROR_STR(FileName); - } - } - fclose(f); - } - else - { - return false; - } - - delete Data; - return true; -} // ================================== void cDxr3Device::SetVideoFormat(bool VideoFormat16_9) |