From ab6f2ccf424896a80b6e2fdf9ab9313ea4b7f316 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 14 Jun 2009 13:49:00 +0200 Subject: =?UTF-8?q?Version=201.7.8=20-=20The=20name=20of=20the=20function?= =?UTF-8?q?=20cDevice::GetVideoSize()=20wasn't=20very=20well=20chosen=20?= =?UTF-8?q?=20=20for=20its=20purpose=20of=20defining=20the=20optimum=20siz?= =?UTF-8?q?e=20of=20the=20OSD=20for=20the=20current=20=20=20output=20devic?= =?UTF-8?q?e.=20Therefore=20a=20new=20function=20named=20cDevice::GetOsdSi?= =?UTF-8?q?ze()=20has=20=20=20been=20introduced=20(suggested=20by=20Rolf?= =?UTF-8?q?=20Ahrenberg).=20Plugin=20authors=20should=20=20=20implement=20?= =?UTF-8?q?this=20function=20in=20classes=20derived=20from=20cDevice,=20if?= =?UTF-8?q?=20they=20are=20able=20=20=20to=20replay=20video.=20cDevice::Ge?= =?UTF-8?q?tVideoSize()=20still=20exists=20and=20should=20return=20the=20?= =?UTF-8?q?=20=20actual=20size=20of=20the=20video=20material=20that=20is?= =?UTF-8?q?=20currently=20replayed.=20Note=20that=20=20=20because=20of=20t?= =?UTF-8?q?he=20many=20possible=20aspect=20ratios=20for=20video=20material?= =?UTF-8?q?,=20the=20type=20=20=20of=20the=20Aspect=20parameter=20of=20Get?= =?UTF-8?q?VideoSize()=20has=20been=20changed=20to=20'double',=20=20=20and?= =?UTF-8?q?=20the=20Aspect=20parameter=20in=20both=20functions=20is=20name?= =?UTF-8?q?d=20differently,=20because=20=20=20it=20returns=20different=20v?= =?UTF-8?q?alues=20(suggested=20by=20Reinhard=20Nissl).=20=20=20Thanks=20t?= =?UTF-8?q?o=20Oliver=20Endriss=20for=20his=20input=20on=20calculating=20t?= =?UTF-8?q?he=20Aspect=20factor=20in=20=20=20GetOsdSize().=20-=20Fixed=20t?= =?UTF-8?q?he=20way=20the=20OSD=20size=20is=20determined=20on=20full=20fea?= =?UTF-8?q?tured=20DVB=20cards=20(thanks=20=20=20to=20Oliver=20Endriss).?= =?UTF-8?q?=20-=20Increased=20MAXOSDHEIGHT=20to=201200=20(suggested=20by?= =?UTF-8?q?=20Nicolas=20Huillard).=20-=20Removed=20limitation=20to=20PAL?= =?UTF-8?q?=20resolution=20from=20SPU=20handling.=20-=20Checking=20fd=5Fvi?= =?UTF-8?q?deo=20in=20cDvbDevice::GetVideoSize()=20to=20avoid=20error=20me?= =?UTF-8?q?ssages=20on=20=20=20systems=20with=20no=20real=20primary=20repl?= =?UTF-8?q?ay=20device=20(reported=20by=20Martin=20Neuditschko).=20-=20Add?= =?UTF-8?q?ed=20a=20note=20to=20cTsToPes::GetPes()=20about=20having=20to?= =?UTF-8?q?=20call=20it=20repeatedly,=20once=20=20=20it=20has=20returned?= =?UTF-8?q?=20a=20non-NULL=20value.=20-=20Added=20MPEG=201=20handling=20to?= =?UTF-8?q?=20remux.c=20(thanks=20to=20Ales=20Jurik).=20-=20Fixed=20use=20?= =?UTF-8?q?of=20time=5Ft=20in=20cEIT::cEIT()=20(thanks=20to=20Tobias=20Bra?= =?UTF-8?q?tfisch).=20-=20Added=20missing=20update=20of=20lastOsdSizeUpdat?= =?UTF-8?q?e.=20-=20EIT=20events=20are=20now=20only=20processed=20if=20a?= =?UTF-8?q?=20plausible=20system=20time=20is=20available,=20to=20=20=20avo?= =?UTF-8?q?id=20wrong=20handling=20of=20PDC=20descriptors=20(thanks=20to?= =?UTF-8?q?=20Tobias=20Bratfisch).=20-=20Removed=20unused=20'synced'=20mem?= =?UTF-8?q?ber=20from=20cTsToPes=20(reported=20by=20Christoph=20Haubrich).?= =?UTF-8?q?=20-=20Added=20a=20note=20to=20cTsToPes=20about=20all=20TS=20pa?= =?UTF-8?q?ckets=20having=20to=20belong=20to=20the=20same=20PID,=20=20=20a?= =?UTF-8?q?nd=20that=20for=20video=20data=20GetPes()=20may=20only=20be=20c?= =?UTF-8?q?alled=20if=20the=20next=20TS=20packet=20that=20=20=20will=20be?= =?UTF-8?q?=20given=20to=20PutTs()=20has=20the=20"payload=20start"=20flag?= =?UTF-8?q?=20set=20(suggested=20by=20Christoph=20=20=20Haubrich).=20-=20A?= =?UTF-8?q?dded=20a=20note=20about=20the=20meaning=20of=20PERCENTAGEDELTA?= =?UTF-8?q?=20in=20cRingBuffer::UpdatePercentage()=20=20=20(thanks=20to=20?= =?UTF-8?q?Rolf=20Ahrenberg).=20-=20The=20new=20setup=20option=20"Recordin?= =?UTF-8?q?g/Pause=20key=20handling"=20can=20be=20used=20to=20define=20=20?= =?UTF-8?q?=20what=20happens=20if=20the=20Pause=20key=20on=20the=20remote?= =?UTF-8?q?=20control=20is=20pressed=20during=20=20=20live=20tv=20(thanks?= =?UTF-8?q?=20to=20Timo=20Eskola).=20-=20Added=20a=20note=20about=20cFont:?= =?UTF-8?q?:GetFont()=20not=20being=20thread-safe.=20-=20Fixed=20generatin?= =?UTF-8?q?g=20PAT/PMT=20version=20numbers=20in=20case=20the=20PIDs=20chan?= =?UTF-8?q?ge=20during=20=20=20recording=20(reported=20by=20Reinhard=20Nis?= =?UTF-8?q?sl).=20-=20Updated=20the=20Ukrainian=20OSD=20texts=20(thanks=20?= =?UTF-8?q?to=20Yarema=20Aka=20Knedlyk).=20-=20Fixed=20a=20memory=20leak?= =?UTF-8?q?=20when=20reaching=20the=20end=20of=20a=20recording=20during=20?= =?UTF-8?q?replay=20(reported=20=20=20by=20Reinhard=20Nissl).=20-=20Fixed?= =?UTF-8?q?=20calling=20close(-1)=20in=20cUnbufferedFile::Close()=20(repor?= =?UTF-8?q?ted=20by=20Reinhard=20Nissl).=20-=20Added=20a=20workaround=20fo?= =?UTF-8?q?r=20the=20broken=20linux-dvb=20driver=20header=20files=20(based?= =?UTF-8?q?=20on=20a=20patch=20=20=20from=20Tobias=20Grimm).=20-=20Fixed?= =?UTF-8?q?=20handling=20the=20length=20of=20DiSEqC=20command=20sequences?= =?UTF-8?q?=20(reported=20by=20Reinhard=20Nissl).=20-=20Fixed=20cOsdMenu::?= =?UTF-8?q?Display()=20in=20case=20the=20menu=20size=20has=20changed=20(th?= =?UTF-8?q?anks=20to=20=20=20Reinhard=20Nissl).=20-=20Added=20some=20missi?= =?UTF-8?q?ng=20'const'=20keywords=20to=20avoid=20compilation=20errors=20w?= =?UTF-8?q?ith=20gcc=204.4=20=20=20(thanks=20to=20Ville=20Skytt=C3=A4=20an?= =?UTF-8?q?d=20Ludwig=20Nussel).=20-=20Modified=20cSVDRP::CmdGRAB()=20to?= =?UTF-8?q?=20avoid=20writing=20into=20const=20data=20(reported=20by=20=20?= =?UTF-8?q?=20Ludwig=20Nussel).=20-=20Fixed=20calculating=20menu=20colum?= =?UTF-8?q?=20widths=20in=20case=20the=20font=20has=20a=20size=20other=20t?= =?UTF-8?q?han=20the=20=20=20default=20size=20(reported=20by=20Reinhard=20?= =?UTF-8?q?Nissl).=20-=20Added=20a=20plausibility=20check=20for=20the=20OS?= =?UTF-8?q?D=20percentage=20parameters=20=20=20to=20avoid=20problems=20in?= =?UTF-8?q?=20case=20the=20values=20are=20stored=20in=20the=20setup.conf?= =?UTF-8?q?=20=20=20file=20in=20a=20=20wrong=20way.=20-=20Fixed=20variable?= =?UTF-8?q?=20types=20in=20cIndexFile=20(reported=20by=20Udo=20Richter).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- recording.c | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 60 insertions(+), 8 deletions(-) (limited to 'recording.c') diff --git a/recording.c b/recording.c index c86b163..2ff7f6f 100644 --- a/recording.c +++ b/recording.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: recording.c 2.12 2009/04/13 13:50:39 kls Exp $ + * $Id: recording.c 2.16 2009/06/13 13:34:08 kls Exp $ */ #include "recording.h" @@ -20,6 +20,7 @@ #include "channels.h" #include "i18n.h" #include "interface.h" +#include "remux.h" #include "skins.h" #include "tools.h" #include "videodir.h" @@ -622,8 +623,8 @@ cRecording::cRecording(cTimer *Timer, const cEvent *Event) Utf8Strn0Cpy(SubtitleBuffer, Subtitle, MAX_SUBTITLE_LENGTH); Subtitle = SubtitleBuffer; } - char *macroTITLE = strstr(Timer->File(), TIMERMACRO_TITLE); - char *macroEPISODE = strstr(Timer->File(), TIMERMACRO_EPISODE); + const char *macroTITLE = strstr(Timer->File(), TIMERMACRO_TITLE); + const char *macroEPISODE = strstr(Timer->File(), TIMERMACRO_EPISODE); if (macroTITLE || macroEPISODE) { name = strdup(Timer->File()); name = strreplace(name, TIMERMACRO_TITLE, Title); @@ -672,7 +673,7 @@ cRecording::cRecording(const char *FileName) sortBuffer = NULL; fileName = strdup(FileName); FileName += strlen(VideoDirectory) + 1; - char *p = strrchr(FileName, '/'); + const char *p = strrchr(FileName, '/'); name = NULL; info = new cRecordingInfo; @@ -1528,8 +1529,8 @@ bool cIndexFile::Get(int Index, uint16_t *FileNumber, off_t *FileOffset, bool *I if (Independent) *Independent = index[Index].independent; if (Length) { - int fn = index[Index + 1].number; - int fo = index[Index + 1].offset; + uint16_t fn = index[Index + 1].number; + off_t fo = index[Index + 1].offset; if (fn == *FileNumber) *Length = fo - *FileOffset; else @@ -1559,8 +1560,8 @@ int cIndexFile::GetNextIFrame(int Index, bool Forward, uint16_t *FileNumber, off *FileOffset = index[Index].offset; if (Length) { // all recordings end with a non-independent frame, so the following should be safe: - int fn = index[Index + 1].number; - int fo = index[Index + 1].offset; + uint16_t fn = index[Index + 1].number; + off_t fo = index[Index + 1].offset; if (fn == *FileNumber) *Length = fo - *FileOffset; else { @@ -1629,6 +1630,57 @@ cFileName::~cFileName() free(fileName); } +bool cFileName::GetLastPatPmtVersions(int &PatVersion, int &PmtVersion) +{ + if (fileName && !isPesRecording) { + // Find the last recording file: + int Number = 1; + for (; Number <= MAXFILESPERRECORDINGTS + 1; Number++) { // +1 to correctly set Number in case there actually are that many files + sprintf(pFileNumber, RECORDFILESUFFIXTS, Number); + if (access(fileName, F_OK) != 0) { // file doesn't exist + Number--; + break; + } + } + for (; Number > 0; Number--) { + // Search for a PAT packet from the end of the file: + cPatPmtParser PatPmtParser; + sprintf(pFileNumber, RECORDFILESUFFIXTS, Number); + int fd = open(fileName, O_RDONLY | O_LARGEFILE, DEFFILEMODE); + if (fd >= 0) { + off_t pos = lseek(fd, -TS_SIZE, SEEK_END); + while (pos >= 0) { + // Read and parse the PAT/PMT: + uchar buf[TS_SIZE]; + while (read(fd, buf, sizeof(buf)) == sizeof(buf)) { + if (buf[0] == TS_SYNC_BYTE) { + int Pid = TsPid(buf); + if (Pid == 0) + PatPmtParser.ParsePat(buf, sizeof(buf)); + else if (Pid == PatPmtParser.PmtPid()) { + PatPmtParser.ParsePmt(buf, sizeof(buf)); + if (PatPmtParser.GetVersions(PatVersion, PmtVersion)) { + close(fd); + return true; + } + } + else + break; // PAT/PMT is always in one sequence + } + else + return false; + } + pos = lseek(fd, pos - TS_SIZE, SEEK_SET); + } + close(fd); + } + else + break; + } + } + return false; +} + cUnbufferedFile *cFileName::Open(void) { if (!file) { -- cgit v1.2.3