summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJochen Dolze <vdr@dolze.de>2012-09-10 14:54:27 +0200
committerJochen Dolze <vdr@dolze.de>2012-09-10 14:54:27 +0200
commit285eeeed580f82bee7ea769df2e737ceda56a8b9 (patch)
tree4e7b1e4df8de9b8553f3ea2e508708018d43039e
parent18519ae5a0c87283527a1fd9f57d2ce146dc471e (diff)
downloadvdr-plugin-markad-285eeeed580f82bee7ea769df2e737ceda56a8b9.tar.gz
vdr-plugin-markad-285eeeed580f82bee7ea769df2e737ceda56a8b9.tar.bz2
Code cleanups
-rw-r--r--command/demux.cpp40
-rw-r--r--command/markad-standalone.cpp13
-rw-r--r--command/streaminfo.cpp2
-rw-r--r--plugin/markad.cpp1
4 files changed, 33 insertions, 23 deletions
diff --git a/command/demux.cpp b/command/demux.cpp
index 2ee198b..b136d17 100644
--- a/command/demux.cpp
+++ b/command/demux.cpp
@@ -70,7 +70,7 @@ void cPaketQueue::Resize(int NewSize, const char *NewName)
uchar *tmp=(uchar *) realloc(buffer,NewSize+8);
if (tmp)
{
- buffer=tmp;
+ buffer=tmp;
maxqueue=NewSize;
}
else
@@ -288,25 +288,6 @@ int cPaketQueue::findaudioheader(int start, int *framesize, int *headersize, boo
if (framesize)
{
- int bitRates[3][3][16] = // all values are specified as kbits/s
- {
- {
- { 0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448, -1 }, // M1, L1
- { 0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384, -1 }, // M1, L2
- { 0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, -1 } // M1, L3
- },
- {
- { 0, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256, -1 }, // M2, L1
- { 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, -1 }, // M2, L2
- { 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, -1 } // M2, L3
- },
- {
- { 0, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256, -1 }, // M2.5, L1
- { 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, -1 }, // M2.5, L2
- { 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, -1 } // M2.5, L3
- }
- };
-
int samplingFrequencies[3][4] = // all values are specified in Hz
{
{ 44100, 48000, 32000, -1 }, // MPEG 1
@@ -347,6 +328,25 @@ int cPaketQueue::findaudioheader(int start, int *framesize, int *headersize, boo
*framesize = 0; // "free" Bitrate -> we don't support this!
else
{
+ int bitRates[3][3][16] = // all values are specified as kbits/s
+ {
+ {
+ { 0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448, -1 }, // M1, L1
+ { 0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384, -1 }, // M1, L2
+ { 0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, -1 } // M1, L3
+ },
+ {
+ { 0, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256, -1 }, // M2, L1
+ { 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, -1 }, // M2, L2
+ { 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, -1 } // M2, L3
+ },
+ {
+ { 0, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256, -1 }, // M2.5, L1
+ { 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, -1 }, // M2.5, L2
+ { 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, -1 } // M2.5, L3
+ }
+ };
+
int br = 1000 * bitRates[mpegIndex][layerIndex][mp2hdr->BitRateIndex]; // bits/s
int N = slots_per_frame[mpegIndex][layerIndex] * br / sf; // slots
diff --git a/command/markad-standalone.cpp b/command/markad-standalone.cpp
index afbf2a9..7857e49 100644
--- a/command/markad-standalone.cpp
+++ b/command/markad-standalone.cpp
@@ -1231,10 +1231,17 @@ bool cMarkAdStandalone::SaveInfo()
FILE *r,*w;
r=fopen(src,"r");
- w=fopen(dst,"w+");
+ if (!r)
+ {
+ free(src);
+ free(dst);
+ return false;
+ }
- if ((!r) || (!w))
+ w=fopen(dst,"w+");
+ if (!w)
{
+ fclose(r);
free(src);
free(dst);
return false;
@@ -1522,6 +1529,7 @@ bool cMarkAdStandalone::LoadInfo()
FILE *f;
f=fopen(buf,"r");
free(buf);
+ buf=NULL;
if (!f) {
// second try for reel vdr
if (asprintf(&buf,"%s/info.txt",directory)==-1) return false;
@@ -1705,6 +1713,7 @@ bool cMarkAdStandalone::CheckTS()
return false;
}
free(buf);
+ buf=NULL;
if (asprintf(&buf,"%s/001.vdr",directory)==-1) return false;
if (stat(buf,&statbuf)==-1)
{
diff --git a/command/streaminfo.cpp b/command/streaminfo.cpp
index 83e6144..62beb6f 100644
--- a/command/streaminfo.cpp
+++ b/command/streaminfo.cpp
@@ -183,7 +183,6 @@ bool cMarkAdStreamInfo::FindH264VideoInfos(MarkAdContext *maContext, uchar *pkt,
uint32_t width=0;
uint32_t height=0;
uint32_t aspect_ratio_idc=0;
- bool fixedframerate=false;
int sar_width=1,sar_height=1;
int profile_idc = bs.getU8(); // profile_idc
@@ -299,6 +298,7 @@ bool cMarkAdStreamInfo::FindH264VideoInfos(MarkAdContext *maContext, uchar *pkt,
if (pic_order_cnt_type!=2) frame_rate/=2;
}
}
+ bool fixedframerate=false;
fixedframerate=bs.getBit(); // fixed_frame_rate_flag
if ((fixedframerate==1) && (frame_rate!=0)) {
maContext->Video.Info.FramesPerSecond=frame_rate;
diff --git a/plugin/markad.cpp b/plugin/markad.cpp
index cfd9ba2..cf35156 100644
--- a/plugin/markad.cpp
+++ b/plugin/markad.cpp
@@ -243,6 +243,7 @@ bool cPluginMarkAd::ReadTitle(const char *Directory)
FILE *f;
f=fopen(buf,"r");
free(buf);
+ buf=NULL;
if (!f)
{
#if VDRVERSNUM > 10700