mirror of https://bitbucket.org/ausocean/av.git
THink I've fixed some obvious syntax errors, but will need to debug tomorrow using cgo
This commit is contained in:
parent
8e6f6ba3e0
commit
a9df7b7adc
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue