18 Jun '13 - 22:11 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1]
  Reply  |  Print  
Author Topic: Seek from the end does not work for this WMA file  (Read 644 times)
Xire
Posts: 241


« on: 19 May '12 - 18:48 »
Reply with quoteQuote

Hi Ian,

I uploaded file badseek.wma. For some reason seeking from end of the file does not work until some position.
Here's the code I used:

procedure TForm1.Button1Click(Sender: TObject);
var
  h: HSTREAM;
  pos: int64;
begin
  h := BASS_WMA_StreamCreateFile(False, PChar('badseek.wma'), 0, 0,
    BASS_STREAM_DECODE or BASS_UNICODE);
  if h <> 0 then begin
    pos := BASS_ChannelGetLength(h, BASS_POS_BYTE);
    Memo1.Lines.Add(Format('Channel len = %d (%.2f)', [pos, BASS_ChannelBytes2Seconds(h, pos)]));
    repeat
      if not BASS_ChannelSetPosition(h, pos, BASS_POS_BYTE) then begin
        Memo1.Lines.Add(Format('Failed with code %d for position %d (%.2f)', [BASS_ErrorGetCode, pos,
          BASS_ChannelBytes2Seconds(h, pos)]));
      end else begin
        Memo1.Lines.Add(Format('Succeeded for position %d (%.2f)', [pos, BASS_ChannelBytes2Seconds(h, pos)]));
        Break;
      end;
      pos := pos - BASS_ChannelSeconds2Bytes(h, 0.01);
    until False;
  end;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  BASS_Init(-1, 44100, 0, Form1.handle, nil);
end;

And here's the output:

Quote
Channel len = 33186484 (188.13)
Failed with code 7 for position 33186484 (188.13)
Failed with code 7 for position 33184720 (188.12)
Failed with code 7 for position 33182956 (188.11)
Failed with code 7 for position 33181192 (188.10)
Failed with code 7 for position 33179428 (188.09)
Failed with code 7 for position 33177664 (188.08)
Failed with code 7 for position 33175900 (188.07)
Failed with code 7 for position 33174136 (188.06)
Failed with code 7 for position 33172372 (188.05)
Failed with code 7 for position 33170608 (188.04)
Failed with code 7 for position 33168844 (188.03)
Failed with code 7 for position 33167080 (188.02)
Failed with code 7 for position 33165316 (188.01)
Failed with code 7 for position 33163552 (188.00)
Failed with code 7 for position 33161788 (187.99)
Succeeded for position 33160024 (187.98)
Logged
Ian @ un4seen
Administrator
Posts: 15363


« Reply #1 on: 21 May '12 - 14:25 »
Reply with quoteQuote

The WMA decoder is reporting that it's at the end of the file when asked to deliver data from those positions close to the end. Here's an update that will request a slightly earlier position (and skip the extra data) if the initial request fails...

   www.un4seen.com/stuff/basswma.dll
Logged
Xire
Posts: 241


« Reply #2 on: 22 May '12 - 07:44 »
Reply with quoteQuote

Worked fine with that wma file, but I've found another one, but I cannot upload it to ftp Sad
Logged
Ian @ un4seen
Administrator
Posts: 15363


« Reply #3 on: 22 May '12 - 14:18 »
Reply with quoteQuote

I can see your incomplete upload attempts on the server. Did the connection die mid-upload? Perhaps there was a temporary network problem. Please try again, and if you still have trouble with it, you could email the file to me instead.
Logged
Xire
Posts: 241


« Reply #4 on: 22 May '12 - 14:57 »
Reply with quoteQuote

Uploaded badseek10.wma Wink
Logged
Ian @ un4seen
Administrator
Posts: 15363


« Reply #5 on: 22 May '12 - 15:25 »
Reply with quoteQuote

Yep, the decoder is still reporting that it's at the end even when BASSWMA requests an earlier position. Personally, I think the decoder should have ended these particular files a lot earlier Wink

Here's another update, which will try taking another step back from the requested position...

   www.un4seen.com/stuff/basswma.dll
Logged
Xire
Posts: 241


« Reply #6 on: 22 May '12 - 17:37 »
Reply with quoteQuote

Worked fine for those files I have. Thanks Wink
Logged
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.18 | SMF © 2013, Simple Machines