Snapshot 2007-09-21

This commit is contained in:
Frank Schmirler 2010-12-02 09:00:32 +01:00
parent 5a270cc3ab
commit 7576173547
9 changed files with 63 additions and 29 deletions

View File

@ -1,5 +1,5 @@
/* /*
* $Id: device.c,v 1.13 2007/05/07 12:18:18 schmirl Exp $ * $Id: device.c,v 1.14 2007/07/20 06:46:47 schmirl Exp $
*/ */
#include "client/device.h" #include "client/device.h"
@ -51,12 +51,21 @@ cStreamdevDevice::cStreamdevDevice(void) {
cStreamdevDevice::~cStreamdevDevice() { cStreamdevDevice::~cStreamdevDevice() {
Dprintf("Device gets destructed\n"); Dprintf("Device gets destructed\n");
Lock();
m_Device = NULL; m_Device = NULL;
delete m_TSBuffer; m_Filters->SetConnection(-1);
delete m_Assembler; ClientSocket.Quit();
ClientSocket.Reset();
Unlock();
Cancel(3);
#if VDRVERSNUM >= 10300 #if VDRVERSNUM >= 10300
delete m_Filters; DELETENULL(m_Filters);
#endif #endif
DELETENULL(m_TSBuffer);
delete m_Assembler;
} }
bool cStreamdevDevice::ProvidesSource(int Source) const { bool cStreamdevDevice::ProvidesSource(int Source) const {
@ -216,7 +225,7 @@ void cStreamdevDevice::CloseDvr(void) {
} }
bool cStreamdevDevice::GetTSPacket(uchar *&Data) { bool cStreamdevDevice::GetTSPacket(uchar *&Data) {
if (m_TSBuffer) { if (m_TSBuffer && m_Device) {
Data = m_TSBuffer->Get(); Data = m_TSBuffer->Get();
#if 1 // TODO: this should be fixed in vdr cTSBuffer #if 1 // TODO: this should be fixed in vdr cTSBuffer
// simple disconnect detection // simple disconnect detection

View File

@ -1,5 +1,5 @@
/* /*
* $Id: common.c,v 1.4 2005/02/11 16:44:14 lordjaxom Exp $ * $Id: common.c,v 1.5 2007/09/21 11:55:56 schmirl Exp $
*/ */
#include <vdr/channels.h> #include <vdr/channels.h>
@ -11,7 +11,7 @@
using namespace std; using namespace std;
const char *VERSION = "0.3.3-20070509"; const char *VERSION = "0.3.3-20070921";
const char *StreamTypes[st_Count] = { const char *StreamTypes[st_Count] = {
"TS", "TS",
@ -270,7 +270,7 @@ eOSState cMenuEditIpItem::ProcessKey(eKeys Key) {
} else } else
curNum = curNum * 10 + (Key - k0); curNum = curNum * 10 + (Key - k0);
if (!step && (curNum * 10 > 255) || (curNum == 0)) { if ((curNum * 10 > 255) || (curNum == 0)) {
in_addr addr; in_addr addr;
addr.s_addr = inet_addr(value); addr.s_addr = inet_addr(value);
if ((int)addr.s_addr == -1) if ((int)addr.s_addr == -1)

View File

@ -559,11 +559,12 @@ istream & operator >> (istream & stream, PS_Packet & x){
p = stream.tellg(); p = stream.tellg();
while (!stream.eof() && !found && count < MAX_SEARCH) { while (!stream.eof() && !found && count < MAX_SEARCH) {
stream.read((char *)&headr,4); stream.read((char *)&headr,4);
if (headr[0] == 0x00 && headr[1] == 0x00 && headr[2] == 0x01) if (headr[0] == 0x00 && headr[1] == 0x00 && headr[2] == 0x01) {
if ( headr[3] == 0xBA ) if ( headr[3] == 0xBA )
found = 1; found = 1;
else if ( headr[3] == 0xB9 ) break; else if ( headr[3] == 0xB9 ) break;
else stream.seekg(p+streampos(1)); else stream.seekg(p+streampos(1));
}
count++; count++;
} }
@ -776,16 +777,16 @@ int tv_norm(istream &stream){
while (!stream.eof() && !found) { while (!stream.eof() && !found) {
p = stream.tellg(); p = stream.tellg();
stream.read((char *)headr,4); stream.read((char *)headr,4);
if (headr[0] == 0x00 && headr[1] == 0x00 && headr[2] == 0x01) if (headr[0] == 0x00 && headr[1] == 0x00 && headr[2] == 0x01) {
if ( headr[3] == 0xB5 ){ if ( headr[3] == 0xB5 ){
char *profile[] = {"reserved", "High", "Spatially Scalable", const char *profile[] = {"reserved", "High", "Spatially Scalable",
"SNR Scalable", "Main", "Simple", "undef", "SNR Scalable", "Main", "Simple", "undef",
"undef"}; "undef"};
char *level[] = {"res", "res", "res", "res", const char *level[] = {"res", "res", "res", "res",
"High","res", "High 1440", "res", "High","res", "High 1440", "res",
"Main","res", "Low", "res", "Main","res", "Low", "res",
"res", "res", "res", "res"}; "res", "res", "res", "res"};
char *chroma[] = {"res", "4:2:0", "4:2:2", "4:4:4:"}; const char *chroma[] = {"res", "4:2:0", "4:2:2", "4:4:4:"};
mpeg = 2; mpeg = 2;
stream.read((char *)headr,4); stream.read((char *)headr,4);
cerr << "PROFILE: " << profile[headr[0] & 0x7] << endl; cerr << "PROFILE: " << profile[headr[0] & 0x7] << endl;
@ -796,6 +797,7 @@ int tv_norm(istream &stream){
mpeg = 1; mpeg = 1;
found = 1; found = 1;
} }
}
if (! found) stream.seekg(p+streampos(1)); if (! found) stream.seekg(p+streampos(1));
} }
@ -831,7 +833,7 @@ int stream_type(istream &fin){
} }
fin >> pes; fin >> pes;
fin.read((char *)!headr,4); fin.read((char *)NULL,4);
fin.seekg(p); fin.seekg(p);
if (fin && headr[0] == 0x00 && headr[1] == 0x00 if (fin && headr[0] == 0x00 && headr[1] == 0x00
&& headr[2] == 0x01 ){ && headr[2] == 0x01 ){
@ -868,7 +870,7 @@ void analyze(istream &fin)
PS_Packet ps; PS_Packet ps;
PES_Packet pes; PES_Packet pes;
int fc = 0; int fc = 0;
char *frames[3] = {"I-Frame","P-Frame","B-Frame"}; const char *frames[3] = {"I-Frame","P-Frame","B-Frame"};
while(fin){ while(fin){
uint32_t pts; uint32_t pts;

View File

@ -489,7 +489,7 @@ int get_video_info(Remux *rem)
VideoInfo *vi = &rem->video_info; VideoInfo *vi = &rem->video_info;
while (found < 4 && ring_rest(vid_buffy)){ while (found < 4 && ring_rest(vid_buffy)){
uint8_t b[3]; uint8_t b[4];
vring_peek( rem, b, 4, 0); vring_peek( rem, b, 4, 0);
if ( b[0] == 0x00 && b[1] == 0x00 && b[2] == 0x01 if ( b[0] == 0x00 && b[1] == 0x00 && b[2] == 0x01

View File

@ -118,7 +118,12 @@ void cTSExt::Action(void)
if (FD_ISSET(m_Outpipe, &rfds)) { if (FD_ISSET(m_Outpipe, &rfds)) {
int result; int result;
if ((result = m_ResultBuffer->Read(m_Outpipe)) == -1) { //Read returns 0 if buffer full or EOF
bool bufferFull = m_ResultBuffer->Free() <= 0; //Free may be < 0
while ((result = m_ResultBuffer->Read(m_Outpipe)) == 0 && bufferFull)
dsyslog("streamdev-server: buffer full while reading from externremux");
if (result == -1) {
if (errno != EINTR) { if (errno != EINTR) {
LOG_ERROR_STR("read failed"); LOG_ERROR_STR("read failed");
m_Active = false; m_Active = false;
@ -149,7 +154,7 @@ cExternRemux::cExternRemux(int VPid, const int *APids, const int *Dpids, const i
m_ResultBuffer(new cRingBufferLinear(WRITERBUFSIZE, TS_SIZE * 2)), m_ResultBuffer(new cRingBufferLinear(WRITERBUFSIZE, TS_SIZE * 2)),
m_Remux(new cTSExt(m_ResultBuffer)) m_Remux(new cTSExt(m_ResultBuffer))
{ {
m_ResultBuffer->SetTimeouts(0, 100); m_ResultBuffer->SetTimeouts(500, 100);
} }
cExternRemux::~cExternRemux() cExternRemux::~cExternRemux()

View File

@ -1,5 +1,5 @@
/* /*
* $Id: connectionVTP.c,v 1.14 2007/05/09 09:12:42 schmirl Exp $ * $Id: connectionVTP.c,v 1.15 2007/09/21 12:45:31 schmirl Exp $
*/ */
#include "server/connectionVTP.h" #include "server/connectionVTP.h"
@ -469,7 +469,7 @@ cConnectionVTP::cConnectionVTP(void):
m_FilterSocket(NULL), m_FilterSocket(NULL),
m_FilterStreamer(NULL), m_FilterStreamer(NULL),
m_LastCommand(NULL), m_LastCommand(NULL),
m_NoTSPIDS(false), m_StreamType(stTSPIDS),
m_LSTEHandler(NULL), m_LSTEHandler(NULL),
m_LSTCHandler(NULL), m_LSTCHandler(NULL),
m_LSTTHandler(NULL) m_LSTTHandler(NULL)
@ -572,13 +572,27 @@ bool cConnectionVTP::Command(char *Cmd)
bool cConnectionVTP::CmdCAPS(char *Opts) bool cConnectionVTP::CmdCAPS(char *Opts)
{ {
if (strcasecmp(Opts, "TS") == 0) { if (strcasecmp(Opts, "TS") == 0) {
m_NoTSPIDS = true; m_StreamType = stTS;
return Respond(220, "Ignored, capability \"%s\" accepted for " return Respond(220, "Capability \"%s\" accepted", Opts);
"compatibility", Opts);
} }
if (strcasecmp(Opts, "TSPIDS") == 0) { if (strcasecmp(Opts, "TSPIDS") == 0) {
m_NoTSPIDS = false; m_StreamType = stTSPIDS;
return Respond(220, "Capability \"%s\" accepted", Opts);
}
if (strcasecmp(Opts, "PS") == 0) {
m_StreamType = stPS;
return Respond(220, "Capability \"%s\" accepted", Opts);
}
if (strcasecmp(Opts, "PES") == 0) {
m_StreamType = stPES;
return Respond(220, "Capability \"%s\" accepted", Opts);
}
if (strcasecmp(Opts, "EXTERN") == 0) {
m_StreamType = stExtern;
return Respond(220, "Capability \"%s\" accepted", Opts); return Respond(220, "Capability \"%s\" accepted", Opts);
} }
@ -715,7 +729,7 @@ bool cConnectionVTP::CmdTUNE(char *Opts)
delete m_LiveStreamer; delete m_LiveStreamer;
m_LiveStreamer = new cStreamdevLiveStreamer(1); m_LiveStreamer = new cStreamdevLiveStreamer(1);
m_LiveStreamer->SetChannel(chan, m_NoTSPIDS ? stTS : stTSPIDS); m_LiveStreamer->SetChannel(chan, m_StreamType);
m_LiveStreamer->SetDevice(dev); m_LiveStreamer->SetDevice(dev);
if(m_LiveSocket) if(m_LiveSocket)
m_LiveStreamer->Start(m_LiveSocket); m_LiveStreamer->Start(m_LiveSocket);

View File

@ -23,7 +23,7 @@ private:
cStreamdevFilterStreamer *m_FilterStreamer; cStreamdevFilterStreamer *m_FilterStreamer;
char *m_LastCommand; char *m_LastCommand;
bool m_NoTSPIDS; eStreamType m_StreamType;
// Members adopted for SVDRP // Members adopted for SVDRP
cRecordings Recordings; cRecordings Recordings;

View File

@ -1,5 +1,5 @@
/* /*
* $Id: streamer.c,v 1.15 2007/04/02 10:32:34 schmirl Exp $ * $Id: streamer.c,v 1.16 2007/09/21 11:45:53 schmirl Exp $
*/ */
#include <vdr/ringbuffer.h> #include <vdr/ringbuffer.h>
@ -141,6 +141,8 @@ void cStreamdevStreamer::Action(void)
int count = Put(block, got); int count = Put(block, got);
if (count) if (count)
m_RingBuffer->Del(count); m_RingBuffer->Del(count);
else
cCondWait::SleepMs(100);
} }
} }
} }

View File

@ -140,8 +140,10 @@ ssize_t cTBSource::ReadUntil(void *Buffer, size_t Length, const char *Seq,
len = m_LineBuffer.size(); len = m_LineBuffer.size();
m_LineBuffer.resize(BUFSIZ); m_LineBuffer.resize(BUFSIZ);
if ((b = Read((char*)m_LineBuffer.data() + len, BUFSIZ - len)) == -1) if ((b = Read((char*)m_LineBuffer.data() + len, BUFSIZ - len)) == -1) {
m_LineBuffer.resize(len);
return -1; return -1;
}
m_LineBuffer.resize(len + b); m_LineBuffer.resize(len + b);
if ((len = m_LineBuffer.find(Seq)) != (size_t)-1) { if ((len = m_LineBuffer.find(Seq)) != (size_t)-1) {