diff --git a/rtmp/RTMP.go b/rtmp/RTMP.go index 73c1cb8d..7a506e41 100644 --- a/rtmp/RTMP.go +++ b/rtmp/RTMP.go @@ -41,7 +41,7 @@ type RTMPSession interface { } type rtmpSession struct { - rtmp *C.RTMP + rtmp *C.struct_RTMP url string timeout uint } @@ -54,21 +54,21 @@ func NewRTMPSession(url string, connectTimeout uint) (session *rtmpSession){ } func (s *rtmpSession) StartSession() error { - if !bool(C.RTMP_start_session(s.rtmp, C.(const char*)(s.url), C.uint(connect_timeout))) { + if !bool(C.RTMP_start_session(s.rtmp, C.CString(s.url), C.uint(connect_timeout))) { return errors.New("RTMP start error! Check rtmp log for details!") } return nil } func (s *rtmpSession) WriteFrame(data []byte, dataLength uint) error { - if !bool(C.RTMP_write_frame(RTMP* rtmp, char* data, C.uint(data_length))) { + if !bool(C.RTMP_write_frame(s.rtmp, (*C.char)(unsafe.Pointer(&data[0])), C.uint(data_length))) { return errors.New("RTMP write error! Check rtmp log for details!") } return nil } func (s *rtmpSession) EndSession() error { - if !bool(RTMP_end_session(RTMP* rtmp)) { + if !bool(C.RTMP_end_session(s.rtmp)) { return errors.New("RTMP end session error! Check rtmp log for details!") } return nil diff --git a/rtmp/RTMPWrapper.c b/rtmp/RTMPWrapper.c index 3eaf63f8..ec52b6ea 100644 --- a/rtmp/RTMPWrapper.c +++ b/rtmp/RTMPWrapper.c @@ -33,11 +33,11 @@ LICENSE #include "rtmp_c/librtmp/log.h" #include "lwlog/lwlog.h" -int RTMP_start_session(RTMP* rtmp, const char* url, uint connect_timeout){ +int RTMP_start_session(RTMP* rtmp, char* url, uint connect_timeout){ rtmp = RTMP_Alloc(); RTMP_Init(rtmp); rtmp->Link.timeout = connect_timeout; - if (!RTMP_SetupURL(rtmp, url)) { + if (!RTMP_SetupURL(rtmp, (const char*)url)) { RTMP_Log(RTMP_LOGERROR, "SetupURL Err\n"); RTMP_Free(rtmp); return 0; diff --git a/rtmp/RTMPWrapper.h b/rtmp/RTMPWrapper.h index 63fd597d..0e1f4de0 100644 --- a/rtmp/RTMPWrapper.h +++ b/rtmp/RTMPWrapper.h @@ -33,6 +33,6 @@ LICENSE #include "rtmp_c/librtmp/log.h" #include "lwlog/lwlog.h" -int RTMP_start_session(RTMP* rtmp, const char* url, uint connect_timeout); +int RTMP_start_session(RTMP* rtmp, char* url, uint connect_timeout); int RTMP_write_frame(RTMP* rtmp, char* data, uint data_length); int RTMP_end_session(RTMP* rtmp);