3
3
#include " protocolm3u.h"
4
4
#include " common.h"
5
5
#include " config.h"
6
- #include " ffmpeghandler.h"
7
- #include " vlchandler.h"
6
+ #include " streambasehandler.h"
8
7
#include " log.h"
9
8
10
- cIptvProtocolM3U::cIptvProtocolM3U () : isActiveM(false ), handler(nullptr ) {
9
+ cIptvProtocolM3U::cIptvProtocolM3U () : isActiveM(false ), handler(" M3U " ) {
11
10
debug1 (" %s" , __PRETTY_FUNCTION__);
12
11
}
13
12
@@ -16,14 +15,12 @@ cIptvProtocolM3U::~cIptvProtocolM3U() {
16
15
17
16
// Drop open handles
18
17
cIptvProtocolM3U::Close ();
19
-
20
- delete handler;
21
- handler = nullptr ;
18
+ handler.stop ();
22
19
}
23
20
24
21
int cIptvProtocolM3U::Read (unsigned char *bufferAddrP, unsigned int bufferLenP) {
25
22
// debug16("%s (, %u)", __PRETTY_FUNCTION__, bufferLenP);
26
- return handler-> popPackets (bufferAddrP, bufferLenP);
23
+ return handler. popPackets (bufferAddrP, bufferLenP);
27
24
}
28
25
29
26
bool cIptvProtocolM3U::Open () {
@@ -69,8 +66,11 @@ bool cIptvProtocolM3U::Open() {
69
66
}
70
67
}
71
68
69
+ handler.setChannelId (channelId);
70
+ handler.setHandlerType (handlerType);
71
+
72
72
m3u8Handler.printStream (streams);
73
- handler-> streamVideo (streams);
73
+ handler. streamVideo (streams);
74
74
}
75
75
76
76
return true ;
@@ -80,9 +80,7 @@ bool cIptvProtocolM3U::Close() {
80
80
debug1 (" %s" , __PRETTY_FUNCTION__);
81
81
82
82
isActiveM = false ;
83
- if (handler != nullptr ) {
84
- handler->stop ();
85
- }
83
+ handler.stop ();
86
84
87
85
return true ;
88
86
}
@@ -132,7 +130,9 @@ cIptvProtocolM3U::SetSource(SourceParameter parameter) {
132
130
}
133
131
134
132
channelId = parameter.channelNumber ;
133
+ handlerType = parameter.handlerType ;
135
134
135
+ /*
136
136
if (handler != nullptr) {
137
137
handler->stop();
138
138
}
@@ -145,7 +145,7 @@ cIptvProtocolM3U::SetSource(SourceParameter parameter) {
145
145
} else if (parameter.handlerType == 'V') {
146
146
handler = new VlcHandler(channelId);
147
147
}
148
-
148
+ */
149
149
return true ;
150
150
}
151
151
0 commit comments