Re: [mpg123-users] Are Ports code still usable ?
Brought to you by:
sobukus
|
From: Fred v. S. <fi...@ho...> - 2015-03-26 23:09:41
|
OK. many thanks for your light ;-)
Hum, about audio internet streaming, this one works on Windows console applications, with fpc ;-) =>
=> mpg123_replace_reader_handle(MyMpHandle, @mpg_read_stream, @mpg_seek_stream, @mpg_close_stream);
=> mpg123_open_handle(MyMpHandle, Pointer(InPipe));
Here procedures used for replace_reader_handle =>
function mpg_read_stream(ahandle: Pointer; AData: Pointer; ACount: Integer): Integer;
var
Stream: TStream absolute ahandle;
begin
Result := Stream.Read(AData^, ACount);
end;
function mpg_seek_stream(ahandle: Pointer; aoffset: Integer): Integer;
var
Stream: TStream absolute ahandle;
begin
// pipe streams are not seekable but memory and filestreams are
Result := aoffset;
try
if aoffset <> 0 then
Result := Stream.Seek(soFromCurrent, aoffset);
except
Result := 0;
end;
end;
procedure mpg_close_stream(ahandle: Pointer);
begin
TObject(ahandle).Free;
end;
_________________________________________________________________________________
All works perfectly for *.nix systems with console and GUI applications.
For Windows, works perfectly but only with console applications.
For GUI applications, i have same problem than with mpg_open_fd => error 12 on mpg_read().
And with the same code used for a simple working console application.
And that i do absolutely not understand why.
Debugger is not helpful, i am loosed... ;-)
But all that does not concern mpg123 anymore...
By the way, lot of thanks for all your help.
Viva mpg123.
Fre;D
|