mirror of
https://projects.vdr-developer.org/git/vdr-plugin-streamdev.git
synced 2023-10-10 19:16:51 +02:00
now there's a common baseclass for all remuxers, make use of it
Modified Files: Tag: v0_4 HISTORY remux/ts2pes.c remux/ts2pes.h remux/tsremux.h server/livestreamer.c server/livestreamer.h
This commit is contained in:
parent
412c6982b6
commit
abb8e80033
1
HISTORY
1
HISTORY
@ -1,6 +1,7 @@
|
|||||||
VDR Plugin 'streamdev' Revision History
|
VDR Plugin 'streamdev' Revision History
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
|
|
||||||
|
- now there's a common baseclass for all remuxers, make use of it
|
||||||
- added namespace to remuxers
|
- added namespace to remuxers
|
||||||
- increased WRITERBUFSIZE - buffer was too small for high bandwidth content
|
- increased WRITERBUFSIZE - buffer was too small for high bandwidth content
|
||||||
- removed cStreamdevStreamer::m_Running
|
- removed cStreamdevStreamer::m_Running
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
* The cRepacker family's code was originally written by Reinhard Nissl <rnissl@gmx.de>,
|
* The cRepacker family's code was originally written by Reinhard Nissl <rnissl@gmx.de>,
|
||||||
* and adapted to the VDR coding style by Klaus.Schmidinger@cadsoft.de.
|
* and adapted to the VDR coding style by Klaus.Schmidinger@cadsoft.de.
|
||||||
*
|
*
|
||||||
* $Id: ts2pes.c,v 1.1.2.2 2009/06/29 06:25:28 schmirl Exp $
|
* $Id: ts2pes.c,v 1.1.2.3 2009/06/30 06:03:16 schmirl Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "remux/ts2pes.h"
|
#include "remux/ts2pes.h"
|
||||||
@ -1907,7 +1907,7 @@ int cTS2PESRemux::Put(const uchar *Data, int Count)
|
|||||||
return used;
|
return used;
|
||||||
}
|
}
|
||||||
|
|
||||||
uchar *cTS2PESRemux::Get(int &Count, uchar *PictureType)
|
uchar *cTS2PESRemux::Get(int &Count)
|
||||||
{
|
{
|
||||||
// Remove any previously skipped data from the result buffer:
|
// Remove any previously skipped data from the result buffer:
|
||||||
|
|
||||||
@ -1916,18 +1916,8 @@ uchar *cTS2PESRemux::Get(int &Count, uchar *PictureType)
|
|||||||
resultSkipped = 0;
|
resultSkipped = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
// Test recording without determining the real frame borders:
|
|
||||||
if (PictureType)
|
|
||||||
*PictureType = I_FRAME;
|
|
||||||
return resultBuffer->Get(Count);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Check for frame borders:
|
// Check for frame borders:
|
||||||
|
|
||||||
if (PictureType)
|
|
||||||
*PictureType = NO_PICTURE;
|
|
||||||
|
|
||||||
Count = 0;
|
Count = 0;
|
||||||
uchar *resultData = NULL;
|
uchar *resultData = NULL;
|
||||||
int resultCount = 0;
|
int resultCount = 0;
|
||||||
@ -1948,8 +1938,6 @@ uchar *cTS2PESRemux::Get(int &Count, uchar *PictureType)
|
|||||||
}
|
}
|
||||||
else if (!synced) {
|
else if (!synced) {
|
||||||
if (pt == I_FRAME) {
|
if (pt == I_FRAME) {
|
||||||
if (PictureType)
|
|
||||||
*PictureType = pt;
|
|
||||||
resultSkipped = i; // will drop everything before this position
|
resultSkipped = i; // will drop everything before this position
|
||||||
cTSRemux::SetBrokenLink(data + i, l);
|
cTSRemux::SetBrokenLink(data + i, l);
|
||||||
synced = true;
|
synced = true;
|
||||||
@ -1957,8 +1945,6 @@ uchar *cTS2PESRemux::Get(int &Count, uchar *PictureType)
|
|||||||
}
|
}
|
||||||
else if (Count)
|
else if (Count)
|
||||||
return resultData;
|
return resultData;
|
||||||
else if (PictureType)
|
|
||||||
*PictureType = pt;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else { //if (AUDIO_STREAM_S <= StreamType && StreamType <= AUDIO_STREAM_E || StreamType == PRIVATE_STREAM1) {
|
else { //if (AUDIO_STREAM_S <= StreamType && StreamType <= AUDIO_STREAM_E || StreamType == PRIVATE_STREAM1) {
|
||||||
@ -1967,15 +1953,11 @@ uchar *cTS2PESRemux::Get(int &Count, uchar *PictureType)
|
|||||||
return resultData;
|
return resultData;
|
||||||
if (noVideo) {
|
if (noVideo) {
|
||||||
if (!synced) {
|
if (!synced) {
|
||||||
if (PictureType)
|
|
||||||
*PictureType = I_FRAME;
|
|
||||||
resultSkipped = i; // will drop everything before this position
|
resultSkipped = i; // will drop everything before this position
|
||||||
synced = true;
|
synced = true;
|
||||||
}
|
}
|
||||||
else if (Count)
|
else if (Count)
|
||||||
return resultData;
|
return resultData;
|
||||||
else if (PictureType)
|
|
||||||
*PictureType = I_FRAME;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (synced) {
|
if (synced) {
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* This file is based on a copy of remux.h from Klaus Schmidinger's
|
* This file is based on a copy of remux.h from Klaus Schmidinger's
|
||||||
* VDR, version 1.6.0.
|
* VDR, version 1.6.0.
|
||||||
*
|
*
|
||||||
* $Id: ts2pes.h,v 1.2.2.2 2009/06/29 06:25:28 schmirl Exp $
|
* $Id: ts2pes.h,v 1.2.2.3 2009/06/30 06:03:16 schmirl Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef VDR_STREAMDEV_TS2PES_H
|
#ifndef VDR_STREAMDEV_TS2PES_H
|
||||||
@ -38,11 +38,9 @@ public:
|
|||||||
int Put(const uchar *Data, int Count);
|
int Put(const uchar *Data, int Count);
|
||||||
///< Puts at most Count bytes of Data into the remuxer.
|
///< Puts at most Count bytes of Data into the remuxer.
|
||||||
///< \return Returns the number of bytes actually consumed from Data.
|
///< \return Returns the number of bytes actually consumed from Data.
|
||||||
uchar *Get(int &Count, uchar *PictureType = NULL);
|
uchar *Get(int &Count);
|
||||||
///< Gets all currently available data from the remuxer.
|
///< Gets all currently available data from the remuxer.
|
||||||
///< \return Count contains the number of bytes the result points to, and
|
///< \return Count contains the number of bytes the result points to, and
|
||||||
///< PictureType (if not NULL) will contain one of NO_PICTURE, I_FRAME, P_FRAME
|
|
||||||
///< or B_FRAME.
|
|
||||||
void Del(int Count);
|
void Del(int Count);
|
||||||
///< Deletes Count bytes from the remuxer. Count must be the number returned
|
///< Deletes Count bytes from the remuxer. Count must be the number returned
|
||||||
///< from a previous call to Get(). Several calls to Del() with fractions of
|
///< from a previous call to Get(). Several calls to Del() with fractions of
|
||||||
|
@ -14,6 +14,10 @@ namespace Streamdev {
|
|||||||
|
|
||||||
class cTSRemux {
|
class cTSRemux {
|
||||||
public:
|
public:
|
||||||
|
virtual int Put(const uchar *Data, int Count) = 0;
|
||||||
|
virtual uchar *Get(int &Count) = 0;
|
||||||
|
virtual void Del(int Count) = 0;
|
||||||
|
|
||||||
static void SetBrokenLink(uchar *Data, int Length);
|
static void SetBrokenLink(uchar *Data, int Length);
|
||||||
static int GetPid(const uchar *Data);
|
static int GetPid(const uchar *Data);
|
||||||
static int GetPacketLength(const uchar *Data, int Count, int Offset);
|
static int GetPacketLength(const uchar *Data, int Count, int Offset);
|
||||||
|
@ -349,10 +349,7 @@ cStreamdevLiveStreamer::cStreamdevLiveStreamer(int Priority, std::string Paramet
|
|||||||
m_Device(NULL),
|
m_Device(NULL),
|
||||||
m_Receiver(NULL),
|
m_Receiver(NULL),
|
||||||
m_PatFilter(NULL),
|
m_PatFilter(NULL),
|
||||||
m_PESRemux(NULL),
|
m_Remux(NULL)
|
||||||
m_ESRemux(NULL),
|
|
||||||
m_PSRemux(NULL),
|
|
||||||
m_ExtRemux(NULL)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -365,10 +362,7 @@ cStreamdevLiveStreamer::~cStreamdevLiveStreamer()
|
|||||||
DELETENULL(m_PatFilter);
|
DELETENULL(m_PatFilter);
|
||||||
}
|
}
|
||||||
DELETENULL(m_Receiver);
|
DELETENULL(m_Receiver);
|
||||||
delete m_PESRemux;
|
delete m_Remux;
|
||||||
delete m_ESRemux;
|
|
||||||
delete m_PSRemux;
|
|
||||||
delete m_ExtRemux;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cStreamdevLiveStreamer::HasPid(int Pid)
|
bool cStreamdevLiveStreamer::HasPid(int Pid)
|
||||||
@ -479,17 +473,17 @@ bool cStreamdevLiveStreamer::SetChannel(const cChannel *Channel, eStreamType Str
|
|||||||
int pid = ISRADIO(m_Channel) ? m_Channel->Apid(0) : m_Channel->Vpid();
|
int pid = ISRADIO(m_Channel) ? m_Channel->Apid(0) : m_Channel->Vpid();
|
||||||
if (Apid != 0)
|
if (Apid != 0)
|
||||||
pid = Apid;
|
pid = Apid;
|
||||||
m_ESRemux = new cTS2ESRemux(pid);
|
m_Remux = new cTS2ESRemux(pid);
|
||||||
return SetPids(pid);
|
return SetPids(pid);
|
||||||
}
|
}
|
||||||
|
|
||||||
case stPES:
|
case stPES:
|
||||||
m_PESRemux = new cTS2PESRemux(m_Channel->Vpid(), m_Channel->Apids(), m_Channel->Dpids(),
|
m_Remux = new cTS2PESRemux(m_Channel->Vpid(), m_Channel->Apids(), m_Channel->Dpids(),
|
||||||
m_Channel->Spids());
|
m_Channel->Spids());
|
||||||
return SetPids(m_Channel->Vpid(), Apids, Dpids, m_Channel->Spids());
|
return SetPids(m_Channel->Vpid(), Apids, Dpids, m_Channel->Spids());
|
||||||
|
|
||||||
case stPS:
|
case stPS:
|
||||||
m_PSRemux = new cTS2PSRemux(m_Channel->Vpid(), m_Channel->Apids(), m_Channel->Dpids(),
|
m_Remux = new cTS2PSRemux(m_Channel->Vpid(), m_Channel->Apids(), m_Channel->Dpids(),
|
||||||
m_Channel->Spids());
|
m_Channel->Spids());
|
||||||
return SetPids(m_Channel->Vpid(), Apids, Dpids, m_Channel->Spids());
|
return SetPids(m_Channel->Vpid(), Apids, Dpids, m_Channel->Spids());
|
||||||
|
|
||||||
@ -508,7 +502,7 @@ bool cStreamdevLiveStreamer::SetChannel(const cChannel *Channel, eStreamType Str
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
case stExtern:
|
case stExtern:
|
||||||
m_ExtRemux = new cExternRemux(m_Channel->Vpid(), m_Channel->Apids(), m_Channel->Dpids(),
|
m_Remux = new cExternRemux(m_Channel->Vpid(), m_Channel->Apids(), m_Channel->Dpids(),
|
||||||
m_Channel->Spids(), m_Parameter);
|
m_Channel->Spids(), m_Parameter);
|
||||||
return SetPids(m_Channel->Vpid(), Apids, Dpids, m_Channel->Spids());
|
return SetPids(m_Channel->Vpid(), Apids, Dpids, m_Channel->Spids());
|
||||||
|
|
||||||
@ -521,87 +515,39 @@ bool cStreamdevLiveStreamer::SetChannel(const cChannel *Channel, eStreamType Str
|
|||||||
|
|
||||||
int cStreamdevLiveStreamer::Put(const uchar *Data, int Count)
|
int cStreamdevLiveStreamer::Put(const uchar *Data, int Count)
|
||||||
{
|
{
|
||||||
switch (m_StreamType) {
|
// insert si data
|
||||||
case stTS:
|
if (m_PatFilter) {
|
||||||
// insert si data
|
int siCount;
|
||||||
if (m_PatFilter) {
|
uchar *siData = m_PatFilter->Get(siCount);
|
||||||
int got;
|
if (siData) {
|
||||||
uchar *si = m_PatFilter->Get(got);
|
if (m_Remux)
|
||||||
if (si) {
|
siCount = m_Remux->Put(siData, siCount);
|
||||||
int count = cStreamdevStreamer::Put(si, got);
|
else
|
||||||
if (count)
|
siCount = cStreamdevStreamer::Put(siData, siCount);
|
||||||
m_PatFilter->Del(count);
|
if (siCount)
|
||||||
}
|
m_PatFilter->Del(siCount);
|
||||||
}
|
}
|
||||||
// fall through
|
|
||||||
case stTSPIDS:
|
|
||||||
return cStreamdevStreamer::Put(Data, Count);
|
|
||||||
|
|
||||||
case stPES:
|
|
||||||
return m_PESRemux->Put(Data, Count);
|
|
||||||
|
|
||||||
case stES:
|
|
||||||
return m_ESRemux->Put(Data, Count);
|
|
||||||
|
|
||||||
case stPS:
|
|
||||||
return m_PSRemux->Put(Data, Count);
|
|
||||||
|
|
||||||
case stExtern:
|
|
||||||
return m_ExtRemux->Put(Data, Count);
|
|
||||||
|
|
||||||
default: // shouldn't happen???
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
if (m_Remux)
|
||||||
|
return m_Remux->Put(Data, Count);
|
||||||
|
else
|
||||||
|
return cStreamdevStreamer::Put(Data, Count);
|
||||||
}
|
}
|
||||||
|
|
||||||
uchar *cStreamdevLiveStreamer::Get(int &Count)
|
uchar *cStreamdevLiveStreamer::Get(int &Count)
|
||||||
{
|
{
|
||||||
switch (m_StreamType) {
|
if (m_Remux)
|
||||||
case stTS:
|
return m_Remux->Get(Count);
|
||||||
case stTSPIDS:
|
else
|
||||||
return cStreamdevStreamer::Get(Count);
|
return cStreamdevStreamer::Get(Count);
|
||||||
|
|
||||||
case stPES:
|
|
||||||
return m_PESRemux->Get(Count);
|
|
||||||
|
|
||||||
case stES:
|
|
||||||
return m_ESRemux->Get(Count);
|
|
||||||
|
|
||||||
case stPS:
|
|
||||||
return m_PSRemux->Get(Count);
|
|
||||||
|
|
||||||
case stExtern:
|
|
||||||
return m_ExtRemux->Get(Count);
|
|
||||||
|
|
||||||
default: // shouldn't happen???
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void cStreamdevLiveStreamer::Del(int Count)
|
void cStreamdevLiveStreamer::Del(int Count)
|
||||||
{
|
{
|
||||||
switch (m_StreamType) {
|
if (m_Remux)
|
||||||
case stTS:
|
m_Remux->Del(Count);
|
||||||
case stTSPIDS:
|
else
|
||||||
cStreamdevStreamer::Del(Count);
|
cStreamdevStreamer::Del(Count);
|
||||||
break;
|
|
||||||
|
|
||||||
case stPES:
|
|
||||||
m_PESRemux->Del(Count);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case stES:
|
|
||||||
m_ESRemux->Del(Count);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case stPS:
|
|
||||||
m_PSRemux->Del(Count);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case stExtern:
|
|
||||||
m_ExtRemux->Del(Count);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void cStreamdevLiveStreamer::Attach(void)
|
void cStreamdevLiveStreamer::Attach(void)
|
||||||
|
@ -5,13 +5,11 @@
|
|||||||
#include <vdr/receiver.h>
|
#include <vdr/receiver.h>
|
||||||
|
|
||||||
#include "server/streamer.h"
|
#include "server/streamer.h"
|
||||||
|
#include "remux/tsremux.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
namespace Streamdev {
|
namespace Streamdev {
|
||||||
class cTS2PSRemux;
|
class cTSRemux;
|
||||||
class cTS2ESRemux;
|
|
||||||
class cExternRemux;
|
|
||||||
class cTS2PESRemux;
|
|
||||||
}
|
}
|
||||||
class cStreamdevPatFilter;
|
class cStreamdevPatFilter;
|
||||||
class cStreamdevLiveReceiver;
|
class cStreamdevLiveReceiver;
|
||||||
@ -29,10 +27,7 @@ private:
|
|||||||
cDevice *m_Device;
|
cDevice *m_Device;
|
||||||
cStreamdevLiveReceiver *m_Receiver;
|
cStreamdevLiveReceiver *m_Receiver;
|
||||||
cStreamdevPatFilter *m_PatFilter;
|
cStreamdevPatFilter *m_PatFilter;
|
||||||
Streamdev::cTS2PESRemux *m_PESRemux;
|
Streamdev::cTSRemux *m_Remux;
|
||||||
Streamdev::cTS2ESRemux *m_ESRemux;
|
|
||||||
Streamdev::cTS2PSRemux *m_PSRemux;
|
|
||||||
Streamdev::cExternRemux *m_ExtRemux;
|
|
||||||
|
|
||||||
void StartReceiver(void);
|
void StartReceiver(void);
|
||||||
bool HasPid(int Pid);
|
bool HasPid(int Pid);
|
||||||
|
Loading…
Reference in New Issue
Block a user