diff --git a/tuner.c b/tuner.c index 96896d8..76aa823 100644 --- a/tuner.c +++ b/tuner.c @@ -141,30 +141,31 @@ void cSatipTuner::DataTimeoutCallback(void *objP) obj->reconnectM = true; } -int cSatipTuner::RtspDebugCallback(CURL *handleP, curl_infotype typeP, char *dataP, size_t sizeP, void *userPtrP) +int cSatipTuner::DebugCallback(CURL *handleP, curl_infotype typeP, char *dataP, size_t sizeP, void *userPtrP) { - //cSatipTuner *obj = reinterpret_cast(userPtrP); - //debug("cSatipTuner::%s(%d) [device %d]", __FUNCTION__, (int)typeP, obj->deviceM->GetId()); + cSatipTuner *obj = reinterpret_cast(userPtrP); - switch (typeP) { - case CURLINFO_TEXT: - debug("RTSP INFO %.*s", (int)sizeP, dataP); - break; - case CURLINFO_HEADER_IN: - debug("RTSP HEAD< %.*s", (int)sizeP, dataP); - break; - case CURLINFO_HEADER_OUT: - debug("RTSP HEAD> %.*s", (int)sizeP, dataP); - break; - case CURLINFO_DATA_IN: - debug("RTSP DATA< %.*s", (int)sizeP, dataP); - break; - case CURLINFO_DATA_OUT: - debug("RTSP DATA> %.*s", (int)sizeP, dataP); - break; - default: - break; - } + if (obj) { + switch (typeP) { + case CURLINFO_TEXT: + debug("cSatipTuner::%s(%d): RTSP INFO %.*s", __FUNCTION__, obj->deviceM->GetId(), (int)sizeP, dataP); + break; + case CURLINFO_HEADER_IN: + debug("cSatipTuner::%s(%d): RTSP HEAD <<< %.*s", __FUNCTION__, obj->deviceM->GetId(), (int)sizeP, dataP); + break; + case CURLINFO_HEADER_OUT: + debug("cSatipTuner::%s(%d): RTSP HEAD >>> %.*s", __FUNCTION__, obj->deviceM->GetId(), (int)sizeP, dataP); + break; + case CURLINFO_DATA_IN: + debug("cSatipTuner::%s(%d): RTSP DATA <<< %.*s", __FUNCTION__, obj->deviceM->GetId(), (int)sizeP, dataP); + break; + case CURLINFO_DATA_OUT: + debug("cSatipTuner::%s(%d): RTSP DATA >>> %.*s", __FUNCTION__, obj->deviceM->GetId(), (int)sizeP, dataP); + break; + default: + break; + } + } return 0; } diff --git a/tuner.h b/tuner.h index 46f5940..fcf542f 100644 --- a/tuner.h +++ b/tuner.h @@ -33,7 +33,7 @@ private: static size_t HeaderCallback(void *ptrP, size_t sizeP, size_t nmembP, void *dataP); static size_t DataCallback(void *ptrP, size_t sizeP, size_t nmembP, void *dataP); static void DataTimeoutCallback(void *objP); - static int RtspDebugCallback(CURL *handleP, curl_infotype typeP, char *dataP, size_t sizeP, void *userPtrP); + static int DebugCallback(CURL *handleP, curl_infotype typeP, char *dataP, size_t sizeP, void *userPtrP); cSatipTunerDataThread dataThreadM; cCondWait sleepM;