downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

Our source is open

The syntax highlighted source is automatically generated by PHP from the plaintext script. If you're interested in what's behind the several functions we used, you can always take a look at the source of the following files:

Of course, if you want to see the source of this page, we have it available. You can also browse the SVN repository for this website on svn.php.net.

Source of: /manual/en/wrappers.audio.php

<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$PARENTS = array();
include_once
dirname(__FILE__) ."/toc/wrappers.inc";
$setup = array (
 
'home' =>
  array (
   
0 => 'index.php',
   
1 => 'PHP Manual',
  ),
 
'head' =>
  array (
   
0 => 'UTF-8',
   
1 => 'en',
  ),
 
'this' =>
  array (
   
0 => 'wrappers.audio.php',
   
1 => 'Audio Streams',
  ),
 
'up' =>
  array (
   
0 => 'wrappers.php',
   
1 => 'List of Supported Protocols/Wrappers',
  ),
 
'prev' =>
  array (
   
0 => 'wrappers.ssh2.php',
   
1 => 'Secure Shell 2',
  ),
 
'next' =>
  array (
   
0 => 'wrappers.expect.php',
   
1 => 'Process Interaction Streams',
  ),
);
$setup["toc"] = $TOC;
$setup["parents"] = $PARENTS;
manual_setup($setup);

manual_header();
?>
<div id="wrappers.audio" class="section">
  <h2 class="title">Audio Streams</h2>
  <p class="simpara"><var class="filename">ogg://</var> PHP 4.3.0 and up (PECL) </p>

  <ul class="itemizedlist">
   <li class="listitem"><span class="simpara"><var class="filename">ogg://soundfile.ogg</var></span></li>
   <li class="listitem"><span class="simpara"><var class="filename">ogg:///path/to/soundfile.ogg</var></span></li>
   <li class="listitem"><span class="simpara"><var class="filename">ogg://http://www.example.com/path/to/soundstream.ogg</var></span></li>
  </ul>

  <blockquote><p><b class="note">Note</b>:
   <b>This wrapper is not enabled by default</b><br />
   <span class="simpara">
    In order to use the <var class="filename">ogg://</var> wrapper you must install
    the <a href="http://pecl.php.net/package/oggvorbis" class="link external">&raquo; OGG/Vorbis</a> extension
    available from <a href="http://pecl.php.net/" class="link external">&raquo; PECL</a>.
   </span>
  </p></blockquote>

  <p class="simpara">
   Files opened for reading via the <var class="filename">ogg://</var> wrapper
   are treated as compressed audio encoded using the <i>OGG/Vorbis</i> codec.
   Similarly, files opened for writing or appending via the
   <var class="filename">ogg://</var> wrapper are writen as compressed audio data.
   <a href="function.stream-get-meta-data.php" class="function">stream_get_meta_data()</a>, when used on an <i>OGG/Vorbis</i>
   file opened for reading will return various details about the stream
   including the <i><tt class="parameter">vendor</tt></i>
 tag, any included
   <i><tt class="parameter">comments</tt></i>
, the number of
   <i><tt class="parameter">channels</tt></i>
, the sampling <i><tt class="parameter">rate</tt></i>
,
   and the encoding rate range described by:
   <i><tt class="parameter">bitrate_lower</tt></i>
, <i><tt class="parameter">bitrate_upper</tt></i>
,
   <i><tt class="parameter">bitrate_nominal</tt></i>
, and <i><tt class="parameter">bitrate_window</tt></i>
.
  </p>

  <p class="para">
   </p><table class="doctable table">
    <caption><b>Wrapper Summary</b></caption>
   
     <thead valign="middle">
      <tr valign="middle">
       <th>Attribute</th>
       <th>Supported</th>
      </tr>

     </thead>

     <tbody valign="middle" class="tbody">
      <tr valign="middle">
       <td align="left">Restricted by <a href="filesystem.configuration.php#ini.allow-url-fopen" class="link">allow_url_fopen</a></td>
       <td align="left">No</td>
      </tr>

      <tr valign="middle">
       <td align="left">Allows Reading</td>
       <td align="left">Yes</td>
      </tr>

      <tr valign="middle">
       <td align="left">Allows Writing</td>
       <td align="left">Yes</td>
      </tr>

      <tr valign="middle">
       <td align="left">Allows Appending</td>
       <td align="left">Yes</td>
      </tr>

      <tr valign="middle">
       <td align="left">Allows Simultaneous Reading and Writing</td>
       <td align="left">No</td>
      </tr>

      <tr valign="middle">
       <td align="left">Supports <a href="function.stat.php" class="function">stat()</a></td>
       <td align="left">No</td>
      </tr>

      <tr valign="middle">
       <td align="left">Supports <a href="function.unlink.php" class="function">unlink()</a></td>
       <td align="left">No</td>
      </tr>

      <tr valign="middle">
       <td align="left">Supports <a href="function.rename.php" class="function">rename()</a></td>
       <td align="left">No</td>
      </tr>

      <tr valign="middle">
       <td align="left">Supports <a href="function.mkdir.php" class="function">mkdir()</a></td>
       <td align="left">No</td>
      </tr>

      <tr valign="middle">
       <td align="left">Supports <a href="function.rmdir.php" class="function">rmdir()</a></td>
       <td align="left">No</td>
      </tr>

     </tbody>
   
   </table>
<p>
  </p>
  <p class="para">
   </p><table class="doctable table">
    <caption><b>Context options</b></caption>
   
     <thead valign="middle">
      <tr valign="middle">
       <th>Name</th>
       <th>Usage</th>
       <th>Default</th>
       <th>Mode</th>
      </tr>

     </thead>

     <tbody valign="middle" class="tbody">
      <tr valign="middle">
       <td align="left"><i>pcm_mode</i></td>
       <td align="left">
        PCM encoding to apply while reading, one of:
        <b><tt class="constant">OGGVORBIS_PCM_U8</tt></b>, <b><tt class="constant">OGGVORBIS_PCM_S8</tt></b>,
        <b><tt class="constant">OGGVORBIS_PCM_U16_BE</tt></b>, <b><tt class="constant">OGGVORBIS_PCM_S16_BE</tt></b>,
        <b><tt class="constant">OGGVORBIS_PCM_U16_LE</tt></b>, and <b><tt class="constant">OGGVORBIS_PCM_S16_LE</tt></b>.
        (8 vs 16 bit, signed or unsigned, big or little <i>endian</i>)
       </td>
       <td align="left">OGGVORBIS_PCM_S16_LE</td>
       <td align="left">Read</td>
      </tr>

      <tr valign="middle">
       <td align="left"><i>rate</i></td>
       <td align="left">
        Sampling rate of input data, expressed in Hz
       </td>
       <td align="left">44100</td>
       <td align="left">Write/Append</td>
      </tr>

      <tr valign="middle">
       <td align="left"><i>bitrate</i></td>
       <td align="left">
        When given as an integer, the fixed bitrate at which to encode. (16000 to 131072)
        When given as a float, the variable bitrate quality to use. (-1.0 to 1.0)
       </td>
       <td align="left">128000</td>
       <td align="left">Write/Append</td>
      </tr>

      <tr valign="middle">
       <td align="left"><i>channels</i></td>
       <td align="left">
        The number of audio channels to encode, typically 1 (Mono), or 2 (Stero).
        May range as high as 16.
       </td>
       <td align="left">2</td>
       <td align="left">Write/Append</td>
      </tr>

      <tr valign="middle">
       <td align="left"><i>comments</i></td>
       <td align="left">
        An array of string values to encode into the track header.
       </td>
       <td class="empty">&nbsp;</td>
       <td align="left">Write/Append</td>
      </tr>

     </tbody>
   
   </table>
<p>
  </p>
 </div><?php manual_footer(); ?>
 
show source | credits | sitemap | contact | advertising | mirror sites