Permalink
Browse files

Merge pull request #268 from FernetMenta/vnsi5

vnsi fixes
  • Loading branch information...
2 parents 776bd34 + 23be707 commit af29425b1e171419d72fb3a0475a10f4a862f0b7 @opdenkamp committed Jan 28, 2014
View
2 addons/pvr.vdr.vnsi/addon/addon.xml.in
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<addon
id="pvr.vdr.vnsi"
- version="1.9.5"
+ version="1.9.6"
name="VDR VNSI Client"
provider-name="FernetMenta, Team XBMC">
<requires>
View
20 addons/pvr.vdr.vnsi/src/VNSIRecording.cpp
@@ -94,7 +94,11 @@ int cVNSIRecording::Read(unsigned char* buf, uint32_t buf_size)
}
if (m_currentPlayingRecordPosition >= m_currentPlayingRecordBytes)
- return 0;
+ {
+ GetLength();
+ if (m_currentPlayingRecordPosition >= m_currentPlayingRecordBytes)
+ return 0;
+ }
cRequestPacket vrp;
if (!vrp.init(VNSI_RECSTREAM_GETBLOCK) ||
@@ -178,3 +182,17 @@ void cVNSIRecording::OnReconnect()
{
OpenRecording(m_recinfo);
}
+
+void cVNSIRecording::GetLength()
+{
+ cRequestPacket vrp;
+ if (!vrp.init(VNSI_RECSTREAM_GETLENGTH))
+ return;
+
+ cResponsePacket* vresp = ReadResult(&vrp);
+ if (!vresp)
+ return;
+
+ m_currentPlayingRecordBytes = vresp->extract_U64();
+ delete vresp;
+}
View
1 addons/pvr.vdr.vnsi/src/VNSIRecording.h
@@ -41,6 +41,7 @@ class cVNSIRecording : public cVNSISession
protected:
void OnReconnect();
+ void GetLength();
private:
View
1 addons/pvr.vdr.vnsi/src/vnsicommand.h
@@ -61,6 +61,7 @@
#define VNSI_RECSTREAM_POSTOFRAME 43
#define VNSI_RECSTREAM_FRAMETOPOS 44
#define VNSI_RECSTREAM_GETIFRAME 45
+#define VNSI_RECSTREAM_GETLENGTH 46
/* OPCODE 60 - 79: VNSI network functions for channel access */
#define VNSI_CHANNELS_GETCOUNT 61
View
7 addons/pvr.vdr.vnsi/vdr-plugin-vnsiserver/HISTORY
@@ -20,4 +20,9 @@ VDR Plugin 'vnsiserver' Revision History
- send buffer times for timeshift
- bump protocol to XBMC to 5
- suffix plugin with version of protocol: vnsiserver5
-- this version is compatible with XBMC 13
+- this version is compatible with XBMC 13
+
+2014-01-08: Version 0.9.4
+
+- update length of recorings in progress
+ while playing
View
1 addons/pvr.vdr.vnsi/vdr-plugin-vnsiserver/parser.h
@@ -225,6 +225,7 @@ class cTSStream
const char *GetLanguage() { return m_language; }
const eStreamContent Content() const { return m_streamContent; }
const eStreamType Type() const { return m_streamType; }
+ void SetType(eStreamType type) { m_streamType = type; }
const int GetPID() const { return m_pID; }
/* Video Stream Information */
View
12 addons/pvr.vdr.vnsi/vdr-plugin-vnsiserver/parser_AAC.c
@@ -106,6 +106,12 @@ int cParserAAC::FindHeaders(uint8_t *buf, int buf_size)
m_curPTS += 90000 * 1024 / m_SampleRate;
return -1;
}
+ else if (buf_ptr[0] == 0xFF && (buf_ptr[1] & 0xF0) == 0xF0)
+ {
+ m_Stream->SetType(stAACADTS);
+ INFOLOG("cParserAAC::FindHeaders - detected ADTS muxing mode");
+ return -1;
+ }
}
else if (m_Stream->Type() == stAACADTS)
{
@@ -138,6 +144,12 @@ int cParserAAC::FindHeaders(uint8_t *buf, int buf_size)
m_curPTS += 90000 * 1024 / m_SampleRate;
return -1;
}
+ else if (buf_ptr[0] == 0x56 && (buf_ptr[1] & 0xE0) == 0xE0)
+ {
+ m_Stream->SetType(stAACLATM);
+ INFOLOG("cParserAAC::FindHeaders - detected LATM muxing mode");
+ return -1;
+ }
}
return 0;
}
View
23 addons/pvr.vdr.vnsi/vdr-plugin-vnsiserver/recplayer.c
@@ -200,7 +200,13 @@ int cRecPlayer::getBlock(unsigned char* buffer, uint64_t position, int amount)
amount = m_totalLength;
if (position >= m_totalLength)
- return 0;
+ {
+ reScan();
+ if (position >= m_totalLength)
+ {
+ return 0;
+ }
+ }
if ((position + amount) > m_totalLength)
amount = m_totalLength - position;
@@ -216,16 +222,19 @@ int cRecPlayer::getBlock(unsigned char* buffer, uint64_t position, int amount)
}
// segment not found / invalid position
- if (segmentNumber == -1) return 0;
+ if (segmentNumber == -1)
+ return 0;
// open file (if not already open)
- if (!openFile(segmentNumber)) return 0;
+ if (!openFile(segmentNumber))
+ return 0;
// work out position in current file
uint64_t filePosition = position - m_segments[segmentNumber]->start;
// seek to position
- if(lseek(m_file, filePosition, SEEK_SET) == -1) {
+ if(lseek(m_file, filePosition, SEEK_SET) == -1)
+ {
ERRORLOG("unable to seek to position: %lu", filePosition);
return 0;
}
@@ -237,7 +246,8 @@ int cRecPlayer::getBlock(unsigned char* buffer, uint64_t position, int amount)
if ((bytes_read == 0) && (position < m_totalLength))
bytes_read += getBlock(buffer, position+1 , amount);
- if(bytes_read <= 0) {
+ if(bytes_read <= 0)
+ {
return 0;
}
@@ -254,7 +264,8 @@ int cRecPlayer::getBlock(unsigned char* buffer, uint64_t position, int amount)
uint64_t cRecPlayer::positionFromFrameNumber(uint32_t frameNumber)
{
- if (!m_indexFile) return 0;
+ if (!m_indexFile)
+ return 0;
#if VDRVERSNUM < 10703
unsigned char retFileNumber;
int retFileOffset;
View
2 addons/pvr.vdr.vnsi/vdr-plugin-vnsiserver/videobuffer.c
@@ -243,7 +243,6 @@ void cVideoBufferRAM::Put(uint8_t *buf, unsigned int size)
{
if (Available() + MARGIN >= m_BufferSize)
{
- ERRORLOG("------------- skipping data");
return;
}
@@ -452,7 +451,6 @@ void cVideoBufferFile::Put(uint8_t *buf, unsigned int size)
{
if (Available() + MARGIN >= m_BufferSize)
{
- ERRORLOG("------------- skipping data");
return;
}
View
2 addons/pvr.vdr.vnsi/vdr-plugin-vnsiserver/vnsi.h
@@ -27,7 +27,7 @@
#include <vdr/plugin.h>
#include "vnsiserver.h"
-static const char *VERSION = "0.9.3";
+static const char *VERSION = "0.9.4";
static const char *DESCRIPTION = "VDR-Network-Streaming-Interface (VNSI) Server";
extern int PmtTimeout;
View
23 addons/pvr.vdr.vnsi/vdr-plugin-vnsiserver/vnsiclient.c
@@ -205,7 +205,7 @@ void cVNSIClient::TimerChange()
}
}
-void cVNSIClient::ChannelChange()
+void cVNSIClient::ChannelsChange()
{
cMutexLock lock(&m_msgLock);
@@ -450,6 +450,10 @@ bool cVNSIClient::processRequest(cRequestPacket* req)
result = processRecStream_GetIFrame();
break;
+ case VNSI_RECSTREAM_GETLENGTH:
+ result = processRecStream_GetLength();
+ break;
+
/** OPCODE 60 - 79: VNSI network functions for channel access */
case VNSI_CHANNELS_GETCOUNT:
@@ -934,6 +938,23 @@ bool cVNSIClient::processRecStream_GetIFrame() /* OPCODE 45 */
return true;
}
+bool cVNSIClient::processRecStream_GetLength() /* OPCODE 46 */
+{
+ uint64_t length = 0;
+
+ if (m_RecPlayer)
+ {
+ m_RecPlayer->reScan();
+ length = m_RecPlayer->getLengthBytes();
+ }
+
+ m_resp->add_U64(length);
+
+ m_resp->finalise();
+ m_socket.write(m_resp->getPtr(), m_resp->getLen());
+
+ return true;
+}
/** OPCODE 60 - 79: VNSI network functions for channel access */
View
3 addons/pvr.vdr.vnsi/vdr-plugin-vnsiserver/vnsiclient.h
@@ -83,7 +83,7 @@ class cVNSIClient : public cThread
cVNSIClient(int fd, unsigned int id, const char *ClientAdr);
virtual ~cVNSIClient();
- void ChannelChange();
+ void ChannelsChange();
void RecordingsChange();
void TimerChange();
void EpgChange();
@@ -124,6 +124,7 @@ class cVNSIClient : public cThread
bool processRecStream_PositionFromFrameNumber();
bool processRecStream_FrameNumberFromPosition();
bool processRecStream_GetIFrame();
+ bool processRecStream_GetLength();
bool processCHANNELS_GroupsCount();
bool processCHANNELS_ChannelsCount();
View
1 addons/pvr.vdr.vnsi/vdr-plugin-vnsiserver/vnsicommand.h
@@ -66,6 +66,7 @@
#define VNSI_RECSTREAM_POSTOFRAME 43
#define VNSI_RECSTREAM_FRAMETOPOS 44
#define VNSI_RECSTREAM_GETIFRAME 45
+#define VNSI_RECSTREAM_GETLENGTH 46
/* OPCODE 60 - 79: VNSI network functions for channel access */
#define VNSI_CHANNELS_GETCOUNT 61
View
2 addons/pvr.vdr.vnsi/vdr-plugin-vnsiserver/vnsiserver.c
@@ -263,7 +263,7 @@ void cVNSIServer::Action(void)
Channels.SetModified((modified == CHANNELSMOD_USER) ? true : false);
INFOLOG("Requesting clients to reload channel list");
for (ClientList::iterator i = m_clients.begin(); i != m_clients.end(); i++)
- (*i)->ChannelChange();
+ (*i)->ChannelsChange();
}
chanTimer.Set(5000);
}

0 comments on commit af29425

Please sign in to comment.