LIBRTMP Delphi:DLL的映射
问题描述:
当我从Delphi调用函数RTMP_SetupURL时,URL在记录RTMP中没有更新,我将DLL函数修改为:
When I call the function RTMP_SetupURL from Delphi the URL is not updated in the record RTMP, I tanslated the DLL function like that:
int RTMP_SetupURL(RTMP *r, char *url);
function RTMP_SetupURL(var r:RTMP; url:PAnsichar):integer;
和记录AVal这样声明:
and the record AVal is declared like that:
AVal = record
av_val: PansiChar;
av_len: integer;
end;
在设置URL之前出现初始化问题之前,我的记录(RTMP)未正确初始化,位于我的记录下方:
Before to set the URL there a init problem, my record (RTMP) is not initialized correctly, below my record:
PChar = PAnsiChar;
uint32_t = LongWord;
uint8_t = Byte;
int8_t = char;
int32_t = LongInt;
unsigned_int = LongWord;
unsigned_short = Word;
int16_t = smallint;
cchar = Char;
cint = LongInt;
RTMP = record
m_inChunkSize : cint;
m_outChunkSize : cint;
m_nBWCheckCounter : cint;
m_nBytesIn : cint;
m_nBytesInSent : cint;
m_nBufferMS : cint;
m_stream_id : cint;
m_mediaChannel : cint;
m_mediaStamp : uint32_t;
m_pauseStamp : uint32_t;
m_pausing : cint;
m_nServerBW : cint;
m_nClientBW : cint;
m_nClientBW2 : uint8_t;
m_bPlaying : uint8_t;
m_bSendEncoding : uint8_t;
m_bSendCounter : uint8_t;
m_numInvokes : cint;
m_numCalls : cint;
m_methodCalls : PRTMP_METHOD;
m_vecChannelsIn : array[0..(RTMP_CHANNELS)-1] of PRTMPPacket;
m_vecChannelsOut : array[0..(RTMP_CHANNELS)-1] of PRTMPPacket;
m_channelTimestamp : array[0..(RTMP_CHANNELS)-1] of cint;
m_fAudioCodecs : double;
m_fVideoCodecs : double;
m_fEncoding : double;
m_fDuration : double;
m_msgCounter : cint;
m_polling : cint;
m_resplen : cint;
m_unackd : cint;
m_clientID : AVal;
m_read : RTMP_READ;
m_write : RTMPPacket;
m_sb : RTMPSockBuf;
Link : RTMP_LNK;
end;
PRTMP = ^RTMP;
然后我打电话:
var MY_RTMP: RTMP;
MY_RTMP := RTMP_Alloc;
RTMP_Init(MY_RTMP);
除初始化URL时使用的链接"记录外,所有记录均已初始化.我想记录没有正确声明
all the record is initialized excepted the "Link" record that is used when initializing the URL. I guess the record is not properly declared
答
我会尝试这样做. 此处
是我用作基础的来源.
I would try this. Here
is the source I've used as a base.
function RTMP_SetupURL(var R: RTMP; Url: PAnsiChar): Integer; cdecl;
external 'librtmp.dll' name 'RTMP_SetupURL';