diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2003-04-27 09:55:53 +0200 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2003-04-27 09:55:53 +0200 |
commit | 9c3ff6e8da0311ad7c2bd4617e018f6e573baabd (patch) | |
tree | 4e693cf7f3522142468d0463525fd7b2856bbceb | |
parent | 65b9d4a97f3a00865f8d578635f8ac2947c62cbb (diff) | |
download | vdr-9c3ff6e8da0311ad7c2bd4617e018f6e573baabd.tar.gz vdr-9c3ff6e8da0311ad7c2bd4617e018f6e573baabd.tar.bz2 |
Setting the 'broken link' flag for GOPs during replay when necessary
-rw-r--r-- | dvbplayer.c | 14 | ||||
-rw-r--r-- | ringbuffer.c | 14 | ||||
-rw-r--r-- | ringbuffer.h | 12 |
3 files changed, 24 insertions, 16 deletions
diff --git a/dvbplayer.c b/dvbplayer.c index f71c69cc..afd42789 100644 --- a/dvbplayer.c +++ b/dvbplayer.c @@ -4,12 +4,13 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: dvbplayer.c 1.19 2003/03/30 12:51:51 kls Exp $ + * $Id: dvbplayer.c 1.20 2003/04/27 09:55:53 kls Exp $ */ #include "dvbplayer.h" #include <stdlib.h> #include "recording.h" +#include "remux.h" #include "ringbuffer.h" #include "thread.h" #include "tools.h" @@ -190,6 +191,7 @@ private: bool eof; bool active; bool running; + bool firstPacket; ePlayModes playMode; ePlayDirs playDir; int trickSpeed; @@ -197,7 +199,7 @@ private: bool canToggleAudioTrack; uchar audioTrack; cFrame *readFrame; - const cFrame *playFrame; + cFrame *playFrame; void TrickSpeed(int Increment); void Empty(void); void StripAudioPackets(uchar *b, int Length, uchar Except = 0x00); @@ -240,6 +242,7 @@ cDvbPlayer::cDvbPlayer(const char *FileName) eof = false; active = true; running = false; + firstPacket = true; playMode = pmPlay; playDir = pdForward; trickSpeed = NORMAL_SPEED; @@ -307,6 +310,7 @@ void cDvbPlayer::Empty(void) ringBuffer->Clear(); backTrace->Clear(); DeviceClear(); + firstPacket = true; } void cDvbPlayer::StripAudioPackets(uchar *b, int Length, uchar Except) @@ -403,7 +407,7 @@ void cDvbPlayer::Action(void) dsyslog("dvbplayer thread started (pid=%d)", getpid()); uchar *b = NULL; - const uchar *p = NULL; + uchar *p = NULL; int pc = 0; readIndex = Resume(); @@ -510,6 +514,10 @@ void cDvbPlayer::Action(void) if (!p) { p = playFrame->Data(); pc = playFrame->Count(); + if (firstPacket) { + cRemux::SetBrokenLink(p, pc); + firstPacket = false; + } } if (p) { int w = PlayVideo(p, pc); diff --git a/ringbuffer.c b/ringbuffer.c index 9eecbba1..6913c71f 100644 --- a/ringbuffer.c +++ b/ringbuffer.c @@ -7,7 +7,7 @@ * Parts of this file were inspired by the 'ringbuffy.c' from the * LinuxDVB driver (see linuxtv.org). * - * $Id: ringbuffer.c 1.14 2003/02/15 13:21:50 kls Exp $ + * $Id: ringbuffer.c 1.15 2003/04/27 09:54:32 kls Exp $ */ #include "ringbuffer.h" @@ -142,9 +142,9 @@ int cRingBufferLinear::Put(const uchar *Data, int Count) return Count; } -const uchar *cRingBufferLinear::Get(int &Count) +uchar *cRingBufferLinear::Get(int &Count) { - const uchar *p = NULL; + uchar *p = NULL; Lock(); if (getThreadPid < 0) getThreadPid = getpid(); @@ -224,7 +224,7 @@ cRingBufferFrame::~cRingBufferFrame() void cRingBufferFrame::Clear(void) { Lock(); - const cFrame *p; + cFrame *p; while ((p = Get()) != NULL) Drop(p); Unlock(); @@ -252,7 +252,7 @@ bool cRingBufferFrame::Put(cFrame *Frame) return false; } -const cFrame *cRingBufferFrame::Get(void) +cFrame *cRingBufferFrame::Get(void) { Lock(); cFrame *p = head ? head->next : NULL; @@ -260,13 +260,13 @@ const cFrame *cRingBufferFrame::Get(void) return p; } -void cRingBufferFrame::Delete(const cFrame *Frame) +void cRingBufferFrame::Delete(cFrame *Frame) { currentFill -= Frame->Count(); delete Frame; } -void cRingBufferFrame::Drop(const cFrame *Frame) +void cRingBufferFrame::Drop(cFrame *Frame) { Lock(); if (head) { diff --git a/ringbuffer.h b/ringbuffer.h index 9205df7f..0ce0a485 100644 --- a/ringbuffer.h +++ b/ringbuffer.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: ringbuffer.h 1.9 2003/01/26 09:47:39 kls Exp $ + * $Id: ringbuffer.h 1.10 2003/04/27 09:55:08 kls Exp $ */ #ifndef __RINGBUFFER_H @@ -56,7 +56,7 @@ public: int Put(const uchar *Data, int Count); ///< Puts at most Count bytes of Data into the ring buffer. ///< \return Returns the number of bytes actually stored. - const uchar *Get(int &Count); + uchar *Get(int &Count); ///< Gets data from the ring buffer. ///< The data will remain in the buffer until a call to Del() deletes it. ///< \return Returns a pointer to the data, and stores the number of bytes @@ -83,7 +83,7 @@ public: ///< If Count is negative, the cFrame object will take ownership of the given ///< Data. Otherwise it will allocate Count bytes of memory and copy Data. ~cFrame(); - const uchar *Data(void) const { return data; } + uchar *Data(void) const { return data; } int Count(void) const { return count; } eFrameType Type(void) const { return type; } int Index(void) const { return index; } @@ -93,7 +93,7 @@ class cRingBufferFrame : public cRingBuffer { private: cFrame *head; int currentFill; - void Delete(const cFrame *Frame); + void Delete(cFrame *Frame); public: cRingBufferFrame(int Size, bool Statistics = false); virtual ~cRingBufferFrame(); @@ -103,10 +103,10 @@ public: bool Put(cFrame *Frame); // Puts the Frame into the ring buffer. // Returns true if this was possible. - const cFrame *Get(void); + cFrame *Get(void); // Gets the next frame from the ring buffer. // The actual data still remains in the buffer until Drop() is called. - void Drop(const cFrame *Frame); + void Drop(cFrame *Frame); // Drops the Frame that has just been fetched with Get(). }; |