1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
/*
* cddump.h
*
* Copyright (C) 2005 Christophe Thommeret <hftom@free.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef CDDUMP_H
#define CDDUMP_H
#include <sys/poll.h>
#include <sys/stat.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <tqthread.h>
#include <tqobject.h>
#include <tqstring.h>
#include <tqfile.h>
#include <tqtimer.h>
#include "cdchannel.h"
struct srtpbits {
unsigned int v:2; /* version: 2 */
unsigned int p:1; /* is there padding appended: 0 */
unsigned int x:1; /* number of extension headers: 0 */
unsigned int cc:4; /* number of CSRC identifiers: 0 */
unsigned int m:1; /* marker: 0 */
unsigned int pt:7; /* payload type: 33 for MPEG2 TS - RFC 1890 */
unsigned int sequence:16; /* sequence number: random */
};
struct srtpheader { /* in network byte order */
struct srtpbits b;
int timestamp; /* start: random */
int ssrc; /* random */
};
class CdDump : public TQObject, public TQThread
{
Q_OBJECT
public :
CdDump( const TQString &pipe );
~CdDump();
virtual void run();
bool go( const TQString &ad, int port, CdChannel c );
void stop();
bool doPause( const TQString &name );
bool running() const;
private slots:
void setPatPmt();
private :
void writePmt();
void writePat();
void calculateCRC( unsigned char *p_begin, unsigned char *p_end );
TQFile liveFile;
bool timeShifting;
TQString timeShiftFileName;
int waitPause;
int fdPipe;
TQString fifoName;
bool isRunning;
int sock;
struct sockaddr_in addr;
CdChannel chan;
unsigned char tspat[188];
unsigned char tspmt[188];
unsigned int CRC32[256];
int pmtpid;
TQTimer timerPatPmt;
bool patpmt;
signals:
void playDvb();
void shifting( bool );
};
#endif /* CDDUMP_H */
|