0

I tried to add mp3 audio playback (LAME encoded) to my Inno setup program using Inno Media Player and following @TLama's decription -> https://stackoverflow.com/a/12360780/3838926. I use Windows 7 64bit with Unicode Inno.

Unfortunately it fails: When opening the installer I get the following error message: TDirectShowPlayer error: -2147220890; Searching through Google didn't help.

What do I do wrong? Is it a bug in the program? I'm clueless...

Here's the exact code:

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 is my audio file.

Thanks in advance!!

Community
  • 1
  • 1
nuc
  • 1
  • That is the [`VFW_E_NO_TRANSPORT`](http://msdn.microsoft.com/en-us/library/windows/desktop/dd375623%28v=vs.85%29.aspx#VFW_E_NO_TRANSPORT) error about which there are few discussions (e.g. [`here`](http://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/58d4d17b-3545-471a-8a3a-62adc0785445/renderfile-on-mp3-trows-an-exception?forum=windowsdirectshowdevelopment), or [`here`](http://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/b7a73b88-c63c-4b77-a02d-262eda707caf/play-mp3-and-wav-file-getting-error-exception-from-hresult-0x80040266-with?forum=windowsdirectshowdevelopment))... – TLama Aug 13 '14 at 18:23
  • ...however it seems that except building the filter graph manually (which is not supported by the plugin) there is no reliable solution. As it seems, this error (often) occurs when the MP3 file has a big ID3 tag (e.g. image file). Does your MP3 file have an ID3 tag ? If so, could you try to remove it ? – TLama Aug 13 '14 at 18:29
  • 1
    Thanks TLama, indeed it was caused by a big cover image (140kb)! Now everything works just fine :) Thanks so much :D – nuc Aug 13 '14 at 19:06

0 Answers0