神龙卡的回调函数function FMPCallbackProc(bMsg:BYTE; hMPEGStream:BYTE; dwValue:DWORD):WOR

欢_乐

Unregistered / Unconfirmed
GUEST, unregistred user!
神龙卡的回调函数function FMPCallbackProc(bMsg:BYTE;
hMPEGStream:BYTE;
dwValue:DWORD):WORD;stdcall;(100分)
<br />神龙卡的回调函数
function FMPCallbackProc(bMsg:BYTE;
hMPEGStream:BYTE;
dwValue:DWORD):WORD;stdcall;
该如何写
 
silion大哥,帮忙吧
 
Function FMPCallbackProc(bMsg: Byte;
hMPEGStream: Byte;
dwValue: DWORD): WORD stdcall;
var
Buf:pBuf;
i:integer;
begin

// showmessage(inttostr(bmsg));
Result:= 0;
try
Buf:= Pointer(FMPGet(hMPEGStream, FMPI_STM_USER));
case bMsg of
//创建缓冲区
FMPM_BUF_CREATE:
begin

showmessage('create');
GetMem(Buf,sizeof(TBuf));
//Buf := GlobalAllocPtr(GMEM_FIXED,sizeof(TBuf));
if Buf=nil then

begin

MessageBox(0,'分配内存出错,可能是内存不足!','错误',
MB_ICONEXCLAMATION);
Result:=FMPE_DOS;
Exit;
end;


Fillchar(Buf^,sizeof(TBUF),0);
Buf.hFile:= CreateFile(pChar(FileName),//TFMP_OPEN_STRUCT(dwValue).lpFileName,
GENERIC_READ,
FILE_SHARE_READ,
Nil,
OPEN_EXISTING,
0,
0);

if (Buf.hFile=INVALID_HANDLE_VALUE) then

begin

MessageBox(0,'打开文件出错!','错误',MB_ICONEXCLAMATION);
FreeMemory(buf);
//GlobalFreePtr( Buf );
Result:=FMPE_DOS;
Exit;
end;


for i := 0 to MAX_BUF_NUMBER-1do

GetMem(Buf.Buffer,MAX_BUF_SIZE + 2);
//GlobalAllocPtr(GMEM_FIXED, );

Buf.wIndex := 0;
Buf.dwSize := 0;

//存储缓冲区结构到用户段
FMPSet(hMPEGStream,FMPI_STM_USER, DWORD(Buf) );

//在到缓冲区3/4时,触发填充下一个缓冲区
FMPSet(hMPEGStream, FMPI_BUF_POS, DWORD(Trunc(MAX_BUF_SIZE* 0.75)));

//FMPSet(hMPEGStream,FMPI_BUF_MODE,FMPF_BUF_LOOP);
end;


//关闭缓冲区
FMPM_BUF_CLOSE :
begin

showmessage('close');

CloseHandle(Buf.hFile);
for i:=0 to MAX_BUF_NUMBER-1do

FreeMemory(Buf.Buffer);
//GlobalFreePtr(Buf.Buffer);
FreeMemory(Buf);
//GlobalFreePtr(Buf);
end;


//跳跃
FMPM_BUF_SEEK:
begin

showmessage('seek');
SetFilePointer(Buf.hFile,dwValue,nil,FILE_begin
);
end;


//读书据
FMPM_BUF_POS:
begin

//showmessage('readfile');
//showmessage('pos'+inttostr(Buf.wIndex));

if ReadFile(Buf.hFile,Buf.Buffer[Buf.wIndex],MAX_BUF_SIZE,Buf.dwSize,nil) then

// SHOWMESSAGE('READ OK');
// showmessage('pos'+inttostr(Buf.dwSize));
end;


// 缓冲区空
FMPM_BUF_EMPTY : //showmessage('Empty');//BufEmpty;
begin

//showmessage('empty'+inttostr(Buf.dwSize));
FMPSet(hMPEGStream, FMPI_BUF_SIZE,Buf.dwSize );
FMPSet(hMPEGStream, FMPI_BUF_ADDRESS, DWORD(Buf.Buffer[Buf.wIndex]));
// FMPSet( ghMPEGStream, FMPI_BUF_HANDLE, (DWORD)Buf->BufferIndex[Buf->wIndex] );
Inc(Buf.wIndex);
// showmessage(inttostr(Buf.wIndex));
if (Buf.wIndex = MAX_BUF_NUMBER) then
Buf.wIndex:=0;
//Buf.wIndex := MAX_BUF_NUMBER MOD Buf.wIndex;
end;


//错误
FMPM_ERROR:
begin

showmessage('error');
end;

//操作完成
FMPM_COMPLETED :
begin

showmessage('COMPLETED');
if dwValue = 3 then
// 播完
begin

//if AutoPlayNext then

// PostMessage(MainForm.Handle, FMP_NEXT, 0, 0)
//else

Showmessage('已播完,按停唱播下一首');
end;

end ;
end;

except
//异常
CloseHandle(Buf.hFile);
for i:=0 to MAX_BUF_NUMBER-1do

FreeMemory(Buf.Buffer);
FreeMemory(Buf);
end;


end;
 
to:aijun

PBuf怎么定义的啊?
 
to :aijun
这样写能通过吗?
 
VOD播放控件1.5版
下载地址一 :http://stgzs.myetang.com/downloads/stVodVcl1.5.rar

下载地址二:http://www.playicq.com


VOD控件1.5版
修正了DVD的伴唱问题,增加了属性得到文件类型(VCD DVD)。


VOD控件1.2版
修正了左右声道,立体声道切换不正确。

VOD控件1.1版

修正了1.0版的播放大于170M的DVD文件出错,增加了一些属性,支持文件流播放和文件播放两种播放方式

专门为VOD视频点播系统开发。用于控制RealMagic公司的硬解压设备,已测试的型号有神龙卡二代和三代,好莱坞卡二代和三代。

安装:
1、 双击stVodD6.dpk,在DELPHI环境,点击Install。
2、 TOOLS---ENVIRONMENT OPTIONS--- LIBRARY ---LIBRARY PATH 添加TFMPPLAYER控件路径(注意不要编译)
 
使用了aijun提供的回调函数,但是不能实现缓冲播放???
请3cs对aijun所写的回调函数的代码提出修改意见!!!


 
这样写通不过啊,到读数据的时候就出错,程序自动关了啊,谁能修改好啊???
 
不正确   c0000005 0x77e55b46 address 0xba010000
 
这个当然通过不了,还不如自己照着SDK 中C代码自己写,主要注意指针类型的用法!!
 
是不是 FMP_Command 在C 和 PASCAL 定义不同呢?

The commands are called with an assembler 'int' instruction with the parameters in registers.
The interrupt number will have been found before with the method described in 'Installation'.

Note: As mentioned under ‘Installation’, if your C-Compiler has difficulty using the int86 function, you should call a vector instead. In this case, use the inline assembly version of FMP_Command below.

The parameters are always of the form :
BH : Command id
BL : Stream handle
CX : flags (eventually combined with a value)
DX,AX : a 32 bits value (high word in DX) or a pointer with the segment in DX and the offset in AX.

In return, BX will indicate if the command was successful. It is zero in this case otherwise in will contain the error code. The error code is in BH. If the error code indicates ado
S error, BL will contain thedo
S error code.

If the command returns a value, it will always be in DX,AX (high word in DX).

Only the registers AX,BX,CX,DX will be modified by the driver call.


The simplest way to call the driver is this:

#include <dos.h>
#include “wtypes.h”
unsigned long FMP_Command(BYTE Command,BYTE hStream,
WORD Flags, DWORD Value)
{
union REGS InRegs,OutRegs;
unsigned Error;

InRegs.h.bh=Command;
InRegs.h.bl=hStream;
InRegs.x.dx=Value>>16;
InRegs.x.ax=(unsigned)Value;
InRegs.x.cx=Flags;
int86(FMPIntNb,&amp;InRegs,&amp;OutRegs);
/* FMPIntNb is the interrupt */
/* number of the driver */
FMPStatus=OutRegs.x.bx;
return ((unsigned long)(OutRegs.x.dx)<<16)+OutRegs.x.ax;
}

If, however, this int86() call causes problems, and you are using C language that supports inline assembly language, you can use a function defined like this for calling the driver:

#include <dos.h>
#include “wtypes.h”
unsigned long FMP_Command(BYTE Command,BYTE hStream,
WORD Flags,DWORD Value)
{
if (!Vector)
{
FMPStatus=FMPE_ERROR;
return 0L;
}

// Set up for the command
_asm mov bh, Command
_asm mov bl, hStream
_asm mov dx, word ptr Value+2
_asm mov dx, word ptr Value
_asm mov cx, Flags
_asm pushf

_asm call dword ptr [Vector]

// Get the error
FMPStatus=_BX;
// the return value is already in ax,dx -- Ignore the warning
}

and in Turbo Pascal :

usesdo
s;
function FMP_Command(Command, Stream : byte;
Value : longint;

Flgs : word) : longint ;
var
Regs:registers;
Error:word;
begin

with Regsdo

begin

bh:=Command;
bl:=Stream;
dx:=Value shr 16;
ax:=word(Value);
cx:=Flgs;
Intr(FMPIntNb,Regs);
(* FMPIntNb is the interrupt *)
(* number of the driver *)
Error:=bx;
(* check for errors here *)
FMP_Command:=longint(dx) shl 16 + ax;
end;

end;


For each command, you can specify the flag FMPF_TEST. This flag is used to know if the driver or hardware can support the command, and no action will take place.

 
to:chz1119,不用那么复杂,你有QQ或是MSN?我的QQ:270260155,有空互相学习。
 
to:bluesky888 ,你好! 我看过你贴的程序,怎么也不能通过,能发一份ok 的给我吗? 
我的程序就差这一关不能通过。
email:chz1119@21cn.com
qq:121189296.
 
to:chz1119上次那个本来就是不能通过的。我发个编译通过的神龙回调!!,请收MAIL
 
to bluesky888, 己收到,并成功调试,非常谢谢您!
 
也发一份神龙的回调给我好吗?谢谢
email:x-soft@163.com
 
菜鸟学习Delphi下多媒体开发,大哥能不能也发一份回调函数给我参考参考!!!
Email:roclei@263.net
 
请发一份给我?EM:cosher@163.com.急
 
请发一份给我.EM:cosher@163.com.
 
顶部