mirror of
https://github.com/vdr-projects/vdr.git
synced 2025-03-01 10:50:46 +00:00
Setting the 'broken link' flag for GOPs during replay when necessary
This commit is contained in:
parent
65b9d4a97f
commit
9c3ff6e8da
14
dvbplayer.c
14
dvbplayer.c
@ -4,12 +4,13 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* 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 "dvbplayer.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "recording.h"
|
#include "recording.h"
|
||||||
|
#include "remux.h"
|
||||||
#include "ringbuffer.h"
|
#include "ringbuffer.h"
|
||||||
#include "thread.h"
|
#include "thread.h"
|
||||||
#include "tools.h"
|
#include "tools.h"
|
||||||
@ -190,6 +191,7 @@ private:
|
|||||||
bool eof;
|
bool eof;
|
||||||
bool active;
|
bool active;
|
||||||
bool running;
|
bool running;
|
||||||
|
bool firstPacket;
|
||||||
ePlayModes playMode;
|
ePlayModes playMode;
|
||||||
ePlayDirs playDir;
|
ePlayDirs playDir;
|
||||||
int trickSpeed;
|
int trickSpeed;
|
||||||
@ -197,7 +199,7 @@ private:
|
|||||||
bool canToggleAudioTrack;
|
bool canToggleAudioTrack;
|
||||||
uchar audioTrack;
|
uchar audioTrack;
|
||||||
cFrame *readFrame;
|
cFrame *readFrame;
|
||||||
const cFrame *playFrame;
|
cFrame *playFrame;
|
||||||
void TrickSpeed(int Increment);
|
void TrickSpeed(int Increment);
|
||||||
void Empty(void);
|
void Empty(void);
|
||||||
void StripAudioPackets(uchar *b, int Length, uchar Except = 0x00);
|
void StripAudioPackets(uchar *b, int Length, uchar Except = 0x00);
|
||||||
@ -240,6 +242,7 @@ cDvbPlayer::cDvbPlayer(const char *FileName)
|
|||||||
eof = false;
|
eof = false;
|
||||||
active = true;
|
active = true;
|
||||||
running = false;
|
running = false;
|
||||||
|
firstPacket = true;
|
||||||
playMode = pmPlay;
|
playMode = pmPlay;
|
||||||
playDir = pdForward;
|
playDir = pdForward;
|
||||||
trickSpeed = NORMAL_SPEED;
|
trickSpeed = NORMAL_SPEED;
|
||||||
@ -307,6 +310,7 @@ void cDvbPlayer::Empty(void)
|
|||||||
ringBuffer->Clear();
|
ringBuffer->Clear();
|
||||||
backTrace->Clear();
|
backTrace->Clear();
|
||||||
DeviceClear();
|
DeviceClear();
|
||||||
|
firstPacket = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cDvbPlayer::StripAudioPackets(uchar *b, int Length, uchar Except)
|
void cDvbPlayer::StripAudioPackets(uchar *b, int Length, uchar Except)
|
||||||
@ -403,7 +407,7 @@ void cDvbPlayer::Action(void)
|
|||||||
dsyslog("dvbplayer thread started (pid=%d)", getpid());
|
dsyslog("dvbplayer thread started (pid=%d)", getpid());
|
||||||
|
|
||||||
uchar *b = NULL;
|
uchar *b = NULL;
|
||||||
const uchar *p = NULL;
|
uchar *p = NULL;
|
||||||
int pc = 0;
|
int pc = 0;
|
||||||
|
|
||||||
readIndex = Resume();
|
readIndex = Resume();
|
||||||
@ -510,6 +514,10 @@ void cDvbPlayer::Action(void)
|
|||||||
if (!p) {
|
if (!p) {
|
||||||
p = playFrame->Data();
|
p = playFrame->Data();
|
||||||
pc = playFrame->Count();
|
pc = playFrame->Count();
|
||||||
|
if (firstPacket) {
|
||||||
|
cRemux::SetBrokenLink(p, pc);
|
||||||
|
firstPacket = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (p) {
|
if (p) {
|
||||||
int w = PlayVideo(p, pc);
|
int w = PlayVideo(p, pc);
|
||||||
|
14
ringbuffer.c
14
ringbuffer.c
@ -7,7 +7,7 @@
|
|||||||
* Parts of this file were inspired by the 'ringbuffy.c' from the
|
* Parts of this file were inspired by the 'ringbuffy.c' from the
|
||||||
* LinuxDVB driver (see linuxtv.org).
|
* 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"
|
#include "ringbuffer.h"
|
||||||
@ -142,9 +142,9 @@ int cRingBufferLinear::Put(const uchar *Data, int Count)
|
|||||||
return Count;
|
return Count;
|
||||||
}
|
}
|
||||||
|
|
||||||
const uchar *cRingBufferLinear::Get(int &Count)
|
uchar *cRingBufferLinear::Get(int &Count)
|
||||||
{
|
{
|
||||||
const uchar *p = NULL;
|
uchar *p = NULL;
|
||||||
Lock();
|
Lock();
|
||||||
if (getThreadPid < 0)
|
if (getThreadPid < 0)
|
||||||
getThreadPid = getpid();
|
getThreadPid = getpid();
|
||||||
@ -224,7 +224,7 @@ cRingBufferFrame::~cRingBufferFrame()
|
|||||||
void cRingBufferFrame::Clear(void)
|
void cRingBufferFrame::Clear(void)
|
||||||
{
|
{
|
||||||
Lock();
|
Lock();
|
||||||
const cFrame *p;
|
cFrame *p;
|
||||||
while ((p = Get()) != NULL)
|
while ((p = Get()) != NULL)
|
||||||
Drop(p);
|
Drop(p);
|
||||||
Unlock();
|
Unlock();
|
||||||
@ -252,7 +252,7 @@ bool cRingBufferFrame::Put(cFrame *Frame)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const cFrame *cRingBufferFrame::Get(void)
|
cFrame *cRingBufferFrame::Get(void)
|
||||||
{
|
{
|
||||||
Lock();
|
Lock();
|
||||||
cFrame *p = head ? head->next : NULL;
|
cFrame *p = head ? head->next : NULL;
|
||||||
@ -260,13 +260,13 @@ const cFrame *cRingBufferFrame::Get(void)
|
|||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cRingBufferFrame::Delete(const cFrame *Frame)
|
void cRingBufferFrame::Delete(cFrame *Frame)
|
||||||
{
|
{
|
||||||
currentFill -= Frame->Count();
|
currentFill -= Frame->Count();
|
||||||
delete Frame;
|
delete Frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cRingBufferFrame::Drop(const cFrame *Frame)
|
void cRingBufferFrame::Drop(cFrame *Frame)
|
||||||
{
|
{
|
||||||
Lock();
|
Lock();
|
||||||
if (head) {
|
if (head) {
|
||||||
|
12
ringbuffer.h
12
ringbuffer.h
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* 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
|
#ifndef __RINGBUFFER_H
|
||||||
@ -56,7 +56,7 @@ public:
|
|||||||
int Put(const uchar *Data, int Count);
|
int Put(const uchar *Data, int Count);
|
||||||
///< Puts at most Count bytes of Data into the ring buffer.
|
///< Puts at most Count bytes of Data into the ring buffer.
|
||||||
///< \return Returns the number of bytes actually stored.
|
///< \return Returns the number of bytes actually stored.
|
||||||
const uchar *Get(int &Count);
|
uchar *Get(int &Count);
|
||||||
///< Gets data from the ring buffer.
|
///< Gets data from the ring buffer.
|
||||||
///< The data will remain in the buffer until a call to Del() deletes it.
|
///< 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
|
///< \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
|
///< 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.
|
///< Data. Otherwise it will allocate Count bytes of memory and copy Data.
|
||||||
~cFrame();
|
~cFrame();
|
||||||
const uchar *Data(void) const { return data; }
|
uchar *Data(void) const { return data; }
|
||||||
int Count(void) const { return count; }
|
int Count(void) const { return count; }
|
||||||
eFrameType Type(void) const { return type; }
|
eFrameType Type(void) const { return type; }
|
||||||
int Index(void) const { return index; }
|
int Index(void) const { return index; }
|
||||||
@ -93,7 +93,7 @@ class cRingBufferFrame : public cRingBuffer {
|
|||||||
private:
|
private:
|
||||||
cFrame *head;
|
cFrame *head;
|
||||||
int currentFill;
|
int currentFill;
|
||||||
void Delete(const cFrame *Frame);
|
void Delete(cFrame *Frame);
|
||||||
public:
|
public:
|
||||||
cRingBufferFrame(int Size, bool Statistics = false);
|
cRingBufferFrame(int Size, bool Statistics = false);
|
||||||
virtual ~cRingBufferFrame();
|
virtual ~cRingBufferFrame();
|
||||||
@ -103,10 +103,10 @@ public:
|
|||||||
bool Put(cFrame *Frame);
|
bool Put(cFrame *Frame);
|
||||||
// Puts the Frame into the ring buffer.
|
// Puts the Frame into the ring buffer.
|
||||||
// Returns true if this was possible.
|
// Returns true if this was possible.
|
||||||
const cFrame *Get(void);
|
cFrame *Get(void);
|
||||||
// Gets the next frame from the ring buffer.
|
// Gets the next frame from the ring buffer.
|
||||||
// The actual data still remains in the buffer until Drop() is called.
|
// 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().
|
// Drops the Frame that has just been fetched with Get().
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user