summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--HISTORY4
-rw-r--r--LIESMICH9
-rw-r--r--Makefile21
-rw-r--r--README9
-rw-r--r--data.h1
-rw-r--r--exif.c4
-rw-r--r--liboutput/Makefile9
-rw-r--r--liboutput/encode.c36
-rw-r--r--liboutput/encode.h2
9 files changed, 76 insertions, 19 deletions
diff --git a/HISTORY b/HISTORY
index 72f5945..c1fd730 100644
--- a/HISTORY
+++ b/HISTORY
@@ -1,6 +1,10 @@
VDR Plugin 'image' Revision History
-----------------------------------
+2007-06-10
+- for build now 'pkg-config' needed
+- Use swscale to converting image (Thanks to Holger Brunn, for summit a patch)
+
2007-01-02
- Release Version 0.2.7
diff --git a/LIESMICH b/LIESMICH
index 8a72561..76056c0 100644
--- a/LIESMICH
+++ b/LIESMICH
@@ -22,7 +22,9 @@ Benötigt:
- das Plugin ist abhängig vom folgenden Paketen
+ ffmpeg (getestet mit ffmpeg-0.4.8/ffmpeg-0.4.9pre1/ffmpeg-cvs)
http://ffmpeg.sourceforge.net
- + libexif-0.6.13 (siehe unten, für Kompilieren ohne diese)
+ + Zum Kompilieren wird 'pkg-config' benötigt
+ http://pkgconfig.freedesktop.org/
+ + libexif-0.6.13 ... 0.6.15 (siehe unten, für Kompilieren ohne diese)
http://libexif.sourceforge.net/
+ zur Ausführung wird auch das Paket netpbm benötigt
http://netpbm.sourceforge.net/
@@ -65,6 +67,11 @@ wird noch das Paket "netpbm" benötigt.
$ make plugins FFMDIR=/usr/src/ffmpeg-cvs
+ Kompilieren ohne swscaler zur Bildconvertierung mittels ffmpeg
+ (WITHOUT_SWSCALER=1 verwendet img_convert, notwendig für ältere Versionen von ffmpeg)
+
+ $ make plugins WITHOUT_SWSCALER=1
+
Kompilieren ohne libexif ¹)
$ make plugins WITHOUT_LIBEXIF=1
diff --git a/Makefile b/Makefile
index 368b854..856b298 100644
--- a/Makefile
+++ b/Makefile
@@ -31,6 +31,7 @@
CXX ?= g++
CXXFLAGS ?= -fPIC -O2 -Wall -Woverloaded-virtual
+PKG-CONFIG ?= pkg-config
###############################################
###############################################
@@ -86,26 +87,26 @@ LIBS += liboutput/liboutput.a libimage/libimage.a
INCLUDES += -I$(VDRDIR)/include -I.
ifdef FFMDIR
-INCLUDES += -I$(FFMDIR)/libavcodec -I$(FFMDIR)/libavutil
-LIBS += -L$(FFMDIR)/libavcodec
+DEFINES += -DFFMDIR
+LIBS += -L$(FFMDIR)/libavcodec -lavcodec -lz
ifeq ($(LIBAVCODECVERSION),51)
LIBS += -L$(FFMDIR)/libavformat -L$(FFMDIR)/libavutil
LIBS += -lavformat -lavutil
endif
-endif
-
-LIBS += -lavcodec
-LIBS += -lz
-
-ifdef FFMDIR
-DEFINES += -DFFMDIR
+else
+ LIBS += $(shell $(PKG-CONFIG) --libs libavcodec)
endif
ifndef WITHOUT_LIBEXIF
- LIBS += -lexif
+ INCLUDES += $(shell $(PKG-CONFIG) --cflags libexif)
+ LIBS += $(shell $(PKG-CONFIG) --libs libexif)
DEFINES += -DHAVE_LIBEXIF
endif
+ifndef WITHOUT_SWSCALER
+ LIBS += $(shell $(PKG-CONFIG) --libs libswscale)
+endif
+
### The object files (add further files here):
OBJS = ${PLUGIN}.o i18n.o data.o menu.o data-image.o menu-image.o \
diff --git a/README b/README
index 99d1866..6ee0f67 100644
--- a/README
+++ b/README
@@ -22,7 +22,9 @@ Required:
- plugin depends follow packages
+ ffmpeg (tested with ffmpeg-0.4.8/ffmpeg-0.4.9pre1/ffmpeg-cvs)
http://ffmpeg.sourceforge.net
- + libexif-0.6.13 (see below for build without this)
+ + for build you need 'pkg-config'
+ http://pkgconfig.freedesktop.org/
+ + libexif-0.6.13 ... 0.6.15 (see below for build without this)
http://libexif.sourceforge.net/
+ for running your will need also package netpbm
http://netpbm.sourceforge.net/
@@ -65,6 +67,11 @@ need netpbm for image conversion.
$ make plugins FFMDIR=/usr/src/ffmpeg-cvs
+ compile without swscaler to convert images via ffmpeg
+ (WITHOUT_SWSCALER=1 use img_convert, needed for older versions from ffmpeg)
+
+ $ make plugins WITHOUT_SWSCALER=1
+
compile without libexif ¹)
$ make plugins WITHOUT_LIBEXIF=1
diff --git a/data.h b/data.h
index b6272bd..3e1d4b1 100644
--- a/data.h
+++ b/data.h
@@ -42,6 +42,7 @@ extern char *AddPath(const char *dir, const char *filename);
class cScanDir {
char *QuoteString(const char *str);
protected:
+ virtual ~cScanDir() {};
enum eScanType { stFile, stDir };
virtual void DoItem(cFileSource *src, const char *subdir, const char *name)=0;
public:
diff --git a/exif.c b/exif.c
index 6e80638..76413f7 100644
--- a/exif.c
+++ b/exif.c
@@ -1,7 +1,7 @@
/*
* Image plugin to VDR (C++)
*
- * (C) 2006 Andreas Brachold <anbr at users.berlios.de>
+ * (C) 2006-2007 Andreas Brachold <anbr at users.berlios.de>
*
* This code is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -19,9 +19,11 @@
* Or, point your browser to http://www.gnu.org/copyleft/gpl.html
*/
+extern "C" {
#include <libexif/exif-data.h>
#include <libexif/exif-ifd.h>
#include <libexif/exif-loader.h>
+}
#include <sstream>
diff --git a/liboutput/Makefile b/liboutput/Makefile
index 126cfc8..7300393 100644
--- a/liboutput/Makefile
+++ b/liboutput/Makefile
@@ -9,6 +9,7 @@ VDRDIR = ../../../..
CXX ?= g++
CXXFLAGS ?= -O0 -g -Wall -Woverloaded-virtual
+PKG-CONFIG ?= pkg-config
-include $(VDRDIR)/Make.config
@@ -18,12 +19,16 @@ CXXFLAGS ?= -O0 -g -Wall -Woverloaded-virtual
INCLUDES += -I$(VDRDIR)/include -I.
ifdef FFMDIR
INCLUDES += -I$(FFMDIR)/libavcodec -I$(FFMDIR)/libavutil
+DEFINES += -DFFMDIR
+else
+ INCLUDES += $(shell $(PKG-CONFIG) --cflags libavcodec)
endif
DEFINES += -D_GNU_SOURCE
-ifdef FFMDIR
-DEFINES += -DFFMDIR
+ifndef WITHOUT_SWSCALER
+ DEFINES += -DHAVE_SWSCALER
+ INCLUDES += $(shell $(PKG-CONFIG) --cflags libswscale)
endif
### The object files (add further files here):
diff --git a/liboutput/encode.c b/liboutput/encode.c
index 67d78f7..ae8bff6 100644
--- a/liboutput/encode.c
+++ b/liboutput/encode.c
@@ -1,7 +1,7 @@
/***************************************************************************
* encode.c
*
- * (C) Copyright 2004-2006 Andreas Brachold <anbr at users.berlios.de>
+ * (C) Copyright 2004-2007 Andreas Brachold <anbr at users.berlios.de>
* Created: Thu Aug 5 2004
*
****************************************************************************/
@@ -26,6 +26,16 @@
#include <string.h>
#include <stdlib.h>
+extern "C" {
+#ifdef HAVE_SWSCALER
+#ifdef FFMDIR
+#include <swscale.h>
+#else
+#include <ffmpeg/swscale.h>
+#endif
+#endif
+}
+
#include "encode.h"
#include <vdr/device.h>
#include <vdr/tools.h>
@@ -190,11 +200,29 @@ bool cEncode::ConvertImageToFrame(AVFrame *frame)
}
else
{
- if(img_convert((AVPicture*)frame->data, PIX_FMT_YUV420P,
+ int result;
+#ifndef HAVE_SWSCALER
+ result=img_convert((AVPicture*)frame->data, PIX_FMT_YUV420P,
(AVPicture*)m_pImageFilled, PIX_FMT_RGB24,
- m_nWidth, m_nHeight))
+ m_nWidth, m_nHeight);
+#else
+ SwsContext* convert_ctx = sws_getContext(m_nWidth, m_nHeight,
+ PIX_FMT_RGB24, m_nWidth, m_nHeight,
+ PIX_FMT_YUV420P, SWS_BICUBIC, NULL, NULL, NULL);
+
+ if(!convert_ctx) {
+ esyslog("imageplugin: failed to initialize swscaler context");
+ return false;
+ }
+
+ result=sws_scale(convert_ctx, ((AVPicture*)m_pImageFilled)->data,
+ ((AVPicture*)m_pImageFilled)->linesize,
+ 0, m_nHeight, frame->data, frame->linesize);
+ sws_freeContext(convert_ctx);
+#endif
+ if(result < 0)
{
- esyslog("imageplugin: failed convert RGB to YUV");
+ esyslog("imageplugin: failed convert RGB to YUV: %X", result);
return false;
}
}
diff --git a/liboutput/encode.h b/liboutput/encode.h
index 805e279..77437fe 100644
--- a/liboutput/encode.h
+++ b/liboutput/encode.h
@@ -25,11 +25,13 @@
#ifndef _ENCODE_H
#define _ENCODE_H
+extern "C" {
#ifdef FFMDIR
#include <avcodec.h>
#else
#include <ffmpeg/avcodec.h>
#endif
+}
#include "../setup-image.h"
//#define TESTCODE