Jpeg screengrab use VDR RgbToJpeg function.

This commit is contained in:
m.Rcu 2012-02-12 20:30:50 +01:00 committed by Johns
parent 0a2a221fa9
commit 33c638d538
4 changed files with 41 additions and 34 deletions

View File

@ -1,5 +1,10 @@
User m.Rcu
Date: Sun Feb 12 20:28:22 CET 2012
Jpeg screengrab use VDR RgbToJpeg function.
User johns User johns
Date: Date: Sun Feb 12 20:14:43 CET 2012
Add play/pause audio support. Add play/pause audio support.
Fix bug: audible glitch when switching AC-3 pass-through <-> none. Fix bug: audible glitch when switching AC-3 pass-through <-> none.

View File

@ -24,7 +24,6 @@ CONFIG += -DAV_INFO
CONFIG += $(shell pkg-config --exists vdpau && echo "-DUSE_VDPAU") CONFIG += $(shell pkg-config --exists vdpau && echo "-DUSE_VDPAU")
CONFIG += $(shell pkg-config --exists libva && echo "-DUSE_VAAPI") CONFIG += $(shell pkg-config --exists libva && echo "-DUSE_VAAPI")
CONFIG += $(shell pkg-config --exists alsa && echo "-DUSE_ALSA") CONFIG += $(shell pkg-config --exists alsa && echo "-DUSE_ALSA")
CONFIG += $(shell ls /usr/lib/libjpeg* >/dev/null 2>&1 && echo "-DUSE_JPEG")
CONFIG += -DUSE_OSS CONFIG += -DUSE_OSS
### The C++ compiler and options: ### The C++ compiler and options:
@ -32,7 +31,8 @@ CONFIG += -DUSE_OSS
CC ?= gcc CC ?= gcc
CXX ?= g++ CXX ?= g++
CFLAGS ?= -g -O2 -W -Wall -Wextra -Winit-self \ CFLAGS ?= -g -O2 -W -Wall -Wextra -Winit-self \
-Wdeclaration-after-statement -Wdeclaration-after-statement \
-ftree-vectorize -msse3 -flax-vector-conversions
CXXFLAGS ?= -g -O2 -W -Wall -Wextra -Woverloaded-virtual CXXFLAGS ?= -g -O2 -W -Wall -Wextra -Woverloaded-virtual
### The directory environment: ### The directory environment:
@ -91,9 +91,7 @@ LIBS += -lrt \
$(if $(findstring USE_VAAPI,$(CONFIG)), \ $(if $(findstring USE_VAAPI,$(CONFIG)), \
`pkg-config --libs libva-x11 libva-glx libva`) \ `pkg-config --libs libva-x11 libva-glx libva`) \
$(if $(findstring USE_ALSA,$(CONFIG)), \ $(if $(findstring USE_ALSA,$(CONFIG)), \
`pkg-config --libs alsa`) \ `pkg-config --libs alsa`)
$(if $(findstring USE_JPEG,$(CONFIG)), \
-ljpeg)
### The object files (add further files here): ### The object files (add further files here):

View File

@ -39,9 +39,6 @@
#define __USE_GNU #define __USE_GNU
#endif #endif
#include <pthread.h> #include <pthread.h>
#ifdef USE_JPEG
#include <jpeglib.h>
#endif
#include "misc.h" #include "misc.h"
#include "softhddev.h" #include "softhddev.h"
@ -1013,6 +1010,9 @@ int PlayVideo(const uint8_t * data, int size)
#endif #endif
} }
/// call VDR support function
extern uint8_t *CreateJpeg(uint8_t *, int *, int, int, int);
#if defined(USE_JPEG) && JPEG_LIB_VERSION >= 80 #if defined(USE_JPEG) && JPEG_LIB_VERSION >= 80
/** /**
@ -1079,21 +1079,15 @@ uint8_t *CreateJpeg(uint8_t * image, int raw_size, int *size, int quality,
uint8_t *GrabImage(int *size, int jpeg, int quality, int width, int height) uint8_t *GrabImage(int *size, int jpeg, int quality, int width, int height)
{ {
if (jpeg) { if (jpeg) {
#if defined(USE_JPEG) && JPEG_LIB_VERSION >= 80
int raw_size;
uint8_t *image;
uint8_t *jpg_image; uint8_t *jpg_image;
uint8_t *image;
int raw_size = 0;
raw_size = 0;
image = VideoGrab(&raw_size, &width, &height, 0); image = VideoGrab(&raw_size, &width, &height, 0);
jpg_image = CreateJpeg(image, raw_size, size, quality, width, height); jpg_image = CreateJpeg(image, size, quality, width, height);
free(image); free(image);
return jpg_image; return jpg_image;
#else
(void)quality;
Error(_("softhddev: jpeg grabbing not supported\n"));
return NULL;
#endif
} }
if (width != -1 && height != -1) { if (width != -1 && height != -1) {
Warning(_("softhddev: scaling unsupported\n")); Warning(_("softhddev: scaling unsupported\n"));

View File

@ -886,17 +886,17 @@ bool cSoftHdDevice::Flush(int timeout_ms)
** Sets the video display format to the given one (only useful if this ** Sets the video display format to the given one (only useful if this
** device has an MPEG decoder). ** device has an MPEG decoder).
** **
** @note FIXME: this function isn't called on the initial channel ** @note this function isn't called on the initial channel
*/ */
void cSoftHdDevice::SetVideoDisplayFormat( void cSoftHdDevice::SetVideoDisplayFormat(
eVideoDisplayFormat video_display_format) eVideoDisplayFormat video_display_format)
{ {
static int last = -1; static int last = -1;
cDevice::SetVideoDisplayFormat(video_display_format);
dsyslog("[softhddev]%s: %d\n", __FUNCTION__, video_display_format); dsyslog("[softhddev]%s: %d\n", __FUNCTION__, video_display_format);
cDevice::SetVideoDisplayFormat(video_display_format);
// called on every channel switch, no need to kill osd... // called on every channel switch, no need to kill osd...
if (last != video_display_format) { if (last != video_display_format) {
last = video_display_format; last = video_display_format;
@ -1033,6 +1033,16 @@ uchar *cSoftHdDevice::GrabImage(int &size, bool jpeg, int quality, int width,
return::GrabImage(&size, jpeg, quality, width, height); return::GrabImage(&size, jpeg, quality, width, height);
} }
/**
** Call rgb to jpeg for C Plugin.
*/
extern "C" uint8_t * CreateJpeg(uint8_t * image, int *size, int quality,
int width, int height)
{
return (uint8_t *) RgbToJpeg((uchar *) image, width, height, *size,
quality);
}
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// cPlugin // cPlugin
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////