通过Inno Media Player播放mp3失败

时间:2014-08-13 18:14:43

标签: audio inno-setup

我尝试使用Inno Media Player将mp3音频播放(LAME编码)添加到我的Inno安装程序中并遵循@ TLama的解密 - > https://stackoverflow.com/a/12360780/3838926。我使用Windows 7 64bit和Unicode Inno。

不幸的是它失败了:打开安装程序时出现以下错误消息:TDirectShowPlayer error: -2147220890;通过Google搜索没有帮助。

我做错了什么?这是程序中的错误吗?我一无所知......

这是确切的代码:

const
  EC_COMPLETE = $01;
type
  TDirectShowEventProc = procedure(EventCode, Param1, Param2: Integer);

function DSGetLastError(var ErrorText: WideString): HRESULT;
  external 'DSGetLastError@files:mediaplayer.dll stdcall';
function DSPlayMediaFile: Boolean;
  external 'DSPlayMediaFile@files:mediaplayer.dll stdcall';
function DSStopMediaPlay: Boolean;
  external 'DSStopMediaPlay@files:mediaplayer.dll stdcall';
function DSSetVolume(Value: LongInt): Boolean;
  external 'DSSetVolume@files:mediaplayer.dll stdcall';
function DSInitializeAudioFile(FileName: WideString; 
  CallbackProc: TDirectShowEventProc): Boolean; 
  external 'DSInitializeAudioFile@files:mediaplayer.dll stdcall';

procedure OnMediaPlayerEvent(EventCode, Param1, Param2: Integer); 
begin
  if EventCode = EC_COMPLETE then
  begin
    // playback is done, so you can e.g. play the stream again, play another
    // one using the same code as in InitializeWizard (in that case would be
    // better to wrap that in some helper function) or do just nothing
  end;
end;

procedure InitializeWizard;
var
  ErrorCode: HRESULT;
  ErrorText: WideString;   
begin
  ExtractTemporaryFile('InDeep.mp3');
  if DSInitializeAudioFile(ExpandConstant('{tmp}\InDeep.mp3'), 
    @OnMediaPlayerEvent) then
  begin
    DSSetVolume(-2500);
    DSPlayMediaFile;
  end
  else
  begin
    ErrorCode := DSGetLastError(ErrorText);
    MsgBox('TDirectShowPlayer error: ' + IntToStr(ErrorCode) + '; ' + 
      ErrorText, mbError, MB_OK);
  end;
end;

procedure DeinitializeSetup;
begin
  DSStopMediaPlay;
end;

InDeep.mp3是我的音频文件。

提前致谢!!

0 个答案:

没有答案