File_Ogg
[ class tree: File_Ogg ] [ index: File_Ogg ] [ all elements ]

Source for file Bitstream.php

Documentation is available at Bitstream.php

  1. <?php
  2. /* vim: set expandtab tabstop=4 shiftwidth=4: */
  3. // +----------------------------------------------------------------------------+
  4. // | File_Ogg PEAR Package for Accessing Ogg Bitstreams                         |
  5. // | Copyright (c) 2005-2007                                                    |
  6. // | David Grant <david@grant.org.uk>                                           |
  7. // | Tim Starling <tstarling@wikimedia.org>                                     |
  8. // +----------------------------------------------------------------------------+
  9. // | This library is free software; you can redistribute it and/or              |
  10. // | modify it under the terms of the GNU Lesser General Public                 |
  11. // | License as published by the Free Software Foundation; either               |
  12. // | version 2.1 of the License, or (at your option) any later version.         |
  13. // |                                                                            |
  14. // | This library is distributed in the hope that it will be useful,            |
  15. // | but WITHOUT ANY WARRANTY; without even the implied warranty of             |
  16. // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU          |
  17. // | Lesser General Public License for more details.                            |
  18. // |                                                                            |
  19. // | You should have received a copy of the GNU Lesser General Public           |
  20. // | License along with this library; if not, write to the Free Software        |
  21. // | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA |
  22. // +----------------------------------------------------------------------------+
  23.  
  24.  
  25. /**
  26.  * @author      David Grant <david@grant.org.uk>, Tim Starling <tstarling@wikimedia.org>
  27.  * @category    File
  28.  * @copyright   David Grant <david@grant.org.uk>, Tim Starling <tstarling@wikimedia.org>
  29.  * @license     http://www.gnu.org/copyleft/lesser.html GNU LGPL
  30.  * @link        http://pear.php.net/package/File_Ogg
  31.  * @package     File_Ogg
  32.  * @version     CVS: $Id: Bitstream.php 302834 2010-08-27 02:16:20Z tstarling $
  33.  */
  34. {
  35.     /**
  36.      * The serial number of this logical stream.
  37.      *
  38.      * @var     int 
  39.      * @access  private
  40.      */
  41.     var $_streamSerial;
  42.     /**
  43.      * @access  private
  44.      */
  45.     var $_streamData;
  46.     /**
  47.      * @access  private
  48.      */
  49.     var $_filePointer;
  50.     /**
  51.      * The number of bits used in this stream.
  52.      *
  53.      * @var     int 
  54.      * @access  private
  55.      */
  56.     var $_streamSize;
  57.  
  58.     /**
  59.      * The last granule position in the stream
  60.      * @var     int 
  61.      * @access  private
  62.      */
  63.     var $_lastGranulePos;
  64.  
  65.     /**
  66.      * Constructor for a generic logical stream.
  67.      *
  68.      * @param   int     $streamSerial   Serial number of the logical stream.
  69.      * @param   array   $streamData     Data for the requested logical stream.
  70.      * @param   string  $filePath       Location of a file on the filesystem.
  71.      * @param   pointer $filePointer    File pointer for the current physical stream.
  72.      * @access  private
  73.      */
  74.     function __construct($streamSerial$streamData$filePointer)
  75.     {
  76.         $this->_streamSerial    $streamSerial;
  77.         $this->_streamData      $streamData;
  78.         $this->_filePointer     $filePointer;
  79.         $this->_firstGranulePos $streamData['first_granule_pos'];
  80.         $this->_lastGranulePos  $streamData['last_granule_pos'];
  81.         $this->_streamSize      $streamData['data_length'];
  82.         $this->_group           $streamData['pages'][0]['group'];
  83.     }
  84.  
  85.     /**
  86.      * Gives the serial number of this stream.
  87.      *
  88.      * The stream serial number is of fairly academic importance, as it makes little
  89.      * difference to the end user.  The serial number is used by the Ogg physical
  90.      * stream to distinguish between concurrent logical streams.
  91.      *
  92.      * @return  int 
  93.      * @access  public
  94.      */
  95.     function getSerial()
  96.     {
  97.         return ($this->_streamSerial);
  98.     }
  99.  
  100.     /**
  101.      * Gives the size (in bits) of this stream.
  102.      *
  103.      * This function returns the size of the Vorbis stream within the Ogg
  104.      * physical stream.
  105.      *
  106.      * @return  int 
  107.      * @access  public
  108.      */
  109.     function getSize()
  110.     {
  111.         return ($this->_streamSize);
  112.     }
  113.  
  114.     /**
  115.      * Get the multiplexed group ID
  116.      */
  117.     function getGroup()
  118.     {
  119.         return $this->_group;
  120.     }
  121.  
  122. }
  123.  
  124. ?>

Documentation generated on Mon, 11 Mar 2019 15:38:25 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.