mirror of
https://github.com/rofafor/vdr-plugin-iptv.git
synced 2023-10-10 13:37:03 +02:00
Simplified RTP read.
This commit is contained in:
parent
0177f03089
commit
ecd4b2f351
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* See the README file for copyright information and how to reach the author.
|
* See the README file for copyright information and how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: protocolrtp.c,v 1.1 2007/09/26 19:49:35 rahrenbe Exp $
|
* $Id: protocolrtp.c,v 1.2 2007/09/26 22:07:45 rahrenbe Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@ -178,12 +178,11 @@ int cIptvProtocolRtp::Read(unsigned char* *BufferAddr)
|
|||||||
MSG_DONTWAIT, (struct sockaddr *)&sockAddr, &addrlen);
|
MSG_DONTWAIT, (struct sockaddr *)&sockAddr, &addrlen);
|
||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
// http://www.networksorcery.com/enp/rfc/rfc2250.txt
|
// http://www.networksorcery.com/enp/rfc/rfc2250.txt
|
||||||
const unsigned int headerlen = 4 * sizeof(uint32_t);
|
const int headerlen = 4 * sizeof(uint32_t);
|
||||||
uint8_t *header = readBuffer + sizeof(uint8_t);
|
|
||||||
// Check if payload type is MPEG2 TS and payload contains multiple of TS packet data
|
// Check if payload type is MPEG2 TS and payload contains multiple of TS packet data
|
||||||
if (((*header & 0x7F) == 33) && (((len - headerlen) % TS_SIZE) == 0)) {
|
if (((readBuffer[1] & 0x7F) == 33) && (((len - headerlen) % TS_SIZE) == 0)) {
|
||||||
// Set argument point to payload in read buffer
|
// Set argument point to payload in read buffer
|
||||||
*BufferAddr = readBuffer + headerlen;
|
*BufferAddr = &readBuffer[headerlen];
|
||||||
return (len - headerlen);
|
return (len - headerlen);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* See the README file for copyright information and how to reach the author.
|
* See the README file for copyright information and how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: sectionfilter.c,v 1.4 2007/09/24 21:25:54 rahrenbe Exp $
|
* $Id: sectionfilter.c,v 1.5 2007/09/26 22:07:45 rahrenbe Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "sectionfilter.h"
|
#include "sectionfilter.h"
|
||||||
@ -49,13 +49,13 @@ cIptvSectionFilter::cIptvSectionFilter(int Index, int devInd,
|
|||||||
struct stat sb;
|
struct stat sb;
|
||||||
stat(pipeName, &sb);
|
stat(pipeName, &sb);
|
||||||
if (S_ISFIFO(sb.st_mode))
|
if (S_ISFIFO(sb.st_mode))
|
||||||
unlink(pipeName);
|
unlink(pipeName);
|
||||||
int err = mknod(pipeName, 0644 | S_IFIFO, 0);
|
int err = mknod(pipeName, 0644 | S_IFIFO, 0);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
char tmp[64];
|
char tmp[64];
|
||||||
error("ERROR: mknod(): %s", strerror_r(errno, tmp, sizeof(tmp)));
|
error("ERROR: mknod(): %s", strerror_r(errno, tmp, sizeof(tmp)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create descriptors
|
// Create descriptors
|
||||||
fifoDescriptor = open(pipeName, O_RDWR | O_NONBLOCK);
|
fifoDescriptor = open(pipeName, O_RDWR | O_NONBLOCK);
|
||||||
|
Loading…
Reference in New Issue
Block a user