Two PECL Proposals [linux_oss] and [oggvorbis]
| From: | pollita@php.net | Date: | Tue, 09 Sep 2003 07:59:58 +0000 |
| Subject: | Two PECL Proposals [linux_oss] and [oggvorbis] | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-21226@lists.php.net to get a copy of this message | ||
I'd like to propose two PECL extensions:
1) linux_oss http://frankenbox.alphaweb.net/test/linux_oss-0.1.tgz
Description: Bindings for the Linux Open Sound System API.
Functions:
linux_oss_buffer() : Setup DSP buffer on /dev/dsp or similar device
linux_oss_channels() : Set DSP to process number of channels (mono vs.
stereo)
linux_oss_rate() : Set sampling rate on DSP device
linux_oss_format() : Set sample encoding 8/16 bit, signed/unsigned,
big/little endian
linux_oss_mixer_query() : Probe capabilities of mixer
linux_oss_mixer_vol() : Get/Set volume on mixer channel
linux_oss_mixer_source() : Get/Set recording source
Purpose: Control sound I/O on linux systems. Yes, this is platform
specific, but sound is a platform specific thing. I'll propose Windows
sound system bindings later, and ultimately bindings for Solaris and BSD as
I research them.
Requirements: PHP >= 4.3.0, Linux w/ OSS kernel module and headers
2) oggvorbis http://frankenbox.alphaweb.net/test/oggvorbis-0.1.tgz
Description: OGG/Vorbis fopen wrapper.
ogg:// write - Encode PCM audio to OGG/Vorbis compressed audio.
ogg:// read - Decode OGG/Vorbis compressed audio to PCM.
Example Usage: .ogg player
<?php
dl('linux_oss.so');
dl('oggvorbis.so');
$input = fopen('ogg://mymusic.ogg', 'r');
$oggdata = stream_get_meta_data($input);
/* Chained OGGs will be added as subsequent numericly indexed subarrays of
wrapper_data */
$songdata = $oggdata['wrapper_data'][0];
$output = fopen('/dev/dsp', 'w');
linux_oss_buffer($output, 8192);
linux_oss_channels($output, $songdata['channels']);
/* AFMT_S16_LE is the default output mode of ogg:// wrapper.
It can also be set to encodings listed above via a context option. */
linux_oss_format($output, AFMT_S16_LE);
linux_oss_rate($output, $songdata['rate']);
$mixer = fopen('/dev/mixer', 'w');
/* Master Volume L / R */
linux_oss_mixer_vol($mixer, MIXER_VOLUME, 100, 100);
/* DSP Output Volume L / R */
linux_oss_mixer_vol($mixer, MIXER_PCM, 100, 100);
stream_copy_to_stream($input, $output);
fclose($mixer);
fclose($output);
fclose($intput);
?>
Requirements: PHP >= 4.3.0, libogg, libvorbis (both governed by BSD style
licenses)