Home Units Hierarchy Routines All identifiers

Class unaLibmpg123Decoder

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type unaLibmpg123Decoder = class(unaObject)

Description

libmpg123 decoder wrapper.

Hierarchy

Overview

Methods

Public constructor create(const libname: string = '');
Public function feed(data: pointer; size: unsigned): iresult;
Public function getDecoderNames(supportedOnly: bool = true; list: unaStringList = nil): charpp;
Public function open(): iresult; overload;
Public function open(const filename: string): iresult; overload;
Public function read(outdata: pointer; var outsize: unsigned): iresult;
Public procedure BeforeDestruction(); override;
Public procedure close();
Protected procedure formatChange(rate, channels, encoding: int); virtual;

Properties

Public property autoResynch: bool read f_autoResynch write f_autoResynch;
Public property bitrate: int read getBitrate;
Public property decoder: string read getDecoder write setDecoder;
Public property handle: pmpg123_handle read f_mh;
Public property libOK: bool read f_libOK;
Public property onFormatChange: unaLibmpg123_onFormatChange read f_onFC write f_onFC;
Public property proto: plibmpg123_proto read getProto;

Description

Methods

Public constructor create(const libname: string = '');

Creates new instance of libmpg123 decoder.

Parameters
libname
DLL file name. Default is '' which means that default library name will be used.
Public function feed(data: pointer; size: unsigned): iresult;

Feeds library with new portion of mp3 data. Library must be opened for feeding with open(). Use read() method to read available uncompressed audio data.

Parameters
data
Pointer to buffer with mp3 data.
size
Size of buffer in bytes.
Returns

MPG123_OK or error code.

Public function getDecoderNames(supportedOnly: bool = true; list: unaStringList = nil): charpp;

Lists available decoder names.

decoder names (plain 8bit ASCII).

Parameters
supportedOnly
Lists supported decoders only. Default is True.
list
Optional string list to be filled with available decoder names. Default is nil.
Returns

Return a NULL-terminated array of generally available (supportedOnly = False) or supported by the CPU (supportedOnly = True)

Public function open(): iresult; overload;

Opens library for direct mp3 data feeding. Use feed() to feed library with new portion of mp3 data. Use read() to read available uncompressed audio data. Use close() to release library handle.

Returns

MPG123_OK or error code.

Public function open(const filename: string): iresult; overload;

Opens library for direct mp3 file reading. Use read() to read uncompressed audio data. Use close() to release library handle.

Parameters
filename
Name of mp3 file to read ddta from.
Returns

MPG123_OK or error code.

Public function read(outdata: pointer; var outsize: unsigned): iresult;

Reads up to outsize uncompressed audio bytes (if available). Library must be opened for feeding or reading with open(). If library was open for feeding, use feed() method to feed library with new portion of mp3 data.

Library will try to fill the whole buffer if there is enough input data. Actual number of bytes written into buffer is returned via this variable. Also check the result for reason of other possible errors or warnings.

MPG123_NEED_MORE library needs more data to fill the whole buffer. Actual number of bytes is returned via outsize parameter. MPG123_OK the buffer was filled, call feed() again to read more data. MPG123_DONE Means track had a fixed VBR header with total track size information. According to this header no more mp3 data is available. Or some error code.

Parameters
outdata
Pointer to buffer to write decompressed audio into.
outsize
Specifies size of buffer in bytes.
Returns

MPG123_NEW_FORMAT in case a new audio format is detected. Returned at least once. No data is returned in this case.

Public procedure BeforeDestruction(); override;

Cleans up the instance before destruction.

Public procedure close();

Closes any handles opened by library after open().

Protected procedure formatChange(rate, channels, encoding: int); virtual;

Called when new format was detected in read().

Parameters
rate
The sample rate value (in Hertz).
channels
A combination of MPG123_STEREO and MPG123_MONO.
encoding
Refer to MPG123_ENC_XXX constants.

Properties

Public property autoResynch: bool read f_autoResynch write f_autoResynch;
 
Public property bitrate: int read getBitrate;

Current bitrate. May change from frame to frame.

Public property decoder: string read getDecoder write setDecoder;

Returns current decoder or assigns a new one (use getDecoderNames() to list available decoders). NOTE: Current decoder is alwyas '' due to limitation of library.

Public property handle: pmpg123_handle read f_mh;

Direct access to internal handle.

Public property libOK: bool read f_libOK;
 
Public property onFormatChange: unaLibmpg123_onFormatChange read f_onFC write f_onFC;

Fired when new format is detected during read().

Public property proto: plibmpg123_proto read getProto;

Direct access to library prototypes.

(c) 2012 Lake of Soft


Generated by PasDoc 0.12.1 on 2012-10-09