summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Meyerholt <dxm523@googlemail.com>2011-02-06 16:30:01 +0100
committerDaniel Meyerholt <dxm523@googlemail.com>2011-02-06 16:30:01 +0100
commit1992d5222ff28d13269eb45187351bdef69e3bcd (patch)
tree0385aeee88ff45ab942455a1d7929462a048a838
parent7ced9f4f634a6123371076fd1fb9ac1d8ec9c0c8 (diff)
downloadvdr-plugin-vdrrip-1992d5222ff28d13269eb45187351bdef69e3bcd.tar.gz
vdr-plugin-vdrrip-1992d5222ff28d13269eb45187351bdef69e3bcd.tar.bz2
* patches by Thomas Günther <tom@toms-cafe.de> (stolen from e-tobi deb):
- maketempdir patch to create temporary directory - greppid2 patch to detect second running process instead of third - fix ogm/ac3 vdrsync 0.1.2.2dev1 creates bd.mpa, not bd.ac3 when demuxing - preserve owner of queue.vdrrip in queuehandler.sh - fix identification of aspect ratio (http://vdrportal.de/board/thread.php?threadid=53225 and http://vdrportal.de/board/thread.php?threadid=58775) - change VDRVERSION define to APIVERSION in Makefile - fix some menus for vdr>=1.3.7 (from user norad at vdrportal.de and thomas) * patch by Herbert Attenberger <herbsl at a-land.de> and user micmac at vdrportal.de to change dvd-parameter to -dvd if the mencoder-version is 0.XX (stolen from e-tobi deb) * patch by Stefan Wagner to change mencoder parameters when detecting cropping (stolen from e-tobi deb) * patches by Tobias Grimm <etobi@debian.org> (stolen from e-tobi deb) - use libdvdread's NEW_IFO_READ functions - fix compilation for gcc4.4
-rwxr-xr-xMakefile11
-rwxr-xr-xa-tools.c2
-rwxr-xr-xmenu-vdrrip.c106
-rwxr-xr-xmenu-vdrrip.h11
-rwxr-xr-xmovie.c34
-rwxr-xr-xscripts/queuehandler.sh42
-rwxr-xr-xvdrrip.c8
7 files changed, 195 insertions, 19 deletions
diff --git a/Makefile b/Makefile
index 83f9308..e69ef9d 100755
--- a/Makefile
+++ b/Makefile
@@ -34,7 +34,7 @@ TMPDIR = /tmp
### The version number of VDR (taken from VDR's "config.h"):
-VDRVERSION = $(shell grep 'define VDRVERSION ' $(VDRDIR)/config.h | awk '{ print $$3 }' | sed -e 's/"//g')
+APIVERSION = $(shell grep 'define APIVERSION ' $(VDRDIR)/config.h | awk '{ print $$3 }' | sed -e 's/"//g')
### The name of the distribution archive:
@@ -45,7 +45,12 @@ PACKAGE = vdr-$(ARCHIVE)
INCLUDES += -I$(VDRDIR)/include -I$(DVBDIR)/include
-DEFINES += -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"$(PLUGIN)"'
+DEFINES += -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"$(PLUGIN)"' -D__STDC_LIMIT_MACROS
+
+NEW_IFO_READ := $(wildcard /usr/include/dvdread/ifo_read.h)
+ifneq ($(strip $(NEW_IFO_READ)),)
+ DEFINES += -DNEW_IFO_READ
+endif
### The object files (add further files here):
@@ -77,7 +82,7 @@ all: libvdr-$(PLUGIN).so
libvdr-$(PLUGIN).so: $(OBJS)
$(CXX) $(CXXFLAGS) -shared $(OBJS) $(LIBS) -o $@
- @cp $@ $(LIBDIR)/$@.$(VDRVERSION)
+ @cp $@ $(LIBDIR)/$@.$(APIVERSION)
dist: clean
@-rm -rf $(TMPDIR)/$(ARCHIVE)
diff --git a/a-tools.c b/a-tools.c
index e8d36b5..dd77777 100755
--- a/a-tools.c
+++ b/a-tools.c
@@ -70,7 +70,7 @@ char *strcol(char *s, char *d, int c) {
}
int strnumcol(const char *s, char *d) {
- char *s1;
+ const char *s1;
int i, l;
// let's do some checks:
diff --git a/menu-vdrrip.c b/menu-vdrrip.c
index 356ddba..861469b 100755
--- a/menu-vdrrip.c
+++ b/menu-vdrrip.c
@@ -4,9 +4,19 @@
#include <vdr/plugin.h>
#include <vdr/videodir.h>
+#if VDRVERSNUM >= 10307
+#include <vdr/interface.h>
+#include <vdr/status.h>
+#endif
#ifdef VDRRIP_DVD
+#ifdef NEW_IFO_READ
+ #include <stdint.h>
+ #include <dvdread/ifo_read.h>
+ #include <dvdread/ifo_types.h>
+#else
#include <dvdnav/ifo_read.h>
+#endif
#endif //VDRRIP_DVD
#include "menu-vdrrip.h"
@@ -92,14 +102,22 @@ eOSState cMenuVdrrip::ProcessKey(eKeys Key) {
# ifdef VDRRIP_DVD
cMenuVdrripWarning::cMenuVdrripWarning(const char *Title, const char *Text)
+#if VDRVERSNUM >= 10307
+:cMenuText(Title, "")
+#else
:cOsdMenu(Title)
+#endif
{
bool warning;
warning = true;
//warning = false;
if (warning) {
+#if VDRVERSNUM >= 10307
+ SetText(Text);
+#else
Add(new cMenuTextItem(Text, 1, 2, Setup.OSDwidth - 2, MAXOSDITEMS, clrWhite, clrBackground, fontOsd));
+#endif
SetHelp(tr("back"), tr("accept"), NULL, NULL);
hadsubmenu = false;
} else {
@@ -120,6 +138,22 @@ eOSState cMenuVdrripWarning::ProcessKey(eKeys Key)
if (hadsubmenu) {return osBack;}
switch (Key) {
+#if VDRVERSNUM >= 10307
+ // cMenuText::ProcessKey don't handle submenus
+ case kUp|k_Repeat:
+ case kUp:
+ case kDown|k_Repeat:
+ case kDown:
+ case kLeft|k_Repeat:
+ case kLeft:
+ case kRight|k_Repeat:
+ case kRight:
+ DisplayMenu()->Scroll(NORMALKEY(Key) == kUp || NORMALKEY(Key) == kLeft,
+ NORMALKEY(Key) == kLeft || NORMALKEY(Key) == kRight);
+ cStatus::MsgOsdTextItem(NULL, NORMALKEY(Key) == kUp);
+ return osContinue;
+#endif
+
case kRed: return osBack;
case kGreen: {
@@ -138,13 +172,22 @@ bool cMenuVdrripWarning::CheckDVD() {
ifo_handle_t *ifo_zero = NULL;
ifo_handle_t *ifo_tmp = NULL;
+#if VDRVERSNUM >= 10307
+ Skins.Message(mtStatus, tr("checking dvd..."));
+ Skins.Flush();
+#else
Interface->Status(tr("checking dvd..."));
Interface->Flush();
+#endif
if (access(DVD, R_OK) == -1) {
char *s = NULL;
asprintf(&s, "No read privileges on %s !", DVD);
+#if VDRVERSNUM >= 10307
+ Skins.Message(mtError, s);
+#else
Interface->Error(s);
+#endif
FREE(s);
return false;
}
@@ -160,7 +203,11 @@ bool cMenuVdrripWarning::CheckDVD() {
else {
char *s = NULL;
asprintf(&s, "Can't open ifo %d !", i);
+#if VDRVERSNUM >= 10307
+ Skins.Message(mtError, s);
+#else
Interface->Error(s);
+#endif
FREE(s);
DVDClose(dvd);
return false;
@@ -171,14 +218,22 @@ bool cMenuVdrripWarning::CheckDVD() {
return true;
} else {
DVDClose(dvd);
+#if VDRVERSNUM >= 10307
+ Skins.Message(mtError, "Can't open main ifo from dvd !");
+#else
Interface->Error("Can't open main ifo from dvd !");
+#endif
return false;
}
}
char *s = NULL;
asprintf(&s, "Can 't open %s !", DVD);
+#if VDRVERSNUM >= 10307
+ Skins.Message(mtError, s);
+#else
Interface->Error(s);
+#endif
FREE(s);
return false;
}
@@ -190,8 +245,13 @@ bool cMenuVdrripWarning::CheckDVD() {
cMenuVdrripEncode::cMenuVdrripEncode():cOsdMenu(tr("encode vdr-recording")) {
R = NULL;
+#if VDRVERSNUM >= 10307
+ Skins.Message(mtStatus, tr("scanning recordings..."));
+ Skins.Flush();
+#else
Interface->Status(tr("scanning recordings..."));
Interface->Flush();
+#endif
R = new cVdrripRecordings;
Set();
@@ -259,7 +319,13 @@ void cMenuVdrripQueue::Set() {
FREE(s1);
}
- if (Q->getLockStat()) {Interface->Error(tr("the queuefile is locked by the queuehandler !"));}
+ if (Q->getLockStat()) {
+#if VDRVERSNUM >= 10307
+ Skins.Message(mtError, tr("the queuefile is locked by the queuehandler !"));
+#else
+ Interface->Error(tr("the queuefile is locked by the queuehandler !"));
+#endif
+ }
SetHelpKeys();
}
@@ -353,11 +419,13 @@ void cMenuVdrripQueue::SetHelpKeys() {
}
void cMenuVdrripQueue::AddColItem(cOsdItem *i) {
+#if VDRVERSNUM < 10307
#ifdef clrScrolLine
i->SetColor(clrScrolLine, clrBackground);
#else
i->SetColor(clrCyan, clrBackground);
#endif
+#endif
Add(i);
}
@@ -584,11 +652,13 @@ eOSState cMenuVdrripEditTemplate::ProcessKey(eKeys Key) {
}
void cMenuVdrripEditTemplate::AddColItem(cOsdItem *i) {
+#if VDRVERSNUM < 10307
#ifdef clrScrolLine
i->SetColor(clrScrolLine, clrBackground);
#else
i->SetColor(clrCyan, clrBackground);
#endif
+#endif
Add(i);
}
@@ -600,8 +670,13 @@ cMenuVdrripMovie::cMenuVdrripMovie(char *p, char *n):cOsdMenu(tr("encode movie")
MovOSDsaveName = NULL;
FileSize[0] = MovieData[0] = CropData[0] = ScaleData[0] = NULL;
+#if VDRVERSNUM >= 10307
+ Skins.Message(mtStatus, tr("reading movie-data..."));
+ Skins.Flush();
+#else
Interface->Status(tr("reading movie-data..."));
Interface->Flush();
+#endif
M = new cMovie(p, n);
Init();
@@ -888,8 +963,13 @@ void cMenuVdrripMovie::OSDChange() {
#ifdef VDRRIP_DVD
} else if (M->isDVD() && MovOSD.Title != MovOSDsave.Title && MovOSD.Title > 0) {
+#if VDRVERSNUM >= 10307
+ Skins.Message(mtStatus, tr("reading audio-data from dvd..."));
+ Skins.Flush();
+#else
Interface->Status(tr("reading audio-data from dvd..."));
Interface->Flush();
+#endif
M->setDVDTitle(MovOSD.Title, true);
M->saveMovieData();
Set();
@@ -1067,7 +1147,13 @@ eOSState cMenuVdrripMovie::ProcessKey(eKeys Key) {
FREE(q);
DELETE(Q);
return osBack;
- } else {Interface->Error(tr("the queuefile is locked by the queuehandler !"));}
+ } else {
+#if VDRVERSNUM >= 10307
+ Skins.Message(mtError, tr("the queuefile is locked by the queuehandler !"));
+#else
+ Interface->Error(tr("the queuefile is locked by the queuehandler !"));
+#endif
+ }
FREE(q);
DELETE(Q);
@@ -1089,11 +1175,20 @@ eOSState cMenuVdrripMovie::ProcessKey(eKeys Key) {
} else {
if (Interface->Confirm(tr("crop black movie boarders ?"))) {
CropReset = true;
+#if VDRVERSNUM >= 10307
+ Skins.Message(mtStatus, tr("search for black movie boarders"));
+ Skins.Flush();
+#else
Interface->Status(tr("search for black movie boarders"));
Interface->Flush();
+#endif
if (! M->setCropValues()) {
CropReset = false;
+#if VDRVERSNUM >= 10307
+ Skins.Message(mtError, tr("couldn't detect black movie boarders !"));
+#else
Interface->Error(tr("couldn't detect black movie boarders !"));
+#endif
}
M->saveMovieData();
}
@@ -1133,11 +1228,13 @@ eOSState cMenuVdrripMovie::ProcessKey(eKeys Key) {
}
void cMenuVdrripMovie::AddColItem(cOsdItem *i) {
+#if VDRVERSNUM < 10307
#ifdef clrScrolLine
i->SetColor(clrScrolLine, clrBackground);
#else
i->SetColor(clrCyan, clrBackground);
#endif
+#endif
Add(i);
}
@@ -1163,8 +1260,13 @@ eOSState cMenuVdrripMovieTitles::ProcessKey(eKeys Key) {
eOSState state = cOsdMenu::ProcessKey(Key);
if (Key == kOk) {
+#if VDRVERSNUM >= 10307
+ Skins.Message(mtStatus, tr("reading audio-data from dvd..."));
+ Skins.Flush();
+#else
Interface->Status(tr("reading audio-data from dvd..."));
Interface->Flush();
+#endif
M->setDVDTitle(Current() + 1, true);
M->saveMovieData();
return osBack;
diff --git a/menu-vdrrip.h b/menu-vdrrip.h
index 476e8d3..50771b5 100755
--- a/menu-vdrrip.h
+++ b/menu-vdrrip.h
@@ -7,6 +7,10 @@
#include <vdr/osd.h>
#include <vdr/menuitems.h>
+#if VDRVERSNUM >= 10307
+#include <vdr/menu.h>
+#include <vdr/skins.h>
+#endif
#include "movie.h"
#include "vdrriprecordings.h"
@@ -51,7 +55,12 @@ public:
#ifdef VDRRIP_DVD
-class cMenuVdrripWarning : public cOsdMenu {
+class cMenuVdrripWarning
+#if VDRVERSNUM >= 10307
+ : public cMenuText {
+#else
+ : public cOsdMenu {
+#endif
private:
bool hadsubmenu;
diff --git a/movie.c b/movie.c
index 4664913..a85763d 100755
--- a/movie.c
+++ b/movie.c
@@ -8,7 +8,13 @@
#include <math.h>
#ifdef VDRRIP_DVD
+#ifdef NEW_IFO_READ
+ #include <stdint.h>
+ #include <dvdread/ifo_read.h>
+ #include <dvdread/ifo_types.h>
+#else
#include <dvdnav/ifo_read.h>
+#endif
#endif //VDRRIP_DVD
#include <vdr/plugin.h>
@@ -21,8 +27,8 @@
#define SAVEFILE "save.vdrrip"
-#define IDENTCMD "%s \'%s\'%s -identify -frames 0 2>/dev/null | sed -e \'s/[`\\!$\"]/\\&/g\'"
-#define CROPCMD "%s \'%s\'%s -vo null -ao null -really-quiet -ss %i -frames %i -vop cropdetect 2>/dev/null | grep \"crop=\" | sed \"s/.*crop\\(.*\\)).*/\\1/\" | sort | uniq -c | sort -r"
+#define IDENTCMD "%s \'%s\'%s -identify -frames 1 -vo md5sum:outfile=/dev/null -ao null 2>/dev/null | sed -e \'s/[`\\!$\"]/\\&/g\'"
+#define CROPCMD "%s \'%s\'%s -vo null -ao null -quiet -ss %i -frames %i -vf cropdetect 2>/dev/null | grep \"crop=\" | sed \"s/.*crop\\(.*\\)).*/\\1/\" | sort | uniq -c | sort -r"
#define AUDIOCMD "%s \'%s/001.vdr\' -vo null -ao null -frames 0 -aid %i 2>/dev/null | grep AUDIO"
#define AUDIOCMDDVD "%s %s -vo null -ao null -frames 0 -aid %i 2>/dev/null | grep AUDIO"
#define MENCCMD "%s %s help 2>/dev/null"
@@ -516,10 +522,34 @@ void cMovie::queryMpValuesVDR() {
FREE(s);
s = strcol(strgrep("ID_VIDEO_ASPECT", p), "=", 2);
+ if (s && atof(s) == 0.0) { // Workaround for mplayer-1.0rc1: search for second aspect line
+ s = strcol(strgrep("ID_VIDEO_ASPECT", p), "=", 2);
+ dsyslog("VDRRIP-FIX: searched for second aspect line: %s", s);
+ }
if (s) {
Aspect = atof(s);
+ if (Aspect == (double)(int)Aspect) { // Workaround for locale problems
+ if (strchr(s, '.'))
+ *strchr(s, '.') = ',';
+ else if (strchr(s, ','))
+ *strchr(s, ',') = '.';
+ dsyslog("VDRRIP-FIX: tried to solve locale problem: %s", s);
+ Aspect = atof(s);
+ }
} else {Aspect = -1;}
+ if (Aspect <= 0.0) { // Workaround for mplayer-1.0pre7
+ pclose(p);
+ p = popen(cmd, "r");
+ if (p && strgrep("(aspect 3)", p)) {
+ Aspect = 1.7778; // 16:9
+ dsyslog("VDRRIP-FIX: found (aspect 3) - set aspect to 16:9");
+ } else {
+ Aspect = 1.3333; // 4:3
+ dsyslog("VDRRIP-FIX: (aspect 3) NOT found - set aspect to 4:3");
+ }
+ }
+
CalcAspect = Aspect;
pclose(p);
diff --git a/scripts/queuehandler.sh b/scripts/queuehandler.sh
index 759b603..c592bd8 100755
--- a/scripts/queuehandler.sh
+++ b/scripts/queuehandler.sh
@@ -92,6 +92,7 @@ function initialize () {
log_error "usage: $scriptname queuefile tempdir" 1
fi
+ mkdir -p "$tempdir"
if [ ! -d "$tempdir" ]
then
log_error "directory $tempdir doesn't exist, aborting !" 1
@@ -101,7 +102,7 @@ function initialize () {
local pids=`pgrep -d" " "$scriptname"`
local pid1=`echo "$pids" | cut -d" " -f1`
- local pid2=`echo "$pids" | cut -d" " -f3`
+ local pid2=`echo "$pids" | cut -d" " -f2`
if [ "$pid1" != "$pid2" ]
then
@@ -215,6 +216,17 @@ function pre_check () {
mp=$mplayer
fi
+ # change the dvd-parameter to -dvd if the mencoder-version is 0.XX
+ if [ "$dvd" ]
+ then
+ local menc_ver=`$mc -v 2>/dev/null | grep "MEncoder" | sed "s/^MEncoder \(.\).*/\1/"`
+ if [ "$menc_ver" = "0" ]
+ then
+ dvd=`echo "$dvd" | sed "s/^dvd:\/\//-dvd /"`
+ fi
+ log_debug "dvd: $dvd"
+ fi
+
# check needed tools
case "$container" in
"avi")
@@ -303,8 +315,8 @@ function preview () {
shortname="$shortname(preview)"
# start the preview in the middle of the movie
- local length=`"$mp" -identify -frames 0 "$dir/001.vdr" 2>/dev/null | grep ID_LENGTH | cut -d"=" -f2`
- let local ss=length/2
+ local length=`"$mp" -vo null -ao null -identify -frames 0 "$dir/001.vdr" 2>/dev/null | grep ID_LENGTH | cut -d"=" -f2`
+ let local ss=$(echo $length | sed -e s/[.,].*//)/2
previewval="-ss $ss -endpos $previewlength"
}
@@ -316,6 +328,11 @@ function prepare() {
if [ "$error" ]; then return
elif [ "$dvd" ]; then return; fi
+ # Recreate $tempdir if removed by vdr housekeeping
+ mkdir -p "$tempdir"
+ if [ ! -d "$tempdir" ]; then return; fi
+ cd "$tempdir"
+
case "$container" in
"avi")
# join all vdr-files to $tempdir/temp.vdr
@@ -337,6 +354,11 @@ function prepare() {
log_info "demuxing all vdr-files from directory $dir"
evecho "demuxing vdr-files"
execute "$vdrsync $dir -o $tempdir"
+ # vdrsync 0.1.2.2 developer version creates bd.mpa
+ if [ -e "$tempdir/bd.mpa" ]
+ then
+ mv "$tempdir/bd.mpa" "$tempdir/bd.ac3"
+ fi
fi
;;
*)
@@ -443,7 +465,7 @@ function encode () {
;;
esac
- # set mencoder -vop values
+ # set mencoder -vf values
if [ "$crop_w" = "-1" -a "$crop_h" = "-1" -a "$crop_x" = "-1" -a \
"$crop_y" = "-1" -a "$scale_w" = "-1" -a "$scale_h" = "-1" ]
then
@@ -453,15 +475,15 @@ function encode () {
then
local vopopts="scale=$scale_w:$scale_h"
else
- local vopopts="scale=$scale_w:$scale_h,crop=$crop_w:$crop_h:$crop_x:$crop_y"
+ local vopopts="crop=$crop_w:$crop_h:$crop_x:$crop_y,scale=$scale_w:$scale_h"
fi
if [ "$ppvalues" ]
then
- local vopopts="-vop pp=$ppvalues,$vopopts"
+ local vopopts="-vf pp=$ppvalues,$vopopts"
elif [ "$vopopts" ]
then
- local vopopts="-vop $vopopts"
+ local vopopts="-vf $vopopts"
fi
# encode in two passes
@@ -729,8 +751,8 @@ function del_queue () {
rm -f "$queuefile"
else
let lines=lines-1
- tail -n $lines "$queuefile" > /tmp/queuefile.tmp
- mv /tmp/queuefile.tmp $queuefile
+ cp -a "$queuefile" /tmp/queuefile.tmp
+ tail -n $lines /tmp/queuefile.tmp > "$queuefile"
fi
if [ "$error" ]
@@ -782,7 +804,7 @@ function split () {
-ss $splitpos $endpos -o $tempdir/$ofile"
# detect length of splitted file and add it to $splitpos
- local length=`$mplayer -identify -frames 0 $tempdir/$ofile 2>/dev/null | \
+ local length=`$mplayer -vo null -ao null -identify -frames 0 $tempdir/$ofile 2>/dev/null | \
grep ID_LENGTH | cut -d= -f2`
let splitpos=splitpos+length-overlap
let count=count+1
diff --git a/vdrrip.c b/vdrrip.c
index 69fbfee..d0964ff 100755
--- a/vdrrip.c
+++ b/vdrrip.c
@@ -132,13 +132,21 @@ cOsdObject *cPluginVdrrip::MainMenuAction(void)
if (access(MPlayer, X_OK) == -1) {
char *s = NULL;
asprintf(&s, "%s doesn't exist or isn't a executable !", MPlayer);
+#if VDRVERSNUM >= 10307
+ Skins.Message(mtError, s);
+#else
Interface->Error(s);
+#endif
FREE(s);
return NULL;
} else if (access(MEncoder, X_OK) == -1) {
char *s = NULL;
asprintf(&s, "%s doesn't exist or isn't a executable !", MEncoder);
+#if VDRVERSNUM >= 10307
+ Skins.Message(mtError, s);
+#else
Interface->Error(s);
+#endif
FREE(s);
return NULL;
} else return new cMenuVdrrip();