From 084e16c057ab195a76c2117c631a2fe10a904238 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 25 Jan 2009 13:13:00 +0100 Subject: =?UTF-8?q?Version=201.7.4=20-=20Removed=20the=20'#define=20FE=5FC?= =?UTF-8?q?AN=5F2ND=5FGEN=5FMODULATION',=20since=20it=20was=20wrong=20and?= =?UTF-8?q?=20the=20=20=20flag=20is=20now=20in=20the=20driver,=20anyway.?= =?UTF-8?q?=20-=20The=20full-featured=20DVB=20cards=20are=20now=20given=20?= =?UTF-8?q?the=20TS=20data=20directly=20for=20replay=20=20=20(thanks=20to?= =?UTF-8?q?=20Oliver=20Endriss=20for=20enhancing=20the=20av7110=20driver?= =?UTF-8?q?=20to=20make=20it=20replay=20=20=20TS=20data).=20The=20patch=20?= =?UTF-8?q?from=20ftp://ftp.cadsoft.de/vdr/Developer/av7110=5Fts=5Freplay?= =?UTF-8?q?=5F=5F1.diff=20=20=20implements=20this=20change=20in=20the=20dr?= =?UTF-8?q?iver.=20=20=20The=20patch=20av7110=5Fv4ldvb=5Fapi5=5Faudiobuf?= =?UTF-8?q?=5Ftest=5F1.diff=20mentioned=20in=20version=201.7.2=20=20=20is?= =?UTF-8?q?=20still=20necessary=20to=20avoid=20audio=20and=20video=20glitc?= =?UTF-8?q?hes=20on=20some=20channels.=20-=20Added=20a=20typecast=20in=20c?= =?UTF-8?q?UnbufferedFile::Write()=20to=20avoid=20an=20error=20message=20w?= =?UTF-8?q?hen=20=20=20compiling=20on=2064=20bit=20systems.=20-=20Added=20?= =?UTF-8?q?some=20missing=20'const'=20statements=20to=20cBitmap=20(thanks?= =?UTF-8?q?=20to=20Andreas=20Regel).=20-=20Fixed=20returning=20complete=20?= =?UTF-8?q?PES=20packets=20in=20cTsToPes::GetPes()=20(thanks=20to=20Reinha?= =?UTF-8?q?rd=20=20=20Nissl).=20-=20Added=20a=20missing=20Detach()=20in=20?= =?UTF-8?q?cTransfer::Activate()=20(thanks=20to=20Marco=20Schl=FC=DFler).?= =?UTF-8?q?=20-=20Added=20clearing=20the=20TS=20buffers=20in=20cDevice::De?= =?UTF-8?q?tach()=20(thanks=20to=20Marco=20Schl=FC=DFler).=20-=20Fixed=20i?= =?UTF-8?q?ncrementing=20the=20continuity=20counter=20in=20cPatPmtGenerato?= =?UTF-8?q?r::GetPmt()=20(thanks=20=20=20to=20Johann=20Friedrichs).=20-=20?= =?UTF-8?q?Fixed=20removing=20deleted=20recordings=20in=20case=20there=20i?= =?UTF-8?q?s=20a=20problem.=20Once=20a=20recording=20=20=20caused=20a=20pr?= =?UTF-8?q?oblem=20with=20removing,=20no=20others=20were=20removed=20any?= =?UTF-8?q?=20more=20and=20an=20ongoing=20=20=20recording=20could=20fill?= =?UTF-8?q?=20up=20the=20disk=20and=20cause=20other=20recordings=20to=20be?= =?UTF-8?q?=20deleted=20=20=20automatically=20(reported=20by=20Reinhard=20?= =?UTF-8?q?Nissl).=20-=20Added=20"DEFINES=20+=3D=20-D=5FFILE=5FOFFSET=5FBI?= =?UTF-8?q?TS=3D64=20-D=5FLARGEFILE=5FSOURCE=20-D=5FLARGEFILE64=5FSOURCE"?= =?UTF-8?q?=20=20=20to=20Make.config.template=20(thanks=20to=20Johann=20Fr?= =?UTF-8?q?iedrichs=20for=20pointing=20this=20out).=20=20=20Plugin=20autho?= =?UTF-8?q?rs=20should=20add=20this=20line=20to=20their=20Makefile=20or=20?= =?UTF-8?q?Make.config=20if=20they=20use=20=20=20file=20access=20functions?= =?UTF-8?q?=20that=20need=20special=20versions=20for=2064=20bit=20offsets.?= =?UTF-8?q?=20-=20The=20new=20command=20line=20option=20-i=20can=20be=20us?= =?UTF-8?q?ed=20to=20set=20an=20"instance=20id",=20which=20will=20=20=20be?= =?UTF-8?q?=20used=20to=20distinguish=20recordings=20of=20the=20same=20bro?= =?UTF-8?q?adcast=20made=20by=20different=20instances=20=20=20of=20VDR=20(?= =?UTF-8?q?suggested=20by=20Frank=20Schmirler).=20This=20replaces=20the=20?= =?UTF-8?q?use=20of=20the=20"resume=20id"=20=20=20that=20was=20introduced?= =?UTF-8?q?=20in=20version=201.7.3.=20-=20Added=20checking=20mutexCurrentA?= =?UTF-8?q?udioTrack=20to=20cDevice::PlayTs()=20(thanks=20to=20Reinhard=20?= =?UTF-8?q?=20=20Nissl=20for=20pointing=20this=20out).=20-=20Fixed=20handl?= =?UTF-8?q?ing=20the=20pointer=20field=20in=20cPatPmtParser::ParsePmt()=20?= =?UTF-8?q?(thanks=20to=20Frank=20=20=20Schmirler=20-=20sorry=20I=20swappe?= =?UTF-8?q?d=20two=20lines=20when=20adopting=20the=20original=20patch).=20?= =?UTF-8?q?-=20Checking=20the=20remaining=20packet=20length=20after=20proc?= =?UTF-8?q?essing=20the=20pointer=20field=20in=20=20=20cPatPmtParser::Pars?= =?UTF-8?q?ePat()=20and=20cPatPmtParser::ParsePmt()=20(suggested=20by=20Fr?= =?UTF-8?q?ank=20=20=20Schmirler).=20-=20Checking=20the=20pointer=20field?= =?UTF-8?q?=20in=20cPatPmtParser::ParsePmt()=20only=20in=20'payload=20star?= =?UTF-8?q?t'=20=20=20packets=20(suggested=20by=20Frank=20Schmirler).=20-?= =?UTF-8?q?=20Changed=20cPatPmtGenerator=20to=20make=20sure=20the=20PMT=20?= =?UTF-8?q?pid=20doesn't=20collide=20with=20any=20of=20=20=20the=20actual?= =?UTF-8?q?=20pids=20of=20the=20channel.=20-=20Fixed=20cDevice::PlayTsAudi?= =?UTF-8?q?o()=20and=20made=20cDevice::PlayTsVideo()=20return=200=20if=20?= =?UTF-8?q?=20=20PlayVideo()=20didn't=20play=20anything.=20-=20Added=20an?= =?UTF-8?q?=20'int'=20typecast=20to=20calculations=20involving=20FramesPer?= =?UTF-8?q?Second()=20to=20avoid=20=20=20compiler=20warnings=20(reported?= =?UTF-8?q?=20by=20Winfried=20Koehler).=20-=20Fixed=20detecting=20frames?= =?UTF-8?q?=20for=20pure=20audio=20recordings.=20-=20Fixed=20editing=20PES?= =?UTF-8?q?=20recordings.=20The=20frame=20type=20in=20the=20index.vdr=20fi?= =?UTF-8?q?le=20generated=20for=20=20=20the=20edited=20PES=20recording=20i?= =?UTF-8?q?s=20set=20to=201=20for=20I-frames=20and=202=20for=20all=20other?= =?UTF-8?q?s=20(P-=20and=20=20=20B-frames).=20The=20exact=20frame=20type?= =?UTF-8?q?=20doesn't=20matter=20for=20VDR,=20it=20only=20needs=20to=20kno?= =?UTF-8?q?w=20if=20=20=20it's=20an=20I-frame=20or=20not.=20-=20The=20PAT/?= =?UTF-8?q?PMT=20is=20now=20only=20processed=20if=20its=20version=20change?= =?UTF-8?q?s=20(reported=20by=20Reinhard=20=20=20Nissl).=20-=20Fixed=20han?= =?UTF-8?q?dling=20the=20maximum=20video=20file=20size=20(reported=20by=20?= =?UTF-8?q?Udo=20Richter).=20-=20Improved=20fast-forward/-rewind=20for=20a?= =?UTF-8?q?udio=20recordings.=20The=20actual=20data=20is=20now=20sent=20?= =?UTF-8?q?=20=20to=20the=20output=20device,=20so=20that=20it=20can=20be?= =?UTF-8?q?=20replayed=20and=20thus=20cause=20the=20proper=20delay.=20=20?= =?UTF-8?q?=20For=20pure=20audio=20recordings=20the=20audio=20is=20no=20lo?= =?UTF-8?q?nger=20muted=20in=20fast-forward/-rewind=20=20=20mode,=20so=20t?= =?UTF-8?q?hat=20some=20orientation=20regarding=20the=20position=20within?= =?UTF-8?q?=20the=20recording=20is=20=20=20possible.=20There=20may=20still?= =?UTF-8?q?=20be=20some=20offset=20in=20the=20replay=20position=20displaye?= =?UTF-8?q?d=20by=20the=20=20=20progress=20indicator=20when=20switching=20?= =?UTF-8?q?from=20fast-forward/-rewind=20to=20play=20mode,=20as=20well=20?= =?UTF-8?q?=20=20as=20in=20the=20current=20position=20during=20normal=20pl?= =?UTF-8?q?ay=20mode.=20This=20is=20due=20to=20the=20various=20=20=20buffe?= =?UTF-8?q?rs=20between=20the=20player=20and=20the=20output=20device=20and?= =?UTF-8?q?=20will=20be=20addressed=20later.=20=20=20Note=20the=20new=20fu?= =?UTF-8?q?nction=20cDevice::IsPlayingVideo(),=20which=20is=20used=20to=20?= =?UTF-8?q?inform=20the=20=20=20player=20whether=20there=20is=20video=20da?= =?UTF-8?q?ta=20in=20the=20currently=20replayed=20stream.=20If=20a=20deriv?= =?UTF-8?q?ed=20=20=20cDevice=20class=20reimplements=20PlayTs()=20or=20Pla?= =?UTF-8?q?yPes(),=20it=20also=20needs=20to=20make=20sure=20this=20=20=20n?= =?UTF-8?q?ew=20function=20works=20as=20expected.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- device.c | 46 ++++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 22 deletions(-) (limited to 'device.c') diff --git a/device.c b/device.c index 8cd0b1e..1f806e0 100644 --- a/device.c +++ b/device.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: device.c 2.5 2009/01/06 09:55:13 kls Exp $ + * $Id: device.c 2.11 2009/01/25 11:10:56 kls Exp $ */ #include "device.h" @@ -81,6 +81,7 @@ cDevice::cDevice(void) startScrambleDetection = 0; player = NULL; + isPlayingVideo = false; ClrAvailableTracks(); currentAudioTrack = ttNone; currentAudioTrackMissingCount = 0; @@ -1020,12 +1021,11 @@ void cDevice::StillPicture(const uchar *Data, int Length) uchar *buf = NULL; int Size = 0; while (Length >= TS_SIZE) { - int PayloadOffset = TsPayloadOffset(Data); int Pid = TsPid(Data); if (Pid == 0) - patPmtParser.ParsePat(Data + PayloadOffset, TS_SIZE - PayloadOffset); + patPmtParser.ParsePat(Data, TS_SIZE); else if (Pid == patPmtParser.PmtPid()) - patPmtParser.ParsePmt(Data + PayloadOffset, TS_SIZE - PayloadOffset); + patPmtParser.ParsePmt(Data, TS_SIZE); else if (Pid == patPmtParser.Vpid()) { if (TsPayloadStart(Data)) { int l; @@ -1098,7 +1098,9 @@ void cDevice::Detach(cPlayer *Player) dvbSubtitleConverter = NULL; SetPlayMode(pmNone); SetVideoDisplayFormat(eVideoDisplayFormat(Setup.VideoDisplayFormat)); + PlayTs(NULL, 0); Audios.ClearAudio(); + isPlayingVideo = false; } } @@ -1151,6 +1153,7 @@ int cDevice::PlayPesPacket(const uchar *Data, int Length, bool VideoOnly) switch (c) { case 0xBE: // padding stream, needed for MPEG1 case 0xE0 ... 0xEF: // video + isPlayingVideo = true; w = PlayVideo(Start, d); break; case 0xC0 ... 0xDF: // audio @@ -1273,7 +1276,7 @@ int cDevice::PlayTsVideo(const uchar *Data, int Length) int l; while (const uchar *p = tsToPesVideo.GetPes(l)) { int w = PlayVideo(p, l); - if (w < 0) + if (w <= 0) return w; } tsToPesVideo.Reset(); @@ -1284,20 +1287,15 @@ int cDevice::PlayTsVideo(const uchar *Data, int Length) int cDevice::PlayTsAudio(const uchar *Data, int Length) { - bool PayloadStart = TsPayloadStart(Data); - for (int Pass = 0; Pass < 2; Pass++) { - if (Pass == 0 && !PayloadStart) // if no new payload is started, we can always put the packet into the converter - tsToPesAudio.PutTs(Data, Length); - if (const uchar *p = tsToPesAudio.GetPes(Length)) { - int w = PlayAudio(p, Length, 0); - if (w > 0) - tsToPesAudio.Reset(); - else if (PayloadStart) - return w; // must get out the old packet before starting a new one - } - if (Pass == 0 && PayloadStart) - tsToPesAudio.PutTs(Data, Length); - } + // Audio PES always has an explicit length and consists of single packets: + int l; + if (const uchar *p = tsToPesAudio.GetPes(l)) { + int w = PlayAudio(p, l, 0); + if (w <= 0) + return w; + tsToPesAudio.Reset(); + } + tsToPesAudio.PutTs(Data, Length); return Length; } @@ -1321,13 +1319,16 @@ int cDevice::PlayTs(const uchar *Data, int Length, bool VideoOnly) return Length; // silently ignore TS packets w/o payload int PayloadOffset = TsPayloadOffset(Data); if (PayloadOffset < Length) { + cMutexLock MutexLock(&mutexCurrentAudioTrack); int Pid = TsPid(Data); if (Pid == 0) - patPmtParser.ParsePat(Data + PayloadOffset, Length - PayloadOffset); + patPmtParser.ParsePat(Data, Length); else if (Pid == patPmtParser.PmtPid()) - patPmtParser.ParsePmt(Data + PayloadOffset, Length - PayloadOffset); - else if (Pid == patPmtParser.Vpid()) + patPmtParser.ParsePmt(Data, Length); + else if (Pid == patPmtParser.Vpid()) { + isPlayingVideo = true; return PlayTsVideo(Data, Length); + } else if (Pid == availableTracks[currentAudioTrack].id) { if (!VideoOnly || HasIBPTrickSpeed()) { int w = PlayTsAudio(Data, Length); @@ -1344,6 +1345,7 @@ int cDevice::PlayTs(const uchar *Data, int Length, bool VideoOnly) } } else if (Data == NULL) { + patPmtParser.Reset(); tsToPesVideo.Reset(); tsToPesAudio.Reset(); tsToPesSubtitle.Reset(); -- cgit v1.2.3