缓冲区的创建

qlonsh 2008-06-24 10:50:33
请问如何声明8个StreamBuffer类型的数组啊?因为我要开辟8个缓冲区,如果一个个创建比较麻烦,况且不利于代码的编写,请指教!下面是其中的一个缓冲区的代码,但是我要创建8个,如何实现呢?请指教!
声明:
StreamBuffer:array[0..65535] of byte; //64K字节,UDP发送的最大包长度(缓冲区)
Bufflength:integer;
sendvideo: TIdUDPClient;
status: integer;
函数:ReadStreamData(通道句柄,缓冲区,缓冲大小,帧类型)
status:=ReadStreamData(channelHwnd[0],@StreamBuffer,@Bufflength,@FrameType);

case FrameType of
$00001: //PktIFrames I帧包
begin
//I帧网络发送
if (sendvideo.Active) then
begin
if sendvideo.Active then sendvideo.SendBuffer(StreamBuffer,Bufflength);
end;
memo1.Lines.Add('I帧长度:'+inttostr(Bufflength));
end;
$00004: //PktBBPFrames B帧包
begin
//B帧网络发送
if ((sendvideo.Active) then
begin
if sendvideo.Active then sendvideo.SendBuffer(StreamBuffer,Bufflength);
end;
memo1.Lines.Add('B帧长度:'+inttostr(Bufflength));
end;
...全文
58 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
etomahawk 2008-06-24
  • 打赏
  • 举报
回复
const
BUF_SIZE = 65535;

var
ptrBuf: array[0..7] of Pointer;
nTmp : Integer;
begin
for nTmp:= 0 to 7 do begin
GetMem(@ptrBuf[0], SizeOf(BYTE) * BUF_SIZE);

//...
end;

指针可以当作数组,只要你明白数组是怎么实现的。

StreamBuffer:array[0..65535] of byte; 我不知道这样能不能运行。我估计系统的栈没有那么大(一般是2K)。除非你是全局的。

5,390

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧