Skip to content

Commit 130e2d0

Browse files
committedMar 8, 2015
Got rid of IPTV_DEBUG.
1 parent bc6da9d commit 130e2d0

File tree

4 files changed

+34
-17
lines changed

4 files changed

+34
-17
lines changed
 

‎Makefile

+1-14
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,10 @@
22
# Makefile for IPTV plugin
33
#
44

5-
# Debugging on/off
6-
7-
#IPTV_DEBUG = 1
8-
95
# Default shell for EXT protocol
106

117
#IPTV_EXTSHELL = /bin/bash
128

13-
# Strip debug symbols? Set eg. to /bin/true if not
14-
15-
STRIP = strip
16-
179
# The official name of this plugin.
1810
# This name will be used in the '-P...' option of VDR to load the plugin.
1911
# By default the main source file also carries this name.
@@ -41,6 +33,7 @@ TMPDIR ?= /tmp
4133

4234
export CFLAGS = $(call PKGCFG,cflags)
4335
export CXXFLAGS = $(call PKGCFG,cxxflags)
36+
STRIP ?= /bin/true
4437

4538
### The version number of VDR's plugin API:
4639

@@ -69,10 +62,6 @@ INCLUDES +=
6962

7063
DEFINES += -DPLUGIN_NAME_I18N='"$(PLUGIN)"'
7164

72-
ifdef IPTV_DEBUG
73-
DEFINES += -DDEBUG
74-
endif
75-
7665
ifdef IPTV_EXTSHELL
7766
DEFINES += -DEXTSHELL='"$(IPTV_EXTSHELL)"'
7867
endif
@@ -139,9 +128,7 @@ install-i18n: $(I18Nmsgs)
139128

140129
$(SOFILE): $(OBJS)
141130
$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(OBJS) $(LIBS) -o $@
142-
ifndef IPTV_DEBUG
143131
@$(STRIP) $@
144-
endif
145132

146133
install-lib: $(SOFILE)
147134
install -D $^ $(DESTDIR)$(LIBDIR)/$^.$(APIVERSION)

‎log.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#define debug6(x...) void( IptvConfig.IsTraceMode(cIptvConfig::eTraceModeDebug6) ? dsyslog("IPTV6: " x) : void() )
2727
// 0x0040: TBD
2828
#define debug7(x...) void( IptvConfig.IsTraceMode(cIptvConfig::eTraceModeDebug7) ? dsyslog("IPTV7: " x) : void() )
29-
// 0x0080: TBD
29+
// 0x0080: CURL
3030
#define debug8(x...) void( IptvConfig.IsTraceMode(cIptvConfig::eTraceModeDebug8) ? dsyslog("IPTV8: " x) : void() )
3131
// 0x0100: TBD
3232
#define debug9(x...) void( IptvConfig.IsTraceMode(cIptvConfig::eTraceModeDebug9) ? dsyslog("IPTV9: " x) : void() )

‎protocolcurl.c

+31-2
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,35 @@ cIptvProtocolCurl::~cIptvProtocolCurl()
5555
DELETE_POINTER(ringBufferM);
5656
}
5757

58+
int cIptvProtocolCurl::DebugCallback(CURL *handleP, curl_infotype typeP, char *dataP, size_t sizeP, void *userPtrP)
59+
{
60+
cIptvProtocolCurl *obj = reinterpret_cast<cIptvProtocolCurl *>(dataP);
61+
62+
if (obj) {
63+
switch (typeP) {
64+
case CURLINFO_TEXT:
65+
debug8("%s INFO %.*s", __PRETTY_FUNCTION__, (int)sizeP, dataP);
66+
break;
67+
case CURLINFO_HEADER_IN:
68+
debug8("%s HEAD <<< %.*s", __PRETTY_FUNCTION__, (int)sizeP, dataP);
69+
break;
70+
case CURLINFO_HEADER_OUT:
71+
debug8("%s HEAD >>>\n%.*s", __PRETTY_FUNCTION__, (int)sizeP, dataP);
72+
break;
73+
case CURLINFO_DATA_IN:
74+
debug8("%s DATA <<< %zu", __PRETTY_FUNCTION__, sizeP);
75+
break;
76+
case CURLINFO_DATA_OUT:
77+
debug8("%s DATA >>> %zu", __PRETTY_FUNCTION__, sizeP);
78+
break;
79+
default:
80+
break;
81+
}
82+
}
83+
84+
return 0;
85+
}
86+
5887
size_t cIptvProtocolCurl::WriteCallback(void *ptrP, size_t sizeP, size_t nmembP, void *dataP)
5988
{
6089
cIptvProtocolCurl *obj = reinterpret_cast<cIptvProtocolCurl *>(dataP);
@@ -258,10 +287,10 @@ bool cIptvProtocolCurl::Connect()
258287
CURLcode res = CURLE_OK;
259288
cString netrc = cString::sprintf("%s/netrc", IptvConfig.GetConfigDirectory());
260289

261-
#ifdef DEBUG
262290
// Verbose output
263291
iptv_curl_easy_setopt(handleM, CURLOPT_VERBOSE, 1L);
264-
#endif
292+
iptv_curl_easy_setopt(handleM, CURLOPT_DEBUGFUNCTION, cIptvProtocolCurl::DebugCallback);
293+
iptv_curl_easy_setopt(handleM, CURLOPT_DEBUGDATA, this);
265294

266295
// Set callbacks
267296
iptv_curl_easy_setopt(handleM, CURLOPT_WRITEFUNCTION, cIptvProtocolCurl::WriteCallback);

‎protocolcurl.h

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ class cIptvProtocolCurl : public cIptvUdpSocket, public cIptvProtocolIf {
3636
eKeepAliveIntervalMs = 300000 // in milliseconds
3737
};
3838

39+
static int DebugCallback(CURL *handleP, curl_infotype typeP, char *dataP, size_t sizeP, void *userPtrP);
3940
static size_t WriteCallback(void *ptrP, size_t sizeP, size_t nmembP, void *dataP);
4041
static size_t WriteRtspCallback(void *ptrP, size_t sizeP, size_t nmembP, void *dataP);
4142
static size_t DescribeCallback(void *ptrP, size_t sizeP, size_t nmembP, void *dataP);

0 commit comments

Comments
 (0)
Please sign in to comment.