summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJochen Dolze <vdr@dolze.de>2009-09-27 10:57:15 (GMT)
committerJochen Dolze <vdr@dolze.de>2009-09-27 10:57:15 (GMT)
commit36cba6f238db17094e18ca3144bd7d5d8a4ffdf0 (patch)
tree2cc5000cf77bc1d0f0715699bcbc68adb572124d
parent960085e4f2cf759a61a46cf10e4d027ca8e96214 (diff)
downloadvdr-plugin-markad-release/v0.0.4.tar.gz
vdr-plugin-markad-release/v0.0.4.tar.bz2
Change marks upon priorityv0.0.4release/v0.0.4
-rw-r--r--HISTORY15
-rw-r--r--Makefile2
-rw-r--r--decoder.cpp4
-rw-r--r--recv.cpp72
-rw-r--r--recv.h3
-rw-r--r--ts2pkt.h2
-rw-r--r--version.h4
-rw-r--r--video.cpp4
8 files changed, 86 insertions, 20 deletions
diff --git a/HISTORY b/HISTORY
index 7545157..0d9ea76 100644
--- a/HISTORY
+++ b/HISTORY
@@ -1,9 +1,20 @@
-VDR Plugin 'noad' Revision History
+VDR Plugin 'markad' Revision History
----------------------------------
+2009-09-27: Version 0.0.4
+
+- Change marks upon priority
+
+2009-09-17: Version 0.0.3
+
+- Changed name from noad to markad
+- Added H264 SPS processor from femon
+- Ignore duplicate TS-packets
+- Added standalone version (still not working)
+
2009-09-11: Version 0.0.2
-- Fixed H264 decoder
+- Fixed H264 decoding
- Added mp2 decoder
- Added ac3 decoder
diff --git a/Makefile b/Makefile
index 4c17bcd..db3eac3 100644
--- a/Makefile
+++ b/Makefile
@@ -18,7 +18,7 @@ AVCODEC = 0
### The version number of this plugin (taken from the main source file):
-VERSION = $(shell grep 'static const char \*VERSION *=' $(PLUGIN).h | awk '{ print $$6 }' | sed -e 's/[";]//g')
+VERSION = $(shell grep 'static const char \*VERSION *=' version.h | awk '{ print $$6 }' | sed -e 's/[";]//g')
### The C++ compiler and options:
diff --git a/decoder.cpp b/decoder.cpp
index 1f1cc0c..029e025 100644
--- a/decoder.cpp
+++ b/decoder.cpp
@@ -124,10 +124,10 @@ void cMarkAdDecoder::FindH264VideoInfos(MarkAdContext *maContext, uchar *pkt, in
maContext->Video.Info.Pict_Type=MA_P_TYPE;
break;
case 2:
- case 7: // B_FRAME;
+ case 7: // B_FRAME;
maContext->Video.Info.Pict_Type=MA_B_TYPE;
break;
- default: // NO_PICTURE;
+ default: // NO_PICTURE;
maContext->Video.Info.Pict_Type=0;
break;
}
diff --git a/recv.cpp b/recv.cpp
index 39bdeb7..43a0e5e 100644
--- a/recv.cpp
+++ b/recv.cpp
@@ -132,7 +132,7 @@ cMarkAdReceiver::~cMarkAdReceiver()
if (buf)
{
tempmark.Comment=buf;
- AddMark(&tempmark);
+ AddMark(&tempmark,0);
isyslog("markad [%i]: %s",recvnumber,buf);
free(buf);
}
@@ -148,6 +148,25 @@ cMarkAdReceiver::~cMarkAdReceiver()
if (filename) free(filename);
}
+char *cMarkAdReceiver::strcatrealloc(char *dest, const char *src)
+{
+ if (!src || !*src)
+ return dest;
+
+ size_t l = (dest ? strlen(dest) : 0) + strlen(src) + 1;
+ if (dest)
+ {
+ dest = (char *)realloc(dest, l);
+ strcat(dest, src);
+ }
+ else
+ {
+ dest = (char*)malloc(l);
+ strcpy(dest, src);
+ }
+ return dest;
+}
+
int cMarkAdReceiver::LastIFrame()
{
if (!Index)
@@ -210,7 +229,8 @@ void cMarkAdReceiver::Receive(uchar *Data, int Length)
buffer.Signal();
}
}
-void cMarkAdReceiver::AddMark(MarkAdMark *mark)
+
+void cMarkAdReceiver::AddMark(MarkAdMark *mark, int Priority)
{
if (!mark) return;
if (!mark->Position) return;
@@ -218,8 +238,43 @@ void cMarkAdReceiver::AddMark(MarkAdMark *mark)
cMark *newmark=marks.Add(mark->Position);
if (newmark)
{
- if (newmark->comment) free(newmark->comment);
- newmark->comment=strdup(mark->Comment);
+ char *buf;
+ asprintf(&buf,"P%i %s",Priority,mark->Comment);
+ if (buf)
+ {
+ if (newmark->comment) free(newmark->comment);
+ newmark->comment=buf;
+ }
+ }
+ marks.Save();
+
+#define MAXPOSDIFF 10500 // = 7 min
+
+ cMark *prevmark=marks.GetPrev(mark->Position);
+ if (!prevmark) return;
+ if (!prevmark->comment) return;
+ if (abs(mark->Position-prevmark->position)>MAXPOSDIFF) return;
+
+ int prevPriority=atoi(prevmark->comment+1);
+ if (prevPriority==Priority) return;
+
+ if (prevPriority>Priority)
+ {
+ // add text from mark to prevmark
+ prevmark->comment=strcatrealloc(prevmark->comment," ");
+ prevmark->comment=strcatrealloc(prevmark->comment,mark->Comment);
+
+ marks.Del(newmark,true);
+ dsyslog("markad [%i]: delete mark %i",recvnumber,newmark->position);
+ }
+ else
+ {
+ // add text from prevmark to mark
+ mark->Comment=strcatrealloc(mark->Comment," ");
+ mark->Comment=strcatrealloc(mark->Comment,prevmark->comment);
+
+ marks.Del(prevmark,true);
+ dsyslog("markad [%i]: delete previous mark %i",recvnumber,prevmark->position);
}
marks.Save();
}
@@ -237,7 +292,7 @@ void cMarkAdReceiver::Action()
if (common)
{
mark=common->Process(lastiframe);
- AddMark(mark);
+ AddMark(mark,0);
}
if ((video_demux) && (decoder) && (video))
@@ -264,8 +319,7 @@ void cMarkAdReceiver::Action()
if (decoder->DecodeVideo(&macontext,pkt,pktlen))
{
mark=video->Process(lastiframe);
- AddMark(mark);
-
+ AddMark(mark,3);
}
}
tspkt+=len;
@@ -301,7 +355,7 @@ void cMarkAdReceiver::Action()
if (decoder->DecodeMP2(&macontext,pkt,pktlen))
{
mark=audio->Process(lastiframe);
- AddMark(mark);
+ AddMark(mark,1);
}
}
tspkt+=len;
@@ -333,7 +387,7 @@ void cMarkAdReceiver::Action()
if (decoder->DecodeAC3(&macontext,pkt,pktlen))
{
mark=audio->Process(lastiframe);
- AddMark(mark);
+ AddMark(mark,2);
}
}
tspkt+=len;
diff --git a/recv.h b/recv.h
index 4e61743..a5d2658 100644
--- a/recv.h
+++ b/recv.h
@@ -58,6 +58,7 @@ private:
char *filename;
int lastiframe;
+ char *strcatrealloc(char *dest, const char *src);
cMarks marks;
cIndexFile *Index;
@@ -73,7 +74,7 @@ private:
cMarkAdDemux *mp2_demux;
cMarkAdDemux *ac3_demux;
- void AddMark(MarkAdMark *mark);
+ void AddMark(MarkAdMark *mark, int Priority);
protected:
virtual void Activate(bool On);
virtual void Receive(uchar *Data, int Length);
diff --git a/ts2pkt.h b/ts2pkt.h
index e610050..927e03b 100644
--- a/ts2pkt.h
+++ b/ts2pkt.h
@@ -9,7 +9,7 @@
#ifndef __ts2pkt_h_
#define __ts2pkt_h_
-#include <vdr/tools.h>
+#include <vdr/tools.h> // needed for (d/e/i)syslog
#ifndef TS_SIZE
#define TS_SIZE 188
diff --git a/version.h b/version.h
index aa37a4a..548a147 100644
--- a/version.h
+++ b/version.h
@@ -9,6 +9,6 @@
#ifndef __version_h_
#define __version_h_
-static const char *VERSION = "0.0.3";
+static const char *VERSION = "0.0.4";
-#endif \ No newline at end of file
+#endif
diff --git a/video.cpp b/video.cpp
index ab2f285..cb64d38 100644
--- a/video.cpp
+++ b/video.cpp
@@ -226,7 +226,7 @@ MarkAdMark *cMarkAdVideo::Process(int LastIFrame)
asprintf(&buf,"detected start of horiz. borders (%i)",borderiframe);
if (buf)
{
- dsyslog("markad [%i]: %s",recvnumber,buf);
+ isyslog("markad [%i]: %s",recvnumber,buf);
AddMark(borderiframe,buf);
free(buf);
}
@@ -238,7 +238,7 @@ MarkAdMark *cMarkAdVideo::Process(int LastIFrame)
asprintf(&buf,"detected stop of horiz. borders (%i)",borderiframe);
if (buf)
{
- dsyslog("markad [%i]: %s",recvnumber,buf);
+ isyslog("markad [%i]: %s",recvnumber,buf);
AddMark(borderiframe,buf);
free(buf);
}