Author Topic: BASS_StreamCreateFileUser broken on Windows 20H1  (Read 3177 times)

StephBel

  • Posts: 14
Re: BASS_StreamCreateFileUser broken on Windows 20H1
« Reply #25 on: 27 Jun '24 - 11:42 »
Upload a audio file on the ftp...

In modify spectrum exemple added to the previous message, in void CALLBACK UpdateSpectrum(UINT uTimerID, UINT uMsg, DWORD_PTR dwUser, DWORD_PTR dw1, DWORD_PTR dw2)

I receive the same error...I'm sure that also BASS_ChannelSetPosition will result the same error

Ian @ un4seen

  • Administrator
  • Posts: 26015
Re: BASS_StreamCreateFileUser broken on Windows 20H1
« Reply #26 on: 27 Jun '24 - 16:53 »
It does appear that Media Foundation is unfortunately unable to get the duration of that MP4 file. Windows Media Player has the same problem with it. Do you know what encoder and settings were used to create it? Also, what is the workaround that you mentioned for BASS 2.4.15, and does that not work with 2.4.17 too?

StephBel

  • Posts: 14
Re: BASS_StreamCreateFileUser broken on Windows 20H1
« Reply #27 on: 28 Jun '24 - 07:51 »
The workaround is basically seeking into the track (see code below).
With 2.4.17 we have error also on BASS_ChannelSetPosition(handle, BASS_POS_BYTE); 

BASS_ChannelSetPosition(handle, 0, BASS_POS_BYTE); return false with value of BASS_ErrorGetCode BASS_ERROR_POSITION.
This is working fine with older versions of BASS.

long long getLength(long long handle)
{
   long long length = BASS_ChannelGetLength(handle, BASS_POS_BYTE);
   long long position = BASS_ChannelGetPosition(handle, BASS_POS_BYTE);
 
   if (length == (long long)(-1) && position != (long long)(-1) && BASS_ChannelSetPosition(handle, 0, BASS_POS_BYTE))
   {
      long long step = 1 << 20;
      long long pos = 0;
      while (TRUE)
      {
         if (BASS_ChannelSetPosition(handle, pos + step, BASS_POS_BYTE))
            pos += step;
         else if (step != 1)
            step /= 2;
         else
         {
            length = pos;
            break;
         }
      }
      BASS_ChannelSetPosition(handle, position, BASS_POS_BYTE);
   }
 
   return length;
}

Ian @ un4seen

  • Administrator
  • Posts: 26015
Re: BASS_StreamCreateFileUser broken on Windows 20H1
« Reply #28 on: 28 Jun '24 - 14:46 »
I see. BASS 2.4.17 does disable seeking with Media Foundation when the file's duration is unknown, while 2.4.15 still allowed seeking to be attempted. Here's a 2.4.17 update for you to try, which again allows seeking to be attempted:

   www.un4seen.com/stuff/bass.zip

From the MP4 file's tags, it looks like your app is creating the file? If so, I think the best solution would be to change the way that's done, to make the duration known. If the file is currently created via an external encoder writing to STDOUT (eg. using a callback with BASS_Encode_Start) then perhaps you could have the encoder write to a file instead? That would allow the encoder to go back and update values in the file.

StephBel

  • Posts: 14
Re: BASS_StreamCreateFileUser broken on Windows 20H1
« Reply #29 on: 28 Jun '24 - 14:55 »
Thanks I'll try this.

StephBel

  • Posts: 14
Re: BASS_StreamCreateFileUser broken on Windows 20H1
« Reply #30 on: 1 Jul '24 - 08:24 »
From the MP4 file's tags, it looks like your app is creating the file?
In fact this is dump from a streaming service.

Here's a 2.4.17 update for you to try
Thanks it seems to work!