summaryrefslogtreecommitdiff
path: root/command/audio.cpp
diff options
context:
space:
mode:
authorJochen Dolze <vdr@dolze.de>2010-10-07 20:27:51 +0200
committerJochen Dolze <vdr@dolze.de>2010-10-07 20:27:51 +0200
commitc84d6dba338bc863f0cb64f13b08ef87b65eba65 (patch)
tree808806f210823da5e3a5dc0d9584681670c85b02 /command/audio.cpp
parent8cf797691409510a1957156d9d2c9cfa104ef6b4 (diff)
downloadvdr-plugin-markad-c84d6dba338bc863f0cb64f13b08ef87b65eba65.tar.gz
vdr-plugin-markad-c84d6dba338bc863f0cb64f13b08ef87b65eba65.tar.bz2
Added support for totally broken info files
Code cleanups
Diffstat (limited to 'command/audio.cpp')
-rw-r--r--command/audio.cpp46
1 files changed, 1 insertions, 45 deletions
diff --git a/command/audio.cpp b/command/audio.cpp
index f46d006..448d1e9 100644
--- a/command/audio.cpp
+++ b/command/audio.cpp
@@ -68,49 +68,6 @@ bool cMarkAdAudio::AddMark(int Type, int Position, const char *Comment)
return true;
}
-bool cMarkAdAudio::SilenceDetection(int FrameNumber)
-{
- // function taken from noad
- if (!FrameNumber) return false;
- if (!macontext->Audio.Data.Valid) return false;
- if (lastframe_silence==FrameNumber) return false; // we already detected silence for this frame
- if (lastframe_silence==-1)
- {
- // ignore first detection
- lastframe_silence=FrameNumber;
- return false;
- }
- int samples=macontext->Audio.Data.SampleBufLen/
- sizeof(*macontext->Audio.Data.SampleBuf)/
- macontext->Audio.Info.Channels;
-
- short left,right;
- int lowvalcount=0;
- for (int i=0; i<samples; i++)
- {
- left=macontext->Audio.Data.SampleBuf[0+(i*2)];
- right=macontext->Audio.Data.SampleBuf[1+(i*2)];
-
- if ((abs(left)+abs(right))<CUT_VAL)
- {
- lowvalcount++;
- if (lowvalcount>MIN_LOWVALS)
- {
- lastframe_silence=FrameNumber;
- }
- }
- else
- {
- if (lastframe_silence==FrameNumber)
- {
- return true;
- }
- lowvalcount=0;
- }
- }
- return false;
-}
-
bool cMarkAdAudio::AnalyzeGain(int FrameNumber)
{
if (!macontext->Audio.Data.Valid) return false;
@@ -155,7 +112,6 @@ void cMarkAdAudio::Clear()
{
channels=0;
lastframe_gain=-1;
- lastframe_silence=-1;
if (result.CommentBefore) free(result.CommentBefore);
if (result.CommentAfter) free(result.CommentAfter);
memset(&result,0,sizeof(result));
@@ -172,7 +128,7 @@ MarkAdPos *cMarkAdAudio::Process2ndPass(int FrameNumber)
{
if (!FrameNumber) return NULL;
#if 0
- if (SilenceDetection(FrameNumber))
+ if (AnalyzeGain(FrameNumber))
{
if (result.CommentBefore) free(result.CommentBefore);
if (asprintf(&result.CommentBefore,"audio silence detection (%i)",FrameNumber)==-1)