LIBRTMP Delphi:DLL 的映射

发布于 2024-12-06 19:02:49 字数 1670 浏览 0 评论 0原文

当我从 Delphi 调用函数 RTMP_SetupURL 时,记录 RTMP 中的 URL 未更新,我像这样翻译了 DLL 函数:

int RTMP_SetupURL(RTMP *r, char *url);

function RTMP_SetupURL(var r:RTMP; url:PAnsichar):integer;

并且记录 AVal 声明如下:

AVal = record
av_val: PansiChar; 
av_len: integer;
end;

在设置 URL 之前存在初始化问题,我的记录 (RTMP)未正确初始化,在我的记录下面:

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 时使用的“链接”记录外,所有记录均已初始化。 我猜该记录未正确声明

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;

and the record AVal is declared like that:

AVal = record
av_val: PansiChar; 
av_len: integer;
end;

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;

then I call:

var MY_RTMP: RTMP;
MY_RTMP := RTMP_Alloc;
RTMP_Init(MY_RTMP);

all the record is initialized excepted the "Link" record that is used when initializing the URL.
I guess the record is not properly declared

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

握住你手 2024-12-13 19:02:49

我会尝试这个。 这里是我用作基础的源。

function RTMP_SetupURL(var R: RTMP; Url: PAnsiChar): Integer; cdecl; 
  external 'librtmp.dll' name 'RTMP_SetupURL';

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';
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文