From a435de089da4dd37c3c183f633a49107c720dd95 Mon Sep 17 00:00:00 2001 From: Dalyn Cessac Date: Wed, 16 Mar 2011 11:06:40 -0500 Subject: Added phpvideotoolkit transcoder and updates to the preset ui --- .../adapters/ffmpeg-php/php-reader/src/ASF.php | 151 +++++ .../ffmpeg-php/php-reader/src/ASF/Exception.php | 51 ++ .../ffmpeg-php/php-reader/src/ASF/Object.php | 226 +++++++ .../src/ASF/Object/AdvancedContentEncryption.php | 109 +++ .../src/ASF/Object/AdvancedMutualExclusion.php | 100 +++ .../php-reader/src/ASF/Object/BandwidthSharing.php | 133 ++++ .../src/ASF/Object/BitrateMutualExclusion.php | 100 +++ .../php-reader/src/ASF/Object/CodecList.php | 98 +++ .../php-reader/src/ASF/Object/Compatibility.php | 88 +++ .../php-reader/src/ASF/Object/Container.php | 195 ++++++ .../php-reader/src/ASF/Object/ContentBranding.php | 135 ++++ .../src/ASF/Object/ContentDescription.php | 141 ++++ .../src/ASF/Object/ContentEncryption.php | 117 ++++ .../ffmpeg-php/php-reader/src/ASF/Object/Data.php | 126 ++++ .../php-reader/src/ASF/Object/DigitalSignature.php | 91 +++ .../php-reader/src/ASF/Object/ErrorCorrection.php | 100 +++ .../src/ASF/Object/ExtendedContentDescription.php | 122 ++++ .../src/ASF/Object/ExtendedContentEncryption.php | 80 +++ .../src/ASF/Object/ExtendedStreamProperties.php | 418 ++++++++++++ .../php-reader/src/ASF/Object/FileProperties.php | 255 +++++++ .../src/ASF/Object/GroupMutualExclusion.php | 108 +++ .../php-reader/src/ASF/Object/Header.php | 125 ++++ .../php-reader/src/ASF/Object/HeaderExtension.php | 101 +++ .../ffmpeg-php/php-reader/src/ASF/Object/Index.php | 185 +++++ .../php-reader/src/ASF/Object/IndexParameters.php | 121 ++++ .../php-reader/src/ASF/Object/LanguageList.php | 85 +++ .../php-reader/src/ASF/Object/Marker.php | 121 ++++ .../php-reader/src/ASF/Object/MediaObjectIndex.php | 176 +++++ .../src/ASF/Object/MediaObjectIndexParameters.php | 130 ++++ .../php-reader/src/ASF/Object/Metadata.php | 113 ++++ .../php-reader/src/ASF/Object/MetadataLibrary.php | 137 ++++ .../php-reader/src/ASF/Object/Padding.php | 64 ++ .../php-reader/src/ASF/Object/ScriptCommand.php | 124 ++++ .../php-reader/src/ASF/Object/SimpleIndex.php | 143 ++++ .../src/ASF/Object/StreamBitrateProperties.php | 93 +++ .../src/ASF/Object/StreamPrioritization.php | 99 +++ .../php-reader/src/ASF/Object/StreamProperties.php | 288 ++++++++ .../php-reader/src/ASF/Object/TimecodeIndex.php | 181 +++++ .../src/ASF/Object/TimecodeIndexParameters.php | 125 ++++ .../ffmpeg-php/php-reader/src/ID3/Encoding.php | 79 +++ .../ffmpeg-php/php-reader/src/ID3/Exception.php | 51 ++ .../php-reader/src/ID3/ExtendedHeader.php | 323 +++++++++ .../ffmpeg-php/php-reader/src/ID3/Frame.php | 295 ++++++++ .../ffmpeg-php/php-reader/src/ID3/Frame/AENC.php | 171 +++++ .../ffmpeg-php/php-reader/src/ID3/Frame/APIC.php | 253 +++++++ .../ffmpeg-php/php-reader/src/ID3/Frame/ASPI.php | 157 +++++ .../php-reader/src/ID3/Frame/AbstractLink.php | 96 +++ .../php-reader/src/ID3/Frame/AbstractText.php | 170 +++++ .../ffmpeg-php/php-reader/src/ID3/Frame/COMM.php | 228 +++++++ .../ffmpeg-php/php-reader/src/ID3/Frame/COMR.php | 373 +++++++++++ .../ffmpeg-php/php-reader/src/ID3/Frame/ENCR.php | 156 +++++ .../ffmpeg-php/php-reader/src/ID3/Frame/EQU2.php | 193 ++++++ .../ffmpeg-php/php-reader/src/ID3/Frame/EQUA.php | 140 ++++ .../ffmpeg-php/php-reader/src/ID3/Frame/ETCO.php | 168 +++++ .../ffmpeg-php/php-reader/src/ID3/Frame/GEOB.php | 226 +++++++ .../ffmpeg-php/php-reader/src/ID3/Frame/GRID.php | 152 +++++ .../ffmpeg-php/php-reader/src/ID3/Frame/IPLS.php | 174 +++++ .../ffmpeg-php/php-reader/src/ID3/Frame/LINK.php | 173 +++++ .../ffmpeg-php/php-reader/src/ID3/Frame/MCDI.php | 78 +++ .../ffmpeg-php/php-reader/src/ID3/Frame/MLLT.php | 169 +++++ .../ffmpeg-php/php-reader/src/ID3/Frame/OWNE.php | 219 ++++++ .../ffmpeg-php/php-reader/src/ID3/Frame/PCNT.php | 111 +++ .../ffmpeg-php/php-reader/src/ID3/Frame/POPM.php | 161 +++++ .../ffmpeg-php/php-reader/src/ID3/Frame/POSS.php | 132 ++++ .../ffmpeg-php/php-reader/src/ID3/Frame/PRIV.php | 126 ++++ .../ffmpeg-php/php-reader/src/ID3/Frame/RBUF.php | 181 +++++ .../ffmpeg-php/php-reader/src/ID3/Frame/RVA2.php | 217 ++++++ .../ffmpeg-php/php-reader/src/ID3/Frame/RVAD.php | 252 +++++++ .../ffmpeg-php/php-reader/src/ID3/Frame/RVRB.php | 314 +++++++++ .../ffmpeg-php/php-reader/src/ID3/Frame/SEEK.php | 104 +++ .../ffmpeg-php/php-reader/src/ID3/Frame/SIGN.php | 122 ++++ .../ffmpeg-php/php-reader/src/ID3/Frame/SYLT.php | 313 +++++++++ .../ffmpeg-php/php-reader/src/ID3/Frame/SYTC.php | 161 +++++ .../ffmpeg-php/php-reader/src/ID3/Frame/TALB.php | 53 ++ .../ffmpeg-php/php-reader/src/ID3/Frame/TBPM.php | 53 ++ .../ffmpeg-php/php-reader/src/ID3/Frame/TCOM.php | 52 ++ .../ffmpeg-php/php-reader/src/ID3/Frame/TCON.php | 62 ++ .../ffmpeg-php/php-reader/src/ID3/Frame/TCOP.php | 59 ++ .../ffmpeg-php/php-reader/src/ID3/Frame/TDAT.php | 55 ++ .../ffmpeg-php/php-reader/src/ID3/Frame/TDEN.php | 56 ++ .../ffmpeg-php/php-reader/src/ID3/Frame/TDLY.php | 54 ++ .../ffmpeg-php/php-reader/src/ID3/Frame/TDOR.php | 57 ++ .../ffmpeg-php/php-reader/src/ID3/Frame/TDRC.php | 56 ++ .../ffmpeg-php/php-reader/src/ID3/Frame/TDRL.php | 56 ++ .../ffmpeg-php/php-reader/src/ID3/Frame/TDTG.php | 56 ++ .../ffmpeg-php/php-reader/src/ID3/Frame/TENC.php | 54 ++ .../ffmpeg-php/php-reader/src/ID3/Frame/TEXT.php | 53 ++ .../ffmpeg-php/php-reader/src/ID3/Frame/TFLT.php | 69 ++ .../ffmpeg-php/php-reader/src/ID3/Frame/TIME.php | 55 ++ .../ffmpeg-php/php-reader/src/ID3/Frame/TIPL.php | 55 ++ .../ffmpeg-php/php-reader/src/ID3/Frame/TIT1.php | 54 ++ .../ffmpeg-php/php-reader/src/ID3/Frame/TIT2.php | 53 ++ .../ffmpeg-php/php-reader/src/ID3/Frame/TIT3.php | 54 ++ .../ffmpeg-php/php-reader/src/ID3/Frame/TKEY.php | 56 ++ .../ffmpeg-php/php-reader/src/ID3/Frame/TLAN.php | 57 ++ .../ffmpeg-php/php-reader/src/ID3/Frame/TLEN.php | 53 ++ .../ffmpeg-php/php-reader/src/ID3/Frame/TMCL.php | 56 ++ .../ffmpeg-php/php-reader/src/ID3/Frame/TMED.php | 137 ++++ .../ffmpeg-php/php-reader/src/ID3/Frame/TMOO.php | 55 ++ .../ffmpeg-php/php-reader/src/ID3/Frame/TOAL.php | 54 ++ .../ffmpeg-php/php-reader/src/ID3/Frame/TOFN.php | 54 ++ .../ffmpeg-php/php-reader/src/ID3/Frame/TOLY.php | 54 ++ .../ffmpeg-php/php-reader/src/ID3/Frame/TOPE.php | 54 ++ .../ffmpeg-php/php-reader/src/ID3/Frame/TORY.php | 57 ++ .../ffmpeg-php/php-reader/src/ID3/Frame/TOWN.php | 53 ++ .../ffmpeg-php/php-reader/src/ID3/Frame/TPE1.php | 53 ++ .../ffmpeg-php/php-reader/src/ID3/Frame/TPE2.php | 53 ++ .../ffmpeg-php/php-reader/src/ID3/Frame/TPE3.php | 52 ++ .../ffmpeg-php/php-reader/src/ID3/Frame/TPE4.php | 54 ++ .../ffmpeg-php/php-reader/src/ID3/Frame/TPOS.php | 56 ++ .../ffmpeg-php/php-reader/src/ID3/Frame/TPRO.php | 61 ++ .../ffmpeg-php/php-reader/src/ID3/Frame/TPUB.php | 53 ++ .../ffmpeg-php/php-reader/src/ID3/Frame/TRCK.php | 55 ++ .../ffmpeg-php/php-reader/src/ID3/Frame/TRDA.php | 57 ++ .../ffmpeg-php/php-reader/src/ID3/Frame/TRSN.php | 53 ++ .../ffmpeg-php/php-reader/src/ID3/Frame/TRSO.php | 53 ++ .../ffmpeg-php/php-reader/src/ID3/Frame/TSIZ.php | 55 ++ .../ffmpeg-php/php-reader/src/ID3/Frame/TSOA.php | 55 ++ .../ffmpeg-php/php-reader/src/ID3/Frame/TSOP.php | 55 ++ .../ffmpeg-php/php-reader/src/ID3/Frame/TSOT.php | 55 ++ .../ffmpeg-php/php-reader/src/ID3/Frame/TSRC.php | 53 ++ .../ffmpeg-php/php-reader/src/ID3/Frame/TSSE.php | 54 ++ .../ffmpeg-php/php-reader/src/ID3/Frame/TSST.php | 55 ++ .../ffmpeg-php/php-reader/src/ID3/Frame/TXXX.php | 148 ++++ .../ffmpeg-php/php-reader/src/ID3/Frame/TYER.php | 55 ++ .../ffmpeg-php/php-reader/src/ID3/Frame/USER.php | 186 +++++ .../ffmpeg-php/php-reader/src/ID3/Frame/USLT.php | 225 +++++++ .../ffmpeg-php/php-reader/src/ID3/Frame/WCOM.php | 54 ++ .../ffmpeg-php/php-reader/src/ID3/Frame/WCOP.php | 53 ++ .../ffmpeg-php/php-reader/src/ID3/Frame/WOAF.php | 53 ++ .../ffmpeg-php/php-reader/src/ID3/Frame/WOAR.php | 54 ++ .../ffmpeg-php/php-reader/src/ID3/Frame/WOAS.php | 53 ++ .../ffmpeg-php/php-reader/src/ID3/Frame/WORS.php | 53 ++ .../ffmpeg-php/php-reader/src/ID3/Frame/WPAY.php | 53 ++ .../ffmpeg-php/php-reader/src/ID3/Frame/WPUB.php | 53 ++ .../ffmpeg-php/php-reader/src/ID3/Frame/WXXX.php | 162 +++++ .../ffmpeg-php/php-reader/src/ID3/Header.php | 173 +++++ .../ffmpeg-php/php-reader/src/ID3/Language.php | 69 ++ .../ffmpeg-php/php-reader/src/ID3/Object.php | 252 +++++++ .../ffmpeg-php/php-reader/src/ID3/Timing.php | 73 ++ .../adapters/ffmpeg-php/php-reader/src/ID3v1.php | 350 ++++++++++ .../adapters/ffmpeg-php/php-reader/src/ID3v2.php | 489 ++++++++++++++ .../ffmpeg-php/php-reader/src/ISO14496.php | 380 +++++++++++ .../ffmpeg-php/php-reader/src/ISO14496/Box.php | 451 +++++++++++++ .../php-reader/src/ISO14496/Box/BXML.php | 86 +++ .../php-reader/src/ISO14496/Box/CDSC.php | 80 +++ .../php-reader/src/ISO14496/Box/CO64.php | 122 ++++ .../php-reader/src/ISO14496/Box/CPRT.php | 96 +++ .../php-reader/src/ISO14496/Box/CTTS.php | 99 +++ .../php-reader/src/ISO14496/Box/DINF.php | 71 ++ .../php-reader/src/ISO14496/Box/DREF.php | 88 +++ .../php-reader/src/ISO14496/Box/EDTS.php | 76 +++ .../php-reader/src/ISO14496/Box/ELST.php | 108 +++ .../php-reader/src/ISO14496/Box/FREE.php | 76 +++ .../php-reader/src/ISO14496/Box/FRMA.php | 78 +++ .../php-reader/src/ISO14496/Box/FTYP.php | 142 ++++ .../php-reader/src/ISO14496/Box/Full.php | 124 ++++ .../php-reader/src/ISO14496/Box/HDLR.php | 150 +++++ .../php-reader/src/ISO14496/Box/HINT.php | 81 +++ .../php-reader/src/ISO14496/Box/HMHD.php | 110 +++ .../php-reader/src/ISO14496/Box/ID32.php | 131 ++++ .../php-reader/src/ISO14496/Box/IINF.php | 87 +++ .../php-reader/src/ISO14496/Box/ILOC.php | 134 ++++ .../php-reader/src/ISO14496/Box/ILST.php | 280 ++++++++ .../php-reader/src/ISO14496/Box/IMIF.php | 91 +++ .../php-reader/src/ISO14496/Box/INFE.php | 131 ++++ .../php-reader/src/ISO14496/Box/IPMC.php | 56 ++ .../php-reader/src/ISO14496/Box/IPRO.php | 82 +++ .../php-reader/src/ISO14496/Box/MDAT.php | 66 ++ .../php-reader/src/ISO14496/Box/MDHD.php | 136 ++++ .../php-reader/src/ISO14496/Box/MDIA.php | 71 ++ .../php-reader/src/ISO14496/Box/MEHD.php | 84 +++ .../php-reader/src/ISO14496/Box/META.php | 90 +++ .../php-reader/src/ISO14496/Box/MFHD.php | 80 +++ .../php-reader/src/ISO14496/Box/MFRA.php | 85 +++ .../php-reader/src/ISO14496/Box/MFRO.php | 85 +++ .../php-reader/src/ISO14496/Box/MINF.php | 71 ++ .../php-reader/src/ISO14496/Box/MOOF.php | 81 +++ .../php-reader/src/ISO14496/Box/MOOV.php | 72 ++ .../php-reader/src/ISO14496/Box/MVEX.php | 74 ++ .../php-reader/src/ISO14496/Box/MVHD.php | 166 +++++ .../php-reader/src/ISO14496/Box/NMHD.php | 55 ++ .../php-reader/src/ISO14496/Box/PADB.php | 57 ++ .../php-reader/src/ISO14496/Box/PDIN.php | 97 +++ .../php-reader/src/ISO14496/Box/PITM.php | 85 +++ .../php-reader/src/ISO14496/Box/SBGP.php | 132 ++++ .../php-reader/src/ISO14496/Box/SCHI.php | 74 ++ .../php-reader/src/ISO14496/Box/SCHM.php | 103 +++ .../php-reader/src/ISO14496/Box/SDTP.php | 130 ++++ .../php-reader/src/ISO14496/Box/SGPD.php | 64 ++ .../php-reader/src/ISO14496/Box/SINF.php | 87 +++ .../php-reader/src/ISO14496/Box/SKIP.php | 73 ++ .../php-reader/src/ISO14496/Box/SMHD.php | 66 ++ .../php-reader/src/ISO14496/Box/STBL.php | 90 +++ .../php-reader/src/ISO14496/Box/STCO.php | 122 ++++ .../php-reader/src/ISO14496/Box/STDP.php | 84 +++ .../php-reader/src/ISO14496/Box/STSC.php | 110 +++ .../php-reader/src/ISO14496/Box/STSD.php | 56 ++ .../php-reader/src/ISO14496/Box/STSH.php | 117 ++++ .../php-reader/src/ISO14496/Box/STSS.php | 89 +++ .../php-reader/src/ISO14496/Box/STSZ.php | 110 +++ .../php-reader/src/ISO14496/Box/STTS.php | 110 +++ .../php-reader/src/ISO14496/Box/STZ2.php | 109 +++ .../php-reader/src/ISO14496/Box/SUBS.php | 138 ++++ .../php-reader/src/ISO14496/Box/TFHD.php | 190 ++++++ .../php-reader/src/ISO14496/Box/TFRA.php | 142 ++++ .../php-reader/src/ISO14496/Box/TKHD.php | 177 +++++ .../php-reader/src/ISO14496/Box/TRAF.php | 77 +++ .../php-reader/src/ISO14496/Box/TRAK.php | 83 +++ .../php-reader/src/ISO14496/Box/TREF.php | 81 +++ .../php-reader/src/ISO14496/Box/TREX.php | 138 ++++ .../php-reader/src/ISO14496/Box/TRUN.php | 149 +++++ .../php-reader/src/ISO14496/Box/UDTA.php | 75 +++ .../ffmpeg-php/php-reader/src/ISO14496/Box/URL.php | 83 +++ .../ffmpeg-php/php-reader/src/ISO14496/Box/URN.php | 94 +++ .../php-reader/src/ISO14496/Box/VMHD.php | 65 ++ .../ffmpeg-php/php-reader/src/ISO14496/Box/XML.php | 87 +++ .../php-reader/src/ISO14496/Exception.php | 51 ++ .../adapters/ffmpeg-php/php-reader/src/Magic.php | 177 +++++ .../adapters/ffmpeg-php/php-reader/src/Reader.php | 216 ++++++ .../ffmpeg-php/php-reader/src/Reader/Exception.php | 49 ++ .../ffmpeg-php/php-reader/src/Transform.php | 745 +++++++++++++++++++++ .../ffmpeg-php/php-reader/src/Twiddling.php | 235 +++++++ 223 files changed, 26682 insertions(+) create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Exception.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/AdvancedContentEncryption.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/AdvancedMutualExclusion.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/BandwidthSharing.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/BitrateMutualExclusion.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/CodecList.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/Compatibility.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/Container.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/ContentBranding.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/ContentDescription.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/ContentEncryption.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/Data.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/DigitalSignature.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/ErrorCorrection.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/ExtendedContentDescription.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/ExtendedContentEncryption.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/ExtendedStreamProperties.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/FileProperties.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/GroupMutualExclusion.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/Header.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/HeaderExtension.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/Index.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/IndexParameters.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/LanguageList.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/Marker.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/MediaObjectIndex.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/MediaObjectIndexParameters.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/Metadata.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/MetadataLibrary.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/Padding.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/ScriptCommand.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/SimpleIndex.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/StreamBitrateProperties.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/StreamPrioritization.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/StreamProperties.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/TimecodeIndex.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/TimecodeIndexParameters.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Encoding.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Exception.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/ExtendedHeader.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/AENC.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/APIC.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/ASPI.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/AbstractLink.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/AbstractText.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/COMM.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/COMR.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/ENCR.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/EQU2.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/EQUA.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/ETCO.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/GEOB.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/GRID.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/IPLS.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/LINK.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/MCDI.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/MLLT.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/OWNE.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/PCNT.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/POPM.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/POSS.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/PRIV.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/RBUF.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/RVA2.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/RVAD.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/RVRB.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/SEEK.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/SIGN.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/SYLT.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/SYTC.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TALB.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TBPM.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TCOM.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TCON.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TCOP.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TDAT.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TDEN.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TDLY.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TDOR.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TDRC.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TDRL.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TDTG.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TENC.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TEXT.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TFLT.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TIME.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TIPL.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TIT1.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TIT2.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TIT3.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TKEY.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TLAN.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TLEN.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TMCL.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TMED.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TMOO.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TOAL.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TOFN.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TOLY.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TOPE.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TORY.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TOWN.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TPE1.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TPE2.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TPE3.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TPE4.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TPOS.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TPRO.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TPUB.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TRCK.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TRDA.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TRSN.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TRSO.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TSIZ.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TSOA.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TSOP.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TSOT.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TSRC.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TSSE.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TSST.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TXXX.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TYER.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/USER.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/USLT.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/WCOM.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/WCOP.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/WOAF.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/WOAR.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/WOAS.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/WORS.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/WPAY.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/WPUB.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/WXXX.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Header.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Language.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Object.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Timing.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3v1.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3v2.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/BXML.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/CDSC.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/CO64.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/CPRT.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/CTTS.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/DINF.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/DREF.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/EDTS.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/ELST.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/FREE.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/FRMA.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/FTYP.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/Full.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/HDLR.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/HINT.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/HMHD.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/ID32.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/IINF.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/ILOC.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/ILST.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/IMIF.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/INFE.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/IPMC.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/IPRO.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MDAT.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MDHD.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MDIA.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MEHD.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/META.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MFHD.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MFRA.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MFRO.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MINF.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MOOF.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MOOV.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MVEX.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MVHD.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/NMHD.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/PADB.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/PDIN.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/PITM.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/SBGP.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/SCHI.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/SCHM.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/SDTP.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/SGPD.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/SINF.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/SKIP.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/SMHD.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STBL.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STCO.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STDP.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STSC.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STSD.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STSH.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STSS.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STSZ.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STTS.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STZ2.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/SUBS.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/TFHD.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/TFRA.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/TKHD.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/TRAF.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/TRAK.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/TREF.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/TREX.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/TRUN.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/UDTA.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/URL.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/URN.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/VMHD.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/XML.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Exception.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/Magic.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/Reader.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/Reader/Exception.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/Transform.php create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/Twiddling.php (limited to 'libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src') diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF.php new file mode 100644 index 0000000..31516ae --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF.php @@ -0,0 +1,151 @@ + + * @copyright Copyright (c) 2006-2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 108 $ + */ +class ASF extends ASF_Object_Container +{ + const HEADER = "75b22630-668e-11cf-a6d9-00aa0062ce6c"; + const DATA = "75b22636-668e-11cf-a6d9-00aa0062ce6c"; + const SIMPLE_INDEX = "33000890-e5b1-11cf-89f4-00a0c90349cb"; + const INDEX = "d6e229d3-35da-11d1-9034-00a0c90349be"; + const MEDIA_OBJECT_INDEX = "feb103f8-12ad-4c64-840f-2a1d2f7ad48c"; + const TIMECODE_INDEX = "3cb73fd0-0c4a-4803-953d-edf7b6228f0c"; + + /** @var string */ + private $_filename; + + /** + * Constructs the ASF class with given file and options. + * + * The following options are currently recognized: + * o encoding -- Indicates the encoding that all the texts are presented + * with. By default this is set to utf-8. See the documentation of iconv + * for accepted values. + * o readonly -- Indicates that the file is read from a temporary location + * or another source it cannot be written back to. + * + * @param string $filename The path to the file or file descriptor of an + * opened file. + * @param Array $options The options array. + */ + public function __construct($filename, $options = array()) + { + $this->_reader = new Reader($this->_filename = $filename); + $this->setOptions($options); + if ($this->getOption("encoding", false) === false) + $this->setOption("encoding", "utf-8"); + $this->setOffset(0); + $this->setSize($this->_reader->getSize()); + $this->constructObjects + (array + (self::HEADER => "Header", + self::DATA => "Data", + self::SIMPLE_INDEX => "SimpleIndex", + self::INDEX => "Index", + self::MEDIA_OBJECT_INDEX => "MediaObjectIndex", + self::TIMECODE_INDEX => "TimecodeIndex")); + } + + /** + * Returns the mandatory header object contained in this file. + * + * @return ASF_Object_Header + */ + public function getHeader() + { + $header = $this->getObjectsByIdentifier(self::HEADER); + return $header[0]; + } + + /** + * Returns the mandatory data object contained in this file. + * + * @return ASF_Object_Data + */ + public function getData() + { + $data = $this->getObjectsByIdentifier(self::DATA); + return $data[0]; + } + + /** + * Returns an array of index objects contained in this file. + * + * @return Array + */ + public function getIndices() + { + return $this->getObjectsByIdentifier + (self::SIMPLE_INDEX . "|" . self::INDEX . "|" . + self::MEDIA_OBJECT_INDEX . "|" . self::TIMECODE_INDEX); + } + + /** + * Writes the changes back to the original media file. + * + * Please note: currently the method writes only Content Description and + * Extended Content Description Objects. + */ + public function write() + { + throw new ASF_Exception("Not yet supported"); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Exception.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Exception.php new file mode 100644 index 0000000..c0e58be --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Exception.php @@ -0,0 +1,51 @@ + + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 102 $ + */ +class ASF_Exception extends Exception +{ +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object.php new file mode 100644 index 0000000..8a93a7e --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object.php @@ -0,0 +1,226 @@ + + * @copyright Copyright (c) 2006-2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 102 $ + */ +class ASF_Object +{ + /** + * The reader object. + * + * @var Reader + */ + protected $_reader; + + /** + * The options array. + * + * @var Array + */ + protected $_options; + + /** @var integer */ + private $_offset = -1; + + /** @var string */ + private $_id; + + /** @var integer */ + private $_size = -1; + + /** @var ASF_Object */ + private $_parent = null; + + /** + * Constructs the class with given parameters and options. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader, &$options = array()) + { + $this->_reader = $reader; + $this->_options = $options; + $this->_offset = $this->_reader->getOffset(); + $this->_id = $this->_reader->readGUID(); + $this->_size = $this->_reader->readInt64LE(); + } + + /** + * Returns the file offset to box start, or -1 if the box was created on heap. + * + * @return integer + */ + public function getOffset() { return $this->_offset; } + + /** + * Sets the file offset where the box starts. + * + * @param integer $offset The file offset to box start. + */ + public function setOffset($offset) { $this->_offset = $offset; } + + /** + * Returns the GUID of the ASF object. + * + * @return string + */ + public function getIdentifier() { return $this->_id; } + + /** + * Set the GUID of the ASF object. + * + * @param string $id The GUID + */ + public function setIdentifier($id) { $this->_id = $id; } + + /** + * Returns the object size in bytes, including the header. + * + * @return integer + */ + public function getSize() { return $this->_size; } + + /** + * Sets the box size. The size must include the header. + * + * @param integer $size The box size. + */ + public function setSize($size) + { + if ($this->_parent !== null) + $this->_parent->setSize + (($this->_parent->getSize() > 0 ? $this->_parent->getSize() : 0) + + $size - ($this->_size > 0 ? $this->_size : 0)); + $this->_size = $size; + } + + /** + * Returns the options array. + * + * @return Array + */ + public function getOptions() { return $this->_options; } + + /** + * Returns the given option value, or the default value if the option is not + * defined. + * + * @param string $option The name of the option. + * @param mixed $defaultValue The default value to be returned. + */ + public function getOption($option, $defaultValue = false) + { + if (isset($this->_options[$option])) + return $this->_options[$option]; + return $defaultValue; + } + + /** + * Sets the options array. See {@link ISO14496} class for available options. + * + * @param Array $options The options array. + */ + public function setOptions(&$options) { $this->_options = $options; } + + /** + * Sets the given option the given value. + * + * @param string $option The name of the option. + * @param mixed $value The value to set for the option. + */ + public function setOption($option, $value) + { + $this->_options[$option] = $value; + } + + /** + * Returns the parent object containing this box. + * + * @return ASF_Object + */ + public function getParent() { return $this->_parent; } + + /** + * Sets the parent containing object. + * + * @param ASF_Object $parent The parent object. + */ + public function setParent(&$parent) { $this->_parent = $parent; } + + /** + * Magic function so that $obj->value will work. + * + * @param string $name The field name. + * @return mixed + */ + public function __get($name) + { + if (method_exists($this, "get" . ucfirst($name))) + return call_user_func(array($this, "get" . ucfirst($name))); + throw new ASF_Exception("Unknown field: " . $name); + } + + /** + * Magic function so that assignments with $obj->value will work. + * + * @param string $name The field name. + * @param string $value The field value. + * @return mixed + */ + public function __set($name, $value) + { + if (method_exists($this, "set" . ucfirst($name))) + call_user_func(array($this, "set" . ucfirst($name)), $value); + else throw new ASF_Exception("Unknown field: " . $name); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/AdvancedContentEncryption.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/AdvancedContentEncryption.php new file mode 100644 index 0000000..c29561a --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/AdvancedContentEncryption.php @@ -0,0 +1,109 @@ +Advanced Content Encryption Object lets authors protect content by + * using Next Generation Windows Media Digital Rights Management for Network + * Devices. + * + * @package php-reader + * @subpackage ASF + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 108 $ + */ +final class ASF_Object_AdvancedContentEncryption extends ASF_Object +{ + const WINDOWS_MEDIA_DRM_NETWORK_DEVICES = + "7a079bb6-daa4-4e12-a5ca-91d3 8dc11a8d"; + + /** @var Array */ + private $_contentEncryptionRecords = array(); + + /** + * Constructs the class with given parameters and reads object related data + * from the ASF file. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + $contentEncryptionRecordsCount = $this->_reader->readUInt16LE(); + for ($i = 0; $i < $contentEncryptionRecordsCount; $i++) { + $entry = array("systemId" => $this->_reader->readGUID(), + "systemVersion" => $this->_reader->readUInt32LE(), + "streamNumbers" => array()); + $encryptedObjectRecordCount = $this->_reader->readUInt16LE(); + for ($j = 0; $j < $encryptedObjectRecordCount; $j++) { + $this->_reader->skip(4); + $entry["streamNumbers"][] = $this->_reader->readUInt16LE(); + } + $dataCount = $this->_reader->readUInt32LE(); + $entry["data"] = $this->_reader->read($dataCount); + $this->_contentEncryptionRecords[] = $entry; + } + } + + /** + * Returns an array of content encryption records. Each record consists of the + * following keys. + * + * o systemId -- Specifies the unique identifier for the content encryption + * system. + * + * o systemVersion -- Specifies the version of the content encryption + * system. + * + * o streamNumbers -- An array of stream numbers a particular Content + * Encryption Record is associated with. + * + * o data -- The content protection data for this Content Encryption Record. + * + * @return Array + */ + public function getContentEncryptionRecords() + { + return $this->_contentEncryptionRecords; + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/AdvancedMutualExclusion.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/AdvancedMutualExclusion.php new file mode 100644 index 0000000..b883dce --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/AdvancedMutualExclusion.php @@ -0,0 +1,100 @@ +Advanced Mutual Exclusion Object identifies streams that have a + * mutual exclusion relationship to each other (in other words, only one of the + * streams within such a relationship can be streamed—the rest are ignored). + * There should be one instance of this object for each set of objects that + * contain a mutual exclusion relationship. The exclusion type is used so that + * implementations can allow user selection of common choices, such as language. + * This object must be used if any of the streams in the mutual exclusion + * relationship are hidden. + * + * @package php-reader + * @subpackage ASF + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 108 $ + */ +final class ASF_Object_AdvancedMutualExclusion extends ASF_Object +{ + const MUTEX_LANGUAGE = "d6e22a00-35da-11d1-9034-00a0c90349be"; + const MUTEX_BITRATE = "d6e22a01-35da-11d1-9034-00a0c90349be"; + const MUTEX_UNKNOWN = "d6e22a02-35da-11d1-9034-00a0c90349be"; + + /** @var string */ + private $_exclusionType; + + /** @var Array */ + private $_streamNumbers = array(); + + /** + * Constructs the class with given parameters and reads object related data + * from the ASF file. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + $this->_exclusionType = $this->_reader->readGUID(); + $streamNumbersCount = $this->_reader->readUInt16LE(); + for ($i = 0; $i < $streamNumbersCount; $i++) + $this->_streamNumbers[] = $this->_reader->readUInt16LE(); + } + + /** + * Returns the nature of the mutual exclusion relationship. + * + * @return string + */ + public function getExclusionType() { return $this->_exclusionType; } + + /** + * Returns an array of stream numbers. + * + * @return Array + */ + public function getStreamNumbers() { return $this->_streamNumbers; } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/BandwidthSharing.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/BandwidthSharing.php new file mode 100644 index 0000000..532ae58 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/BandwidthSharing.php @@ -0,0 +1,133 @@ +Bandwidth Sharing Object indicates streams that share bandwidth in + * such a way that the maximum bandwidth of the set of streams is less than the + * sum of the maximum bandwidths of the individual streams. There should be one + * instance of this object for each set of objects that share bandwidth. Whether + * or not this object can be used meaningfully is content-dependent. + * + * @package php-reader + * @subpackage ASF + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 108 $ + */ +final class ASF_Object_BandwidthSharing extends ASF_Object +{ + const SHARING_EXCLUSIVE = "af6060aa-5197-11d2-b6af-00c04fd908e9"; + const SHARING_PARTIAL = "af6060ab-5197-11d2-b6af-00c04fd908e9"; + + /** @var string */ + private $_sharingType; + + /** @var integer */ + private $_dataBitrate; + + /** @var integer */ + private $_bufferSize; + + /** @var Array */ + private $_streamNumbers = array(); + + /** + * Constructs the class with given parameters and reads object related data + * from the ASF file. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $this->_sharingType = $this->_reader->readGUID(); + $this->_dataBitrate = $this->_reader->readUInt32LE(); + $this->_bufferSize = $this->_reader->readUInt32LE(); + $streamNumbersCount = $this->_reader->readUInt16LE(); + for ($i = 0; $i < $streamNumbersCount; $i++) + $this->_streamNumbers[] = $this->_reader->readUInt16LE(); + } + + /** + * Returns the type of sharing relationship for this object. Two types are + * predefined: SHARING_PARTIAL, in which any number of the streams in the + * relationship may be streaming data at any given time; and + * SHARING_EXCLUSIVE, in which only one of the streams in the relationship + * may be streaming data at any given time. + * + * @return string + */ + public function getSharingType() { return $this->_sharingType; } + + /** + * Returns the leak rate R, in bits per second, of a leaky bucket that + * contains the data portion of all of the streams, excluding all ASF Data + * Packet overhead, without overflowing. The size of the leaky bucket is + * specified by the value of the Buffer Size field. This value can be less + * than the sum of all of the data bit rates in the + * {@link ASF_Object_ExtendedStreamProperties Extended Stream Properties} + * Objects for the streams contained in this bandwidth-sharing relationship. + * + * @return integer + */ + public function getDataBitrate() { return $this->_dataBitrate; } + + /** + * Specifies the size B, in bits, of the leaky bucket used in the Data Bitrate + * definition. This value can be less than the sum of all of the buffer sizes + * in the {@link ASF_Object_ExtendedStreamProperties Extended Stream + * Properties} Objects for the streams contained in this bandwidth-sharing + * relationship. + * + * @return integer + */ + public function getBufferSize() { return $this->_bufferSize; } + + /** + * Returns an array of stream numbers. + * + * @return Array + */ + public function getStreamNumbers() { return $this->_streamNumbers; } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/BitrateMutualExclusion.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/BitrateMutualExclusion.php new file mode 100644 index 0000000..22ca8c9 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/BitrateMutualExclusion.php @@ -0,0 +1,100 @@ +Bitrate Mutual Exclusion Object identifies video streams that have + * a mutual exclusion relationship to each other (in other words, only one of + * the streams within such a relationship can be streamed at any given time and + * the rest are ignored). One instance of this object must be present for each + * set of objects that contains a mutual exclusion relationship. All video + * streams in this relationship must have the same frame size. The exclusion + * type is used so that implementations can allow user selection of common + * choices, such as bit rate. + * + * @package php-reader + * @subpackage ASF + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 108 $ + */ +final class ASF_Object_BitrateMutualExclusion extends ASF_Object +{ + const MUTEX_LANGUAGE = "d6e22a00-35da-11d1-9034-00a0c90349be"; + const MUTEX_BITRATE = "d6e22a01-35da-11d1-9034-00a0c90349be"; + const MUTEX_UNKNOWN = "d6e22a02-35da-11d1-9034-00a0c90349be"; + + /** @var string */ + private $_exclusionType; + + /** @var Array */ + private $_streamNumbers = array(); + + /** + * Constructs the class with given parameters and reads object related data + * from the ASF file. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + $this->_exclusionType = $this->_reader->readGUID(); + $streamNumbersCount = $this->_reader->readUInt16LE(); + for ($i = 0; $i < $streamNumbersCount; $i++) + $this->_streamNumbers[] = $this->_reader->readUInt16LE(); + } + + /** + * Returns the nature of the mutual exclusion relationship. + * + * @return string + */ + public function getExclusionType() { return $this->_exclusionType; } + + /** + * Returns an array of stream numbers. + * + * @return Array + */ + public function getStreamNumbers() { return $this->_streamNumbers; } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/CodecList.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/CodecList.php new file mode 100644 index 0000000..5a220a7 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/CodecList.php @@ -0,0 +1,98 @@ +Codec List Object provides user-friendly information about the + * codecs and formats used to encode the content found in the ASF file. + * + * @package php-reader + * @subpackage ASF + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 102 $ + */ +final class ASF_Object_CodecList extends ASF_Object +{ + const VIDEO_CODEC = 0x1; + const AUDIO_CODEC = 0x2; + const UNKNOWN_CODEC = 0xffff; + + /** @var Array */ + private $_entries = array(); + + /** + * Constructs the class with given parameters and reads object related data + * from the ASF file. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $this->_reader->skip(16); + $codecEntriesCount = $this->_reader->readUInt32LE(); + for ($i = 0; $i < $codecEntriesCount; $i++) { + $entry = array("type" => $this->_reader->readUInt16LE()); + $codecNameLength = $this->_reader->readUInt16LE() * 2; + $entry["codecName"] = iconv + ("utf-16le", $this->getOption("encoding"), + $this->_reader->readString16LE($codecNameLength)); + $codecDescriptionLength = $this->_reader->readUInt16LE() * 2; + $entry["codecDescription"] = iconv + ("utf-16le", $this->getOption("encoding"), + $this->_reader->readString16LE($codecDescriptionLength)); + $codecInformationLength = $this->_reader->readUInt16LE(); + $entry["codecInformation"] = + $this->_reader->read($codecInformationLength); + $this->_entries[] = $entry; + } + } + + /** + * Returns the array of codec entries. + * + * @return Array + */ + public function getEntries() { return $this->_entries; } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/Compatibility.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/Compatibility.php new file mode 100644 index 0000000..e051b45 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/Compatibility.php @@ -0,0 +1,88 @@ +Compatibility Object is reserved for future use. + * + * @package php-reader + * @subpackage ASF + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 108 $ + */ +final class ASF_Object_Compatibility extends ASF_Object +{ + /** @var integer */ + private $_profile; + + /** @var integer */ + private $_mode; + + /** + * Constructs the class with given parameters and reads object related data + * from the ASF file. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $this->_profile = $this->_reader->readUInt8(); + $this->_mode = $this->_reader->readUInt8(); + } + + /** + * Returns the profile field. This field is reserved and is set to 2. + * + * @return integer + */ + public function getProfile() { return $this->_profile; } + + /** + * Returns the mode field. This field is reserved and is set to 1. + * + * @return integer + */ + public function getMode() { return $this->_mode; } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/Container.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/Container.php new file mode 100644 index 0000000..a214a3b --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/Container.php @@ -0,0 +1,195 @@ + + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 108 $ + */ +abstract class ASF_Object_Container extends ASF_Object +{ + /** @var Array */ + private $_objects = array(); + + /** + * Reads and constructs the objects found within this object. + */ + protected function constructObjects($defaultclassnames = array()) + { + while (true) { + $offset = $this->_reader->getOffset(); + if ($offset >= $this->getOffset() + $this->getSize()) + break; + $guid = $this->_reader->readGUID(); + $size = $this->_reader->readInt64LE(); + + $this->_reader->setOffset($offset); + if (isset($defaultclassnames[$guid])) { + if (@fopen($filename = "ASF/Object/" . $defaultclassnames[$guid] . + ".php", "r", true) !== false) + require_once($filename); + if (class_exists + ($classname = "ASF_Object_" . $defaultclassnames[$guid])) + $object = new $classname($this->_reader, $this->_options); + else + $object = new ASF_Object($this->_reader, $this->_options); + } else + $object = new ASF_Object($this->_reader, $this->_options); + $object->setParent($this); + if (!$this->hasObject($object->getIdentifier())) + $this->_objects[$object->getIdentifier()] = array(); + $this->_objects[$object->getIdentifier()][] = $object; + $this->_reader->setOffset($offset + $size); + } + } + + /** + * Checks whether the object with given GUID is present in the file. Returns + * true if one or more objects are present, false + * otherwise. + * + * @return boolean + */ + public function hasObject($identifier) + { + return isset($this->_objects[$identifier]); + } + + /** + * Returns all the objects the file contains as an associate array. The object + * identifiers work as keys having an array of ASF objects as associated + * value. + * + * @return Array + */ + public function getObjects() + { + return $this->_objects; + } + + /** + * Returns an array of objects matching the given object GUID or an empty + * array if no object matched the identifier. + * + * The identifier may contain wildcard characters "*" and "?". The asterisk + * matches against zero or more characters, and the question mark matches any + * single character. + * + * Please note that one may also use the shorthand $obj->identifier to access + * the first box with the identifier given. Wildcards cannot be used with + * the shorthand and they will not work with user defined uuid types. + * + * @return Array + */ + public function getObjectsByIdentifier($identifier) + { + $matches = array(); + $searchPattern = "/^" . + str_replace(array("*", "?"), array(".*", "."), $identifier) . "$/i"; + foreach ($this->_objects as $identifier => $objects) + if (preg_match($searchPattern, $identifier)) + foreach ($objects as $object) + $matches[] = $object; + return $matches; + } + + /** + * Adds a new object into the current object and returns it. + * + * @param ASF_Object The object to add + * @return ASF_Object + */ + public function addObject($object) + { + $object->setParent($this); + $object->setOptions($this->_options); + if (!$this->hasObject($object->getIdentifier())) + $this->_objects[$object->getIdentifier()] = array(); + return $this->_objects[$object->getIdentifier()][] = $object; + } + + /** + * Override magic function so that $obj->value will work as expected. + * + * The method first attempts to call the appropriate getter method. If no + * field with given name is found, the method attempts to return the right + * object instead. In other words, calling $obj->value will attempt to return + * the first object returned by $this->getObjectsByIdentifier(self::value). + * + * @param string $name The field or object name. + * @return mixed + */ + public function __get($name) + { + if (method_exists($this, "get" . ucfirst($name))) + return call_user_func(array($this, "get" . ucfirst($name))); + if (defined($constname = get_class($this) . "::" . strtoupper + (preg_replace("/[A-Z]/", "_$0", $name)))) { + $objects = $this->getObjectsByIdentifier(constant($constname)); + if (isset($objects[0])) + return $objects[0]; + } + throw new ASF_Exception("Unknown field/object: " . $name); + } + + /** + * Magic function so that isset($obj->value) will work. This method checks + * whether the object by given identifier is contained by this container. + * + * @param string $name The object name. + * @return boolean + */ + public function __isset($name) + { + if (defined($constname = get_class($this) . "::" . strtoupper + (preg_replace("/[A-Z]/", "_$0", $name)))) { + $objects = $this->getObjectsByIdentifier(constant($constname)); + return isset($objects[0]); + } + else + return isset($this->_objects[$name]); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/ContentBranding.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/ContentBranding.php new file mode 100644 index 0000000..c5859a5 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/ContentBranding.php @@ -0,0 +1,135 @@ +Content Branding Object stores branding data for an ASF file, + * including information about a banner image and copyright associated with the + * file. + * + * @package php-reader + * @subpackage ASF + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 108 $ + */ +final class ASF_Object_ContentBranding extends ASF_Object +{ + /** Indicates that there is no banner */ + const TYPE_NONE = 0; + + /** Indicates that the data represents a bitmap */ + const TYPE_BMP = 1; + + /** Indicates that the data represents a JPEG */ + const TYPE_JPEG = 2; + + /** Indicates that the data represents a GIF */ + const TYPE_GIF = 3; + + + /** @var integer */ + private $_bannerImageType; + + /** @var string */ + private $_bannerImageData; + + /** @var string */ + private $_bannerImageUrl; + + /** @var string */ + private $_copyrightUrl; + + /** + * Constructs the class with given parameters and reads object related data + * from the ASF file. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $this->_bannerImageType = $this->_reader->readUInt32LE(); + $bannerImageDataSize = $this->_reader->readUInt32LE(); + $this->_bannerImageData = $this->_reader->read($bannerImageDataSize); + $bannerImageUrlLength = $this->_reader->readUInt32LE(); + $this->_bannerImageUrl = $this->_reader->read($bannerImageUrlLength); + $copyrightUrlLength = $this->_reader->readUInt32LE(); + $this->_copyrightUrl = $this->_reader->read($copyrightUrlLength); + } + + /** + * Returns the type of data contained in the Banner Image Data. Valid + * values are 0 to indicate that there is no banner image data; 1 to indicate + * that the data represent a bitmap; 2 to indicate that the data represents a + * JPEG; and 3 to indicate that the data represents a GIF. If this value is + * set to 0, then the Banner Image Data Size field is set to 0, and the + * Banner Image Data field is empty. + * + * @return integer + */ + public function getBannerImageType() { return $this->_bannerImageType; } + + /** + * Returns the entire banner image, including the header for the appropriate + * image format. + * + * @return string + */ + public function getBannerImageData() { return $this->_bannerImageData; } + + /** + * Returns, if present, a link to more information about the banner image. + * + * @return string + */ + public function getBannerImageUrl() { return $this->_bannerImageUrl; } + + /** + * Returns, if present, a link to more information about the copyright for the + * content. + * + * @return string + */ + public function getCopyrightUrl() { return $this->_copyrightUrl; } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/ContentDescription.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/ContentDescription.php new file mode 100644 index 0000000..bab422c --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/ContentDescription.php @@ -0,0 +1,141 @@ +Content Description Object lets authors record well-known data + * describing the file and its contents. This object is used to store standard + * bibliographic information such as title, author, copyright, description, and + * rating information. This information is pertinent to the entire file. + * + * @package php-reader + * @subpackage ASF + * @author Sven Vollbehr + * @copyright Copyright (c) 2006-2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 102 $ + */ +final class ASF_Object_ContentDescription extends ASF_Object +{ + /** @var string */ + private $_title; + + /** @var string */ + private $_author; + + /** @var string */ + private $_copyright; + + /** @var string */ + private $_description; + + /** @var string */ + private $_rating; + + /** + * Constructs the class with given parameters and reads object related data + * from the ASF file. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $titleLen = $this->_reader->readUInt16LE(); + $authorLen = $this->_reader->readUInt16LE(); + $copyrightLen = $this->_reader->readUInt16LE(); + $descriptionLen = $this->_reader->readUInt16LE(); + $ratingLen = $this->_reader->readUInt16LE(); + + $this->_title = iconv + ("utf-16le", $this->getOption("encoding"), + $this->_reader->readString16LE($titleLen)); + $this->_author = iconv + ("utf-16le", $this->getOption("encoding"), + $this->_reader->readString16LE($authorLen)); + $this->_copyright = iconv + ("utf-16le", $this->getOption("encoding"), + $this->_reader->readString16LE($copyrightLen)); + $this->_description = iconv + ("utf-16le", $this->getOption("encoding"), + $this->_reader->readString16LE($descriptionLen)); + $this->_rating = iconv + ("utf-16le", $this->getOption("encoding"), + $this->_reader->readString16LE($ratingLen)); + } + + /** + * Returns the title information. + * + * @return string + */ + public function getTitle() { return $this->_title; } + + /** + * Returns the author information. + * + * @return string + */ + public function getAuthor() { return $this->_author; } + + /** + * Returns the copyright information. + * + * @return string + */ + public function getCopyright() { return $this->_copyright; } + + /** + * Returns the description information. + * + * @return string + */ + public function getDescription() { return $this->_description; } + + /** + * Returns the rating information. + * + * @return string + */ + public function getRating() { return $this->_rating; } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/ContentEncryption.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/ContentEncryption.php new file mode 100644 index 0000000..29fe766 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/ContentEncryption.php @@ -0,0 +1,117 @@ +Content Encryption Object lets authors protect content by using + * Microsoft® Digital Rights Manager version 1. + * + * @package php-reader + * @subpackage ASF + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 108 $ + */ +final class ASF_Object_ContentEncryption extends ASF_Object +{ + /** @var string */ + private $_secretData; + + /** @var string */ + private $_protectionType; + + /** @var string */ + private $_keyId; + + /** @var string */ + private $_licenseUrl; + + /** + * Constructs the class with given parameters and reads object related data + * from the ASF file. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $secretDataLength = $this->_reader->readUInt32LE(); + $this->_secretData = $this->_reader->read($secretDataLength); + $protectionTypeLength = $this->_reader->readUInt32LE(); + $this->_protectionType = $this->_reader->readString8($protectionTypeLength); + $keyIdLength = $this->_reader->readUInt32LE(); + $this->_keyId = $this->_reader->readString8($keyIdLength); + $licenseUrlLength = $this->_reader->readUInt32LE(); + $this->_licenseUrl = $this->_reader->readString8($licenseUrlLength); + } + + /** + * Returns the secret data. + * + * @return string + */ + public function getSecretData() { return $this->_secretData; } + + /** + * Returns the type of protection mechanism used. The value of this field + * is set to "DRM". + * + * @return string + */ + public function getProtectionType() { return $this->_protectionType; } + + /** + * Returns the key ID used. + * + * @return string + */ + public function getKeyId() { return $this->_keyId; } + + /** + * Returns the URL from which a license to manipulate the content can be + * acquired. + * + * @return string + */ + public function getLicenseUrl() { return $this->_licenseUrl; } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/Data.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/Data.php new file mode 100644 index 0000000..2904693 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/Data.php @@ -0,0 +1,126 @@ +Data Object contains all of the Data Packets for a file. + * These Data Packets are organized in terms of increasing send times. A Data + * Packet can contain interleaved data from several digital media streams. + * This data can consist of entire objects from one or more streams. + * Alternatively, it can consist of partial objects (fragmentation). + * + * Capabilities provided within the interleave packet definition include: + * o Single or multiple payload types per Data Packet + * o Fixed-size Data Packets + * o Error correction information (optional) + * o Clock information (optional) + * o Redundant sample information, such as presentation time stamp (optional) + * + * @todo Implement optional support for ASF Data Packet parsing + * @package php-reader + * @subpackage ASF + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 108 $ + */ +final class ASF_Object_Data extends ASF_Object +{ + /** @var string */ + private $_fileId; + + /** @var integer */ + private $_totalDataPackets; + + /** @var Array */ + private $_dataPackets; + + /** + * Constructs the class with given parameters and reads object related data + * from the ASF file. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $this->_fileId = $this->_reader->readGUID(); + $this->_totalDataPackets = $this->_reader->readInt64LE(); + $this->_reader->skip(2); + /* Data packets are not supported + * for ($i = 0; $i < $this->_totalDataPackets; $i++) { + * $this->_dataPackets[] = new ASF_Object_Data_Packet($reader); + * } + */ + } + + /** + * Returns the unique identifier for this ASF file. The value of this field + * is changed every time the file is modified in any way. The value of this + * field is identical to the value of the File ID field of the + * Header Object. + * + * @return string + */ + public function getFileId() { return $this->_fileId; } + + /** + * Returns the number of ASF Data Packet entries that exist within the Data + * Object. It must be equal to the Data Packet Count field in the + * File Properties Object. The value of this field is invalid if the + * broadcast flag field of the File Properties Object is set to 1. + * + * @return integer + */ + public function getTotalDataPackets() { return $this->_endTime; } + + /** + * Returns an array of Data Packets. + * + * @return Array + */ + public function getDataPackets() + { + throw new ASF_Exception("Data packets are not parsed due to optimization."); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/DigitalSignature.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/DigitalSignature.php new file mode 100644 index 0000000..64a7690 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/DigitalSignature.php @@ -0,0 +1,91 @@ +Digital Signature Object lets authors sign the portion of their + * header that lies between the end of the File Properties Object and the + * beginning of the Digital Signature Object. + * + * @package php-reader + * @subpackage ASF + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 108 $ + */ +final class ASF_Object_DigitalSignature extends ASF_Object +{ + /** @var integer */ + private $_signatureType; + + /** @var string */ + private $_signatureData; + + /** + * Constructs the class with given parameters and reads object related data + * from the ASF file. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $this->_signatureType = $this->_reader->readUInt32LE(); + $signatureDataLength = $this->_reader->readUInt32LE(); + $this->_signatureData = $this->_reader->read($signatureDataLength); + } + + /** + * Returns the type of digital signature used. This field is set to 2. + * + * @return integer + */ + public function getSignatureType() { return $this->_signatureType; } + + /** + * Returns the digital signature data. + * + * @return string + */ + public function getSignatureData() { return $this->_signatureData; } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/ErrorCorrection.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/ErrorCorrection.php new file mode 100644 index 0000000..c5cb522 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/ErrorCorrection.php @@ -0,0 +1,100 @@ +Error Correction Object defines the error correction method. This + * enables different error correction schemes to be used during content + * creation. The Error Correction Object contains provisions for opaque + * information needed by the error correction engine for recovery. For example, + * if the error correction scheme were a simple N+1 parity scheme, then the + * value of N would have to be available in this object. + * + * Note that this does not refer to the same thing as the Error Correction + * Type field in the {@link ASF_Object_StreamProperties Stream Properties + * Object}. + * + * @package php-reader + * @subpackage ASF + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 108 $ + */ +final class ASF_Object_ErrorCorrection extends ASF_Object +{ + /** @var string */ + private $_type; + + /** @var string */ + private $_data; + + /** + * Constructs the class with given parameters and reads object related data + * from the ASF file. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $this->_type = $this->_reader->readGUID(); + $dataLength = $this->_reader->readUInt32LE(); + $this->_data = $this->_reader->read($dataLength); + } + + /** + * Returns the type of error correction. + * + * @return string + */ + public function getType() { return $this->_type; } + + /** + * Returns the data specific to the error correction scheme. The structure for + * the Error Correction Data field is determined by the value stored in + * the Error Correction Type field. + * + * @return Array + */ + public function getData() { return $this->_data; } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/ExtendedContentDescription.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/ExtendedContentDescription.php new file mode 100644 index 0000000..259bbb2 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/ExtendedContentDescription.php @@ -0,0 +1,122 @@ +ASF_Extended_Content_Description_Object object implementation. + * This object contains unlimited number of attribute fields giving more + * information about the file. + * + * @package php-reader + * @subpackage ASF + * @author Sven Vollbehr + * @copyright Copyright (c) 2006-2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 108 $ + */ +final class ASF_Object_ExtendedContentDescription extends ASF_Object +{ + /** @var Array */ + private $_contentDescriptors = array(); + + /** + * Constructs the class with given parameters and reads object related data + * from the ASF file. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $contentDescriptorsCount = $this->_reader->readUInt16LE(); + for ($i = 0; $i < $contentDescriptorsCount; $i++) { + $nameLen = $this->_reader->readUInt16LE(); + $name = iconv + ("utf-16le", $this->getOption("encoding"), + $this->_reader->readString16LE($nameLen)); + $valueDataType = $this->_reader->readUInt16LE(); + $valueLen = $this->_reader->readUInt16LE(); + switch ($valueDataType) { + case 0: + case 1: // string + $this->_contentDescriptors[$name] = iconv + ("utf-16le", $this->getOption("encoding"), + $this->_reader->readString16LE($valueLen)); + break; + case 2: // bool + case 3: // 32-bit integer + $this->_contentDescriptors[$name] = $this->_reader->readUInt32LE(); + break; + case 4: // 64-bit integer + $this->_contentDescriptors[$name] = $this->_reader->readInt64LE(); + break; + case 5: // 16-bit integer + $this->_contentDescriptors[$name] = $this->_reader->readUInt16LE(); + break; + default: + } + } + } + + /** + * Returns the value of the specified descriptor or false if there + * is no such descriptor defined. + * + * @param string $name The name of the descriptor (ie the name of the field). + * @return string|false + */ + public function getDescriptor($name) + { + if (isset($this->_contentDescriptors[$name])) + return $this->_contentDescriptors[$name]; + return false; + } + + /** + * Returns an associate array of all the descriptors defined having the names + * of the descriptors as the keys. + * + * @return Array + */ + public function getDescriptors() { return $this->_contentDescriptors; } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/ExtendedContentEncryption.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/ExtendedContentEncryption.php new file mode 100644 index 0000000..a2a2eee --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/ExtendedContentEncryption.php @@ -0,0 +1,80 @@ +Extended Content Encryption Object lets authors protect content by + * using the Windows Media Rights Manager 7 Software Development Kit (SDK). + * + * @package php-reader + * @subpackage ASF + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 108 $ + */ +final class ASF_Object_ExtendedContentEncryption extends ASF_Object +{ + /** @var string */ + private $_data; + + /** + * Constructs the class with given parameters and reads object related data + * from the ASF file. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $dataSize = $this->_reader->readUInt32LE(); + $this->_data = $this->_reader->read($dataSize); + } + + /** + * Returns the array of bytes required by the DRM client to manipulate the + * protected content. + * + * @return string + */ + public function getData() { return $this->_data; } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/ExtendedStreamProperties.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/ExtendedStreamProperties.php new file mode 100644 index 0000000..6a65038 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/ExtendedStreamProperties.php @@ -0,0 +1,418 @@ +Extended Stream Properties Object defines additional optional + * properties and characteristics of a digital media stream that are not + * described in the Stream Properties Object. + * + * Typically, the basic Stream Properties Object is present in the + * Header Object, and the Extended Stream Properties Object is + * present in the Header Extension Object. Sometimes, however, the + * Stream Properties Object for a stream may be embedded inside the + * Extended Stream Properties Object for that stream. This approach + * facilitates the creation of backward-compatible content. + * + * This object has an optional provision to include application-specific or + * implementation-specific data attached to the payloads of each digital media + * sample stored within a Data Packet. This data can be looked at as + * digital media sample properties and is stored in the Replicated Data + * field of a payload header. The Payload Extension Systems fields of the + * Extended Stream Properties Object describes what this data is and is + * necessary for that data to be parsed, if present. + * + * @package php-reader + * @subpackage ASF + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 108 $ + */ +final class ASF_Object_ExtendedStreamProperties extends ASF_Object +{ + /** + * Indicates, if set, that this digital media stream, if sent over a network, + * must be carried over a reliable data communications transport mechanism. + * This should be set for streams that cannot recover after a lost media + * object. + */ + const RELIABLE = 1; + + /** + * This flag should be set only if the stream is seekable, either by using an + * index object or by estimating according to bit rate (as can sometimes be + * done with audio). This flag pertains to this stream only rather than to the + * entire file. + */ + const SEEKABLE = 2; + + /** + * Indicates, if set, that the stream does not contain any cleanpoints. A + * cleanpoint is any point at which playback could begin without having seen + * the previous media objects. For streams that use key frames, the key frames + * would be the cleanpoints. + */ + const NO_CLEANPOINT = 4; + + /** + * Specifies, if set, that when a stream is joined in mid-transmission, all + * information from the most recent cleanpoint up to the current time should + * be sent before normal streaming begins at the current time. The default + * behavior (when this flag is not set) is to send only the data starting at + * the current time. This flag should only be set for streams that are coming + * from a live source. + */ + const RESEND_LIVE_CLEANPOINTS = 8; + + const AUDIO_MEDIA = "f8699e40-5b4d-11cf-a8fd-00805f5c442b"; + const VIDEO_MEDIA = "bc19efc0-5b4d-11cf-a8fd-00805f5c442b"; + const COMMAND_MEDIA = "59dacfc0-59e6-11d0-a3ac-00a0c90348f6"; + const JFIF_MEDIA = "b61be100-5b4e-11cf-a8fD-00805f5c442b"; + const DEGRADABLE_JPEG_MEDIA = "35907dE0-e415-11cf-a917-00805f5c442b"; + const FILE_TRANSFER_MEDIA = "91bd222c-f21c-497a-8b6d-5aa86bfc0185"; + const BINARY_MEDIA = "3afb65e2-47ef-40f2-ac2c-70a90d71d343"; + + const NO_ERROR_CORRECTION = "20fb5700-5b55-11cf-a8fd-00805f5c442b"; + const AUDIO_SPREAD = "bfc3cd50-618f-11cf-8bb2-00aa00b4e220"; + + const PAYLOAD_EXTENSION_SYSTEM_TIMECODE = + "399595ec-8667-4e2d-8fdb-98814ce76c1e"; + const PAYLOAD_EXTENSION_SYSTEM_FILE_NAME = + "e165ec0e-19ed-45d7-b4a7-25cbd1e28e9b"; + const PAYLOAD_EXTENSION_SYSTEM_CONTENT_TYPE = + "d590dc20-07bc-436c-9cf7-f3bbfbf1a4dc"; + const PAYLOAD_EXTENSION_SYSTEM_PIXEL_ASPECT_RATIO = + "1b1ee554-f9ea-4bc8-821a-376b74e4c4b8"; + const PAYLOAD_EXTENSION_SYSTEM_SAMPLE_DURATION = + "c6bd9450-867f-4907-83a3-c77921b733ad"; + const PAYLOAD_EXTENSION_SYSTEM_ENCRYPTION_SAMPLE_ID = + "6698b84e-0afa-4330-aeb2-1c0a98d7a44d"; + + /** @var integer */ + private $_startTime; + + /** @var integer */ + private $_endTime; + + /** @var integer */ + private $_dataBitrate; + + /** @var integer */ + private $_bufferSize; + + /** @var integer */ + private $_initialBufferFullness; + + /** @var integer */ + private $_alternateDataBitrate; + + /** @var integer */ + private $_alternateBufferSize; + + /** @var integer */ + private $_alternateInitialBufferFullness; + + /** @var integer */ + private $_maximumObjectSize; + + /** @var integer */ + private $_flags; + + /** @var integer */ + private $_streamNumber; + + /** @var integer */ + private $_streamLanguageIndex; + + /** @var integer */ + private $_averageTimePerFrame; + + /** @var Array */ + private $_streamNames = array(); + + /** @var Array */ + private $_payloadExtensionSystems = array(); + + /** + * Constructs the class with given parameters and reads object related data + * from the ASF file. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $this->_startTime = $this->_reader->readInt64LE(); + $this->_endTime = $this->_reader->readInt64LE(); + $this->_dataBitrate = $this->_reader->readUInt32LE(); + $this->_bufferSize = $this->_reader->readUInt32LE(); + $this->_initialBufferFullness = $this->_reader->readUInt32LE(); + $this->_alternateDataBitrate = $this->_reader->readUInt32LE(); + $this->_alternateBufferSize = $this->_reader->readUInt32LE(); + $this->_alternateInitialBufferFullness = $this->_reader->readUInt32LE(); + $this->_maximumObjectSize = $this->_reader->readUInt32LE(); + $this->_flags = $this->_reader->readUInt32LE(); + $this->_streamNumber = $this->_reader->readUInt16LE(); + $this->_streamLanguageIndex = $this->_reader->readUInt16LE(); + $this->_averageTimePerFrame = $this->_reader->readInt64LE(); + $streamNameCount = $this->_reader->readUInt16LE(); + $payloadExtensionSystemCount = $this->_reader->readUInt16LE(); + for ($i = 0; $i < $streamNameCount; $i++) { + $streamName = array("languageIndex" => $this->_reader->readUInt16LE()); + $streamNameLength = $this->_reader->readUInt16LE(); + $streamName["streamName"] = iconv + ("utf-16le", $this->getOption("encoding"), + $this->_reader->readString16LE($streamNameLength)); + $this->_streamNames[] = $streamName; + } + for ($i = 0; $i < $payloadExtensionSystemCount; $i++) { + $payloadExtensionSystem = array + ("extensionSystemId" => $this->_reader->readGUID(), + "extensionDataSize" => $this->_reader->readUInt16LE()); + $extensionSystemInfoLength = $this->_reader->readUInt32LE(); + $payloadExtensionSystem["extensionSystemInfo"] = iconv + ("utf-16le", $this->getOption("encoding"), + $this->_reader->readString16LE($extensionSystemInfoLength)); + $this->_payloadExtensionSystems[] = $payloadExtensionSystem; + } + } + + /** + * Returns the presentation time of the first object, indicating where this + * digital media stream starts within the context of the timeline of the ASF + * file as a whole. This time value corresponds to presentation times as they + * appear in the data packets (adjusted by the preroll). This field is given + * in units of milliseconds and can optionally be set to 0, in which case it + * will be ignored. + * + * @return integer + */ + public function getStartTime() { return $this->_startTime; } + + /** + * Returns the presentation time of the last object plus the duration of play, + * indicating where this digital media stream ends within the context of the + * timeline of the ASF file as a whole. This time value corresponds to + * presentation times as they appear in the data packets (adjusted by the + * preroll). This field is given in units of milliseconds and can optionally + * be set to 0, in which case it will be ignored. + * + * @return integer + */ + public function getEndTime() { return $this->_endTime; } + + /** + * Returns the leak rate R, in bits per second, of a leaky bucket that + * contains the data portion of the stream without overflowing, excluding all + * ASF Data Packet overhead. The size of the leaky bucket is specified by the + * value of the Buffer Size field. This field has a non-zero value. + * + * @return integer + */ + public function getDataBitrate() { return $this->_dataBitrate; } + + /** + * Returns the size B, in milliseconds, of the leaky bucket used in the + * Data Bitrate definition. + * + * @return integer + */ + public function getBufferSize() { return $this->_bufferSize; } + + /** + * Returns the initial fullness, in milliseconds, of the leaky bucket used in + * the Data Bitrate definition. This is the fullness of the buffer at + * the instant before the first bit in the stream is dumped into the bucket. + * Typically, this value is set to 0. This value shall not exceed the value in + * the Buffer Size field. + * + * @return integer + */ + public function getInitialBufferFullness() + { + return $this->_initialBufferFullness; + } + + /** + * Returns the leak rate RAlt, in bits per second, of a leaky bucket that + * contains the data portion of the stream without overflowing, excluding all + * ASF Data Packet overhead. The size of the leaky bucket is specified + * by the value of the Alternate Buffer Size field. This value is + * relevant in most scenarios where the bit rate is not exactly constant, but + * it is especially useful for streams that have highly variable bit rates. + * This field can optionally be set to the same value as the Data + * Bitrate field. + * + * @return integer + */ + public function getAlternateDataBitrate() + { + return $this->_alternateDataBitrate; + } + + /** + * Returns the size BAlt, in milliseconds, of the leaky bucket used in the + * Alternate Data Bitrate definition. This value is relevant in most + * scenarios where the bit rate is not exactly constant, but it is especially + * useful for streams that have highly variable bit rates. This field can + * optionally be set to the same value as the Buffer Size field. + * + * @return integer + */ + public function getAlternateBufferSize() + { + return $this->_alternateBufferSize; + } + + /** + * Returns the initial fullness, in milliseconds, of the leaky bucket used in + * the Alternate Data Bitrate definition. This is the fullness of the + * buffer at the instant before the first bit in the stream is dumped into the + * bucket. Typically, this value is set to 0. This value does not exceed the + * value of the Alternate Buffer Size field. + * + * @return integer + */ + public function getAlternateInitialBufferFullness() + { + return $this->_alternateInitialBufferFullness; + } + + /** + * Returns the maximum size of the largest sample stored in the data packets + * for a stream. A value of 0 means unknown. + * + * @return integer + */ + public function getMaximumObjectSize() + { + return $this->_maximumObjectSize; + } + + /** + * Returns the average time duration, measured in 100-nanosecond units, of + * each frame. This number should be rounded to the nearest integer. This + * field can optionally be set to 0 if the average time per frame is unknown + * or unimportant. It is recommended that this field be set for video. + * + * @return integer + */ + public function getAverageTimePerFrame() + { + return $this->_averageTimePerFrame; + } + + /** + * Returns the number of this stream. 0 is an invalid stream number (that is, + * other Header Objects use stream number 0 to refer to the entire file + * as a whole rather than to a specific media stream within the file). Valid + * values are between 1 and 127. + * + * @return integer + */ + public function getStreamNumber() + { + return $this->_streamNumber; + } + + /** + * Returns the language, if any, which the content of the stream uses or + * assumes. Refer to the {@link LanguageList Language List Object} description + * for the details concerning how the Stream Language Index and + * Language Index fields should be used. Note that this is an index + * into the languages listed in the Language List Object rather than a + * language identifier. + * + * @return integer + */ + public function getStreamLanguageIndex() + { + return $this->_streamLanguageIndex; + } + + /** + * Returns an array of Stream Names. Each stream name instance is potentially + * localized into a specific language. The Language Index field + * indicates the language in which the Stream Name has been written. + * + * The array contains the following keys: + * o languageIndex -- The language index + * o streamName -- The localized stream name + * + * @return Array + */ + public function getStreamNames() + { + return $this->_streamNames; + } + + /** + * Returns an array of payload extension systems. Payload extensions provide a + * way for content creators to specify kinds of data that will appear in the + * payload header for every payload from this stream. This system is used when + * stream properties must be conveyed at the media object level. The + * Replicated Data bytes in the payload header will contain these + * properties in the order in which the Payload Extension Systems + * appear in this object. A Payload Extension System must appear in the + * Extended Stream Properties Object for each type of per-media-object + * properties that will appear with the payloads for this stream. + * + * The array contains the following keys: + * o extensionSystemId -- Specifies a unique identifier for the extension + * system. + * o extensionDataSize -- Specifies the fixed size of the extension data for + * this system that will appear in the replicated data alongside every + * payload for this stream. If this extension system uses variable-size + * data, then this should be set to 0xffff. Note, however, that replicated + * data length is limited to 255 bytes, which limits the total size of all + * extension systems for a particular stream. + * o extensionSystemInfo -- Specifies additional information to describe + * this extension system (optional). + * + * @return Array + */ + public function getPayloadExtensionSystems() + { + return $this->_payloadExtensionSystems; + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/FileProperties.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/FileProperties.php new file mode 100644 index 0000000..c1e4ada --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/FileProperties.php @@ -0,0 +1,255 @@ +File Properties Object defines the global characteristics of the + * combined digital media streams found within the Data Object. + * + * @package php-reader + * @subpackage ASF + * @author Sven Vollbehr + * @copyright Copyright (c) 2006-2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 102 $ + */ +final class ASF_Object_FileProperties extends ASF_Object +{ + /** + * Indicates, if set, that a file is in the process of being created (for + * example, for recording applications), and thus that various values stored + * in the header objects are invalid. It is highly recommended that + * post-processing be performed to remove this condition at the earliest + * opportunity. + */ + const BROADCAST = 1; + + /** + * Indicates, if set, that a file is seekable. Note that for files containing + * a single audio stream and a Minimum Data Packet Size field equal to + * the Maximum Data Packet Size field, this flag shall always be set to + * 1. For files containing a single audio stream and a video stream or + * mutually exclusive video streams, this flag is only set to 1 if the file + * contains a matching Simple Index Object for each regular video + * stream. + */ + const SEEKABLE = 2; + + /** @var string */ + private $_fileId; + + /** @var integer */ + private $_fileSize; + + /** @var integer */ + private $_creationDate; + + /** @var integer */ + private $_dataPacketsCount; + + /** @var integer */ + private $_playDuration; + + /** @var integer */ + private $_sendDuration; + + /** @var integer */ + private $_preroll; + + /** @var integer */ + private $_flags; + + /** @var integer */ + private $_minimumDataPacketSize; + + /** @var integer */ + private $_maximumDataPacketSize; + + /** @var integer */ + private $_maximumBitrate; + + /** + * Constructs the class with given parameters and reads object related data + * from the ASF file. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $this->_fileId = $this->_reader->readGUID(); + $this->_fileSize = $this->_reader->readInt64LE(); + $this->_creationDate = $this->_reader->readInt64LE(); + $this->_dataPacketsCount = $this->_reader->readInt64LE(); + $this->_playDuration = $this->_reader->readInt64LE(); + $this->_sendDuration = $this->_reader->readInt64LE(); + $this->_preroll = $this->_reader->readInt64LE(); + $this->_flags = $this->_reader->readUInt32LE(); + $this->_minimumDataPacketSize = $this->_reader->readUInt32LE(); + $this->_maximumDataPacketSize = $this->_reader->readUInt32LE(); + $this->_maximumBitrate = $this->_reader->readUInt32LE(); + } + + /** + * Returns the file id field. + * + * @return integer + */ + public function getFileId() { return $this->_fileId; } + + /** + * Returns the size, in bytes, of the entire file. The value of this field is + * invalid if the broadcast flag bit in the flags field is set to 1. + * + * @return integer + */ + public function getFileSize() { return $this->_fileSize; } + + /** + * Returns the date and time of the initial creation of the file. The value is + * given as the number of 100-nanosecond intervals since January 1, 1601, + * according to Coordinated Universal Time (Greenwich Mean Time). The value of + * this field may be invalid if the broadcast flag bit in the flags field is + * set to 1. + * + * @return integer + */ + public function getCreationDate() { return $this->_creationDate; } + + /** + * Returns the number of Data Packet entries that exist within the + * {@link ASF_Object_Data Data Object}. The value of this field is invalid if + * the broadcast flag bit in the flags field is set to 1. + * + * @return integer + */ + public function getDataPacketsCount() { return $this->_dataPacketsCount; } + + /** + * Returns the time needed to play the file in 100-nanosecond units. This + * value should include the duration (estimated, if an exact value is + * unavailable) of the the last media object in the presentation. The value of + * this field is invalid if the broadcast flag bit in the flags field is set + * to 1. + * + * @return integer + */ + public function getPlayDuration() { return $this->_playDuration; } + + /** + * Returns the time needed to send the file in 100-nanosecond units. This + * value should include the duration of the last packet in the content. The + * value of this field is invalid if the broadcast flag bit in the flags field + * is set to 1. + * + * @return integer + */ + public function getSendDuration() { return $this->_sendDuration; } + + /** + * Returns the amount of time to buffer data before starting to play the file, + * in millisecond units. If this value is nonzero, the Play Duration + * field and all of the payload Presentation Time fields have been + * offset by this amount. Therefore, player software must subtract the value + * in the preroll field from the play duration and presentation times to + * calculate their actual values. + * + * @return integer + */ + public function getPreroll() { return $this->_preroll; } + + /** + * Checks whether or not the flag is set. Returns true if the flag + * is set, false otherwise. + * + * @param integer $flag The flag to query. + * @return boolean + */ + public function hasFlag($flag) { return ($this->_flags & $flag) == $flag; } + + /** + * Returns the flags field. + * + * @return integer + */ + public function getFlags() { return $this->_flags; } + + /** + * Returns the minimum Data Packet size in bytes. In general, the value + * of this field is invalid if the broadcast flag bit in the flags field is + * set to 1. However, the values for the Minimum Data Packet Size and + * Maximum Data Packet Size fields shall be set to the same value, and + * this value should be set to the packet size, even when the broadcast flag + * in the flags field is set to 1. + * + * @return integer + */ + public function getMinimumDataPacketSize() + { + return $this->_minimumDataPacketSize; + } + + /** + * Returns the maximum Data Packet size in bytes. In general, the value + * of this field is invalid if the broadcast flag bit in the flags field is + * set to 1. However, the values for the Minimum Data Packet Size and + * Maximum Data Packet Size fields shall be set to the same value, and + * this value should be set to the packet size, even when the broadcast flag + * in the flags field is set to 1. + * + * @return integer + */ + public function getMaximumDataPacketSize() + { + return $this->_maximumDataPacketSize; + } + + /** + * Returns the maximum instantaneous bit rate in bits per second for the + * entire file. This is equal the sum of the bit rates of the individual + * digital media streams. + * + * @return integer + */ + public function getMaximumBitrate() { return $this->_maximumBitrate; } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/GroupMutualExclusion.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/GroupMutualExclusion.php new file mode 100644 index 0000000..f5bc6e4 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/GroupMutualExclusion.php @@ -0,0 +1,108 @@ +Group Mutual Exclusion Object is used to describe mutual exclusion + * relationships between groups of streams. This object is organized in terms of + * records, each containing one or more streams, where a stream in record N + * cannot coexist with a stream in record M for N != M (however, streams in the + * same record can coexist). This mutual exclusion object would be used + * typically for the purpose of language mutual exclusion, and a record would + * consist of all streams for a particular language. + * + * @package php-reader + * @subpackage ASF + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 108 $ + */ +final class ASF_Object_GroupMutualExclusion extends ASF_Object +{ + const MUTEX_LANGUAGE = "d6e22a00-35da-11d1-9034-00a0c90349be"; + const MUTEX_BITRATE = "d6e22a01-35da-11d1-9034-00a0c90349be"; + const MUTEX_UNKNOWN = "d6e22a02-35da-11d1-9034-00a0c90349be"; + + /** @var string */ + private $_exclusionType; + + /** @var Array */ + private $_records = array(); + + /** + * Constructs the class with given parameters and reads object related data + * from the ASF file. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + $this->_exclusionType = $this->_reader->readGUID(); + $recordCount = $this->_reader->readUInt16LE(); + for ($i = 0; $i < $recordCount; $i++) { + $streamNumbersCount = $this->_reader->readUInt16LE(); + $streamNumbers = array(); + for ($j = 0; $j < $streamNumbersCount; $j++) + $streamNumbers[] = array + ("streamNumbers" => $this->_reader->readUInt16LE()); + $this->_records[] = $streamNumbers; + } + } + + /** + * Returns the nature of the mutual exclusion relationship. + * + * @return string + */ + public function getExclusionType() { return $this->_exclusionType; } + + /** + * Returns an array of records. Each record consists of the following keys. + * + * o streamNumbers -- Specifies the stream numbers for this record. Valid + * values are between 1 and 127. + * + * @return Array + */ + public function getRecords() { return $this->_records; } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/Header.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/Header.php new file mode 100644 index 0000000..489ea78 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/Header.php @@ -0,0 +1,125 @@ + + * @copyright Copyright (c) 2006-2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 102 $ + */ +final class ASF_Object_Header extends ASF_Object_Container +{ + const FILE_PROPERTIES = "8cabdca1-a947-11cf-8ee4-00c00c205365"; + const STREAM_PROPERTIES = "b7dc0791-a9b7-11cf-8ee6-00c00c205365"; + const HEADER_EXTENSION = "5fbf03b5-a92e-11cf-8ee3-00c00c205365"; + const CODEC_LIST = "86d15240-311d-11d0-a3a4-00a0c90348f6"; + const SCRIPT_COMMAND = "1efb1a30-0b62-11d0-a39b-00a0c90348f6"; + const MARKER = "f487cd01-a951-11cf-8ee6-00c00c205365"; + const BITRATE_MUTUAL_EXCLUSION = "d6e229dc-35da-11d1-9034-00a0c90349be"; + const ERROR_CORRECTION = "75b22635-668e-11cf-a6d9-00aa0062ce6c"; + const CONTENT_DESCRIPTION = "75b22633-668e-11cf-a6d9-00aa0062ce6c"; + const EXTENDED_CONTENT_DESCRIPTION = "d2d0a440-e307-11d2-97f0-00a0c95ea850"; + const CONTENT_BRANDING = "2211b3fa-bd23-11d2-b4b7-00a0c955fc6e"; + const STREAM_BITRATE_PROPERTIES = "7bf875ce-468d-11d1-8d82-006097c9a2b2"; + const CONTENT_ENCRYPTION = "2211b3fb-bd23-11d2-b4b7-00a0c955fc6e"; + const EXTENDED_CONTENT_ENCRYPTION = "298ae614-2622-4c17-b935-dae07ee9289c"; + const DIGITAL_SIGNATURE = "2211b3fc-bd23-11d2-b4b7-00a0c955fc6e"; + const PADDING = "1806d474-cadf-4509-a4ba-9aabcb96aae8"; + + /** + * Constructs the class with given parameters and options. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $this->_reader->skip(6); + $this->constructObjects + (array + (self::FILE_PROPERTIES => "FileProperties", + self::STREAM_PROPERTIES => "StreamProperties", + self::HEADER_EXTENSION => "HeaderExtension", + self::CODEC_LIST => "CodecList", + self::SCRIPT_COMMAND => "ScriptCommand", + self::MARKER => "Marker", + self::BITRATE_MUTUAL_EXCLUSION => "BitrateMutualExclusion", + self::ERROR_CORRECTION => "ErrorCorrection", + self::CONTENT_DESCRIPTION => "ContentDescription", + self::EXTENDED_CONTENT_DESCRIPTION => "ExtendedContentDescription", + self::CONTENT_BRANDING => "ContentBranding", + self::STREAM_BITRATE_PROPERTIES => "StreamBitrateProperties", + self::CONTENT_ENCRYPTION => "ContentEncryption", + self::EXTENDED_CONTENT_ENCRYPTION => "ExtendedContentEncryption", + self::DIGITAL_SIGNATURE => "DigitalSignature", + self::PADDING => "Padding")); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/HeaderExtension.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/HeaderExtension.php new file mode 100644 index 0000000..92c8c0d --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/HeaderExtension.php @@ -0,0 +1,101 @@ +Header Extension Object allows additional functionality to be + * added to an ASF file while maintaining backward compatibility. The Header + * Extension Object is a container containing zero or more additional extended + * header objects. + * + * @package php-reader + * @subpackage ASF + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 108 $ + */ +final class ASF_Object_HeaderExtension extends ASF_Object_Container +{ + const EXTENDED_STREAM_PROPERTIES = "14e6a5cb-c672-4332-8399-a96952065b5a"; + const ADVANCED_MUTUAL_EXCLUSION = "a08649cf-4775-4670-8a16-6e35357566cd"; + const GROUP_MUTUAL_EXCLUSION = "d1465a40-5a79-4338-b71b-e36b8fd6c249"; + const STREAM_PRIORITIZATION = "d4fed15b-88d3-454f-81f0-ed5c45999e24"; + const BANDWIDTH_SHARING = "a69609e6-517b-11d2-b6af-00c04fd908e9"; + const LANGUAGE_LIST = "7c4346a9-efe0-4bfc-b229-393ede415c85"; + const METADATA = "c5f8cbea-5baf-4877-8467-aa8c44fa4cca"; + const METADATA_LIBRARY = "44231c94-9498-49d1-a141-1d134e457054"; + const INDEX_PARAMETERS = "d6e229df-35da-11d1-9034-00a0c90349be"; + const MEDIA_OBJECT_INDEX_PARAMETERS = "6b203bad-3f11-48e4-aca8-d7613de2cfa7"; + const TIMECODE_INDEX_PARAMETERS = "f55e496d-9797-4b5d-8c8b-604dfe9bfb24"; + const COMPATIBILITY = "75b22630-668e-11cf-a6d9-00aa0062ce6c"; + const ADVANCED_CONTENT_ENCRYPTION = "43058533-6981-49e6-9b74-ad12cb86d58c"; + const PADDING = "1806d474-cadf-4509-a4ba-9aabcb96aae8"; + + /** + * Constructs the class with given parameters and reads object related data + * from the ASF file. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $this->_reader->skip(22); + $this->constructObjects + (array + (self::EXTENDED_STREAM_PROPERTIES => "ExtendedStreamProperties", + self::ADVANCED_MUTUAL_EXCLUSION => "AdvancedMutualExclusion", + self::GROUP_MUTUAL_EXCLUSION => "GroupMutualExclusion", + self::STREAM_PRIORITIZATION => "StreamPrioritization", + self::BANDWIDTH_SHARING => "BandwidthSharing", + self::LANGUAGE_LIST => "LanguageList", + self::METADATA => "Metadata", + self::METADATA_LIBRARY => "MetadataLibrary", + self::INDEX_PARAMETERS => "IndexParameters", + self::MEDIA_OBJECT_INDEX_PARAMETERS => "MediaObjectIndexParameters", + self::TIMECODE_INDEX_PARAMETERS => "TimecodeIndexParameters", + self::COMPATIBILITY => "Compatibility", + self::ADVANCED_CONTENT_ENCRYPTION => "AdvancedContentEncryption", + self::PADDING => "Padding")); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/Index.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/Index.php new file mode 100644 index 0000000..6ce63ca --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/Index.php @@ -0,0 +1,185 @@ +Index Object are in terms of presentation times. The + * corresponding Offset field values of the Index Entry byte + * offsets that, when combined with the Block Position value of the + * Index Block, indicate the starting location in bytes of an ASF Data + * Packet relative to the start of the first ASF Data Packet in the file. + * + * An offset value of 0xFFFFFFFF is used to indicate an invalid offset value. + * Invalid offsets signify that this particular index entry does not identify a + * valid indexible point. Invalid offsets may occur for the initial index + * entries of a digital media stream whose first ASF Data Packet has a non-zero + * send time. Invalid offsets may also occur in the case where a digital media + * stream has a large gap in the presentation time of successive objects. + * + * The Index Object is not recommended for use with files where the + * Send Time of the first Data Packet within the Data + * Object has a Send Time value significantly greater than zero + * (otherwise the index itself will be sparse and inefficient). + * + * Any ASF file containing an Index Object does also contain an Index + * Parameters Object in its {@link ASF_Object_Header ASF Header}. + * + * @package php-reader + * @subpackage ASF + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 108 $ + */ +final class ASF_Object_Index extends ASF_Object +{ + /** + * Indicates that the index type is Nearest Past Data Packet. The Nearest + * Past Data Packet indexes point to the data packet whose presentation time + * is closest to the index entry time. + */ + const NEAREST_PAST_DATA_PACKET = 1; + + /** + * Indicates that the index type is Nearest Past Media. The Nearest Past + * Object indexes point to the closest data packet containing an entire object + * or first fragment of an object. + */ + const NEAREST_PAST_MEDIA = 2; + + /** + * Indicates that the index type is Nearest Past Cleanpoint. The Nearest Past + * Cleanpoint indexes point to the closest data packet containing an entire + * object (or first fragment of an object) that has the Cleanpoint Flag set. + * + * Nearest Past Cleanpoint is the most common type of index. + */ + const NEAREST_PAST_CLEANPOINT = 3; + + /** @var integer */ + private $_indexEntryTimeInterval; + + /** @var Array */ + private $_indexSpecifiers = array(); + + /** @var Array */ + private $_indexBlocks = array(); + + /** + * Constructs the class with given parameters and reads object related data + * from the ASF file. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $this->_indexEntryTimeInterval = $this->_reader->readUInt32LE(); + $indexSpecifiersCount = $this->_reader->readUInt16LE(); + $indexBlocksCount = $this->_reader->readUInt32LE(); + for ($i = 0; $i < $indexSpecifiersCount; $i++) + $this->_indexSpecifiers[] = array + ("streamNumber" => $this->_reader->readUInt16LE(), + "indexType" => $this->_reader->readUInt16LE()); + for ($i = 0; $i < $indexBlocksCount; $i++) { + $indexEntryCount = $this->_reader->readUInt32LE(); + $blockPositions = array(); + for ($i = 0; $i < $indexSpecifiersCount; $i++) + $blockPositions[] = $this->_reader->readInt64LE(); + $offsets = array(); + for ($i = 0; $i < $indexSpecifiersCount; $i++) + $offsets[] = $this->_reader->readUInt32LE(); + $this->_indexBlocks[] = array + ("blockPositions" => $blockPositions, + "indexEntryOffsets" => $offsets); + } + } + + /** + * Returns the time interval between each index entry in ms. + * + * @return integer + */ + public function getIndexEntryTimeInterval() + { + return $this->_indexEntryTimeInterval; + } + + /** + * Returns an array of index specifiers. Each entry consists of the following + * keys. + * + * o streamNumber -- Specifies the stream number that the Index + * Specifiers refer to. Valid values are between 1 and 127. + * + * o indexType -- Specifies the type of index. + * + * @return Array + */ + public function getIndexSpecifiers() { return $this->_indexSpecifiers; } + + /** + * Returns an array of index entries. Each entry consists of the following + * keys. + * + * o blockPositions -- Specifies a list of byte offsets of the beginnings of + * the blocks relative to the beginning of the first Data Packet (for + * example, the beginning of the Data Object + 50 bytes). + * + * o indexEntryOffsets -- Specifies the offset. An offset value of + * 0xffffffff indicates an invalid offset value. + * + * @return Array + */ + public function getIndexBlocks() { return $this->_indexBlocks; } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/IndexParameters.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/IndexParameters.php new file mode 100644 index 0000000..d8229d9 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/IndexParameters.php @@ -0,0 +1,121 @@ +Index Parameters Object supplies information about those streams + * that are actually indexed (there must be at least one stream in an index) by + * the {@link ASF_Object_Index Index Object} and how they are being indexed. + * This object shall be present in the {@link ASF_Object_Header Header Object} + * if there is an {@link ASF_Object_Index Index Object} present in the file. + * + * An Index Specifier is required for each stream that will be indexed by the + * {@link ASF_Object_Index Index Object}. These specifiers must exactly match + * those in the {@link ASF_Object_Index Index Object}. + * + * @package php-reader + * @subpackage ASF + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 108 $ + */ +final class ASF_Object_IndexParameters extends ASF_Object +{ + /** @var string */ + private $_indexEntryTimeInterval; + + /** @var Array */ + private $_indexSpecifiers = array(); + + /** + * Constructs the class with given parameters and reads object related data + * from the ASF file. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $this->_indexEntryTimeInterval = $this->_reader->readUInt32LE(); + $indexSpecifiersCount = $this->_reader->readUInt16LE(); + for ($i = 0; $i < $indexSpecifiersCount; $i++) { + $this->_indexSpecifiers[] = array + ("streamNumber" => $this->_reader->readUInt16LE(), + "indexType" => $this->_reader->readUInt16LE()); + } + } + + /** + * Returns the time interval between index entries in milliseconds. This value + * cannot be 0. + * + * @return integer + */ + public function getIndexEntryTimeInterval() + { + return $this->_indexEntryTimeInterval; + } + + /** + * Returns an array of index entries. Each entry consists of the following + * keys. + * + * o streamNumber -- Specifies the stream number that the Index Specifiers + * refer to. Valid values are between 1 and 127. + * + * o indexType -- Specifies the type of index. Values are as follows: + * 1 = Nearest Past Data Packet, + * 2 = Nearest Past Media Object, and + * 3 = Nearest Past Cleanpoint. + * The Nearest Past Data Packet indexes point to the data packet whose + * presentation time is closest to the index entry time. The Nearest Past + * Object indexes point to the closest data packet containing an entire + * object or first fragment of an object. The Nearest Past Cleanpoint + * indexes point to the closest data packet containing an entire object + * (or first fragment of an object) that has the Cleanpoint Flag set. + * Nearest Past Cleanpoint is the most common type of index. + * + * @return Array + */ + public function getIndexSpecifiers() { return $this->_indexSpecifiers; } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/LanguageList.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/LanguageList.php new file mode 100644 index 0000000..13c6950 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/LanguageList.php @@ -0,0 +1,85 @@ +Language List Object contains an array of Unicode-based language + * IDs. All other header objects refer to languages through zero-based positions + * in this array. + * + * @package php-reader + * @subpackage ASF + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 102 $ + */ +final class ASF_Object_LanguageList extends ASF_Object +{ + /** @var Array */ + private $_languages = array(); + + /** + * Constructs the class with given parameters and reads object related data + * from the ASF file. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $languageIdRecordsCount = $this->_reader->readUInt16LE(); + for ($i = 0; $i < $languageIdRecordsCount; $i++) { + $languageIdLength = $this->_reader->readInt8(); + $languageId = $this->_reader->readString16LE($languageIdLength); + $this->_languages[] = iconv + ("utf-16le", $this->getOption("encoding"), $languageId); + } + } + + /** + * Returns the array of language ids. + * + * @return Array + */ + public function getLanguage() { return $this->_languages; } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/Marker.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/Marker.php new file mode 100644 index 0000000..697cb4a --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/Marker.php @@ -0,0 +1,121 @@ +Marker Object class. + * + * @package php-reader + * @subpackage ASF + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 108 $ + */ +final class ASF_Object_Marker extends ASF_Object +{ + /** @var string */ + private $_name; + + /** @var Array */ + private $_markers = array(); + + /** + * Constructs the class with given parameters and reads object related data + * from the ASF file. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $this->_reader->skip(16); + $markersCount = $this->_reader->readUInt32LE(); + $this->_reader->skip(2); + $nameLength = $this->_reader->readUInt16LE(); + $this->_name = iconv + ("utf-16le", $this->getOption("encoding"), + $this->_reader->readString16LE($nameLength)); + for ($i = 0; $i < $markersCount; $i++) { + $marker = array + ("offset" => $this->_reader->readInt64LE(), + "presentationTime" => $this->_reader->readInt64LE()); + $this->_reader->skip(2); + $marker["sendTime"] = $this->_reader->readUInt32LE(); + $marker["flags"] = $this->_reader->readUInt32LE(); + $descriptionLength = $this->_reader->readUInt32LE(); + $marker["description"] = iconv + ("utf-16le", $this->getOption("encoding"), + $this->_reader->readString16LE($descriptionLength)); + $this->_markers[] = $marker; + } + } + + /** + * Returns the name of the Marker Object. + * + * @return Array + */ + public function getName() { return $this->_name; } + + /** + * Returns an array of markers. Each entry consists of the following keys. + * + * o offset -- Specifies a byte offset into the Data Object to the + * actual position of the marker in the Data Object. ASF parsers + * must seek to this position to properly display data at the specified + * marker Presentation Time. + * + * o presentationTime -- Specifies the presentation time of the marker, in + * 100-nanosecond units. + * + * o sendTime -- Specifies the send time of the marker entry, in + * milliseconds. + * + * o flags -- Flags are reserved and should be set to 0. + * + * o description -- Specifies a description of the marker entry. + * + * @return Array + */ + public function getMarkers() { return $this->_markers; } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/MediaObjectIndex.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/MediaObjectIndex.php new file mode 100644 index 0000000..676abd1 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/MediaObjectIndex.php @@ -0,0 +1,176 @@ +Media Object Index Object are in terms of media + * object numbers, with the first frame for a given stream in the ASF file + * corresponding to entry 0 in the Media Object Index Object. The + * corresponding Offset field values of the Index Entry are byte + * offsets that, when combined with the Block Position value of the + * Index Block, indicate the starting location in bytes of an ASF Data Packet + * relative to the start of the first ASF Data Packet in the file. + * + * Any ASF file containing a Media Object Index Object shall also contain + * a Media Object Index Parameters Object in its + * {@link ASF_Object_Header ASF Header}. + * + * @package php-reader + * @subpackage ASF + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 108 $ + */ +final class ASF_Object_MediaObjectIndex extends ASF_Object +{ + /** + * Indicates that the index type is Nearest Past Data Packet. The Nearest + * Past Data Packet indexes point to the data packet whose presentation time + * is closest to the index entry time. + */ + const NEAREST_PAST_DATA_PACKET = 1; + + /** + * Indicates that the index type is Nearest Past Media. The Nearest Past + * Object indexes point to the closest data packet containing an entire object + * or first fragment of an object. + */ + const NEAREST_PAST_MEDIA = 2; + + /** + * Indicates that the index type is Nearest Past Cleanpoint. The Nearest Past + * Cleanpoint indexes point to the closest data packet containing an entire + * object (or first fragment of an object) that has the Cleanpoint Flag set. + * + * Nearest Past Cleanpoint is the most common type of index. + */ + const NEAREST_PAST_CLEANPOINT = 3; + + /** @var integer */ + private $_indexEntryCountInterval; + + /** @var Array */ + private $_indexSpecifiers = array(); + + /** @var Array */ + private $_indexBlocks = array(); + + /** + * Constructs the class with given parameters and reads object related data + * from the ASF file. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $this->_indexEntryCountInterval = $this->_reader->readUInt32LE(); + $indexSpecifiersCount = $this->_reader->readUInt16LE(); + $indexBlocksCount = $this->_reader->readUInt32LE(); + for ($i = 0; $i < $indexSpecifiersCount; $i++) + $this->_indexSpecifiers[] = array + ("streamNumber" => $this->_reader->readUInt16LE(), + "indexType" => $this->_reader->readUInt16LE()); + for ($i = 0; $i < $indexBlocksCount; $i++) { + $indexEntryCount = $this->_reader->readUInt32LE(); + $blockPositions = array(); + for ($i = 0; $i < $indexSpecifiersCount; $i++) + $blockPositions[] = $this->_reader->readInt64LE(); + $offsets = array(); + for ($i = 0; $i < $indexSpecifiersCount; $i++) + $offsets[] = $this->_reader->readUInt32LE(); + $this->_indexBlocks[] = array + ("blockPositions" => $blockPositions, + "indexEntryOffsets" => $offsets); + } + } + + /** + * Returns the interval between each index entry in number of media objects. + * + * @return integer + */ + public function getIndexEntryCountInterval() + { + return $this->_indexEntryCountInterval; + } + + /** + * Returns an array of index specifiers. Each entry consists of the following + * keys. + * + * o streamNumber -- Specifies the stream number that the Index + * Specifiers refer to. Valid values are between 1 and 127. + * + * o indexType -- Specifies the type of index. + * + * @return Array + */ + public function getIndexSpecifiers() { return $this->_indexSpecifiers; } + + /** + * Returns an array of index entries. Each entry consists of the following + * keys. + * + * o blockPositions -- Specifies a list of byte offsets of the beginnings of + * the blocks relative to the beginning of the first Data Packet (for + * example, the beginning of the Data Object + 50 bytes). + * + * o indexEntryOffsets -- Specifies the offset. An offset value of + * 0xffffffff indicates an invalid offset value. + * + * @return Array + */ + public function getIndexBlocks() { return $this->_indexBlocks; } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/MediaObjectIndexParameters.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/MediaObjectIndexParameters.php new file mode 100644 index 0000000..ffc8998 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/MediaObjectIndexParameters.php @@ -0,0 +1,130 @@ +Media Object Index Parameters Object supplies information about + * those streams that actually indexed (there must be at least one stream in an + * index) by media objects. This object shall be present in the + * {@link ASF_Object_Header Header Object} if there is a + * {@link ASF_Object_MediaObjectIndex Media Object Index Object} present in the + * file. + * + * An Index Specifier is required for each stream that will be indexed by the + * {@link ASF_Object_MediaObjectIndex Media Object Index Object}. These + * specifiers must exactly match those in the + * {@link ASF_Object_MediaObjectIndex Media Object Index Object}. + * + * @package php-reader + * @subpackage ASF + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 108 $ + */ +final class ASF_Object_MediaObjectIndexParameters extends ASF_Object +{ + /** @var string */ + private $_indexEntryCountInterval; + + /** @var Array */ + private $_indexSpecifiers = array(); + + /** + * Constructs the class with given parameters and reads object related data + * from the ASF file. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $this->_indexEntryCountInterval = $this->_reader->readUInt32LE(); + $indexSpecifiersCount = $this->_reader->readUInt16LE(); + for ($i = 0; $i < $indexSpecifiersCount; $i++) { + $this->_indexSpecifiers[] = array + ("streamNumber" => $this->_reader->readUInt16LE(), + "indexType" => $this->_reader->readUInt16LE()); + } + } + + /** + * Returns the interval between each index entry by the number of media + * objects. This value cannot be 0. + * + * @return integer + */ + public function getIndexEntryCountInterval() + { + return $this->_indexEntryCountInterval; + } + + /** + * Returns an array of index entries. Each entry consists of the following + * keys. + * + * o streamNumber -- Specifies the stream number that the Index Specifiers + * refer to. Valid values are between 1 and 127. + * + * o indexType -- Specifies the type of index. Values are defined as + * follows: + * 1 = Nearest Past Data Packet, + * 2 = Nearest Past Media Object, + * 3 = Nearest Past Cleanpoint, + * 0xff = Frame Number Offset. + * For a video stream, the Nearest Past Media Object and Nearest Past Data + * Packet indexes point to the closest data packet containing an entire + * video frame or first fragment of a video frame; Nearest Past Cleanpoint + * indexes point to the closest data packet containing an entire video + * frame (or first fragment of a video frame) that is a key frame; and + * Frame Number Offset indicates how many more frames need to be read for + * the given stream, starting with the first frame in the packet pointed + * to by the index entry, in order to get to the requested frame. Nearest + * Past Media Object is the most common value. Because ASF payloads do not + * contain the full frame number, there is often a Frame Number Offset + * index alongside one of the other types of indexes to allow the user to + * identify the exact frame being seeked to. + * + * @return Array + */ + public function getIndexSpecifiers() { return $this->_indexSpecifiers; } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/Metadata.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/Metadata.php new file mode 100644 index 0000000..67b75e2 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/Metadata.php @@ -0,0 +1,113 @@ +Metadata Object permits authors to store stream-based metadata in + * a file. This object supports the same types of metadata information as the + * Extended Content Description Object except that it also allows a + * stream number to be specified. + * + * @package php-reader + * @subpackage ASF + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 102 $ + */ +final class ASF_Object_Metadata extends ASF_Object +{ + /** @var Array */ + private $_descriptions = array(); + + /** + * Constructs the class with given parameters and reads object related data + * from the ASF file. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $descriptionRecordsCount = $this->_reader->readUInt16LE(); + for ($i = 0; $i < $descriptionRecordsCount; $i++) { + $this->_reader->skip(2); + $record = array("streamNumber" => $this->_reader->readUInt16LE()); + $nameLength = $this->_reader->readUInt16LE(); + $dataType = $this->_reader->readUInt16LE(); + $dataLength = $this->_reader->readUInt32LE(); + $record["name"] = iconv + ("utf-16le", $this->getOption("encoding"), + $this->_reader->readString16LE($nameLength)); + switch ($dataType) { + case 0: + $record["data"] = iconv + ("utf-16le", $this->getOption("encoding"), + $this->_reader->readString16LE($dataLength)); + break; + case 1: + $record["data"] = $this->_reader->readString16LE($dataLength); + break; + case 2: + $record["data"] = $this->_reader->readUInt16LE() ? true : false; + break; + case 3: + $record["data"] = $this->_reader->readUInt32LE(); + break; + case 4: + $record["data"] = $this->_reader->readInt64LE(); + break; + case 5: + $record["data"] = $this->_reader->readUInt16LE(); + break; + } + $this->_descriptions[] = $record; + } + } + + /** + * Returns the array of description records. + * + * @return Array + */ + public function getDescriptions() { return $this->_descriptions; } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/MetadataLibrary.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/MetadataLibrary.php new file mode 100644 index 0000000..4a03fdf --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/MetadataLibrary.php @@ -0,0 +1,137 @@ +Metadata Library Object lets authors store stream-based, + * language-attributed, multiply defined, and large metadata attributes in a + * file. + * + * This object supports the same types of metadata as the + * {@link ASF_Object_Metadata Metadata Object}, as well as attributes + * with language IDs, attributes that are defined more than once, large + * attributes, and attributes with the GUID data type. + * + * @package php-reader + * @subpackage ASF + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 108 $ + */ +final class ASF_Object_MetadataLibrary extends ASF_Object +{ + /** @var Array */ + private $_descriptionRecords = array(); + + /** + * Constructs the class with given parameters and reads object related data + * from the ASF file. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $descriptionRecordsCount = $this->_reader->readUInt16LE(); + for ($i = 0; $i < $descriptionRecordsCount; $i++) { + $descriptionRecord = array + ("languageIndex" => $this->_reader->readUInt16LE(), + "streamNumber" => $this->_reader->readUInt16LE()); + $nameLength = $this->_reader->readUInt16LE(); + $dataType = $this->_reader->readUInt16LE(); + $dataLength = $this->_reader->readUInt32LE(); + $descriptionRecord["name"] = iconv + ("utf-16le", $this->getOption("encoding"), + $this->_reader->readString16LE($nameLength)); + switch ($dataType) { + case 0: // Unicode string + $descriptionRecord["data"] = iconv + ("utf-16le", $this->getOption("encoding"), + $this->_reader->readString16LE($dataLength)); + break; + case 1: // BYTE array + $descriptionRecord["data"] = $this->_reader->read($dataLength); + break; + case 2: // BOOL + $descriptionRecord["data"] = $this->_reader->readUInt16LE() == 1; + break; + case 3: // DWORD + $descriptionRecord["data"] = $this->_reader->readUInt32LE(); + break; + case 4: // QWORD + $descriptionRecord["data"] = $this->_reader->readInt64LE(); + break; + case 5: // WORD + $descriptionRecord["data"] = $this->_reader->readUInt16LE(); + break; + case 6: // GUID + $descriptionRecord["data"] = $this->_reader->readGUID(); + break; + } + $this->_descriptionRecords[] = $descriptionRecord; + } + } + + /** + * Returns an array of description records. Each record consists of the + * following keys. + * + * o languageIndex -- Specifies the index into the Language List + * Object that identifies the language of this attribute. If there is + * no Language List Object present, this field is zero. + * + * o streamNumber -- Specifies whether the entry applies to a specific + * digital media stream or whether it applies to the whole file. A value + * of 0 in this field indicates that it applies to the whole file; + * otherwise, the entry applies only to the indicated stream number. Valid + * values are between 1 and 127. + * + * o name -- Specifies the name that identifies the attribute being + * described. + * + * o data -- Specifies the actual metadata being stored. + * + * @return Array + */ + public function getDescriptionRecords() { return $this->_descriptionRecords; } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/Padding.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/Padding.php new file mode 100644 index 0000000..4e0be36 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/Padding.php @@ -0,0 +1,64 @@ +Padding Object is a dummy object that is used to pad the size of + * the Header Object. This object enables the size of any object stored + * in the Header Object to grow or shrink without having to rewrite the + * entire Data Object and Index Object sections of the ASF file. + * For instance, if entries in the Content Description Object or + * Extended Content Description Object need to be removed or shortened, + * the size of the Padding Object can be increased to compensate for the + * reduction in size of the Content Description Object. The ASF file can + * then be updated by overwriting the previous Header Object with the + * edited Header Object of identical size, without having to move or + * rewrite the data contained in the Data Object. + * + * @package php-reader + * @subpackage ASF + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 102 $ + */ +final class ASF_Object_Padding extends ASF_Object +{ +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/ScriptCommand.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/ScriptCommand.php new file mode 100644 index 0000000..4fdbfd6 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/ScriptCommand.php @@ -0,0 +1,124 @@ +Script Command Object provides a list of type/parameter pairs of + * strings that are synchronized to the ASF file's timeline. Types can include + * URL or FILENAME values. Other type values may also be freely defined and + * used. The semantics and treatment of this set of types are defined by the + * local implementations. The parameter value is specific to the type field. You + * can use this type/parameter pairing for many purposes, including sending URLs + * to be launched by a client into an HTML frame (in other words, the URL type) + * or launching another ASF file for the chained continuous play of audio or + * video presentations (in other words, the FILENAME type). This object is also + * used as a method to stream text, as well as to provide script commands that + * you can use to control elements within the client environment. + * + * @package php-reader + * @subpackage ASF + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 108 $ + */ +final class ASF_Object_ScriptCommand extends ASF_Object +{ + /** @var Array */ + private $_commandTypes = array(); + + /** @var Array */ + private $_commands = array(); + + /** + * Constructs the class with given parameters and reads object related data + * from the ASF file. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $this->_reader->skip(16); + $commandsCount = $this->_reader->readUInt16LE(); + $commandTypesCount = $this->_reader->readUInt16LE(); + for ($i = 0; $i < $commandTypesCount; $i++) { + $commandTypeNameLength = $this->_reader->readUInt16LE(); + $this->_commandTypes[] = iconv + ("utf-16le", $this->getOption("encoding"), + $this->_reader->readString16LE($commandTypeNameLength * 2)); + } + for ($i = 0; $i < $commandsCount; $i++) { + $command = array + ("presentationTime" => $this->_reader->readUInt32LE(), + "typeIndex" => $this->_reader->readUInt16LE()); + $commandNameLength = $this->_reader->readUInt16LE(); + $command["name"] = iconv + ("utf-16le", $this->getOption("encoding"), + $this->_reader->readString16LE($commandNameLength * 2)); + $this->_commands[] = $command; + } + } + + /** + * Returns an array of command type names. + * + * @return Array + */ + public function getCommandTypes() { return $this->_commandTypes; } + + /** + * Returns an array of index entries. Each entry consists of the following + * keys. + * + * o presentationTime -- Specifies the presentation time of the command, in + * milliseconds. + * + * o typeIndex -- Specifies the type of this command, as a zero-based index + * into the array of Command Types of this object. + * + * o name -- Specifies the name of this command. + * + * @return Array + */ + public function getCommands() { return $this->_commands; } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/SimpleIndex.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/SimpleIndex.php new file mode 100644 index 0000000..14de7c9 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/SimpleIndex.php @@ -0,0 +1,143 @@ +Simple Index Object. Additionally, the instances of the Simple + * Index Object shall be ordered by stream number. + * + * Index entries in the Simple Index Object are in terms of + * Presentation Times. The corresponding Packet Number field + * values (of the Index Entry, see below) indicate the packet number of + * the ASF Data Packet with the closest past key frame. Note that for + * video streams that contain both key frames and non-key frames, the Packet + * Number field will always point to the closest past key frame. + * + * @package php-reader + * @subpackage ASF + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 108 $ + */ +final class ASF_Object_SimpleIndex extends ASF_Object +{ + /** @var string */ + private $_fileId; + + /** @var integer */ + private $_indexEntryTimeInterval; + + /** @var integer */ + private $_maximumPacketCount; + + /** @var Array */ + private $_indexEntries = array(); + + /** + * Constructs the class with given parameters and reads object related data + * from the ASF file. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $this->_fileId = $this->_reader->readGUID(); + $this->_indexEntryTimeInterval = $this->_reader->readInt64LE(); + $this->_maximumPacketCount = $this->_reader->readUInt32LE(); + $indexEntriesCount = $this->_reader->readUInt32LE(); + for ($i = 0; $i < $indexEntriesCount; $i++) { + $this->_indexEntries[] = array + ("packetNumber" => $this->_reader->readUInt32LE(), + "packetCount" => $this->_reader->readUInt16LE()); + } + } + + /** + * Returns the unique identifier for this ASF file. The value of this field + * should be changed every time the file is modified in any way. The value of + * this field may be set to 0 or set to be identical to the value of the + * File ID field of the Data Object and the Header + * Object. + * + * @return string + */ + public function getFileId() { return $this->_fileId; } + + /** + * Returns the time interval between each index entry in 100-nanosecond units. + * The most common value is 10000000, to indicate that the index entries are + * in 1-second intervals, though other values can be used as well. + * + * @return integer + */ + public function getIndexEntryTimeInterval() + { + return $this->_indexEntryTimeInterval; + } + + /** + * Returns the maximum Packet Count value of all Index Entries. + * + * @return integer + */ + public function getMaximumPacketCount() { return $this->_maximumPacketCount; } + + /** + * Returns an array of index entries. Each entry consists of the following + * keys. + * + * o packetNumber -- Specifies the number of the Data Packet associated + * with this index entry. Note that for video streams that contain both + * key frames and non-key frames, this field will always point to the + * closest key frame prior to the time interval. + * + * o packetCount -- Specifies the number of Data Packets to send at + * this index entry. If a video key frame has been fragmented into two + * Data Packets, the value of this field will be equal to 2. + * + * @return Array + */ + public function getIndexEntries() { return $this->_indexEntries; } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/StreamBitrateProperties.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/StreamBitrateProperties.php new file mode 100644 index 0000000..98fd037 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/StreamBitrateProperties.php @@ -0,0 +1,93 @@ +Stream Bitrate Properties Object defines the average bit rate of + * each digital media stream. + * + * @package php-reader + * @subpackage ASF + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 108 $ + */ +final class ASF_Object_StreamBitrateProperties extends ASF_Object +{ + /** @var Array */ + private $_bitrateRecords = array(); + + /** + * Constructs the class with given parameters and reads object related data + * from the ASF file. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $bitrateRecordsCount = $this->_reader->readUInt16LE(); + for ($i = 0; $i < $bitrateRecordsCount; $i++) + $this->_bitrateRecords[] = array + ("streamNumber" => ($tmp = $this->_reader->readInt16LE()) & 0x1f, + "flags" => $tmp >> 5, + "averageBitrate" => $this->_reader->readUInt32LE()); + } + + /** + * Returns an array of bitrate records. Each record consists of the following + * keys. + * + * o streamNumber -- Specifies the number of this stream described by this + * record. 0 is an invalid stream. Valid values are between 1 and 127. + * + * o flags -- These bits are reserved and should be set to 0. + * + * o averageBitrate -- Specifies the average bit rate of the stream in bits + * per second. This value should include an estimate of ASF packet and + * payload overhead associated with this stream. + * + * @return Array + */ + public function getBitrateRecords() { return $this->_bitrateRecords; } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/StreamPrioritization.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/StreamPrioritization.php new file mode 100644 index 0000000..e5f1bf5 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/StreamPrioritization.php @@ -0,0 +1,99 @@ +Stream Prioritization Object indicates the author's intentions as + * to which streams should or should not be dropped in response to varying + * network congestion situations. There may be special cases where this + * preferential order may be ignored (for example, the user hits the "mute" + * button). Generally it is expected that implementations will try to honor the + * author's preference. + * + * The priority of each stream is indicated by how early in the list that + * stream's stream number is listed (in other words, the list is ordered in + * terms of decreasing priority). + * + * The Mandatory flag field shall be set if the author wants that stream kept + * "regardless". If this flag is not set, then that indicates that the stream + * should be dropped in response to network congestion situations. Non-mandatory + * streams must never be assigned a higher priority than mandatory streams. + * + * @package php-reader + * @subpackage ASF + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 108 $ + */ +final class ASF_Object_StreamPrioritization extends ASF_Object +{ + /** @var Array */ + private $_priorityRecords = array(); + + /** + * Constructs the class with given parameters and reads object related data + * from the ASF file. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + $priorityRecordCount = $this->_reader->readUInt16LE(); + for ($i = 0; $i < $priorityRecordCount; $i++) + $this->_priorityRecords[] = array + ("streamNumber" => $this->_reader->readUInt16LE(), + "flags" => $this->_reader->readUInt16LE()); + } + + /** + * Returns an array of records. Each record consists of the following keys. + * + * o streamNumber -- Specifies the stream number. Valid values are between + * 1 and 127. + * + * o flags -- Specifies the flags. The mandatory flag is the bit 1 (LSB). + * + * @return Array + */ + public function getPriorityRecords() { return $this->_priorityRecords; } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/StreamProperties.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/StreamProperties.php new file mode 100644 index 0000000..8c42d57 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/StreamProperties.php @@ -0,0 +1,288 @@ +Stream Properties Object defines the specific properties and + * characteristics of a digital media stream. This object defines how a digital + * media stream within the Data Object is interpreted, as well as the + * specific format (of elements) of the Data Packet itself. + * + * Whereas every stream in an ASF presentation, including each stream in a + * mutual exclusion relationship, must be represented by a Stream Properties + * Object, in certain cases, this object might be found embedded in the + * Extended Stream Properties Object. + * + * @package php-reader + * @subpackage ASF + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 102 $ + */ +final class ASF_Object_StreamProperties extends ASF_Object +{ + /** + * Indicates, if set, that the data contained in this stream is encrypted and + * will be unreadable unless there is a way to decrypt the stream. + */ + const ENCRYPTED_CONTENT = 0x8000; + + const AUDIO_MEDIA = "f8699e40-5b4d-11cf-a8fd-00805f5c442b"; + const VIDEO_MEDIA = "bc19efc0-5b4d-11cf-a8fd-00805f5c442b"; + const COMMAND_MEDIA = "59dacfc0-59e6-11d0-a3ac-00a0c90348f6"; + const JFIF_MEDIA = "b61be100-5b4e-11cf-a8fD-00805f5c442b"; + const DEGRADABLE_JPEG_MEDIA = "35907dE0-e415-11cf-a917-00805f5c442b"; + const FILE_TRANSFER_MEDIA = "91bd222c-f21c-497a-8b6d-5aa86bfc0185"; + const BINARY_MEDIA = "3afb65e2-47ef-40f2-ac2c-70a90d71d343"; + + const NO_ERROR_CORRECTION = "20fb5700-5b55-11cf-a8fd-00805f5c442b"; + const AUDIO_SPREAD = "bfc3cd50-618f-11cf-8bb2-00aa00b4e220"; + + /** @var string */ + private $_streamType; + + /** @var string */ + private $_errorCorrectionType; + + /** @var integer */ + private $_timeOffset; + + /** @var integer */ + private $_flags; + + /** @var Array */ + private $_typeSpecificData = array(); + + /** @var Array */ + private $_errorCorrectionData = array(); + + /** + * Constructs the class with given parameters and reads object related data + * from the ASF file. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $this->_streamType = $this->_reader->readGUID(); + $this->_errorCorrectionType = $this->_reader->readGUID(); + $this->_timeOffset = $this->_reader->readInt64LE(); + $typeSpecificDataLength = $this->_reader->readUInt32LE(); + $errorCorrectionDataLength = $this->_reader->readUInt32LE(); + $this->_flags = $this->_reader->readUInt16LE(); + $this->_reader->skip(4); + switch ($this->_streamType) { + case self::AUDIO_MEDIA: + $this->_typeSpecificData = array + ("codecId" => $this->_reader->readUInt16LE(), + "numberOfChannels" => $this->_reader->readUInt16LE(), + "samplesPerSecond" => $this->_reader->readUInt32LE(), + "avgNumBytesPerSecond" => $this->_reader->readUInt32LE(), + "blockAlignment" => $this->_reader->readUInt16LE(), + "bitsPerSample" => $this->_reader->readUInt16LE()); + $codecSpecificDataSize = $this->_reader->readUInt16LE(); + $this->_typeSpecificData["codecSpecificData"] = + $this->_reader->read($codecSpecificDataSize); + break; + case self::VIDEO_MEDIA: + $this->_typeSpecificData = array + ("encodedImageWidth" => $this->_reader->readUInt32LE(), + "encodedImageHeight" => $this->_reader->readUInt32LE(), + "reservedFlags" => $this->_reader->readInt8()); + $this->_reader->skip(2); + $formatDataSize = $this->_reader->readUInt32LE(); + $this->_typeSpecificData = array_merge + ($this->_typeSpecificData, array + ("imageWidth" => $this->_reader->readUInt32LE(), + "imageHeight" => $this->_reader->readUInt32LE(), + "reserved" => $this->_reader->readUInt16LE(), + "bitsPerPixelCount" => $this->_reader->readUInt16LE(), + "compressionId" => $this->_reader->readUInt32LE(), + "imageSize" => $this->_reader->readUInt32LE(), + "horizontalPixelsPerMeter" => $this->_reader->readUInt32LE(), + "verticalPixelsPerMeter" => $this->_reader->readUInt32LE(), + "colorsUsedCount" => $this->_reader->readUInt32LE(), + "importantColorsCount" => $this->_reader->readUInt32LE(), + "codecSpecificData" => $this->_reader->read($formatDataSize - 38))); + break; + case self::JFIF_MEDIA: + $this->_typeSpecificData = array + ("imageWidth" => $this->_reader->readUInt32LE(), + "imageHeight" => $this->_reader->readUInt32LE(), + "reserved" => $this->_reader->readUInt32LE()); + break; + case self::DEGRADABLE_JPEG_MEDIA: + $this->_typeSpecificData = array + ("imageWidth" => $this->_reader->readUInt32LE(), + "imageHeight" => $this->_reader->readUInt32LE(), + $this->_reader->readUInt16LE(), + $this->_reader->readUInt16LE(), + $this->_reader->readUInt16LE()); + $interchangeDataSize = $this->_reader->readUInt16LE(); + if ($interchangeDataSize == 0) + $interchangeDataSize++; + $this->_typeSpecificData["interchangeData"] = + $this->_reader->read($interchangeDataSize); + break; + case self::FILE_TRANSFER_MEDIA: + case self::BINARY_MEDIA: + $this->_typeSpecificData = array + ("majorMediaType" => $this->_reader->getGUID(), + "mediaSubtype" => $this->_reader->getGUID(), + "fixedSizeSamples" => $this->_reader->readUInt32LE(), + "temporalCompression" => $this->_reader->readUInt32LE(), + "sampleSize" => $this->_reader->readUInt32LE(), + "formatType" => $this->_reader->getGUID()); + $formatDataSize = $this->_reader->readUInt32LE(); + $this->_typeSpecificData["formatData"] = + $this->_reader->read($formatDataSize); + break; + case self::COMMAND_MEDIA: + default: + $this->_reader->skip($typeSpecificDataLength); + } + switch ($this->_errorCorrectionType) { + case self::AUDIO_SPREAD: + $this->_errorCorrectionData = array + ("span" => $this->_reader->readInt8(), + "virtualPacketLength" => $this->_reader->readUInt16LE(), + "virtualChunkLength" => $this->_reader->readUInt16LE()); + $silenceDataSize = $this->_reader->readUInt16LE(); + $this->_errorCorrectionData["silenceData"] = + $this->_reader->read($silenceDataSize); + break; + case self::NO_ERROR_CORRECTION: + default: + $this->_reader->skip($errorCorrectionDataLength); + } + } + + /** + * Returns the number of this stream. 0 is an invalid stream. Valid values are + * between 1 and 127. The numbers assigned to streams in an ASF presentation + * may be any combination of unique values; parsing logic must not assume that + * streams are numbered sequentially. + * + * @return integer + */ + public function getStreamNumber() { return $this->_flags & 0x3f; } + + /** + * Returns the type of the stream (for example, audio, video, and so on). + * + * @return string + */ + public function getStreamType() { return $this->_streamType; } + + /** + * Returns the error correction type used by this digital media stream. For + * streams other than audio, this value should be set to NO_ERROR_CORRECTION. + * For audio streams, this value should be set to AUDIO_SPREAD. + * + * @return string + */ + public function getErrorCorrectionType() + { + return $this->_errorCorrectionType; + } + + /** + * Returns the presentation time offset of the stream in 100-nanosecond units. + * The value of this field is added to all of the timestamps of the samples in + * the stream. This value shall be equal to the send time of the first + * interleaved packet in the data section. The value of this field is + * typically 0. It is non-zero in the case when an ASF file is edited and it + * is not possible for the editor to change the presentation times and send + * times of ASF packets. Note that if more than one stream is present in an + * ASF file the offset values of all stream properties objects must be equal. + * + * @return integer + */ + public function getTimeOffset() { return $this->_timeOffset; } + + /** + * Checks whether or not the flag is set. Returns true if the flag + * is set, false otherwise. + * + * @param integer $flag The flag to query. + * @return boolean + */ + public function hasFlag($flag) { return ($this->_flags & $flag) == $flag; } + + /** + * Returns the flags field. + * + * @return integer + */ + public function getFlags() { return $this->_flags; } + + /** + * Returns type-specific format data. The structure for the Type-Specific + * Data field is determined by the value stored in the Stream Type + * field. + * + * The type-specific data is returned as key-value pairs of an associate + * array. + * + * @return Array + */ + public function getTypeSpecificData() { return $this->_typeSpecificData; } + + /** + * Returns data specific to the error correction type. The structure for the + * Error Correction Data field is determined by the value stored in the + * Error Correction Type field. For example, an audio data stream might + * need to know how codec chunks were redistributed, or it might need a sample + * of encoded silence. + * + * The error correction type-specific data is returned as key-value pairs of + * an associate array. + * + * @return integer + */ + public function getErrorCorrectionData() + { + return $this->_errorCorrectionData; + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/TimecodeIndex.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/TimecodeIndex.php new file mode 100644 index 0000000..943a353 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/TimecodeIndex.php @@ -0,0 +1,181 @@ +Timecode Index Object + * is used, it is recommended that timecodes be stored as a Payload Extension + * System on the appropriate stream. It is also recommended that every + * timecode appearing in the ASF file have a corresponging index entry. + * + * The index is designed to be broken into blocks to facilitate storage that is + * more space-efficient by using 32-bit offsets relative to a 64-bit base. That + * is, each index block has a full 64-bit offset in the block header that is + * added to the 32-bit offsets found in each index entry. If a file is larger + * than 2^32 bytes, then multiple index blocks can be used to fully index the + * entire large file while still keeping index entry offsets at 32 bits. + * + * To locate an object with a particular timecode in an ASF file, one would + * typically look through the Timecode Index Object in blocks of the + * appropriate range and try to locate the nearest possible timecode. The + * corresponding Offset field values of the Index Entry are byte + * offsets that, when combined with the Block Position value of the Index + * Block, indicate the starting location in bytes of an ASF Data Packet relative + * to the start of the first ASF Data Packet in the file. + * + * Any ASF file containing a Timecode Index Object shall also contain a + * Timecode Index Parameters Object in its + * {@link ASF_Object_Header ASF Header}. + * + * @package php-reader + * @subpackage ASF + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 108 $ + */ +final class ASF_Object_TimecodeIndex extends ASF_Object +{ + /** + * Indicates that the index type is Nearest Past Data Packet. The Nearest + * Past Data Packet indexes point to the data packet whose presentation time + * is closest to the index entry time. + */ + const NEAREST_PAST_DATA_PACKET = 1; + + /** + * Indicates that the index type is Nearest Past Media. The Nearest Past + * Object indexes point to the closest data packet containing an entire object + * or first fragment of an object. + */ + const NEAREST_PAST_MEDIA = 2; + + /** + * Indicates that the index type is Nearest Past Cleanpoint. The Nearest Past + * Cleanpoint indexes point to the closest data packet containing an entire + * object (or first fragment of an object) that has the Cleanpoint Flag set. + * + * Nearest Past Cleanpoint is the most common type of index. + */ + const NEAREST_PAST_CLEANPOINT = 3; + + /** @var Array */ + private $_indexSpecifiers = array(); + + /** @var Array */ + private $_indexBlocks = array(); + + /** + * Constructs the class with given parameters and reads object related data + * from the ASF file. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $this->_reader->skip(4); + $indexSpecifiersCount = $this->_reader->readUInt16LE(); + $indexBlocksCount = $this->_reader->readUInt32LE(); + for ($i = 0; $i < $indexSpecifiersCount; $i++) + $this->_indexSpecifiers[] = array + ("streamNumber" => $this->_reader->readUInt16LE(), + "indexType" => $this->_reader->readUInt16LE()); + for ($i = 0; $i < $indexBlocksCount; $i++) { + $indexEntryCount = $this->_reader->readUInt32LE(); + $timecodeRange = $this->_reader->readUInt16LE(); + $blockPositions = array(); + for ($i = 0; $i < $indexSpecifiersCount; $i++) + $blockPositions[] = $this->_reader->readInt64LE(); + $indexEntries = array(); + for ($i = 0; $i < $indexEntryCount; $i++) { + $timecode = $this->_reader->readUInt32LE(); + $offsets = array(); + for ($i = 0; $i < $indexSpecifiersCount; $i++) + $offsets[] = $this->_reader->readUInt32LE(); + $indexEntries[] = array + ("timecode" => $timecode, + "offsets" => $offsets); + } + $this->_indexBlocks[] = array + ("timecodeRange" => $timecodeRange, + "blockPositions" => $blockPositions, + "indexEntries" => $indexEntries); + } + } + + /** + * Returns an array of index specifiers. Each entry consists of the following + * keys. + * + * o streamNumber -- Specifies the stream number that the Index + * Specifiers refer to. Valid values are between 1 and 127. + * + * o indexType -- Specifies the type of index. + * + * @return Array + */ + public function getIndexSpecifiers() { return $this->_indexSpecifiers; } + + /** + * Returns an array of index entries. Each entry consists of the following + * keys. + * + * o timecodeRange -- Specifies the timecode range for this block. + * Subsequent blocks must contain range numbers greater than or equal to + * this one. + * + * o blockPositions -- Specifies a list of byte offsets of the beginnings of + * the blocks relative to the beginning of the first Data Packet (for + * example, the beginning of the Data Object + 50 bytes). + * + * o indexEntries -- An array that consists of the following keys + * o timecode -- This is the 4-byte timecode for these entries. + * o offsets -- Specifies the offset. An offset value of 0xffffffff + * indicates an invalid offset value. + * + * @return Array + */ + public function getIndexBlocks() { return $this->_indexBlocks; } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/TimecodeIndexParameters.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/TimecodeIndexParameters.php new file mode 100644 index 0000000..a7a9ef8 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ASF/Object/TimecodeIndexParameters.php @@ -0,0 +1,125 @@ +Timecode Index Parameters Object supplies information about those + * streams that are actually indexed (there must be at least one stream in an + * index) by timecodes. All streams referred to in the + * {@link ASF_Object_TimecodeIndexParameters Timecode Index Parameters Object} + * must have timecode Payload Extension Systems associated with them in the + * {@link ASF_Object_ExtendedStreamProperties Extended Stream Properties + * Object}. This object shall be present in the {@link ASF_Object_Header Header + * Object} if there is a {@link ASF_Object_TimecodeIndex Timecode Index Object} + * present in the file. + * + * An Index Specifier is required for each stream that will be indexed by the + * {@link ASF_Object_TimecodeIndex Timecode Index Object}. These specifiers must + * exactly match those in the {@link ASF_Object_TimecodeIndex Timecode Index + * Object}. + * + * @package php-reader + * @subpackage ASF + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 108 $ + */ +final class ASF_Object_TimecodeIndexParameters extends ASF_Object +{ + /** @var string */ + private $_indexEntryCountInterval; + + /** @var Array */ + private $_indexSpecifiers = array(); + + /** + * Constructs the class with given parameters and reads object related data + * from the ASF file. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $this->_indexEntryCountInterval = $this->_reader->readUInt32LE(); + $indexSpecifiersCount = $this->_reader->readUInt16LE(); + for ($i = 0; $i < $indexSpecifiersCount; $i++) { + $this->_indexSpecifiers[] = array + ("streamNumber" => $this->_reader->readUInt16LE(), + "indexType" => $this->_reader->readUInt16LE()); + } + } + + /** + * Returns the interval between each index entry by the number of media + * objects. This value cannot be 0. + * + * @return integer + */ + public function getIndexEntryCountInterval() + { + return $this->_indexEntryCountInterval; + } + + /** + * Returns an array of index entries. Each entry consists of the following + * keys. + * + * o streamNumber -- Specifies the stream number that the Index Specifiers + * refer to. Valid values are between 1 and 127. + * + * o indexType -- Specifies the type of index. Values are defined as + * follows: + * 2 = Nearest Past Media Object, + * 3 = Nearest Past Cleanpoint (1 is not a valid value). + * For a video stream, The Nearest Past Media Object indexes point to the + * closest data packet containing an entire video frame or the first + * fragment of a video frame, and the Nearest Past Cleanpoint indexes + * point to the closest data packet containing an entire video frame (or + * first fragment of a video frame) that is a key frame. Nearest Past + * Media Object is the most common value. + * + * @return Array + */ + public function getIndexSpecifiers() { return $this->_indexSpecifiers; } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Encoding.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Encoding.php new file mode 100644 index 0000000..5fd8e7f --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Encoding.php @@ -0,0 +1,79 @@ +Encoding interface implies that the ID3v2 frame supports + * content encoding. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 105 $ + */ +interface ID3_Encoding +{ + /** The ISO-8859-1 encoding. */ + const ISO88591 = 0; + + /** The UTF-16 Unicode encoding with BOM. */ + const UTF16 = 1; + + /** The UTF-16LE Unicode encoding without BOM. */ + const UTF16LE = 4; + + /** The UTF-16BE Unicode encoding without BOM. */ + const UTF16BE = 2; + + /** The UTF-8 Unicode encoding. */ + const UTF8 = 3; + + /** + * Returns the text encoding. + * + * @return integer + */ + public function getEncoding(); + + /** + * Sets the text encoding. + * + * @param integer $encoding The text encoding. + */ + public function setEncoding($encoding); +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Exception.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Exception.php new file mode 100644 index 0000000..e9b2a8b --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Exception.php @@ -0,0 +1,51 @@ + + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 39 $ + */ +class ID3_Exception extends Exception +{ +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/ExtendedHeader.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/ExtendedHeader.php new file mode 100644 index 0000000..9a90bd5 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/ExtendedHeader.php @@ -0,0 +1,323 @@ + + * @author Ryan Butterfield + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 105 $ + */ +final class ID3_ExtendedHeader extends ID3_Object +{ + /** + * A flag to denote that the present tag is an update of a tag found earlier + * in the present file or stream. If frames defined as unique are found in + * the present tag, they are to override any corresponding ones found in the + * earlier tag. This flag has no corresponding data. + * + * @since ID3v2.4.0 + */ + const UPDATE = 64; + + /** + * @since ID3v2.4.0 A flag to denote that a CRC-32 data is included in the + * extended header. The CRC is calculated on all the data between the header + * and footer as indicated by the header's tag length field, minus the + * extended header. Note that this includes the padding (if there is any), but + * excludes the footer. The CRC-32 is stored as an 35 bit synchsafe integer, + * leaving the upper four bits always zeroed. + * + * @since ID3v2.3.0 The CRC is calculated before unsynchronisation on the data + * between the extended header and the padding, i.e. the frames and only the + * frames. + */ + const CRC32 = 32; + + /** + * A flag to denote whether or not the tag has restrictions applied on it. + * + * @since ID3v2.4.0 + */ + const RESTRICTED = 16; + + /** @var integer */ + private $_size; + + /** @var integer */ + private $_flags = 0; + + /** @var integer */ + private $_padding; + + /** @var integer */ + private $_crc; + + /** @var integer */ + private $_restrictions = 0; + + /** + * Constructs the class with given parameters and reads object related data + * from the ID3v2 tag. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + + if ($reader === null) + return; + + $offset = $this->_reader->getOffset(); + $this->_size = $this->_reader->readUInt32BE(); + + /* ID3v2.3.0 ExtendedHeader */ + if ($this->getOption("version", 4) < 4) { + if ($this->_reader->readUInt16BE() == 0x8000) + $this->_flags = self::CRC32; + $this->_padding = $this->_reader->readUInt32BE(); + if ($this->hasFlag(self::CRC32)) + $this->_crc = Transform::readUInt32BE(); + } + + /* ID3v2.4.0 ExtendedHeader */ + else { + $this->_size = $this->decodeSynchsafe32($this->_size); + $this->_reader->skip(1); + $this->_flags = $this->_reader->readInt8(); + if ($this->hasFlag(self::UPDATE)) + $this->_reader->skip(1); + if ($this->hasFlag(self::CRC32)) { + $this->_reader->skip(1); + $this->_crc = + Transform::fromInt8($this->_reader->read(1)) * (0xfffffff + 1) + + decodeSynchsafe32(Transform::fromUInt32BE($this->_reader->read(4))); + } + if ($this->hasFlag(self::RESTRICTED)) { + $this->_reader->skip(1); + $this->_restrictions = $this->_reader->readInt8(1); + } + } + } + + /** + * Returns the extended header size in bytes. + * + * @return integer + */ + public function getSize() { return $this->_size; } + + /** + * Checks whether or not the flag is set. Returns true if the flag + * is set, false otherwise. + * + * @param integer $flag The flag to query. + * @return boolean + */ + public function hasFlag($flag) { return ($this->_flags & $flag) == $flag; } + + /** + * Returns the flags byte. + * + * @return integer + */ + public function getFlags($flags) { return $this->_flags; } + + /** + * Sets the flags byte. + * + * @param integer $flags The flags byte. + */ + public function setFlags($flags) { $this->_flags = $flags; } + + /** + * Returns the CRC-32 data. + * + * @return integer + */ + public function getCrc() + { + if ($this->hasFlag(self::CRC32)) + return $this->_crc; + return false; + } + + /** + * Sets whether the CRC-32 should be generated upon tag write. + * + * @param boolean $useCrc Whether CRC-32 should be generated. + */ + public function useCrc($useCrc) + { + if ($useCrc) + $this->setFlags($this->getFlags() | self::CRC32); + else + $this->setFlags($this->getFlags() & ~self::CRC32); + } + + /** + * Sets the CRC-32. The CRC-32 value is calculated of all the frames in the + * tag and includes padding. + * + * @param integer $crc The 32-bit CRC value. + */ + public function setCrc($crc) + { + if (is_bool($crc)) + $this->useCrc($crc); + else + $this->_crc = $crc; + } + + /** + * Returns the restrictions. For some applications it might be desired to + * restrict a tag in more ways than imposed by the ID3v2 specification. Note + * that the presence of these restrictions does not affect how the tag is + * decoded, merely how it was restricted before encoding. If this flag is set + * the tag is restricted as follows: + * + *
+   * Restrictions %ppqrrstt
+   *
+   * p - Tag size restrictions
+   *
+   *   00   No more than 128 frames and 1 MB total tag size.
+   *   01   No more than 64 frames and 128 KB total tag size.
+   *   10   No more than 32 frames and 40 KB total tag size.
+   *   11   No more than 32 frames and 4 KB total tag size.
+   *
+   * q - Text encoding restrictions
+   *
+   *   0    No restrictions
+   *   1    Strings are only encoded with ISO-8859-1 or UTF-8.
+   *
+   * r - Text fields size restrictions
+   *
+   *   00   No restrictions
+   *   01   No string is longer than 1024 characters.
+   *   10   No string is longer than 128 characters.
+   *   11   No string is longer than 30 characters.
+   *
+   *   Note that nothing is said about how many bytes is used to represent those
+   *   characters, since it is encoding dependent. If a text frame consists of
+   *   more than one string, the sum of the strungs is restricted as stated.
+   *
+   * s - Image encoding restrictions
+   *
+   *   0   No restrictions
+   *   1   Images are encoded only with PNG [PNG] or JPEG [JFIF].
+   *
+   * t - Image size restrictions
+   *
+   *   00  No restrictions
+   *   01  All images are 256x256 pixels or smaller.
+   *   10  All images are 64x64 pixels or smaller.
+   *   11  All images are exactly 64x64 pixels, unless required otherwise.
+   * 
+ * + * @return integer + */ + public function getRestrictions() { return $this->_restrictions; } + + /** + * Sets the restrictions byte. See {@link #getRestrictions} for more. + * + * @param integer $restrictions The restrictions byte. + */ + public function setRestrictions($restrictions) + { + $this->_restrictions = $restrictions; + } + + /** + * Returns the total padding size, or simply the total tag size excluding the + * frames and the headers. + * + * @return integer + * @deprecated ID3v2.3.0 + */ + public function getPadding() { return $this->_padding; } + + /** + * Sets the total padding size, or simply the total tag size excluding the + * frames and the headers. + * + * @param integer $padding The padding size. + * @deprecated ID3v2.3.0 + */ + public function setPadding($padding) { return $this->_padding = $padding; } + + /** + * Returns the header raw data. + * + * @return string + */ + public function __toString() + { + /* ID3v2.3.0 ExtendedHeader */ + if ($this->getOption("version", 4) < 4) { + return Transform::toUInt32BE($this->_size) . + Transform::toUInt16BE($this->hasFlag(self::CRC32) ? 0x8000 : 0) . + Transform::toUInt32BE($this->_padding) . + ($this->hasFlag(self::CRC32) ? Transform::toUInt32BE($this->_crc) : ""); + } + + /* ID3v2.4.0 ExtendedHeader */ + else { + return Transform::toUInt32BE($this->encodeSynchsafe32($this->_size)) . + Transform::toInt8(1) . Transform::toInt8($this->_flags) . + ($this->hasFlag(self::UPDATE) ? "\0" : "") . + ($this->hasFlag(self::CRC32) ? Transform::toInt8(5) . + Transform::toInt8($this->_crc & 0xf0000000 >> 28 & 0xf /*eq >>> 28*/) . + Transform::toUInt32BE($this->encodeSynchsafe32($this->_crc)) : "") . + ($this->hasFlag(self::RESTRICTED) ? + Transform::toInt8(1) . Transform::toInt8($this->_restrictions) : ""); + } + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame.php new file mode 100644 index 0000000..cf4a6dc --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame.php @@ -0,0 +1,295 @@ + + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 107 $ + */ +class ID3_Frame extends ID3_Object +{ + /** + * This flag tells the tag parser what to do with this frame if it is unknown + * and the tag is altered in any way. This applies to all kinds of + * alterations, including adding more padding and reordering the frames. + */ + const DISCARD_ON_TAGCHANGE = 16384; + + /** + * This flag tells the tag parser what to do with this frame if it is unknown + * and the file, excluding the tag, is altered. This does not apply when the + * audio is completely replaced with other audio data. + */ + const DISCARD_ON_FILECHANGE = 8192; + + /** + * This flag, if set, tells the software that the contents of this frame are + * intended to be read only. Changing the contents might break something, + * e.g. a signature. + */ + const READ_ONLY = 4096; + + /** + * This flag indicates whether or not this frame belongs in a group with + * other frames. If set, a group identifier byte is added to the frame. Every + * frame with the same group identifier belongs to the same group. + */ + const GROUPING_IDENTITY = 32; + + /** + * This flag indicates whether or not the frame is compressed. A Data + * Length Indicator byte is included in the frame. + * + * @see DATA_LENGTH_INDICATOR + */ + const COMPRESSION = 8; + + /** + * This flag indicates whether or not the frame is encrypted. If set, one byte + * indicating with which method it was encrypted will be added to the frame. + * See description of the {@link ID3_Frame_ENCR} frame for more information + * about encryption method registration. Encryption should be done after + * compression. Whether or not setting this flag requires the presence of a + * Data Length Indicator depends on the specific algorithm used. + * + * @see DATA_LENGTH_INDICATOR + */ + const ENCRYPTION = 4; + + /** + * This flag indicates whether or not unsynchronisation was applied to this + * frame. + * + * @since ID3v2.4.0 + */ + const UNSYNCHRONISATION = 2; + + /** + * This flag indicates that a data length indicator has been added to the + * frame. + * + * @since ID3v2.4.0 + */ + const DATA_LENGTH_INDICATOR = 1; + + /** @var integer */ + private $_identifier; + + /** @var integer */ + private $_size = 0; + + /** @var integer */ + private $_flags = 0; + + /** + * Raw content of the frame. + * + * @var string + */ + protected $_data = ""; + + /** + * Constructs the class with given parameters and reads object related data + * from the ID3v2 tag. + * + * @todo Only limited subset of flags are processed. + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + + if ($reader === null) { + $this->_identifier = substr(get_class($this), -4); + } else { + $this->_identifier = $this->_reader->readString8(4); + + /* ID3v2.3.0 size and flags; convert flags to 2.4.0 format */ + if ($this->getOption("version", 4) < 4) { + $this->_size = $this->_reader->readUInt32BE(); + $flags = $this->_reader->readUInt16BE(); + if (($flags & 0x8000) == 0x8000) + $this->_flags |= self::DISCARD_ON_TAGCHANGE; + if (($flags & 0x4000) == 0x4000) + $this->_flags |= self::DISCARD_ON_FILECHANGE; + if (($flags & 0x2000) == 0x2000) + $this->_flags |= self::READ_ONLY; + if (($flags & 0x80) == 0x80) + $this->_flags |= self::COMPRESSION; + if (($flags & 0x40) == 0x40) + $this->_flags |= self::ENCRYPTION; + if (($flags & 0x20) == 0x20) + $this->_flags |= self::GROUPING_IDENTITY; + } + + /* ID3v2.4.0 size and flags */ + else { + $this->_size = $this->decodeSynchsafe32($this->_reader->readUInt32BE()); + $this->_flags = $this->_reader->readUInt16BE(); + } + + $dataLength = $this->_size; + if ($this->hasFlag(self::DATA_LENGTH_INDICATOR)) { + $dataLength = $this->decodeSynchsafe32($this->_reader->readUInt32BE()); + $this->_size -= 4; + } + $this->_data = $this->_reader->read($this->_size); + $this->_size = $dataLength; + + if ($this->hasFlag(self::UNSYNCHRONISATION) || + $this->getOption("unsyncronisation", false) === true) + $this->_data = $this->decodeUnsynchronisation($this->_data); + } + } + + /** + * Returns the frame identifier string. + * + * @return string + */ + public function getIdentifier() { return $this->_identifier; } + + /** + * Sets the frame identifier. + * + * @param string $identifier The identifier. + */ + public function setIdentifier($identifier) + { + $this->_identifier = $identifier; + } + + /** + * Returns the size of the data in the final frame, after encryption, + * compression and unsynchronisation. The size is excluding the frame header. + * + * @return integer + */ + public function getSize() { return $this->_size; } + + /** + * Checks whether or not the flag is set. Returns true if the flag + * is set, false otherwise. + * + * @param integer $flag The flag to query. + * @return boolean + */ + public function hasFlag($flag) { return ($this->_flags & $flag) == $flag; } + + /** + * Returns the frame flags byte. + * + * @return integer + */ + public function getFlags($flags) { return $this->_flags; } + + /** + * Sets the frame flags byte. + * + * @param string $flags The flags byte. + */ + public function setFlags($flags) { $this->_flags = $flags; } + + /** + * Sets the frame raw data. + * + * @param string $data + */ + protected function setData($data) + { + $this->_data = $data; + $this->_size = strlen($data); + } + + /** + * Returns the frame raw data. + * + * @return string + */ + public function __toString() + { + /* ID3v2.3.0 Flags; convert from 2.4.0 format */ + if ($this->getOption("version", 4) < 4) { + $flags = 0; + if ($this->hasFlag(self::DISCARD_ON_TAGCHANGE)) + $flags = $flags | 0x8000; + if ($this->hasFlag(self::DISCARD_ON_FILECHANGE)) + $flags = $flags | 0x4000; + if ($this->hasFlag(self::READ_ONLY)) + $flags = $flags | 0x2000; + if ($this->hasFlag(self::COMPRESSION)) + $flags = $flags | 0x80; + if ($this->hasFlag(self::ENCRYPTION)) + $flags = $flags | 0x40; + if ($this->hasFlag(self::GROUPING_IDENTITY)) + $flags = $flags | 0x20; + } + + /* ID3v2.4.0 Flags */ + else + $flags = $this->_flags; + + $size = $this->_size; + if ($this->getOption("version", 4) < 4) + $data = $this->_data; + else { + $data = $this->encodeUnsynchronisation($this->_data); + if (($dataLength = strlen($data)) != $size) { + $size = 4 + $dataLength; + $data = Transform::toUInt32BE($this->encodeSynchsafe32($this->_size)) . + $data; + $flags |= self::DATA_LENGTH_INDICATOR | self::UNSYNCHRONISATION; + $this->setOption("unsyncronisation", true); + } + } + return Transform::toString8(substr($this->_identifier, 0, 4), 4) . + Transform::toUInt32BE($this->encodeSynchsafe32($size)) . + Transform::toUInt16BE($flags) . $data; + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/AENC.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/AENC.php new file mode 100644 index 0000000..a3971ae --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/AENC.php @@ -0,0 +1,171 @@ +Audio encryption indicates if the actual audio stream is + * encrypted, and by whom. + * + * The identifier is a URL containing an email address, or a link to a location + * where an email address can be found, that belongs to the organisation + * responsible for this specific encrypted audio file. Questions regarding the + * encrypted audio should be sent to the email address specified. There may be + * more than one AENC frame in a tag, but only one with the same owner + * identifier. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @author Ryan Butterfield + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 105 $ + */ +final class ID3_Frame_AENC extends ID3_Frame +{ + /** @var string */ + private $_owner; + + /** @var integer */ + private $_previewStart; + + /** @var integer */ + private $_previewLength; + + /** @var string */ + private $_encryptionInfo; + + /** + * Constructs the class with given parameters and parses object related data. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + + if ($reader === null) + return; + + list($this->_owner, $this->_data) = $this->explodeString8($this->_data, 2); + $this->_previewStart = Transform::fromUInt16BE(substr($this->_data, 0, 2)); + $this->_previewLength = Transform::fromUInt16BE(substr($this->_data, 2, 2)); + $this->_encryptionInfo = substr($this->_data, 4); + } + + /** + * Returns the owner identifier string. + * + * @return string + */ + public function getOwner() { return $this->_owner; } + + /** + * Sets the owner identifier string. + * + * @param string $owner The owner identifier string. + */ + public function setOwner($owner) { $this->_owner = $owner; } + + /** + * Returns the pointer to an unencrypted part of the audio in frames. + * + * @return integer + */ + public function getPreviewStart() { return $this->_previewStart; } + + /** + * Sets the pointer to an unencrypted part of the audio in frames. + * + * @param integer $previewStart The pointer to an unencrypted part. + */ + public function setPreviewStart($previewStart) + { + $this->_previewStart = $previewStart; + } + + /** + * Returns the length of the preview in frames. + * + * @return integer + */ + public function getPreviewLength() { return $this->_previewLength; } + + /** + * Sets the length of the preview in frames. + * + * @param integer $previewLength The length of the preview. + */ + public function setPreviewLength($previewLength) + { + $this->_previewLength = $previewLength; + } + + /** + * Returns the encryption info. + * + * @return string + */ + public function getEncryptionInfo() { return $this->_encryptionInfo; } + + /** + * Sets the encryption info binary string. + * + * @param string $encryptionInfo The data string. + */ + public function setEncryptionInfo($encryptionInfo) + { + $this->_encryptionInfo = $encryptionInfo; + } + + /** + * Returns the frame raw data. + * + * @return string + */ + public function __toString() + { + $this->setData + ($this->_owner . "\0" . Transform::toUInt16BE($this->_previewStart) . + Transform::toUInt16BE($this->_previewLength) . $this->_encryptionInfo); + return parent::__toString(); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/APIC.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/APIC.php new file mode 100644 index 0000000..ebd4904 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/APIC.php @@ -0,0 +1,253 @@ +Attached picture frame contains a picture directly related to the + * audio file. Image format is the MIME type and subtype for the image. + * + * There may be several pictures attached to one file, each in their individual + * APIC frame, but only one with the same content descriptor. There may only + * be one picture with the same picture type. There is the possibility to put + * only a link to the image file by using the MIME type "-->" and having a + * complete URL instead of picture data. + * + * The use of linked files should however be used sparingly since there is the + * risk of separation of files. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @author Ryan Butterfield + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 105 $ + */ +final class ID3_Frame_APIC extends ID3_Frame + implements ID3_Encoding +{ + /** + * The list of image types. + * + * @var Array + */ + public static $types = array + ("Other", "32x32 pixels file icon (PNG only)", "Other file icon", + "Cover (front)", "Cover (back)", "Leaflet page", + "Media (e.g. label side of CD)", "Lead artist/lead performer/soloist", + "Artist/performer", "Conductor", "Band/Orchestra", "Composer", + "Lyricist/text writer", "Recording Location", "During recording", + "During performance", "Movie/video screen capture", + "A bright coloured fish", "Illustration", "Band/artist logotype", + "Publisher/Studio logotype"); + + /** @var integer */ + private $_encoding = ID3_Encoding::UTF8; + + /** @var string */ + private $_mimeType = "image/unknown"; + + /** @var integer */ + private $_imageType = 0; + + /** @var string */ + private $_description; + + /** @var string */ + private $_imageData; + + /** @var integer */ + private $_imageSize = 0; + + /** + * Constructs the class with given parameters and parses object related data. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + + if ($reader === null) + return; + + $this->_encoding = Transform::fromUInt8($this->_data[0]); + $this->_mimeType = substr + ($this->_data, 1, ($pos = strpos($this->_data, "\0", 1)) - 1); + $this->_imageType = Transform::fromUInt8($this->_data[++$pos]); + $this->_data = substr($this->_data, $pos + 1); + + switch ($this->_encoding) { + case self::UTF16: + list ($this->_description, $this->_imageData) = + $this->explodeString16($this->_data, 2); + $this->_description = Transform::fromString16($this->_description); + break; + case self::UTF16BE: + list ($this->_description, $this->_imageData) = + $this->explodeString16($this->_data, 2); + $this->_description = Transform::fromString16BE($this->_description); + break; + default: + list ($this->_description, $this->_imageData) = + $this->explodeString8($this->_data, 2); + } + + $this->_imageSize = strlen($this->_imageData); + } + + /** + * Returns the text encoding. + * + * @return integer + */ + public function getEncoding() { return $this->_encoding; } + + /** + * Sets the text encoding. + * + * @see ID3_Encoding + * @param integer $encoding The text encoding. + */ + public function setEncoding($encoding) { $this->_encoding = $encoding; } + + /** + * Returns the MIME type. The MIME type is always ISO-8859-1 encoded. + * + * @return string + */ + public function getMimeType() { return $this->_mimeType; } + + /** + * Sets the MIME type. The MIME type is always ISO-8859-1 encoded. + * + * @param string $mimeType The MIME type. + */ + public function setMimeType($mimeType) { $this->_mimeType = $mimeType; } + + /** + * Returns the image type. + * + * @return integer + */ + public function getImageType() { return $this->_imageType; } + + /** + * Sets the image type code. + * + * @param integer $imageType The image type code. + */ + public function setImageType($imageType) { $this->_imageType = $imageType; } + + /** + * Returns the file description. + * + * @return string + */ + public function getDescription() { return $this->_description; } + + /** + * Sets the content description text using given encoding. + * + * @param string $description The content description text. + * @param integer $encoding The text encoding. + */ + public function setDescription($description, $encoding = false) + { + $this->_description = $description; + if ($encoding !== false) + $this->_encoding = $encoding; + } + + /** + * Returns the embedded image data. + * + * @return string + */ + public function getImageData() { return $this->_imageData; } + + /** + * Sets the embedded image data. Also updates the image size field to + * correspond the new data. + * + * @param string $imageData The image data. + */ + public function setImageData($imageData) + { + $this->_imageData = $imageData; + $this->_imageSize = strlen($imageData); + } + + /** + * Returns the size of the embedded image data. + * + * @return integer + */ + public function getImageSize() { return $this->_imageSize; } + + /** + * Returns the frame raw data. + * + * @return string + */ + public function __toString() + { + $data = Transform::toUInt8($this->_encoding) . $this->_mimeType . "\0" . + Transform::toUInt8($this->_imageType); + switch ($this->_encoding) { + case self::UTF16: + case self::UTF16LE: + $data .= Transform::toString16 + ($this->_description, $this->_encoding == self::UTF16 ? + Transform::MACHINE_ENDIAN_ORDER : Transform::LITTLE_ENDIAN_ORDER) . + "\0\0"; + break; + case self::UTF16BE: + $data .= Transform::toString16BE($this->_description) . "\0\0"; + break; + default: + $data .= $this->_description . "\0"; + } + parent::setData($data . $this->_imageData); + return parent::__toString(); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/ASPI.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/ASPI.php new file mode 100644 index 0000000..d51cc01 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/ASPI.php @@ -0,0 +1,157 @@ +Audio seek point index or + * ASPI frame makes seeking easier by providing a list a seek points within the + * audio file. The seek points are a fractional offset within the audio data, + * providing a starting point from which to find an appropriate point to start + * decoding. The presence of an ASPI frame requires the existence of a + * {@link ID3_Frame_TLEN} frame, indicating the duration of the file in + * milliseconds. There may only be one audio seek point index frame in a tag. + * + * @todo Data parsing and write support + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 75 $ + * @since ID3v2.4.0 + */ +final class ID3_Frame_ASPI extends ID3_Frame +{ + /** @var integer */ + private $_dataStart; + + /** @var integer */ + private $_dataLength; + + /** @var integer */ + private $_size; + + /** @var Array */ + private $_fractions = array(); + + /** + * Constructs the class with given parameters and parses object related data. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + + if ($reader === null) + throw new ID3_Exception("Write not supported yet"); + + $this->_dataStart = Transform::fromInt32BE(substr($this->_data, 0, 4)); + $this->_dataLength = Transform::fromInt32BE(substr($this->_data, 4, 4)); + $this->_size = Transform::fromInt16BE(substr($this->_data, 8, 2)); + + $bitsPerPoint = Transform::fromInt8($this->_data[10]); + /*for ($i = 0, $offset = 11; $i < $this->_size; $i++) { + if ($bitsPerPoint == 16) { + $this->_fractions[$i] = substr($this->_data, $offset, 2); + $offset += 2; + } else { + $this->_fractions[$i] = substr($this->_data, $offset, 1); + $offset ++; + } + }*/ + } + + /** + * Returns the byte offset from the beginning of the file. + * + * @return integer + */ + public function getDataStart() { return $this->_dataStart; } + + /** + * Sets the byte offset from the beginning of the file. + * + * @param integer $dataStart The offset. + */ + public function setDataStart($dataStart) { $this->_dataStart = $dataStart; } + + /** + * Returns the byte length of the audio data being indexed. + * + * @return integer + */ + public function getDataLength() { return $this->_dataLength; } + + /** + * Sets the byte length of the audio data being indexed. + * + * @param integer $dataLength The length. + */ + public function setDataLength($dataLength) + { + $this->_dataLength = $dataLength; + } + + /** + * Returns the number of index points in the frame. + * + * @return integer + */ + public function getSize() { return count($this->_fractions); } + + /** + * Returns the numerator of the fraction representing a relative position in + * the data or false if index not defined. The denominator is 2 + * to the power of b. + * + * @param integer $index The fraction numerator. + * @return integer + */ + public function getFractionAt($index) + { + if (isset($this->_fractions[$index])) + return $this->_fractions[$index]; + return false; + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/AbstractLink.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/AbstractLink.php new file mode 100644 index 0000000..24166cb --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/AbstractLink.php @@ -0,0 +1,96 @@ + + * @author Ryan Butterfield + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 105 $ + */ +abstract class ID3_Frame_AbstractLink extends ID3_Frame +{ + /** @var string */ + protected $_link; + + /** + * Constructs the class with given parameters and parses object related data. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + + if ($reader !== null) + $this->_link = implode($this->explodeString8($this->_data, 1), ""); + } + + /** + * Returns the link associated with the frame. + * + * @return string + */ + public function getLink() { return $this->_link; } + + /** + * Sets the link. The link encoding is always ISO-8859-1. + * + * @param string $link The link. + */ + public function setLink($link) { $this->_link = $link; } + + /** + * Returns the frame raw data. + * + * @return string + */ + public function __toString() + { + $this->setData($this->_link); + return parent::__toString(); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/AbstractText.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/AbstractText.php new file mode 100644 index 0000000..ca2081a --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/AbstractText.php @@ -0,0 +1,170 @@ + + * @author Ryan Butterfield + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 107 $ + */ +abstract class ID3_Frame_AbstractText extends ID3_Frame + implements ID3_Encoding +{ + /** + * The text encoding. + * + * @var integer + */ + protected $_encoding = ID3_Encoding::UTF8; + + /** + * The text array. + * + * @var string + */ + protected $_text; + + /** + * Constructs the class with given parameters and parses object related data. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + + if ($reader === null) + return; + + $this->_encoding = Transform::fromUInt8($this->_data[0]); + $this->_data = substr($this->_data, 1); + switch ($this->_encoding) { + case self::UTF16: + $this->_text = + $this->explodeString16(Transform::fromString16($this->_data)); + break; + case self::UTF16BE: + $this->_text = + $this->explodeString16(Transform::fromString16BE($this->_data)); + break; + default: + $this->_text = + $this->explodeString8(Transform::fromString8($this->_data)); + } + } + + /** + * Returns the text encoding. + * + * @return integer + */ + public function getEncoding() { return $this->_encoding; } + + /** + * Sets the text encoding. + * + * @see ID3_Encoding + * @param integer $encoding The text encoding. + */ + public function setEncoding($encoding) { $this->_encoding = $encoding; } + + /** + * Returns the first text chunk the frame contains. + * + * @return string + */ + public function getText() { return $this->_text[0]; } + + /** + * Returns an array of texts the frame contains. + * + * @return Array + */ + public function getTexts() { return $this->_text; } + + /** + * Sets the text using given encoding. + * + * @param mixed $text The test string or an array of strings. + * @param integer $encoding The text encoding. + */ + public function setText($text, $encoding = false) + { + $this->_text = is_array($text) ? $text : array($text); + if ($encoding !== false) + $this->_encoding = $encoding; + } + + /** + * Returns the frame raw data. + * + * @return string + */ + public function __toString() + { + $data = Transform::toUInt8($this->_encoding); + switch ($this->_encoding) { + case self::UTF16: + case self::UTF16LE: + $array = $this->_text; + foreach ($array as &$text) + $text = Transform::toString16($text); + $data .= Transform::toString16 + (implode("\0\0", $array), $this->_encoding == self::UTF16 ? + Transform::MACHINE_ENDIAN_ORDER : Transform::LITTLE_ENDIAN_ORDER); + break; + case self::UTF16BE: + $data .= Transform::toString16BE(implode("\0\0", $this->_text)); + break; + default: + $data .= implode("\0", $this->_text); + } + $this->setData($data); + return parent::__toString(); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/COMM.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/COMM.php new file mode 100644 index 0000000..8f66a41 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/COMM.php @@ -0,0 +1,228 @@ +Comments frame is intended for any kind of full text information + * that does not fit in any other frame. It consists of a frame header followed + * by encoding, language and content descriptors and is ended with the actual + * comment as a text string. Newline characters are allowed in the comment text + * string. There may be more than one comment frame in each tag, but only one + * with the same language and content descriptor. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @author Ryan Butterfield + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 105 $ + */ +final class ID3_Frame_COMM extends ID3_Frame + implements ID3_Encoding, ID3_Language +{ + /** @var integer */ + private $_encoding = ID3_Encoding::UTF8; + + /** @var string */ + private $_language = "und"; + + /** @var string */ + private $_description; + + /** @var string */ + private $_text; + + /** + * Constructs the class with given parameters and parses object related data. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + + if ($reader === null) + return; + + $this->_encoding = Transform::fromUInt8($this->_data[0]); + $this->_language = substr($this->_data, 1, 3); + if ($this->_language == "XXX") + $this->_language = "und"; + $this->_data = substr($this->_data, 4); + + switch ($this->_encoding) { + case self::UTF16: + list ($this->_description, $this->_text) = + $this->explodeString16($this->_data, 2); + $this->_description = Transform::fromString16($this->_description); + $this->_text = Transform::fromString16($this->_text); + break; + case self::UTF16BE: + list ($this->_description, $this->_text) = + $this->explodeString16($this->_data, 2); + $this->_description = Transform::fromString16BE($this->_description); + $this->_text = Transform::fromString16BE($this->_text); + break; + default: + list ($this->_description, $this->_text) = + $this->explodeString8($this->_data, 2); + $this->_description = Transform::fromString8($this->_description); + $this->_text = Transform::fromString8($this->_text); + } + } + + /** + * Returns the text encoding. + * + * @return integer + */ + public function getEncoding() { return $this->_encoding; } + + /** + * Sets the text encoding. + * + * @see ID3_Encoding + * @param integer $encoding The text encoding. + */ + public function setEncoding($encoding) { $this->_encoding = $encoding; } + + /** + * Returns the language code as specified in the + * {@link http://www.loc.gov/standards/iso639-2/ ISO-639-2} standard. + * + * @return string + */ + public function getLanguage() { return $this->_language; } + + /** + * Sets the text language code as specified in the + * {@link http://www.loc.gov/standards/iso639-2/ ISO-639-2} standard. + * + * @see ID3_Language + * @param string $language The language code. + */ + public function setLanguage($language) + { + if ($language == "XXX") + $language = "und"; + $this->_language = substr($language, 0, 3); + } + + /** + * Returns the short content description. + * + * @return string + */ + public function getDescription() { return $this->_description; } + + /** + * Sets the content description text using given encoding. The description + * language and encoding must be that of the actual text. + * + * @param string $description The content description text. + * @param string $language The language code. + * @param integer $encoding The text encoding. + */ + public function setDescription($description, $language = false, + $encoding = false) + { + $this->_description = $description; + if ($language !== false) + $this->setLanguage($language); + if ($encoding !== false) + $this->setEncoding($encoding); + } + + /** + * Returns the comment text. + * + * @return string + */ + public function getText() { return $this->_text; } + + /** + * Sets the text using given encoding. The text language and encoding must be + * that of the description text. + * + * @param mixed $text The test string. + * @param string $language The language code. + * @param integer $encoding The text encoding. + */ + public function setText($text, $language = false, $encoding = false) + { + $this->_text = $text; + if ($language !== false) + $this->setLanguage($language); + if ($encoding !== false) + $this->setEncoding($encoding); + } + + /** + * Returns the frame raw data. + * + * @return string + */ + public function __toString() + { + $data = Transform::toUInt8($this->_encoding) . $this->_language; + switch ($this->_encoding) { + case self::UTF16: + case self::UTF16LE: + $order = $this->_encoding == self::UTF16 ? + Transform::MACHINE_ENDIAN_ORDER : Transform::LITTLE_ENDIAN_ORDER; + $data .= Transform::toString16($this->_description, $order) . "\0\0" . + Transform::toString16($this->_text, $order); + break; + case self::UTF16BE: + $data .= Transform::toString16BE + ($this->_description . "\0\0" . $this->_text); + break; + default: + $data .= $this->_description . "\0" . $this->_text; + } + $this->setData($data); + return parent::__toString(); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/COMR.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/COMR.php new file mode 100644 index 0000000..bd0125b --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/COMR.php @@ -0,0 +1,373 @@ +Commercial frame enables several competing offers in the same tag + * by bundling all needed information. That makes this frame rather complex but + * it's an easier solution than if one tries to achieve the same result with + * several frames. + * + * There may be more than one commercial frame in a tag, but no two may be + * identical. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @author Ryan Butterfield + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 105 $ + */ +final class ID3_Frame_COMR extends ID3_Frame + implements ID3_Encoding +{ + /** + * The delivery types. + * + * @var Array + */ + public static $types = array + ("Other", "Standard CD album with other songs", "Compressed audio on CD", + "File over the Internet", "Stream over the Internet", "As note sheets", + "As note sheets in a book with other sheets", "Music on other media", + "Non-musical merchandise"); + + /** @var integer */ + private $_encoding = ID3_Encoding::UTF8; + + /** @var string */ + private $_currency = "EUR"; + + /** @var string */ + private $_price; + + /** @var string */ + private $_date; + + /** @var string */ + private $_contact; + + /** @var integer */ + private $_delivery = 0; + + /** @var string */ + private $_seller; + + /** @var string */ + private $_description; + + /** @var string */ + private $_mimeType = false; + + /** @var string */ + private $_imageData; + + /** @var integer */ + private $_imageSize = 0; + + /** + * Constructs the class with given parameters and parses object related data. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + + if ($reader === null) + return; + + $this->_encoding = Transform::fromUInt8($this->_data[0]); + list($pricing, $this->_data) = + $this->explodeString8(substr($this->_data, 1), 2); + $this->_currency = substr($pricing, 0, 3); + $this->_price = substr($pricing, 3); + $this->_date = substr($this->_data, 0, 8); + list($this->_contact, $this->_data) = + $this->explodeString8(substr($this->_data, 8), 2); + $this->_delivery = Transform::fromUInt8($this->_data[0]); + $this->_data = substr($this->_data, 1); + + switch ($this->_encoding) { + case self::UTF16: + list ($this->_seller, $this->_description, $this->_data) = + $this->explodeString16($this->_data, 3); + $this->_seller = Transform::fromString16($this->_seller); + $this->_description = Transform::fromString16($this->_description); + break; + case self::UTF16BE: + list ($this->_seller, $this->_description, $this->_data) = + $this->explodeString16($this->_data, 3); + $this->_seller = Transform::fromString16BE($this->_seller); + $this->_description = Transform::fromString16BE($this->_description); + break; + default: + list ($this->_seller, $this->_description, $this->_data) = + $this->explodeString8($this->_data, 3); + $this->_seller = Transform::fromString8($this->_seller); + $this->_description = Transform::fromString8($this->_description); + } + + if (strlen($this->_data) == 0) + return; + + list($this->_mimeType, $this->_imageData) = + $this->explodeString8($this->_data, 2); + + $this->_imageSize = strlen($this->_imageData); + } + + /** + * Returns the text encoding. + * + * @return integer + */ + public function getEncoding() { return $this->_encoding; } + + /** + * Sets the text encoding. + * + * @see ID3_Encoding + * @param integer $encoding The text encoding. + */ + public function setEncoding($encoding) { $this->_encoding = $encoding; } + + /** + * Returns the currency code, encoded according to + * {@link http://www.iso.org/iso/support/faqs/faqs_widely_used_standards/widely_used_standards_other/currency_codes/currency_codes_list-1.htm + * ISO 4217} alphabetic currency code. + * + * @return string + */ + public function getCurrency() { return $this->_currency; } + + /** + * Sets the currency used in transaction, encoded according to + * {@link http://www.iso.org/iso/support/faqs/faqs_widely_used_standards/widely_used_standards_other/currency_codes/currency_codes_list-1.htm + * ISO 4217} alphabetic currency code. + * + * @param string $currency The currency code. + */ + public function setCurrency($currency) { $this->_currency = $currency; } + + /** + * Returns the price as a numerical string using "." as the decimal separator. + * + * In the price string several prices may be concatenated, separated by a "/" + * character, but there may only be one currency of each type. + * + * @return string + */ + public function getPrice() { return $this->_price; } + + /** + * Sets the price. The price must use "." as the decimal separator and have + * multiple values be separated by a "/" character. + * + * @param string $price The price. + */ + public function setPrice($price) + { + $this->_price = $price; + } + + /** + * Returns the date as an 8 character date string (YYYYMMDD), describing for + * how long the price is valid. + * + * @return string + */ + public function getDate() { return $this->_date; } + + /** + * Sets the date describing for how long the price is valid for. The date must + * be an 8 character date string (YYYYMMDD). + * + * @param string $date The date string. + */ + public function setDate($date) { $this->_date = $date; } + + /** + * Returns the contact URL, with which the user can contact the seller. + * + * @return string + */ + public function getContact() { return $this->_contact; } + + /** + * Sets the contact URL, with which the user can contact the seller. + * + * @param string $contact The contact URL. + */ + public function setContact($contact) { $this->_contact = $contact; } + + /** + * Returns the delivery type with whitch the audio was delivered when bought. + * + * @return integer + */ + public function getDelivery() { return $this->_delivery; } + + /** + * Sets the delivery type with whitch the audio was delivered when bought. + * + * @param integer $delivery The delivery type code. + */ + public function setDelivery($delivery) { $this->_delivery = $delivery; } + + /** + * Returns the name of the seller. + * + * @return string + */ + public function getSeller() { return $this->_seller; } + + /** + * Sets the name of the seller using given encoding. The seller text encoding + * must be that of the description text. + * + * @param string $seller The name of the seller. + * @param integer $encoding The text encoding. + */ + public function setSeller($seller, $encoding = false) + { + $this->_seller = $seller; + if ($encoding !== false) + $this->_encoding = $encoding; + } + + /** + * Returns the short description of the product. + * + * @return string + */ + public function getDescription() { return $this->_description; } + + /** + * Sets the content description text using given encoding. The description + * encoding must be that of the seller text. + * + * @param string $description The content description text. + * @param integer $encoding The text encoding. + */ + public function setDescription($description, $encoding = false) + { + $this->_description = $description; + if ($encoding !== false) + $this->_encoding = $encoding; + } + + /** + * Returns the MIME type of the seller's company logo, if attached, or + * false otherwise. Currently only "image/png" and "image/jpeg" + * are allowed. + * + * @return string + */ + public function getMimeType() { return $this->_mimeType; } + + /** + * Sets the MIME type. Currently only "image/png" and "image/jpeg" are + * allowed. The MIME type is always ISO-8859-1 encoded. + * + * @param string $mimeType The MIME type. + */ + public function setMimeType($mimeType) { $this->_mimeType = $mimeType; } + + /** + * Returns the embedded image binary data. + * + * @return string + */ + public function getImageData() { return $this->_imageData; } + + /** + * Sets the embedded image data. Also updates the image size to correspond the + * new data. + * + * @param string $imageData The image data. + */ + public function setImageData($imageData) + { + $this->_imageData = $imageData; + $this->_imageSize = strlen($imageData); + } + + /** + * Returns the size of the embedded image data. + * + * @return integer + */ + public function getImageSize() { return $this->_imageSize; } + + /** + * Returns the frame raw data. + * + * @return string + */ + public function __toString() + { + $data = Transform::toUInt8($this->_encoding) . $this->_currency . + $this->_price . "\0" . $this->_date . $this->_contact . "\0" . + Transform::toUInt8($this->_delivery); + switch ($this->_encoding) { + case self::UTF16: + case self::UTF16LE: + $order = $this->_encoding == self::UTF16 ? + Transform::MACHINE_ENDIAN_ORDER : Transform::LITTLE_ENDIAN_ORDER; + $data .= Transform::toString16($this->_seller, $order) . "\0\0" . + Transform::toString16($this->_description, $order) . "\0\0"; + break; + case self::UTF16BE: + $data .= Transform::toString16BE + ($this->_seller . "\0\0" . $this->_description . "\0\0"); + break; + default: + $data .= $this->_seller . "\0" . $this->_description . "\0"; + } + parent::setData + ($data . ($this->_mimeType ? + $this->_mimeType . "\0" . $this->_imageData : "")); + return parent::__toString(); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/ENCR.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/ENCR.php new file mode 100644 index 0000000..881823f --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/ENCR.php @@ -0,0 +1,156 @@ +Encryption method + * registration frame. + * + * The owner identifier a URL containing an email address, or a link to a + * location where an email address can be found, that belongs to the + * organisation responsible for this specific encryption method. Questions + * regarding the encryption method should be sent to the indicated email + * address. + * + * The method symbol contains a value that is associated with this method + * throughout the whole tag, in the range $80-F0. All other values are reserved. + * The method symbol may optionally be followed by encryption specific data. + * + * There may be several ENCR frames in a tag but only one containing the same + * symbol and only one containing the same owner identifier. The method must be + * used somewhere in the tag. See {@link ID3_Frame#ENCRYPTION} for more + * information. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @author Ryan Butterfield + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 105 $ + */ +final class ID3_Frame_ENCR extends ID3_Frame +{ + /** @var string */ + private $_owner; + + /** @var integer */ + private $_method; + + /** @var string */ + private $_encryptionData; + + /** + * Constructs the class with given parameters and parses object related data. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + + if ($reader === null) + return; + + list($this->_owner, $this->_data) = $this->explodeString8($this->_data, 2); + $this->_method = Transform::fromInt8($this->_data[0]); + $this->_encryptionData = substr($this->_data, 1); + } + + /** + * Returns the owner identifier string. + * + * @return string + */ + public function getOwner() { return $this->_owner; } + + /** + * Sets the owner identifier string. + * + * @param string $owner The owner identifier string. + */ + public function setOwner($owner) { $this->_owner = $owner; } + + /** + * Returns the method symbol. + * + * @return integer + */ + public function getMethod() { return $this->_method; } + + /** + * Sets the method symbol. + * + * @param integer $method The method symbol byte. + */ + public function setMethod($method) { $this->_method = $method; } + + /** + * Returns the encryption data. + * + * @return string + */ + public function getEncryptionData() { return $this->_encryptionData; } + + /** + * Sets the encryption data. + * + * @param string $encryptionData The encryption data string. + */ + public function setEncryptionData($encryptionData) + { + $this->_encryptionData = $encryptionData; + } + + /** + * Returns the frame raw data. + * + * @return string + */ + public function __toString() + { + parent::setData + ($this->_owner . "\0" . Transform::toInt8($this->_method) . + $this->_encryptionData); + return parent::__toString(); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/EQU2.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/EQU2.php new file mode 100644 index 0000000..3721121 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/EQU2.php @@ -0,0 +1,193 @@ +Equalisation (2) is another subjective, alignment frame. It allows + * the user to predefine an equalisation curve within the audio file. There may + * be more than one EQU2 frame in each tag, but only one with the same + * identification string. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @author Ryan Butterfield + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 105 $ + * @since ID3v2.4.0 + */ +final class ID3_Frame_EQU2 extends ID3_Frame +{ + /** + * Interpolation type that defines that no interpolation is made. A jump from + * one adjustment level to another occurs in the middle between two adjustment + * points. + */ + const BAND = 0; + + /** + * Interpolation type that defines that interpolation between adjustment + * points is linear. + */ + const LINEAR = 1; + + /** @var integer */ + private $_interpolation; + + /** @var string */ + private $_device; + + /** @var Array */ + private $_adjustments; + + /** + * Constructs the class with given parameters and parses object related data. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + + if ($reader === null) + return; + + $this->_interpolation = Transform::fromInt8($this->_data[0]); + list ($this->_device, $this->_data) = + $this->explodeString8(substr($this->_data, 1), 2); + + for ($i = 0; $i < strlen($this->_data); $i += 4) + $this->_adjustments + [(int)(Transform::fromUInt16BE(substr($this->_data, $i, 2)) / 2)] = + Transform::fromInt16BE(substr($this->_data, $i + 2, 2)) / 512.0; + ksort($this->_adjustments); + } + + /** + * Returns the interpolation method. The interpolation method describes which + * method is preferred when an interpolation between the adjustment point that + * follows. + * + * @return integer + */ + public function getInterpolation() { return $this->_interpolation; } + + /** + * Sets the interpolation method. The interpolation method describes which + * method is preferred when an interpolation between the adjustment point that + * follows. + * + * @param integer $interpolation The interpolation method code. + */ + public function setInterpolation($interpolation) + { + $this->_interpolation = $interpolation; + } + + /** + * Returns the device where the adjustments should apply. + * + * @return string + */ + public function getDevice() { return $this->_device; } + + /** + * Sets the device where the adjustments should apply. + * + * @param string $device The device. + */ + public function setDevice($device) { $this->_device = $device; } + + /** + * Returns the array containing adjustments having frequencies as keys and + * their corresponding adjustments as values. + * + * Adjustment points are ordered by frequency. + * + * @return Array + */ + public function getAdjustments() { return $this->_adjustments; } + + /** + * Adds a volume adjustment setting for given frequency. The frequency can + * have a value from 0 to 32767 Hz, and the adjustment +/- 64 dB with a + * precision of 0.001953125 dB. + * + * @param integer $frequency The frequency, in hertz. + * @param integer $adjustment The adjustment, in dB. + */ + public function addAdjustment($frequency, $adjustment) + { + $this->_adjustments[$frequency] = $adjustment; + ksort($this->_adjustments); + } + + /** + * Sets the adjustments array. The array must have frequencies as keys and + * their corresponding adjustments as values. The frequency can have a value + * from 0 to 32767 Hz, and the adjustment +/- 64 dB with a precision of + * 0.001953125 dB. One frequency should only be described once in the frame. + * + * @param Array $adjustments The adjustments array. + */ + public function setAdjustments($adjustments) + { + $this->_adjustments = $adjustments; + ksort($this->_adjustments); + } + + /** + * Returns the frame raw data. + * + * @return string + */ + public function __toString() + { + $data = Transform::toInt8($this->_interpolation) . $this->_device . "\0"; + foreach ($this->_adjustments as $frequency => $adjustment) + $data .= Transform::toUInt16BE($frequency * 2) . + Transform::toInt16BE($adjustment * 512); + $this->setData($data); + return parent::__toString(); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/EQUA.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/EQUA.php new file mode 100644 index 0000000..42adab2 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/EQUA.php @@ -0,0 +1,140 @@ +Equalisation frame is another subjective, alignment frame. It + * allows the user to predefine an equalisation curve within the audio file. + * There may only be one EQUA frame in each tag. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @author Ryan Butterfield + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 105 $ + * @deprecated ID3v2.3.0 + */ +final class ID3_Frame_EQUA extends ID3_Frame +{ + /** @var Array */ + private $_adjustments; + + /** + * Constructs the class with given parameters and parses object related data. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + + if ($reader === null) + return; + + $adjustmentBits = Transform::fromInt8($this->_data[0]); + if ($adjustmentBits <= 8 || $adjustmentBits > 16) + throw new ID3_Exception + ("Unsupported adjustment bit size of: " . $adjustmentBits); + + for ($i = 1; $i < strlen($this->_data); $i += 4) { + $frequency = Transform::fromUInt16BE(substr($this->_data, $i, 2)); + $this->_adjustments[($frequency & 0x7fff)] = + ($frequency & 0x8000) == 0x8000 ? + Transform::fromUInt16BE(substr($this->_data, $i + 2, 2)) : + -Transform::fromUInt16BE(substr($this->_data, $i + 2, 2)); + } + ksort($this->_adjustments); + } + + /** + * Returns the array containing adjustments having frequencies as keys and + * their corresponding adjustments as values. + * + * @return Array + */ + public function getAdjustments() { return $this->_adjustments; } + + /** + * Adds a volume adjustment setting for given frequency. The frequency can + * have a value from 0 to 32767 Hz. + * + * @param integer $frequency The frequency, in hertz. + * @param integer $adjustment The adjustment, in dB. + */ + public function addAdjustment($frequency, $adjustment) + { + $this->_adjustments[$frequency] = $adjustment; + ksort($this->_adjustments); + } + + /** + * Sets the adjustments array. The array must have frequencies as keys and + * their corresponding adjustments as values. The frequency can have a value + * from 0 to 32767 Hz. One frequency should only be described once in the + * frame. + * + * @param Array $adjustments The adjustments array. + */ + public function setAdjustments($adjustments) + { + $this->_adjustments = $adjustments; + ksort($this->_adjustments); + } + + /** + * Returns the frame raw data. + * + * @return string + */ + public function __toString() + { + $data = Transform::toInt8(16); + foreach ($this->_adjustments as $frequency => $adjustment) + $data .= Transform::toUInt16BE + ($adjustment > 0 ? $frequency | 0x8000 : $frequency & ~0x8000) . + Transform::toUInt16BE(abs($adjustment)); + $this->setData($data); + return parent::__toString(); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/ETCO.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/ETCO.php new file mode 100644 index 0000000..14e8516 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/ETCO.php @@ -0,0 +1,168 @@ +Event timing codes allows synchronisation with key events in the + * audio. + * + * The events are an array of timestamp and type pairs. The time stamp is set to + * zero if directly at the beginning of the sound or after the previous event. + * All events are sorted in chronological order. + * + * The events $E0-EF are for user events. You might want to synchronise your + * music to something, like setting off an explosion on-stage, activating a + * screensaver etc. + * + * There may only be one ETCO frame in each tag. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @author Ryan Butterfield + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 105 $ + */ +final class ID3_Frame_ETCO extends ID3_Frame + implements ID3_Timing +{ + /** + * The list of event types. + * + * @var Array + */ + public static $types = array + ("Padding", "End of initial silence", "Intro start", "Main part start", + "Outro start", "Outro end", "Verse start","Refrain start", + "Interlude start", "Theme start", "Variation start", "Key change", + "Time change", "Momentary unwanted noise", "Sustained noise", + "Sustained noise end", "Intro end", "Main part end", "Verse end", + "Refrain end", "Theme end", "Profanity", "Profanity end", + + 0xe0 => "User event", "User event", "User event", "User event", + "User event", "User event", "User event", "User event", "User event", + "User event", "User event", "User event", "User event", "User event", + + 0xfd => "Audio end (start of silence)", "Audio file ends", + "One more byte of events follows"); + + /** @var integer */ + private $_format = ID3_Timing::MPEG_FRAMES; + + /** @var Array */ + private $_events = array(); + + /** + * Constructs the class with given parameters and parses object related data. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + + if ($reader === null) + return; + + $this->_format = Transform::fromUInt8($this->_data[0]); + for ($i = 1; $i < $this->getSize(); $i += 5) { + $this->_events[Transform::fromUInt32BE(substr($this->_data, $i + 1, 4))] = + $data = Transform::fromUInt8($this->_data[$i]); + if ($data == 0xff) + break; + } + ksort($this->_events); + } + + /** + * Returns the timing format. + * + * @return integer + */ + public function getFormat() { return $this->_format; } + + /** + * Sets the timing format. + * + * @see ID3_Timing + * @param integer $format The timing format. + */ + public function setFormat($format) { $this->_format = $format; } + + /** + * Returns the events as an associated array having the timestamps as keys and + * the event types as values. + * + * @return Array + */ + public function getEvents() { return $this->_events; } + + /** + * Sets the events using given format. The value must be an associated array + * having the timestamps as keys and the event types as values. + * + * @param Array $events The events array. + * @param integer $format The timing format. + */ + public function setEvents($events, $format = false) + { + $this->_events = $events; + if ($format !== false) + $this->_format = $format; + ksort($this->_events); + } + + /** + * Returns the frame raw data. + * + * @return string + */ + public function __toString() + { + $data = Transform::toUInt8($this->_format); + foreach ($this->_events as $timestamp => $type) + $data .= Transform::toUInt8($type) . Transform::toUInt32BE($timestamp); + $this->setData($data); + return parent::__toString(); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/GEOB.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/GEOB.php new file mode 100644 index 0000000..dbfcc84 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/GEOB.php @@ -0,0 +1,226 @@ +General encapsulated object frame any type of file can be + * encapsulated. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @author Ryan Butterfield + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 105 $ + */ +final class ID3_Frame_GEOB extends ID3_Frame + implements ID3_Encoding +{ + /** @var integer */ + private $_encoding = ID3_Encoding::UTF8; + + /** @var string */ + private $_mimeType; + + /** @var string */ + private $_filename; + + /** @var string */ + private $_description; + + /** @var string */ + private $_objectData; + + /** + * Constructs the class with given parameters and parses object related data. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + + if ($reader === null) + return; + + $this->_encoding = Transform::fromUInt8($this->_data[0]); + $this->_mimeType = substr + ($this->_data, 1, ($pos = strpos($this->_data, "\0", 1)) - 1); + $this->_data = substr($this->_data, $pos + 1); + + switch ($this->_encoding) { + case self::UTF16: + list ($this->_filename, $this->_description, $this->_objectData) = + $this->explodeString16($this->_data, 3); + $this->_filename = Transform::fromString16($this->_filename); + $this->_description = Transform::fromString16($this->_description); + break; + case self::UTF16BE: + list ($this->_filename, $this->_description, $this->_objectData) = + $this->explodeString16($this->_data, 3); + $this->_filename = Transform::fromString16BE($this->_filename); + $this->_description = Transform::fromString16BE($this->_description); + break; + default: + list ($this->_filename, $this->_description, $this->_objectData) = + $this->explodeString8($this->_data, 3); + $this->_filename = Transform::fromString8($this->_filename); + $this->_description = Transform::fromString8($this->_description); + } + } + + /** + * Returns the text encoding. + * + * @return integer + */ + public function getEncoding() { return $this->_encoding; } + + /** + * Sets the text encoding. + * + * @see ID3_Encoding + * @param integer $encoding The text encoding. + */ + public function setEncoding($encoding) { $this->_encoding = $encoding; } + + /** + * Returns the MIME type. The MIME type is always encoded with ISO-8859-1. + * + * @return string + */ + public function getMimeType() { return $this->_mimeType; } + + /** + * Sets the MIME type. The MIME type is always ISO-8859-1 encoded. + * + * @param string $mimeType The MIME type. + */ + public function setMimeType($mimeType) { $this->_mimeType = $mimeType; } + + /** + * Returns the file name. + * + * @return string + */ + public function getFilename() { return $this->_filename; } + + /** + * Sets the file name using given encoding. The file name encoding must be + * that of the description text. + * + * @param string $description The file description text. + * @param integer $encoding The text encoding. + */ + public function setFilename($filename, $encoding = false) + { + $this->_filename = $filename; + if ($encoding !== false) + $this->_encoding = $encoding; + } + + /** + * Returns the file description. + * + * @return string + */ + public function getDescription() { return $this->_description; } + + /** + * Sets the file description text using given encoding. The description + * encoding must be that of the file name. + * + * @param string $description The file description text. + * @param integer $encoding The text encoding. + */ + public function setDescription($description, $encoding = false) + { + $this->_description = $description; + if ($encoding !== false) + $this->_encoding = $encoding; + } + + /** + * Returns the embedded object binary data. + * + * @return string + */ + public function getObjectData() { return $this->_objectData; } + + /** + * Sets the embedded object binary data. + * + * @param string $objectData The object data. + */ + public function setObjectData($objectData) + { + $this->_objectData = $objectData; + } + + /** + * Returns the frame raw data. + * + * @return string + */ + public function __toString() + { + $data = Transform::toUInt8($this->_encoding) . $this->_mimeType . "\0"; + switch ($this->_encoding) { + case self::UTF16: + case self::UTF16LE: + $order = $this->_encoding == self::UTF16 ? + Transform::MACHINE_ENDIAN_ORDER : Transform::LITTLE_ENDIAN_ORDER; + $data .= Transform::toString16($this->_filename, $order) . "\0\0" . + Transform::toString16($this->_description, $order) . "\0\0"; + break; + case self::UTF16BE: + $data .= Transform::toString16BE + ($this->_filename . "\0\0" . $this->_description . "\0\0"); + break; + default: + $data .= $this->_filename . "\0" . $this->_description . "\0"; + } + $this->setData($data . $this->_objectData); + return parent::__toString(); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/GRID.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/GRID.php new file mode 100644 index 0000000..513654d --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/GRID.php @@ -0,0 +1,152 @@ +Group identification registration frame enables grouping of + * otherwise unrelated frames. This can be used when some frames are to be + * signed. To identify which frames belongs to a set of frames a group + * identifier must be registered in the tag with this frame. + * + * The owner identifier is a URL containing an email address, or a link to a + * location where an email address can be found, that belongs to the + * organisation responsible for this grouping. Questions regarding the grouping + * should be sent to the indicated email address. + * + * The group symbol contains a value that associates the frame with this group + * throughout the whole tag, in the range $80-F0. All other values are reserved. + * The group symbol may optionally be followed by some group specific data, e.g. + * a digital signature. There may be several GRID frames in a tag but only one + * containing the same symbol and only one containing the same owner identifier. + * The group symbol must be used somewhere in the tag. See + * {@link ID3_Frame#GROUPING_ownerENTITY} for more information. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @author Ryan Butterfield + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 105 $ + */ +final class ID3_Frame_GRID extends ID3_Frame +{ + /** @var string */ + private $_owner; + + /** @var integer */ + private $_group; + + /** @var string */ + private $_groupData; + + /** + * Constructs the class with given parameters and parses object related data. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + + if ($reader === null) + return; + + list($this->_owner, $this->_data) = $this->explodeString8($this->_data, 2); + $this->_group = Transform::fromUInt8($this->_data[0]); + $this->_groupData = substr($this->_data, 1); + } + + /** + * Returns the owner identifier string. + * + * @return string + */ + public function getOwner() { return $this->_owner; } + + /** + * Sets the owner identifier string. + * + * @param string $owner The owner identifier string. + */ + public function setOwner($owner) { $this->_owner = $owner; } + + /** + * Returns the group symbol. + * + * @return integer + */ + public function getGroup() { return $this->_group; } + + /** + * Sets the group symbol. + * + * @param integer $group The group symbol. + */ + public function setGroup($group) { $this->_group = $group; } + + /** + * Returns the group dependent data. + * + * @return string + */ + public function getGroupData() { return $this->_groupData; } + + /** + * Sets the group dependent data. + * + * @param string $groupData The data. + */ + public function setGroupData($groupData) { $this->_groupData = $groupData; } + + /** + * Returns the frame raw data. + * + * @return string + */ + public function __toString() + { + parent::setData + ($this->_owner . "\0" . Transform::toUInt8($this->_group) . + $this->_groupData); + return parent::__toString(); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/IPLS.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/IPLS.php new file mode 100644 index 0000000..3200a11 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/IPLS.php @@ -0,0 +1,174 @@ +Involved people list is a frame containing the names of those + * involved, and how they were involved. There may only be one IPLS frame in + * each tag. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @author Ryan Butterfield + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 105 $ + * @deprecated ID3v2.3.0 + */ +final class ID3_Frame_IPLS extends ID3_Frame + implements ID3_Encoding +{ + /** @var integer */ + private $_encoding = ID3_Encoding::UTF8; + + /** @var Array */ + private $_people = array(); + + /** + * Constructs the class with given parameters and parses object related data. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + + if ($reader === null) + return; + + $this->_encoding = Transform::fromUInt8($this->_data[0]); + $data = substr($this->_data, 1); + $order = Transform::MACHINE_ENDIAN_ORDER; + switch ($this->_encoding) { + case self::UTF16: + $data = $this->explodeString16($data); + foreach ($data as &$str) + $str = Transform::fromString16($str, $order); + break; + case self::UTF16BE: + $data = $this->explodeString16($data); + foreach ($data as &$str) + $str = Transform::fromString16BE($str); + break; + default: + $data = $this->explodeString8($data); + } + + for ($i = 0; $i < count($data) - 1; $i += 2) + $this->_people[] = array($data[$i] => @$data[$i + 1]); + } + + /** + * Returns the text encoding. + * + * @return integer + */ + public function getEncoding() { return $this->_encoding; } + + /** + * Sets the text encoding. + * + * @see ID3_Encoding + * @param integer $encoding The text encoding. + */ + public function setEncoding($encoding) { $this->_encoding = $encoding; } + + /** + * Returns the involved people list as an array. For each person, the array + * contains an entry, which too is an associate array with involvement as its + * key and involvee as its value. + * + * @return Array + */ + public function getPeople() { return $this->_people; } + + /** + * Adds a person with his involvement. + * + * @return string + */ + public function addPerson($involvement, $person) + { + $this->_people[] = array($involvement => $person); + } + + /** + * Sets the involved people list array. For each person, the array must + * contain an associate array with involvement as its key and involvee as its + * value. + * + * @param Array $people The involved people list. + */ + public function setPeople($people) { $this->_people = $people; } + + /** + * Returns the frame raw data. + * + * @return string + */ + public function __toString() + { + $data = Transform::toUInt8($this->_encoding); + $order = $this->_encoding == self::UTF16 ? + Transform::MACHINE_ENDIAN_ORDER : Transform::LITTLE_ENDIAN_ORDER; + foreach ($this->_people as $entry) { + foreach ($entry as $key => $val) { + switch ($this->_encoding) { + case self::UTF16: + case self::UTF16LE: + $data .= Transform::toString16($key, $order) . "\0\0" . + Transform::toString16($val, $order) . "\0\0"; + break; + case self::UTF16BE: + $data .= Transform::toString16BE($key . "\0\0" . $val . "\0\0"); + break; + default: + $data .= $key . "\0" . $val . "\0"; + } + } + } + $this->setData($data); + return parent::__toString(); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/LINK.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/LINK.php new file mode 100644 index 0000000..b01a9de --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/LINK.php @@ -0,0 +1,173 @@ +Linked information frame is used to keep information duplication + * as low as possible by linking information from another ID3v2 tag that might + * reside in another audio file or alone in a binary file. It is recommended + * that this method is only used when the files are stored on a CD-ROM or other + * circumstances when the risk of file separation is low. + * + * Data should be retrieved from the first tag found in the file to which this + * link points. There may be more than one LINK frame in a tag, but only one + * with the same contents. + * + * A linked frame is to be considered as part of the tag and has the same + * restrictions as if it was a physical part of the tag (i.e. only one + * {@link ID3_Frame_RVRB} frame allowed, whether it's linked or not). + * + * Frames that may be linked and need no additional data are + * {@link ID3_Frame_ASPI}, {@link ID3_Frame_ETCO}, {@link ID3_Frame_EQU2}, + * {@link ID3_Frame_MCDI}, {@link ID3_Frame_MLLT}, {@link ID3_Frame_OWNE}, + * {@link ID3_Frame_RVA2}, {@link ID3_Frame_RVRB}, {@link ID3_Frame_SYTC}, the + * text information frames (ie frames descendats of + * {@link ID3_Frame_AbstractText}) and the URL link frames (ie frames descendants + * of {@link ID3_Frame_AbstractLink}). + * + * The {@link ID3_Frame_AENC}, {@link ID3_Frame_APIC}, {@link ID3_Frame_GEOB} + * and {@link ID3_Frame_TXXX} frames may be linked with the content descriptor + * as additional ID data. + * + * The {@link ID3_Frame_USER} frame may be linked with the language field as + * additional ID data. + * + * The {@link ID3_Frame_PRIV} frame may be linked with the owner identifier as + * additional ID data. + * + * The {@link ID3_Frame_COMM}, {@link ID3_Frame_SYLT} and {@link ID3_Frame_USLT} + * frames may be linked with three bytes of language descriptor directly + * followed by a content descriptor as additional ID data. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @author Ryan Butterfield + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 105 $ + */ +final class ID3_Frame_LINK extends ID3_Frame +{ + /** @var string */ + private $_target; + + /** @var string */ + private $_url; + + /** @var string */ + private $_qualifier; + + /** + * Constructs the class with given parameters and parses object related data. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + + if ($reader === null) + return; + + $this->_target = substr($this->_data, 0, 4); + list($this->_url, $this->_qualifier) = + $this->explodeString8(substr($this->_data, 4), 2); + } + + /** + * Returns the target tag identifier. + * + * @return string + */ + public function getTarget() { return $this->_target; } + + /** + * Sets the target tag identifier. + * + * @param string $target The target tag identifier. + */ + public function setTarget($target) { $this->_target = $target; } + + /** + * Returns the target tag URL. + * + * @return string + */ + public function getUrl() { return $this->_url; } + + /** + * Sets the target tag URL. + * + * @param string $url The target URL. + */ + public function setUrl($url) { $this->_url = $url; } + + /** + * Returns the additional data to identify further the tag. + * + * @return string + */ + public function getQualifier() { return $this->_qualifier; } + + /** + * Sets the additional data to be used in tag identification. + * + * @param string $identifier The qualifier. + */ + public function setQualifier($qualifier) + { + $this->_qualifier = $qualifier; + } + + /** + * Returns the frame raw data. + * + * @return string + */ + public function __toString() + { + $this->setData + (Transform::toString8(substr($this->_target, 0, 4), 4) . + $this->_url . "\0" . $this->_qualifier); + return parent::__toString(); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/MCDI.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/MCDI.php new file mode 100644 index 0000000..d5b99c4 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/MCDI.php @@ -0,0 +1,78 @@ + + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 65 $ + */ +final class ID3_Frame_MCDI extends ID3_Frame +{ + /** + * Returns the CD TOC binary dump. + * + * @return string + */ + public function getData() { return $this->_data; } + + /** + * Sets the CD TOC binary dump. + * + * @param string $data The CD TOC binary dump string. + */ + public function setData($data) { parent::setData($data); } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/MLLT.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/MLLT.php new file mode 100644 index 0000000..05aa6a0 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/MLLT.php @@ -0,0 +1,169 @@ +MPEG location lookup table frame includes references that the + * software can use to calculate positions in the file. + * + * The MPEG frames between reference describes how much the frame counter should + * be increased for every reference. If this value is two then the first + * reference points out the second frame, the 2nd reference the 4th frame, the + * 3rd reference the 6th frame etc. In a similar way the bytes between reference + * and milliseconds between reference points out bytes and milliseconds + * respectively. + * + * Each reference consists of two parts; a certain number of bits that describes + * the difference between what is said in bytes between reference and the + * reality and a certain number of bits that describes the difference between + * what is said in milliseconds between reference and the reality. + * + * There may only be one MLLT frame in each tag. + * + * @todo Data parsing and write support + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 75 $ + */ +final class ID3_Frame_MLLT extends ID3_Frame +{ + /** @var integer */ + private $_frames; + + /** @var integer */ + private $_bytes; + + /** @var integer */ + private $_milliseconds; + + /** @var Array */ + private $_deviation = array(); + + /** + * Constructs the class with given parameters and parses object related data. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + + if ($reader === null) + throw new ID3_Exception("Write not supported yet"); + + $this->_frames = Transform::fromInt16BE(substr($this->_data, 0, 2)); + $this->_bytes = Transform::fromInt32BE(substr($this->_data, 2, 3)); + $this->_milliseconds = Transform::fromInt32BE(substr($this->_data, 5, 3)); + + $byteDevBits = Transform::fromInt8($this->_data[8]); + $millisDevBits = Transform::fromInt8($this->_data[9]); + + // $data = substr($this->_data, 10); + } + + /** + * Returns the number of MPEG frames between reference. + * + * @return integer + */ + public function getFrames() { return $this->_frames; } + + /** + * Sets the number of MPEG frames between reference. + * + * @param integer $frames The number of MPEG frames. + */ + public function setFrames($frames) { $this->_frames = $frames; } + + /** + * Returns the number of bytes between reference. + * + * @return integer + */ + public function getBytes() { return $this->_bytes; } + + /** + * Sets the number of bytes between reference. + * + * @param integer $bytes The number of bytes. + */ + public function setBytes($bytes) { $this->_bytes = $bytes; } + + /** + * Returns the number of milliseconds between references. + * + * @return integer + */ + public function getMilliseconds() { return $this->_milliseconds; } + + /** + * Sets the number of milliseconds between references. + * + * @param integer $milliseconds The number of milliseconds. + */ + public function setMilliseconds($milliseconds) + { + return $this->_milliseconds; + } + + /** + * Returns the deviations as an array. Each value is an array containing two + * values, ie the deviation in bytes, and the deviation in milliseconds, + * respectively. + * + * @return Array + */ + public function getDeviation() { return $this->_deviation; } + + /** + * Sets the deviations array. The array must consist of arrays, each of which + * having two values, the deviation in bytes, and the deviation in + * milliseconds, respectively. + * + * @param Array $deviation The deviations array. + */ + public function setDeviation($deviation) { $this->_deviation = $deviation; } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/OWNE.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/OWNE.php new file mode 100644 index 0000000..3258f71 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/OWNE.php @@ -0,0 +1,219 @@ +Ownership frame might be used as a reminder of a made transaction + * or, if signed, as proof. Note that the {@link ID3_Frame_USER} and + * {@link ID3_Frame_TOWN} frames are good to use in conjunction with this one. + * + * There may only be one OWNE frame in a tag. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @author Ryan Butterfield + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 105 $ + */ +final class ID3_Frame_OWNE extends ID3_Frame + implements ID3_Encoding +{ + /** @var integer */ + private $_encoding = ID3_Encoding::UTF8; + + /** @var string */ + private $_currency = "EUR"; + + /** @var string */ + private $_price; + + /** @var string */ + private $_date; + + /** @var string */ + private $_seller; + + /** + * Constructs the class with given parameters and parses object related data. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + + if ($reader === null) + return; + + $this->_encoding = Transform::fromUInt8($this->_data[0]); + list($tmp, $this->_data) = + $this->explodeString8(substr($this->_data, 1), 2); + $this->_currency = substr($tmp, 0, 3); + $this->_price = substr($tmp, 3); + $this->_date = substr($this->_data, 0, 8); + $this->_data = substr($this->_data, 8); + + switch ($this->_encoding) { + case self::UTF16: + $this->_seller = Transform::fromString16($this->_data); + break; + case self::UTF16BE: + $this->_seller = Transform::fromString16BE($this->_data); + break; + default: + $this->_seller = Transform::fromString8($this->_data); + } + } + + /** + * Returns the text encoding. + * + * @return integer + */ + public function getEncoding() { return $this->_encoding; } + + /** + * Sets the text encoding. + * + * @see ID3_Encoding + * @param integer $encoding The text encoding. + */ + public function setEncoding($encoding) { $this->_encoding = $encoding; } + + /** + * Returns the currency used in transaction, encoded according to + * {@link http://www.iso.org/iso/support/faqs/faqs_widely_used_standards/widely_used_standards_other/currency_codes/currency_codes_list-1.htm + * ISO 4217} alphabetic currency code. + * + * @return string + */ + public function getCurrency() { return $this->_currency; } + + /** + * Sets the currency used in transaction, encoded according to + * {@link http://www.iso.org/iso/support/faqs/faqs_widely_used_standards/widely_used_standards_other/currency_codes/currency_codes_list-1.htm + * ISO 4217} alphabetic currency code. + * + * @param string $currency The currency code. + */ + public function setCurrency($currency) { $this->_currency = $currency; } + + /** + * Returns the price as a numerical string using "." as the decimal separator. + * + * @return string + */ + public function getPrice() { return $this->_price; } + + /** + * Sets the price. + * + * @param integer $price The price. + */ + public function setPrice($price) + { + $this->_price = number_format($price, 2, ".", ""); + } + + /** + * Returns the date of purchase as an 8 character date string (YYYYMMDD). + * + * @return string + */ + public function getDate() { return $this->_date; } + + /** + * Sets the date of purchase. The date must be an 8 character date string + * (YYYYMMDD). + * + * @param string $date The date string. + */ + public function setDate($date) { $this->_date = $date; } + + /** + * Returns the name of the seller. + * + * @return string + */ + public function getSeller() { return $this->_seller; } + + /** + * Sets the name of the seller using given encoding. + * + * @param string $seller The name of the seller. + * @param integer $encoding The text encoding. + */ + public function setSeller($seller, $encoding = false) + { + $this->_seller = $seller; + if ($encoding !== false) + $this->_encoding = $encoding; + } + + /** + * Returns the frame raw data. + * + * @return string + */ + public function __toString() + { + $data = Transform::toUInt8($this->_encoding) . $this->_currency . + $this->_price . "\0" . $this->_date; + switch ($this->_encoding) { + case self::UTF16: + case self::UTF16LE: + $data .= Transform::toString16 + ($this->_seller, $this->_encoding == self::UTF16 ? + Transform::MACHINE_ENDIAN_ORDER : Transform::LITTLE_ENDIAN_ORDER); + break; + case self::UTF16BE: + $data .= Transform::toString16BE($this->_seller); + break; + default: + $data .= $this->_seller; + } + $this->setData($data); + return parent::__toString(); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/PCNT.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/PCNT.php new file mode 100644 index 0000000..aeff277 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/PCNT.php @@ -0,0 +1,111 @@ +Play counter is simply a counter of the number of times a file has + * been played. The value is increased by one every time the file begins to + * play. There may only be one PCNT frame in each tag. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @author Ryan Butterfield + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 105 $ + */ +final class ID3_Frame_PCNT extends ID3_Frame +{ + /** @var integer */ + private $_counter = 0; + + /** + * Constructs the class with given parameters and parses object related data. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + + if ($reader === null) + return; + + if (strlen($this->_data) > 4) + $this->_counter = Transform::fromInt64BE($this->_data); // UInt64 + else + $this->_counter = Transform::fromUInt32BE($this->_data); + } + + /** + * Returns the counter. + * + * @return integer + */ + public function getCounter() { return $this->_counter; } + + /** + * Adds counter by one. + */ + public function addCounter() { $this->_counter++; } + + /** + * Sets the counter value. + * + * @param integer $counter The counter value. + */ + public function setCounter($counter) { $this->_counter = $counter; } + + /** + * Returns the frame raw data. + * + * @return string + */ + public function __toString() + { + $this->setData + ($this->_counter > 4294967295 ? + Transform::toInt64BE($this->_counter) : // UInt64 + Transform::toUInt32BE($this->_counter)); + return parent::__toString(); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/POPM.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/POPM.php new file mode 100644 index 0000000..332abef --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/POPM.php @@ -0,0 +1,161 @@ +Popularimeter frame is to specify how good an audio + * file is. Many interesting applications could be found to this frame such as a + * playlist that features better audio files more often than others or it could + * be used to profile a person's taste and find other good files by comparing + * people's profiles. The frame contains the email address to the user, one + * rating byte and a four byte play counter, intended to be increased with one + * for every time the file is played. + * + * The rating is 1-255 where 1 is worst and 255 is best. 0 is unknown. If no + * personal counter is wanted it may be omitted. When the counter reaches all + * one's, one byte is inserted in front of the counter thus making the counter + * eight bits bigger in the same away as the play counter + * {@link ID3_Frame_PCNT}. There may be more than one POPM frame in each tag, + * but only one with the same email address. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @author Ryan Butterfield + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 105 $ + */ +final class ID3_Frame_POPM extends ID3_Frame +{ + /** @var string */ + private $_owner; + + /** @var integer */ + private $_rating = 0; + + /** @var integer */ + private $_counter = 0; + + /** + * Constructs the class with given parameters and parses object related data. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + + if ($reader === null) + return; + + list($this->_owner, $this->_data) = $this->explodeString8($this->_data, 2); + $this->_rating = Transform::fromUInt8($this->_data[0]); + $this->_data = substr($this->_data, 1); + + if (strlen($this->_data) > 4) + $this->_counter = Transform::fromInt64BE($this->_data); // UInt64 + else if (strlen($this->_data) > 0) + $this->_counter = Transform::fromUInt32BE($this->_data); + } + + /** + * Returns the owner identifier string. + * + * @return string + */ + public function getOwner() { return $this->_owner; } + + /** + * Sets the owner identifier string. + * + * @param string $owner The owner identifier string. + */ + public function setOwner($owner) { return $this->_owner = $owner; } + + /** + * Returns the user rating. + * + * @return integer + */ + public function getRating() { return $this->_rating; } + + /** + * Sets the user rating. + * + * @param integer $rating The user rating. + */ + public function setRating($rating) { $this->_rating = $rating; } + + /** + * Returns the counter. + * + * @return integer + */ + public function getCounter() { return $this->_counter; } + + /** + * Adds counter by one. + */ + public function addCounter() { $this->_counter++; } + + /** + * Sets the counter value. + * + * @param integer $counter The counter value. + */ + public function setCounter($counter) { $this->_counter = $counter; } + + /** + * Returns the frame raw data. + * + * @return string + */ + public function __toString() + { + $this->setData + ($this->_owner . "\0" . Transform::toInt8($this->_rating) . + ($this->_counter > 0xffffffff ? + Transform::toInt64BE($this->_counter) : + ($this->_counter > 0 ? Transform::toUInt32BE($this->_counter) : 0))); + return parent::__toString(); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/POSS.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/POSS.php new file mode 100644 index 0000000..3de3f27 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/POSS.php @@ -0,0 +1,132 @@ +Position synchronisation frame delivers information to the + * listener of how far into the audio stream he picked up; in effect, it states + * the time offset from the first frame in the stream. There may only be one + * POSS frame in each tag. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @author Ryan Butterfield + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 105 $ + */ +final class ID3_Frame_POSS extends ID3_Frame + implements ID3_Timing +{ + /** @var integer */ + private $_format = ID3_Timing::MPEG_FRAMES; + + /** @var integer */ + private $_position; + + /** + * Constructs the class with given parameters and parses object related data. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + + if ($reader === null) + return; + + $this->_format = Transform::fromUInt8($this->_data[0]); + $this->_position = Transform::fromUInt32BE(substr($this->_data, 1, 4)); + } + + /** + * Returns the timing format. + * + * @return integer + */ + public function getFormat() { return $this->_format; } + + /** + * Sets the timing format. + * + * @see ID3_Timing + * @param integer $format The timing format. + */ + public function setFormat($format) { $this->_format = $format; } + + /** + * Returns the position where in the audio the listener starts to receive, + * i.e. the beginning of the next frame. + * + * @return integer + */ + public function getPosition() { return $this->_position; } + + /** + * Sets the position where in the audio the listener starts to receive, + * i.e. the beginning of the next frame, using given format. + * + * @param integer $position The position. + * @param integer $format The timing format. + */ + public function setPosition($position, $format = false) + { + $this->_position = $position; + if ($format !== false) + $this->_format = $format; + } + + /** + * Returns the frame raw data. + * + * @return string + */ + public function __toString() + { + $this->setData + (Transform::toUInt8($this->_format) . + Transform::toUInt32BE($this->_position)); + return parent::__toString(); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/PRIV.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/PRIV.php new file mode 100644 index 0000000..4097204 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/PRIV.php @@ -0,0 +1,126 @@ +Private frame is used to contain information from a software + * producer that its program uses and does not fit into the other frames. The + * frame consists of an owner identifier string and the binary data. The owner + * identifier is URL containing an email address, or a link to a location where + * an email address can be found, that belongs to the organisation responsible + * for the frame. Questions regarding the frame should be sent to the indicated + * email address. The tag may contain more than one PRIV frame but only with + * different contents. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @author Ryan Butterfield + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 105 $ + */ +final class ID3_Frame_PRIV extends ID3_Frame +{ + /** @var string */ + private $_owner; + + /** @var string */ + private $_privateData; + + /** + * Constructs the class with given parameters and parses object related data. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + + if ($reader === null) + return; + + list($this->_owner, $this->_privateData) = + $this->explodeString8($this->_data, 2); + } + + /** + * Returns the owner identifier string. + * + * @return string + */ + public function getOwner() { return $this->_owner; } + + /** + * Sets the owner identifier string. + * + * @param string $owner The owner identifier string. + */ + public function setOwner($owner) { $this->_owner = $owner; } + + /** + * Returns the private binary data associated with the frame. + * + * @return string + */ + public function getPrivateData() { return $this->_privateData; } + + /** + * Sets the private binary data associated with the frame. + * + * @param string $privateData The private binary data string. + */ + public function setPrivateData($privateData) + { + $this->_privateData = $privateData; + } + + /** + * Returns the frame raw data. + * + * @return string + */ + public function __toString() + { + parent::setData($this->_owner . "\0" . $this->_privateData); + return parent::__toString(); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/RBUF.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/RBUF.php new file mode 100644 index 0000000..83c4cc0 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/RBUF.php @@ -0,0 +1,181 @@ +Recommended buffer size frame. If the embedded info + * flag is set then this indicates that an ID3 tag with the maximum size + * described in buffer size may occur in the audio stream. In such case the tag + * should reside between two MPEG frames, if the audio is MPEG encoded. If the + * position of the next tag is known, offset to next tag may be used. The offset + * is calculated from the end of tag in which this frame resides to the first + * byte of the header in the next. This field may be omitted. Embedded tags are + * generally not recommended since this could render unpredictable behaviour + * from present software/hardware. + * + * For applications like streaming audio it might be an idea to embed tags into + * the audio stream though. If the clients connects to individual connections + * like HTTP and there is a possibility to begin every transmission with a tag, + * then this tag should include a recommended buffer size frame. If the client + * is connected to a arbitrary point in the stream, such as radio or multicast, + * then the recommended buffer size frame should be included in every tag. + * + * The buffer size should be kept to a minimum. There may only be one RBUF + * frame in each tag. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @author Ryan Butterfield + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 105 $ + */ +final class ID3_Frame_RBUF extends ID3_Frame +{ + /** + * A flag to denote that an ID3 tag with the maximum size described in buffer + * size may occur in the audio stream. + */ + const EMBEDDED = 0x1; + + /** @var integer */ + private $_bufferSize; + + /** @var integer */ + private $_infoFlags; + + /** @var integer */ + private $_offset = 0; + + /** + * Constructs the class with given parameters and parses object related data. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + + if ($reader === null) + return; + + $this->_bufferSize = + Transform::fromUInt32BE("\0" . substr($this->_data, 0, 3)); + $this->_infoFlags = Transform::fromInt8($this->_data[3]); + if ($this->getSize() > 4) + $this->_offset = Transform::fromInt32BE(substr($this->_data, 4, 4)); + } + + /** + * Returns the buffer size. + * + * @return integer + */ + public function getBufferSize() { return $this->_bufferSize; } + + /** + * Sets the buffer size. + * + * @param integer $size The buffer size. + */ + public function setBufferSize($bufferSize) + { + $this->_bufferSize = $bufferSize; + } + + /** + * Checks whether or not the flag is set. Returns true if the flag + * is set, false otherwise. + * + * @param integer $flag The flag to query. + * @return boolean + */ + public function hasInfoFlag($flag) + { + return ($this->_infoFlags & $flag) == $flag; + } + + /** + * Returns the flags byte. + * + * @return integer + */ + public function getInfoFlags() { return $this->_infoFlags; } + + /** + * Sets the flags byte. + * + * @param string $flags The flags byte. + */ + public function setInfoFlags($infoFlags) { $this->_infoFlags = $infoFlags; } + + /** + * Returns the offset to next tag. + * + * @return integer + */ + public function getOffset() { return $this->_offset; } + + /** + * Sets the offset to next tag. + * + * @param integer $offset The offset. + */ + public function setOffset($offset) { $this->_offset = $offset; } + + /** + * Returns the frame raw data. + * + * @return string + */ + public function __toString() + { + $this->setData + (substr(Transform::toUInt32BE($this->_bufferSize), 1, 3) . + Transform::toInt8($this->_infoFlags) . + Transform::toInt32BE($this->_offset)); + return parent::__toString(); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/RVA2.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/RVA2.php new file mode 100644 index 0000000..bfdd287 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/RVA2.php @@ -0,0 +1,217 @@ +Relative volume adjustment (2) frame is a more subjective frame than + * the previous ones. It allows the user to say how much he wants to + * increase/decrease the volume on each channel when the file is played. The + * purpose is to be able to align all files to a reference volume, so that you + * don't have to change the volume constantly. This frame may also be used to + * balance adjust the audio. The volume adjustment is encoded as a fixed point + * decibel value, 16 bit signed integer representing (adjustment*512), giving + * +/- 64 dB with a precision of 0.001953125 dB. E.g. +2 dB is stored as $04 00 + * and -2 dB is $FC 00. + * + * There may be more than one RVA2 frame in each tag, but only one with the same + * identification string. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @author Ryan Butterfield + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 105 $ + * @since ID3v2.4.0 + */ +final class ID3_Frame_RVA2 extends ID3_Frame +{ + /** + * The channel type key. + * + * @see $types + * @var string + */ + const channelType = "channelType"; + + /** + * The volume adjustment key. Adjustments are +/- 64 dB with a precision of + * 0.001953125 dB. + * + * @var string + */ + const volumeAdjustment = "volumeAdjustment"; + + /** + * The peak volume key. + * + * @var string + */ + const peakVolume = "peakVolume"; + + /** + * The list of channel types. + * + * @var Array + */ + public static $types = array + ("Other", "Master volume", "Front right", "Front left", "Back right", + "Back left", "Front centre", "Back centre", "Subwoofer"); + + /** @var string */ + private $_device; + + /** @var Array */ + private $_adjustments; + + /** + * Constructs the class with given parameters and parses object related data. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + + if ($reader === null) + return; + + list ($this->_device, $this->_data) = + $this->explodeString8($this->_data, 2); + + for ($i = $j = 0; $i < 9; $i++) { + $this->_adjustments[$i] = array + (self::channelType => Transform::fromInt8($this->_data[$j++]), + self::volumeAdjustment => + Transform::fromInt16BE(substr($this->_data, $j++, 2)) / 512.0); + $j++; + $bitsInPeak = Transform::fromInt8($this->_data[$j++]); + $bytesInPeak = $bitsInPeak > 0 ? ceil($bitsInPeak / 8) : 0; + switch ($bytesInPeak) { + case 8: + case 7: + case 6: + case 5: + $this->_adjustments[$i][self::peakVolume] = + Transform::fromInt64BE(substr($this->_data, $j, $bytesInPeak)); + break; + case 4: + case 3: + $this->_adjustments[$i][self::peakVolume] = + Transform::fromUInt32BE(substr($this->_data, $j, $bytesInPeak)); + break; + case 2: + $this->_adjustments[$i][self::peakVolume] = + Transform::fromUInt16BE(substr($this->_data, $j, $bytesInPeak)); + break; + case 1: + $this->_adjustments[$i][self::peakVolume] = + Transform::fromUInt8(substr($this->_data, $j, $bytesInPeak)); + } + $j += $bytesInPeak; + } + } + + /** + * Returns the device where the adjustments should apply. + * + * @return string + */ + public function getDevice() { return $this->_device; } + + /** + * Sets the device where the adjustments should apply. + * + * @param string $device The device. + */ + public function setDevice($device) { $this->_device = $device; } + + /** + * Returns the array containing volume adjustments for each channel. Volume + * adjustments are arrays themselves containing the following keys: + * channelType, volumeAdjustment, peakVolume. + * + * @return Array + */ + public function getAdjustments() { return $this->_adjustments; } + + /** + * Sets the array of volume adjustments for each channel. Each volume + * adjustment is an array too containing the following keys: channelType, + * volumeAdjustment, peakVolume. + * + * @param Array $adjustments The volume adjustments array. + */ + public function setAdjustments($adjustments) + { + $this->_adjustments = $adjustments; + } + + /** + * Returns the frame raw data. + * + * @return string + */ + public function __toString() + { + $data = $this->_device . "\0"; + foreach ($this->_adjustments as $channel) { + $data .= Transform::toInt8($channel[self::channelType]) . + Transform::toInt16BE($channel[self::volumeAdjustment] * 512); + if (abs($channel[self::peakVolume]) <= 0xff) + $data .= Transform::toInt8(8) . + Transform::toUInt8($channel[self::peakVolume]); + else if (abs($channel[self::peakVolume]) <= 0xffff) + $data .= Transform::toInt8(16) . + Transform::toUInt16BE($channel[self::peakVolume]); + else if (abs($channel[self::peakVolume]) <= 0xffffffff) + $data .= Transform::toInt8(32) . + Transform::toUInt32BE($channel[self::peakVolume]); + else + $data .= Transform::toInt8(64) . + Transform::toInt64BE($channel[self::peakVolume]); // UInt64 + } + $this->setData($data); + return parent::__toString(); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/RVAD.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/RVAD.php new file mode 100644 index 0000000..c377aa7 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/RVAD.php @@ -0,0 +1,252 @@ +Relative volume adjustment frame is a more subjective function + * than the previous ones. It allows the user to say how much he wants to + * increase/decrease the volume on each channel while the file is played. The + * purpose is to be able to align all files to a reference volume, so that you + * don't have to change the volume constantly. This frame may also be used to + * balance adjust the audio. + * + * There may only be one RVAD frame in each tag. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @author Ryan Butterfield + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 105 $ + * @deprecated ID3v2.3.0 + */ +final class ID3_Frame_RVAD extends ID3_Frame +{ + /* The required keys. */ + + /** @var string */ + const right = "right"; + + /** @var string */ + const left = "left"; + + /** @var string */ + const peakRight = "peakRight"; + + /** @var string */ + const peakLeft = "peakLeft"; + + /* The optional keys. */ + + /** @var string */ + const rightBack = "rightBack"; + + /** @var string */ + const leftBack = "leftBack"; + + /** @var string */ + const peakRightBack = "peakRightBack"; + + /** @var string */ + const peakLeftBack = "peakLeftBack"; + + /** @var string */ + const center = "center"; + + /** @var string */ + const peakCenter = "peakCenter"; + + /** @var string */ + const bass = "bass"; + + /** @var string */ + const peakBass = "peakBass"; + + /** @var Array */ + private $_adjustments; + + /** + * Constructs the class with given parameters and parses object related data. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + + if ($reader === null) + return; + + $flags = Transform::fromInt8($this->_data[0]); + $descriptionBits = Transform::fromInt8($this->_data[1]); + if ($descriptionBits <= 8 || $descriptionBits > 16) + throw new ID3_Exception + ("Unsupported description bit size of: " . $descriptionBits); + + $this->_adjustments[self::right] = + ($flags & 0x1) == 0x1 ? + Transform::fromUInt16BE(substr($this->_data, 2, 2)) : + -Transform::fromUInt16BE(substr($this->_data, 2, 2)); + $this->_adjustments[self::left] = + ($flags & 0x2) == 0x2 ? + Transform::fromUInt16BE(substr($this->_data, 4, 2)) : + -Transform::fromUInt16BE(substr($this->_data, 4, 2)); + $this->_adjustments[self::peakRight] = + Transform::fromUInt16BE(substr($this->_data, 6, 2)); + $this->_adjustments[self::peakLeft] = + Transform::fromUInt16BE(substr($this->_data, 8, 2)); + + if ($this->getSize() <= 10) + return; + + $this->_adjustments[self::rightBack] = + ($flags & 0x4) == 0x4 ? + Transform::fromUInt16BE(substr($this->_data, 10, 2)) : + -Transform::fromUInt16BE(substr($this->_data, 10, 2)); + $this->_adjustments[self::leftBack] = + ($flags & 0x8) == 0x8 ? + Transform::fromUInt16BE(substr($this->_data, 12, 2)) : + -Transform::fromUInt16BE(substr($this->_data, 12, 2)); + $this->_adjustments[self::peakRightBack] = + Transform::fromUInt16BE(substr($this->_data, 14, 2)); + $this->_adjustments[self::peakLeftBack] = + Transform::fromUInt16BE(substr($this->_data, 16, 2)); + + if ($this->getSize() <= 18) + return; + + $this->_adjustments[self::center] = + ($flags & 0x10) == 0x10 ? + Transform::fromUInt16BE(substr($this->_data, 18, 2)) : + -Transform::fromUInt16BE(substr($this->_data, 18, 2)); + $this->_adjustments[self::peakCenter] = + Transform::fromUInt16BE(substr($this->_data, 20, 2)); + + if ($this->getSize() <= 22) + return; + + $this->_adjustments[self::bass] = + ($flags & 0x20) == 0x20 ? + Transform::fromUInt16BE(substr($this->_data, 22, 2)) : + -Transform::fromUInt16BE(substr($this->_data, 22, 2)); + $this->_adjustments[self::peakBass] = + Transform::fromUInt16BE(substr($this->_data, 24, 2)); + } + + /** + * Returns the array containing the volume adjustments. The array must contain + * the following keys: right, left, peakRight, peakLeft. It may optionally + * contain the following keys: rightBack, leftBack, peakRightBack, + * peakLeftBack, center, peakCenter, bass, and peakBass. + * + * @return Array + */ + public function getAdjustments() { return $this->_adjustments; } + + /** + * Sets the array of volume adjustments. The array must contain the following + * keys: right, left, peakRight, peakLeft. It may optionally contain the + * following keys: rightBack, leftBack, peakRightBack, peakLeftBack, center, + * peakCenter, bass, and peakBass. + * + * @param Array $adjustments The volume adjustments array. + */ + public function setAdjustments($adjustments) + { + $this->_adjustments = $adjustments; + } + + /** + * Returns the frame raw data. + * + * @return string + */ + public function __toString() + { + $flags = 0; + if ($this->_adjustments[self::right] > 0) + $flags = $flags | 0x1; + if ($this->_adjustments[self::left] > 0) + $flags = $flags | 0x2; + $data = Transform::toInt8(16) . + Transform::toUInt16BE(abs($this->_adjustments[self::right])) . + Transform::toUInt16BE(abs($this->_adjustments[self::left])) . + Transform::toUInt16BE(abs($this->_adjustments[self::peakRight])) . + Transform::toUInt16BE(abs($this->_adjustments[self::peakLeft])); + + if (isset($this->_adjustments[self::rightBack]) && + isset($this->_adjustments[self::leftBack]) && + isset($this->_adjustments[self::peakRightBack]) && + isset($this->_adjustments[self::peakLeftBack])) { + if ($this->_adjustments[self::rightBack] > 0) + $flags = $flags | 0x4; + if ($this->_adjustments[self::leftBack] > 0) + $flags = $flags | 0x8; + $data .= + Transform::toUInt16BE(abs($this->_adjustments[self::rightBack])) . + Transform::toUInt16BE(abs($this->_adjustments[self::leftBack])) . + Transform::toUInt16BE(abs($this->_adjustments[self::peakRightBack])) . + Transform::toUInt16BE(abs($this->_adjustments[self::peakLeftBack])); + } + + if (isset($this->_adjustments[self::center]) && + isset($this->_adjustments[self::peakCenter])) { + if ($this->_adjustments[self::center] > 0) + $flags = $flags | 0x10; + $data .= + Transform::toUInt16BE(abs($this->_adjustments[self::center])) . + Transform::toUInt16BE(abs($this->_adjustments[self::peakCenter])); + } + + if (isset($this->_adjustments[self::bass]) && + isset($this->_adjustments[self::peakBass])) { + if ($this->_adjustments[self::bass] > 0) + $flags = $flags | 0x20; + $data .= + Transform::toUInt16BE(abs($this->_adjustments[self::bass])) . + Transform::toUInt16BE(abs($this->_adjustments[self::peakBass])); + } + $this->setData(Transform::toInt8($flags) . $data); + return parent::__toString(); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/RVRB.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/RVRB.php new file mode 100644 index 0000000..1027ea8 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/RVRB.php @@ -0,0 +1,314 @@ +Reverb is yet another subjective frame, with which you can adjust + * echoes of different kinds. Reverb left/right is the delay between every + * bounce in milliseconds. Reverb bounces left/right is the number of bounces + * that should be made. $FF equals an infinite number of bounces. Feedback is + * the amount of volume that should be returned to the next echo bounce. $00 is + * 0%, $FF is 100%. If this value were $7F, there would be 50% volume reduction + * on the first bounce, 50% of that on the second and so on. Left to left means + * the sound from the left bounce to be played in the left speaker, while left + * to right means sound from the left bounce to be played in the right speaker. + * + * Premix left to right is the amount of left sound to be mixed in the right + * before any reverb is applied, where $00 id 0% and $FF is 100%. Premix right + * to left does the same thing, but right to left. Setting both premix to $FF + * would result in a mono output (if the reverb is applied symmetric). There may + * only be one RVRB frame in each tag. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @author Ryan Butterfield + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 105 $ + */ +final class ID3_Frame_RVRB extends ID3_Frame +{ + /** @var integer */ + private $_reverbLeft; + + /** @var integer */ + private $_reverbRight; + + /** @var integer */ + private $_reverbBouncesLeft; + + /** @var integer */ + private $_reverbBouncesRight; + + /** @var integer */ + private $_reverbFeedbackLtoL; + + /** @var integer */ + private $_reverbFeedbackLtoR; + + /** @var integer */ + private $_reverbFeedbackRtoR; + + /** @var integer */ + private $_reverbFeedbackRtoL; + + /** @var integer */ + private $_premixLtoR; + + /** @var integer */ + private $_premixRtoL; + + /** + * Constructs the class with given parameters and parses object related data. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + + if ($reader === null) + return; + + $this->_reverbLeft = Transform::fromUInt16BE(substr($this->_data, 0, 2)); + $this->_reverbRight = Transform::fromUInt16BE(substr($this->_data, 2, 2)); + $this->_reverbBouncesLeft = Transform::fromUInt8($this->_data[4]); + $this->_reverbBouncesRight = Transform::fromUInt8($this->_data[5]); + $this->_reverbFeedbackLtoL = Transform::fromUInt8($this->_data[6]); + $this->_reverbFeedbackLtoR = Transform::fromUInt8($this->_data[7]); + $this->_reverbFeedbackRtoR = Transform::fromUInt8($this->_data[8]); + $this->_reverbFeedbackRtoL = Transform::fromUInt8($this->_data[9]); + $this->_premixLtoR = Transform::fromUInt8($this->_data[10]); + $this->_premixRtoL = Transform::fromUInt8($this->_data[11]); + } + + /** + * Returns the left reverb. + * + * @return integer + */ + public function getReverbLeft() { return $this->_reverbLeft; } + + /** + * Sets the left reverb. + * + * @param integer $reverbLeft The left reverb. + */ + public function setReverbLeft($reverbLeft) + { + return $this->_reverbLeft = $reverbLeft; + } + + /** + * Returns the right reverb. + * + * @return integer + */ + public function getReverbRight() { return $this->_reverbRight; } + + /** + * Sets the right reverb. + * + * @param integer $reverbRight The right reverb. + */ + public function setReverbRight($reverbRight) + { + return $this->_reverbRight = $reverbRight; + } + + /** + * Returns the left reverb bounces. + * + * @return integer + */ + public function getReverbBouncesLeft() { return $this->_reverbBouncesLeft; } + + /** + * Sets the left reverb bounces. + * + * @param integer $reverbBouncesLeft The left reverb bounces. + */ + public function setReverbBouncesLeft($reverbBouncesLeft) + { + $this->_reverbBouncesLeft = $reverbBouncesLeft; + } + + /** + * Returns the right reverb bounces. + * + * @return integer + */ + public function getReverbBouncesRight() { return $this->_reverbBouncesRight; } + + /** + * Sets the right reverb bounces. + * + * @param integer $reverbBouncesRight The right reverb bounces. + */ + public function setReverbBouncesRight($reverbBouncesRight) + { + $this->_reverbBouncesRight = $reverbBouncesRight; + } + + /** + * Returns the left-to-left reverb feedback. + * + * @return integer + */ + public function getReverbFeedbackLtoL() { return $this->_reverbFeedbackLtoL; } + + /** + * Sets the left-to-left reverb feedback. + * + * @param integer $reverbFeedbackLtoL The left-to-left reverb feedback. + */ + public function setReverbFeedbackLtoL($reverbFeedbackLtoL) + { + $this->_reverbFeedbackLtoL = $reverbFeedbackLtoL; + } + + /** + * Returns the left-to-right reverb feedback. + * + * @return integer + */ + public function getReverbFeedbackLtoR() { return $this->_reverbFeedbackLtoR; } + + /** + * Sets the left-to-right reverb feedback. + * + * @param integer $reverbFeedbackLtoR The left-to-right reverb feedback. + */ + public function setReverbFeedbackLtoR($reverbFeedbackLtoR) + { + $this->_reverbFeedbackLtoR = $reverbFeedbackLtoR; + } + + /** + * Returns the right-to-right reverb feedback. + * + * @return integer + */ + public function getReverbFeedbackRtoR() { return $this->_reverbFeedbackRtoR; } + + /** + * Sets the right-to-right reverb feedback. + * + * @param integer $reverbFeedbackRtoR The right-to-right reverb feedback. + */ + public function setReverbFeedbackRtoR($reverbFeedbackRtoR) + { + $this->_reverbFeedbackRtoR = $reverbFeedbackRtoR; + } + + /** + * Returns the right-to-left reverb feedback. + * + * @return integer + */ + public function getReverbFeedbackRtoL() { return $this->_reverbFeedbackRtoL; } + + /** + * Sets the right-to-left reverb feedback. + * + * @param integer $reverbFeedbackRtoL The right-to-left reverb feedback. + */ + public function setReverbFeedbackRtoL($reverbFeedbackRtoL) + { + $this->_reverbFeedbackRtoL = $reverbFeedbackRtoL; + } + + /** + * Returns the left-to-right premix. + * + * @return integer + */ + public function getPremixLtoR() { return $this->_premixLtoR; } + + /** + * Sets the left-to-right premix. + * + * @param integer $premixLtoR The left-to-right premix. + */ + public function setPremixLtoR($premixLtoR) + { + $this->_premixLtoR = $premixLtoR; + } + + /** + * Returns the right-to-left premix. + * + * @return integer + */ + public function getPremixRtoL() { return $this->_premixRtoL; } + + /** + * Sets the right-to-left premix. + * + * @param integer $premixRtoL The right-to-left premix. + */ + public function setPremixRtoL($premixRtoL) + { + $this->_premixRtoL = $premixRtoL; + } + + /** + * Returns the frame raw data. + * + * @return string + */ + public function __toString() + { + $this->setData + (Transform::toUInt16BE($this->_reverbLeft) . + Transform::toUInt16BE($this->_reverbRight) . + Transform::toUInt8($this->_reverbBouncesLeft) . + Transform::toUInt8($this->_reverbBouncesRight) . + Transform::toUInt8($this->_reverbFeedbackLtoL) . + Transform::toUInt8($this->_reverbFeedbackLtoR) . + Transform::toUInt8($this->_reverbFeedbackRtoR) . + Transform::toUInt8($this->_reverbFeedbackRtoL) . + Transform::toUInt8($this->_premixLtoR) . + Transform::toUInt8($this->_premixRtoL)); + return parent::__toString(); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/SEEK.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/SEEK.php new file mode 100644 index 0000000..d211bf6 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/SEEK.php @@ -0,0 +1,104 @@ +Seek frame indicates where other tags in a file/stream can be + * found. The minimum offset to next tag is calculated from the end of this tag + * to the beginning of the next. There may only be one seek frame in a tag. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 75 $ + * @since ID3v2.4.0 + */ +final class ID3_Frame_SEEK extends ID3_Frame +{ + /** @var integer */ + private $_minOffset; + + /** + * Constructs the class with given parameters and parses object related data. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + + if ($reader === null) + return; + + $this->_minOffset = Transform::fromInt32BE($this->_data); + } + + /** + * Returns the minimum offset to next tag in bytes. + * + * @return integer + */ + public function getMinimumOffset() { return $this->_minOffset; } + + /** + * Sets the minimum offset to next tag in bytes. + * + * @param integer $minOffset The minimum offset. + */ + public function setMinimumOffset($minOffset) + { + $this->_minOffset = $minOffset; + } + + /** + * Returns the frame raw data. + * + * @return string + */ + public function __toString() + { + $this->setData(Transform::toInt32BE($this->_minOffset)); + return parent::__toString(); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/SIGN.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/SIGN.php new file mode 100644 index 0000000..ff37c63 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/SIGN.php @@ -0,0 +1,122 @@ +Group identification registration, to be signed. Although signatures + * can reside inside the registration frame, it might be desired to store the + * signature elsewhere, e.g. in watermarks. There may be more than one signature + * frame in a tag, but no two may be identical. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @author Ryan Butterfield + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 105 $ + * @since ID3v2.4.0 + */ +final class ID3_Frame_SIGN extends ID3_Frame +{ + /** @var integer */ + private $_group; + + /** @var string */ + private $_signature; + + /** + * Constructs the class with given parameters and parses object related data. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + + if ($reader === null) + return; + + $this->_group = Transform::fromUInt8(substr($this->_data, 0, 1)); + $this->_signature = substr($this->_data, 1); + } + + /** + * Returns the group symbol byte. + * + * @return integer + */ + public function getGroup() { return $this->_group; } + + /** + * Sets the group symbol byte. + * + * @param integer $group The group symbol byte. + */ + public function setGroup($group) { $this->_group = $group; } + + /** + * Returns the signature binary data. + * + * @return string + */ + public function getSignature() { return $this->_signature; } + + /** + * Sets the signature binary data. + * + * @param string $signature The signature binary data string. + */ + public function setSignature($signature) { $this->_signature = $signature; } + + /** + * Returns the frame raw data. + * + * @return string + */ + public function __toString() + { + $this->setData(Transform::toUInt8($this->_group) . $this->_signature); + return parent::__toString(); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/SYLT.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/SYLT.php new file mode 100644 index 0000000..f1995cc --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/SYLT.php @@ -0,0 +1,313 @@ +Synchronised lyrics/text frame is another way of incorporating the + * words, said or sung lyrics, in the audio file as text, this time, however, + * in sync with the audio. It might also be used to describing events e.g. + * occurring on a stage or on the screen in sync with the audio. + * + * There may be more than one SYLT frame in each tag, but only one with the + * same language and content descriptor. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @author Ryan Butterfield + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 105 $ + */ +final class ID3_Frame_SYLT extends ID3_Frame + implements ID3_Encoding, ID3_Language, ID3_Timing +{ + /** + * The list of content types. + * + * @var Array + */ + public static $types = array + ("Other", "Lyrics", "Text transcription", "Movement/Part name", "Events", + "Chord", "Trivia", "URLs to webpages", "URLs to images"); + + /** @var integer */ + private $_encoding = ID3_Encoding::UTF8; + + /** @var string */ + private $_language = "und"; + + /** @var integer */ + private $_format = ID3_Timing::MPEG_FRAMES; + + /** @var integer */ + private $_type = 0; + + /** @var string */ + private $_description; + + /** @var Array */ + private $_events = array(); + + /** + * Constructs the class with given parameters and parses object related data. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + + if ($reader === null) + return; + + $this->_encoding = Transform::fromUInt8($this->_data[0]); + $this->_language = substr($this->_data, 1, 3); + if ($this->_language == "XXX") + $this->_language = "und"; + $this->_format = Transform::fromUInt8($this->_data[4]); + $this->_type = Transform::fromUInt8($this->_data[5]); + $this->_data = substr($this->_data, 6); + + switch ($this->_encoding) { + case self::UTF16: + list($this->_description, $this->_data) = + $this->explodeString16($this->_data, 2); + $this->_description = Transform::fromString16($this->_description); + break; + case self::UTF16BE: + list($this->_description, $this->_data) = + $this->explodeString16($this->_data, 2); + $this->_description = Transform::fromString16BE($this->_description); + break; + default: + list($this->_description, $this->_data) = + $this->explodeString8($this->_data, 2); + $this->_description = Transform::fromString8($this->_description); + } + + while (strlen($this->_data) > 0) { + switch ($this->_encoding) { + case self::UTF16: + list($syllable, $this->_data) = + $this->explodeString16($this->_data, 2); + $syllable = Transform::fromString16($syllable); + break; + case self::UTF16BE: + list($syllable, $this->_data) = + $this->explodeString16($this->_data, 2); + $syllable = Transform::fromString16BE($syllable); + break; + default: + list($syllable, $this->_data) = + $this->explodeString8($this->_data, 2); + $syllable = Transform::fromString8($syllable); + } + $this->_events[Transform::fromUInt32BE(substr($this->_data, 0, 4))] = + $syllable; + $this->_data = substr($this->_data, 4); + } + ksort($this->_events); + } + + /** + * Returns the text encoding. + * + * @return integer + */ + public function getEncoding() { return $this->_encoding; } + + /** + * Sets the text encoding. + * + * @see ID3_Encoding + * @param integer $encoding The text encoding. + */ + public function setEncoding($encoding) { $this->_encoding = $encoding; } + + /** + * Returns the language code as specified in the + * {@link http://www.loc.gov/standards/iso639-2/ ISO-639-2} standard. + * + * @return string + */ + public function getLanguage() { return $this->_language; } + + /** + * Sets the text language code as specified in the + * {@link http://www.loc.gov/standards/iso639-2/ ISO-639-2} standard. + * + * @see ID3_Language + * @param string $language The language code. + */ + public function setLanguage($language) + { + if ($language == "XXX") + $language = "und"; + $this->_language = substr($language, 0, 3); + } + + /** + * Returns the timing format. + * + * @return integer + */ + public function getFormat() { return $this->_format; } + + /** + * Sets the timing format. + * + * @see ID3_Timing + * @param integer $format The timing format. + */ + public function setFormat($format) { $this->_format = $format; } + + /** + * Returns the content type code. + * + * @return integer + */ + public function getType() { return $this->_type; } + + /** + * Sets the content type code. + * + * @param integer $type The content type code. + */ + public function setType($type) { $this->_type = $type; } + + /** + * Returns the content description. + * + * @return string + */ + public function getDescription() { return $this->_description; } + + /** + * Sets the content description text using given encoding. The description + * language and encoding must be that of the actual text. + * + * @param string $description The content description text. + * @param string $language The language code. + * @param integer $encoding The text encoding. + */ + public function setDescription($description, $language = false, + $encoding = false) + { + $this->_description = $description; + if ($language !== false) + $this->setLanguage($language); + if ($encoding !== false) + $this->setEncoding($encoding); + } + + /** + * Returns the syllable events with their timestamps. + * + * @return Array + */ + public function getEvents() { return $this->_events; } + + /** + * Sets the syllable events with their timestamps using given encoding. + * The text language and encoding must be that of the description text. + * + * @param Array $text The test string. + * @param string $language The language code. + * @param integer $encoding The text encoding. + */ + public function setEvents($events, $language = false, $encoding = false) + { + $this->_events = $events; + if ($language !== false) + $this->setLanguage($language); + if ($encoding !== false) + $this->setEncoding($encoding); + ksort($this->_events); + } + + /** + * Returns the frame raw data. + * + * @return string + */ + public function __toString() + { + $data = Transform::toUInt8($this->_encoding) . $this->_language . + Transform::toUInt8($this->_format) . Transform::toUInt8($this->_type); + switch ($this->_encoding) { + case self::UTF16: + case self::UTF16LE: + $data .= Transform::toString16 + ($this->_description, $this->_encoding == self::UTF16 ? + Transform::MACHINE_ENDIAN_ORDER : Transform::LITTLE_ENDIAN_ORDER) . + "\0\0"; + break; + case self::UTF16BE: + $data .= Transform::toString16BE($this->_description) . "\0\0"; + break; + default: + $data .= $this->_description . "\0"; + } + foreach ($this->_events as $timestamp => $syllable) { + switch ($this->_encoding) { + case self::UTF16: + case self::UTF16LE: + $data .= Transform::toString16 + ($syllable, $this->_encoding == self::UTF16 ? + Transform::MACHINE_ENDIAN_ORDER : Transform::LITTLE_ENDIAN_ORDER) . + "\0\0"; + break; + case self::UTF16BE: + $data .= Transform::toString16BE($syllable) . "\0\0"; + break; + default: + $data .= $syllable . "\0"; + } + $data .= Transform::toUInt32BE($timestamp); + } + $this->setData($data); + return parent::__toString(); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/SYTC.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/SYTC.php new file mode 100644 index 0000000..5673a4e --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/SYTC.php @@ -0,0 +1,161 @@ +Synchronised tempo codes frame might be used. + * + * The tempo data consists of one or more tempo codes. Each tempo code consists + * of one tempo part and one time part. The tempo is in BPM described with one + * or two bytes. If the first byte has the value $FF, one more byte follows, + * which is added to the first giving a range from 2 - 510 BPM, since $00 and + * $01 is reserved. $00 is used to describe a beat-free time period, which is + * not the same as a music-free time period. $01 is used to indicate one single + * beat-stroke followed by a beat-free period. + * + * The tempo descriptor is followed by a time stamp. Every time the tempo in the + * music changes, a tempo descriptor may indicate this for the player. All tempo + * descriptors must be sorted in chronological order. The first beat-stroke in + * a time-period is at the same time as the beat description occurs. There may + * only be one SYTC frame in each tag. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @author Ryan Butterfield + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 107 $ + */ +final class ID3_Frame_SYTC extends ID3_Frame + implements ID3_Timing +{ + /** Describes a beat-free time period. */ + const BEAT_FREE = 0x00; + + /** Indicate one single beat-stroke followed by a beat-free period. */ + const SINGLE_BEAT = 0x01; + + /** @var integer */ + private $_format = ID3_Timing::MPEG_FRAMES; + + /** @var Array */ + private $_events = array(); + + /** + * Constructs the class with given parameters and parses object related data. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + + if ($reader === null) + return; + + $offset = 0; + $this->_format = Transform::fromUInt8($this->_data[$offset++]); + while ($offset < strlen($this->_data)) { + $tempo = Transform::fromUInt8($this->_data[$offset++]); + if ($tempo == 0xff) + $tempo += Transform::fromUInt8($this->_data[$offset++]); + $this->_events + [Transform::fromUInt32BE(substr($this->_data, $offset, 4))] = $tempo; + $offset += 4; + } + ksort($this->_events); + } + + /** + * Returns the timing format. + * + * @return integer + */ + public function getFormat() { return $this->_format; } + + /** + * Sets the timing format. + * + * @see ID3_Timing + * @param integer $format The timing format. + */ + public function setFormat($format) { $this->_format = $format; } + + /** + * Returns the time-bpm tempo events. + * + * @return Array + */ + public function getEvents() { return $this->_events; } + + /** + * Sets the time-bpm tempo events. + * + * @param Array $events The time-bpm tempo events. + */ + public function setEvents($events) + { + $this->_events = $events; + ksort($this->_events); + } + + /** + * Returns the frame raw data. + * + * @return string + */ + public function __toString() + { + $data = Transform::toUInt8($this->_format); + foreach ($this->_events as $timestamp => $tempo) { + if ($tempo >= 0xff) + $data .= Transform::toUInt8(0xff) . Transform::toUInt8($tempo - 0xff); + else + $data .= Transform::toUInt8($tempo); + $data .= Transform::toUInt32BE($timestamp); + } + parent::setData($data); + return parent::__toString(); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TALB.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TALB.php new file mode 100644 index 0000000..e3834f6 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TALB.php @@ -0,0 +1,53 @@ +Album/Movie/Show title frame is intended for the title of the + * recording (or source of sound) from which the audio in the file is taken. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 65 $ + */ +final class ID3_Frame_TALB extends ID3_Frame_AbstractText {} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TBPM.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TBPM.php new file mode 100644 index 0000000..775d55f --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TBPM.php @@ -0,0 +1,53 @@ +BPM frame contains the number of beats per minute in the main part + * of the audio. The BPM is an integer and represented as a numerical string. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 65 $ + */ +final class ID3_Frame_TBPM extends ID3_Frame_AbstractText {} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TCOM.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TCOM.php new file mode 100644 index 0000000..d5e79c8 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TCOM.php @@ -0,0 +1,52 @@ +Composer frame is intended for the name of the composer. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 65 $ + */ +final class ID3_Frame_TCOM extends ID3_Frame_AbstractText {} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TCON.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TCON.php new file mode 100644 index 0000000..41abd78 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TCON.php @@ -0,0 +1,62 @@ +Content type, which ID3v1 was stored as a one byte numeric value + * only, is now a string. You may use one or several of the ID3v1 types as + * numerical strings, or, since the category list would be impossible to + * maintain with accurate and up to date categories, define your own. + * + * You may also use any of the following keywords: + * + *
+ *  RX  Remix
+ *  CR  Cover
+ * 
+ * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 65 $ + */ +final class ID3_Frame_TCON extends ID3_Frame_AbstractText {} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TCOP.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TCOP.php new file mode 100644 index 0000000..7cbed31 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TCOP.php @@ -0,0 +1,59 @@ +Copyright message frame, in which the string must begin with a + * year and a space character (making five characters), is intended for the + * copyright holder of the original sound, not the audio file itself. The + * absence of this frame means only that the copyright information is + * unavailable or has been removed, and must not be interpreted to mean that the + * audio is public domain. Every time this field is displayed the field must be + * preceded with "Copyright " (C) " ", where (C) is one character showing a C in + * a circle. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 65 $ + */ +final class ID3_Frame_TCOP extends ID3_Frame_AbstractText {} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TDAT.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TDAT.php new file mode 100644 index 0000000..de8dda2 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TDAT.php @@ -0,0 +1,55 @@ +Date frame is a numeric string in the DDMM format containing the + * date for the recording. This field is always four characters long. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 75 $ + * @deprecated ID3v2.3.0 + */ +final class ID3_Frame_TDAT extends ID3_Frame_AbstractText {} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TDEN.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TDEN.php new file mode 100644 index 0000000..3c55b51 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TDEN.php @@ -0,0 +1,56 @@ +Encoding time frame contains a timestamp describing when the audio + * was encoded. Timestamp format is described in the + * {@link http://www.id3.org/id3v2.4.0-structure ID3v2 structure document}. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 65 $ + * @since ID3v2.4.0 + */ +final class ID3_Frame_TDEN extends ID3_Frame_AbstractText {} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TDLY.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TDLY.php new file mode 100644 index 0000000..59d2779 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TDLY.php @@ -0,0 +1,54 @@ +Playlist delay defines the numbers of milliseconds of silence that + * should be inserted before this audio. The value zero indicates that this is a + * part of a multifile audio track that should be played continuously. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 65 $ + */ +final class ID3_Frame_TDLY extends ID3_Frame_AbstractText {} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TDOR.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TDOR.php new file mode 100644 index 0000000..46a2acd --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TDOR.php @@ -0,0 +1,57 @@ +Original release time frame contains a timestamp describing when + * the original recording of the audio was released. Timestamp format is + * described in the {@link http://www.id3.org/id3v2.4.0-structure ID3v2 + * structure document}. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 65 $ + * @since ID3v2.4.0 + */ +final class ID3_Frame_TDOR extends ID3_Frame_AbstractText {} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TDRC.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TDRC.php new file mode 100644 index 0000000..fc6a871 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TDRC.php @@ -0,0 +1,56 @@ +Recording time frame contains a timestamp describing when the + * audio was recorded. Timestamp format is described in the + * {@link http://www.id3.org/id3v2.4.0-structure ID3v2 structure document}. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 65 $ + * @since ID3v2.4.0 + */ +final class ID3_Frame_TDRC extends ID3_Frame_AbstractText {} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TDRL.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TDRL.php new file mode 100644 index 0000000..b3cdddf --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TDRL.php @@ -0,0 +1,56 @@ +Release time frame contains a timestamp describing when the audio + * was first released. Timestamp format is described in the + * {@link http://www.id3.org/id3v2.4.0-structure ID3v2 structure document}. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 65 $ + * @since ID3v2.4.0 + */ +final class ID3_Frame_TDRL extends ID3_Frame_AbstractText {} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TDTG.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TDTG.php new file mode 100644 index 0000000..9e724e5 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TDTG.php @@ -0,0 +1,56 @@ +Tagging time frame contains a timestamp describing then the audio + * was tagged. Timestamp format is described in the + * {@link http://www.id3.org/id3v2.4.0-structure ID3v2 structure document}. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 65 $ + * @since ID3v2.4.0 + */ +final class ID3_Frame_TDTG extends ID3_Frame_AbstractText {} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TENC.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TENC.php new file mode 100644 index 0000000..f55becd --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TENC.php @@ -0,0 +1,54 @@ +Encoded by frame contains the name of the person or organisation + * that encoded the audio file. This field may contain a copyright message, if + * the audio file also is copyrighted by the encoder. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 65 $ + */ +final class ID3_Frame_TENC extends ID3_Frame_AbstractText {} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TEXT.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TEXT.php new file mode 100644 index 0000000..fc4cc76 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TEXT.php @@ -0,0 +1,53 @@ +Lyricist/Text writer frame is intended for the writer of the text + * or lyrics in the recording. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 65 $ + */ +final class ID3_Frame_TEXT extends ID3_Frame_AbstractText {} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TFLT.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TFLT.php new file mode 100644 index 0000000..2e7279f --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TFLT.php @@ -0,0 +1,69 @@ +File type frame indicates which type of audio this tag defines. + * The following types and refinements are defined: + * + *
+ * MIME   MIME type follows
+ *  MPG    MPEG Audio
+ *    /1     MPEG 1/2 layer I
+ *    /2     MPEG 1/2 layer II
+ *    /3     MPEG 1/2 layer III
+ *    /2.5   MPEG 2.5
+ *    /AAC   Advanced audio compression
+ *  VQF    Transform-domain Weighted Interleave Vector Quantisation
+ *  PCM    Pulse Code Modulated audio
+ * 
+ * + * but other types may be used, but not for these types though. This is used in + * a similar way to the predefined types in the {@link ID3_Frame_TMED} + * frame. If this frame is not present audio type is assumed to be MPG. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 65 $ + */ +final class ID3_Frame_TFLT extends ID3_Frame_AbstractText {} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TIME.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TIME.php new file mode 100644 index 0000000..1165986 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TIME.php @@ -0,0 +1,55 @@ +Time frame is a numeric string in the HHMM format containing the + * time for the recording. This field is always four characters long. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 75 $ + * @deprecated ID3v2.3.0 + */ +final class ID3_Frame_TIME extends ID3_Frame_AbstractText {} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TIPL.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TIPL.php new file mode 100644 index 0000000..3882383 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TIPL.php @@ -0,0 +1,55 @@ +Involved people list is very similar to the musician credits list, + * but maps between functions, like producer, and names. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 65 $ + * @since ID3v2.4.0 + */ +final class ID3_Frame_TIPL extends ID3_Frame_AbstractText {} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TIT1.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TIT1.php new file mode 100644 index 0000000..929dd75 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TIT1.php @@ -0,0 +1,54 @@ +Content group description frame is used if the sound belongs to a + * larger category of sounds/music. For example, classical music is often sorted + * in different musical sections (e.g. "Piano Concerto", "Weather - Hurricane"). + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 65 $ + */ +final class ID3_Frame_TIT1 extends ID3_Frame_AbstractText {} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TIT2.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TIT2.php new file mode 100644 index 0000000..b1128b3 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TIT2.php @@ -0,0 +1,53 @@ +Title/Songname/Content description frame is the actual name of the + * piece (e.g. "Adagio", "Hurricane Donna"). + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 65 $ + */ +final class ID3_Frame_TIT2 extends ID3_Frame_AbstractText {} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TIT3.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TIT3.php new file mode 100644 index 0000000..2b03f5a --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TIT3.php @@ -0,0 +1,54 @@ +Subtitle/Description refinement frame is used for information + * directly related to the contents title (e.g. "Op. 16" or "Performed live at + * Wembley"). + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 65 $ + */ +final class ID3_Frame_TIT3 extends ID3_Frame_AbstractText {} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TKEY.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TKEY.php new file mode 100644 index 0000000..b0cbe72 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TKEY.php @@ -0,0 +1,56 @@ +Initial key frame contains the musical key in which the sound + * starts. It is represented as a string with a maximum length of three + * characters. The ground keys are represented with "A", "B", "C", "D", "E", "F" + * and "G" and halfkeys represented with "b" and "#". Minor is represented as + * "m", e.g. "Dbm" $00. Off key is represented with an "o" only. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 65 $ + */ +final class ID3_Frame_TKEY extends ID3_Frame_AbstractText {} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TLAN.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TLAN.php new file mode 100644 index 0000000..61b07ad --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TLAN.php @@ -0,0 +1,57 @@ +Language frame should contain the languages of the text or lyrics + * spoken or sung in the audio. The language is represented with three + * characters according to {@link http://www.loc.gov/standards/iso639-2/ + * ISO-639-2}. If more than one language is used in the text their language + * codes should follow according to the amount of their usage, e.g. + * "eng" $00 "sve" $00. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 65 $ + */ +final class ID3_Frame_TLAN extends ID3_Frame_AbstractText {} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TLEN.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TLEN.php new file mode 100644 index 0000000..3ba2c2e --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TLEN.php @@ -0,0 +1,53 @@ +Length frame contains the length of the audio file in + * milliseconds, represented as a numeric string. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 65 $ + */ +final class ID3_Frame_TLEN extends ID3_Frame_AbstractText {} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TMCL.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TMCL.php new file mode 100644 index 0000000..8cf57e7 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TMCL.php @@ -0,0 +1,56 @@ +Musician credits list is intended as a mapping between instruments + * and the musician that played it. Every odd field is an instrument and every + * even is an artist or a comma delimited list of artists. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 65 $ + * @since ID3v2.4.0 + */ +final class ID3_Frame_TMCL extends ID3_Frame_AbstractText {} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TMED.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TMED.php new file mode 100644 index 0000000..ef70d69 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TMED.php @@ -0,0 +1,137 @@ +Media type frame describes from which media the sound originated. + * This may be a text string or a reference to the predefined media types found + * in the list below. Example: "VID/PAL/VHS" $00. + * + *
+ *  DIG    Other digital media
+ *    /A    Analogue transfer from media
+ *
+ *  ANA    Other analogue media
+ *    /WAC  Wax cylinder
+ *    /8CA  8-track tape cassette
+ *
+ *  CD     CD
+ *    /A    Analogue transfer from media
+ *    /DD   DDD
+ *    /AD   ADD
+ *    /AA   AAD
+ *
+ *  LD     Laserdisc
+ *
+ *  TT     Turntable records
+ *    /33    33.33 rpm
+ *    /45    45 rpm
+ *    /71    71.29 rpm
+ *    /76    76.59 rpm
+ *    /78    78.26 rpm
+ *    /80    80 rpm
+ *
+ *  MD     MiniDisc
+ *    /A    Analogue transfer from media
+ *
+ *  DAT    DAT
+ *    /A    Analogue transfer from media
+ *    /1    standard, 48 kHz/16 bits, linear
+ *    /2    mode 2, 32 kHz/16 bits, linear
+ *    /3    mode 3, 32 kHz/12 bits, non-linear, low speed
+ *    /4    mode 4, 32 kHz/12 bits, 4 channels
+ *    /5    mode 5, 44.1 kHz/16 bits, linear
+ *    /6    mode 6, 44.1 kHz/16 bits, 'wide track' play
+ *
+ *  DCC    DCC
+ *    /A    Analogue transfer from media
+ *
+ *  DVD    DVD
+ *    /A    Analogue transfer from media
+ *
+ *  TV     Television
+ *    /PAL    PAL
+ *    /NTSC   NTSC
+ *    /SECAM  SECAM
+ *
+ *  VID    Video
+ *    /PAL    PAL
+ *    /NTSC   NTSC
+ *    /SECAM  SECAM
+ *    /VHS    VHS
+ *    /SVHS   S-VHS
+ *    /BETA   BETAMAX
+ *
+ *  RAD    Radio
+ *    /FM   FM
+ *    /AM   AM
+ *    /LW   LW
+ *    /MW   MW
+ *
+ *  TEL    Telephone
+ *    /I    ISDN
+ *
+ *  MC     MC (normal cassette)
+ *    /4    4.75 cm/s (normal speed for a two sided cassette)
+ *    /9    9.5 cm/s
+ *    /I    Type I cassette (ferric/normal)
+ *    /II   Type II cassette (chrome)
+ *    /III  Type III cassette (ferric chrome)
+ *    /IV   Type IV cassette (metal)
+ *
+ *  REE    Reel
+ *    /9    9.5 cm/s
+ *    /19   19 cm/s
+ *    /38   38 cm/s
+ *    /76   76 cm/s
+ *    /I    Type I cassette (ferric/normal)
+ *    /II   Type II cassette (chrome)
+ *    /III  Type III cassette (ferric chrome)
+ *    /IV   Type IV cassette (metal)
+ * 
+ * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 65 $ + */ +final class ID3_Frame_TMED extends ID3_Frame_AbstractText {} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TMOO.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TMOO.php new file mode 100644 index 0000000..eb4cd8f --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TMOO.php @@ -0,0 +1,55 @@ +Mood frame is intended to reflect the mood of the audio with a few + * keywords, e.g. "Romantic" or "Sad". + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 65 $ + * @since ID3v2.4.0 + */ +final class ID3_Frame_TMOO extends ID3_Frame_AbstractText {} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TOAL.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TOAL.php new file mode 100644 index 0000000..11ec617 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TOAL.php @@ -0,0 +1,54 @@ +Original album/movie/show title frame is intended for the title of + * the original recording (or source of sound), if for example the music in the + * file should be a cover of a previously released song. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 65 $ + */ +final class ID3_Frame_TOAL extends ID3_Frame_AbstractText {} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TOFN.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TOFN.php new file mode 100644 index 0000000..f923049 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TOFN.php @@ -0,0 +1,54 @@ +Original filename frame contains the preferred filename for the + * file, since some media doesn't allow the desired length of the filename. The + * filename is case sensitive and includes its suffix. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 65 $ + */ +final class ID3_Frame_TOFN extends ID3_Frame_AbstractText {} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TOLY.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TOLY.php new file mode 100644 index 0000000..ee6acc6 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TOLY.php @@ -0,0 +1,54 @@ +Original lyricist/text writer frame is intended for the text + * writer of the original recording, if for example the music in the file should + * be a cover of a previously released song. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 65 $ + */ +final class ID3_Frame_TOLY extends ID3_Frame_AbstractText {} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TOPE.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TOPE.php new file mode 100644 index 0000000..e77bff0 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TOPE.php @@ -0,0 +1,54 @@ +Original artist/performer frame is intended for the performer of + * the original recording, if for example the music in the file should be a + * cover of a previously released song. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 65 $ + */ +final class ID3_Frame_TOPE extends ID3_Frame_AbstractText {} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TORY.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TORY.php new file mode 100644 index 0000000..41d5ab3 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TORY.php @@ -0,0 +1,57 @@ +Original release year frame is intended for the year when the + * original recording, if for example the music in the file should be a cover of + * a previously released song, was released. The field is formatted as in the + * {@link ID3_Frame_TYER} frame. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 75 $ + * @deprecated ID3v2.3.0 + */ +final class ID3_Frame_TORY extends ID3_Frame_AbstractText {} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TOWN.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TOWN.php new file mode 100644 index 0000000..780a0e6 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TOWN.php @@ -0,0 +1,53 @@ +File owner/licensee frame contains the name of the owner or + * licensee of the file and it's contents. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 65 $ + */ +final class ID3_Frame_TOWN extends ID3_Frame_AbstractText {} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TPE1.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TPE1.php new file mode 100644 index 0000000..478c3ba --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TPE1.php @@ -0,0 +1,53 @@ +Lead artist/Lead performer/Soloist/Performing group is used for + * the main artist. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 65 $ + */ +final class ID3_Frame_TPE1 extends ID3_Frame_AbstractText {} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TPE2.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TPE2.php new file mode 100644 index 0000000..13032d3 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TPE2.php @@ -0,0 +1,53 @@ +Band/Orchestra/Accompaniment frame is used for additional + * information about the performers in the recording. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 65 $ + */ +final class ID3_Frame_TPE2 extends ID3_Frame_AbstractText {} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TPE3.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TPE3.php new file mode 100644 index 0000000..79c5da8 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TPE3.php @@ -0,0 +1,52 @@ +Conductor frame is used for the name of the conductor. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 65 $ + */ +final class ID3_Frame_TPE3 extends ID3_Frame_AbstractText {} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TPE4.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TPE4.php new file mode 100644 index 0000000..d1fe19c --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TPE4.php @@ -0,0 +1,54 @@ +Interpreted, remixed, or otherwise modified by frame contains more + * information about the people behind a remix and similar interpretations of + * another existing piece. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 65 $ + */ +final class ID3_Frame_TPE4 extends ID3_Frame_AbstractText {} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TPOS.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TPOS.php new file mode 100644 index 0000000..3f578c1 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TPOS.php @@ -0,0 +1,56 @@ +Part of a set frame is a numeric string that describes which part + * of a set the audio came from. This frame is used if the source described in + * the {@link ID3_Frame_TALB} frame is divided into several mediums, e.g. + * a double CD. The value may be extended with a "/" character and a numeric + * string containing the total number of parts in the set. E.g. "1/2". + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 65 $ + */ +final class ID3_Frame_TPOS extends ID3_Frame_AbstractText {} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TPRO.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TPRO.php new file mode 100644 index 0000000..152c555 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TPRO.php @@ -0,0 +1,61 @@ +Produced notice frame, in which the string must begin with a year + * and a space character (making five characters), is intended for the + * production copyright holder of the original sound, not the audio file itself. + * The absence of this frame means only that the production copyright + * information is unavailable or has been removed, and must not be interpreted + * to mean that the audio is public domain. Every time this field is displayed + * the field must be preceded with "Produced " (P) " ", where (P) is one + * character showing a P in a circle. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 65 $ + * @since ID3v2.4.0 + */ +final class ID3_Frame_TPRO extends ID3_Frame_AbstractText {} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TPUB.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TPUB.php new file mode 100644 index 0000000..f55a62e --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TPUB.php @@ -0,0 +1,53 @@ +Publisher frame simply contains the name of the label or + * publisher. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 65 $ + */ +final class ID3_Frame_TPUB extends ID3_Frame_AbstractText {} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TRCK.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TRCK.php new file mode 100644 index 0000000..c2461ed --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TRCK.php @@ -0,0 +1,55 @@ +Track number/Position in set frame is a numeric string containing + * the order number of the audio-file on its original recording. This may be + * extended with a "/" character and a numeric string containing the total + * number of tracks/elements on the original recording. E.g. "4/9". + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 65 $ + */ +final class ID3_Frame_TRCK extends ID3_Frame_AbstractText {} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TRDA.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TRDA.php new file mode 100644 index 0000000..3cef5c9 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TRDA.php @@ -0,0 +1,57 @@ +Recording dates frame is intended to be used as complement to + * the {@link ID3_Frame_TYER}, {@link ID3_Frame_TDAT} and {@link ID3_Frame_TIME} + * frames. E.g. "4th-7th June, 12th June" in combination with the + * {@link ID3_Frame_TYER} frame. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 75 $ + * @deprecated ID3v2.3.0 + */ +final class ID3_Frame_TRDA extends ID3_Frame_AbstractText {} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TRSN.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TRSN.php new file mode 100644 index 0000000..ba58981 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TRSN.php @@ -0,0 +1,53 @@ +Internet radio station name frame contains the name of the + * internet radio station from which the audio is streamed. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 65 $ + */ +final class ID3_Frame_TRSN extends ID3_Frame_AbstractText {} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TRSO.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TRSO.php new file mode 100644 index 0000000..7c58a0c --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TRSO.php @@ -0,0 +1,53 @@ +Internet radio station owner frame contains the name of the owner + * of the internet radio station from which the audio is streamed. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 65 $ + */ +final class ID3_Frame_TRSO extends ID3_Frame_AbstractText {} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TSIZ.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TSIZ.php new file mode 100644 index 0000000..b4cfab6 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TSIZ.php @@ -0,0 +1,55 @@ +Size frame contains the size of the audiofile in bytes, excluding + * the ID3v2 tag, represented as a numeric string. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 75 $ + * @deprecated ID3v2.3.0 + */ +final class ID3_Frame_TSIZ extends ID3_Frame_AbstractText {} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TSOA.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TSOA.php new file mode 100644 index 0000000..1ba7d79 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TSOA.php @@ -0,0 +1,55 @@ +Album sort order frame defines a string which should be used + * instead of the {@link ID3_Frame_TALB} album name frame for sorting purposes. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 65 $ + * @since ID3v2.4.0 + */ +final class ID3_Frame_TSOA extends ID3_Frame_AbstractText {} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TSOP.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TSOP.php new file mode 100644 index 0000000..764fc91 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TSOP.php @@ -0,0 +1,55 @@ +Performer sort order frame defines a string which should be used + * instead of the {@link ID3_Frame_TPE2} performer frame for sorting purposes. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 65 $ + * @since ID3v2.4.0 + */ +final class ID3_Frame_TSOP extends ID3_Frame_AbstractText {} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TSOT.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TSOT.php new file mode 100644 index 0000000..bf96f7c --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TSOT.php @@ -0,0 +1,55 @@ +Title sort order frame defines a string which should be used + * instead of the {@link ID3_Frame_TIT2} title frame for sorting purposes. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 65 $ + * @since ID3v2.4.0 + */ +final class ID3_Frame_TSOT extends ID3_Frame_AbstractText {} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TSRC.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TSRC.php new file mode 100644 index 0000000..b74ba10 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TSRC.php @@ -0,0 +1,53 @@ +ISRC frame should contain the International Standard Recording + * Code (12 characters). + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 65 $ + */ +final class ID3_Frame_ISRC extends ID3_Frame_AbstractText {} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TSSE.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TSSE.php new file mode 100644 index 0000000..a342b65 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TSSE.php @@ -0,0 +1,54 @@ +Software/Hardware and settings used for encoding frame includes + * the used audio encoder and its settings when the file was encoded. Hardware + * refers to hardware encoders, not the computer on which a program was run. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 65 $ + */ +final class ID3_Frame_TSSE extends ID3_Frame_AbstractText {} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TSST.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TSST.php new file mode 100644 index 0000000..b13b41b --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TSST.php @@ -0,0 +1,55 @@ +Set subtitle frame is intended for the subtitle of the part of a + * set this track belongs to. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 65 $ + * @since ID3v2.4.0 + */ +final class ID3_Frame_TSST extends ID3_Frame_AbstractText {} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TXXX.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TXXX.php new file mode 100644 index 0000000..f1facd1 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TXXX.php @@ -0,0 +1,148 @@ + + * @author Ryan Butterfield + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 105 $ + */ +final class ID3_Frame_TXXX extends ID3_Frame_AbstractText +{ + /** @var string */ + private $_description; + + /** + * Constructs the class with given parameters and parses object related data. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader = null, &$options = array()) + { + ID3_Frame::__construct($reader, $options); + + if ($reader === null) + return; + + $this->_encoding = Transform::fromUInt8($this->_data[0]); + $this->_data = substr($this->_data, 1); + + switch ($this->_encoding) { + case self::UTF16: + list($this->_description, $this->_text) = + $this->explodeString16($this->_data, 2); + $this->_description = Transform::fromString16($this->_description); + $this->_text = array(Transform::fromString16($this->_text)); + break; + case self::UTF16BE: + list($this->_description, $this->_text) = + $this->explodeString16($this->_data, 2); + $this->_description = Transform::fromString16BE($this->_description); + $this->_text = array(Transform::fromString16BE($this->_text)); + break; + default: + list($this->_description, $this->_text) = + $this->explodeString8($this->_data, 2); + $this->_text = array($this->_text); + } + } + + /** + * Returns the description text. + * + * @return string + */ + public function getDescription() { return $this->_description; } + + /** + * Sets the description text using given encoding. + * + * @param string $description The content description text. + * @param integer $encoding The text encoding. + */ + public function setDescription($description, $encoding = false) + { + $this->_description = $description; + if ($encoding !== false) + $this->_encoding = $encoding; + } + + /** + * Returns the frame raw data. + * + * @return string + */ + public function __toString() + { + $data = Transform::toUInt8($this->_encoding); + switch ($this->_encoding) { + case self::UTF16: + case self::UTF16LE: + $order = $this->_encoding == self::UTF16 ? + Transform::MACHINE_ENDIAN_ORDER : Transform::LITTLE_ENDIAN_ORDER; + $data .= Transform::toString16($this->_description, $order) . "\0\0" . + Transform::toString16($this->_text[0], $order); + break; + case self::UTF16BE: + $data .= Transform::toString16BE($this->_description) . "\0\0" . + Transform::toString16BE($this->_text[0]); + break; + default: + $data .= $this->_description . "\0" . $this->_text[0]; + } + $this->setData($data); + return ID3_Frame::__toString(); + } +} + diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TYER.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TYER.php new file mode 100644 index 0000000..ed338bf --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/TYER.php @@ -0,0 +1,55 @@ +Year frame is a numeric string with a year of the recording. This + * frames is always four characters long (until the year 10000). + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 75 $ + * @deprecated ID3v2.3.0 + */ +final class ID3_Frame_TYER extends ID3_Frame_AbstractText {} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/USER.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/USER.php new file mode 100644 index 0000000..a46cfd7 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/USER.php @@ -0,0 +1,186 @@ +Terms of use frame contains a brief description of the terms of + * use and ownership of the file. More detailed information concerning the legal + * terms might be available through the {@link ID3_Frame_WCOP} frame. Newlines + * are allowed in the text. There may be more than one Terms of use frames in a + * tag, but only one with the same language. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @author Ryan Butterfield + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 105 $ + */ +final class ID3_Frame_USER extends ID3_Frame + implements ID3_Encoding, ID3_Language +{ + /** @var integer */ + private $_encoding = ID3_Encoding::UTF8; + + /** @var string */ + private $_language = "und"; + + /** @var string */ + private $_text; + + /** + * Constructs the class with given parameters and parses object related data. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + + if ($reader === null) + return; + + $this->_encoding = Transform::fromUInt8($this->_data[0]); + $this->_language = substr($this->_data, 1, 3); + if ($this->_language == "XXX") + $this->_language = "und"; + $this->_data = substr($this->_data, 4); + + switch ($this->_encoding) { + case self::UTF16: + $this->_text = Transform::fromString16($this->_data); + break; + case self::UTF16BE: + $this->_text = Transform::fromString16BE($this->_data); + break; + default: + $this->_text = Transform::fromString8($this->_data); + } + } + + /** + * Returns the text encoding. + * + * @return integer + */ + public function getEncoding() { return $this->_encoding; } + + /** + * Sets the text encoding. + * + * @see ID3_Encoding + * @param integer $encoding The text encoding. + */ + public function setEncoding($encoding) { $this->_encoding = $encoding; } + + /** + * Returns the language code as specified in the + * {@link http://www.loc.gov/standards/iso639-2/ ISO-639-2} standard. + * + * @return string + */ + public function getLanguage() { return $this->_language; } + + /** + * Sets the text language code as specified in the + * {@link http://www.loc.gov/standards/iso639-2/ ISO-639-2} standard. + * + * @see ID3_Language + * @param string $language The language code. + */ + public function setLanguage($language) + { + if ($language == "XXX") + $language = "und"; + $this->_language = substr($language, 0, 3); + } + + /** + * Returns the text. + * + * @return string + */ + public function getText() { return $this->_text; } + + /** + * Sets the text using given language and encoding. + * + * @param string $text The text. + * @param string $language The language code. + * @param integer $encoding The text encoding. + */ + public function setText($text, $language = false, $encoding = false) + { + $this->_text = $text; + if ($language !== false) + $this->setLanguage($language); + if ($encoding !== false) + $this->setEncoding($encoding); + } + + /** + * Returns the frame raw data. + * + * @return string + */ + public function __toString() + { + $data = Transform::toUInt8($this->_encoding) . $this->_language; + switch ($this->_encoding) { + case self::UTF16: + case self::UTF16LE: + $data .= Transform::toString16 + ($this->_text, $this->_encoding == self::UTF16 ? + Transform::MACHINE_ENDIAN_ORDER : Transform::LITTLE_ENDIAN_ORDER); + break; + case self::UTF16BE: + $data .= Transform::toString16BE($this->_text); + break; + default: + $data .= $this->_text; + } + $this->setData($data); + return parent::__toString(); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/USLT.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/USLT.php new file mode 100644 index 0000000..000a540 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/USLT.php @@ -0,0 +1,225 @@ +Unsynchronised lyrics/text transcription frame contains the lyrics + * of the song or a text transcription of other vocal activities. There may be + * more than one unsynchronised lyrics/text transcription frame in each tag, but + * only one with the same language and content descriptor. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @author Ryan Butterfield + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 105 $ + */ +final class ID3_Frame_USLT extends ID3_Frame + implements ID3_Encoding, ID3_Language +{ + /** @var integer */ + private $_encoding = ID3_Encoding::UTF8; + + /** @var string */ + private $_language = "und"; + + /** @var string */ + private $_description; + + /** @var string */ + private $_text; + + /** + * Constructs the class with given parameters and parses object related data. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + + if ($reader === null) + return; + + $this->_encoding = Transform::fromUInt8($this->_data[0]); + $this->_language = substr($this->_data, 1, 3); + if ($this->_language == "XXX") + $this->_language = "und"; + $this->_data = substr($this->_data, 4); + + switch ($this->_encoding) { + case self::UTF16: + list ($this->_description, $this->_text) = + $this->explodeString16($this->_data, 2); + $this->_description = Transform::fromString16($this->_description); + $this->_text = Transform::fromString16($this->_text); + break; + case self::UTF16BE: + list ($this->_description, $this->_text) = + $this->explodeString16($this->_data, 2); + $this->_description = Transform::fromString16BE($this->_description); + $this->_text = Transform::fromString16BE($this->_text); + break; + default: + list ($this->_description, $this->_text) = + $this->explodeString8($this->_data, 2); + $this->_description = Transform::fromString8($this->_description); + $this->_text = Transform::fromString8($this->_text); + } + } + + /** + * Returns the text encoding. + * + * @return integer + */ + public function getEncoding() { return $this->_encoding; } + + /** + * Sets the text encoding. + * + * @see ID3_Encoding + * @param integer $encoding The text encoding. + */ + public function setEncoding($encoding) { $this->_encoding = $encoding; } + + /** + * Returns the language code as specified in the + * {@link http://www.loc.gov/standards/iso639-2/ ISO-639-2} standard. + * + * @return string + */ + public function getLanguage() { return $this->_language; } + + /** + * Sets the text language code as specified in the + * {@link http://www.loc.gov/standards/iso639-2/ ISO-639-2} standard. + * + * @see ID3_Language + * @param string $language The language code. + */ + public function setLanguage($language) + { + if ($language == "XXX") + $language = "und"; + $this->_language = substr($language, 0, 3); + } + + /** + * Returns the short content description. + * + * @return string + */ + public function getDescription() { return $this->_description; } + + /** + * Sets the content description text using given encoding. The description + * language and encoding must be that of the actual text. + * + * @param string $description The content description text. + * @param string $language The language code. + * @param integer $encoding The text encoding. + */ + public function setDescription($description, $language = false, + $encoding = false) + { + $this->_description = $description; + if ($language !== false) + $this->setLanguage($language); + if ($encoding !== false) + $this->setEncoding($encoding); + } + + /** + * Returns the lyrics/text. + * + * @return string + */ + public function getText() { return $this->_text; } + + /** + * Sets the text using given encoding. The text language and encoding must be + * that of the description text. + * + * @param mixed $text The test string. + * @param string $language The language code. + * @param integer $encoding The text encoding. + */ + public function setText($text, $language = false, $encoding = false) + { + $this->_text = $text; + if ($language !== false) + $this->setLanguage($language); + if ($encoding !== false) + $this->setEncoding($encoding); + } + + /** + * Returns the frame raw data. + * + * @return string + */ + public function __toString() + { + $data = Transform::toUInt8($this->_encoding) . $this->_language; + switch ($this->_encoding) { + case self::UTF16: + case self::UTF16LE: + $order = $this->_encoding == self::UTF16 ? + Transform::MACHINE_ENDIAN_ORDER : Transform::LITTLE_ENDIAN_ORDER; + $data .= Transform::toString16($this->_description, $order) . "\0\0" . + Transform::toString16($this->_text, $order); + break; + case self::UTF16BE: + $data .= Transform::toString16BE($this->_description) . "\0\0" . + Transform::toString16BE($this->_text); + break; + default: + $data .= $this->_description . "\0" . $this->_text; + } + $this->setData($data); + return parent::__toString(); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/WCOM.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/WCOM.php new file mode 100644 index 0000000..e3fd209 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/WCOM.php @@ -0,0 +1,54 @@ +Commercial information frame is a URL pointing at a webpage with + * information such as where the album can be bought. There may be more than one + * WCOM frame in a tag, but not with the same content. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 65 $ + */ +final class ID3_Frame_WCOM extends ID3_Frame_AbstractLink {} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/WCOP.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/WCOP.php new file mode 100644 index 0000000..42f1d90 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/WCOP.php @@ -0,0 +1,53 @@ +Copyright/Legal information frame is a URL pointing at a webpage + * where the terms of use and ownership of the file is described. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 65 $ + */ +final class ID3_Frame_WCOP extends ID3_Frame_AbstractLink {} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/WOAF.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/WOAF.php new file mode 100644 index 0000000..2eabc45 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/WOAF.php @@ -0,0 +1,53 @@ +Official audio file webpage frame is a URL pointing at a file + * specific webpage. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 65 $ + */ +final class ID3_Frame_WOAF extends ID3_Frame_AbstractLink {} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/WOAR.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/WOAR.php new file mode 100644 index 0000000..c4e736e --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/WOAR.php @@ -0,0 +1,54 @@ +Official artist/performer webpage frame is a URL pointing at the + * artists official webpage. There may be more than one WOAR frame in a tag if + * the audio contains more than one performer, but not with the same content. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 65 $ + */ +final class ID3_Frame_WOAR extends ID3_Frame_AbstractLink {} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/WOAS.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/WOAS.php new file mode 100644 index 0000000..b867e26 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/WOAS.php @@ -0,0 +1,53 @@ +Official audio source webpage frame is a URL pointing at the + * official webpage for the source of the audio file, e.g. a movie. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 65 $ + */ +final class ID3_Frame_WOAS extends ID3_Frame_AbstractLink {} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/WORS.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/WORS.php new file mode 100644 index 0000000..5529ff9 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/WORS.php @@ -0,0 +1,53 @@ +Official Internet radio station homepage contains a URL pointing + * at the homepage of the internet radio station. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 65 $ + */ +final class ID3_Frame_WORS extends ID3_Frame_AbstractLink {} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/WPAY.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/WPAY.php new file mode 100644 index 0000000..2215755 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/WPAY.php @@ -0,0 +1,53 @@ +Payment frame is a URL pointing at a webpage that will handle the + * process of paying for this file. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 65 $ + */ +final class ID3_Frame_WPAY extends ID3_Frame_AbstractLink {} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/WPUB.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/WPUB.php new file mode 100644 index 0000000..832bdec --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/WPUB.php @@ -0,0 +1,53 @@ +Publishers official webpage frame is a URL pointing at the + * official webpage for the publisher. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 65 $ + */ +final class ID3_Frame_WPUB extends ID3_Frame_AbstractLink {} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/WXXX.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/WXXX.php new file mode 100644 index 0000000..7d2dfad --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Frame/WXXX.php @@ -0,0 +1,162 @@ + + * @author Ryan Butterfield + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 105 $ + */ +final class ID3_Frame_WXXX extends ID3_Frame_AbstractLink + implements ID3_Encoding +{ + /** @var integer */ + private $_encoding = ID3_Encoding::UTF8; + + /** @var string */ + private $_description; + + /** + * Constructs the class with given parameters and parses object related data. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader = null, &$options = array()) + { + ID3_Frame::__construct($reader, $options); + + if ($reader === null) + return; + + $this->_encoding = Transform::fromUInt8($this->_data[0]); + $this->_data = substr($this->_data, 1); + + switch ($this->_encoding) { + case self::UTF16: + list($this->_description, $this->_link) = + $this->explodeString16($this->_data, 2); + $this->_description = Transform::fromString16($this->_description); + break; + case self::UTF16BE: + list($this->_description, $this->_link) = + $this->explodeString16($this->_data, 2); + $this->_description = Transform::fromString16BE($this->_description); + break; + default: + list($this->_description, $this->_link) = + $this->explodeString8($this->_data, 2); + break; + } + $this->_link = implode($this->explodeString8($this->_link, 1), ""); + } + + /** + * Returns the text encoding. + * + * @return integer The encoding. + */ + public function getEncoding() { return $this->_encoding; } + + /** + * Sets the text encoding. + * + * @see ID3_Encoding + * @param integer $encoding The text encoding. + */ + public function setEncoding($encoding) { $this->_encoding = $encoding; } + + /** + * Returns the link description. + * + * @return string + */ + public function getDescription() { return $this->_description; } + + /** + * Sets the content description text using given encoding. + * + * @param string $description The content description text. + * @param integer $encoding The text encoding. + */ + public function setDescription($description, $encoding = false) + { + $this->_description = $description; + if ($encoding !== false) + $this->_encoding = $encoding; + } + + /** + * Returns the frame raw data. + * + * @return string + */ + public function __toString() + { + $data = Transform::toUInt8($this->_encoding); + switch ($this->_encoding) { + case self::UTF16: + case self::UTF16LE: + $data .= Transform::toString16 + ($this->_description, $this->_encoding == self::UTF16 ? + Transform::MACHINE_ENDIAN_ORDER : Transform::LITTLE_ENDIAN_ORDER) . + "\0\0"; + break; + case self::UTF16BE: + $data .= Transform::toString16BE($this->_description) . "\0\0"; + break; + default: + $data .= $this->_description . "\0"; + } + $this->setData($data . $this->_link); + return ID3_Frame::__toString(); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Header.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Header.php new file mode 100644 index 0000000..3190b00 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Header.php @@ -0,0 +1,173 @@ + + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 107 $ + */ +final class ID3_Header extends ID3_Object +{ + /** A flag to denote whether or not unsynchronisation is applied on all + frames */ + const UNSYNCHRONISATION = 128; + + /** A flag to denote whether or not the header is followed by an extended + header */ + const EXTENDEDHEADER = 64; + + /** A flag used as an experimental indicator. This flag shall always be set + when the tag is in an experimental stage. */ + const EXPERIMENTAL = 32; + + /** + * A flag to denote whether a footer is present at the very end of the tag. + * + * @since ID3v2.4.0 + */ + const FOOTER = 16; + + /** @var integer */ + private $_version = 4.0; + + /** @var integer */ + private $_flags = 0; + + /** @var integer */ + private $_size; + + /** + * Constructs the class with given parameters and reads object related data + * from the ID3v2 tag. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + + if ($reader === null) + return; + + $this->_version = $options["version"] = + $this->_reader->readInt8() + $this->_reader->readInt8() / 10; + $this->_flags = $this->_reader->readInt8(); + $this->_size = $this->decodeSynchsafe32($this->_reader->readUInt32BE()); + } + + /** + * Returns the tag version number. The version number is in the form of + * major.revision. + * + * @return integer + */ + public function getVersion() { return $this->_version; } + + /** + * Sets the tag version number. Supported version numbers are 3.0 and 4.0 + * for ID3v2.3.0 and ID3v2.4.0 standards, respectively. + * + * @param integer $version The tag version number in the form of + * major.revision. + */ + public function setVersion($version) + { + $this->setOption("version", $this->_version = $version); + } + + /** + * Checks whether or not the flag is set. Returns true if the flag + * is set, false otherwise. + * + * @param integer $flag The flag to query. + * @return boolean + */ + public function hasFlag($flag) { return ($this->_flags & $flag) == $flag; } + + /** + * Returns the flags byte. + * + * @return integer + */ + public function getFlags() { return $this->_flags; } + + /** + * Sets the flags byte. + * + * @param string $flags The flags byte. + */ + public function setFlags($flags) { $this->_flags = $flags; } + + /** + * Returns the tag size, excluding the header and the footer. + * + * @return integer + */ + public function getSize() { return $this->_size; } + + /** + * Sets the tag size, excluding the header and the footer. Called + * automatically upon tag generation to adjust the tag size. + * + * @param integer $size The size of the tag, in bytes. + */ + public function setSize($size) { $this->_size = $size; } + + /** + * Returns the header/footer raw data without the identifier. + * + * @return string + */ + public function __toString() + { + return Transform::toInt8(floor($this->_version)) . + Transform::toInt8(($this->_version - floor($this->_version)) * 10) . + Transform::toInt8($this->_flags) . + Transform::toUInt32BE($this->encodeSynchsafe32($this->_size)); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Language.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Language.php new file mode 100644 index 0000000..6cdb0be --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Language.php @@ -0,0 +1,69 @@ +Language interface implies that the ID3v2 frame supports + * its content to be given in multiple languages. + * + * The three byte language code is used to describe the language of the frame's + * content, according to {@link http://www.loc.gov/standards/iso639-2/ + * ISO-639-2}. The language should be represented in lower case. If the language + * is not known the string "xxx" should be used. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 64 $ + */ +interface ID3_Language +{ + /** + * Returns the text language code. + * + * @return string + */ + public function getLanguage(); + + /** + * Sets the text language code. + * + * @param string $language The text language code. + */ + public function setLanguage($language); +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Object.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Object.php new file mode 100644 index 0000000..c6ab3bc --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Object.php @@ -0,0 +1,252 @@ + + * @author Ryan Butterfield + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 107 $ + */ +abstract class ID3_Object +{ + /** + * The reader object. + * + * @var Reader + */ + protected $_reader; + + /** + * The options array. + * + * @var Array + */ + private $_options; + + /** + * Constructs the class with given parameters and reads object related data + * from the ID3v2 tag. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader = null, &$options = array()) + { + $this->_reader = $reader; + $this->_options = &$options; + } + + /** + * Returns the options array. + * + * @return Array + */ + public function getOptions() { return $this->_options; } + + /** + * Returns the given option value, or the default value if the option is not + * defined. + * + * @param string $option The name of the option. + * @param mixed $defaultValue The default value to be returned. + */ + public function getOption($option, $defaultValue = false) + { + if (isset($this->_options[$option])) + return $this->_options[$option]; + return $defaultValue; + } + + /** + * Sets the options array. See {@link ID3v2} class for available options. + * + * @param Array $options The options array. + */ + public function setOptions(&$options) { $this->_options = &$options; } + + /** + * Sets the given option the given value. + * + * @param string $option The name of the option. + * @param mixed $value The value to set for the option. + */ + public function setOption($option, $value) + { + $this->_options[$option] = $value; + } + + /** + * Magic function so that $obj->value will work. + * + * @param string $name The field name. + * @return mixed + */ + public function __get($name) + { + if (method_exists($this, "get" . ucfirst($name))) + return call_user_func(array($this, "get" . ucfirst($name))); + else throw new ID3_Exception("Unknown field: " . $name); + } + + /** + * Magic function so that assignments with $obj->value will work. + * + * @param string $name The field name. + * @param string $value The field value. + * @return mixed + */ + public function __set($name, $value) + { + if (method_exists($this, "set" . ucfirst($name))) + call_user_func + (array($this, "set" . ucfirst($name)), $value); + else throw new ID3_Exception("Unknown field: " . $name); + } + + /** + * Encodes the given 32-bit integer to 28-bit synchsafe integer, where the + * most significant bit of each byte is zero, making seven bits out of eight + * available. + * + * @param integer $val The integer to encode. + * @return integer + */ + protected function encodeSynchsafe32($val) + { + return ($val & 0x7f) | ($val & 0x3f80) << 1 | + ($val & 0x1fc000) << 2 | ($val & 0xfe00000) << 3; + } + + /** + * Decodes the given 28-bit synchsafe integer to regular 32-bit integer. + * + * @param integer $val The integer to decode + * @return integer + */ + protected function decodeSynchsafe32($val) + { + return ($val & 0x7f) | ($val & 0x7f00) >> 1 | + ($val & 0x7f0000) >> 2 | ($val & 0x7f000000) >> 3; + } + + /** + * Applies the unsynchronisation scheme to the given data string. + * + * Whenever a false synchronisation is found within the data, one zeroed byte + * is inserted after the first false synchronisation byte. This has the side + * effect that all 0xff00 combinations have to be altered, so they will not + * be affected by the decoding process. Therefore all the 0xff00 combinations + * have to be replaced with the 0xff0000 combination during the + * unsynchronisation. + * + * @param string $data The input data. + * @return string + */ + protected function encodeUnsynchronisation(&$data) + { + $result = ""; + for ($i = 0, $j = 0; $i < strlen($data) - 1; $i++) + if (ord($data[$i]) == 0xff && + ((($tmp = ord($data[$i + 1])) & 0xe0) == 0xe0 || $tmp == 0x0)) { + $result .= substr($data, $j, $i + 1 - $j) . "\0"; + $j = $i + 1; + } + return $result . substr($data, $j); + } + + /** + * Reverses the unsynchronisation scheme from the given data string. + * + * @see encodeUnsyncronisation + * @param string $data The input data. + * @return string + */ + protected function decodeUnsynchronisation(&$data) + { + $result = ""; + for ($i = 0, $j = 0; $i < strlen($data) - 1; $i++) + if (ord($data[$i]) == 0xff && ord($data[$i + 1]) == 0x0) { + $result .= substr($data, $j, $i + 1 - $j); + $j = $i + 2; + } + return $result . substr($data, $j); + } + + /** + * Splits UTF-16 formatted binary data up according to null terminators + * residing in the string, up to a given limit. + * + * @param string $value The input string. + * @return Array + */ + protected function explodeString16($value, $limit = null) + { + $i = 0; + $array = array(); + while (count($array) < $limit - 1 || $limit === null) { + $start = $i; + do { + $i = strpos($value, "\x00\x00", $i); + if ($i === false) { + $array[] = substr($value, $start); + return $array; + } + } while ($i & 0x1 != 0 && $i++); // make sure its aligned + $array[] = substr($value, $start, $i - $start); + $i += 2; + } + $array[] = substr($value, $i); + return $array; + } + + /** + * Splits UTF-8 or ISO-8859-1 formatted binary data according to null + * terminators residing in the string, up to a given limit. + * + * @param string $value The input string. + * @return Array + */ + protected function explodeString8($value, $limit = null) + { + return preg_split("/\\x00/", $value, $limit); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Timing.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Timing.php new file mode 100644 index 0000000..0ab120c --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3/Timing.php @@ -0,0 +1,73 @@ +Timing interface implies that the ID3v2 frame contains + * one or more 32-bit timestamps. + * + * The timestamps are absolute times, meaning that every stamp contains the time + * from the beginning of the file. + * + * @package php-reader + * @subpackage ID3 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 64 $ + */ +interface ID3_Timing +{ + /** The timestamp is an absolute time, using MPEG frames as unit. */ + const MPEG_FRAMES = 1; + + /** The timestamp is an absolute time, using milliseconds as unit. */ + const MILLISECONDS = 2; + + /** + * Returns the timing format. + * + * @return integer + */ + public function getFormat(); + + /** + * Sets the timing format. + * + * @param integer $format The timing format. + */ + public function setFormat($format); +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3v1.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3v1.php new file mode 100644 index 0000000..583545f --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3v1.php @@ -0,0 +1,350 @@ + + * @author Ryan Butterfield + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 107 $ + */ +final class ID3v1 +{ + /** @var string */ + private $_title; + + /** @var string */ + private $_artist; + + /** @var string */ + private $_album; + + /** @var string */ + private $_year; + + /** @var string */ + private $_comment; + + /** @var integer */ + private $_track; + + /** @var integer */ + private $_genre = 255; + + /** + * The genre list. + * + * @var Array + */ + public static $genres = array + ("Blues", "Classic Rock", "Country", "Dance", "Disco", "Funk", "Grunge", + "Hip-Hop", "Jazz", "Metal", "New Age", "Oldies", "Other", "Pop", "R&B", + "Rap", "Reggae", "Rock", "Techno", "Industrial", "Alternative", "Ska", + "Death Metal", "Pranks", "Soundtrack", "Euro-Techno", "Ambient", + "Trip-Hop", "Vocal", "Jazz+Funk", "Fusion", "Trance", "Classical", + "Instrumental", "Acid", "House", "Game", "Sound Clip", "Gospel", "Noise", + "AlternRock", "Bass", "Soul", "Punk", "Space", "Meditative", + "Instrumental Pop", "Instrumental Rock", "Ethnic", "Gothic", "Darkwave", + "Techno-Industrial", "Electronic", "Pop-Folk", "Eurodance", "Dream", + "Southern Rock", "Comedy", "Cult", "Gangsta", "Top 40", "Christian Rap", + "Pop/Funk", "Jungle", "Native American", "Cabaret", "New Wave", + "Psychadelic", "Rave", "Showtunes", "Trailer", "Lo-Fi", "Tribal", + "Acid Punk", "Acid Jazz", "Polka", "Retro", "Musical", "Rock & Roll", + "Hard Rock", "Folk", "Folk-Rock", "National Folk", "Swing", "Fast Fusion", + "Bebob", "Latin", "Revival", "Celtic", "Bluegrass", "Avantgarde", + "Gothic Rock", "Progressive Rock", "Psychedelic Rock", "Symphonic Rock", + "Slow Rock", "Big Band", "Chorus", "Easy Listening", "Acoustic", "Humour", + "Speech", "Chanson", "Opera", "Chamber Music", "Sonata", "Symphony", + "Booty Bass", "Primus", "Porn Groove", "Satire", "Slow Jam", "Club", + "Tango", "Samba", "Folklore", "Ballad", "Power Ballad", "Rhythmic Soul", + "Freestyle", "Duet", "Punk Rock", "Drum Solo", "A capella", "Euro-House", + "Dance Hall", 255 => "Unknown"); + + /** @var Reader */ + private $_reader; + + /** @var string */ + private $_filename = false; + + /** + * Constructs the ID3v1 class with given file. The file is not mandatory + * argument and may be omitted. A new tag can be written to a file also by + * giving the filename to the {@link #write} method of this class. + * + * @param string|Reader $filename The path to the file, file descriptor of an + * opened file, or {@link Reader} instance. + */ + public function __construct($filename = false) + { + if ($filename instanceof Reader) + $this->_reader = &$filename; + else if ((is_string($filename) && ($this->_filename = $filename) !== false && + file_exists($filename) !== false) || + (is_resource($filename) && + in_array(get_resource_type($filename), array("file", "stream")))) + $this->_reader = new Reader($filename); + else + return; + + if ($this->_reader->getSize() < 128) + throw new ID3_Exception("File does not contain ID3v1 tag"); + $this->_reader->setOffset(-128); + if ($this->_reader->read(3) != "TAG") { + $this->_reader = false; // reset reader, see write + throw new ID3_Exception("File does not contain ID3v1 tag"); + } + + $this->_title = rtrim($this->_reader->readString8(30), " \0"); + $this->_artist = rtrim($this->_reader->readString8(30), " \0"); + $this->_album = rtrim($this->_reader->readString8(30), " \0"); + $this->_year = $this->_reader->readString8(4); + $this->_comment = rtrim($this->_reader->readString8(28), " \0"); + + /* ID3v1.1 support for tracks */ + $v11_null = $this->_reader->read(1); + $v11_track = $this->_reader->read(1); + if (ord($v11_null) == 0 && ord($v11_track) != 0) + $this->_track = ord($v11_track); + else + $this->_comment = rtrim($this->_comment . $v11_null . $v11_track, " \0"); + + $this->_genre = $this->_reader->readInt8(); + } + + /** + * Returns the title field. + * + * @return string + */ + public function getTitle() { return $this->_title; } + + /** + * Sets a new value for the title field. The field cannot exceed 30 + * characters in length. + * + * @param string $title The title. + */ + public function setTitle($title) { $this->_title = $title; } + + /** + * Returns the artist field. + * + * @return string + */ + public function getArtist() { return $this->_artist; } + + /** + * Sets a new value for the artist field. The field cannot exceed 30 + * characters in length. + * + * @param string $artist The artist. + */ + public function setArtist($artist) { $this->_artist = $artist; } + + /** + * Returns the album field. + * + * @return string + */ + public function getAlbum() { return $this->_album; } + + /** + * Sets a new value for the album field. The field cannot exceed 30 + * characters in length. + * + * @param string $album The album. + */ + public function setAlbum($album) { $this->_album = $album; } + + /** + * Returns the year field. + * + * @return string + */ + public function getYear() { return $this->_year; } + + /** + * Sets a new value for the year field. The field cannot exceed 4 + * characters in length. + * + * @param string $year The year. + */ + public function setYear($year) { $this->_year = $year; } + + /** + * Returns the comment field. + * + * @return string + */ + public function getComment() { return $this->_comment; } + + /** + * Sets a new value for the comment field. The field cannot exceed 30 + * characters in length. + * + * @param string $comment The comment. + */ + public function setComment($comment) { $this->_comment = $comment; } + + /** + * Returns the track field. + * + * @since ID3v1.1 + * @return integer + */ + public function getTrack() { return $this->_track; } + + /** + * Sets a new value for the track field. By setting this field you enforce the + * 1.1 version to be used. + * + * @since ID3v1.1 + * @param integer $track The track number. + */ + public function setTrack($track) { $this->_track = $track; } + + /** + * Returns the genre. + * + * @return string + */ + public function getGenre() + { + if (isset(self::$genres[$this->_genre])) + return self::$genres[$this->_genre]; + else + return self::$genres[255]; // unknown + } + + /** + * Sets a new value for the genre field. The value may either be a numerical + * code representing one of the genres, or its string variant. + * + * The genre is set to unknown (code 255) in case the string is not found from + * the static {@link $genres} array of this class. + * + * @param integer $genre The genre. + */ + public function setGenre($genre) + { + if ((is_numeric($genre) && $genre >= 0 && $genre <= 255) || + ($genre = array_search($genre, self::$genres)) !== false) + $this->_genre = $genre; + else + $this->_genre = 255; // unknown + } + + /** + * Writes the possibly altered ID3v1 tag back to the file where it was read. + * If the class was constructed without a file name, one can be provided here + * as an argument. Regardless, the write operation will override previous + * tag information, if found. + * + * @param string $filename The optional path to the file. + */ + public function write($filename = false) + { + if ($filename === false && ($filename = $this->_filename) === false) + throw new ID3_Exception("No file given to write the tag to"); + + if (($fd = fopen + ($filename, file_exists($filename) ? "r+b" : "wb")) === false) + throw new ID3_Exception("Unable to open file for writing: " . $filename); + + fseek($fd, $this->_reader !== false ? -128 : 0, SEEK_END); + fwrite($fd, $this, 128); + + $this->_filename = $filename; + } + + /** + * Magic function so that $obj->value will work. + * + * @param string $name The field name. + * @return mixed + */ + public function __get($name) + { + if (method_exists($this, "get" . ucfirst(strtolower($name)))) + return call_user_func(array($this, "get" . ucfirst(strtolower($name)))); + else throw new ID3_Exception("Unknown field: " . $name); + } + + /** + * Magic function so that assignments with $obj->value will work. + * + * @param string $name The field name. + * @param string $value The field value. + * @return mixed + */ + public function __set($name, $value) + { + if (method_exists($this, "set" . ucfirst(strtolower($name)))) + call_user_func + (array($this, "set" . ucfirst(strtolower($name))), $value); + else throw new ID3_Exception("Unknown field: " . $name); + } + + /** + * Returns the tag raw data. + * + * @return string + */ + private function __toString() + { + return "TAG" . + Transform::toString8(substr($this->_title, 0, 30), 30) . + Transform::toString8(substr($this->_artist, 0, 30), 30) . + Transform::toString8(substr($this->_album, 0, 30), 30) . + Transform::toString8(substr($this->_year, 0, 4), 4) . + ($this->_track ? + Transform::toString8(substr($this->_comment, 0, 28), 28) . + "\0" . Transform::toInt8($this->_track) : + Transform::toString8(substr($this->_comment, 0, 30), 30)) . + Transform::toInt8($this->_genre); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3v2.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3v2.php new file mode 100644 index 0000000..7aeceb8 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ID3v2.php @@ -0,0 +1,489 @@ + + * @author Ryan Butterfield + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 107 $ + */ +final class ID3v2 +{ + /** @var Reader */ + private $_reader; + + /** @var ID3_Header */ + private $_header; + + /** @var ID3_ExtendedHeader */ + private $_extendedHeader; + + /** @var ID3_Header */ + private $_footer; + + /** @var Array */ + private $_frames = array(); + + /** @var string */ + private $_filename = false; + + /** @var Array */ + private $_options; + + /** + * Constructs the ID3v2 class with given file and options. The options array + * may also be given as the only parameter. + * + * The following options are currently recognized: + * o version -- The ID3v2 tag version to use in write operation. This option + * is automatically set when a tag is read from a file and defaults to + * version 4.0 for tag write. + * o readonly -- Indicates that the tag is read from a temporary file or + * another source it cannot be written back to. The tag can, however, + * still be written to another file. + * + * @todo Only limited subset of flags are processed. + * @todo Utilize the SEEK frame and search for a footer to find the tag + * @todo Utilize the LINK frame to fetch frames from other sources + * @param string|Reader $filename The path to the file, file descriptor of an + * opened file, or {@link Reader} instance. + * @param Array $options The options array. + */ + public function __construct($filename = false, $options = array()) + { + if (is_array($filename)) { + $options = $filename; + $filename = false; + } + + $this->_options = &$options; + if ($filename === false || + (is_string($filename) && file_exists($filename) === false) || + (is_resource($filename) && + in_array(get_resource_type($filename), array("file", "stream")))) { + $this->_header = new ID3_Header(null, $options); + } else { + if (is_string($filename) && !isset($options["readonly"])) + $this->_filename = $filename; + if ($filename instanceof Reader) + $this->_reader = &$filename; + else + $this->_reader = new Reader($filename); + if ($this->_reader->readString8(3) != "ID3") + throw new ID3_Exception("File does not contain ID3v2 tag"); + + $startOffset = $this->_reader->getOffset(); + + $this->_header = new ID3_Header($this->_reader, $options); + if ($this->_header->getVersion() < 3 || $this->_header->getVersion() > 4) + throw new ID3_Exception + ("File does not contain ID3v2 tag of supported version"); + if ($this->_header->getVersion() < 4 && + $this->_header->hasFlag(ID3_Header::UNSYNCHRONISATION)) + throw new ID3_Exception + ("Unsynchronisation not supported for this version of ID3v2 tag"); + unset($this->_options["unsyncronisation"]); + if ($this->_header->hasFlag(ID3_Header::UNSYNCHRONISATION)) + $this->_options["unsyncronisation"] = true; + if ($this->_header->hasFlag(ID3_Header::EXTENDEDHEADER)) + $this->_extendedHeader = + new ID3_ExtendedHeader($this->_reader, $options); + if ($this->_header->hasFlag(ID3_Header::FOOTER)) + $this->_footer = &$this->_header; // skip footer, and rather copy header + + while (true) { + $offset = $this->_reader->getOffset(); + + // Jump off the loop if we reached the end of the tag + if ($offset - $startOffset - 10 >= $this->_header->getSize() - + ($this->hasFooter() ? 10 : 0)) + break; + + // Jump off the loop if we reached the last frame + if ($this->_reader->available() < 4 || Transform::fromUInt32BE + ($identifier = $this->_reader->read(4)) == 0) + break; + $this->_reader->setOffset($offset); + + if (@fopen($filename = "ID3/Frame/" . + strtoupper($identifier) . ".php", "r", true) !== false) + require_once($filename); + if (class_exists($classname = "ID3_Frame_" . $identifier)) + $frame = new $classname($this->_reader, $options); + else + $frame = new ID3_Frame($this->_reader, $options); + + if (!isset($this->_frames[$frame->getIdentifier()])) + $this->_frames[$frame->getIdentifier()] = array(); + $this->_frames[$frame->getIdentifier()][] = $frame; + } + } + } + + /** + * Returns the header object. + * + * @return ID3_Header + */ + public function getHeader() { return $this->_header; } + + /** + * Checks whether there is an extended header present in the tag. Returns + * true if the header is present, false otherwise. + * + * @return boolean + */ + public function hasExtendedHeader() + { + if ($this->_header) + return $this->_header->hasFlag(ID3_Header::EXTENDEDHEADER); + } + + /** + * Returns the extended header object if present, or false + * otherwise. + * + * @return ID3_ExtendedHeader|false + */ + public function getExtendedHeader() + { + if ($this->hasExtendedHeader()) + return $this->_extendedHeader; + return false; + } + + /** + * Sets the extended header object. + * + * @param ID3_ExtendedHeader $extendedHeader The header object + */ + public function setExtendedHeader($extendedHeader) + { + if (is_subclass_of($extendedHeader, "ID3_ExtendedHeader")) { + $this->_header->flags = + $this->_header->flags | ID3_Header::EXTENDEDHEADER; + $this->_extendedHeader->setOptions($this->_options); + $this->_extendedHeader = $extendedHeader; + } else throw new ID3_Exception("Invalid argument"); + } + + /** + * Checks whether there is a frame given as an argument defined in the tag. + * Returns true if one ore more frames are present, + * false otherwise. + * + * @return boolean + */ + public function hasFrame($identifier) + { + return isset($this->_frames[$identifier]); + } + + /** + * Returns all the frames the tag contains as an associate array. The frame + * identifiers work as keys having an array of frames as associated value. + * + * @return Array + */ + public function getFrames() { return $this->_frames; } + + /** + * Returns an array of frames matching the given identifier or an empty array + * if no frames matched the identifier. + * + * The identifier may contain wildcard characters "*" and "?". The asterisk + * matches against zero or more characters, and the question mark matches any + * single character. + * + * Please note that one may also use the shorthand $obj->identifier to access + * the first frame with the identifier given. Wildcards cannot be used with + * the shorthand. + * + * @return Array + */ + public function getFramesByIdentifier($identifier) + { + $matches = array(); + $searchPattern = "/^" . + str_replace(array("*", "?"), array(".*", "."), $identifier) . "$/i"; + foreach ($this->_frames as $identifier => $frames) + if (preg_match($searchPattern, $identifier)) + foreach ($frames as $frame) + $matches[] = $frame; + return $matches; + } + + /** + * Adds a new frame to the tag and returns it. + * + * @param ID3_Frame $frame The frame to add. + * @return ID3_Frame + */ + public function addFrame($frame) + { + $frame->setOptions($this->_options); + if (!$this->hasFrame($frame->getIdentifier())) + $this->_frames[$frame->getIdentifier()] = array(); + return $this->_frames[$frame->getIdentifier()][] = $frame; + } + + /** + * Checks whether there is a footer present in the tag. Returns + * true if the footer is present, false otherwise. + * + * @return boolean + */ + public function hasFooter() + { + return $this->_header->hasFlag(ID3_Header::FOOTER); + } + + /** + * Returns the footer object if present, or false otherwise. + * + * @return ID3_Header|false + */ + public function getFooter() + { + if ($this->hasFooter()) + return $this->_footer; + return false; + } + + /** + * Sets whether the tag should have a footer defined. + * + * @param boolean $useFooter Whether the tag should have a footer + */ + public function setFooter($useFooter) + { + if ($useFooter) { + $this->_header->setFlags + ($this->_header->getFlags() | ID3_Header::FOOTER); + $this->_footer = &$this->_header; + } else { + /* Count footer bytes towards the tag size, so it gets removed or + overridden upon re-write */ + if ($this->hasFooter()) + $this->_header->setSize($this->_header->getSize() + 10); + + $this->_header->setFlags + ($this->_header->getFlags() & ~ID3_Header::FOOTER); + $this->_footer = null; + } + } + + /** + * Writes the possibly altered ID3v2 tag back to the file where it was read. + * If the class was constructed without a file name, one can be provided here + * as an argument. Regardless, the write operation will override previous + * tag information, if found. + * + * If write is called without setting any frames to the tag, the tag is + * removed from the file. + * + * @param string $filename The optional path to the file. + */ + public function write($filename = false) + { + if ($filename === false && ($filename = $this->_filename) === false) + throw new ID3_Exception("No file given to write the tag to"); + else if ($filename !== false && $this->_filename !== false && + realpath($filename) != realpath($this->_filename) && + !copy($this->_filename, $filename)) + throw new ID3_Exception("Unable to copy source to destination: " . + realpath($this->_filename) . "->" . realpath($filename)); + + if (($fd = fopen + ($filename, file_exists($filename) ? "r+b" : "wb")) === false) + throw new ID3_Exception("Unable to open file for writing: " . $filename); + + $oldTagSize = $this->_header->getSize(); + $tag = "" . $this; + $tagSize = empty($this->_frames) ? 0 : strlen($tag); + + if ($this->_reader === null || + $tagSize - 10 > $oldTagSize || $tagSize == 0) { + fseek($fd, 0, SEEK_END); + $oldFileSize = ftell($fd); + ftruncate($fd, $newFileSize = $tagSize - $oldTagSize + $oldFileSize); + for ($i = 1, $cur = $oldFileSize; $cur > 0; $cur -= 1024, $i++) { + fseek($fd, -(($i * 1024) + ($newFileSize - $oldFileSize)), SEEK_END); + $buffer = fread($fd, 1024); + fseek($fd, -($i * 1024), SEEK_END); + fwrite($fd, $buffer, 1024); + } + } + fseek($fd, 0); + fwrite($fd, $tag, $tagSize); + fclose($fd); + + $this->_filename = $filename; + } + + /** + * Magic function so that $obj->value will work. The method will attempt to + * return the first frame that matches the identifier. + * + * If there is no frame or field with given name, the method will attempt to + * create a frame with given identifier. + * + * If none of these work, an exception is thrown. + * + * @param string $name The frame or field name. + * @return mixed + */ + public function __get($name) { + if (isset($this->_frames[strtoupper($name)])) + return $this->_frames[strtoupper($name)][0]; + if (method_exists($this, "get" . ucfirst($name))) + return call_user_func(array($this, "get" . ucfirst($name))); + if (@fopen($filename = + "ID3/Frame/" . strtoupper($name) . ".php", "r", true) !== false) + require_once($filename); + if (class_exists($classname = "ID3_Frame_" . strtoupper($name))) + return $this->addFrame(new $classname()); + throw new ID3_Exception("Unknown frame/field: " . $name); + } + + /** + * Magic function so that isset($obj->value) will work. This method checks + * whether the frame matching the identifier exists. + * + * @param string $name The frame identifier. + * @return boolean + */ + public function __isset($name) + { + return isset($this->_frames[strtoupper($name)]); + } + + /** + * Magic function so that unset($obj->value) will work. This method removes + * all the frames matching the identifier. + * + * @param string $name The frame identifier. + */ + public function __unset($name) { unset($this->_frames[strtoupper($name)]); } + + /** + * Returns the tag raw data. + * + * @return string + */ + public function __toString() + { + unset($this->_options["unsyncronisation"]); + + $data = ""; + foreach ($this->_frames as $frames) + foreach ($frames as $frame) + $data .= $frame; + + $datalen = strlen($data); + $padlen = 0; + + if (isset($this->_options["unsyncronisation"]) && + $this->_options["unsyncronisation"] === true) + $this->_header->setFlags + ($this->_header->getFlags() | ID3_Header::UNSYNCHRONISATION); + + /* The tag padding is calculated as follows. If the tag can be written in + the space of the previous tag, the remaining space is used for padding. + If there is no previous tag or the new tag is bigger than the space taken + by the previous tag, the padding is calculated using the following + logaritmic equation: log(0.2(x + 10)), ranging from some 300 bytes to + almost 5000 bytes given the tag length of 0..256M. */ + if ($this->hasFooter() === false) { + if ($this->_reader !== null && $datalen < $this->_header->getSize()) + $padlen = $this->_header->getSize() - $datalen; + else + $padlen = ceil(log(0.2 * ($datalen / 1024 + 10), 10) * 1024); + } + + /* ID3v2.4.0 CRC calculated w/ padding */ + if (!isset($this->_options["version"]) || $this->_options["version"] >= 4) + $data = str_pad($data, $datalen + $padlen, "\0"); + + if ($this->hasExtendedHeader()) { + $this->_extendedHeader->setPadding($padlen); + if ($this->_extendedHeader->hasFlag(ID3_ExtendedHeader::CRC32)) { + $crc = crc32($data); + if ($crc & 0x80000000) + $crc = -(($crc ^ 0xffffffff) + 1); + $this->_extendedHeader->setCrc($crc); + } + $data = $this->getExtendedHeader() . $data; + } + + /* ID3v2.3.0 CRC calculated w/o padding */ + if (isset($this->_options["version"]) && $this->_options["version"] < 4) + $data = str_pad($data, $datalen + $padlen, "\0"); + + $this->_header->setSize(strlen($data)); + + return "ID3" . $this->_header . $data . + ($this->hasFooter() ? "3DI" . $this->getFooter() : ""); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496.php new file mode 100644 index 0000000..81c7fa5 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496.php @@ -0,0 +1,380 @@ +Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + *
  • Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + *
  • Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: ISO14496.php 101 2008-05-13 20:28:13Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("Reader.php"); +require_once("ISO14496/Box.php"); +/**#@-*/ + +/** + * This class represents a file in ISO base media file format as described in + * ISO/IEC 14496 Part 12 standard. + * + * The ISO Base Media File Format is designed to contain timed media information + * for a presentation in a flexible, extensible format that facilitates + * interchange, management, editing, and presentation of the media. This + * presentation may be local to the system containing the presentation, or may + * be via a network or other stream delivery mechanism. + * + * The file structure is object-oriented; a file can be decomposed into + * constituent objects very simply, and the structure of the objects inferred + * directly from their type. The file format is designed to be independent of + * any particular network protocol while enabling efficient support for them in + * general. + * + * The ISO Base Media File Format is a base format for media file formats. + * + * + * An overall view of the normal encapsulation structure is provided in the + * following table. + * + * The table shows those boxes that may occur at the top-level in the left-most + * column; indentation is used to show possible containment. Thus, for example, + * a {@link ISO14496_Box_TKHD Track Header Box} is found in a + * {@link ISO14496_Box_TRAK Track Box}, which is found in a + * {@link ISO14496_Box_MOOV Movie Box}. Not all boxes need be used in all files; + * the mandatory boxes are marked with bold typeface. See the description of the + * individual boxes for a discussion of what must be assumed if the optional + * boxes are not present. + * + * User data objects shall be placed only in {@link ISO14496_Box_MOOV Movie} or + * {@link ISO14496_Box_TRAK Track Boxes}, and objects using an extended type may + * be placed in a wide variety of containers, not just the top level. + * + *
      + *
    • ftyp -- {@link ISO14496_Box_FTYP File Type Box}; file type + * and compatibility + *
    • pdin -- {@link ISO14496_Box_PDIN Progressive Download Information + * Box} + *
    • moov -- {@link ISO14496_Box_MOOV Movie Box}; container for + * all the metadata + *
        + *
      • mvhd -- {@link ISO14496_Box_MVHD Movie Header Box}; + * overall declarations + *
      • trak -- {@link ISO14496_Box_TRAK Track Box}; container + * for an individual track or stream + *
          + *
        • tkhd -- {@link ISO14496_Box_TKHD Track Header Box}; + * overall information about the track + *
        • tref -- {@link ISO14496_Box_TREF Track Reference Box} + *
        • edts -- {@link ISO14496_Box_EDTS Edit Box} + *
            + *
          • elst -- {@link ISO14496_Box_ELST Edit List Box} + *
          + *
        • mdia -- {@link ISO14496_Box_MDIA Media Box} + *
            + *
          • mdhd -- {@link ISO14496_Box_MDHD Media Header Box}; + * overall information about the media + *
          • hdlr -- {@link ISO14496_Box_HDLR Handler Reference + * Box}; declares the media type + *
          • minf -- {@link ISO14496_Box_MINF Media Information + * Box} + *
              + *
            • vmhd -- {@link ISO14496_Box_VMHD Video Media Header Box}; + * overall information (video track only) + *
            • smhd -- {@link ISO14496_Box_SMHD Sound Media Header Box}; + * overall information (sound track only) + *
            • hmhd -- {@link ISO14496_Box_HMHD Hint Media Header Box}; + * overall information (hint track only) + *
            • nmhd -- {@link ISO14496_Box_NMHD Null Media Header Box}; + * overall information (some tracks only) + *
            • dinf -- {@link ISO14496_Box_DINF Data Information + * Box} + *
                + *
              • dref -- {@link ISO14496_Box_DREF Data Reference + * Box} + *
              + *
            • stbl -- {@link ISO14496_Box_STBL Sample Table Box} + *
                + *
              • stsd -- {@link ISO14496_Box_STSD Sample Descriptions + * Box} + *
              • stts -- {@link ISO14496_Box_STTS Decoding Time To + * Sample Box} + *
              • ctts -- {@link ISO14496_Box_CTTS Composition Time To Sample + * Box} + *
              • stsc -- {@link ISO14496_Box_STSC Sample To Chunk + * Box} + *
              • stsz -- {@link ISO14496_Box_STSZ Sample Size Box} + *
              • stz2 -- {@link ISO14496_Box_STZ2 Compact Sample Size + * Box} + *
              • stco -- {@link ISO14496_Box_STCO Chunk Offset + * Box}; 32-bit + *
              • co64 -- {@link ISO14496_Box_CO64 Chunk Ooffset Box}; + * 64-bit + *
              • stss -- {@link ISO14496_Box_STSS Sync Sample Table Box} + *
              • stsh -- {@link ISO14496_Box_STSH Shadow Sync Sample Table + * Box} + *
              • padb -- {@link ISO14496_Box_PADB Padding Bits Box} + *
              • stdp -- {@link ISO14496_Box_STDP Sample Degradation Priority + * Box} + *
              • sdtp -- {@link ISO14496_Box_SDTP Independent and Disposable + * Samples Box} + *
              • sbgp -- {@link ISO14496_Box_SBGP Sample To Group Box} + *
              • sgpd -- {@link ISO14496_Box_SGPD Sample Group + * Description} + *
              • subs -- {@link ISO14496_Box_SUBS Sub-Sample Information + * Box} + *
              + *
            + *
          + *
        + *
      • mvex -- {@link ISO14496_Box_MVEX Movie Extends Box} + *
          + *
        • mehd -- {@link ISO14496_Box_MEHD Movie Extends Header Box} + *
        • trex -- {@link ISO14496_Box_TREX Track Extends Box} + *
        + *
      • ipmc -- {@link ISO14496_Box_IPMC IPMP Control Box} + *
      + *
    • moof -- {@link ISO14496_Box_MOOF Movie Fragment Box} + *
        + *
      • mfhd -- {@link ISO14496_Box_MFHD Movie Fragment Header + * Box} + *
      • traf -- {@link ISO14496_Box_TRAF Track Fragment Box} + *
          + *
        • tfhd -- {@link ISO14496_Box_TFHD Track Fragment Header + * Box} + *
        • trun -- {@link ISO14496_Box_TRUN Track Fragment Run} + *
        • sdtp -- {@link ISO14496_Box_SDTP Independent and Disposable + * Samples} + *
        • sbgp -- {@link ISO14496_Box_SBGP !SampleToGroup Box} + *
        • subs -- {@link ISO14496_Box_SUBS Sub-Sample Information Box} + *
        + *
      + *
    • mfra -- {@link ISO14496_Box_MFRA Movie Fragment Random Access Box} + *
        + *
      • tfra -- {@link ISO14496_Box_TFRA Track Fragment Random Access + * Box} + *
      • mfro -- {@link ISO14496_Box_MFRO Movie Fragment Random Access + * Offset Box} + *
      + *
    • mdat -- {@link ISO14496_Box_MDAT Media Data Box} + *
    • free -- {@link ISO14496_Box_FREE Free Space Box} + *
    • skip -- {@link ISO14496_Box_SKIP Free Space Box} + *
        + *
      • udta -- {@link ISO14496_Box_UDTA User Data Box} + *
          + *
        • cprt -- {@link ISO14496_Box_CPRT Copyright Box} + *
        + *
      + *
    • meta -- {@link ISO14496_Box_META The Meta Box} + *
        + *
      • hdlr -- {@link ISO14496_Box_HDLR Handler Reference Box}; + * declares the metadata type + *
      • dinf -- {@link ISO14496_Box_DINF Data Information Box} + *
          + *
        • dref -- {@link ISO14496_Box_DREF Data Reference Box}; declares + * source(s) of metadata items + *
        + *
      • ipmc -- {@link ISO14496_Box_IPMC IPMP Control Box} + *
      • iloc -- {@link ISO14496_Box_ILOC Item Location Box} + *
      • ipro -- {@link ISO14496_Box_IPRO Item Protection Box} + *
          + *
        • sinf -- {@link ISO14496_Box_SINF Protection Scheme Information + * Box} + *
            + *
          • frma -- {@link ISO14496_Box_FRMA Original Format Box} + *
          • imif -- {@link ISO14496_Box_IMIF IPMP Information Box} + *
          • schm -- {@link ISO14496_Box_SCHM Scheme Type Box} + *
          • schi -- {@link ISO14496_Box_SCHI Scheme Information Box} + *
          + *
        + *
      • iinf -- {@link ISO14496_Box_IINF Item Information Box} + *
          + *
        • infe -- {@link ISO14496_Box_INFE Item Information Entry Box} + *
        + *
      • xml -- {@link ISO14496_Box_XML XML Box} + *
      • bxml -- {@link ISO14496_Box_BXML Binary XML Box} + *
      • pitm -- {@link ISO14496_Box_PITM Primary Item Reference Box} + *
      + *
    + * + * There are two non-standard extensions to the ISO 14496 standard that add the + * ability to include file meta information. Both the boxes reside under + * moov.udta.meta. + * + *
      + *
    • moov -- {@link ISO14496_Box_MOOV Movie Box}; container for + * all the metadata + *
    • udta -- {@link ISO14496_Box_UDTA User Data Box} + *
    • meta -- {@link ISO14496_Box_META The Meta Box} + *
        + *
      • ilst -- {@link ISO14496_Box_ILST The iTunes/iPod Tag Container + * Box} + *
      • id32 -- {@link ISO14496_Box_ID32 The ID3v2 Box} + *
      + *
    + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 101 $ + */ +class ISO14496 extends ISO14496_Box +{ + /** @var string */ + private $_filename; + + /** + * Constructs the ISO14496 class with given file and options. + * + * The following options are currently recognized: + * o base -- Indicates that only boxes with the given base path are parsed + * from the ISO base media file. Parsing all boxes can possibly have a + * significant impact on running time. Base path is a list of nested boxes + * separated by a dot. + * o readonly -- Indicates that the file is read from a temporary location + * or another source it cannot be written back to. The use of base option + * implies readonly option. + * + * @param string $filename The path to the file or file descriptor of an + * opened file. + * @param Array $options The options array. + */ + public function __construct($filename, $options = array()) + { + $this->_reader = new Reader($this->_filename = $filename); + if (isset($options["base"])) + $options["readonly"] = true; + $this->setOptions($options); + $this->setOffset(0); + $this->setSize($this->_reader->getSize()); + $this->setType("file"); + $this->setContainer(true); + $this->constructBoxes(); + } + + /** + * Writes the changes back to the original media file. + * + * Please note: currently the method writes only ID32 and ILST boxes to + * moov.udta.meta. Changes to any other box are discarded. Write + * operation will overwrite moov.udta, if found. + */ + public function write() + { + if (!isset($this->moov->udta->meta->ilst) && + !isset($this->moov->udta->meta->id32)) + throw new ISO14496_Exception("Nothing to write"); + + if ($this->getOption("readonly", false) !== false) + throw new ISO14496_Exception("File is read only"); + + if (($fd = fopen($this->_filename, file_exists + ($this->_filename) ? "r+b" : "wb")) === false) + throw new ISO14496_Exception + ("Unable to open file for writing: " . $filename); + + $this->moov->udta->meta->hdlr->setHandlerType("mdir"); + + /* Calculate start position */ + $mark = ($this->moov->udta->getOffset() > 0 ? + $this->moov->udta->getOffset() : + $this->moov->getOffset() + $this->moov->getSize()); + + /* Calculate file size */ + fseek($fd, 0, SEEK_END); + $oldFileSize = ftell($fd); + $newFileSize = $oldFileSize - + ($this->moov->udta->getOffset() > 0 ? $this->moov->udta->getSize() : 0) - + (isset($this->moov->udta->meta->free) ? + $this->moov->udta->meta->free->getSize() : 0) + + strlen($this->moov->udta); + + /* Calculate free space size */ + if ($oldFileSize < $newFileSize) { + // Add free space to the file calculated using the following logaritmic + // equation: log(0.2(x + 10)), ranging from 1k to 9k given the file size + // of 0..4G + $this->moov->udta->meta->free->setSize + (ceil(log(0.2 * ($newFileSize / 1024 + 10), 10) * 1024)); + ftruncate($fd, $newFileSize += $this->moov->udta->meta->free->getSize()); + + // Move data to the end of the file + for ($i = 1, $cur = $oldFileSize; $cur > $mark; $cur -= 1024, $i++) { + fseek($fd, -(($i * 1024) + + ($excess = $cur - 1024 > $mark ? 0 : $cur - $mark - 1024) + + ($newFileSize - $oldFileSize)), SEEK_END); + $buffer = fread($fd, 1024); + fseek($fd, -(($i * 1024) + $excess), SEEK_END); + fwrite($fd, $buffer, 1024); + } + + // Update stco/co64 to correspond the data move + foreach ($this->moov->getBoxesByIdentifier("trak") as $trak) { + $chunkOffsetBox = + (isset($trak->mdia->minf->stbl->stco) ? + $trak->mdia->minf->stbl->stco : $trak->mdia->minf->stbl->co64); + $chunkOffsetTable = $chunkOffsetBox->getChunkOffsetTable(); + $chunkOffsetTableCount = count($chunkOffsetTable); + $chunkOffsetDelta = $newFileSize - $oldFileSize; + for ($i = 1; $i <= $chunkOffsetTableCount; $i++) + $chunkOffsetTable[$i] += $chunkOffsetDelta; + $chunkOffsetBox->setChunkOffsetTable($chunkOffsetTable); + fseek($fd, $chunkOffsetBox->getOffset()); + fwrite($fd, $chunkOffsetBox, $chunkOffsetBox->getSize()); + } + } + else + $this->moov->udta->meta->free->setSize($oldFileSize - $newFileSize); + + /* Update the target box */ + fseek($fd, $mark); + $this->moov->udta->setSize(fwrite($fd, $this->moov->udta)); + + /* Update the parent box */ + fseek($fd, $this->moov->getOffset()); + fwrite($fd, Transform::toUInt32BE($this->moov->getSize())); + + fclose($fd); + } + + /** + * Returns the raw data of the ISO14496 file. + * + * @return string + */ + public function __toString($data = "") + { + if ($this->isContainer()) + foreach ($this->getBoxes() as $name => $boxes) + foreach ($boxes as $box) + $data .= $box; + return $data; + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box.php new file mode 100644 index 0000000..d1f4823 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box.php @@ -0,0 +1,451 @@ + + * @copyright Copyright (c) 2008 PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 102 $ + */ +class ISO14496_Box +{ + /** + * The reader object. + * + * @var Reader + */ + protected $_reader; + + /** @var Array */ + private $_options; + + /** @var integer */ + private $_offset = -1; + + /** @var integer */ + private $_size = -1; + + /** @var string */ + private $_type; + + + /** @var ISO14496_Box */ + private $_parent = null; + + + /** @var boolean */ + private $_container = false; + + /** @var Array */ + private $_boxes = array(); + + /** @var Array */ + private static $_path = array(); + + /** + * Constructs the class with given parameters and options. + * + * @param Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader, &$options = array()) + { + if (($this->_reader = $reader) === null) { + $this->_type = strtolower(substr(get_class($this), -4)); + } else { + $this->_offset = $this->_reader->getOffset(); + $this->_size = $this->_reader->readUInt32BE(); + $this->_type = $this->_reader->read(4); + + if ($this->_size == 1) + $this->_size = $this->_reader->readInt64BE(); + if ($this->_size == 0) + $this->_size = $this->_reader->getSize() - $this->_offset; + + if ($this->_type == "uuid") + $this->_type = $this->_reader->readGUID(); + } + $this->_options = $options; + } + + /** + * Returns the options array. + * + * @return Array + */ + public function getOptions() { return $this->_options; } + + /** + * Returns the given option value, or the default value if the option is not + * defined. + * + * @param string $option The name of the option. + * @param mixed $defaultValue The default value to be returned. + */ + public function getOption($option, $defaultValue = false) + { + if (isset($this->_options[$option])) + return $this->_options[$option]; + return $defaultValue; + } + + /** + * Sets the options array. See {@link ISO14496} class for available options. + * + * @param Array $options The options array. + */ + public function setOptions(&$options) { $this->_options = $options; } + + /** + * Sets the given option the given value. + * + * @param string $option The name of the option. + * @param mixed $value The value to set for the option. + */ + public function setOption($option, $value) + { + $this->_options[$option] = $value; + } + + /** + * Returns the file offset to box start, or -1 if the box was created on heap. + * + * @return integer + */ + public function getOffset() { return $this->_offset; } + + /** + * Sets the file offset where the box starts. + * + * @param integer $offset The file offset to box start. + */ + public function setOffset($offset) { $this->_offset = $offset; } + + /** + * Returns the box size in bytes, including the size and type header, + * fields, and all contained boxes, or -1 if the box was created on heap. + * + * @return integer + */ + public function getSize() { return $this->_size; } + + /** + * Sets the box size. The size must include the size and type header, + * fields, and all contained boxes. + * + * The method will propagate size change to box parents. + * + * @param integer $size The box size. + */ + public function setSize($size) + { + if ($this->_parent !== null) + $this->_parent->setSize + (($this->_parent->getSize() > 0 ? $this->_parent->getSize() : 0) + + $size - ($this->_size > 0 ? $this->_size : 0)); + $this->_size = $size; + } + + /** + * Returns the box type. + * + * @return string + */ + public function getType() { return $this->_type; } + + /** + * Sets the box type. + * + * @param string $type The box type. + */ + public function setType($type) { $this->_type = $type; } + + /** + * Returns the parent box containing this box. + * + * @return ISO14496_Box + */ + public function getParent() { return $this->_parent; } + + /** + * Sets the parent containing box. + * + * @param ISO14496_Box $parent The parent box. + */ + public function setParent(&$parent) { $this->_parent = $parent; } + + /** + * Returns a boolean value corresponding to whether the box is a container. + * + * @return boolean + */ + public function isContainer() { return $this->_container; } + + /** + * Returns a boolean value corresponding to whether the box is a container. + * + * @return boolean + */ + public function getContainer() { return $this->_container; } + + /** + * Sets whether the box is a container. + * + * @param boolean $container Whether the box is a container. + */ + protected function setContainer($container) + { + $this->_container = $container; + } + + /** + * Reads and constructs the boxes found within this box. + * + * @todo Does not parse iTunes internal ---- boxes. + */ + protected function constructBoxes($defaultclassname = "ISO14496_Box") + { + $base = $this->getOption("base", ""); + if ($this->getType() != "file") + self::$_path[] = $this->getType(); + $path = implode(self::$_path, "."); + + while (true) { + $offset = $this->_reader->getOffset(); + if ($offset >= $this->_offset + $this->_size) + break; + $size = $this->_reader->readUInt32BE(); + $type = rtrim($this->_reader->read(4), " "); + if ($size == 1) + $size = $this->_reader->readInt64BE(); + if ($size == 0) + $size = $this->_reader->getSize() - $offset; + + if (preg_match("/^\xa9?[a-z0-9]{3,4}$/i", $type) && + substr($base, 0, min(strlen($base), strlen + ($tmp = $path . ($path ? "." : "") . $type))) == + substr($tmp, 0, min(strlen($base), strlen($tmp)))) + { + $this->_reader->setOffset($offset); + if (@fopen($filename = "ISO14496/Box/" . strtoupper($type) . ".php", + "r", true) !== false) + require_once($filename); + if (class_exists($classname = "ISO14496_Box_" . strtoupper($type))) + $box = new $classname($this->_reader, $this->_options); + else + $box = new $defaultclassname($this->_reader, $this->_options); + $box->setParent($this); + if (!isset($this->_boxes[$box->getType()])) + $this->_boxes[$box->getType()] = array(); + $this->_boxes[$box->getType()][] = $box; + } + $this->_reader->setOffset($offset + $size); + } + + array_pop(self::$_path); + } + + /** + * Checks whether the box given as an argument is present in the file. Returns + * true if one or more boxes are present, false + * otherwise. + * + * @return boolean + * @throws ISO14496_Exception if called on a non-container box + */ + public function hasBox($identifier) + { + if (!$this->isContainer()) + throw new ISO14496_Exception("Box not a container"); + return isset($this->_boxes[$identifier]); + } + + /** + * Returns all the boxes the file contains as an associate array. The box + * identifiers work as keys having an array of boxes as associated value. + * + * @return Array + * @throws ISO14496_Exception if called on a non-container box + */ + public function getBoxes() + { + if (!$this->isContainer()) + throw new ISO14496_Exception("Box not a container"); + return $this->_boxes; + } + + /** + * Returns an array of boxes matching the given identifier or an empty array + * if no boxes matched the identifier. + * + * The identifier may contain wildcard characters "*" and "?". The asterisk + * matches against zero or more characters, and the question mark matches any + * single character. + * + * Please note that one may also use the shorthand $obj->identifier to access + * the first box with the identifier given. Wildcards cannot be used with + * the shorthand and they will not work with user defined uuid types. + * + * @return Array + * @throws ISO14496_Exception if called on a non-container box + */ + public function getBoxesByIdentifier($identifier) + { + if (!$this->isContainer()) + throw new ISO14496_Exception("Box not a container"); + $matches = array(); + $searchPattern = "/^" . + str_replace(array("*", "?"), array(".*", "."), $identifier) . "$/i"; + foreach ($this->_boxes as $identifier => $boxes) + if (preg_match($searchPattern, $identifier)) + foreach ($boxes as $box) + $matches[] = $box; + return $matches; + } + + /** + * Adds a new box into the current box and returns it. + * + * @param ISO14496_Box The box to add + * @return ISO14496_Box + */ + public function addBox($box) + { + $box->setParent($this); + $box->setOptions($this->_options); + if (!$this->hasBox($box->getType())) + $this->_boxes[$box->getType()] = array(); + return $this->_boxes[$box->getType()][] = $box; + } + + /** + * Magic function so that $obj->value will work. If called on a container box, + * the method will first attempt to return the first contained box that + * matches the identifier, and if not found, invoke a getter method. + * + * If there are no boxes or getter methods with given name, the method + * attempts to create a frame with given identifier. + * + * If none of these work, an exception is thrown. + * + * @param string $name The box or field name. + * @return mixed + */ + public function __get($name) + { + if ($this->isContainer() && isset($this->_boxes[$name])) + return $this->_boxes[$name][0]; + if (method_exists($this, "get" . ucfirst($name))) + return call_user_func(array($this, "get" . ucfirst($name))); + if (@fopen($filename = "ISO14496/Box/" . + strtoupper($name) . ".php", "r", true) !== false) + require_once($filename); + if (class_exists($classname = "ISO14496_Box_" . strtoupper($name))) + return $this->addBox(new $classname()); + throw new ISO14496_Exception("Unknown box/field: " . $name); + } + + /** + * Magic function so that assignments with $obj->value will work. + * + * @param string $name The field name. + * @param string $value The field value. + * @return mixed + */ + public function __set($name, $value) + { + if (method_exists($this, "set" . ucfirst($name))) + call_user_func(array($this, "set" . ucfirst($name)), $value); + else throw new ISO14496_Exception("Unknown field: " . $name); + } + + /** + * Magic function so that isset($obj->value) will work. This method checks + * whether the box is a container and contains a box that matches the + * identifier. + * + * @param string $name The box name. + * @return boolean + */ + public function __isset($name) + { + return ($this->isContainer() && isset($this->_boxes[$name])); + } + + /** + * Magic function so that unset($obj->value) will work. This method removes + * all the boxes from this container that match the identifier. + * + * @param string $name The box name. + */ + public function __unset($name) + { + if ($this->isContainer()) + unset($this->_boxes[$name]); + } + + /** + * Returns the box raw data. + * + * @return string + */ + public function __toString($data = "") + { + if ($this->isContainer()) + foreach ($this->getBoxes() as $name => $boxes) + foreach ($boxes as $box) + $data .= $box; + $size = strlen($data) + 8; + if ($size > 0xffffffff) + $size += 8; + if (strlen($this->_type) > 4) + $size += 16; + return ($size > 0xffffffff ? + Transform::toUInt32BE(1) : Transform::toUInt32BE($size)) . + (strlen($this->_type) > 4 ? "uuid" : $this->_type) . + ($size > 0xffffffff ? Transform::toInt64BE($size) : "") . + (strlen($this->_type) > 4 ? Transform::toGUID($this->_type) : "") . $data; + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/BXML.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/BXML.php new file mode 100644 index 0000000..d7533dd --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/BXML.php @@ -0,0 +1,86 @@ +XML Box forms may be used. + * The Binary XML Box may only be used when there is a single well-defined + * binarization of the XML for that defined format as identified by the handler. + * + * Within an XML box the data is in UTF-8 format unless the data starts with a + * byte-order-mark (BOM), which indicates that the data is in UTF-16 format. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_BXML extends ISO14496_Box_Full +{ + /** @var string */ + private $_data; + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $this->_data = $this->_reader->read + ($this->getOffset() + $this->getSize() - $this->_reader->getOffset()); + } + + /** + * Returns the binary data. + * + * @return string + */ + public function getData() + { + return $this->_data; + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/CDSC.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/CDSC.php new file mode 100644 index 0000000..fe7d627 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/CDSC.php @@ -0,0 +1,80 @@ + + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_CDSC extends ISO14496_Box +{ + /** @var Array */ + private $_trackId = array(); + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + while ($this->_reader->getOffset <= $this->getSize()) + $this->_trackId[] = $this->_reader->readUInt32BE(); + } + + /** + * Returns an array of integer references from the containing track to another + * track in the presentation. Track IDs are never re-used and cannot be equal + * to zero. + * + * @return integer + */ + public function getTrackId() { return $this->_trackId; } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/CO64.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/CO64.php new file mode 100644 index 0000000..b6a2f11 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/CO64.php @@ -0,0 +1,122 @@ +Chunk Offset Box table gives the index of each chunk into the + * containing file. There are two variants, permitting the use of 32-bit or + * 64-bit offsets. The latter is useful when managing very large presentations. + * At most one of these variants will occur in any single instance of a sample + * table. + * + * Offsets are file offsets, not the offset into any box within the file (e.g. + * {@link ISO14496_Box_MDAT Media Data Box}). This permits referring to media + * data in files without any box structure. It does also mean that care must be + * taken when constructing a self-contained ISO file with its metadata + * ({@link ISO14496_Box_MOOV Movie Box}) at the front, as the size of the + * {@link ISO14496_Box_MOOV Movie Box} will affect the chunk offsets to the + * media data. + * + * This box variant contains 64-bit offsets. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_CO64 extends ISO14496_Box_Full +{ + /** @var Array */ + private $_chunkOffsetTable = array(); + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $entryCount = $this->_reader->readUInt32BE(); + $data = $this->_reader->read + ($this->getOffset() + $this->getSize() - $this->_reader->getOffset()); + for ($i = 1; $i <= $entryCount; $i++) + $this->_chunkOffsetTable[$i] = + Transform::fromInt64BE(substr($data, ($i - 1) * 8, 8)); + } + + /** + * Returns an array of values. Each entry has the entry number as its index + * and a 64 bit integer that gives the offset of the start of a chunk into + * its containing media file as its value. + * + * @return Array + */ + public function getChunkOffsetTable() { return $this->_chunkOffsetTable; } + + /** + * Sets an array of chunk offsets. Each entry must have the entry number as + * its index and a 64 bit integer that gives the offset of the start of a + * chunk into its containing media file as its value. + * + * @param Array $chunkOffsetTable The chunk offset array. + */ + public function setChunkOffsetTable($chunkOffsetTable) + { + $this->_chunkOffsetTable = $chunkOffsetTable; + } + + /** + * Returns the box raw data. + * + * @return string + */ + public function __toString($data = "") + { + $data = Transform::toUInt32BE(count($this->_chunkOffsetTable)); + foreach ($this->_chunkOffsetTable as $chunkOffset) + $data .= Transform::toInt64BE($chunkOffset); + return parent::__toString($data); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/CPRT.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/CPRT.php new file mode 100644 index 0000000..2fc10ed --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/CPRT.php @@ -0,0 +1,96 @@ +Copyright Box contains a copyright declaration which applies to + * the entire presentation, when contained within the {@link ISO14496_Box_MOOV + * Movie Box}, or, when contained in a track, to that entire track. There may be + * multiple copyright boxes using different language codes. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_CPRT extends ISO14496_Box_Full +{ + /** @var string */ + private $_language; + + /** @var string */ + private $_notice; + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + * @todo Distinguish UTF-16? + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $this->_language = + chr(((($tmp = $this->_reader->readUInt16BE()) >> 10) & 0x1f) + 0x60) . + chr((($tmp >> 5) & 0x1f) + 0x60) . chr(($tmp & 0x1f) + 0x60); + $this->_notice = $this->_reader->read + ($this->getOffset() + $this->getSize() - $this->_reader->getOffset()); + } + + /** + * Returns the three byte language code to describe the language of the + * notice, according to {@link http://www.loc.gov/standards/iso639-2/ + * ISO 639-2/T}. + * + * @return string + */ + public function getLanguage() { return $this->_language; } + + /** + * Returns the copyright notice. + * + * @return string + */ + public function getNotice() { return $this->_notice; } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/CTTS.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/CTTS.php new file mode 100644 index 0000000..c3d3dba --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/CTTS.php @@ -0,0 +1,99 @@ +Composition Time to Sample Box provides the offset between + * decoding time and composition time. Since decoding time must be less than the + * composition time, the offsets are expressed as unsigned numbers such that + * CT(n) = DT(n) + CTTS(n) where CTTS(n) is the (uncompressed) table entry for + * sample n. + * + * The composition time to sample table is optional and must only be present if + * DT and CT differ for any samples. Hint tracks do not use this box. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_CTTS extends ISO14496_Box_Full +{ + /** @var Array */ + private $_compositionOffsetTable = array(); + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $entryCount = $this->_reader->readUInt32BE(); + $data = $this->_reader->read + ($this->getOffset() + $this->getSize() - $this->_reader->getOffset()); + for ($i = 1; $i <= $entryCount; $i++) + $this->_compositionOffsetTable[$i] = array + ("sampleCount" => + Transform::fromUInt32BE(substr($data, ($i - 1) * 8, 4)), + "sampleOffset" => + Transform::fromUInt32BE(substr($data, $i * 8 - 4, 4))); + } + + /** + * Returns an array of values. Each entry is an array containing the following + * keys. + * o sampleCount -- an integer that counts the number of consecutive samples + * that have the given offset. + * o sampleOffset -- a non-negative integer that gives the offset between CT + * and DT, such that CT(n) = DT(n) + CTTS(n). + * + * @return Array + */ + public function getCompositionOffsetTable() + { + return $this->_compositionOffsetTable; + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/DINF.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/DINF.php new file mode 100644 index 0000000..362f6b7 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/DINF.php @@ -0,0 +1,71 @@ +Data Information Box contains objects that declare the location + * of the media information in a track. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_DINF extends ISO14496_Box +{ + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + $this->setContainer(true); + + if ($reader === null) + return; + + $this->constructBoxes(); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/DREF.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/DREF.php new file mode 100644 index 0000000..1f56355 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/DREF.php @@ -0,0 +1,88 @@ +Data Reference Box contains a table of data references (normally + * URLs) that declare the location(s) of the media data used within the + * presentation. The data reference index in the sample description ties entries + * in this table to the samples in the track. A track may be split over several + * sources in this way. + * + * This box may either contain {@link ISO14496_Box_URN urn} or + * {@link ISO14496_Box_URL url} boxes. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_DREF extends ISO14496_Box_Full +{ + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + $this->setContainer(true); + + if ($reader === null) + return; + + $this->_reader->skip(4); + $this->constructBoxes(); + } + + /** + * Returns the box raw data. + * + * @return string + */ + public function __toString($data = "") + { + return parent::__toString(Transform::toUInt32BE(count($this->_boxes))); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/EDTS.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/EDTS.php new file mode 100644 index 0000000..fa9207b --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/EDTS.php @@ -0,0 +1,76 @@ +Edit Box maps the presentation time-line to the media time-line as + * it is stored in the file. The Edit Box is a container for the edit lists. + * + * The Edit Box is optional. In the absence of this box, there is an implicit + * one-to-one mapping of these time-lines, and the presentation of a track + * starts at the beginning of the presentation. An empty edit is used to offset + * the start time of a track. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_EDTS extends ISO14496_Box +{ + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + $this->setContainer(true); + + if ($reader === null) + return; + + $this->constructBoxes(); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/ELST.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/ELST.php new file mode 100644 index 0000000..56ae8da --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/ELST.php @@ -0,0 +1,108 @@ +Edit List Box contains an explicit timeline map. Each entry + * defines part of the track time-line: by mapping part of the media time-line, + * or by indicating empty time, or by defining a dwell, where a single + * time-point in the media is held for a period. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_ELST extends ISO14496_Box_Full +{ + /** @var Array */ + private $_entries = array(); + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $entryCount = $this->_reader->readUInt32BE(); + for ($i = 1; $i <= $entryCount; $i++) { + $entry = array(); + if ($this->getVersion() == 1) { + $entry["segmentDuration"] = $this->_reader->readInt64BE(); + $entry["mediaTime"] = $this->_reader->readInt64BE(); + } else { + $entry["segmentDuration"] = $this->_reader->readUInt32BE(); + $entry["mediaTime"] = $this->_reader->readInt32BE(); + } + $entry["mediaRate"] = $this->_reader->readInt16BE() + + $this->_reader->readInt16BE() / 10; + $this->_entries[] = $entry; + } + } + + /** + * Returns an array of entries. Each entry is an array containing the + * following keys. + * o segmentDuration: specifies the duration of this edit segment in units + * of the timescale in the {@link ISO14496_Box_MVHD Movie Header Box}. + * o mediaTime: the starting time within the media of this edit segment (in + * media time scale units, in composition time). If this field is set to + * –1, it is an empty edit. The last edit in a track shall never be an + * empty edit. Any difference between the duration in the + * {@link ISO14496_Box_MVHD Movie Header Box}, and the track's duration is + * expressed as an implicit empty edit at the end. + * o mediaRate: the relative rate at which to play the media corresponding + * to this edit segment. If this value is 0, then the edit is specifying + * a dwell: the media at media-time is presented for the segment-duration. + * Otherwise this field shall contain the value 1. + * + * @return Array + */ + public function getEntries() + { + return $this->_entries; + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/FREE.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/FREE.php new file mode 100644 index 0000000..449935a --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/FREE.php @@ -0,0 +1,76 @@ +Free Space Box are irrelevant and may be ignored, or + * the object deleted, without affecting the presentation. (Care should be + * exercised when deleting the object, as this may invalidate the offsets used + * in the sample table, unless this object is after all the media data). + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_FREE extends ISO14496_Box +{ + /** + * Constructs the class with given parameters. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + } + + /** + * Returns the box raw data. + * + * @return string + */ + public function __toString($data = "") + { + return parent::__toString(str_repeat("\0", $this->getSize() - 8)); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/FRMA.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/FRMA.php new file mode 100644 index 0000000..909cfdb --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/FRMA.php @@ -0,0 +1,78 @@ +Original Format Box contains the four-character-code of the + * original un-transformed sample description. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_FRMA extends ISO14496_Box +{ + /** @var string */ + private $_dataFormat; + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $this->_dataFormat = $this->_reader->read(4); + } + + /** + * Returns the four-character-code of the original un-transformed sample entry + * (e.g. mp4v if the stream contains protected MPEG-4 visual material). + * + * @return string + */ + public function getDataFormat() { return $this->_dataFormat; } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/FTYP.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/FTYP.php new file mode 100644 index 0000000..f060091 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/FTYP.php @@ -0,0 +1,142 @@ +File Type Box is placed as early as possible in the file (e.g. + * after any obligatory signature, but before any significant variable-size + * boxes such as a {@link ISO14496_Box_MOOV Movie Box}, {@link ISO14496_Box_MDAT + * Media Data Box}, or {@link ISO14496_Box_FREE Free Space}). It identifies + * which specification is the best use of the file, and a minor version + * of that specification; and also a set of others specifications to which the + * file complies. + * + * The minor version is informative only. It does not appear for + * compatible-brands, and must not be used to determine the conformance of a + * file to a standard. It may allow more precise identification of the major + * specification, for inspection, debugging, or improved decoding. + * + * The type isom (ISO Base Media file) is defined as identifying files + * that conform to the first version of the ISO Base Media File Format. More + * specific identifiers can be used to identify precise versions of + * specifications providing more detail. This brand is not be used as the major + * brand; this base file format should be derived into another specification to + * be used. There is therefore no defined normal file extension, or mime type + * assigned to this brand, nor definition of the minor version when isom + * is the major brand. + * + * Files would normally be externally identified (e.g. with a file extension or + * mime type) that identifies the best use (major brand), or the brand + * that the author believes will provide the greatest compatibility. + * + * The brand iso2 shall be used to indicate compatibility with the + * amended version of the ISO Base Media File Format; it may be used in addition + * to or instead of the isom brand and the same usage rules apply. If + * used without the brand isom identifying the first version of the + * specification, it indicates that support for some or all of the technology + * introduced by the amended version of the ISO Base Media File Format is + * required. + * + * The brand avc1 shall be used to indicate that the file is conformant + * with the AVC Extensions. If used without other brands, this implies + * that support for those extensions is required. The use of avc1 as a + * major-brand may be permitted by specifications; in that case, that + * specification defines the file extension and required behavior. + * + * If a Meta-box with an MPEG-7 handler type is used at the file level, then the + * brand mp71 is a member of the compatible-brands list in the file-type + * box. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_FTYP extends ISO14496_Box +{ + /** @var integer */ + private $_majorBrand; + + /** @var integer */ + private $_minorVersion; + + /** @var integer */ + private $_compatibleBrands = array(); + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $this->_majorBrand = $this->_reader->readString8(4); + $this->_minorVersion = $this->_reader->readUInt32BE(); + while ($this->_reader->getOffset() < $this->getSize()) + if (($brand = $this->_reader->readString8(4)) != "") + $this->_compatibleBrands[] = $brand; + } + + /** + * Returns the major version brand. + * + * @return string + */ + public function getMajorBrand() { return $this->_majorBrand; } + + /** + * Returns the minor version number. + * + * @return integer + */ + public function getMinorVersion() { return $this->_minorVersion; } + + /** + * Returns the array of compatible version brands. + * + * @return Array + */ + public function getCompatibleBrands() { return $this->_compatibleBrands; } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/Full.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/Full.php new file mode 100644 index 0000000..d22e0d3 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/Full.php @@ -0,0 +1,124 @@ + + * @copyright Copyright (c) 2008 PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +abstract class ISO14496_Box_Full extends ISO14496_Box +{ + /** @var integer */ + protected $_version = 0; + + /** @var integer */ + protected $_flags = 0; + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + if ($reader === null) + return; + + $this->_version = (($field = $this->_reader->readUInt32BE()) >> 24) & 0xff; + $this->_flags = $field & 0xffffff; + } + + /** + * Returns the version of this format of the box. + * + * @return integer + */ + public function getVersion() { return $this->_version; } + + /** + * Sets the version of this format of the box. + * + * @param integer $version The version. + */ + public function setVersion($version) { $this->_version = $version; } + + /** + * Checks whether or not the flag is set. Returns true if the flag + * is set, false otherwise. + * + * @param integer $flag The flag to query. + * @return boolean + */ + public function hasFlag($flag) { return ($this->_flags & $flag) == $flag; } + + /** + * Returns the map of flags. + * + * @return integer + */ + public function getFlags() { return $this->_flags; } + + /** + * Sets the map of flags. + * + * @param string $flags The map of flags. + */ + public function setFlags($flags) { $this->_flags = $flags; } + + /** + * Returns the box raw data. + * + * @return string + */ + public function __toString($data = "") + { + return parent::__toString + (Transform::toUInt32BE($this->_version << 24 | $this->_flags) . $data); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/HDLR.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/HDLR.php new file mode 100644 index 0000000..6de86c1 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/HDLR.php @@ -0,0 +1,150 @@ +Handler Reference Box is within a {@link ISO14496_Box_MDIA Media + * Box} declares the process by which the media-data in the track is presented, + * and thus, the nature of the media in a track. For example, a video track + * would be handled by a video handler. + * + * This box when present within a {@link ISO14496_Box_META Meta Box}, declares + * the structure or format of the meta box contents. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_HDLR extends ISO14496_Box_Full +{ + /** @var string */ + private $_handlerType; + + /** @var string */ + private $_name; + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + + if ($reader === null) + return; + + $this->_reader->skip(4); + $this->_handlerType = $this->_reader->read(4); + $this->_reader->skip(12); + $this->_name = $this->_reader->readString8 + ($this->getOffset() + $this->getSize() - $this->_reader->getOffset()); + } + + /** + * Returns the handler type. + * + * When present in a media box, the returned value contains one of the + * following values, or a value from a derived specification: + * o vide Video track + * o soun Audio track + * o hint Hint track + * + * When present in a meta box, the returned value contains an appropriate + * value to indicate the format of the meta box contents. + * + * @return integer + */ + public function getHandlerType() { return $this->_handlerType; } + + /** + * Sets the handler type. + * + * When present in a media box, the value must be set to one of the following + * values, or a value from a derived specification: + * o vide Video track + * o soun Audio track + * o hint Hint track + * + * When present in a meta box, the value must be set to an appropriate value + * to indicate the format of the meta box contents. + * + * @param string $handlerType The handler type. + */ + public function setHandlerType($handlerType) + { + $this->_handlerType = $handlerType; + } + + /** + * Returns the name string. The name is in UTF-8 characters and gives a + * human-readable name for the track type (for debugging and inspection + * purposes). + * + * @return integer + */ + public function getName() { return $this->_name; } + + /** + * Sets the name string. The name must be in UTF-8 and give a human-readable + * name for the track type (for debugging and inspection purposes). + * + * @param string $name The human-readable description. + */ + public function setName($name) { $this->_name = $name; } + + /** + * Returns the box raw data. + * + * @return string + */ + public function __toString($data = "") + { + return parent::__toString + ("appl" . $this->_handlerType . Transform::toUInt32BE(0) . + Transform::toUInt32BE(0) . Transform::toUInt32BE(0) . $this->_name . + "\0"); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/HINT.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/HINT.php new file mode 100644 index 0000000..02d73af --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/HINT.php @@ -0,0 +1,81 @@ + + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_HINT extends ISO14496_Box +{ + /** @var Array */ + private $_trackId = array(); + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + while ($this->_reader->getOffset <= $this->getSize()) + $this->_trackId[] = $this->_reader->readUInt32BE(); + } + + /** + * Returns an array of integer references from the containing track to another + * track in the presentation. Track IDs are never re-used and cannot be equal + * to zero. + * + * @return integer + */ + public function getTrackId() { return $this->_trackId; } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/HMHD.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/HMHD.php new file mode 100644 index 0000000..c269099 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/HMHD.php @@ -0,0 +1,110 @@ +Hint Media Header Box header contains general information, + * independent of the protocol, for hint tracks. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_HMHD extends ISO14496_Box_Full +{ + /** @var integer */ + private $_maxPDUSize; + + /** @var integer */ + private $_avgPDUSize; + + /** @var integer */ + private $_maxBitrate; + + /** @var integer */ + private $_avgBitrate; + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $this->_maxPDUSize = $this->_reader->readUInt16BE(); + $this->_avgPDUSize = $this->_reader->readUInt16BE(); + $this->_maxBitrate = $this->_reader->readUInt32BE(); + $this->_avgBitrate = $this->_reader->readUInt32BE(); + } + + /** + * Returns the size in bytes of the largest PDU in this (hint) stream. + * + * @return integer + */ + public function getMaxPDUSize() { return $this->_maxPDUSize; } + + /** + * Returns the average size of a PDU over the entire presentation. + * + * @return integer + */ + public function getAvgPDUSize() { return $this->_avgPDUSize; } + + /** + * Returns the maximum rate in bits/second over any window of one second. + * + * @return integer + */ + public function getMaxBitrate() { return $this->_maxbitrate; } + + /** + * Returns the average rate in bits/second over the entire presentation. + * + * @return integer + */ + public function getAvgBitrate() { return $this->_maxbitrate; } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/ID32.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/ID32.php new file mode 100644 index 0000000..334289a --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/ID32.php @@ -0,0 +1,131 @@ +ID3v2 Box resides under the {@link ISO14496_Box_META Meta Box} and + * stores ID3 version 2 meta-data. There may be more than one ID3v2 Box present + * each with a different language code. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 93 $ + */ +final class ISO14496_Box_ID32 extends ISO14496_Box_Full +{ + /** @var string */ + private $_language = "und"; + + /** @var ID3v2 */ + private $_tag; + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + + if ($reader === null) + return; + + $this->_language = + chr(((($tmp = $this->_reader->readUInt16BE()) >> 10) & 0x1f) + 0x60) . + chr((($tmp >> 5) & 0x1f) + 0x60) . chr(($tmp & 0x1f) + 0x60); + $this->_tag = new ID3v2($this->_reader, array("readonly" => true)); + } + + /** + * Returns the three byte language code to describe the language of this + * media, according to {@link http://www.loc.gov/standards/iso639-2/ + * ISO 639-2/T}. + * + * @return string + */ + public function getLanguage() { return $this->_language; } + + /** + * Sets the three byte language code as specified in the + * {@link http://www.loc.gov/standards/iso639-2/ ISO 639-2} standard. + * + * @param string $language The language code. + */ + public function setLanguage($language) { $this->_language = $language; } + + /** + * Returns the {@link ID3v2} tag class instance. + * + * @return string + */ + public function getTag() { return $this->_tag; } + + /** + * Sets the {@link ID3v2} tag class instance using given language. + * + * @param ID3v2 $tag The tag instance. + * @param string $language The language code. + */ + public function setTag($tag, $language = false) + { + $this->_tag = $tag; + if ($language !== false) + $this->_language = $language; + } + + /** + * Returns the box raw data. + * + * @return string + */ + public function __toString($data = "") + { + return parent::__toString + (Transform::toUInt16BE + (((ord($this->_language[0]) - 0x60) << 10) | + ((ord($this->_language[1]) - 0x60) << 5) | + ord($this->_language[2]) - 0x60) . $this->_tag); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/IINF.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/IINF.php new file mode 100644 index 0000000..008e99d --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/IINF.php @@ -0,0 +1,87 @@ +Item Information Box provides extra information about selected + * items, including symbolic (file) names. It may optionally occur, but + * if it does, it must be interpreted, as item protection or content encoding + * may have changed the format of the data in the item. If both content encoding + * and protection are indicated for an item, a reader should first un-protect + * the item, and then decode the item's content encoding. If more control is + * needed, an IPMP sequence code may be used. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_IINF extends ISO14496_Box +{ + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + $this->setContainer(true); + + if ($reader === null) + return; + + $this->_reader->skip(2); + $this->constructBoxes(); + } + + /** + * Returns the box raw data. + * + * @return string + */ + public function __toString($data = "") + { + return parent::__toString(Transform::toUInt16BE(count($this->_boxes))); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/ILOC.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/ILOC.php new file mode 100644 index 0000000..9244fda --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/ILOC.php @@ -0,0 +1,134 @@ +The Item Location Box provides a directory of resources in this or + * other files, by locating their containing file, their offset within that + * file, and their length. Placing this in binary format enables common handling + * of this data, even by systems which do not understand the particular metadata + * system (handler) used. For example, a system might integrate all the + * externally referenced metadata resources into one file, re-adjusting file + * offsets and file references accordingly. + * + * Items may be stored fragmented into extents, e.g. to enable interleaving. An + * extent is a contiguous subset of the bytes of the resource; the resource is + * formed by concatenating the extents. If only one extent is used then either + * or both of the offset and length may be implied: + * + * o If the offset is not identified (the field has a length of zero), then + * the beginning of the file (offset 0) is implied. + * o If the length is not specified, or specified as zero, then the entire + * file length is implied. References into the same file as this metadata, + * or items divided into more than one extent, should have an explicit + * offset and length, or use a MIME type requiring a different + * interpretation of the file, to avoid infinite recursion. + * + * The size of the item is the sum of the extentLengths. Note: extents may be + * interleaved with the chunks defined by the sample tables of tracks. + * + * The dataReferenceIndex may take the value 0, indicating a reference into the + * same file as this metadata, or an index into the dataReference table. + * + * Some referenced data may itself use offset/length techniques to address + * resources within it (e.g. an MP4 file might be included in this way). + * Normally such offsets are relative to the beginning of the containing file. + * The field base offset provides an additional offset for offset calculations + * within that contained data. For example, if an MP4 file is included within a + * file formatted to this specification, then normally data-offsets within that + * MP4 section are relative to the beginning of file; baseOffset adds to those + * offsets. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_ILOC extends ISO14496_Box +{ + /** @var Array */ + private $_items = array(); + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $offsetSize = (($tmp = $this->_reader->readUInt32BE()) >> 28) & 0xf; + $lengthSize = ($tmp >> 24) & 0xf; + $baseOffsetSize = ($tmp >> 20) & 0xf; + $itemCount = $this->_reader->readUInt16BE(); + for ($i = 0; $i < $itemCount; $i++) { + $item = array(); + $item["itemId"] = $this->_reader->readUInt16BE(); + $item["dataReferenceIndex"] = $this->_reader->readUInt16BE(); + $item["baseOffset"] = + ($baseOffsetSize == 4 ? $this->_reader->readUInt32BE() : + ($baseOffsetSize == 8 ? $this->_reader->readInt64BE() : 0)); + $item["extents"] = array(); + for ($j = 0; $j < $extentCount; $j++) { + $extent = array(); + $extent["offset"] = + ($offsetSize == 4 ? $this->_reader->readUInt32BE() : + ($offsetSize == 8 ? $this->_reader->readInt64BE() : 0)); + $extent["length"] = + ($lengthSize == 4 ? $this->_reader->readUInt32BE() : + ($lengthSize == 8 ? $this->_reader->readInt64BE() : 0)); + $item["extents"][] = $extent; + } + $this->_items[] = $item; + } + } + + /** + * Returns the array of items. Each entry has the following keys set: itemId, + * dataReferenceIndex, baseOffset, and extents. + * + * @return Array + */ + public function getItems() { return $this->_items; } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/ILST.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/ILST.php new file mode 100644 index 0000000..9b4a209 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/ILST.php @@ -0,0 +1,280 @@ + + *
  • _nam -- Name of the track
  • + *
  • _ART -- Name of the artist
  • + *
  • aART -- Name of the album artist
  • + *
  • _alb -- Name of the album
  • + *
  • _grp -- Grouping
  • + *
  • _day -- Year of publication
  • + *
  • trkn -- Track number (number/total)
  • + *
  • disk -- Disk number (number/total)
  • + *
  • tmpo -- BPM tempo
  • + *
  • _wrt -- Name of the composer
  • + *
  • _cmt -- Comments
  • + *
  • _gen -- Genre as string
  • + *
  • gnre -- Genre as an ID3v1 code, added by one
  • + *
  • cpil -- Part of a compilation (0/1)
  • + *
  • tvsh -- Name of the (television) show
  • + *
  • sonm -- Sort name of the track
  • + *
  • soar -- Sort name of the artist
  • + *
  • soaa -- Sort name of the album artist
  • + *
  • soal -- Sort name of the album
  • + *
  • soco -- Sort name of the composer
  • + *
  • sosn -- Sort name of the show
  • + *
  • _lyr -- Lyrics
  • + *
  • covr -- Cover (or other) artwork binary data
  • + *
  • _too -- Information about the software
  • + * + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 101 $ + * @since iTunes/iPod specific + */ +final class ISO14496_Box_ILST extends ISO14496_Box +{ + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + $this->setContainer(true); + + if ($reader === null) + return; + + $this->constructBoxes("ISO14496_Box_ILST_Container"); + } + + /** + * Override magic function so that $obj->value on a box will return the data + * box instead of the data container box. + * + * @param string $name The box or field name. + * @return mixed + */ + public function __get($name) + { + if (strlen($name) == 3) + $name = "\xa9" . $name; + if ($name[0] == "_") + $name = "\xa9" . substr($name, 1, 3); + if ($this->hasBox($name)) { + $boxes = $this->getBoxesByIdentifier($name); + return $boxes[0]->data; + } + if (method_exists($this, "get" . ucfirst($name))) + return call_user_func(array($this, "get" . ucfirst($name))); + return $this->addBox(new ISO14496_Box_ILST_Container($name))->data; + } +} + +/** + * Generic iTunes/iPod DATA Box container. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 101 $ + * @since iTunes/iPod specific + * @ignore + */ +final class ISO14496_Box_ILST_Container extends ISO14496_Box +{ + public function __construct($reader = null, &$options = array()) + { + parent::__construct(is_string($reader) ? null : $reader, $options); + $this->setContainer(true); + + if (is_string($reader)) { + $this->setType($reader); + $this->addBox(new ISO14496_Box_DATA()); + } else + $this->constructBoxes(); + } +} + +/**#@+ @ignore */ +require_once("ISO14496/Box/Full.php"); +/**#@-*/ + +/** + * A box that contains data for iTunes/iPod specific boxes. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 101 $ + * @since iTunes/iPod specific + */ +final class ISO14496_Box_DATA extends ISO14496_Box_Full +{ + /** @var mixed */ + private $_value; + + /** A flag to indicate that the data is an unsigned 8-bit integer. */ + const INTEGER = 0x0; + + /** + * A flag to indicate that the data is an unsigned 8-bit integer. Different + * value used in old versions of iTunes. + */ + const INTEGER_OLD_STYLE = 0x15; + + /** A flag to indicate that the data is a string. */ + const STRING = 0x1; + + /** A flag to indicate that the data is the contents of an JPEG image. */ + const JPEG = 0xd; + + /** A flag to indicate that the data is the contents of a PNG image. */ + const PNG = 0xe; + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + + if ($reader === null) + return; + + $this->_reader->skip(4); + $data = $this->_reader->read + ($this->getOffset() + $this->getSize() - $this->_reader->getOffset()); + switch ($this->getFlags()) { + case self::INTEGER: + case self::INTEGER_OLD_STYLE: + for ($i = 0; $i < strlen($data); $i++) + $this->_value .= Transform::fromInt8($data[$i]); + break; + case self::STRING: + default: + $this->_value = $data; + } + } + + /** + * Returns the value this box contains. + * + * @return mixed + */ + public function getValue() { return $this->_value; } + + /** + * Sets the value this box contains. + * + * @return mixed + */ + public function setValue($value, $type = false) + { + $this->_value = (string)$value; + if ($type === false && is_string($value)) + $this->_flags = self::STRING; + if ($type === false && is_int($value)) + $this->_flags = self::INTEGER; + if ($type !== false) + $this->_flags = $type; + } + + /** + * Override magic function so that $obj->data will return the current box + * instead of an error. For other values the method will attempt to call a + * getter method. + * + * If there are no getter methods with given name, the method will yield an + * exception. + * + * @param string $name The box or field name. + * @return mixed + */ + public function __get($name) + { + if ($name == "data") + return $this; + if (method_exists($this, "get" . ucfirst($name))) + return call_user_func(array($this, "get" . ucfirst($name))); + throw new ISO14496_Exception("Unknown box/field: " . $name); + } + + /** + * Returns the box raw data. + * + * @return string + */ + public function __toString($data = "") + { + switch ($this->getFlags()) { + case self::INTEGER: + case self::INTEGER_OLD_STYLE: + $data = ""; + for ($i = 0; $i < strlen($this->_value); $i++) + $data .= Transform::toInt8($this->_value[$i]); + break; + case self::STRING: + default: + $data = $this->_value; + } + return parent::__toString("\0\0\0\0" . $data); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/IMIF.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/IMIF.php new file mode 100644 index 0000000..c4e389a --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/IMIF.php @@ -0,0 +1,91 @@ +IPMP Information Box contains IPMP Descriptors which document the + * protection applied to the stream. + * + * IPMP_Descriptor is defined in 14496-1. This is a part of the MPEG-4 object + * descriptors (OD) that describe how an object can be accessed and decoded. + * Here, in the ISO Base Media File Format, IPMP Descriptor can be carried + * directly in IPMP Information Box without the need for OD stream. + * + * The presence of IPMP Descriptor in this box indicates the associated media + * stream is protected by the IPMP Tool described in the IPMP Descriptor. + * + * Each IPMP_Descriptor has an IPMP_ToolID, which identifies the required IPMP + * tool for protection. An independent registration authority (RA) is used so + * any party can register its own IPMP Tool and identify this without + * collisions. + * + * The IPMP_Descriptor carries IPMP information for one or more IPMP Tool + * instances, it includes but not limited to IPMP Rights Data, IPMP Key Data, + * Tool Configuration Data, etc. + * + * More than one IPMP Descriptors can be carried in this box if this media + * stream is protected by more than one IPMP Tools. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_IMIF extends ISO14496_Box +{ + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + $this->setContainer(true); + + if ($reader === null) + return; + + $this->constructBoxes(); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/INFE.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/INFE.php new file mode 100644 index 0000000..6b7f113 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/INFE.php @@ -0,0 +1,131 @@ +Item Information Entry Box contains the entry information. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_INFE extends ISO14496_Box_Full +{ + /** @var integer */ + private $_itemId; + + /** @var integer */ + private $_itemProtectionIndex; + + /** @var string */ + private $_itemName; + + /** @var string */ + private $_contentType; + + /** @var string */ + private $_contentEncoding; + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $this->_itemId = $this->_reader->readUInt16BE(); + $this->_itemProtectionIndex = $this->_reader->readUInt16BE(); + list($this->_itemName, $this->_contentType, $this->_contentEncoding) = + preg_split + ("/\\x00/", $this->_reader->read + ($this->getOffset() + $this->getSize() - $this->_reader->getOffset())); + } + + /** + * Returns the item identifier. The value is either 0 for the primary resource + * (e.g. the XML contained in an {@link ISO14496_Box_XML XML Box}) or the ID + * of the item for which the following information is defined. + * + * @return integer + */ + public function getItemId() { return $this->_itemId; } + + /** + * Returns the item protection index. The value is either 0 for an unprotected + * item, or the one-based index into the {@link ISO14496_Box_IPRO Item + * Protection Box} defining the protection applied to this item (the first box + * in the item protection box has the index 1). + * + * @return integer + */ + public function getItemProtectionIndex() + { + return $this->_itemProtectionIndex; + } + + /** + * Returns the symbolic name of the item. + * + * @return string + */ + public function getItemName() { return $this->_itemName; } + + /** + * Returns the MIME type for the item. + * + * @return string + */ + public function getContentType() { return $this->_contentType; } + + /** + * Returns the optional content encoding type as defined for Content-Encoding + * for HTTP /1.1. Some possible values are gzip, compress and + * deflate. An empty string indicates no content encoding. + * + * @return string + */ + public function getContentEncoding() { return $this->_contentEncoding; } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/IPMC.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/IPMC.php new file mode 100644 index 0000000..cce9469 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/IPMC.php @@ -0,0 +1,56 @@ +IPMP Control Box may contain IPMP descriptors which may be + * referenced by any stream in the file. + * + * @todo Data parsing + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 85 $ + */ +final class ISO14496_Box_IPMC extends ISO14496_Box_Full +{ +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/IPRO.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/IPRO.php new file mode 100644 index 0000000..edee325 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/IPRO.php @@ -0,0 +1,82 @@ +Item Protection Box provides an array of item protection + * information, for use by the {@link ISO14496_Box_IINF Item Information Box}. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_IPRO extends ISO14496_Box +{ + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + $this->setContainer(true); + + if ($reader === null) + return; + + $this->_reader->skip(2); + $this->constructBoxes(); + } + + /** + * Returns the box raw data. + * + * @return string + */ + public function __toString($data = "") + { + return parent::__toString(Transform::toUInt16BE(count($this->_boxes))); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MDAT.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MDAT.php new file mode 100644 index 0000000..439d3cc --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MDAT.php @@ -0,0 +1,66 @@ +Media Data Box contains the media data. In video tracks, this box + * would contain video frames. There may be any number of these boxes in the + * file (including zero, if all the media data is in other files). + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_MDAT extends ISO14496_Box +{ + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MDHD.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MDHD.php new file mode 100644 index 0000000..c52cca3 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MDHD.php @@ -0,0 +1,136 @@ +Media Header Box declares overall information that is + * media-independent, and relevant to characteristics of the media in a track. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_MDHD extends ISO14496_Box_Full +{ + /** @var integer */ + private $_creationTime; + + /** @var integer */ + private $_modificationTime; + + /** @var integer */ + private $_timescale; + + /** @var integer */ + private $_duration; + + /** @var string */ + private $_language; + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + if ($this->getVersion() == 1) { + $this->_creationTime = $this->_reader->readInt64BE(); + $this->_modificationTime = $this->_reader->readInt64BE(); + $this->_timescale = $this->_reader->readUInt32BE(); + $this->_duration = $this->_reader->readInt64BE(); + } else { + $this->_creationTime = $this->_reader->readUInt32BE(); + $this->_modificationTime = $this->_reader->readUInt32BE(); + $this->_timescale = $this->_reader->readUInt32BE(); + $this->_duration = $this->_reader->readUInt32BE(); + } + $this->_language = + chr(((($tmp = $this->_reader->readUInt16BE()) >> 10) & 0x1f) + 0x60) . + chr((($tmp >> 5) & 0x1f) + 0x60) . chr(($tmp & 0x1f) + 0x60); + } + + /** + * Returns the creation time of the media in this track, in seconds since + * midnight, Jan. 1, 1904, in UTC time. + * + * @return integer + */ + public function getCreationTime() { return $this->_creationTime; } + + /** + * Returns the most recent time the media in this track was modified in + * seconds since midnight, Jan. 1, 1904, in UTC time. + * + * @return integer + */ + public function getModificationTime() { return $this->_modificationTime; } + + /** + * Returns the time-scale for this media. This is the number of time units + * that pass in one second. For example, a time coordinate system that + * measures time in sixtieths of a second has a time scale of 60. + * + * @return integer + */ + public function getTimescale() { return $this->_timescale; } + + /** + * Returns the duration of this media (in the scale of the timescale). + * + * @return integer + */ + public function getDuration() { return $this->_duration; } + + /** + * Returns the three byte language code to describe the language of this + * media, according to {@link http://www.loc.gov/standards/iso639-2/ + * ISO 639-2/T}. + * + * @return string + */ + public function getLanguage() { return $this->_language; } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MDIA.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MDIA.php new file mode 100644 index 0000000..4949c4f --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MDIA.php @@ -0,0 +1,71 @@ +Media Box contains all the objects that declare information about + * the media data within a track. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_MDIA extends ISO14496_Box +{ + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + $this->setContainer(true); + + if ($reader === null) + return; + + $this->constructBoxes(); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MEHD.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MEHD.php new file mode 100644 index 0000000..2967a1b --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MEHD.php @@ -0,0 +1,84 @@ +Movie Extends Header Box is optional, and provides the overall + * duration, including fragments, of a fragmented movie. If this box is not + * present, the overall duration must be computed by examining each fragment. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_MEHD extends ISO14496_Box_Full +{ + /** @var integer */ + private $_fragmentDuration; + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + if ($this->getVersion() == 1) + $this->_fragmentDuration = $this->_reader->readInt64BE(); + else + $this->_fragmentDuration = $this->_reader->readUInt32BE(); + } + + /** + * Returns the length of the presentation of the whole movie including + * fragments (in the timescale indicated in the {@link ISO14496_Box_MVHD + * Movie Header Box}). The value of this field corresponds to the duration of + * the longest track, including movie fragments. + * + * @return integer + */ + public function getFragmentDuration() { return $this->_fragmentDuration; } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/META.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/META.php new file mode 100644 index 0000000..a7d13a7 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/META.php @@ -0,0 +1,90 @@ +Meta Box contains descriptive or annotative metadata. The + * meta box is required to contain a {@link ISO14496_Box_HDLR hdlr} box + * indicating the structure or format of the meta box contents. That + * metadata is located either within a box within this box (e.g. an XML box), or + * is located by the item identified by a primary item box. + * + * All other contained boxes are specific to the format specified by the handler + * box. + * + * The other boxes defined here may be defined as optional or mandatory for a + * given format. If they are used, then they must take the form specified here. + * These optional boxes include a data-information box, which documents other + * files in which metadata values (e.g. pictures) are placed, and a item + * location box, which documents where in those files each item is located (e.g. + * in the common case of multiple pictures stored in the same file). At most one + * meta box may occur at each of the file level, movie level, or track level. + * + * If an {@link ISO14496_Box_IPRO Item Protection Box} occurs, then some or all + * of the meta-data, including possibly the primary resource, may have been + * protected and be un-readable unless the protection system is taken into + * account. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_META extends ISO14496_Box_Full +{ + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + $this->setContainer(true); + + if ($reader === null) + return; + + $this->constructBoxes(); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MFHD.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MFHD.php new file mode 100644 index 0000000..d282ed5 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MFHD.php @@ -0,0 +1,80 @@ +Movie Fragment Header Box contains a sequence number, as a safety + * check. The sequence number usually starts at 1 and must increase for each + * movie fragment in the file, in the order in which they occur. This allows + * readers to verify integrity of the sequence; it is an error to construct a + * file where the fragments are out of sequence. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_MFHD extends ISO14496_Box_Full +{ + /** @var integer */ + private $_sequenceNumber; + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $this->_sequenceNumber = $this->_reader->readUInt32BE(); + } + + /** + * Returns the ordinal number of this fragment, in increasing order. + * + * @return integer + */ + public function getSequenceNumber() { return $this->_sequenceNumber; } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MFRA.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MFRA.php new file mode 100644 index 0000000..c29f76f --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MFRA.php @@ -0,0 +1,85 @@ +Movie Fragment Random Access Box provides a table which may assist + * readers in finding random access points in a file using movie fragments. It + * contains a track fragment random access box for each track for which + * information is provided (which may not be all tracks). It is usually placed + * at or near the end of the file; the last box within the Movie Fragment Random + * Access Box provides a copy of the length field from the Movie Fragment Random + * Access Box. Readers may attempt to find this box by examining the last 32 + * bits of the file, or scanning backwards from the end of the file for a Movie + * Fragment Random Access Offset Box and using the size information in it, to + * see if that locates the beginning of a Movie Fragment Random Access Box. + * + * This box provides only a hint as to where random access points are; the movie + * fragments themselves are definitive. It is recommended that readers take care + * in both locating and using this box as modifications to the file after it was + * created may render either the pointers, or the declaration of random access + * points, incorrect. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_MFRA extends ISO14496_Box +{ + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + $this->setContainer(true); + + if ($reader === null) + return; + + $this->constructBoxes(); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MFRO.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MFRO.php new file mode 100644 index 0000000..24bd696 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MFRO.php @@ -0,0 +1,85 @@ +Movie Fragment Random Access Offset Box provides a copy of the + * length field from the enclosing {@link ISO14496_Box_MFRA Movie Fragment + * Random Access Box}. It is placed last within that box, so that the size field + * is also last in the enclosing Movie Fragment Random Access Box. When the + * Movie Fragment Random Access Box is also last in the file this permits its + * easy location. The size field here must be correct. However, neither the + * presence of the Movie Fragment Random Access Box, nor its placement last in + * the file, are assured. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_MFRO extends ISO14496_Box_Full +{ + /** @var integer */ + private $_parentSize; + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $this->_parentSize = $this->_reader->readUInt32BE(); + } + + /** + * Returns the number of bytes of the enclosing {@link ISO14496_Box_MFRA} box. + * This field is placed at the last of the enclosing box to assist readers + * scanning from the end of the file in finding the mfra box. + * + * @return integer + */ + public function getParentSize() { return $this->_parentSize; } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MINF.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MINF.php new file mode 100644 index 0000000..9865605 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MINF.php @@ -0,0 +1,71 @@ +Media Information Box contains all the objects that declare + * characteristic information of the media in the track. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_MINF extends ISO14496_Box +{ + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + $this->setContainer(true); + + if ($reader === null) + return; + + $this->constructBoxes(); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MOOF.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MOOF.php new file mode 100644 index 0000000..e4b9f55 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MOOF.php @@ -0,0 +1,81 @@ +Movie Fragment Box extend the presentation in time. They provide + * the information that would previously have been in the + * {@link ISO14496_Box_MOOV Movie Box}. The actual samples are in + * {@link ISO14496_Box_MDAT Media Data Boxes}, as usual, if they are in the same + * file. The data reference index is in the sample description, so it is + * possible to build incremental presentations where the media data is in files + * other than the file containing the Movie Box. + * + * The Movie Fragment Box is a top-level box, (i.e. a peer to the Movie Box and + * Media Data boxes). It contains a {@link ISO14496_Box_MFHD Movie Fragment + * Header Box}, and then one or more {@link ISO14496_Box_TRAF Track Fragment + * Boxes}. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_MOOF extends ISO14496_Box +{ + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + $this->setContainer(true); + + if ($reader === null) + return; + + $this->constructBoxes(); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MOOV.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MOOV.php new file mode 100644 index 0000000..cd139e0 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MOOV.php @@ -0,0 +1,72 @@ +Movie Box + * which occurs at the top-level of a file. Normally this box is close to the + * beginning or end of the file, though this is not required. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_MOOV extends ISO14496_Box +{ + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + $this->setContainer(true); + + if ($reader === null) + return; + + $this->constructBoxes(); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MVEX.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MVEX.php new file mode 100644 index 0000000..78f8b3d --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MVEX.php @@ -0,0 +1,74 @@ +Movie Extends Box warns readers that there might be + * {@link ISO14496_Box_MFRA Movie Fragment Boxes} in this file. To know of all + * samples in the tracks, these Movie Fragment Boxes must be found and scanned + * in order, and their information logically added to that found in the + * {@link ISO14496_Box_MOOV Movie Box}. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_MVEX extends ISO14496_Box +{ + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + $this->setContainer(true); + + if ($reader === null) + return; + + $this->constructBoxes(); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MVHD.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MVHD.php new file mode 100644 index 0000000..5436c34 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MVHD.php @@ -0,0 +1,166 @@ +Movie Header Box defines overall information which is + * media-independent, and relevant to the entire presentation considered as a + * whole. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_MVHD extends ISO14496_Box_Full +{ + /** @var integer */ + private $_creationTime; + + /** @var integer */ + private $_modificationTime; + + /** @var integer */ + private $_timescale; + + /** @var integer */ + private $_duration; + + /** @var integer */ + private $_rate; + + /** @var integer */ + private $_volume; + + /** @var integer */ + private $_nextTrackId; + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + if ($this->getVersion() == 1) { + $this->_creationTime = $this->_reader->readInt64BE(); + $this->_modificationTime = $this->_reader->readInt64BE(); + $this->_timescale = $this->_reader->readUInt32BE(); + $this->_duration = $this->_reader->readInt64BE(); + } else { + $this->_creationTime = $this->_reader->readUInt32BE(); + $this->_modificationTime = $this->_reader->readUInt32BE(); + $this->_timescale = $this->_reader->readUInt32BE(); + $this->_duration = $this->_reader->readUInt32BE(); + } + $this->_rate = + ((($tmp = $this->_reader->readUInt32BE()) >> 16) & 0xffff) + + ($tmp & 0xffff) / 10; + $this->_volume = ((($tmp = $this->_reader->readUInt16BE()) >> 8) & 0xff) + + ($tmp & 0xff) / 10; + $this->_reader->skip(70); + $this->_nextTrackId = $this->_reader->readUInt32BE(); + } + + /** + * Returns the creation time of the presentation. The value is in seconds + * since midnight, Jan. 1, 1904, in UTC time. + * + * @return integer + */ + public function getCreationTime() { return $this->_creationTime; } + + /** + * Returns the most recent time the presentation was modified. The value is in + * seconds since midnight, Jan. 1, 1904, in UTC time. + * + * @return integer + */ + public function getModificationTime() { return $this->_modificationTime; } + + /** + * Returns the time-scale for the entire presentation. This is the number of + * time units that pass in one second. For example, a time coordinate system + * that measures time in sixtieths of a second has a time scale of 60. + * + * @return integer + */ + public function getTimescale() { return $this->_timescale; } + + /** + * Returns the length of the presentation in the indicated timescale. This + * property is derived from the presentation's tracks: the value of this field + * corresponds to the duration of the longest track in the presentation. + * + * @return integer + */ + public function getDuration() { return $this->_duration; } + + /** + * Returns the preferred rate to play the presentation. 1.0 is normal forward + * playback. + * + * @return integer + */ + public function getRate() { return $this->_rate; } + + /** + * Returns the preferred playback volume. 1.0 is full volume. + * + * @return integer + */ + public function getVolume() { return $this->_volume; } + + /** + * Returns a value to use for the track ID of the next track to be added to + * this presentation. Zero is not a valid track ID value. The value is larger + * than the largest track-ID in use. If this value is equal to or larger than + * 32-bit maxint, and a new media track is to be added, then a search must be + * made in the file for a unused track identifier. + * + * @return integer + */ + public function getNextTrackId() { return $this->_nextTrackId; } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/NMHD.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/NMHD.php new file mode 100644 index 0000000..e57831a --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/NMHD.php @@ -0,0 +1,55 @@ +Null Media Header Box, + * as defined here. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 85 $ + */ +final class ISO14496_Box_NMHD extends ISO14496_Box_Full +{ +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/PADB.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/PADB.php new file mode 100644 index 0000000..6fe231a --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/PADB.php @@ -0,0 +1,57 @@ +Padding Bits BoxIn some streams the media samples do not occupy + * all bits of the bytes given by the sample size, and are padded at the end to + * a byte boundary. In some cases, it is necessary to record externally the + * number of padding bits used. This table supplies that information. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 85 $ + */ +final class ISO14496_Box_PADB extends ISO14496_Box_Full +{ +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/PDIN.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/PDIN.php new file mode 100644 index 0000000..57ed193 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/PDIN.php @@ -0,0 +1,97 @@ +Progressive Download Information Box aids the progressive download + * of an ISO file. The box contains pairs of numbers (to the end of the box) + * specifying combinations of effective file download bitrate in units of + * bytes/sec and a suggested initial playback delay in units of milliseconds. + * + * A receiving party can estimate the download rate it is experiencing, and from + * that obtain an upper estimate for a suitable initial delay by linear + * interpolation between pairs, or by extrapolation from the first or last + * entry. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_PDIN extends ISO14496_Box_Full +{ + /** @var Array */ + private $_progressiveDownloadInfo = array(); + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + while ($this->_reader->getOffset() < $this->getOffset() + $this->getSize()) + $this->_progressiveDownloadInfo[] = array + ("rate" => $this->_reader->readUInt32BE(), + "initialDelay" => $this->_reader->readUInt32BE()); + } + + /** + * Returns the progressive download information array. The array consists of + * items having two keys. + * + * o rate -- the download rate expressed in bytes/second + * o initialDelay -- the suggested delay to use when playing the file, + * such that if download continues at the given rate, all data within the + * file will arrive in time for its use and playback should not need to + * stall. + * + * @return Array + */ + public function getProgressiveDownloadInfo() + { + return $this->_progressiveDownloadInfo; + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/PITM.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/PITM.php new file mode 100644 index 0000000..ecbc5c9 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/PITM.php @@ -0,0 +1,85 @@ +Primary Item Box must + * occur, or there must be a box within the meta-box (e.g. an + * {@link ISO14496_Box_XML XML Box}) containing the primary information in the + * format required by the identified handler. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_PITM extends ISO14496_Box_Full +{ + /** @var string */ + private $_itemId; + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $this->_itemId = $this->_reader->readUInt16BE(); + } + + /** + * Returns the identifier of the primary item. + * + * @return integer + */ + public function getItemId() + { + return $this->_itemId; + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/SBGP.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/SBGP.php new file mode 100644 index 0000000..a7b21eb --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/SBGP.php @@ -0,0 +1,132 @@ +Sample To Group Box table can be used to find the group that a + * sample belongs to and the associated description of that sample group. The + * table is compactly coded with each entry giving the index of the first sample + * of a run of samples with the same sample group descriptor. The sample group + * description ID is an index that refers to a {@link ISO14496_Box_SGPD Sample + * Group Description Box}, which contains entries describing the characteristics + * of each sample group. + * + * There may be multiple instances of this box if there is more than one sample + * grouping for the samples in a track. Each instance of the Sample To Group Box + * has a type code that distinguishes different sample groupings. Within a + * track, there shall be at most one instance of this box with a particular + * grouping type. The associated Sample Group Description shall indicate the + * same value for the grouping type. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_SBGP extends ISO14496_Box_Full +{ + /** @var integer */ + private $_groupingType; + + /** @var Array */ + private $_sampleToGroupTable = array(); + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $groupingType = $this->_reader->readUInt32BE(); + $entryCount = $this->_reader->readUInt32BE(); + $data = $this->_reader->read + ($this->getOffset() + $this->getSize() - $this->_reader->getOffset()); + for ($i = 1; $i <= $entryCount; $i++) + $this->_sampleToGroupTable[$i] = array + ("sampleCount" => + Transform::fromUInt32BE(substr($data, ($i - 1) * 8, 4)), + "groupDescriptionIndex" => + Transform::fromUInt32BE(substr($data, $i * 8 - 4, 4))); + } + + /** + * Returns the grouping type that identifies the type (i.e. criterion used to + * form the sample groups) of the sample grouping and links it to its sample + * group description table with the same value for grouping type. At most one + * occurrence of this box with the same value for groupingType shall exist for + * a track. + * + * @return integer + */ + public function getGroupingType() + { + return $this->_groupingType; + } + + /** + * Returns an array of values. Each entry is an array containing the following + * keys. + * o sampleCount -- an integer that gives the number of consecutive samples + * with the same sample group descriptor. If the sum of the sample count + * in this box is less than the total sample count, then the reader should + * effectively extend it with an entry that associates the remaining + * samples with no group. It is an error for the total in this box to be + * greater than the sample_count documented elsewhere, and the reader + * behavior would then be undefined. + * o groupDescriptionIndex -- an integer that gives the index of the sample + * group entry which describes the samples in this group. The index ranges + * from 1 to the number of sample group entries in the + * {@link ISO14496_Box_SGPD Sample Group Description Box}, or takes the + * value 0 to indicate that this sample is a member of no group of this + * type. + * + * @return Array + */ + public function getSampleToGroupTable() + { + return $this->_sampleToGroupTable; + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/SCHI.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/SCHI.php new file mode 100644 index 0000000..d63d3f0 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/SCHI.php @@ -0,0 +1,74 @@ +Scheme Information Box is a container Box that is only interpreted + * by the scheme being used. Any information the encryption system needs is + * stored here. The content of this box is a series of boxes whose type and + * format are defined by the scheme declared in the + * {@link ISO14496_Box_SCHM Scheme Type Box}. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_SCHI extends ISO14496_Box +{ + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + $this->setContainer(true); + + if ($reader === null) + return; + + $this->constructBoxes(); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/SCHM.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/SCHM.php new file mode 100644 index 0000000..2f361f2 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/SCHM.php @@ -0,0 +1,103 @@ +Scheme Type Box identifies the protection scheme. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_SCHM extends ISO14496_Box_Full +{ + /** @var string */ + private $_schemeType; + + /** @var integer */ + private $_schemeVersion; + + /** @var string */ + private $_schemeUri; + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $this->_schemeType = $this->_reader->read(4); + $this->_schemeVersion = $this->_reader->readUInt32BE(); + if ($this->hasFlag(1)) + $this->_schemeUri = preg_split + ("/\\x00/", $this->_reader->read + ($this->getOffset() + $this->getSize() - $this->_reader->getOffset())); + } + + /** + * Returns the code defining the protection scheme. + * + * @return string + */ + public function getSchemeType() { return $this->_schemeType; } + + /** + * Returns the version of the scheme used to create the content. + * + * @return integer + */ + public function getSchemeVersion() { return $this->_schemeVersion; } + + /** + * Returns the optional scheme address to allow for the option of directing + * the user to a web-page if they do not have the scheme installed on their + * system. It is an absolute URI. + * + * @return string + */ + public function getSchemeUri() { return $this->_schemeUri; } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/SDTP.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/SDTP.php new file mode 100644 index 0000000..b8f3dc3 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/SDTP.php @@ -0,0 +1,130 @@ +Independent and Disposable Samples Box optional table answers + * three questions about sample dependency: + * 1) does this sample depend on others (is it an I-picture)? + * 2) do no other samples depend on this one? + * 3) does this sample contain multiple (redundant) encodings of the data at + * this time-instant (possibly with different dependencies)? + * + * In the absence of this table: + * 1) the sync sample table answers the first question; in most video codecs, + * I-pictures are also sync points, + * 2) the dependency of other samples on this one is unknown. + * 3) the existence of redundant coding is unknown. + * + * When performing trick modes, such as fast-forward, it is possible to use the + * first piece of information to locate independently decodable samples. + * Similarly, when performing random access, it may be necessary to locate the + * previous sync point or random access recovery point, and roll-forward from + * the sync point or the pre-roll starting point of the random access recovery + * point to the desired point. While rolling forward, samples on which no others + * depend need not be retrieved or decoded. + * + * The value of sampleIsDependedOn is independent of the existence of redundant + * codings. However, a redundant coding may have different dependencies from the + * primary coding; if redundant codings are available, the value of + * sampleDependsOn documents only the primary coding. + * + * A sample dependency Box may also occur in the {@link ISO14496_Box_TRAF Track + * Fragment Box}. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_SDTP extends ISO14496_Box_Full +{ + /** @var Array */ + private $_sampleDependencyTypeTable = array(); + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $data = $this->_reader->read + ($this->getOffset() + $this->getSize() - $this->_reader->getOffset()); + $dataSize = strlen($data); + for ($i = 1; $i <= $dataSize; $i++) + $this->_sampleDependencyTypeTable[$i] = array + ("sampleDependsOn" => (($tmp = Transform::fromInt8 + ($data[$i - 1])) >> 4) & 0x3, + "sampleIsDependedOn" => ($tmp >> 2) & 0x3, + "sampleHasRedundancy" => $tmp & 0x3); + } + + /** + * Returns an array of values. Each entry is an array containing the following + * keys. + * o sampleDependsOn -- takes one of the following four values: + * 0: the dependency of this sample is unknown; + * 1: this sample does depend on others (not an I picture); + * 2: this sample does not depend on others (I picture); + * 3: reserved + * o sampleIsDependedOn -- takes one of the following four values: + * 0: the dependency of other samples on this sample is unknown; + * 1: other samples depend on this one (not disposable); + * 2: no other sample depends on this one (disposable); + * 3: reserved + * o sampleHasRedundancy -- takes one of the following four values: + * 0: it is unknown whether there is redundant coding in this sample; + * 1: there is redundant coding in this sample; + * 2: there is no redundant coding in this sample; + * 3: reserved + * + * @return Array + */ + public function getSampleDependencyTypeTable() + { + return $this->_sampleDependencyTypeTable; + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/SGPD.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/SGPD.php new file mode 100644 index 0000000..ca46806 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/SGPD.php @@ -0,0 +1,64 @@ +Sample Group Description Box table gives information about the + * characteristics of sample groups. The descriptive information is any other + * information needed to define or characterize the sample group. + * + * There may be multiple instances of this box if there is more than one sample + * grouping for the samples in a track. Each instance of the Sample Group + * Description box has a type code that distinguishes different sample + * groupings. Within a track, there shall be at most one instance of this box + * with a particular grouping type. The associated Sample To Group shall + * indicate the same value for the grouping type. + * + * @todo Data parsing + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 85 $ + */ +final class ISO14496_Box_SGPD extends ISO14496_Box_Full +{ +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/SINF.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/SINF.php new file mode 100644 index 0000000..605781f --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/SINF.php @@ -0,0 +1,87 @@ +Protection Scheme Information Box contains all the information + * required both to understand the encryption transform applied and its + * parameters, and also to find other information such as the kind and location + * of the key management system. It also documents the original (unencrypted) + * format of the media. The Protection Scheme Info Box is a container Box. It is + * mandatory in a sample entry that uses a code indicating a protected stream. + * + * When used in a protected sample entry, this box must contain the original + * format box to document the original format. At least one of the following + * signaling methods must be used to identify the protection applied: + * + * a) MPEG-4 systems with IPMP: no other boxes, when IPMP descriptors in MPEG-4 + * systems streams are used; + * b) Standalone IPMP: an {@link ISO14496_Box_IMIF IPMP Info Box}, when IPMP + * descriptors outside MPEG-4 systems are used; + * c) Scheme signaling: a {@link ISO14496_Box_SCHM Scheme Type Box} and + * {@link ISO14496_Box_SCHI Scheme Information Box}, when these are used + * (either both must occur, or neither). + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_SINF extends ISO14496_Box +{ + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + $this->setContainer(true); + + if ($reader === null) + return; + + $this->constructBoxes(); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/SKIP.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/SKIP.php new file mode 100644 index 0000000..5bc259e --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/SKIP.php @@ -0,0 +1,73 @@ +Free Space Box are irrelevant and may be ignored, or + * the object deleted, without affecting the presentation. (Care should be + * exercised when deleting the object, as this may invalidate the offsets used + * in the sample table, unless this object is after all the media data). + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_SKIP extends ISO14496_Box +{ + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + $this->setContainer(true); + + if ($reader === null) + return; + + $this->constructBoxes(); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/SMHD.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/SMHD.php new file mode 100644 index 0000000..d52ab79 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/SMHD.php @@ -0,0 +1,66 @@ +Sound Media Header Box contains general presentation information, + * independent of the coding, for audio media. This header is used for all + * tracks containing audio. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_SMHD extends ISO14496_Box_Full +{ + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STBL.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STBL.php new file mode 100644 index 0000000..06dfee6 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STBL.php @@ -0,0 +1,90 @@ +Sample Table Box contains all the time and data indexing of the + * media samples in a track. Using the tables here, it is possible to locate + * samples in time, determine their type (e.g. I-frame or not), and determine + * their size, container, and offset into that container. + * + * If the track that contains the Sample Table Box references no data, then the + * Sample Table Box does not need to contain any sub-boxes (this is not a very + * useful media track). + * + * If the track that the Sample Table Box is contained in does reference data, + * then the following sub-boxes are required: {@link ISO14496_Box_STSD Sample + * Description}, {@link ISO14496_Box_STSZ Sample Size}, + * {@link ISO14496_Box_STSC Sample To Chunk}, and {@link ISO14496_Box_STCO Chunk + * Offset}. Further, the {@link ISO14496_Box_STSD Sample Description Box} shall + * contain at least one entry. A Sample Description Box is required because it + * contains the data reference index field which indicates which + * {@link ISO14496_Box_DREF Data Reference Box} to use to retrieve the media + * samples. Without the Sample Description, it is not possible to determine + * where the media samples are stored. The {@link ISO14496_Box_STSS Sync Sample + * Box} is optional. If the Sync Sample Box is not present, all samples are sync + * samples. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_STBL extends ISO14496_Box +{ + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + $this->setContainer(true); + + if ($reader === null) + return; + + $this->constructBoxes(); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STCO.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STCO.php new file mode 100644 index 0000000..1b8e5cc --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STCO.php @@ -0,0 +1,122 @@ +Chunk Offset Box table gives the index of each chunk into the + * containing file. There are two variants, permitting the use of 32-bit or + * 64-bit offsets. The latter is useful when managing very large presentations. + * At most one of these variants will occur in any single instance of a sample + * table. + * + * Offsets are file offsets, not the offset into any box within the file (e.g. + * {@link ISO14496_Box_MDAT Media Data Box}). This permits referring to media + * data in files without any box structure. It does also mean that care must be + * taken when constructing a self-contained ISO file with its metadata + * ({@link ISO14496_Box_MOOV Movie Box}) at the front, as the size of the + * {@link ISO14496_Box_MOOV Movie Box} will affect the chunk offsets to the + * media data. + * + * This box variant contains 32-bit offsets. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_STCO extends ISO14496_Box_Full +{ + /** @var Array */ + private $_chunkOffsetTable = array(); + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $entryCount = $this->_reader->readUInt32BE(); + $data = $this->_reader->read + ($this->getOffset() + $this->getSize() - $this->_reader->getOffset()); + for ($i = 1; $i <= $entryCount; $i++) + $this->_chunkOffsetTable[$i] = + Transform::fromUInt32BE(substr($data, ($i - 1) * 4, 4)); + } + + /** + * Returns an array of values. Each entry has the entry number as its index + * and a 32 bit integer that gives the offset of the start of a chunk into + * its containing media file as its value. + * + * @return Array + */ + public function getChunkOffsetTable() { return $this->_chunkOffsetTable; } + + /** + * Sets an array of chunk offsets. Each entry must have the entry number as + * its index and a 32 bit integer that gives the offset of the start of a + * chunk into its containing media file as its value. + * + * @param Array $chunkOffsetTable The chunk offset array. + */ + public function setChunkOffsetTable($chunkOffsetTable) + { + $this->_chunkOffsetTable = $chunkOffsetTable; + } + + /** + * Returns the box raw data. + * + * @return string + */ + public function __toString($data = "") + { + $data = Transform::toUInt32BE(count($this->_chunkOffsetTable)); + foreach ($this->_chunkOffsetTable as $chunkOffset) + $data .= Transform::toUInt32BE($chunkOffset); + return parent::__toString($data); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STDP.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STDP.php new file mode 100644 index 0000000..a6eb4d6 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STDP.php @@ -0,0 +1,84 @@ +Degradation Priority Box contains the degradation priority of each + * sample. Specifications derived from this define the exact meaning and + * acceptable range of the priority field. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_STDP extends ISO14496_Box_Full +{ + /** @var Array */ + private $_values = array(); + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + while ($this->_reader->getOffset() < $this->getOffset() + $this->getSize()) + $this->_values[] = array("priority" => $this->_reader->readUInt16BE()); + } + + /** + * Returns an array of values. Each entry is an array containing the following + * keys. + * o priority: specifies the degradation priority for each sample segment. + * + * @return Array + */ + public function getValues() + { + return $this->_values; + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STSC.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STSC.php new file mode 100644 index 0000000..22c751d --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STSC.php @@ -0,0 +1,110 @@ +Sample To Chunk Box table can be used to find the chunk that + * contains a sample, its position, and the associated sample description. + * + * The table is compactly coded. Each entry gives the index of the first chunk + * of a run of chunks with the same characteristics. By subtracting one entry + * here from the previous one, you can compute how many chunks are in this run. + * You can convert this to a sample count by multiplying by the appropriate + * samplesPerChunk. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_STSC extends ISO14496_Box_Full +{ + /** @var Array */ + private $_sampleToChunkTable = array(); + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $entryCount = $this->_reader->readUInt32BE(); + $data = $this->_reader->read + ($this->getOffset() + $this->getSize() - $this->_reader->getOffset()); + for ($i = 1; $i <= $entryCount; $i++) + $this->_sampleToChunkTable[$i] = array + ("firstChunk" => + Transform::fromUInt32BE(substr($data, ($i - 1) * 12, 4)), + "samplesPerChunk" => + Transform::fromUInt32BE(substr($data, $i * 12 - 8, 4)), + "sampleDescriptionIndex" => + Transform::fromUInt32BE(substr($data, $i * 12 - 4, 4))); + } + + /** + * Returns an array of values. Each entry is an array containing the following + * keys. + * o firstChunk -- an integer that gives the index of the first chunk in + * this run of chunks that share the same samplesPerChunk and + * sampleDescriptionIndex; the index of the first chunk in a track has the + * value 1 (the firstChunk field in the first record of this box has the + * value 1, identifying that the first sample maps to the first chunk). + * o samplesPerChunk is an integer that gives the number of samples in each + * of these chunks. + * o sampleDescriptionIndex is an integer that gives the index of the sample + * entry that describes the samples in this chunk. The index ranges from 1 + * to the number of sample entries in the {@link ISO14496_Box_STSD Sample + * Description Box}. + * + * @return Array + */ + public function getSampleToChunkTable() + { + return $this->_sampleToChunkTable; + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STSD.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STSD.php new file mode 100644 index 0000000..cb13973 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STSD.php @@ -0,0 +1,56 @@ +Sample Description Box table gives detailed information about the + * coding type used, and any initialization information needed for that coding. + * + * @todo Data parsing + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 85 $ + */ +final class ISO14496_Box_STSD extends ISO14496_Box_Full +{ +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STSH.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STSH.php new file mode 100644 index 0000000..8dd6a6d --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STSH.php @@ -0,0 +1,117 @@ +Shadow Sync Sample Box table provides an optional set of sync + * samples that can be used when seeking or for similar purposes. In normal + * forward play they are ignored. + * + * Each entry in the Shadow Sync Table consists of a pair of sample numbers. The + * first entry (shadowedSampleNumber) indicates the number of the sample that a + * shadow sync will be defined for. This should always be a non-sync sample + * (e.g. a frame difference). The second sample number (syncSampleNumber) + * indicates the sample number of the sync sample (i.e. key frame) that can be + * used when there is a random access at, or before, the shadowedSampleNumber. + * + * The shadow sync samples are normally placed in an area of the track that is + * not presented during normal play (edited out by means of an edit list), + * though this is not a requirement. The shadow sync table can be ignored and + * the track will play (and seek) correctly if it is ignored (though perhaps not + * optimally). + * + * The Shadow Sync Sample replaces, not augments, the sample that it shadows + * (i.e. the next sample sent is shadowedSampleNumber+1). The shadow sync sample + * is treated as if it occurred at the time of the sample it shadows, having the + * duration of the sample it shadows. + * + * Hinting and transmission might become more complex if a shadow sample is used + * also as part of normal playback, or is used more than once as a shadow. In + * this case the hint track might need separate shadow syncs, all of which can + * get their media data from the one shadow sync in the media track, to allow + * for the different time-stamps etc. needed in their headers. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_STSH extends ISO14496_Box_Full +{ + /** @var Array */ + private $_shadowSyncSampleTable = array(); + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $entryCount = $this->_reader->readUInt32BE(); + $data = $this->_reader->read + ($this->getOffset() + $this->getSize() - $this->_reader->getOffset()); + for ($i = 0; $i < $entryCount; $i++) + $this->_shadowSyncSampleTable[$i] = array + ("shadowedSampleNumber" => + Transform::fromUInt32BE(substr($data, ($i - 1) * 8, 4)), + "syncSampleNumber" => + Transform::fromUInt32BE(substr($data, $i * 8 - 4, 4))); + } + + /** + * Returns an array of values. Each entry is an array containing the following + * keys. + * o shadowedSampleNumber - gives the number of a sample for which there is + * an alternative sync sample. + * o syncSampleNumber - gives the number of the alternative sync sample. + * + * @return Array + */ + public function getShadowSyncSampleTable() + { + return $this->_shadowSyncSampleTable; + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STSS.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STSS.php new file mode 100644 index 0000000..ca0d03f --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STSS.php @@ -0,0 +1,89 @@ +Sync Sample Box provides a compact marking of the random access + * points within the stream. The table is arranged in strictly increasing order + * of sample number. If the sync sample box is not present, every sample is a + * random access point. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_STSS extends ISO14496_Box_Full +{ + /** @var Array */ + private $_syncSampleTable = array(); + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $entryCount = $this->_reader->readUInt32BE(); + $data = $this->_reader->read + ($this->getOffset() + $this->getSize() - $this->_reader->getOffset()); + for ($i = 1; $i <= $entryCount; $i++) + $this->_syncSampleTable[$i] = + Transform::fromUInt32BE(substr($data, ($i - 1) * 4, 4)); + } + + /** + * Returns an array of values. Each entry has the entry number as its index + * and an integer that gives the numbers of the samples that are random access + * points in the stream as its value. + * + * @return Array + */ + public function getSyncSampleTable() + { + return $this->_syncSampleTable; + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STSZ.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STSZ.php new file mode 100644 index 0000000..21ba170 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STSZ.php @@ -0,0 +1,110 @@ +Sample Size Box contains the sample count and a table giving the + * size in bytes of each sample. This allows the media data itself to be + * unframed. The total number of samples in the media is always indicated in the + * sample count. + * + * There are two variants of the sample size box. The first variant has a fixed + * size 32-bit field for representing the sample sizes; it permits defining a + * constant size for all samples in a track. The second variant permits smaller + * size fields, to save space when the sizes are varying but small. One of these + * boxes must be present; the first version is preferred for maximum + * compatibility. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_STSZ extends ISO14496_Box_Full +{ + /** @var integer */ + private $_sampleSize; + + /** @var Array */ + private $_sampleSizeTable = array(); + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $this->_sampleSize = $this->_reader->readUInt32BE(); + $sampleCount = $this->_reader->readUInt32BE(); + if ($this->_sampleSize == 0) { + $data = $this->_reader->read + ($this->getOffset() + $this->getSize() - $this->_reader->getOffset()); + for ($i = 1; $i <= $sampleCount; $i++) + $this->_sampleSizeTable[$i] = + Transform::fromUInt32BE(substr($data, ($i - 1) * 4, 4)); + } + } + + /** + * Returns the default sample size. If all the samples are the same size, this + * field contains that size value. If this field is set to 0, then the samples + * have different sizes, and those sizes are stored in the sample size table. + * + * @return integer + */ + public function getSampleSize() { return $this->_sampleSize; } + + /** + * Returns an array of sample sizes specifying the size of a sample, indexed + * by its number. + * + * @return Array + */ + public function getSampleSizeTable() + { + return $this->_sampleSizeTable; + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STTS.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STTS.php new file mode 100644 index 0000000..ae0e39c --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STTS.php @@ -0,0 +1,110 @@ +Decoding Time to Sample Box contains a compact version of a table + * that allows indexing from decoding time to sample number. Other tables give + * sample sizes and pointers, from the sample number. Each entry in the table + * gives the number of consecutive samples with the same time delta, and the + * delta of those samples. By adding the deltas a complete time-to-sample map + * may be built. + * + * The Decoding Time to Sample Box contains decode time delta's: DT(n+1) = DT(n) + * + STTS(n) where STTS(n) is the (uncompressed) table entry for sample n. + * + * The sample entries are ordered by decoding time stamps; therefore the deltas + * are all non-negative. + * + * The DT axis has a zero origin; DT(i) = SUM(for j=0 to i-1 of delta(j)), and + * the sum of all deltas gives the length of the media in the track (not mapped + * to the overall timescale, and not considering any edit list). + * + * The {@link ISO14496_Box_ELST Edit List Box} provides the initial CT value if + * it is non-empty (non-zero). + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_STTS extends ISO14496_Box_Full +{ + /** @var Array */ + private $_timeToSampleTable = array(); + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $entryCount = $this->_reader->readUInt32BE(); + $data = $this->_reader->read + ($this->getOffset() + $this->getSize() - $this->_reader->getOffset()); + for ($i = 1; $i <= $entryCount; $i++) + $this->_timeToSampleTable[$i] = array + ("sampleCount" => + Transform::fromUInt32BE(substr($data, ($i - 1) * 8, 4)), + "sampleDelta" => + Transform::fromUInt32BE(substr($data, $i * 8 - 4, 4))); + } + + /** + * Returns an array of values. Each entry is an array containing the following + * keys. + * o sampleCount -- an integer that counts the number of consecutive samples + * that have the given duration. + * o sampleDelta -- an integer that gives the delta of these samples in the + * time-scale of the media. + * + * @return Array + */ + public function getTimeToSampleTable() + { + return $this->_timeToSampleTable; + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STZ2.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STZ2.php new file mode 100644 index 0000000..44ab096 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STZ2.php @@ -0,0 +1,109 @@ +Sample Size Box contains the sample count and a table giving the + * size in bytes of each sample. This allows the media data itself to be + * unframed. The total number of samples in the media is always indicated in the + * sample count. + * + * There are two variants of the sample size box. This variant permits smaller + * than 32-bit size fields, to save space when the sizes are varying but small. + * One of the boxes must be present; the {@link ISO14496_Box_STSZ another + * variant} is preferred for maximum compatibility. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_STZ2 extends ISO14496_Box_Full +{ + /** @var Array */ + private $_sampleSizeTable = array(); + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $this->_reader->skip(3); + $fieldSize = $this->_reader->readInt8(); + $sampleCount = $this->_reader->readUInt32BE(); + $data = $this->_reader->read + ($this->getOffset() + $this->getSize() - $this->_reader->getOffset()); + for ($i = 1; $i <= $sampleCount; $i++) { + switch ($fieldSize) { + case 4: + $this->_sampleSizeTable[$i] = + (($tmp = Transform::fromInt8($data[$i - 1])) >> 4) & 0xf; + if ($i + 1 < $sampleCount) + $this->_sampleSizeTable[$i++] = $tmp & 0xf; + break; + case 8: + $this->_sampleSizeTable[$i] = Transform::fromInt8($data[$i - 1]); + break; + case 16: + $this->_sampleSizeTable[$i] = + Transform::fromUInt16BE(substr($data, ($i - 1) * 2, 2)); + break; + } + } + } + + /** + * Returns an array of sample sizes specifying the size of a sample, indexed + * by its number. + * + * @return Array + */ + public function getSampleSizeTable() + { + return $this->_sampleSizeTable; + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/SUBS.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/SUBS.php new file mode 100644 index 0000000..83ae8ac --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/SUBS.php @@ -0,0 +1,138 @@ +Sub-Sample Information Box is designed to contain sub-sample + * information. + * + * A sub-sample is a contiguous range of bytes of a sample. The specific + * definition of a sub-sample shall be supplied for a given coding system (e.g. + * for ISO/IEC 14496-10, Advanced Video Coding). In the absence of such a + * specific definition, this box shall not be applied to samples using that + * coding system. + * + * If subsample_count is 0 for any entry, then those samples have no subsample + * information and no array follows. The table is sparsely coded; the table + * identifies which samples have sub-sample structure by recording the + * difference in sample-number between each entry. The first entry in the table + * records the sample number of the first sample having sub-sample information. + * + * Note: It is possible to combine subsamplePriority and discardable such that + * when subsamplePriority is smaller than a certain value, discardable is set to + * 1. However, since different systems may use different scales of priority + * values, to separate them is safe to have a clean solution for discardable + * sub-samples. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_SUBS extends ISO14496_Box_Full +{ + /** @var Array */ + private $_subSampleTable = array(); + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $entryCount = $this->_reader->readUInt32BE(); + for ($i = 0; $i < $entryCount; $i++) { + $entry = array(); + $entry["sampleDelta"] = $this->_reader->readUInt32BE(); + $entry["subsamples"] = array(); + if (($subsampleCount = $this->_reader->readUInt16BE()) > 0) { + for ($j = 0; $j < $subsampleCount; $j++) { + $subsample = array(); + if ($this->getVersion() == 1) + $subsample["subsampleSize"] = $this->_reader->readUInt32BE(); + else + $subsample["subsampleSize"] = $this->_reader->readUInt16BE(); + $subsample["subsamplePriority"] = $this->_reader->readInt8(); + $subsample["discardable"] = $this->_reader->readInt8(); + $this->_reader->skip(4); + $entry["subsamples"][] = $subsample; + } + $this->_subSampleTable[] = $entry; + } + } + } + + /** + * Returns an array of values. Each entry is an array containing the following + * keys. + * o sampleDelta -- an integer that specifies the sample number of the + * sample having sub-sample structure. It is coded as the difference + * between the desired sample number, and the sample number indicated in + * the previous entry. If the current entry is the first entry, the value + * indicates the sample number of the first sample having sub-sample + * information, that is, the value is the difference between the sample + * number and zero (0). + * o subsamples -- an array of subsample arrays, each containing the + * following keys. + * o subsampleSize -- an integer that specifies the size, in bytes, of + * the current sub-sample. + * o subsamplePriority -- an integer specifying the degradation priority + * for each sub-sample. Higher values of subsamplePriority, indicate + * sub-samples which are important to, and have a greater impact on, + * the decoded quality. + * o discardable -- equal to 0 means that the sub-sample is required to + * decode the current sample, while equal to 1 means the sub-sample is + * not required to decode the current sample but may be used for + * enhancements, e.g., the sub-sample consists of supplemental + * enhancement information (SEI) messages. + * + * @return Array + */ + public function getSubSampleTable() + { + return $this->_subSampleTable; + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/TFHD.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/TFHD.php new file mode 100644 index 0000000..53faac1 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/TFHD.php @@ -0,0 +1,190 @@ +Track Fragment Header Box to + * each track; and a track fragment can add zero or more contiguous runs of + * samples. The track fragment header sets up information and defaults used for + * those runs of samples. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_TFHD extends ISO14496_Box_Full +{ + /** @var integer */ + private $_trackId; + + /** @var integer */ + private $_defaultSampleDescriptionIndex; + + /** @var integer */ + private $_defaultSampleDuration; + + /** @var integer */ + private $_defaultSampleSize; + + /** @var integer */ + private $_defaultSampleFlags; + + /** + * Indicates indicates the presence of the baseDataOffset field. This provides + * an explicit anchor for the data offsets in each track run (see below). If + * not provided, the base-dataoffset for the first track in the movie fragment + * is the position of the first byte of the enclosing Movie Fragment Box, and + * for second and subsequent track fragments, the default is the end of the + * data defined by the preceding fragment. Fragments inheriting their offset + * in this way must all use the same data-reference (i.e., the data for these + * tracks must be in the same file). + */ + const BASE_DATA_OFFSET = 0x1; + + /** + * Indicates the presence of the sampleDescriptionIndex field, which + * over-rides, in this fragment, the default set up in the + * {@link ISO14496_Box_TREX Track Extends Box}. + */ + const SAMPLE_DESCRIPTION_INDEX = 0x2; + + /** Indicates the precense of the defaultSampleDuration field. */ + const DEFAULT_SAMPLE_DURATION = 0x8; + + /** Indicates the precense of the defaultSampleSize field. */ + const DEFAULT_SAMPLE_SIZE = 0x10; + + /** Indicates the precense of the defaultSampleFlags field. */ + const DEFAULT_SAMPLE_DURATION = 0x20; + + /** + * Indicates that the duration provided in either defaultSampleDuration, or by + * the defaultDuration in the {@link ISO14496_Box_TREX Track Extends Box}, is + * empty, i.e. that there are no samples for this time interval. + */ + const DURATION_IS_EMPTY = 0x10000; + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + * @todo The sample flags could be parsed further + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $this->_trackId = $this->_reader->readUInt32BE(); + if ($this->hasFlag(self::BASE_DATA_OFFSET)) + $this->_baseDataOffset = $this->_reader->readInt64BE(); + if ($this->hasFlag(self::SAMPLE_DESCRIPTION_INDEX)) + $this->_sampleDescriptionIndex = $this->_reader->readUInt32BE(); + if ($this->hasFlag(self::DEFAULT_SAMPLE_DURATION)) + $this->_defaultSampleDuration = $this->_reader->readUInt32BE(); + if ($this->hasFlag(self::DEFAULT_SAMPLE_SIZE)) + $this->_defaultSampleSize = $this->_reader->readUInt32BE(); + if ($this->hasFlag(self::DEFAULT_SAMPLE_FLAGS)) + $this->_defaultSampleFlags = $this->_reader->readUInt32BE(); + } + + /** + * Returns the track identifier. + * + * @return integer + */ + public function getTrackId() + { + return $this->_trackId; + } + + /** + * Returns the base offset to use when calculating data offsets. + * + * @return integer + */ + public function getBaseDataOffset() + { + return $this->_baseDataOffset; + } + + /** + * Returns the sample description index. + * + * @return integer + */ + public function getSampleDescriptionIndex() + { + return $this->_defaultSampleDescriptionIndex; + } + + /** + * Returns the default sample duration. + * + * @return integer + */ + public function getDefaultSampleDuration() + { + return $this->_defaultSampleDuration; + } + + /** + * Returns the default sample size. + * + * @return integer + */ + public function getDefaultSampleSize() + { + return $this->_defaultSampleSize; + } + + /** + * Returns the default sample flags. + * + * @return integer + */ + public function getDefaultSampleFlags() + { + return $this->_defaultSampleFlags; + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/TFRA.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/TFRA.php new file mode 100644 index 0000000..5e73844 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/TFRA.php @@ -0,0 +1,142 @@ +Track Fragment Random Access Box does not mean that + * all the samples are sync samples. Random access information in the + * {@link ISO14496_Box_TRUN Track Fragment Run Box}, + * {@link ISO14496_Box_TRAF Track Fragment Box} and + * {@link ISO14496_Box_TREX Track Fragment Box} shall be set appropriately + * regardless of the presence of this box. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_TFRA extends ISO14496_Box_Full +{ + /** @var integer */ + private $_trackId; + + /** @var Array */ + private $_degradationPriorityTable = array(); + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $this->_trackId = $this->_reader->readUInt32BE(); + + $trafNumberSize = (($tmp = $this->_reader->readUInt32BE()) >> 4) & 0x3; + $trunNumberSize = ($tmp >> 2) & 0x3; + $sampleNumberSize = $tmp & 0x3; + $entryCount = $this->_reader->readUInt32BE(); + for ($i = 1; $i <= $entryCount; $i++) { + $entry = array(); + if ($this->getVersion() == 1) { + $entry["time"] = $this->_reader->readInt64BE(); + $entry["moofOffset"] = $this->_reader->readInt64BE(); + } else { + $entry["time"] = $this->_reader->readUInt32BE(); + $entry["moofOffset"] = $this->_reader->readUInt32BE(); + } + $entry["trafNumber"] = + ($trafNumberSize == 4 ? $this->_reader->readUInt32BE() : + ($trafNumberSize == 8 ? $this->_reader->readInt64BE() : 0)); + $entry["trunNumber"] = + ($trunNumberSize == 4 ? $this->_reader->readUInt32BE() : + ($trunNumberSize == 8 ? $this->_reader->readInt64BE() : 0)); + $entry["sampleNumber"] = + ($sampleNumberSize == 4 ? $this->_reader->readUInt32BE() : + ($sampleNumberSize == 8 ? $this->_reader->readInt64BE() : 0)); + $this->_degradationPriorityTable[$i] = $entry; + } + } + + /** + * Returns the track identifier. + * + * @return integer + */ + public function getTrackId() { return $this->_trackId; } + + /** + * Returns an array of entries. Each entry is an array containing the + * following keys. + * o time -- a 32 or 64 bits integer that indicates the presentation time of + * the random access sample in units defined in the + * {@link ISO14496_Box_MDHD Media Header Box} of the associated track. + * o moofOffset -- a 32 or 64 bits integer that gives the offset of the + * {@link ISO14496_Box_MOOF Movie Fragment Box} used in this entry. Offset + * is the byte-offset between the beginning of the file and the beginning + * of the Movie Fragment Box. + * o trafNumber -- indicates the {@link ISO14496_Box_TRAF Track Fragment + * Box} number that contains the random accessible sample. The number + * ranges from 1 (the first traf is numbered 1) in each Track Fragment + * Box. + * o trunNumber -- indicates the {@link ISO14496_Box_TRUN Track Fragment Run + * Box} number that contains the random accessible sample. The number + * ranges from 1 in each Track Fragment Run Box. + * o sampleNumber -- indicates the sample number that contains the random + * accessible sample. The number ranges from 1 in each Track Fragment Run + * Box. + * + * @return Array + */ + public function getDegradationPriorityTable() + { + return $this->_degradationPriorityTable; + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/TKHD.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/TKHD.php new file mode 100644 index 0000000..e01013c --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/TKHD.php @@ -0,0 +1,177 @@ +Track Header Box specifies the characteristics of a single track. + * Exactly one Track Header Box is contained in a track. + * + * In the absence of an edit list, the presentation of a track starts at the + * beginning of the overall presentation. An empty edit is used to offset the + * start time of a track. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_TKHD extends ISO14496_Box_Full +{ + /** @var integer */ + private $_creationTime; + + /** @var integer */ + private $_modificationTime; + + /** @var integer */ + private $_trackId; + + /** @var integer */ + private $_duration; + + /** @var integer */ + private $_width; + + /** @var integer */ + private $_height; + + /** + * Indicates that the track is enabled. A disabled track is treated as if it + * were not present. + */ + const TRACK_ENABLED = 1; + + /** Indicates that the track is used in the presentation. */ + const TRACK_IN_MOVIE = 2; + + /** Indicates that the track is used when previewing the presentation. */ + const TRACK_IN_PREVIEW = 4; + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + if ($this->getVersion() == 1) { + $this->_creationTime = $this->_reader->readInt64BE(); + $this->_modificationTime = $this->_reader->readInt64BE(); + $this->_trackId = $this->_reader->readUInt32BE(); + $this->_reader->skip(4); + $this->_duration = $this->_reader->readInt64BE(); + } else { + $this->_creationTime = $this->_reader->readUInt32BE(); + $this->_modificationTime = $this->_reader->readUInt32BE(); + $this->_trackId = $this->_reader->readUInt32BE(); + $this->_reader->skip(4); + $this->_duration = $this->_reader->readUInt32BE(); + } + $this->_reader->skip(52); + $this->_width = + ((($tmp = $this->_reader->readUInt32BE()) >> 16) & 0xffff) + + ($tmp & 0xffff) / 10; + $this->_height = + ((($tmp = $this->_reader->readUInt32BE()) >> 16) & 0xffff) + + ($tmp & 0xffff) / 10; + } + + /** + * Returns the creation time of this track in seconds since midnight, Jan. 1, + * 1904, in UTC time. + * + * @return integer + */ + public function getCreationTime() { return $this->_creationTime; } + + /** + * Returns the most recent time the track was modified in seconds since + * midnight, Jan. 1, 1904, in UTC time. + * + * @return integer + */ + public function getModificationTime() { return $this->_modificationTime; } + + /** + * Returns a number that uniquely identifies this track over the entire + * life-time of this presentation. Track IDs are never re-used and cannot be + * zero. + * + * @return integer + */ + public function getTrackId() { return $this->_trackId; } + + /** + * Returns the duration of this track (in the timescale indicated in the + * {@link MVHD Movie Header Box}). The value of this field is equal to the sum + * of the durations of all of the track's edits. If there is no edit list, + * then the duration is the sum of the sample durations, converted into the + * timescale in the {@link MVHD Movie Header Box}. If the duration of this + * track cannot be determined then duration is set to all 32-bit maxint. + * + * @return integer + */ + public function getDuration() { return $this->_duration; } + + /** + * Returns the track's visual presentation width. This needs not be the same + * as the pixel width of the images; all images in the sequence are scaled to + * this width, before any overall transformation of the track represented by + * the matrix. The pixel width of the images is the default value. + * + * @return integer + */ + public function getWidth() { return $this->_rate; } + + /** + * Returns the track's visual presentation height. This needs not be the same + * as the pixel height of the images; all images in the sequence are scaled to + * this height, before any overall transformation of the track represented by + * the matrix. The pixel height of the images is the default value. + * + * @return integer + */ + public function getHeight() { return $this->_volume; } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/TRAF.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/TRAF.php new file mode 100644 index 0000000..9ce8601 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/TRAF.php @@ -0,0 +1,77 @@ +Track Fragment Box there is a set of track fragments, zero + * or more per track. The track fragments in turn contain zero or more track + * runs, each of which document a contiguous run of samples for that track. + * + * Within these structures, many fields are optional and can be defaulted. It is + * possible to add empty time to a track using these structures, as well as + * adding samples. Empty inserts can be used in audio tracks doing silence + * suppression, for example. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_TRAF extends ISO14496_Box +{ + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + $this->setContainer(true); + + if ($reader === null) + return; + + $this->constructBoxes(); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/TRAK.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/TRAK.php new file mode 100644 index 0000000..152ab02 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/TRAK.php @@ -0,0 +1,83 @@ +Track Box is a container box for a single track of a presentation. + * A presentation consists of one or more tracks. Each track is independent of + * the other tracks in the presentation and carries its own temporal and spatial + * information. Each track will contain its associated {@link ISO14496_Box_MDIA + * Media Box}. + * + * Tracks are used for two purposes: + * (a) to contain media data (media tracks) and + * (b) to contain packetization information for streaming protocols + * (hint tracks). + * There shall be at least one media track within an ISO file, and all the media + * tracks that contributed to the hint tracks shall remain in the file, even if + * the media data within them is not referenced by the hint tracks; after + * deleting all hint tracks, the entire un-hinted presentation shall remain. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_TRAK extends ISO14496_Box +{ + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + $this->setContainer(true); + + if ($reader === null) + return; + + $this->constructBoxes(); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/TREF.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/TREF.php new file mode 100644 index 0000000..f5f3815 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/TREF.php @@ -0,0 +1,81 @@ +Track Reference Box provides a reference from the containing track + * to another track in the presentation. These references are typed. A {@link + * ISO14496_Box_HINT hint} reference links from the containing hint track to the + * media data that it hints. A content description reference {@link + * ISO14496_Box_CDSC cdsc} links a descriptive or metadata track to the content + * which it describes. + * + * Exactly one Track Reference Box can be contained within the {@link + * ISO14496_Box_TRAK Track Box}. + * + * If this box is not present, the track is not referencing any other track in + * any way. The reference array is sized to fill the reference type box. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_TREF extends ISO14496_Box +{ + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + $this->setContainer(true); + + if ($reader === null) + return; + + $this->constructBoxes(); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/TREX.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/TREX.php new file mode 100644 index 0000000..854c14e --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/TREX.php @@ -0,0 +1,138 @@ +Track Extends Box sets up default values used by the movie + * fragments. By setting defaults in this way, space and complexity can be saved + * in each {@link ISO14496_Box_TRAF Track Fragment Box}. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_TREX extends ISO14496_Box_Full +{ + /** @var integer */ + private $_trackId; + + /** @var integer */ + private $_defaultSampleDescriptionIndex; + + /** @var integer */ + private $_defaultSampleDuration; + + /** @var integer */ + private $_defaultSampleSize; + + /** @var integer */ + private $_defaultSampleFlags; + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + * @todo The sample flags could be parsed further + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $this->_trackId = $this->_reader->readUInt32BE(); + $this->_defaultSampleDescriptionIndex = $this->_reader->readUInt32BE(); + $this->_defaultSampleDuration = $this->_reader->readUInt32BE(); + $this->_defaultSampleSize = $this->_reader->readUInt32BE(); + $this->_defaultSampleFlags = $this->_reader->readUInt32BE(); + } + + /** + * Returns the default track identifier. + * + * @return integer + */ + public function getTrackId() + { + return $this->_trackId; + } + + /** + * Returns the default sample description index. + * + * @return integer + */ + public function getDefaultSampleDescriptionIndex() + { + return $this->_defaultSampleDescriptionIndex; + } + + /** + * Returns the default sample duration. + * + * @return integer + */ + public function getDefaultSampleDuration() + { + return $this->_defaultSampleDuration; + } + + /** + * Returns the default sample size. + * + * @return integer + */ + public function getDefaultSampleSize() + { + return $this->_defaultSampleSize; + } + + /** + * Returns the default sample flags. + * + * @return integer + */ + public function getDefaultSampleFlags() + { + return $this->_defaultSampleFlags; + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/TRUN.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/TRUN.php new file mode 100644 index 0000000..d6a51d2 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/TRUN.php @@ -0,0 +1,149 @@ +Track Fragment Run Boxes. If the durationIsEmpty flag is set, + * there are no track runs. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_TRUN extends ISO14496_Box_Full +{ + /** @var integer */ + private $_dataOffset; + + /** @var Array */ + private $_samples = array(); + + /** Indicates the precense of the dataOffset field. */ + const DATA_OFFSET = 0x1; + + /** + * Indicates the precense of the firstSampleFlags field; this over-rides the + * default flags for the first sample only. This makes it possible to record + * a group of frames where the first is a key and the rest are difference + * frames, without supplying explicit flags for every sample. If this flag and + * field are used, sampleFlags field shall not be present. + */ + const FIRST_SAMPLE_FLAGS = 0x4; + + /** + * Indicates that each sample has its own duration, otherwise the default is + * used. + */ + const SAMPLE_DURATION = 0x100; + + /** + * Indicates that each sample has its own size, otherwise the default is used. + */ + const SAMPLE_SIZE = 0x200; + + /** + * Indicates that each sample has its own flags, otherwise the default is + * used. + */ + const SAMPLE_FLAGS = 0x400; + + /** + * Indicates that each sample has a composition time offset (e.g. as used for + * I/P/B video in MPEG). + */ + const SAMPLE_COMPOSITION_TIME_OFFSETS = 0x800; + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $flags = $this->_flags; + $sampleCount = $this->_reader->readUInt32BE(); + + if ($this->hasFlag(self::DATA_OFFSET)) + $this->_dataOffset = $this->_reader->readInt32BE(); + if ($this->hasFlag(self::FIRST_SAMPLE_FLAGS)) + $this->_flags = $this->_reader->readUInt32BE(); + + for ($i = 0; $i < $sampleCount; $i++) { + $sample = array(); + if ($this->hasFlag(self::SAMPLE_DURATION)) + $sample["duration"] = $this->_reader->readUInt32BE(); + if ($this->hasFlag(self::SAMPLE_SIZE)) + $sample["size"] = $this->_reader->readUInt32BE(); + if ($this->hasFlag(self::SAMPLE_FLAGS)) + $sample["flags"] = $this->_reader->readUInt32BE(); + if ($this->hasFlag(self::SAMPLE_COMPOSITION_TIME_OFFSET)) + $sample["compositionTimeOffset"] = $this->_reader->readUInt32BE(); + $this->_samples[] = $sample; + $this->_flags = $flags; + } + } + + /** + * Returns the data offset. + * + * @return integer + */ + public function getDataOffset() + { + return $this->_trackId; + } + + /** + * Returns the array of samples. + * + * @return Array + */ + public function getSamples() + { + return $this->_samples; + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/UDTA.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/UDTA.php new file mode 100644 index 0000000..e55d63f --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/UDTA.php @@ -0,0 +1,75 @@ +User Data Box contains objects that declare user information about + * the containing box and its data (presentation or track). + * + * The User Data Box is a container box for informative user-data. This user + * data is formatted as a set of boxes with more specific box types, which + * declare more precisely their content. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_UDTA extends ISO14496_Box +{ + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + $this->setContainer(true); + + if ($reader === null) + return; + + $this->constructBoxes(); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/URL.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/URL.php new file mode 100644 index 0000000..593765b --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/URL.php @@ -0,0 +1,83 @@ + + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_URL extends ISO14496_Box_Full +{ + /** @var string */ + private $_location; + + /** + * Indicates that the media data is in the same file as the Movie Box + * containing this data reference. + */ + const SELFCONTAINED = 1; + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $this->_location = $this->_reader->read + ($this->getOffset() + $this->getSize() - $this->_reader->getOffset()); + } + + /** + * Returns the location. + * + * @return string + */ + public function getLocation() { return $this->_location; } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/URN.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/URN.php new file mode 100644 index 0000000..dc5ae1d --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/URN.php @@ -0,0 +1,94 @@ + + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_URN extends ISO14496_Box_Full +{ + /** @var string */ + private $_name; + + /** @var string */ + private $_location; + + /** + * Indicates that the media data is in the same file as the Movie Box + * containing this data reference. + */ + const SELFCONTAINED = 1; + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + list ($this->_name, $this->_location) = preg_split + ("/\\x00/", $this->_reader->read + ($this->getOffset() + $this->getSize() - $this->_reader->getOffset())); + } + + /** + * Returns the name. + * + * @return string + */ + public function getName() { return $this->_name; } + + /** + * Returns the location. + * + * @return string + */ + public function getLocation() { return $this->_location; } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/VMHD.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/VMHD.php new file mode 100644 index 0000000..b661946 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/VMHD.php @@ -0,0 +1,65 @@ +Video Media Header Box contains general presentation information, + * independent of the coding, for video media. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_VMHD extends ISO14496_Box_Full +{ + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/XML.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/XML.php new file mode 100644 index 0000000..c2efbc3 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/XML.php @@ -0,0 +1,87 @@ +XML Box forms may be used. + * The {@link ISO14496_Box_BXML Binary XML Box} may only be used when there is a + * single well-defined binarization of the XML for that defined format as + * identified by the handler. + * + * Within an XML box the data is in UTF-8 format unless the data starts with a + * byte-order-mark (BOM), which indicates that the data is in UTF-16 format. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_XML extends ISO14496_Box_Full +{ + /** @var string */ + private $_xml; + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $this->_xml = $this->_reader->read + ($this->getOffset() + $this->getSize() - $this->_reader->getOffset()); + } + + /** + * Returns the XML data. + * + * @return string + */ + public function getXml() + { + return $this->_xml; + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Exception.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Exception.php new file mode 100644 index 0000000..c34f8f1 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Exception.php @@ -0,0 +1,51 @@ + + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 85 $ + */ +class ISO14496_Exception extends Exception +{ +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/Magic.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/Magic.php new file mode 100644 index 0000000..ab5b81d --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/Magic.php @@ -0,0 +1,177 @@ +1 -- byte number to begin checking from. ">" indicates a dependency + * upon the previous non-">" line + * o 2 -- type of data to match. Can be one of following + * - byte (single character) + * - short (machine-order 16-bit integer) + * - long (machine-order 32-bit integer) + * - string (arbitrary-length string) + * - date (long integer date (seconds since Unix epoch/1970)) + * - beshort (big-endian 16-bit integer) + * - belong (big-endian 32-bit integer) + * - bedate (big-endian 32-bit integer date) + * - leshort (little-endian 16-bit integer) + * - lelong (little-endian 32-bit integer) + * - ledate (little-endian 32-bit integer date) + * o 3 -- contents of data to match + * o 4 -- file description/MIME type if matched + * o 5 -- optional MIME encoding if matched and if above was a MIME type + * + * @package php-reader + * @author Sven Vollbehr + * @copyright Copyright (c) 2006-2008 PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 73 $ + */ +final class Magic +{ + /** @var string */ + private $_magic; + + /** + * Reads the magic information from given magic file. + * + * @param string $filename The path to the magic file. + */ + public function __construct($filename) + { + $reader = new Reader($filename); + $this->_magic = $reader->read($reader->getSize()); + } + + /** + * Returns the recognized MIME type/description of the given file. The type + * is determined by the content using magic bytes characteristic for the + * particular file type. + * + * If the type could not be found, the function returns the default value, or + * false. + * + * @param string $filename The file path whose type to determine. + * @param string $default The default value. + * @return string|false + */ + public function getType($filename, $default = false) + { + $reader = new Reader($filename); + + $parentOffset = 0; + foreach (preg_split("/^/m", $this->_magic) as $line) { + $chunks = array(); + if (!preg_match("/^(?P>?)(?P\d+)\s+(?P\S+)" . + "\s+(?P\S+)(?:\s+(?P[a-z]+\/[a-z-" . + "0-9]+)?(?:\s+(?P.+))?)?$/", $line, $chunks)) + continue; + + if ($chunks["Dependant"]) { + $reader->setOffset($parentOffset); + $reader->skip($chunks["Byte"]); + } else + $reader->setOffset($parentOffset = $chunks["Byte"]); + + $matchType = strtolower($chunks["MatchType"]); + $matchData = preg_replace + (array("/\\\\ /", "/\\\\\\\\/", "/\\\\([0-7]{1,3})/e", + "/\\\\x([0-9A-Fa-f]{1,2})/e", "/0x([0-9A-Fa-f]+)/e"), + array(" ", "\\\\", "pack(\"H*\", base_convert(\"$1\", 8, 16));", + "pack(\"H*\", \"$1\");", "hexdec(\"$1\");"), + $chunks["MatchData"]); + + switch ($matchType) { + case "byte": // single character + $data = $reader->readInt8(); + break; + case "short": // machine-order 16-bit integer + $data = $reader->readInt16(); + break; + case "long": // machine-order 32-bit integer + $data = $reader->readInt32(); + break; + case "string": // arbitrary-length string + $data = $reader->readString8(strlen($matchData)); + break; + case "date": // long integer date (seconds since Unix epoch/1970) + $data = $reader->readInt64BE(); + break; + case "beshort": // big-endian 16-bit integer + $data = $reader->readUInt16BE(); + break; + case "belong": // big-endian 32-bit integer + case "bedate": // big-endian 32-bit integer date + $data = $reader->readUInt32BE(); + break; + case "leshort": // little-endian 16-bit integer + $data = $reader->readUInt16LE(); + break; + case "lelong": // little-endian 32-bit integer + case "ledate": // little-endian 32-bit integer date + $data = $reader->readUInt32LE(); + break; + default: + $data = null; + break; + } + + if (strcmp($data, $matchData) == 0) { + if (!empty($chunks["MIMEType"])) + return $chunks["MIMEType"]; + if (!empty($chunks["Description"])) + return $chunks["Description"]; + } + } + return $default; + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/Reader.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/Reader.php new file mode 100644 index 0000000..98678b6 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/Reader.php @@ -0,0 +1,216 @@ + + * @author Ryan Butterfield + * @copyright Copyright (c) 2006-2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 104 $ + */ +class Reader +{ + /** @var resource */ + private $_fd; + + /** @var integer */ + private $_size; + + /** + * Constructs the Reader class with given file. + * + * @param string $filename The path to the file. + * @param string $mode The type of access. + * @throws Reader_Exception if the file cannot be read. + */ + public function __construct($filename, $mode = "rb") + { + if (is_resource($filename) && + in_array(get_resource_type($filename), array("file", "stream"))) + $this->_fd = $filename; + else if (($this->_fd = fopen($filename, $mode)) === false) + throw new Reader_Exception("Unable to open file:" . $filename); + + fseek($this->_fd, 0, SEEK_END); + $this->_size = ftell($this->_fd); + fseek($this->_fd, 0); + } + + /** + * Closes the file. + */ + public function __destruct() + { + @fclose($this->_fd); + } + + /** + * Checks whether there is more to be read in the file. Returns + * true if the end of the file has not yet been reached; + * false otherwise. + * + * @return boolean + */ + public function available() + { + return $this->getOffset() < $this->_size; + } + + /** + * Jumps size amount of bytes in the file stream. + * + * @param integer $size The amount of bytes. + * @return void + * @throws Reader_Exception if size attribute is negative. + */ + public function skip($size) + { + if ($size < 0) + throw new Reader_Exception("Invalid argument"); + if ($size == 0) + return; + fseek($this->_fd, $size, SEEK_CUR); + } + + /** + * Reads length amount of bytes from the file stream. + * + * @param integer $length The amount of bytes. + * @return string + * @throws Reader_Exception if length attribute is negative. + */ + public function read($length) + { + if ($length < 0) + throw new Reader_Exception("Invalid argument"); + if ($length == 0) + return ""; + return fread($this->_fd, $length); + } + + /** + * Returns the current point of operation. + * + * @return integer + */ + public function getOffset() + { + return ftell($this->_fd); + } + + /** + * Sets the point of operation, ie the cursor offset value. The offset can + * also be set to a negative value when it is interpreted as an offset from + * the end of the file instead of the beginning. + * + * @param integer $offset The new point of operation. + * @return void + */ + public function setOffset($offset) + { + fseek($this->_fd, $offset < 0 ? $this->_size + $offset : $offset); + } + + /** + * Returns the file size in bytes. + * + * @return integer + */ + public function getSize() { return $this->_size; } + + /** + * Magic function so that $obj->value will work. + * + * @param string $name The field name. + * @return mixed + */ + public function __get($name) { + if (method_exists($this, "get" . ucfirst(strtolower($name)))) + return call_user_func(array($this, "get" . ucfirst(strtolower($name)))); + else throw new Reader_Exception("Unknown field: " . $name); + } + + /** + * Magic function so that assignments with $obj->value will work. + * + * @param string $name The field name. + * @param string $value The field value. + * @return mixed + */ + public function __set($name, $value) { + if (method_exists($this, "set" . ucfirst(strtolower($name)))) + call_user_func + (array($this, "set" . ucfirst(strtolower($name))), $value); + else throw new Reader_Exception("Unknown field: " . $name); + } + + /** + * Magic function to delegate the call to helper methods of + * Transform class to transform read data in another format. + * + * The read data length is determined from the helper method name. For methods + * where arbitrary data lengths are accepted a parameter can be used to + * specify the length. + * + * @param string $method The method to be called. + * @param string $params The parameters should the function accept them. + * @return mixed + * @throws Reader_Exception if no such transformer is implemented + */ + public function __call($method, $params) { + $chunks = array(); + if (preg_match + ("/read([a-z]{3,6})?(\d{1,2})?(?:LE|BE)?/i", $method, $chunks) && + method_exists("Transform", preg_replace("/^read/", "from", $method))) { + return call_user_func + (array("Transform", preg_replace("/^read/", "from", $method)), + $this->read(preg_match("/String|(?:H|L)Hex/", $chunks[1]) ? + (isset($params[0]) ? $params[0] : 1) : + ($chunks[1] == "GUID" ? 16 : $chunks[2] / 8))); + } else throw new Reader_Exception("Unknown method: " . $method); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/Reader/Exception.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/Reader/Exception.php new file mode 100644 index 0000000..41d7018 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/Reader/Exception.php @@ -0,0 +1,49 @@ + + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 39 $ + */ +class Reader_Exception extends Exception +{ +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/Transform.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/Transform.php new file mode 100644 index 0000000..b39cd06 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/Transform.php @@ -0,0 +1,745 @@ + + * @author Ryan Butterfield + * @copyright Copyright (c) 2006-2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 105 $ + * @static + */ +final class Transform +{ + const MACHINE_ENDIAN_ORDER = 0; + const LITTLE_ENDIAN_ORDER = 1; + const BIG_ENDIAN_ORDER = 2; + + /** + * Default private constructor for a static class. + */ + private function __construct() {} + + /** + * Returns whether the current machine endian order is little endian. + * + * @return boolean + */ + public static function isLittleEndian() + { + return self::fromInt32("\x01\x00\x00\x00") == 1; + } + + /** + * Returns whether the current machine endian order is big endian. + * + * @return boolean + */ + public static function isBigEndian() + { + return self::fromInt32("\x00\x00\x00\x01") == 1; + } + + /** + * Returns 64-bit float as little-endian ordered binary data string. + * + * @param integer $value The input value. + * @return string + */ + public static function toInt64LE($value) + { + return pack("V*", $value & 0xffffffff, $value / (0xffffffff+1)); + } + + /** + * Returns little-endian ordered binary data as 64-bit float. PHP does not + * support 64-bit integers as the long integer is of 32-bits but using + * aritmetic operations it is implicitly converted into floating point which + * is of 64-bits long. + * + * @param string $value The binary data string. + * @return integer + */ + public static function fromInt64LE($value) + { + list(, $lolo, $lohi, $hilo, $hihi) = unpack("v*", $value); + return ($hihi * (0xffff+1) + $hilo) * (0xffffffff+1) + + ($lohi * (0xffff+1) + $lolo); + } + + /** + * Returns 64-bit float as big-endian ordered binary data string. + * + * @param integer $value The input value. + * @return string + */ + public static function toInt64BE($value) + { + return pack("N*", $value / (0xffffffff+1), $value & 0xffffffff); + } + + /** + * Returns big-endian ordered binary data as 64-bit float. PHP does not + * support 64-bit integers as the long integer is of 32-bits but using + * aritmetic operations it is implicitly converted into floating point which + * is of 64-bits long. + * + * @param string $value The binary data string. + * @return integer + */ + public static function fromInt64BE($value) + { + list(, $hihi, $hilo, $lohi, $lolo) = unpack("n*", $value); + return ($hihi * (0xffff+1) + $hilo) * (0xffffffff+1) + + ($lohi * (0xffff+1) + $lolo); + } + + /** + * Returns signed 32-bit integer as machine-endian ordered binary data. + * + * @param integer $value The input value. + * @return string + */ + public static function toInt32($value) + { + return pack("l*", $value); + } + + /** + * Returns machine-endian ordered binary data as signed 32-bit integer. + * + * @param string $value The binary data string. + * @return integer + */ + public static function fromInt32($value) + { + list(, $int) = unpack("l*", $value); + return $int; + } + + /** + * Returns signed 32-bit integer as little-endian ordered binary data. + * + * @param integer $value The input value. + * @return string + */ + public static function toInt32LE($value) + { + if (self::isBigEndian()) + return strrev(self::toInt32($value)); + else + return self::toInt32($value); + } + + /** + * Returns little-endian ordered binary data as signed 32-bit integer. + * + * @param string $value The binary data string. + * @return integer + */ + public static function fromInt32LE($value) + { + if (self::isBigEndian()) + return self::fromInt32(strrev($value)); + else + return self::fromInt32($value); + } + + /** + * Returns signed 32-bit integer as big-endian ordered binary data. + * + * @param integer $value The input value. + * @return string + */ + public static function toInt32BE($value) + { + if (self::isBigEndian()) + return self::toInt32($value); + else + return strrev(self::toInt32($value)); + } + + /** + * Returns big-endian ordered binary data as signed 32-bit integer. + * + * @param string $value The binary data string. + * @return integer + */ + public static function fromInt32BE($value) + { + if (self::isBigEndian()) + return self::fromInt32($value); + else + return self::fromInt32(strrev($value)); + } + + /** + * Returns unsigned 32-bit integer as little-endian ordered binary data. + * + * @param integer $value The input value. + * @return string + */ + public static function toUInt32LE($value) + { + return pack("V*", $value); + } + + /** + * Returns little-endian ordered binary data as unsigned 32-bit integer. + * + * @param string $value The binary data string. + * @return integer + */ + public static function fromUInt32LE($value) + { + if (PHP_INT_SIZE < 8) { + list(, $lo, $hi) = unpack("v*", $value); + return $hi * (0xffff+1) + $lo; // eq $hi << 16 | $lo + } else { + list(, $int) = unpack("V*", $value); + return $int; + } + } + + /** + * Returns unsigned 32-bit integer as big-endian ordered binary data. + * + * @param integer $value The input value. + * @return string + */ + public static function toUInt32BE($value) + { + return pack("N*", $value); + } + + /** + * Returns big-endian ordered binary data as unsigned 32-bit integer. + * + * @param string $value The binary data string. + * @return integer + */ + public static function fromUInt32BE($value) + { + if (PHP_INT_SIZE < 8) { + list(, $hi, $lo) = unpack("n*", $value); + return $hi * (0xffff+1) + $lo; // eq $hi << 16 | $lo + } else { + list(, $int) = unpack("N*", $value); + return $int; + } + } + + /** + * Returns signed 16-bit integer as machine endian ordered binary data. + * + * @param integer $value The input value. + * @return string + */ + public static function toInt16($value) + { + return pack("s*", $value); + } + + /** + * Returns machine endian ordered binary data as signed 16-bit integer. + * + * @param string $value The binary data string. + * @return integer + */ + public static function fromInt16($value) + { + list(, $int) = unpack("s*", $value); + return $int; + } + + /** + * Returns signed 16-bit integer as little-endian ordered binary data. + * + * @param integer $value The input value. + * @return string + */ + public static function toInt16LE($value) + { + if (self::isBigEndian()) + return strrev(self::toInt16($value)); + else + return self::toInt16($value); + } + + /** + * Returns little-endian ordered binary data as signed 16-bit integer. + * + * @param string $value The binary data string. + * @return integer + */ + public static function fromInt16LE($value) + { + if (self::isBigEndian()) + return self::fromInt16(strrev($value)); + else + return self::fromInt16($value); + } + + /** + * Returns signed 16-bit integer as big-endian ordered binary data. + * + * @param integer $value The input value. + * @return string + */ + public static function toInt16BE($value) + { + if (self::isBigEndian()) + return self::toInt16($value); + else + return strrev(self::toInt16($value)); + } + + /** + * Returns big-endian ordered binary data as signed 16-bit integer. + * + * @param string $value The binary data string. + * @return integer + */ + public static function fromInt16BE($value) + { + if (self::isBigEndian()) + return self::fromInt16($value); + else + return self::fromInt16(strrev($value)); + } + + /** + * Returns machine endian ordered binary data as unsigned 16-bit integer. + * + * @param string $value The binary data string. + * @param integer $order The byte order of the binary data string. + * @return integer + */ + private static function fromUInt16($value, $order = self::MACHINE_ENDIAN_ORDER) + { + list(, $int) = unpack + (($order == self::BIG_ENDIAN_ORDER ? "n" : + ($order == self::LITTLE_ENDIAN_ORDER ? "v" : "S")) . "*", $value); + return $int; + } + + /** + * Returns unsigned 16-bit integer as little-endian ordered binary data. + * + * @param integer $value The input value. + * @return string + */ + public static function toUInt16LE($value) + { + return pack("v*", $value); + } + + /** + * Returns little-endian ordered binary data as unsigned 16-bit integer. + * + * @param string $value The binary data string. + * @return integer + */ + public static function fromUInt16LE($value) + { + return self::fromUInt16($value, self::LITTLE_ENDIAN_ORDER); + } + + /** + * Returns unsigned 16-bit integer as big-endian ordered binary data. + * + * @param integer $value The input value. + * @return string + */ + public static function toUInt16BE($value) + { + return pack("n*", $value); + } + + /** + * Returns big-endian ordered binary data as unsigned 16-bit integer. + * + * @param string $value The binary data string. + * @return integer + */ + public static function fromUInt16BE($value) + { + return self::fromUInt16($value, self::BIG_ENDIAN_ORDER); + } + + /** + * Returns an 8-bit integer as binary data. + * + * @param integer $value The input value. + * @return integer + */ + public static function toInt8($value) + { + return pack("c*", $value); + } + + /** + * Returns binary data as 8-bit integer. + * + * @param string $value The binary data string. + * @return integer + */ + public static function fromInt8($value) + { + list(, $int) = unpack("c*", $value); + return $int; + } + + /** + * Returns an unsigned 8-bit integer as binary data. + * + * @param integer $value The input value. + * @return integer + */ + public static function toUInt8($value) + { + return pack("C*", $value); + } + + /** + * Returns binary data as an unsigned 8-bit integer. + * + * @param string $value The binary data string. + * @return integer + */ + public static function fromUInt8($value) + { + list(, $int) = unpack("C*", $value); + return $int; + } + + /** + * Returns a floating point number as machine endian ordered binary data. + * + * @param float $value The input value. + * @return string + */ + public static function toFloat($value) + { + return pack("f*", $value); + } + + /** + * Returns machine endian ordered binary data as a floating point number. + * + * @param string $value The binary data string. + * @return float + */ + public static function fromFloat($value) + { + list(, $float) = unpack("f*", $value); + return $float; + } + + /** + * Returns a floating point number as little-endian ordered binary data. + * + * @param float $value The input value. + * @return string + */ + public static function toFloatLE($value) + { + if (self::isBigEndian()) + return strrev(self::toFloat($value)); + else + return self::toFloat($value); + } + + /** + * Returns little-endian ordered binary data as a floating point number. + * + * @param string $value The binary data string. + * @return float + */ + public static function fromFloatLE($value) + { + if (self::isBigEndian()) + return self::fromFloat(strrev($value)); + else + return self::fromFloat($value); + } + + /** + * Returns a floating point number as big-endian ordered binary data. + * + * @param float $value The input value. + * @return string + */ + public static function toFloatBE($value) + { + if (self::isBigEndian()) + return self::toFloat($value); + else + return strrev(self::toFloat($value)); + } + + /** + * Returns big-endian ordered binary data as a float point number. + * + * @param string $value The binary data string. + * @return float + */ + public static function fromFloatBE($value) + { + if (self::isBigEndian()) + return self::fromFloat($value); + else + return self::fromFloat(strrev($value)); + } + + /** + * Returns string as binary data padded to given length with zeros. + * + * @param string $value The input value. + * @return string + */ + public static function toString8($value, $length, $padding = "\0") + { + return str_pad($value, $length, $padding); + } + + /** + * Returns binary data as string. Removes terminating zero. + * + * @param string $value The binary data string. + * @return string + */ + public static function fromString8($value) + { + return rtrim($value, "\0"); + } + + /** + * Returns machine-ordered multibyte string as UTF-16 defined-order binary + * data. The byte order is stored using a byte order mask (BOM) in the binary + * data string. + * + * @param string $value The input value. + * @param integer $order The byte order of the binary data string. + * @return string + */ + public static function toString16($value, $order = self::MACHINE_ENDIAN_ORDER) + { + $format = $order == self::BIG_ENDIAN_ORDER ? "n" : + ($order == self::LITTLE_ENDIAN_ORDER ? "v" : "S"); + $string = pack($format, 0xfeff); + foreach (unpack("S*", $value) as $char) + $string .= pack($format, $char); + return $string; + } + + /** + * Returns UTF-16 formatted binary data as machine-ordered multibyte string. + * The byte order is determined from the byte order mark included in the + * binary data string. The order parameter is updated if a BOM is found. + * + * @param string $value The binary data string. + * @param integer $order The endian to decode using if no BOM was found. + * @return string + */ + public static function fromString16 + ($value, &$order = self::MACHINE_ENDIAN_ORDER) + { + if (strlen($value) < 2) + return ""; + + if (ord($value[0]) == 0xfe && ord($value[1]) == 0xff) { + $order = self::BIG_ENDIAN_ORDER; + return self::fromString16BE(substr($value, 2)); + } + else if (ord($value[0]) == 0xff && ord($value[1]) == 0xfe) { + $order = self::LITTLE_ENDIAN_ORDER; + return self::fromString16LE(substr($value, 2)); + } + else if ($order == self::BIG_ENDIAN_ORDER || + ($order == self::MACHINE_ENDIAN_ORDER && self::isBigEndian())) + return self::fromString16BE($value); + else + return self::fromString16LE($value); + } + + /** + * Returns machine-ordered multibyte string as little-endian ordered binary + * data. + * + * @param string $value The input value. + * @return string + */ + public static function toString16LE($value) + { + $string = ""; + foreach (unpack("S*", $value) as $char) + $string .= pack("v", $char); + return $string; + } + + /** + * Returns little-endian ordered binary data as machine ordered multibyte + * string. Removes terminating zero. + * + * @param string $value The binary data string. + * @return string + */ + public static function fromString16LE($value) + { + $string = ""; + foreach (unpack("v*", substr($value, -2) == "\0\0" ? + substr($value, 0, -2) : $value) as $char) + $string .= pack("S", $char); + return $string; + } + + /** + * Returns machine ordered multibyte string as big-endian ordered binary data. + * + * @param string $value The input value. + * @return string + */ + public static function toString16BE($value) + { + $string = ""; + foreach (unpack("S*", $value) as $char) + $string .= pack("n", $char); + return $string; + } + + /** + * Returns big-endian ordered binary data as machine ordered multibyte string. + * Removes terminating zero. + * + * @param string $value The binary data string. + * @return string + */ + public static function fromString16BE($value) + { + $string = ""; + foreach (unpack("n*", substr($value, -2) == "\0\0" ? + substr($value, 0, -2) : $value) as $char) + $string .= pack("S", $char); + return $string; + } + + /** + * Returns hexadecimal string having high nibble first as binary data. + * + * @param string $value The input value. + * @return string + */ + public static function toHHex($value) + { + return pack("H*", $value); + } + + /** + * Returns binary data as hexadecimal string having high nibble first. + * + * @param string $value The binary data string. + * @return string + */ + public static function fromHHex($value) + { + list($hex) = unpack("H*0", $value); + return $hex; + } + + /** + * Returns hexadecimal string having low nibble first as binary data. + * + * @param string $value The input value. + * @return string + */ + public static function toLHex($value) + { + return pack("h*", $value); + } + + /** + * Returns binary data as hexadecimal string having low nibble first. + * + * @param string $value The binary data string. + * @return string + */ + public static function fromLHex($value) + { + list($hex) = unpack("h*0", $value); + return $hex; + } + + /** + * Returns big-endian ordered hexadecimal GUID string as little-endian ordered + * binary data string. + * + * @param string $value The input value. + * @return string + */ + public static function toGUID($value) + { + $string = ""; $C = preg_split("/-/", $value); + return pack + ("V1v2N2", hexdec($C[0]), hexdec($C[1]), hexdec($C[2]), + hexdec($C[3] . substr($C[4], 0, 4)), hexdec(substr($C[4], 4))); + } + + /** + * Returns the little-endian ordered binary data as big-endian ordered + * hexadecimal GUID string. + * + * @param string $value The binary data string. + * @return string + */ + public static function fromGUID($value) + { + $C = @unpack("V1V/v2v/N2N", $value); + list($hex) = @unpack("H*0", pack + ("NnnNN", $C["V"], $C["v1"], $C["v2"], $C["N1"], $C["N2"])); + + /* Fixes a bug in PHP versions earlier than Jan 25 2006 */ + if (implode("", unpack("H*", pack("H*", "a"))) == "a00") + $hex = substr($hex, 0, -1); + + return preg_replace + ("/^(.{8})(.{4})(.{4})(.{4})/", "\\1-\\2-\\3-\\4-", $hex); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/Twiddling.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/Twiddling.php new file mode 100644 index 0000000..8ad1285 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/Twiddling.php @@ -0,0 +1,235 @@ + + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 110 $ + * @static + */ +final class Twiddling +{ + /** + * Default private constructor for a static class. + */ + private function __construct() {} + + /** + * Sets a bit at a given position in an integer. + * + * @param integer $integer The value to manipulate. + * @param integer $position The position of the bit to set. + * @param boolean $on Whether to enable or clear the bit. + * @return integer + */ + public static function setBit($integer, $position, $on) + { + return $on ? self::enableBit($integer, $position) : + self::clearBit($integer, $position); + } + + /** + * Enables a bit at a given position in an integer. + * + * @param integer $integer The value to manipulate. + * @param integer $position The position of the bit to enable. + * @return integer + */ + public static function enableBit($integer, $position) + { + return $integer | (1 << $position); + } + + /** + * Clears a bit at a given position in an integer. + * + * @param integer $integer The value to manipulate. + * @param integer $position The position of the bit to clear. + * @return integer + */ + public static function clearBit($integer, $position) + { + return $integer & ~(1 << $position); + } + + /** + * Toggles a bit at a given position in an integer. + * + * @param integer $integer The value to manipulate. + * @param integer $position The position of the bit to toggle. + * @return integer + */ + public static function toggleBit($integer, $position) + { + return $integer ^ (1 << $position); + } + + /** + * Tests a bit at a given position in an integer. + * + * @param integer $integer The value to test. + * @param integer $position The position of the bit to test. + * @return boolean + */ + public static function testBit($integer, $position) + { + return ($integer & (1 << $position)) != 0; + } + + /** + * Sets a given set of bits in an integer. + * + * @param integer $integer The value to manipulate. + * @param integer $bits The bits to set. + * @param boolean $on Whether to enable or clear the bits. + * @return integer + */ + public static function setBits($integer, $bits, $on) + { + return $on ? self::enableBits($integer, $bits) : + self::clearBits($integer, $bits); + } + + /** + * Enables a given set of bits in an integer. + * + * @param integer $integer The value to manipulate. + * @param integer $bits The bits to enable. + * @return integer + */ + public static function enableBits($integer, $bits) + { + return $integer | $bits; + } + + /** + * Clears a given set of bits in an integer. + * + * @param integer $integer The value to manipulate. + * @param integer $bits The bits to clear. + * @return integer + */ + public static function clearBits($integer, $bits) + { + return $integer & ~$bits; + } + + /** + * Toggles a given set of bits in an integer. + * + * @param integer $integer The value to manipulate. + * @param integer $bits The bits to toggle. + * @return integer + */ + public static function toggleBits($integer, $bits) + { + return $integer ^ $bits; + } + + /** + * Tests a given set of bits in an integer + * returning whether all bits are set. + * + * @param integer $integer The value to test. + * @param integer $bits The bits to test. + * @return boolean + */ + public static function testAllBits($integer, $bits) + { + return ($integer & $bits) == $bits; + } + + /** + * Tests a given set of bits in an integer + * returning whether any bits are set. + * + * @param integer $integer The value to test. + * @param integer $bits The bits to test. + * @return boolean + */ + public static function testAnyBits($integer, $bits) + { + return ($integer & $bits) != 0; + } + + /** + * Stores a value in a given range in an integer. + * + * @param integer $integer The value to store into. + * @param integer $start The position to store from. Must be <= $end. + * @param integer $end The position to store to. Must be >= $start. + * @param integer $value The value to store. + * @return integer + */ + public static function setValue($integer, $start, $end, $value) + { + return self::clearBits($integer, self::getMask($start, $end) << $start) | + ($value << $start); + } + + /** + * Retrieves a value from a given range in an integer, inclusive. + * + * @param integer $integer The value to read from. + * @param integer $start The position to read from. Must be <= $end. + * @param integer $end The position to read to. Must be >= $start. + * @return integer + */ + public static function getValue($integer, $start, $end) + { + return ($integer & self::getMask($start, $end)) >> $start; + } + + /** + * Returns an integer with all bits set from start to end. + * + * @param integer $start The position to start setting bits from. Must + * be <= $end. + * @param integer $end The position to stop setting bits. Must be >= $start. + * @return integer + */ + public static function getMask($start, $end) + { + $mask = 0; + for (; $start <= $end; $start++) + $mask |= 1 << $start; + return $mask; + } +} -- cgit v1.2.3