diff options
author | Jochen Dolze <vdr@dolze.de> | 2010-08-15 21:41:32 +0200 |
---|---|---|
committer | Jochen Dolze <vdr@dolze.de> | 2010-08-15 21:41:32 +0200 |
commit | 032f8437299515c83a0fe148e66c0230d0dad8fa (patch) | |
tree | ddede2e7e0e8d63c7dd0f1a59c6e99099ea74425 /command | |
parent | 462f8e37728c3d835e9a922f4fb4b11c7619ea9d (diff) | |
download | vdr-plugin-markad-032f8437299515c83a0fe148e66c0230d0dad8fa.tar.gz vdr-plugin-markad-032f8437299515c83a0fe148e66c0230d0dad8fa.tar.bz2 |
Fixed demux error with AC3 on VDR files (added in the last commits)
Fixed writing info files
Few cleanups
Diffstat (limited to 'command')
-rw-r--r-- | command/demux.cpp | 12 | ||||
-rw-r--r-- | command/demux.h | 4 | ||||
-rw-r--r-- | command/markad-standalone.cpp | 85 |
3 files changed, 47 insertions, 54 deletions
diff --git a/command/demux.cpp b/command/demux.cpp index 97fd7d9..23bd78e 100644 --- a/command/demux.cpp +++ b/command/demux.cpp @@ -126,30 +126,30 @@ int cMarkAdDemux::GetMinNeeded(MarkAdPid Pid, uchar *Data, int Count, bool *Offc { if (Pid.Num>=0) return TS_SIZE; - uchar *qData=queue->Peek(6); + uchar *qData=queue->Peek(PESHDRSIZE); if (!qData) { - int len=6-queue->Length(); + int len=PESHDRSIZE-queue->Length(); int cnt=(Count>len) ? len : Count; queue->Put(Data,cnt); return -cnt; } - int stream=qData[3] & 0xF0; + int stream=qData[3]; if ((qData[0]==0) && (qData[1]==0) && (qData[2]==1) && (stream>0xBC)) { int needed=qData[4]*256+qData[5]; if (((Pid.Type==MARKAD_PIDTYPE_VIDEO_H262) || - (Pid.Type==MARKAD_PIDTYPE_VIDEO_H264)) && (stream!=0xE0)) + (Pid.Type==MARKAD_PIDTYPE_VIDEO_H264)) && ((stream & 0xF0)!=0xE0)) { // ignore 6 header bytes from queue->Put above queue->Clear(); if (Offcnt) *Offcnt=true; return -needed; } - if ((Pid.Type==MARKAD_PIDTYPE_AUDIO_MP2) && (stream!=0xC0)) + if ((Pid.Type==MARKAD_PIDTYPE_AUDIO_MP2) && ((stream & 0xF0)!=0xC0)) { // ignore 6 header bytes from queue->Put above queue->Clear(); @@ -163,7 +163,7 @@ int cMarkAdDemux::GetMinNeeded(MarkAdPid Pid, uchar *Data, int Count, bool *Offc if (Offcnt) *Offcnt=true; return -needed; } - return needed+6; + return needed+PESHDRSIZE; } else { diff --git a/command/demux.h b/command/demux.h index 7b70891..f97fe08 100644 --- a/command/demux.h +++ b/command/demux.h @@ -12,9 +12,7 @@ #define TS_SIZE 188 #endif -#ifndef VDR_SIZE -#define VDR_SIZE 2048 -#endif +#define PESHDRSIZE 6 #include "global.h" #include "queue.h" diff --git a/command/markad-standalone.cpp b/command/markad-standalone.cpp index adb65f4..99dc215 100644 --- a/command/markad-standalone.cpp +++ b/command/markad-standalone.cpp @@ -731,7 +731,8 @@ bool cMarkAdStandalone::ProcessFile(const char *Directory, int Number) int len=video_demux->Process(macontext.Info.VPid,tspkt,tslen,&pkt,&pktlen,&offcnt); if (len<0) { - esyslog("Error demuxing video"); + esyslog("error demuxing video"); + abort=true; break; } else @@ -806,7 +807,7 @@ bool cMarkAdStandalone::ProcessFile(const char *Directory, int Number) int len=ac3_demux->Process(macontext.Info.DPid,tspkt,tslen,&pkt,&pktlen,NULL); if (len<0) { - esyslog("Error demuxing ac3-audio"); + esyslog("error demuxing ac3-audio"); break; } else @@ -848,7 +849,7 @@ bool cMarkAdStandalone::ProcessFile(const char *Directory, int Number) int len=mp2_demux->Process(macontext.Info.APid,tspkt,tslen,&pkt,&pktlen,NULL); if (len<0) { - esyslog("Error demuxing mp2-audio"); + esyslog("error demuxing mp2-audio"); break; } else @@ -1059,6 +1060,7 @@ bool cMarkAdStandalone::SaveInfo(const char *Directory) } char *line=NULL; + char *lline=NULL; size_t length=0; bool setVideo43_done=false; @@ -1117,16 +1119,10 @@ bool cMarkAdStandalone::SaveInfo(const char *Directory) else { if (fprintf(w,"%s",line)<=0) err=true; - free(line); - line=NULL; - length=0; } break; default: if (fprintf(w,"%s",line)<=0) err=true; - free(line); - line=NULL; - length=0; break; } } @@ -1136,13 +1132,22 @@ bool cMarkAdStandalone::SaveInfo(const char *Directory) if (line[0]!='@') { if (fprintf(w,"%s",line)<=0) err=true; - free(line); - line=NULL; - length=0; + } + else + { + if (lline) + { + free(lline); + err=true; + esyslog("multiple @lines in info file, please report this!"); + } + lline=strdup(line); } } if (err) break; } + if (line) free(line); + line=lline; if ((setVideo43) && (!setVideo43_done) && (!err)) { @@ -1160,8 +1165,11 @@ bool cMarkAdStandalone::SaveInfo(const char *Directory) { if (fprintf(w,"%s","X 2 05 und Dolby Digital 5.1\n")<=0) err=true; } - if (line) if (fprintf(w,"%s",line)<=0) err=true; - if (line) free(line); + if (line) + { + if (fprintf(w,"%s",line)<=0) err=true; + free(line); + } fclose(w); fclose(r); if (err) @@ -1599,7 +1607,11 @@ bool cMarkAdStandalone::CreatePidfile(const char *Directory) } fclose(oldpid); } - if (duplicate) return false; + if (duplicate) + { + free(buf); + return false; + } FILE *pidfile=fopen(buf,"w+"); @@ -1646,6 +1658,16 @@ cMarkAdStandalone::cMarkAdStandalone(const char *Directory, bool BackupMarks, in fastexit=false; reprocess=false; + indexFile=NULL; + streaminfo=NULL; + video_demux=NULL; + ac3_demux=NULL; + mp2_demux=NULL; + decoder=NULL; + video=NULL; + audio=NULL; + osd=NULL; + setAudio51=false; setAudio20=false; setVideo43=false; @@ -1739,32 +1761,12 @@ cMarkAdStandalone::cMarkAdStandalone(const char *Directory, bool BackupMarks, in if (!noPid) { CreatePidfile(Directory); - if (abort) - { - video_demux=NULL; - ac3_demux=NULL; - mp2_demux=NULL; - decoder=NULL; - video=NULL; - audio=NULL; - osd=NULL; - return; - } + if (abort) return; } if (Before) sleep(10); - if (!CheckTS(Directory)) - { - video_demux=NULL; - ac3_demux=NULL; - mp2_demux=NULL; - decoder=NULL; - video=NULL; - audio=NULL; - osd=NULL; - return; - } + if (!CheckTS(Directory)) return; if (isTS) { @@ -1886,13 +1888,6 @@ cMarkAdStandalone::cMarkAdStandalone(const char *Directory, bool BackupMarks, in if (macontext.Info.ChannelID) dsyslog("channel %s",macontext.Info.ChannelID); } - else - { - decoder=NULL; - video=NULL; - audio=NULL; - streaminfo=NULL; - } framecnt=0; lastiframe=0; @@ -1968,7 +1963,7 @@ int usage() "-B --backupmarks\n" " make a backup of existing marks\n" "-G --genindex\n" - " run genindex on broken index file\n" + " regenerate broken index file\n" "-L --extractlogo=<direction>[,width[,height]]\n" " extracts logo to /tmp as pgm files (must be renamed)\n" " <direction> 0 = top left, 1 = top right\n" |