summaryrefslogtreecommitdiff
path: root/device.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <kls (at) cadsoft (dot) de>2009-01-25 13:13:00 +0100
committerKlaus Schmidinger <kls (at) cadsoft (dot) de>2009-01-25 13:13:00 +0100
commit084e16c057ab195a76c2117c631a2fe10a904238 (patch)
tree5506d63dbe1fca2f785017aefd6c9ee03e79c291 /device.c
parentc2966475942fcb9d4b8d41dbf026ff57630a1ad6 (diff)
downloadvdr-patch-lnbsharing-084e16c057ab195a76c2117c631a2fe10a904238.tar.gz
vdr-patch-lnbsharing-084e16c057ab195a76c2117c631a2fe10a904238.tar.bz2
Version 1.7.4vdr-1.7.4
- Removed the '#define FE_CAN_2ND_GEN_MODULATION', since it was wrong and the flag is now in the driver, anyway. - The full-featured DVB cards are now given the TS data directly for replay (thanks to Oliver Endriss for enhancing the av7110 driver to make it replay TS data). The patch from ftp://ftp.cadsoft.de/vdr/Developer/av7110_ts_replay__1.diff implements this change in the driver. The patch av7110_v4ldvb_api5_audiobuf_test_1.diff mentioned in version 1.7.2 is still necessary to avoid audio and video glitches on some channels. - Added a typecast in cUnbufferedFile::Write() to avoid an error message when compiling on 64 bit systems. - Added some missing 'const' statements to cBitmap (thanks to Andreas Regel). - Fixed returning complete PES packets in cTsToPes::GetPes() (thanks to Reinhard Nissl). - Added a missing Detach() in cTransfer::Activate() (thanks to Marco Schlüßler). - Added clearing the TS buffers in cDevice::Detach() (thanks to Marco Schlüßler). - Fixed incrementing the continuity counter in cPatPmtGenerator::GetPmt() (thanks to Johann Friedrichs). - Fixed removing deleted recordings in case there is a problem. Once a recording caused a problem with removing, no others were removed any more and an ongoing recording could fill up the disk and cause other recordings to be deleted automatically (reported by Reinhard Nissl). - Added "DEFINES += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE" to Make.config.template (thanks to Johann Friedrichs for pointing this out). Plugin authors should add this line to their Makefile or Make.config if they use file access functions that need special versions for 64 bit offsets. - The new command line option -i can be used to set an "instance id", which will be used to distinguish recordings of the same broadcast made by different instances of VDR (suggested by Frank Schmirler). This replaces the use of the "resume id" that was introduced in version 1.7.3. - Added checking mutexCurrentAudioTrack to cDevice::PlayTs() (thanks to Reinhard Nissl for pointing this out). - Fixed handling the pointer field in cPatPmtParser::ParsePmt() (thanks to Frank Schmirler - sorry I swapped two lines when adopting the original patch). - Checking the remaining packet length after processing the pointer field in cPatPmtParser::ParsePat() and cPatPmtParser::ParsePmt() (suggested by Frank Schmirler). - Checking the pointer field in cPatPmtParser::ParsePmt() only in 'payload start' packets (suggested by Frank Schmirler). - Changed cPatPmtGenerator to make sure the PMT pid doesn't collide with any of the actual pids of the channel. - Fixed cDevice::PlayTsAudio() and made cDevice::PlayTsVideo() return 0 if PlayVideo() didn't play anything. - Added an 'int' typecast to calculations involving FramesPerSecond() to avoid compiler warnings (reported by Winfried Koehler). - Fixed detecting frames for pure audio recordings. - Fixed editing PES recordings. The frame type in the index.vdr file generated for the edited PES recording is set to 1 for I-frames and 2 for all others (P- and B-frames). The exact frame type doesn't matter for VDR, it only needs to know if it's an I-frame or not. - The PAT/PMT is now only processed if its version changes (reported by Reinhard Nissl). - Fixed handling the maximum video file size (reported by Udo Richter). - Improved fast-forward/-rewind for audio recordings. The actual data is now sent to the output device, so that it can be replayed and thus cause the proper delay. For pure audio recordings the audio is no longer muted in fast-forward/-rewind mode, so that some orientation regarding the position within the recording is possible. There may still be some offset in the replay position displayed by the progress indicator when switching from fast-forward/-rewind to play mode, as well as in the current position during normal play mode. This is due to the various buffers between the player and the output device and will be addressed later. Note the new function cDevice::IsPlayingVideo(), which is used to inform the player whether there is video data in the currently replayed stream. If a derived cDevice class reimplements PlayTs() or PlayPes(), it also needs to make sure this new function works as expected.
Diffstat (limited to 'device.c')
-rw-r--r--device.c46
1 files changed, 24 insertions, 22 deletions
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();