Fixing build errors

This commit is contained in:
saxon 2018-07-16 13:16:40 +09:30
parent 876f552c2a
commit d1362d659f
1 changed files with 10 additions and 6 deletions

View File

@ -39,6 +39,8 @@ package rtmp
RTMP* start_session(RTMP* rtmp, char* url, uint connect_timeout); RTMP* start_session(RTMP* rtmp, char* url, uint connect_timeout);
int write_frame(RTMP* rtmp, char* data, uint data_length); int write_frame(RTMP* rtmp, char* data, uint data_length);
int end_session(RTMP* rtmp); int end_session(RTMP* rtmp);
void AV_queue(RTMP_METHOD **vals, int *num, AVal *av, int txn);
int WriteN(RTMP *r, const char *buffer, int n);
*/ */
import "C" import "C"
@ -55,6 +57,7 @@ import (
const ( const (
minDataSize = 11 minDataSize = 11
debugMode = false debugMode = false
nullChar = "golang\000"
) )
const ( const (
@ -248,12 +251,12 @@ func rtmpWrite(r *C.RTMP, data []byte) int {
} }
func sendPacket(r *C.RTMP, pkt *C.RTMPPacket, queue int) int { func sendPacket(r *C.RTMP, packet *C.RTMPPacket, queue int) int {
var prevPacket *C.RTMPPacket var prevPacket *C.RTMPPacket
last := 0 last := 0
var nSize, hSize, cSize, nChunkSize, tlen int var nSize, hSize, cSize, nChunkSize, tlen int
var header, hptr, hend, buffer, tbuf, toff unsafe.Pointer var header, hptr, hend, buffer, tbuf, toff unsafe.Pointer
var goHbuf [RTMP_MAX_HEADER_SIZE]byte var goHbuf [C.RTMP_MAX_HEADER_SIZE]byte
var hbuf = unsafe.Pointer(&goHbuf[0]) var hbuf = unsafe.Pointer(&goHbuf[0])
var c byte var c byte
var t int32 var t int32
@ -492,7 +495,7 @@ func sendPacket(r *C.RTMP, pkt *C.RTMPPacket, queue int) int {
return 1 return 1
} }
/*
func writeN(r *C.RTMP, buffer unsafe.Pointer, n int) int { func writeN(r *C.RTMP, buffer unsafe.Pointer, n int) int {
ptr := buffer ptr := buffer
for n > 0 { for n > 0 {
@ -500,7 +503,7 @@ func writeN(r *C.RTMP, buffer unsafe.Pointer, n int) int {
if r.Link.protocol & C.RTMP_FEATURE_HTTP { if r.Link.protocol & C.RTMP_FEATURE_HTTP {
// TODO: port HTTP_POST // TODO: port HTTP_POST
nbytes = int(C.HTTP_POST(r, C.RTMPT_SEND, (*C.char)(ptr), C.int(n)) nbytes = int(C.HTTP_POST(r, C.RTMPT_SEND, (*C.char)(ptr), C.int(n)))
} else { } else {
// TODO: port this if necessary // TODO: port this if necessary
nBytes = RTMPSockBuf_Send(&r.m_sb, (*C.char)(ptr), C.int(n)) nBytes = RTMPSockBuf_Send(&r.m_sb, (*C.char)(ptr), C.int(n))
@ -536,7 +539,7 @@ func writeN(r *C.RTMP, buffer unsafe.Pointer, n int) int {
} }
// TODO: port RTMP_METHOD // TODO: port RTMP_METHOD
func AV_queue(vals **C.RTMP_METHOD, num *int, av *AVal, txn int ) { func avQueue(vals **C.RTMP_METHOD, num *int, av *AVal, txn int ) {
var tmp unsafe.Pointer var tmp unsafe.Pointer
if (*num & 0x0f) == 0 { if (*num & 0x0f) == 0 {
@ -546,8 +549,9 @@ func AV_queue(vals **C.RTMP_METHOD, num *int, av *AVal, txn int ) {
tmp := C.malloc(av.av_len + 1 ) tmp := C.malloc(av.av_len + 1 )
memmove(tmp, unsafe.Pointer(av.av_val), int(av.av_len)) memmove(tmp, unsafe.Pointer(av.av_val), int(av.av_len))
indxPtr(tpm,av.av_len) = '\0' indxPtr(tmp,av.av_len) = byte(nullChar)
} }
*/
// memmove copies n bytes from "from" to "to". // memmove copies n bytes from "from" to "to".
//go:linkname memmove runtime.memmove //go:linkname memmove runtime.memmove