Skip to content

danog\MadelineProto\Ogg: Async OGG stream reader and writer.

Back to index

Author: Daniil Gentili daniil@daniil.it
Author: Charles-Édouard Coste contact@ccoste.fr

Async OGG stream reader and writer.

Constants

  • danog\MadelineProto\Ogg::CONTINUATION:

  • danog\MadelineProto\Ogg::BOS:

  • danog\MadelineProto\Ogg::EOS:

  • danog\MadelineProto\Ogg::STATE_READ_HEADER:

  • danog\MadelineProto\Ogg::STATE_READ_COMMENT:

  • danog\MadelineProto\Ogg::STATE_STREAMING:

  • danog\MadelineProto\Ogg::STATE_END:

Properties

  • $pageOffset: int Byte offset of the OGG page currently being read.

This is a page boundary, so re-opening the file here with the $startOffset constructor argument resumes reading exactly this page, which is what makes playback byte-offset resumable across a serialize/unserialize cycle.

  • $opusPackets: iterable<string> Opus packet iterator.
  • $vendorString: string
  • $comments: list<string>

Method list:

Methods:

__construct(\danog\MadelineProto\LocalFile|\danog\MadelineProto\RemoteUrl|\Amp\ByteStream\ReadableStream $stream, ?\Amp\Cancellation $cancellation = NULL, int $startOffset = 0)

Constructor.

Parameters:

  • $stream: \danog\MadelineProto\LocalFile|\danog\MadelineProto\RemoteUrl|\Amp\ByteStream\ReadableStream
  • $cancellation: ?\Amp\Cancellation
  • $startOffset: int

See also:

packetDuration(string $packet): int

Get the duration of an OPUS packet, in 48kHz samples (0 if the packet is malformed).

The duration is read from the TOC byte (and, for packets with an arbitrary number of frames,
from the frame count byte) of the packet, see RFC 6716 §3.1.

Parameters:

  • $packet: string

validate(\danog\MadelineProto\LocalFile|\danog\MadelineProto\RemoteUrl|\Amp\ByteStream\ReadableStream $file, ?\Amp\Cancellation $cancellation = NULL): void

Validate that the specified file, URL or stream is a valid VoIP OGG OPUS file.

Parameters:

  • $file: \danog\MadelineProto\LocalFile|\danog\MadelineProto\RemoteUrl|\Amp\ByteStream\ReadableStream
  • $cancellation: ?\Amp\Cancellation

See also:

convert((\danog\MadelineProto\LocalFile|\danog\MadelineProto\RemoteUrl|\Amp\ByteStream\ReadableStream) $in, (\danog\MadelineProto\LocalFile|\Amp\ByteStream\WritableStream) $oggOut, ?\Amp\Cancellation $cancellation = NULL): void

Converts a file, URL, or stream of any format (including video) into an OGG audio stream suitable for consumption by MadelineProto’s VoIP implementation.

Parameters:

  • $in: (\danog\MadelineProto\LocalFile|\danog\MadelineProto\RemoteUrl|\Amp\ByteStream\ReadableStream) The input file, URL or stream.
  • $oggOut: (\danog\MadelineProto\LocalFile|\Amp\ByteStream\WritableStream) The output file or stream.
  • $cancellation: ?\Amp\Cancellation

See also:

validateOgg(\danog\MadelineProto\LocalFile|\danog\MadelineProto\RemoteUrl|\Amp\ByteStream\ReadableStream $f): void

Validate that the specified OGG OPUS file can be played directly by MadelineProto, without doing any conversion.

Parameters:

  • $f: \danog\MadelineProto\LocalFile|\danog\MadelineProto\RemoteUrl|\Amp\ByteStream\ReadableStream

See also:

convertWav((\danog\MadelineProto\LocalFile|\danog\MadelineProto\RemoteUrl|\Amp\ByteStream\ReadableStream) $wavIn, (\danog\MadelineProto\LocalFile|\Amp\ByteStream\WritableStream) $oggOut, ?\Amp\Cancellation $cancellation = NULL): void

Converts a file, URL, or stream in WAV format @ 48khz into an OGG audio stream suitable for consumption by MadelineProto’s VoIP implementation.

Parameters:

  • $wavIn: (\danog\MadelineProto\LocalFile|\danog\MadelineProto\RemoteUrl|\Amp\ByteStream\ReadableStream) The input file, URL or stream.
  • $oggOut: (\danog\MadelineProto\LocalFile|\Amp\ByteStream\WritableStream) The output file or stream.
  • $cancellation: ?\Amp\Cancellation

See also:


Generated by danog/phpdoc