diff options
author | Alib <aliboba@free.fr> | 2010-03-15 17:56:22 +0100 |
---|---|---|
committer | Alib <aliboba@free.fr> | 2010-03-15 17:56:22 +0100 |
commit | 438912c0c4a4075a5cd74cf9689451c9df4bbe34 (patch) | |
tree | 334e03bbba01b002a34d3cbf81ee7e600ec7bff6 | |
parent | a8012963c23e7e5eaf487ee9e192ae5c4d4ccff2 (diff) | |
download | istreamdev-438912c0c4a4075a5cd74cf9689451c9df4bbe34.tar.gz istreamdev-438912c0c4a4075a5cd74cf9689451c9df4bbe34.tar.bz2 |
New Jquery branch. Initial development version for istreamdev 1.0
464 files changed, 18376 insertions, 38143 deletions
diff --git a/COPYING b/COPYING deleted file mode 100755 index 5b6e7c6..0000000 --- a/COPYING +++ /dev/null @@ -1,340 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - <signature of Ty Coon>, 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/HISTORY b/HISTORY deleted file mode 100755 index 835ff8b..0000000 --- a/HISTORY +++ /dev/null @@ -1,104 +0,0 @@ -iStreamdev History ------------------- - -01.03.2010 - 0.3.7 - -- fixed indentation -- good display of recording date & time and names -- epg characters encoding detection and conversion to utf8 if necessary -- fixed channels with coma. Something was still missing. -- added an option to enable/disable the VDR feature -- segmenter binary path is now configurable ( don't forget to update your config.php ) -- cosmetics fixes -- added timers support: create/edit/delete. -- now support moviename.tbn, poster.jpg & folder.jpg thumbnails for movies -- added sources support for multiple media dirs. -- added mp3,aac,wav playback support. -- added switch auto to next track while playing audio files. -- added audio dir playback with itune style -- replaced mediainfo by getid3 (http://getid3.sourceforge.net/) -- trick channel names having a \ for logos. Replace the \ by a space in the logo name. ex "CHAN\CHAN" gives "CHAN CHAN.png". -- fixed Thumbnails aspect/ratio. Now it checks sources resolution before generating the thumb. -- Added more info for video. -- no more killall ffmpeg command. Now the pid is checked and killed. -- allow multiple streaming sessions -- added button to kill all active sessions. - -19.02.2010 - V.0.3.6.1 - -- fixed CSS typo -- cosmetic changes in path -- corrected media listing if directory is empty - -19.02.2010 - V.0.3.6 - -- Added Media streaming. Only video files for the moment. Mediainfo is needed on the system. ( The Troll ) -- fix logos channels size in channel list. Now it's ok ( thanks alex ) -- now recordings show logo channel ( The Troll ) -- fix channels with comma in the name to display epg ( thanks hendrikw01 & Mentox ) -- default config moved to config-default.php - - -18.02.2010 - V.0.3.5 - -- fix SHELL environment necessary for apache account when login shell is /sbin/nologin (cf. cron manual) ( thanks alex ) -- fix logos channels oversized in channels list ( thanks alex ) -- fix memory buffer issue in svdrp php implementation causing timeout ( thanks hendrikw01 ) -- backend rework to ease future evolutions ( TheTroll ) -- No more 'ps aux | grep segmenter' calls to check if server is running, and less svdrp call. Now a status file is present in ram folder while broadcast is running. ( TheTroll ) - -17.02.2010 - V.0.3.4 - -- changed apps icon, boot picture and menu pics. -- now handles old vdr recordings ( PES ) -- mono or stereo sound now configurable in config.php -- less bugs with special characters in path & names - -15.02.2010 - V.0.3.3 - -- added support for VDR recordings (recordings in sub folders are supported) -- fixed channels with ' char -- better handling of stream availibility. Now based on first ts file ready and not m3u8 playlist. Should always works now. -- changed stream timeout to 25 seconds in case of vdr can't tune to the channel. -- no more svdrpsend.pl dependency. Now svdrp request are made with svdrpphp lib. - - -15.02.2010 - V.0.3.2 - -- fixed problem with some channels name with a "," in the name -- added default background for channels without logos. - - -15.02.2010 - V.0.3.1 - -- fixed error in README for testing istream.sh -- added Ajax based server callback for stream availibility. Now if after 15 seconds VDR still send nothing, it redirect to an error page. When stream is available, the play icon appear based on ajax server push. - - -14.02.2010 - v.0.3.0 - -- Massive rewrite & optimisations. -- added Category page -- added Channel list per Category with channels logo & epg -- adapted in php many shell call. -- configuration from config.php file only -- encoding bitrate and resolution configurable -- solved many race conditions with simultaneous users. -- channel list now parsed from channels.conf and not streamdev version dependant anymore -- better video quality for low bitrates -- menu icons -- remove loading.ts temporary video. -- now the video play button appear only when the video feed is ready, no need of the loading trick anymore. - - -09.02.2010 - v. 0.2 - -- Initial revision - - -To do: - - - Access to vdr recordings - - Access to stored media ( xvid, mp3, etc ) - - @@ -1,114 +0,0 @@ - ________________________________________________________ -| | -| [ iStreamdev ] | -|________________________________________________________| - - Written by: - Alib <aliboba@free.fr> - - Contributors - The Troll - - Project's homepage: - http://projects.vdr-developer.org/projects/show/istreamdev - - - Latest version available at: - http://projects.vdr-developer.org/projects/list_files/istreamdev - - git repository: - git://projects.vdr-developer.org/istreamdev.git - - See the file COPYING for license information. - - About: - ----- - -iStreamdev lets you stream TV channels & recordings from VDR and all your Video & Music files from your PC to your iPhone. -Your Iphone don't needs to be jailbroken, it uses native iphone Quicktime player. -You needs at least firmware 3.0 to support HTTP Live Streaming protocol. - -It gets vdr-streamdev plugins TS feeds, and recodes it to TS mux with h264 level 3.0 video and mp3 audio using ffmpeg. -Segmenter receives output from pipe, cuts it in 10 seconds video file and updates the m3u8 playlist in live. - -Audio files are not rencoded but streamed directly to their native formats. So only mp3, aac & wave are supported. - - - Features: - --------- - - •100% webapp compatible user interface using iWebkit framework ( http://iwebkit.net ) - •Channel selection throught categories - •Channels listed with logo and current epg. - •Streaming format selection: Edge, 3g, Wifi - •Recording streaming: Access your vdr recordings with epg. - •Timers support: Add/Edit/Delete/Activate/Deactivate timers. - •Video files support: Stream to all your video files ( avi, mkv, mov, etc ) to your Iphone. If you have a movie.tbn poster.jpg or folder.jpg file in the same folder as the video file, it will display it as thumbnail. If there's no picture, it will generate a thumbnail from the video. - •Music files support: Access to your mp3/aac/Wav files remotly and stream them with playlist support. - - - Webapp: - ------- - - Add iStreamdev to your iPhone home menu. This makes it looking likes an appstore app without Safari interface. - - Usage: - ------ - - Select a channels category, then a channel. - Select your stream mode: Edge , 3g or Wifi. The Play icon - will appear automatically after few seconds when the feed is - ready. - This is the same for recorinds and videos files. - To Stop the stream server, hit Stop stream button. - - Video thumbnails: - iStreamdev takes videoname.tbn , poster.jpg or folder.jpg file ( from xbmc export library ) as thumbnail source, or grab a pi cture in the video stream if there's not. - - Channel logos: - Put your 80x80 png logos in logos/ folder. They needs to have the same name/caps as your channels.conf If a channel have a / character in the name, replace it by _ ( cf RTL/TELEVISION > RTL_TELEVISION.png ) - - Music: - iStreamdev generate a playlist from the requested file to the last file of the folder. Then you can goes Next easily. To play an album, just launch the first track. - - - What you need: - -------------- - - - an http server with PHP5 enabled like apache or lighthttpd - - having "at" package. - - www-data user should allowed to use "at". - Check on your /etc/at/deny if www-data is there, and remove it if so. - - PHP is allowed to use exec() function. - - ffmpeg compiled with x264 support - - segmenter: You need to use modified version included in istreamdev path. - - Install iStreamdev: - ------------------- - - Copy the file in your webfolder. /istreamdev for example. - Copy config_default.php to config.php and edit it. - $httpath is your istreamdev http path NOT the full url - ( '/istreamdev/' NOT 'http://yourdomain/istreamdev' ) - - Compiles segmenter provided by typing make in segmenter folder and install it: - "make & cp segmenter /usr/bin/" - - the ram folder should be writable. If you want to prevent hard disk - usage, you can mount it in ram with /dev/shm: - - mkdir /dev/shm/ram - ln -s /dev/shm/ram ram - - Check everything is ok with ffmpeg by launching the above - command logued as your http server user ( www-data ) : - - ./istream.sh http://localhost:3000/TS/1 512k 64k 1 480x320 ./ 3 /usr/bin/ffmpeg /usr/bin/segmenter - - - You should see ffmpeg access streamdev http://localhost:3000/TS/1 and - encode the stream. - - Now everything is ok you can login from your iphone: http://yourip/istreamdev - - diff --git a/bin/backend.php b/bin/backend.php new file mode 100644 index 0000000..54e0058 --- /dev/null +++ b/bin/backend.php @@ -0,0 +1,129 @@ +<?php +header('Content-type: text/html'); +$action=$_REQUEST['action']; +switch ($action) + { + case ("getGlobals"): + $tree = file_get_contents("textfiles/getGlobals.txt"); + print $tree; + break; + + case ("getTvCat"): + $tree = file_get_contents("textfiles/getTvCat.txt"); + print $tree; + break; + + case ("getFullChanList"): + $tree = file_get_contents("textfiles/getFullChanList.txt"); + print $tree; + break; + + case ("getTvChan"): + $tree = file_get_contents("textfiles/getTvChan.txt"); + print $tree; + break; + + case ("getChanInfo"): + $tree = file_get_contents("textfiles/getChanInfo.txt"); + print $tree; + break; + + case ("getRecInfo"): + $tree = file_get_contents("textfiles/getRecInfo.txt"); + print $tree; + break; + + case ("getVidInfo"): + $tree = file_get_contents("textfiles/getVidInfo.txt"); + print $tree; + break; + + case ("getStreamInfo"): + $session = $_REQUEST['session']; + $tree = file_get_contents("textfiles/getStreamInfo-" . $session . ".txt"); + print $tree; + break; + + case ("startBroadcast"): + $type = $_REQUEST['type']; + $url = $_REQUEST['url']; + $tree = file_get_contents("textfiles/startBroadcast-" . $type . ".txt"); + print $tree; + break; + + case ("stopBroadcast"): + $tree = file_get_contents("textfiles/stopBroadcast.txt"); + print $tree; + break; + + case ("getStreamStatus"): + $time = time(); + $session = $_REQUEST['session']; + $prevmsg = $_REQUEST['msg']; + while((time() - $time) < 29) + { + $tree = file_get_contents("textfiles/getStreamStatus.txt"); + $data = json_decode($tree); + $message = $data->message; + $status = $data->status; + if ($prevmsg != $message) { + print $tree; + break; + } + else if ($status == "ready") + { + print $tree; + break; + } + usleep(1000); + } + break; + + case ("getTimers"): + $tree = file_get_contents("textfiles/getTimers.txt"); + print $tree; + break; + + case ("editTimer"): + $id = $_REQUEST['id']; + if (id) { + $tree = file_get_contents("textfiles/editTimer.txt"); + } + else { + $tree = file_get_contents("textfiles/addTimer.txt"); + } + print $tree; + break; + + case ("deltimer"): + $tree = file_get_contents("textfiles/delTimer.txt"); + print $tree; + break; + + case ("browseFolder"): + $path = $_REQUEST['path']; + if ( $path == "/video/" ) { + $tree = file_get_contents("textfiles/browseFolder-rec.txt"); + } + else { + $tree = file_get_contents("textfiles/browseFolder-vid.txt"); + } + print $tree; + break; + + case ("browseRec"): + $tree = file_get_contents("textfiles/browseRec.txt"); + print $tree; + break; + + case ("browseAudio"): + $tree = file_get_contents("textfiles/browseAudio.txt"); + print $tree; + break; + + case ("streamAudio"): + $tree = file_get_contents("textfiles/streamAudio.txt"); + print $tree; + break; + } +?> diff --git a/bin/textfiles/addTimer.txt b/bin/textfiles/addTimer.txt new file mode 100644 index 0000000..728616e --- /dev/null +++ b/bin/textfiles/addTimer.txt @@ -0,0 +1 @@ +{ "status": "Ok", "message":"Timer created successfully" } diff --git a/bin/textfiles/browseAudio.txt b/bin/textfiles/browseAudio.txt new file mode 100644 index 0000000..2f91c4f --- /dev/null +++ b/bin/textfiles/browseAudio.txt @@ -0,0 +1,21 @@ +{ + "list": + [ + { + "type": "folder", + "name": "album1", + "path": "/mnt/music/album1" + }, + { + "type": "folder", + "name": "album2", + "path": "/mnt/music/album2" + }, + { + "type": "audio", + "name": "audiofile.mp3", + "length": "3.30", + "path": "/mnt/music/audiofile.mp3" + } + ] +} diff --git a/bin/textfiles/browseFolder-rec.txt b/bin/textfiles/browseFolder-rec.txt new file mode 100644 index 0000000..c3d721c --- /dev/null +++ b/bin/textfiles/browseFolder-rec.txt @@ -0,0 +1,22 @@ +{ + "list": + [ + { + "type": "folder", + "name": "rec1", + "path": "/video/rec1" + }, + { + "type": "folder", + "name": "rec2", + "path": "/video/rec2" + }, + { + "type": "rec", + "name": "2010/02/25 at 23h21", + "path": "/video/rec1/2010-02-25.23.21.3-0.rec" + } + + ] +} + diff --git a/bin/textfiles/browseFolder-vid.txt b/bin/textfiles/browseFolder-vid.txt new file mode 100644 index 0000000..62fecf3 --- /dev/null +++ b/bin/textfiles/browseFolder-vid.txt @@ -0,0 +1,20 @@ +{ + "list": + [ + { + "type": "folder", + "name": "movie1", + "path": "/mnt/videos/movie1" + }, + { + "type": "folder", + "name": "movie2", + "path": "/mnt/videos/movie2" + }, + { + "type": "video", + "name": "videofile.avi", + "path": "/mnt/videos/videofile.avi" + } + ] +} diff --git a/bin/textfiles/delTimer.txt b/bin/textfiles/delTimer.txt new file mode 100644 index 0000000..9ab3b92 --- /dev/null +++ b/bin/textfiles/delTimer.txt @@ -0,0 +1 @@ +{ "status": "ok", "message":"Timer successfully deleted" } diff --git a/bin/textfiles/editTimer.txt b/bin/textfiles/editTimer.txt new file mode 100644 index 0000000..bad3855 --- /dev/null +++ b/bin/textfiles/editTimer.txt @@ -0,0 +1 @@ +{ "status": "Ok", "message":"Timer edited successfully" } diff --git a/bin/textfiles/getChanInfo.txt b/bin/textfiles/getChanInfo.txt new file mode 100644 index 0000000..94f302d --- /dev/null +++ b/bin/textfiles/getChanInfo.txt @@ -0,0 +1,14 @@ +{ + "program": + { + "name": "TF1", + "number": "1", + "now_time": "13h00-13h30", + "now_title": "Journal de 13h", + "now_desc": "Les informations de 13h... Blahblah..", + "next_time": "13h35-13h45", + "next_title": "Météo", + "next_desc": "Le bulletin météo de la journée." + } +} + diff --git a/bin/textfiles/getFullChanList.txt b/bin/textfiles/getFullChanList.txt new file mode 100644 index 0000000..80e0495 --- /dev/null +++ b/bin/textfiles/getFullChanList.txt @@ -0,0 +1,34 @@ +{ + "category": + [ + { + "name": "Nationales&TNT", + "channel": + [ + { + "name": "TF1", + "number": "1" + },{ + "name": "FRANCE 2", + "number": "2" + },{ + "name": "FRANCE 3", + "number": "3" + } + ] + }, + { + "name": "Divertissement", + "channel": + [ + { + "name": "Paris Première", + "number": "10" + },{ + "name": "RTL Télévision", + "number": "11" + } + ] + } + ] +} diff --git a/bin/textfiles/getGlobals.txt b/bin/textfiles/getGlobals.txt new file mode 100644 index 0000000..87a9994 --- /dev/null +++ b/bin/textfiles/getGlobals.txt @@ -0,0 +1,6 @@ +{ + "streamdev_server": "http://127.0.0.1:3000", + "rec_path": "/video/", + "video_path": "/mnt/media/Video/", + "audio_path": "/mnt/media/Music/" +} diff --git a/bin/textfiles/getRecInfo.txt b/bin/textfiles/getRecInfo.txt new file mode 100644 index 0000000..6488ea7 --- /dev/null +++ b/bin/textfiles/getRecInfo.txt @@ -0,0 +1,10 @@ +{ + "program": + { + "name": "Journal de 13h", + "channel": "TF1", + "recorded": "2010-02-02 at 19h30", + "desc": "Les informations de 13h..." + } +} + diff --git a/bin/textfiles/getStreamInfo-1.txt b/bin/textfiles/getStreamInfo-1.txt new file mode 100644 index 0000000..fe89488 --- /dev/null +++ b/bin/textfiles/getStreamInfo-1.txt @@ -0,0 +1,17 @@ +{ + "stream": + { + "session": "1", + "type": "tv", + "name": "TF1", + "mode": "3G", + "now_time": "13h00-13h30", + "now_title": "Journal de 13h", + "now_desc": "Les informations de 13h...", + "next_time": "13h35-13h45", + "next_title": "Météo", + "next_desc": "Le bulletin météo de la journée.", + "thumbwidth" : "80", + "thumbheight" : "80" + } +} diff --git a/bin/textfiles/getStreamInfo-2.txt b/bin/textfiles/getStreamInfo-2.txt new file mode 100644 index 0000000..f097b7f --- /dev/null +++ b/bin/textfiles/getStreamInfo-2.txt @@ -0,0 +1,16 @@ +{ + "stream": + { + "session": "2", + "type": "rec", + "name": "Journal de 13h", + "channel": "TF1", + "recorded": "2010-02-02 at 19h30", + "desc": "Les informations de 13h...", + "mode": "3G", + "thumbwidth": "80", + "thumbheight": "80" + } +} + + diff --git a/bin/textfiles/getStreamInfo-3.txt b/bin/textfiles/getStreamInfo-3.txt new file mode 100644 index 0000000..a0f2558 --- /dev/null +++ b/bin/textfiles/getStreamInfo-3.txt @@ -0,0 +1,17 @@ +{ + "stream": + { + "session": "3", + "type": "vid", + "name": "Mavideo.avi", + "desc": "", + "duration": "1:41:55", + "format": "avi", + "video": "XviD MPEG-4", + "audio": "MPEG Layer 3", + "resolution": "608x256", + "mode": "3G", + "thumbwidth": "180", + "thumbheight": "100" + } +} diff --git a/bin/textfiles/getStreamStatus.txt b/bin/textfiles/getStreamStatus.txt new file mode 100644 index 0000000..d14a003 --- /dev/null +++ b/bin/textfiles/getStreamStatus.txt @@ -0,0 +1 @@ +{"status": "ready","message": "3G Broadcast ready", "url": "ram/session1/stream.m3u8"} diff --git a/bin/textfiles/getTimers.txt b/bin/textfiles/getTimers.txt new file mode 100644 index 0000000..103d110 --- /dev/null +++ b/bin/textfiles/getTimers.txt @@ -0,0 +1,38 @@ +{ + "timer": + [ + { + "id": "1", + "name": "Timername", + "active": "1", + "channumber": "2", + "channame": "FRANCE 2", + "date": "2010-03-10", + "starttime": "2030", + "endtime": "2230", + "running": "0" + }, + { + "id": "2", + "name": "Timername2", + "active": "0", + "channumber": "3", + "channame": "FRANCE 3", + "date": "2010-05-10", + "starttime": "1030", + "endtime": "1230", + "running": "0" + }, + { + "id": "3", + "name": "Timername3", + "active": "1", + "channumber": "4", + "channame": "Canal +", + "date": "2010-03-13", + "starttime": "2030", + "endtime": "2230", + "running": "1" + } + ] +} diff --git a/bin/textfiles/getTvCat.txt b/bin/textfiles/getTvCat.txt new file mode 100644 index 0000000..0d95dca --- /dev/null +++ b/bin/textfiles/getTvCat.txt @@ -0,0 +1,16 @@ +{ + "categories": + [ + { + "name": "Nationales&TNT", + "channels": "17" + },{ + "name": "Divertissements", + "channels": "12" + },{ + "name": "Information", + "channels": "6" + } + ] +} + diff --git a/bin/textfiles/getTvChan.txt b/bin/textfiles/getTvChan.txt new file mode 100644 index 0000000..03d4840 --- /dev/null +++ b/bin/textfiles/getTvChan.txt @@ -0,0 +1,19 @@ +{ + "channel": + [ + { + "name": "TF1", + "number": "1", + "now_title": "Journal de 13h", + },{ + "name": "FRANCE 2", + "number": "2", + "now_title": "Tournez manège", + },{ + "name": "FRANCE 3", + "number": "3", + "now_title": "Journal régional" + } + ] +} + diff --git a/bin/textfiles/getVidInfo.txt b/bin/textfiles/getVidInfo.txt new file mode 100644 index 0000000..11a58f7 --- /dev/null +++ b/bin/textfiles/getVidInfo.txt @@ -0,0 +1,13 @@ +{ + "program": + { + "name": "Mavideo.avi", + "desc": "", + "duration": "1:41:55", + "format": "avi", + "video": "XviD MPEG-4", + "audio": "MPEG Layer 3", + "resolution": "608x256" + } +} + diff --git a/bin/textfiles/startBroadcast-rec.txt b/bin/textfiles/startBroadcast-rec.txt new file mode 100644 index 0000000..e24cc29 --- /dev/null +++ b/bin/textfiles/startBroadcast-rec.txt @@ -0,0 +1,2 @@ +{ "session": "2" } + diff --git a/bin/textfiles/startBroadcast-tv.txt b/bin/textfiles/startBroadcast-tv.txt new file mode 100644 index 0000000..b34344a --- /dev/null +++ b/bin/textfiles/startBroadcast-tv.txt @@ -0,0 +1,2 @@ +{ "session": "1" } + diff --git a/bin/textfiles/startBroadcast-vid.txt b/bin/textfiles/startBroadcast-vid.txt new file mode 100644 index 0000000..a1fffae --- /dev/null +++ b/bin/textfiles/startBroadcast-vid.txt @@ -0,0 +1,2 @@ +{ "session": "3" } + diff --git a/bin/textfiles/stopBroadcast.txt b/bin/textfiles/stopBroadcast.txt new file mode 100644 index 0000000..0b99d06 --- /dev/null +++ b/bin/textfiles/stopBroadcast.txt @@ -0,0 +1 @@ +{ "status": "ok", "message": "Successfully stopped broadcast" } diff --git a/bin/textfiles/streamAudio.txt b/bin/textfiles/streamAudio.txt new file mode 100644 index 0000000..28cca73 --- /dev/null +++ b/bin/textfiles/streamAudio.txt @@ -0,0 +1,14 @@ +{ + playlist: + [ + { + "file": "/istreamdev/playlist/track1.mp3" + }, + { + "file": "/istreamdev/playlist/track2.mp3" + }, + { + "file": "/istreamdev/playlist/track3.mp3" + } + ] +} diff --git a/config_default.php b/config_default.php deleted file mode 100755 index 1cce79f..0000000 --- a/config_default.php +++ /dev/null @@ -1,36 +0,0 @@ -<?php - // Http configuration - $user = 'istreamdev'; // Login - $pass = 'iguest'; // Password - $httppath = '/istreamdev/'; // Absolute path to the index.php file. //Don't put http://yourdomain !! - - // VDR configuration - - $vdrenabled=1; // enable/disable VDR features - $vdrchannels='/etc/vdr/channels.conf'; // VDR channel list - $svdrpport=2001; // SVDRP port - $svdrpip='127.0.0.1'; // SVDRP ip - $vdrstreamdev='http://127.0.0.1:3000/TS/'; // VDR streamdev URL - $vdrrecpath='/video/'; //VDR recording directory - - // Media configuration - $videotypes='avi mkv ts mov mp4 wmv flv mpg mpeg mpeg2 mpv '; // Supported video extensions (must finish with a space) - // 1:vid 2:aud Source name Source path - $mediasource=array(); - $mediasources[]=array ( 1, 'Video', '/mnt/media/movies'); - $mediasources[]=array ( 2, 'Audio', '/mnt/media/music'); - - // Encoding - // Name Video Audio Audio channels Resolution - $quality=array ( 'Edge' => '128k 64k 1 240x160', - '3g' => '350k 64k 1 408x272', - 'Wifi' => '512k 128k 2 480x320'); - $maxencodingprocesses=10; // Max simultaneous encoding processes - - // Misc - $ffmpegpath = '/usr/bin/ffmpeg'; //path to ffmpeg binary - $segmenterpath = '/usr/bin/segmenter'; //path to segmenter binary - - // Version - $isdversion = "0.3.7"; -?> diff --git a/css/developer-style.css b/css/developer-style.css deleted file mode 100755 index 517fefe..0000000 --- a/css/developer-style.css +++ /dev/null @@ -1,1159 +0,0 @@ -body { - position: relative; - margin: 0; - -webkit-text-size-adjust: none; - min-height: 416px; - font-family: helvetica,sans-serif; - background: url("../images/background.png") repeat; - -webkit-touch-callout: none; -} -.center { - margin: auto; - display: block; - text-align:center!important -} -img { - border: 0; -} -a:hover span.arrow { - background-position: 0 -13px!important; -} -@media screen and (max-width: 320px) -{ -#topbar { - height: 44px; -} -#title { - line-height: 44px; - height: 44px; - font-size: 16pt; -} -#tributton a:first-child, #duobutton a:first-child { - width: 101px; -} -#tributton a:last-child, #duobutton a:last-child { - width: 101px; -} -#tributton a { - width: 106px; -} -#duobutton .links { - width: 195px; -} -#tributton .links { - width: 302px; -} -#doublead { - width: 300px!important; -} -#duoselectionbuttons { - width: 191px; - height: 30px; - top: 7px; -} -#triselectionbuttons { - width: 290px; - height: 30px; - top: 7px; -} -#triselectionbuttons a:first-child, #duoselectionbuttons a:first-child { - width: 99px; - height: 28px; - line-height: 28px; -} -#triselectionbuttons a { - width: 98px; - height: 28px; - line-height: 28px; -} -#triselectionbuttons a:last-child, #duoselectionbuttons a:last-child { - width: 99px; - height: 28px; - line-height: 28px; -} -.searchbox form { - width: 272px; -} -.searchbox input[type="text"] { - width: 275px; -} -li.menu span.name { - max-width: 77%; -} -li.checkbox .name { - max-width: 190px; -} -li.radiobutton .name { - max-width: 190px; -} -#leftnav a, #rightnav a, #leftbutton a, #rightbutton a, #blueleftbutton a, #bluerightbutton a { - line-height: 30px; - height: 30px; -} -#leftnav img, #rightnav img { - margin-top: 4px; -} -#leftnav, #leftbutton, #blueleftbutton { - top: 7px; -} -#rightnav, #rightbutton, #bluerightbutton { - top: 7px; -} -body.musiclist ul li span.name { - max-width:55% -} -.textbox textarea { - width: 280px; -} -} -@media screen and (min-width: 321px) -{ -#topbar { - height: 32px; -} -#title { - line-height: 32px; - height: 32px; - font-size: 13pt; -} -li.menu span.name { - max-width: 85%; -} -li.checkbox .name { - max-width: 75%; -} -li.radiobutton .name { - max-width: 75%; -} -#leftnav a, #rightnav a, #leftbutton a, #rightbutton a, #blueleftbutton a, #bluerightbutton a { - line-height: 24px; - height: 24px; -} -#leftnav img, #rightnav img { - margin-top: 4px; - height: 70%; -} -#leftnav, #leftbutton, #blueleftbutton { - top: 4px; -} -#rightnav, #rightbutton, #bluerightbutton { - top: 4px; -} -body.musiclist ul li span.name { - max-width:70% -} -.textbox textarea { - width: 440px; -} -#tributton a:first-child, #duobutton a:first-child { - width: 152px; -} -#tributton a:last-child, #duobutton a:last-child { - width: 152px; -} -#tributton a { - width: 154px; -} -#tributton .links { - width: 452px; -} -#duobutton .links { - width: 298px; -} -#doublead { - width: 350px!important; -} -#duoselectionbuttons { - width: 293px; - height: 24px; - top: 4px; -} -#triselectionbuttons { - width: 450px; - height: 24px; - top: 4px; -} -#triselectionbuttons a:first-child, #duoselectionbuttons a:first-child { - width: 150px; - height: 22px; - line-height: 22px; -} -#triselectionbuttons a { - width: 156px; - height: 22px; - line-height: 22px; -} -#triselectionbuttons a:last-child, #duoselectionbuttons a:last-child { - width: 150px; - height: 22px; - line-height: 22px; -} -.searchbox form { - width: 432px; -} -.searchbox input[type="text"] { - width: 435px; -} -} -#topbar.black { - background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#858585), color-stop(3%, #636363), color-stop(50%, #202020), color-stop(51%, black), color-stop(97%, black), to(#262626)); -} -#topbar.transparent { - background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgba(133,133,133,0.7)), color-stop(3%, rgba(99,99,99,0.7)), color-stop(50%, rgba(32,32,32,0.7)), color-stop(51%, rgba(0,0,0,0.7)), color-stop(97%, rgba(0,0,0,0.7)), to(rgba(38,38,38,0.7))); -} -#topbar { - position: relative; - left: 0; - top: 0; - width: auto; - background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#cdd5df), color-stop(3%, #b0bccd), color-stop(50%, #889bb3), color-stop(51%, #8195af), color-stop(97%, #6d84a2), to(#2d3642)); - margin-bottom: 13px; -} -#title { - position: absolute; - font-weight: bold; - top: 0; - left: 0; - right: 0; - padding: 0 10px; - text-align: center; - text-overflow: ellipsis; - white-space: nowrap; - overflow: hidden; - color: #FFF; - text-shadow: rgba(0,0,0,0.6) 0 -1px 0; -} -} -#content { - width: 100%; - position: relative; - min-height: 250px; - margin-top: 10px; - height: auto; - z-index: 0; - overflow: hidden; -} -#footer { - text-align: center; - position: relative; - margin: 20px 10px 0; - height: auto; - width: auto; - bottom: 10px; -} -body.ipodlist #footer, body.ipodlist #footer a { - text-shadow: #FFF 0 -1px 0; -} -#footer a, #footer { - text-decoration: none; - font-size: 9pt; - color: #4C4C4C; - text-shadow: #FFF 0 1px 0; -} -.pageitem { - -webkit-border-radius: 8px; - background-color: #fff; - border: #878787 solid 1px; - font-size: 12pt; - overflow: hidden; - padding: 0; - position: relative; - display: block; - height: auto; - width: auto; - margin: 3px 9px 17px; - list-style: none; -} -.textbox { - padding: 5px 9px; - position: relative; - overflow: hidden; - border-top: 1px solid #878787; -} -#tributton, #duobutton { - height: 44px; - background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#cdd4d9), color-stop(3%, #c0c9cf), color-stop(97%, #abb7bf),to(#81929f)); - margin: -13px 0 13px 0; - text-align: center; -} -#tributton .links, #duobutton .links { - height: 30px; - -webkit-border-image: url("../images/tributton.png") 0 4 0 4; - border-width: 0 4px 0 4px; - margin: 0 auto 0px auto; - position: relative; - top: 7px; -} -#tributton a:first-child, #duobutton a:first-child { - border-right: 1px solid #6d7e91; - -webkit-border-top-left-radius: 5px; - -webkit-border-bottom-left-radius: 5px; - margin-left: -4px; -} -#tributton a, #duobutton a { - text-overflow: ellipsis; - overflow: hidden; - white-space: nowrap; - height: 27px; - display: inline-block; - line-height: 27px; - margin-top: 1px; - font: bold 13px; - text-decoration: none; - color: #3f5c84; - text-shadow: #FFF 0 1px 0; -} -#duobutton a:last-child { - border: 0; -} -#tributton a:last-child { - border-left: 1px solid #6d7e91; -} -#tributton a:last-child, #duobutton a:last-child { - -webkit-border-top-right-radius: 5px; - -webkit-border-bottom-right-radius: 5px; - margin-right: -4px; -} -#tributton a:hover, #tributton a#pressed, #duobutton a:hover, #duobutton a#pressed { - background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#7b8b9f), color-stop(3%, #8c9baf), to(#647792)); - color: white; - text-shadow: black 0 -1px 0; -} -#triselectionbuttons, #duoselectionbuttons { - -webkit-border-image: url('../images/navbutton.png') 0 5 0 5; - border-width: 0 5px 0 5px; - position: relative; - margin: auto; -} -#duoselectionbuttons a:first-child { - border: 0; -} -#triselectionbuttons a:first-child { - border-right: solid 1px #556984; -} -#triselectionbuttons a:first-child, #duoselectionbuttons a:first-child { - margin-left: -4px; - -webkit-border-top-left-radius: 6px; - -webkit-border-bottom-left-radius: 6px; -} -#triselectionbuttons a, #duoselectionbuttons a { - display: inline-block; - text-align: center; - color: white; - text-decoration: none; - margin-top: 1px; - text-shadow: black 0 -1px 0; - background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#909baa), color-stop(3%, #a5b4c6), color-stop(50%, #798eaa), color-stop(51%, #6b83a1), color-stop(97%, #6e85a3), to(#526379)); -} -#triselectionbuttons a:last-child, #duoselectionbuttons a:last-child { - border-left: solid 1px #556984; - margin-right: -4px; - -webkit-border-top-right-radius: 6px; - -webkit-border-bottom-right-radius: 6px; -} -#triselectionbuttons a:hover, #triselectionbuttons a#pressed, #duoselectionbuttons a:hover, #duoselectionbuttons a#pressed { - background: none; -} -#doublead { - height: 83px!important; - position: relative; - margin: 0 auto 13px auto; -} -#doublead a:first-child { - left: 0!important; -} -#doublead a:last-child { - right: 0!important; -} -#doublead a { - width: 147px!important; - height: 83px!important; - position: absolute; - -webkit-border-radius: 8px; - display: block; - background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#7c7c7c), color-stop(3%, #858585), color-stop(97%, #a4a4a4),to(#c2c2c2)); -} -li#doublead { - margin-top: 25px; - margin-bottom: 10px!important; - background: none; -} -li#doublead:hover { - background: none; -} -.searchbox { - height: 44px; - background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#f1f3f4), color-stop(3%, #e0e4e7), color-stop(50%, #c7cfd4), color-stop(51%, #bec7cd), color-stop(97%, #b4bec6), to(#8999a5)); - margin: -13px 0 13px 0; - width: 100%; -} -.searchbox form { - height: 24px; - -webkit-border-image: url('../images/searchfield.png') 4 14 1 24; - border-width: 4px 14px 1px 24px; - display: block; - position: relative; - top: 8px; - margin: auto; -} -fieldset { - border: 0; - margin: 0; - padding: 0; -} -.searchbox input[type="text"] { - border: 0; - -webkit-appearance: none; - height: 18px; - float: left; - font-size: 13px; - padding: 0; - position: relative; - top: 2px; - left: 2px; -} -.textbox img { - max-width: 100%; -} -.textbox p { - margin-top: 2px; -} -.textbox p { - margin-top: 2px; - color: #000; - margin-bottom: 2px; - text-align: justify; -} -.textbox img { - max-width: 100%; -} -.textbox ul { - margin: 3px 0 3px 0; - list-style: circle!important; -} -.textbox li { - margin: 0!important; -} -.pageitem li:first-child, .pageitem li.form:first-child { - border-top: 0; -} -li.menu, li.checkbox, li.radiobutton, li.select, li.button, li.bigfield, li.smallfield { - position: relative; - list-style-type: none; - display: block; - height: 43px; - overflow: hidden; - border-top: 1px solid #878787; - width: auto; -} -ul.pageitem li:first-child:hover, .pageitem li:first-child a, li.radiobutton:first-child input, li.select:first-child select, li.button:first-child input, .bigfield:first-child input { - -webkit-border-top-left-radius: 8px; - -webkit-border-top-right-radius: 8px; -} -ul.pageitem li:last-child:hover, .pageitem li:last-child a, li.radiobutton:last-child input, li.select:last-child select, li.button:last-child input, .bigfiel:last-child input { - -webkit-border-bottom-left-radius: 8px; - -webkit-border-bottom-right-radius: 8px; -} -li.menu:hover, li.store:hover, body.list div#content li a:hover, body.list li.withimage:hover, body.applist li:hover:nth-child(n),body.ipodlist li:hover:nth-child(n) { - background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#058cf5), to(#015fe6)); -} -body.ipodlist li:hover:nth-child(n) .name,body.ipodlist li:hover:nth-child(n) .time{border:0} -li.menu a:hover span.name, li.menu a:hover span.comment, li.store:hover .starcomment, li.store:hover .name, li.store:hover .comment, body.list li.withimage a:hover .comment { - color: #fff; -} -li.menu a:hover span.comment { - color: #CCF; -} -li.menu a { - display: block; - height: 43px; - width: auto; - text-decoration: none; -} -li.menu a img { - width: auto; - height: 32px; - margin: 5px 0 0 5px; - float: left; -} -li.menu span.name, li.checkbox .name, li.radiobutton .name { - margin: 11px 0 0 7px; - width: auto; - color: #000; - font-weight: bold; - font-size: 17px; - text-overflow: ellipsis; - overflow: hidden; - white-space: nowrap; - float: left; -} -li.menu span.comment { - margin: 11px 30px 0 0; - width: auto; - font-size: 17px; - text-overflow: ellipsis; - overflow: hidden; - max-width: 75%; - white-space: nowrap; - float: right; - color: #324f85; -} -li.menu span.arrow, li.store span.arrow, body.musiclist span.arrow, body.list span.arrow { - position: absolute; - width: 8px!important; - height: 13px!important; - right: 10px; - top: 15px; - margin: 0!important; - background: url("../images/arrow.png") 0 0 no-repeat; -} -body.applist span.arrow { - position: absolute; - width: 8px!important; - height: 13px!important; - right: 10px; - top: 29px; - margin: 0!important; - background: url("../images/arrow.png") 0 0 no-repeat; -} -li.store { - height: 90px; - border-top: #878787 solid 1px; - overflow: hidden; - position: relative; -} -li.store a { - width: 100%; - height: 90px; - display: block; - text-decoration: none; - position: absolute; -} -li.store .image { - position: absolute; - left: 0; - top: 0; - height: 80px; - width: 80px; - display: block; - background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#eff1f5), to(#d6dce6)); - -webkit-background-size: 90px; -} -body.applist .image { - width: 57px; - height: 57px; - display: block; - position: absolute; - top: 7px; - left: 11px; - -webkit-border-radius: 8px; - -webkit-box-shadow: 0 2px 3px rgb(0,0,0); - background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#7c7c7c), color-stop(3%, #858585), color-stop(97%, #a4a4a4),to(#c2c2c2)); - -webkit-background-size: 57px; -} -li:first-child.store .image, li.store:first-child a { - -webkit-border-top-left-radius: 8px 8px; -} -li:last-child.store .image, li.store:last-child a { - -webkit-border-bottom-left-radius: 8px 8px; -} -li.store .name, body.applist .name { - font-size: 15px; - white-space: nowrap; - display: block; - overflow: hidden; - color: #000; - max-width: 60%; - text-overflow: ellipsis; - font-weight: bold; -} -li.store .name { - position: absolute; - left: 95px; - top: 35px; -} -body.applist .name { - position: absolute; - top: 27px; - left: 80px; - text-shadow: #eeeeee 0 1px 0; -} -li.store .comment, body.list li.withimage .comment, body.applist .comment, body.applist .price { - font-size: 12px; - color: #7f7f7f; - display: block; - width: 60%; - font-weight: bold; - white-space: nowrap; - text-overflow: ellipsis; - overflow: hidden; -} -li.store .comment, body.list li.withimage .comment { - margin: 16px 0 0 95px; -} -body.applist .comment { - position: absolute; - top: 9px; - left: 80px; - text-shadow: #eeeeee 0 1px 0; - color: #3b3b3b; -} -body.applist .price { - position: absolute; - top: 29px; - right: 26px; - text-shadow: #eeeeee 0 1px 0; - text-align: right; - color: #3b3b3b; -} -li.store .arrow, body.list li.withimage .arrow { - top: 39px!important; -} -li.store .stars0, li.store .stars1, li.store .stars2, li.store .stars3, li.store .stars4, li.store .stars5 { - position: absolute; - top: 56px; - left: 95px; - width: 65px; - height: 18px; - display: block!important; -} -li.store .stars0 { - background: url('../images/0starsborder.png'); -} -li.store .stars1 { - background: url('../images/1starsborder.png'); -} -li.store .stars2 { - background: url('../images/2starsborder.png'); -} -li.store .stars3 { - background: url('../images/3starsborder.png'); -} -li.store .stars4 { - background: url('../images/4starsborder.png'); -} -li.store .stars5, body.applist .stars5 { - background: url('../images/5stars.png'); -} -body.applist .stars0, body.applist .stars1, body.applist .stars2, body.applist .stars3, body.applist .stars4, body.applist .stars5 { - position: absolute; - top: 46px; - left: 79px; - width: 65px; - height: 18px; - display: block!important; -} -body.applist .stars0 { - background: url('../images/0stars.png'); -} -body.applist .stars1 { - background: url('../images/1stars.png'); -} -body.applist .stars2 { - background: url('../images/2stars.png'); -} -body.applist .stars3 { - background: url('../images/3stars.png'); -} -body.applist .stars4 { - background: url('../images/4stars.png'); -} -body.applist .starcomment { - left: 147px; - top: 46px; - color: #3b3b3b; -} -.starcomment { - position: absolute; - left: 165px; - top: 56px; - font-size: 12px; - color: #7f7f7f; - font-weight: lighter; -} -body.applist a:hover .name, body.applist a:hover .starcomment, body.applist a:hover .comment, body.applist a:hover .price { - color: white; - text-shadow: none; -} -.graytitle { - position: relative; - font-weight: bold; - font-size: 17px; - right: 20px; - left: 9px; - color: #4C4C4C; - text-shadow: #FFF 0 1px 0; - padding: 1px 0 3px 8px; -} -.header { - display: block; - font-weight: bold; - color: rgb(73,102,145); - font-size: 12pt; - margin-bottom: 6px; - line-height: 14pt; -} -body.musiclist div#content, body.ipodlist div#content, body.applist div#content { - width: auto; - margin: -16px auto auto -40px; -} -body.musiclist li:nth-child(odd) { - background: #dddee0 -} -body.applist li:nth-child(even) { - background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#adadb0), color-stop(98%, #adadb0), to(#898a8d)) -} -body.applist li:nth-child(odd) { - background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#98989c), color-stop(98%, #98989c), to(#898a8d)) - -} -body.ipodlist li:nth-child(even) { - background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#414041), color-stop(3%, rgba(45,45,45,0.2)), to(rgba(45,45,45,0.2))) -} -body.ipodlist li:nth-child(odd) { - background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#414041), color-stop(3%, rgba(50,50,50,0.4)), to(rgba(50,50,50,0.4))) -} -body.musiclist div#content ul li, body.ipodlist div#content ul li, body.applist div#content ul li { - list-style: none; - width: auto; - position: relative; -} -body.musiclist div#content ul li { - height: 44px; - border-bottom: 1px solid #e6e6e6; -} -body.applist div#content ul li { - height: 70px; - margin-bottom: 1px; -} -body.ipodlist div#content ul li { - height: 42px; -} -body.ipodlist div#content { - background: -webkit-gradient(radial, 50% -70, 0, 50% 0, 200, from(#444444), to(rgb(13, 13, 13))) rgb(13, 13, 13); -} -body.musiclist div#content ul li a, body.ipodlist div#content ul li a { - text-decoration: none; - color: #000; - width: 100%!important; - height: 100%; - display: block; -} -body.applist div#content ul li a { - text-decoration: none; - color: #000; - width: 100%; - height: 100%; - display: block; -} -body.musiclist ul li .number, body.musiclist .name, body.musiclist .time { - display: inline-block; - height: 44px; - font-weight: bold; - font-size: large; - width: 44px; - text-align: center; - line-height: 46px; -} -body.musiclist ul li .name { - margin-left: 0; - width: auto!important; - font-size: medium; - padding-left: 5px; - border-left: solid 1px #e6e6e6; -} -body.musiclist ul li .time { - color: #848484; - font-size: medium; - margin-left: 4px; - width: auto!important; - font-weight: normal; -} -body.musiclist { - background-image: none!important; - background-color: #cbcccf; -} -body.ipodlist { - background-image: none!important; - background-color: black; -} -body.applist { - background-image: none!important; - background-color: #98989c; -} -body.ipodlist span { - color: white; - font-weight: bold; - font-size: 14px; -} -body.musiclist ul li span.name { - text-overflow: ellipsis; - overflow: hidden; - white-space: nowrap; -} -body.musiclist a:hover span.name { - color: #0380f2; -} -body.ipodlist .number { - width: 23px; - display: block; - float: left; - height: 42px; - margin-right: 3px; - text-align: right; - line-height: 43px; -} -body.ipodlist .stop, body.ipodlist .auto, body.ipodlist .play { - width: 18px; - display: block; - float: left; - height: 10px; - text-align: right; - line-height: 43px; - margin-top: 16px; -} -body.ipodlist .play { - background: url('../images/play.gif') no-repeat; -} -body.ipodlist a:hover .auto, body.ipodlist a:hover .play { - background: url('../images/play.gif') no-repeat; - background-position: 0 -10px; -} -body.ipodlist .time { - width: 48px; - float: right; - border-left: solid #414041 1px; - display: block; - height: 42px; - text-align: center; - line-height: 43px; -} -body.ipodlist .name { - display: block; - float: left; - width: inherit; - height: 42px; - text-overflow: ellipsis; - line-height: 42px; - padding-left: 5px; - overflow: hidden; - white-space: nowrap; - max-width: 62%; - border-left: solid #414041 1px; -} -body.list ul li.title { - background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#a5b1ba), color-stop(3%, #909faa), color-stop(97%, #b5bfc6), to(#989ea4)); - height: 22px!important; - width: 100%; - color: #fff; - font-weight: bold; - font-size: 16px; - text-shadow: gray 0 1px 0; - line-height: 22px; - padding-left: 20px; - border-bottom: none!important; -} -body.list ul { - background-color: #fff; - width: 100%; - overflow: hidden; - padding: 0; - margin: 0; -} -body.list div#content li { - height: 40px; - border-bottom: 1px solid #e1e1e1; - list-style: none; -} -body.list { - background-color: #fff; - background-image: none!important; -} -body.list div#footer { - margin-top: 24px!important; -} -body.list div#content li a { - padding: 9px 0 0 20px; - font-size: large; - font-weight: bold; - position: relative; - display: block; - color: #000; - text-decoration: none; - height: 32px; -} -body.list div#content li a span.name { - text-overflow: ellipsis; - overflow: hidden; - max-width: 93%; - white-space: nowrap; - display: block; -} -body.list div#content li a:hover { - color: #fff; -} -body.list div#content { - margin-top: -13px!important; -} -body.list ul img { - width: 90px; - height: 90px; - position: absolute; - left: 0; - top: 0; -} -body.list li.withimage { - height: 90px!important; -} -body.list li.withimage span.name { - margin: 13px 0 0 90px; - text-overflow: ellipsis; - overflow: hidden; - max-width: 63%!important; - white-space: nowrap; -} -body.list li.withimage .comment { - margin: 10px auto auto 90px !important; - max-width: 63%!important; -} -body.list li.withimage a, body.list li.withimage:hover a { - height: 81px!important; -} -#leftnav, #leftbutton, #blueleftbutton { - position: absolute; - font-size: 12px; - left: 9px; - font-weight: bold; -} -#leftnav, #leftbutton, #rightnav, #rightbutton, #blueleftbutton, #bluerightbutton { - z-index: 5000; -} -#leftnav a, #rightnav a, #leftbutton a, #rightbutton a, #blueleftbutton a, #bluerightbutton a { - display: block; - color: #fff; - text-shadow: rgba(0,0,0,0.6) 0 -1px 0; - text-decoration: none; -} -.black #leftnav a:first-child, .transparent #leftnav a:first-child { - -webkit-border-image: url("../images/navleftblack.png") 0 5 0 13; -} -.black #leftnav a, .transparent #leftnav a { - -webkit-border-image: url("../images/navlinkleftblack.png") 0 5 0 13; -} -.black #rightnav a:first-child, .transparent #rightnav a:first-child { - -webkit-border-image: url("../images/navrightblack.png") 0 13 0 5; -} -.black #rightnav a, .transparent #rightnav a { - -webkit-border-image: url("../images/navlinkrightblack.png") 0 13 0 5; -} -.black #leftbutton a, .black #rightbutton a, .transparent #leftbutton a, .transparent #rightbutton a { - -webkit-border-image: url("../images/navbuttonblack.png") 0 5 0 5; -} -#leftnav a:first-child { - z-index: 2; - -webkit-border-image: url("../images/navleft.png") 0 5 0 13; - border-width: 0 5px 0 13px; - -webkit-border-top-left-radius: 16px; - -webkit-border-bottom-left-radius: 16px; - -webkit-border-top-right-radius: 6px; - -webkit-border-bottom-right-radius: 6px; - width: auto; -} -#leftnav a { - -webkit-border-image: url("../images/navlinkleft.png") 0 5 0 13; - z-index: 3; - margin-left: -4px; - border-width: 0 5px 0 13px; - padding-right: 4px; - -webkit-border-top-left-radius: 16px; - -webkit-border-bottom-left-radius: 16px; - -webkit-border-top-right-radius: 6px; - -webkit-border-bottom-right-radius: 6px; - float: left; -} -#rightnav, #rightbutton, #bluerightbutton { - position: absolute; - font-size: 12px; - right: 9px; - font-weight: bold; -} -#rightnav a { - -webkit-border-image: url("../images/navlinkright.png") 0 13 0 5; - z-index: 3; - margin-right: -4px; - border-width: 0 13px 0 5px; - padding-left: 4px; - -webkit-border-top-left-radius: 6px; - -webkit-border-bottom-left-radius: 6px; - float: right; - -webkit-border-top-right-radius: 16px; - -webkit-border-bottom-right-radius: 16px; -} -#rightnav a:first-child { - z-index: 2; - -webkit-border-top-left-radius: 6px; - -webkit-border-bottom-left-radius: 6px; - -webkit-border-image: url("../images/navright.png") 0 13 0 5; - border-width: 0 13px 0 5px; - -webkit-border-top-right-radius: 16px; - -webkit-border-bottom-right-radius: 16px; -} -#leftbutton a, #rightbutton a { - -webkit-border-image: url("../images/navbutton.png") 0 5 0 5; - border-width: 0 5px; - -webkit-border-radius: 6px; -} -#blueleftbutton a, #bluerightbutton a { - -webkit-border-image: url("../images/navbuttonblue.png") 0 5 0 5; - border-width: 0 5px; - -webkit-border-radius: 6px; -} -.rssxpresschannel { - font-family: helvetica,sans-serif; - border: 0; -} -} -.rssxpresschtitle { - text-align: center; -} -.rssxpresschdesc { - color: #000; - text-align: center; - border-bottom: 1px solid #000; - padding-bottom: 5px; -} -.rssxpressittitle { - display: block; - font-size: 12pt; - background: #fff; - margin: 5px 0 2px; -} -.rssxpressittitle a { - text-decoration: none!important; - font-weight: bold; - color: rgb(73,102,145); - line-height: 10pt; -} -.rssxpressitdesc { - background: #fff; - font-size: 10pt; -} -.rssxpressdivider { - display: none; -} -input[type="checkbox"] { - width: 94px; - height: 27px; - background: url('../images/checkbox.png'); - -webkit-appearance: none; - border: 0; - float: right; - margin: 8px 4px 0 0; -} -input[type="checkbox"]:checked { - background-position: 0 27px; -} -input[type="radio"] { - -webkit-appearance: none; - border: 0; - width: 100%; - height: 100%; - z-index: 2; - position: absolute; - left: 0; - margin: 0; - -webkit-border-radius: 0; -} -input[type="radio"]:checked { - background: url('../images/radiobutton.png') no-repeat; - background-position: right center; -} -.radiobutton .name { - z-index: 1; -} -select { - -webkit-appearance: none; - height: 100%; - width: 100%; - border: 0; -} -li.select select { - -webkit-border-radius: 0; - color: #000; - font-weight: bold; - font-size: 17px; -} -li.select option { - max-width: 90%; -} -li.select .arrow { - background: url('../images/arrow.png'); - width: 8px; - height: 13px; - display: block; - -webkit-transform: rotate(90deg); - position: absolute; - right: 10px; - top: 18px; -} -.button input { - width: 100%; - height: 100%; - -webkit-appearance: none; - border: 0; - -webkit-border-radius: 0; - font-weight: bold; - font-size: 17px; - text-overflow: ellipsis; - white-space: nowrap; - overflow: hidden; -} -.textbox textarea { - text-align: center; - padding: 0; - margin-top: 5px; -} -.bigfield input { - -webkit-appearance: none; - border: 0; - width: 100%; - height: 100%; - padding: 0; - -webkit-border-radius: 0; - background: transparent; - font-weight: bold; - font-size: 17px; - padding-left: 5px; -} -.smallfield .name { - width: 48%; - position: absolute; - left: 0; - font-size: 17px; - text-overflow: ellipsis; - white-space: nowrap; - font-weight: bold; - line-height: 44px; - font-size: 17px; - padding-left: 5px; - overflow: hidden; -} -.smallfield input { - width: 50%; - position: absolute; - right: 0; - height: 44px; - -webkit-appearance: none; - border: none; - padding: 0; - background: transparent; - -webkit-border-radius: 0; - font-weight: bold; - font-size: 17px; -} -.smallfield:first-child input { - -webkit-border-top-right-radius: 8px; -} -.smallfield:last-child input { - -webkit-border-bottom-right-radius: 8px; -} diff --git a/css/istreamdev.css b/css/istreamdev.css new file mode 100644 index 0000000..ac58b7a --- /dev/null +++ b/css/istreamdev.css @@ -0,0 +1,316 @@ + +div.loader { + font-family: Arial, Helvetica, sans-serif; + font-size: 14px; + + background-image: url(../img/loading.gif); + background-repeat: no-repeat; + background-position: 50% 50%; + text-align: center; + vertical-align: middle; + height: 100%; + width: 100%; + position: absolute; + z-index: 10; + left: 0px; + top: 0px; + opacity: .85; + display: block; + +} + +ul li img.menuicon { +vertical-align: middle; +} + +h1 img.menuicon { +position:relative; +top: 3px; +width: 22px; +height: 20px; +} + +.menuname { +vertical-align: middle; +margin: 0 0 0 10px; +} + +li.forward > a > span, span.substring { +vertical-align: middle; +} +li.channellist { +height: 55px; +background-image: url(../img/chevron.png), -webkit-gradient(linear, 0% 0%, 0% 100%, from(#4c4d4e), to(#404142)); +background-position: right center; +background-repeat: no-repeat; +} + +li.channellist img { +width: 55px; +height: 55px; +vertical-align: middle; +position: relative; +-webkit-mask-box-image: url(../img/mask.png) 80 stretch; +top: 0px; +} + +li.channellist span.name { +margin: 10px 0 0 0px; +left: 90px; +text-overflow: ellipsis; +overflow: hidden; +max-width: 80%!important; +white-space: nowrap; +font-size: 17px; +line-height: normal; +position: absolute; +font-weight: bold; + +} +li.channellist span.comment { +margin: 28px 0 0 0px; +left: 90px; +max-width: 80%!important; +font-size: 14px; +line-height: normal; +position: absolute; +top: 15 px; +font-style: italic; +font-weight: normal; +} + +li.channellist small.counter { + margin-right: 15px; + position: relative; + top: 36px; + font-size: 17px; + line-height: 13px; + font-weight: bold; + background: rgba(0,0,0,.15); + color: #fff; + -webkit-border-radius: 11px; + display: block; + width: auto; + -webkit-box-shadow: rgba(255,255,255,.1) 0 1px 0; +} +ul.thumb { +-webkit-border-radius: 8px; +-webkit-box-shadow: rgba(0,0,0,.3) 1px 1px 3px; +} + +.thumbnail { +vertical-align: middle; +margin: 5px 0 5px 0; +} + +span.streamButton a{ +margin: 5px 5px 5px 5px; +border-width: 0 12px; +padding: 8px; +text-align: center; +font-size: 14px; +font-weight: bold; +text-decoration: inherit; +color: inherit; +-webkit-border-image: url(../img/stream.png) 0 12 0 12; +color: #FFFFFF; +} +span.streamButton a:active{ +color: #aaa; +-webkit-border-image: url(../img/stream_clicked.png) 0 12 0 12; +} +span.recButton a{ +margin: 5px 5px 5px 5px; +border-width: 0 12px; +padding: 8px; +text-align: center; +font-size: 14px; +font-weight: bold; +text-decoration: inherit; +color: inherit; +-webkit-border-image: url(../img/rec.png) 0 12 0 12; +color: #FFFFFF; +} +span.recButton a:active{ +color: #aaa; +-webkit-border-image: url(../img/rec_clicked.png) 0 12 0 12; +} + +ul.streaminfo { +-webkit-border-radius: 8px; +-webkit-box-shadow: rgba(0,0,0,.3) 1px 1px 3px; +} +ul.streaminfo li:first-child, ul.streaminfo li:first-child a { + border-top: 0; + -webkit-border-top-left-radius: 8px; + -webkit-border-top-right-radius: 8px; +} +ul.streaminfo li:last-child, ul.streaminfo li:last-child a { + -webkit-border-bottom-left-radius: 8px; + -webkit-border-bottom-right-radius: 8px; +} + +ul.streaminfo span.name_now, span.name_next { +padding-top: 0px; +padding-right: 10px; +padding-left: 10px; +font-size: 17px; +font-weight: bold; +display: block; +color: white; +text-shadow: rgba(0,0,0,.8) 0 1px 0; +} +ul.streaminfo span.epgtime_now, span.epgtime_next { +padding-top: 0px; +padding-right: 10px; +padding-left: 10px; +font-size: 14px; +font-weight: bold; +display: block; +color: #ccc; +text-shadow: rgba(0,0,0,.8) 0 1px 0; +} +ul.streaminfo span.desc_now { +position: relative; +padding-top: 5px; +padding-right: 10px; +padding-bottom: 10px; +padding-left: 10px; +display: block; +color: white; +font-size: 14px; +font-style: italic; +font-weight: normal; +line-height: normal; + +} + +ul.streamstatus { +-webkit-border-radius: 8px; +-webkit-box-shadow: rgba(0,0,0,.3) 1px 1px 3px; +} +ul.streamstatus span.title { +padding-top: 10px; +padding-right: 10px; +padding-left: 10px; +font-size: 17px; +font-weight: bold; +display: block; +color: white; +text-shadow: rgba(0,0,0,.8) 0 1px 0; +} + +ul.streamstatus span.mode { +position: relative; +padding-top: 10px; +padding-right: 10px; +padding-bottom: 10px; +padding-left: 10px; +display: block; +color: white; +font-size: 14px; +font-style: italic; +font-weight: normal; +line-height: normal; +} +#jqt ul li select option{ +color: #000000; +} +#jqt ul li select optgroup{ +color: #999; +} +span.timertitle { +padding-right: 10px; +padding-left: 10px; +font-size: 14px; +font-weight: bold; +color: #999; +text-shadow: rgba(0,0,0,.8) 0 1px 0; +} +span.menutitle { +padding-right: 10px; +padding-left: 10px; +font-size: 17px; +font-weight: bold; +color: #999; +text-shadow: rgba(0,0,0,.8) 0 1px 0; +} +.formerrormsg { +padding-right: 10px; +padding-left: 10px; +font-size: 12px; +color: #FF8300; + +} +#timers .info { +display: none; +} + +a.cat_but { + +} + +video { +padding-top:5px; +} +li.track small.counter { +margin-right: 15px; +position: relative; +top: -2px; +font-size: 17px; +line-height: 13px; +font-weight: bold; +background: rgba(0,0,0,.15); +color: #fff; +-webkit-border-radius: 11px; +display: block; +width: auto; +-webkit-box-shadow: rgba(255,255,255,.1) 0 1px 0; +} +li.track { +height: 20px; +padding: 0; +} + +li.track .numberbox { +position: relative; +width: 23px; +height: 42px; +top: -10px; +display: block; +float: left; +margin-right: 3px; +border-right: 1px solid #333333; +-webkit-box-shadow: rgba(255,255,255,.1) 0 1px 0; +} +li.track .number { +position: absolute; +color: #9c9ea0; +top: 10px; +left: 2px; +} +li.track a span.tracktitle { +position: relative; +left: 32px; +padding-left: 4px; +top: -3px; +} +li.track div.timebox { +position: relative; +width: 30px; +height: 42px; +top: -38px; +display: block; +float: right; +margin-left: 3px; +border-left: 1px solid #333333; +-webkit-box-shadow: rgba(255,255,255,.1) 0 1px 0; +} +li.track .time { +position: absolute; +color: #9c9ea0; +top: 13px; +left: 5px; +font-size: 14px; +} + diff --git a/css/spinningwheel.css b/css/spinningwheel.css index dd5df67..169853a 100755..100644 --- a/css/spinningwheel.css +++ b/css/spinningwheel.css @@ -2,6 +2,8 @@ position:absolute; z-index:1000; left:0; width:100%; + display:inline !important; + min-height: 0px !important; font-family:helvetica, sans-serif; background:rgba(0,0,0,0.7); text-align:left; @@ -11,7 +13,7 @@ position:relative; width:100%; height:43px; border-top:1px solid #000; border-bottom:1px solid #000; - background:url(../images/sw-header.png) 0 0 repeat-x; + background:url(../img/sw-header.png) 0 0 repeat-x; opacity: 0.9; } @@ -29,13 +31,13 @@ #sw-cancel { left:7px; float:left; - -webkit-border-image:url(../images/sw-button-cancel.png) 5; + -webkit-border-image:url(../img/sw-button-cancel.png) 5; } #sw-done { right:7px; float:right; - -webkit-border-image:url(../images/sw-button-done.png) 5; + -webkit-border-image:url(../img/sw-button-done.png) 5; } .sw-pressed { opacity:0.4; } @@ -60,7 +62,7 @@ padding-top:86px; border-left:2px solid #0d0e0f; background-color:#fcfcfc; - background-image: url(sw-slot-border.png); + background-image: url(../img/sw-slot-border.png); background-position: 0 0, 100% 0; background-repeat: repeat-y; } @@ -77,6 +79,8 @@ #sw-slots .sw-readonly { background:#ddd; } #sw-slots li { + border-top: 0px solid black !important; + color:#000000 !important; padding:0 8px; height:44px; overflow:hidden; @@ -88,5 +92,5 @@ left:0; right:0; bottom:0; height:183px; border-width:16px; - -webkit-border-image:url(../images/sw-alpha.png) 16; + -webkit-border-image:url(../img/sw-alpha.png) 16; }
\ No newline at end of file diff --git a/css/style.css b/css/style.css deleted file mode 100755 index 3d5e9fd..0000000 --- a/css/style.css +++ /dev/null @@ -1,1172 +0,0 @@ -body { - position: relative; - margin: 0; - -webkit-text-size-adjust: none; - min-height: 416px; - font-family: helvetica,sans-serif; - background: url("../images/background.png") repeat; - -webkit-touch-callout: none; -} -.center { - margin: auto; - display: block; - text-align:center!important -} -img { - border: 0; -} -a:hover span.arrow { - background-position: 0 -13px!important; -} -@media screen and (max-width: 320px) -{ -#topbar { - height: 44px; -} -#title { - line-height: 44px; - height: 44px; - font-size: 16pt; -} -#tributton a:first-child, #duobutton a:first-child { - width: 101px; -} -#tributton a:last-child, #duobutton a:last-child { - width: 101px; -} -#tributton a { - width: 106px; -} -#duobutton .links { - width: 195px; -} -#tributton .links { - width: 302px; -} -#doublead { - width: 300px!important; -} -#duoselectionbuttons { - width: 191px; - height: 30px; - top: 7px; -} -#triselectionbuttons { - width: 290px; - height: 30px; - top: 7px; -} -#triselectionbuttons a:first-child, #duoselectionbuttons a:first-child { - width: 99px; - height: 28px; - line-height: 28px; -} -#triselectionbuttons a { - width: 98px; - height: 28px; - line-height: 28px; -} -#triselectionbuttons a:last-child, #duoselectionbuttons a:last-child { - width: 99px; - height: 28px; - line-height: 28px; -} -.searchbox form { - width: 272px; -} -.searchbox input[type="text"] { - width: 275px; -} -li.menu span.name { - max-width: 77%; -} -li.checkbox .name { - max-width: 190px; -} -li.radiobutton .name { - max-width: 190px; -} -#leftnav a, #rightnav a, #leftbutton a, #rightbutton a, #blueleftbutton a, #bluerightbutton a { - line-height: 30px; - height: 30px; -} -#leftnav img, #rightnav img { - margin-top: 4px; -} -#leftnav, #leftbutton, #blueleftbutton { - top: 7px; -} -#rightnav, #rightbutton, #bluerightbutton { - top: 7px; -} -body.musiclist ul li span.name { - max-width:55% -} -.textbox textarea { - width: 280px; -} -} -@media screen and (min-width: 321px) -{ -#topbar { - height: 32px; -} -#title { - line-height: 32px; - height: 32px; - font-size: 13pt; -} -li.menu span.name { - max-width: 85%; -} -li.checkbox .name { - max-width: 75%; -} -li.radiobutton .name { - max-width: 75%; -} -#leftnav a, #rightnav a, #leftbutton a, #rightbutton a, #blueleftbutton a, #bluerightbutton a { - line-height: 24px; - height: 24px; -} -#leftnav img, #rightnav img { - margin-top: 4px; - height: 70%; -} -#leftnav, #leftbutton, #blueleftbutton { - top: 4px; -} -#rightnav, #rightbutton, #bluerightbutton { - top: 4px; -} -body.musiclist ul li span.name { - max-width:70% -} -.textbox textarea { - width: 440px; -} -#tributton a:first-child, #duobutton a:first-child { - width: 152px; -} -#tributton a:last-child, #duobutton a:last-child { - width: 152px; -} -#tributton a { - width: 154px; -} -#tributton .links { - width: 452px; -} -#duobutton .links { - width: 298px; -} -#doublead { - width: 350px!important; -} -#duoselectionbuttons { - width: 293px; - height: 24px; - top: 4px; -} -#triselectionbuttons { - width: 450px; - height: 24px; - top: 4px; -} -#triselectionbuttons a:first-child, #duoselectionbuttons a:first-child { - width: 150px; - height: 22px; - line-height: 22px; -} -#triselectionbuttons a { - width: 156px; - height: 22px; - line-height: 22px; -} -#triselectionbuttons a:last-child, #duoselectionbuttons a:last-child { - width: 150px; - height: 22px; - line-height: 22px; -} -.searchbox form { - width: 432px; -} -.searchbox input[type="text"] { - width: 435px; -} -} -#topbar.black { - background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#858585), color-stop(3%, #636363), color-stop(50%, #202020), color-stop(51%, black), color-stop(97%, black), to(#262626)); -} -#topbar.transparent { - background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgba(133,133,133,0.7)), color-stop(3%, rgba(99,99,99,0.7)), color-stop(50%, rgba(32,32,32,0.7)), color-stop(51%, rgba(0,0,0,0.7)), color-stop(97%, rgba(0,0,0,0.7)), to(rgba(38,38,38,0.7))); -} -#topbar { - position: relative; - left: 0; - top: 0; - width: auto; - background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#cdd5df), color-stop(3%, #b0bccd), color-stop(50%, #889bb3), color-stop(51%, #8195af), color-stop(97%, #6d84a2), to(#2d3642)); - margin-bottom: 13px; -} -#title { - position: absolute; - font-weight: bold; - top: 0; - left: 0; - right: 0; - padding: 0 10px; - text-align: center; - text-overflow: ellipsis; - white-space: nowrap; - overflow: hidden; - color: #FFF; - text-shadow: rgba(0,0,0,0.6) 0 -1px 0; -} -} -#content { - width: 100%; - position: relative; - min-height: 250px; - margin-top: 10px; - height: auto; - z-index: 0; - overflow: hidden; -} -#footer { - text-align: center; - position: relative; - margin: 20px 10px 0; - height: auto; - width: auto; - bottom: 10px; -} -body.ipodlist #footer, body.ipodlist #footer a { - text-shadow: #FFF 0 -1px 0; -} -#footer a, #footer { - text-decoration: none; - font-size: 9pt; - color: #4C4C4C; - text-shadow: #FFF 0 1px 0; -} -.pageitem img { - border: 0; - margin-top: 5px; - margin-left: 5px; -} - -.pageitem video { - border: 0; - margin-top: 5px; - margin-left: 5px; -} - -.pageitem { - -webkit-border-radius: 8px; - background-color: #fff; - border: #878787 solid 1px; - font-size: 12pt; - overflow: hidden; - padding: 0; - position: relative; - display: block; - height: auto; - width: auto; - margin: 3px 9px 17px; - list-style: none; -} -.textbox { - padding: 5px 9px; - position: relative; - overflow: hidden; - border-top: 1px solid #878787; -} -#tributton, #duobutton { - height: 44px; - background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#cdd4d9), color-stop(3%, #c0c9cf), color-stop(97%, #abb7bf),to(#81929f)); - margin: -13px 0 13px 0; - text-align: center; -} -#tributton .links, #duobutton .links { - height: 30px; - -webkit-border-image: url("../images/tributton.png") 0 4 0 4; - border-width: 0 4px 0 4px; - margin: 0 auto 0px auto; - position: relative; - top: 7px; -} -#tributton a:first-child, #duobutton a:first-child { - border-right: 1px solid #6d7e91; - -webkit-border-top-left-radius: 5px; - -webkit-border-bottom-left-radius: 5px; - margin-left: -4px; -} -#tributton a, #duobutton a { - text-overflow: ellipsis; - overflow: hidden; - white-space: nowrap; - height: 27px; - display: inline-block; - line-height: 27px; - margin-top: 1px; - font: bold 13px; - text-decoration: none; - color: #3f5c84; - text-shadow: #FFF 0 1px 0; -} -#duobutton a:last-child { - border: 0; -} -#tributton a:last-child { - border-left: 1px solid #6d7e91; -} -#tributton a:last-child, #duobutton a:last-child { - -webkit-border-top-right-radius: 5px; - -webkit-border-bottom-right-radius: 5px; - margin-right: -4px; -} -#tributton a:hover, #tributton a#pressed, #duobutton a:hover, #duobutton a#pressed { - background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#7b8b9f), color-stop(3%, #8c9baf), to(#647792)); - color: white; - text-shadow: black 0 -1px 0; -} -#triselectionbuttons, #duoselectionbuttons { - -webkit-border-image: url('../images/navbutton.png') 0 5 0 5; - border-width: 0 5px 0 5px; - position: relative; - margin: auto; -} -#duoselectionbuttons a:first-child { - border: 0; -} -#triselectionbuttons a:first-child { - border-right: solid 1px #556984; -} -#triselectionbuttons a:first-child, #duoselectionbuttons a:first-child { - margin-left: -4px; - -webkit-border-top-left-radius: 6px; - -webkit-border-bottom-left-radius: 6px; -} -#triselectionbuttons a, #duoselectionbuttons a { - display: inline-block; - text-align: center; - color: white; - text-decoration: none; - margin-top: 1px; - text-shadow: black 0 -1px 0; - background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#909baa), color-stop(3%, #a5b4c6), color-stop(50%, #798eaa), color-stop(51%, #6b83a1), color-stop(97%, #6e85a3), to(#526379)); -} -#triselectionbuttons a:last-child, #duoselectionbuttons a:last-child { - border-left: solid 1px #556984; - margin-right: -4px; - -webkit-border-top-right-radius: 6px; - -webkit-border-bottom-right-radius: 6px; -} -#triselectionbuttons a:hover, #triselectionbuttons a#pressed, #duoselectionbuttons a:hover, #duoselectionbuttons a#pressed { - background: none; -} -#doublead { - height: 83px!important; - position: relative; - margin: 0 auto 13px auto; -} -#doublead a:first-child { - left: 0!important; -} -#doublead a:last-child { - right: 0!important; -} -#doublead a { - width: 147px!important; - height: 83px!important; - position: absolute; - -webkit-border-radius: 8px; - display: block; - background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#7c7c7c), color-stop(3%, #858585), color-stop(97%, #a4a4a4),to(#c2c2c2)); -} -li#doublead { - margin-top: 25px; - margin-bottom: 10px!important; - background: none; -} -li#doublead:hover { - background: none; -} -.searchbox { - height: 44px; - background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#f1f3f4), color-stop(3%, #e0e4e7), color-stop(50%, #c7cfd4), color-stop(51%, #bec7cd), color-stop(97%, #b4bec6), to(#8999a5)); - margin: -13px 0 13px 0; - width: 100%; -} -.searchbox form { - height: 24px; - -webkit-border-image: url('../images/searchfield.png') 4 14 1 24; - border-width: 4px 14px 1px 24px; - display: block; - position: relative; - top: 8px; - margin: auto; -} -fieldset { - border: 0; - margin: 0; - padding: 0; -} -.searchbox input[type="text"] { - border: 0; - -webkit-appearance: none; - height: 18px; - float: left; - font-size: 13px; - padding: 0; - position: relative; - top: 2px; - left: 2px; -} -.textbox img { - max-width: 100%; -} -.textbox p { - margin-top: 2px; -} -.textbox p { - margin-top: 2px; - color: #000; - margin-bottom: 2px; - text-align: justify; -} -.textbox img { - max-width: 100%; -} -.textbox ul { - margin: 3px 0 3px 0; - list-style: circle!important; -} -.textbox li { - margin: 0!important; -} -.pageitem li:first-child, .pageitem li.form:first-child { - border-top: 0; -} -li.menu, li.checkbox, li.radiobutton, li.select, li.button, li.bigfield, li.smallfield { - position: relative; - list-style-type: none; - display: block; - height: 43px; - overflow: hidden; - border-top: 1px solid #878787; - width: auto; -} -ul.pageitem li:first-child:hover, .pageitem li:first-child a, li.radiobutton:first-child input, li.select:first-child select, li.button:first-child input, .bigfield:first-child input { - -webkit-border-top-left-radius: 8px; - -webkit-border-top-right-radius: 8px; -} -ul.pageitem li:last-child:hover, .pageitem li:last-child a, li.radiobutton:last-child input, li.select:last-child select, li.button:last-child input, .bigfiel:last-child input { - -webkit-border-bottom-left-radius: 8px; - -webkit-border-bottom-right-radius: 8px; -} -li.menu:hover, li.store:hover, body.list div#content li a:hover, body.list li.withimage:hover, body.applist li:hover:nth-child(n),body.ipodlist li:hover:nth-child(n) { - background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#058cf5), to(#015fe6)); -} -body.ipodlist li:hover:nth-child(n) .name,body.ipodlist li:hover:nth-child(n) .time{border:0} -li.menu a:hover span.name, li.menu a:hover span.comment, li.store:hover .starcomment, li.store:hover .name, li.store:hover .comment, body.list li.withimage a:hover .comment { - color: #fff; -} -li.menu a:hover span.comment { - color: #CCF; -} -li.menu a { - display: block; - height: 43px; - width: auto; - text-decoration: none; -} -li.menu a img { - width: auto; - height: 32px; - margin: 5px 0 0 5px; - float: left; -} -li.menu span.name, li.checkbox .name, li.radiobutton .name { - margin: 11px 0 0 7px; - width: auto; - color: #000; - font-weight: bold; - font-size: 17px; - text-overflow: ellipsis; - overflow: hidden; - white-space: nowrap; - float: left; -} -li.menu span.comment { - margin: 11px 30px 0 0; - width: auto; - font-size: 17px; - text-overflow: ellipsis; - overflow: hidden; - max-width: 75%; - white-space: nowrap; - float: right; - color: #324f85; -} -li.menu span.arrow, li.store span.arrow, body.musiclist span.arrow, body.list span.arrow { - position: absolute; - width: 8px!important; - height: 13px!important; - right: 10px; - top: 15px; - margin: 0!important; - background: url("../images/arrow.png") 0 0 no-repeat; -} -body.applist span.arrow { - position: absolute; - width: 8px!important; - height: 13px!important; - right: 10px; - top: 29px; - margin: 0!important; - background: url("../images/arrow.png") 0 0 no-repeat; -} -li.store { - height: 90px; - border-top: #878787 solid 1px; - overflow: hidden; - position: relative; -} -li.store a { - width: 100%; - height: 90px; - display: block; - text-decoration: none; - position: absolute; -} -li.store .image { - position: absolute; - left: 0; - top: 0; - height: 90px; - width: 90px; - display: block; - background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#eff1f5), to(#d6dce6)); - -webkit-background-size: 90px; -} -body.applist .image { - width: 57px; - height: 57px; - display: block; - position: absolute; - top: 7px; - left: 11px; - -webkit-border-radius: 8px; - -webkit-box-shadow: 0 2px 3px rgb(0,0,0); - background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#7c7c7c), color-stop(3%, #858585), color-stop(97%, #a4a4a4),to(#c2c2c2)); - -webkit-background-size: 57px; -} -li:first-child.store .image, li.store:first-child a { - -webkit-border-top-left-radius: 8px 8px; -} -li:last-child.store .image, li.store:last-child a { - -webkit-border-bottom-left-radius: 8px 8px; -} -li.store .name, body.applist .name { - font-size: 15px; - white-space: nowrap; - display: block; - overflow: hidden; - color: #000; - max-width: 60%; - text-overflow: ellipsis; - font-weight: bold; -} -li.store .name { - position: absolute; - left: 95px; - top: 35px; -} -body.applist .name { - position: absolute; - top: 27px; - left: 80px; - text-shadow: #eeeeee 0 1px 0; -} -li.store .comment, body.list li.withimage .comment, body.applist .comment, body.applist .price { - font-size: 12px; - color: #7f7f7f; - display: block; - width: 60%; - font-weight: bold; - white-space: nowrap; - text-overflow: ellipsis; - overflow: hidden; -} -li.store .comment, body.list li.withimage .comment { - margin: 16px 0 0 95px; -} -body.applist .comment { - position: absolute; - top: 9px; - left: 80px; - text-shadow: #eeeeee 0 1px 0; - color: #3b3b3b; -} -body.applist .price { - position: absolute; - top: 29px; - right: 26px; - text-shadow: #eeeeee 0 1px 0; - text-align: right; - color: #3b3b3b; -} -li.store .arrow, body.list li.withimage .arrow { - top: 39px!important; -} -li.store .stars0, li.store .stars1, li.store .stars2, li.store .stars3, li.store .stars4, li.store .stars5 { - position: absolute; - top: 56px; - left: 95px; - width: 65px; - height: 18px; - display: block!important; -} -li.store .stars0 { - background: url('../images/0starsborder.png'); -} -li.store .stars1 { - background: url('../images/1starsborder.png'); -} -li.store .stars2 { - background: url('../images/2starsborder.png'); -} -li.store .stars3 { - background: url('../images/3starsborder.png'); -} -li.store .stars4 { - background: url('../images/4starsborder.png'); -} -li.store .stars5, body.applist .stars5 { - background: url('../images/5stars.png'); -} -body.applist .stars0, body.applist .stars1, body.applist .stars2, body.applist .stars3, body.applist .stars4, body.applist .stars5 { - position: absolute; - top: 46px; - left: 79px; - width: 65px; - height: 18px; - display: block!important; -} -body.applist .stars0 { - background: url('../images/0stars.png'); -} -body.applist .stars1 { - background: url('../images/1stars.png'); -} -body.applist .stars2 { - background: url('../images/2stars.png'); -} -body.applist .stars3 { - background: url('../images/3stars.png'); -} -body.applist .stars4 { - background: url('../images/4stars.png'); -} -body.applist .starcomment { - left: 147px; - top: 46px; - color: #3b3b3b; -} -.starcomment { - position: absolute; - left: 165px; - top: 56px; - font-size: 12px; - color: #7f7f7f; - font-weight: lighter; -} -body.applist a:hover .name, body.applist a:hover .starcomment, body.applist a:hover .comment, body.applist a:hover .price { - color: white; - text-shadow: none; -} -.graytitle { - position: relative; - font-weight: bold; - font-size: 17px; - right: 20px; - left: 9px; - color: #4C4C4C; - text-shadow: #FFF 0 1px 0; - padding: 1px 0 3px 8px; -} -.header { - display: block; - font-weight: bold; - color: rgb(73,102,145); - font-size: 12pt; - margin-bottom: 6px; - line-height: 14pt; -} -body.musiclist div#content, body.ipodlist div#content, body.applist div#content { - width: auto; - margin: -16px auto auto -40px; -} -body.musiclist li:nth-child(odd) { - background: #dddee0 -} -body.applist li:nth-child(even) { - background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#adadb0), color-stop(98%, #adadb0), to(#898a8d)) -} -body.applist li:nth-child(odd) { - background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#98989c), color-stop(98%, #98989c), to(#898a8d)) - -} -body.ipodlist li:nth-child(even) { - background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#414041), color-stop(3%, rgba(45,45,45,0.2)), to(rgba(45,45,45,0.2))) -} -body.ipodlist li:nth-child(odd) { - background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#414041), color-stop(3%, rgba(50,50,50,0.4)), to(rgba(50,50,50,0.4))) -} -body.musiclist div#content ul li, body.ipodlist div#content ul li, body.applist div#content ul li { - list-style: none; - width: auto; - position: relative; -} -body.musiclist div#content ul li { - height: 44px; - border-bottom: 1px solid #e6e6e6; -} -body.applist div#content ul li { - height: 70px; - margin-bottom: 1px; -} -body.ipodlist div#content ul li { - height: 42px; -} -body.ipodlist div#content { - background: -webkit-gradient(radial, 50% -70, 0, 50% 0, 200, from(#444444), to(rgb(13, 13, 13))) rgb(13, 13, 13); -} -body.musiclist div#content ul li a, body.ipodlist div#content ul li a { - text-decoration: none; - color: #000; - width: 100%!important; - height: 100%; - display: block; -} -body.applist div#content ul li a { - text-decoration: none; - color: #000; - width: 100%; - height: 100%; - display: block; -} -body.musiclist ul li .number, body.musiclist .name, body.musiclist .time { - display: inline-block; - height: 44px; - font-weight: bold; - font-size: large; - width: 44px; - text-align: center; - line-height: 46px; -} -body.musiclist ul li .name { - margin-left: 0; - width: auto!important; - font-size: medium; - padding-left: 5px; - border-left: solid 1px #e6e6e6; -} -body.musiclist ul li .time { - color: #848484; - font-size: medium; - margin-left: 4px; - width: auto!important; - font-weight: normal; -} -body.musiclist { - background-image: none!important; - background-color: #cbcccf; -} -body.ipodlist { - background-image: none!important; - background-color: black; -} -body.applist { - background-image: none!important; - background-color: #98989c; -} -body.ipodlist span { - color: white; - font-weight: bold; - font-size: 14px; -} -body.musiclist ul li span.name { - text-overflow: ellipsis; - overflow: hidden; - white-space: nowrap; -} -body.musiclist a:hover span.name { - color: #0380f2; -} -body.ipodlist .number { - width: 23px; - display: block; - float: left; - height: 42px; - margin-right: 3px; - text-align: right; - line-height: 43px; -} -body.ipodlist .stop, body.ipodlist .auto, body.ipodlist .play { - width: 18px; - display: block; - float: left; - height: 10px; - text-align: right; - line-height: 43px; - margin-top: 16px; -} -body.ipodlist .play { - background: url('../images/play.gif') no-repeat; -} -body.ipodlist a:hover .auto, body.ipodlist a:hover .play { - background: url('../images/play.gif') no-repeat; - background-position: 0 -10px; -} -body.ipodlist .time { - width: 48px; - float: right; - border-left: solid #414041 1px; - display: block; - height: 42px; - text-align: center; - line-height: 43px; -} -body.ipodlist .name { - display: block; - float: left; - width: inherit; - height: 42px; - text-overflow: ellipsis; - line-height: 42px; - padding-left: 5px; - overflow: hidden; - white-space: nowrap; - max-width: 62%; - border-left: solid #414041 1px; -} -body.list ul li.title { - background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#a5b1ba), color-stop(3%, #909faa), color-stop(97%, #b5bfc6), to(#989ea4)); - height: 22px!important; - width: 100%; - color: #fff; - font-weight: bold; - font-size: 16px; - text-shadow: gray 0 1px 0; - line-height: 22px; - padding-left: 20px; - border-bottom: none!important; -} -body.list ul { - background-color: #fff; - width: 100%; - overflow: hidden; - padding: 0; - margin: 0; -} -body.list div#content li { - height: 40px; - border-bottom: 1px solid #e1e1e1; - list-style: none; -} -body.list { - background-color: #fff; - background-image: none!important; -} -body.list div#footer { - margin-top: 24px!important; -} -body.list div#content li a { - padding: 9px 0 0 20px; - font-size: large; - font-weight: bold; - position: relative; - display: block; - color: #000; - text-decoration: none; - height: 32px; -} -body.list div#content li a span.name { - text-overflow: ellipsis; - overflow: hidden; - max-width: 93%; - white-space: nowrap; - display: block; -} -body.list div#content li a:hover { - color: #fff; -} -body.list div#content { - margin-top: -13px!important; -} -body.list ul img { - width: 80px; - height: 80px; - position: absolute; - left: 5px; - top: 5px; -} -body.list li.withimage { - height: 90px!important; -} -body.list li.withimage span.name { - margin: 13px 0 0 90px; - text-overflow: ellipsis; - overflow: hidden; - max-width: 63%!important; - white-space: nowrap; -} -body.list li.withimage .comment { - margin: 10px auto auto 90px !important; - max-width: 63%!important; -} -body.list li.withimage a, body.list li.withimage:hover a { - height: 81px!important; -} -#leftnav, #leftbutton, #blueleftbutton { - position: absolute; - font-size: 12px; - left: 9px; - font-weight: bold; -} -#leftnav, #leftbutton, #rightnav, #rightbutton, #blueleftbutton, #bluerightbutton { - z-index: 5000; -} -#leftnav a, #rightnav a, #leftbutton a, #rightbutton a, #blueleftbutton a, #bluerightbutton a { - display: block; - color: #fff; - text-shadow: rgba(0,0,0,0.6) 0 -1px 0; - text-decoration: none; -} -.black #leftnav a:first-child, .transparent #leftnav a:first-child { - -webkit-border-image: url("../images/navleftblack.png") 0 5 0 13; -} -.black #leftnav a, .transparent #leftnav a { - -webkit-border-image: url("../images/navlinkleftblack.png") 0 5 0 13; -} -.black #rightnav a:first-child, .transparent #rightnav a:first-child { - -webkit-border-image: url("../images/navrightblack.png") 0 13 0 5; -} -.black #rightnav a, .transparent #rightnav a { - -webkit-border-image: url("../images/navlinkrightblack.png") 0 13 0 5; -} -.black #leftbutton a, .black #rightbutton a, .transparent #leftbutton a, .transparent #rightbutton a { - -webkit-border-image: url("../images/navbuttonblack.png") 0 5 0 5; -} -#leftnav a:first-child { - z-index: 2; - -webkit-border-image: url("../images/navleft.png") 0 5 0 13; - border-width: 0 5px 0 13px; - -webkit-border-top-left-radius: 16px; - -webkit-border-bottom-left-radius: 16px; - -webkit-border-top-right-radius: 6px; - -webkit-border-bottom-right-radius: 6px; - width: auto; -} -#leftnav a { - -webkit-border-image: url("../images/navlinkleft.png") 0 5 0 13; - z-index: 3; - margin-left: -4px; - border-width: 0 5px 0 13px; - padding-right: 4px; - -webkit-border-top-left-radius: 16px; - -webkit-border-bottom-left-radius: 16px; - -webkit-border-top-right-radius: 6px; - -webkit-border-bottom-right-radius: 6px; - float: left; -} -#rightnav, #rightbutton, #bluerightbutton { - position: absolute; - font-size: 12px; - right: 9px; - font-weight: bold; -} -#rightnav a { - -webkit-border-image: url("../images/navlinkright.png") 0 13 0 5; - z-index: 3; - margin-right: -4px; - border-width: 0 13px 0 5px; - padding-left: 4px; - -webkit-border-top-left-radius: 6px; - -webkit-border-bottom-left-radius: 6px; - float: right; - -webkit-border-top-right-radius: 16px; - -webkit-border-bottom-right-radius: 16px; -} -#rightnav a:first-child { - z-index: 2; - -webkit-border-top-left-radius: 6px; - -webkit-border-bottom-left-radius: 6px; - -webkit-border-image: url("../images/navright.png") 0 13 0 5; - border-width: 0 13px 0 5px; - -webkit-border-top-right-radius: 16px; - -webkit-border-bottom-right-radius: 16px; -} -#leftbutton a, #rightbutton a { - -webkit-border-image: url("../images/navbutton.png") 0 5 0 5; - border-width: 0 5px; - -webkit-border-radius: 6px; -} -#blueleftbutton a, #bluerightbutton a { - -webkit-border-image: url("../images/navbuttonblue.png") 0 5 0 5; - border-width: 0 5px; - -webkit-border-radius: 6px; -} -.rssxpresschannel { - font-family: helvetica,sans-serif; - border: 0; -} -} -.rssxpresschtitle { - text-align: center; -} -.rssxpresschdesc { - color: #000; - text-align: center; - border-bottom: 1px solid #000; - padding-bottom: 5px; -} -.rssxpressittitle { - display: block; - font-size: 12pt; - background: #fff; - margin: 5px 0 2px; -} -.rssxpressittitle a { - text-decoration: none!important; - font-weight: bold; - color: rgb(73,102,145); - line-height: 10pt; -} -.rssxpressitdesc { - background: #fff; - font-size: 10pt; -} -.rssxpressdivider { - display: none; -} -input[type="checkbox"] { - width: 94px; - height: 27px; - background: url('../images/checkbox.png'); - -webkit-appearance: none; - border: 0; - float: right; - margin: 8px 4px 0 0; -} -input[type="checkbox"]:checked { - background-position: 0 27px; -} -input[type="radio"] { - -webkit-appearance: none; - border: 0; - width: 100%; - height: 100%; - z-index: 2; - position: absolute; - left: 0; - margin: 0; - -webkit-border-radius: 0; -} -input[type="radio"]:checked { - background: url('../images/radiobutton.png') no-repeat; - background-position: right center; -} -.radiobutton .name { - z-index: 1; -} -select { - -webkit-appearance: none; - height: 100%; - width: 100%; - border: 0; -} -li.select select { - -webkit-border-radius: 0; - color: #000; - font-weight: bold; - font-size: 17px; -} -li.select option { - max-width: 90%; -} -li.select .arrow { - background: url('../images/arrow.png'); - width: 8px; - height: 13px; - display: block; - -webkit-transform: rotate(90deg); - position: absolute; - right: 10px; - top: 18px; -} -.button input { - width: 100%; - height: 100%; - -webkit-appearance: none; - border: 0; - -webkit-border-radius: 0; - font-weight: bold; - font-size: 17px; - text-overflow: ellipsis; - white-space: nowrap; - overflow: hidden; -} -.textbox textarea { - text-align: center; - padding: 0; - margin-top: 5px; -} -.bigfield input { - -webkit-appearance: none; - border: 0; - width: 100%; - height: 100%; - padding: 0; - -webkit-border-radius: 0; - background: transparent; - font-weight: bold; - font-size: 17px; - padding-left: 5px; -} -.smallfield .name { - width: 48%; - position: absolute; - left: 0; - font-size: 17px; - text-overflow: ellipsis; - white-space: nowrap; - font-weight: bold; - line-height: 44px; - font-size: 17px; - padding-left: 5px; - overflow: hidden; -} -.smallfield input { - width: 50%; - position: absolute; - right: 0; - height: 44px; - -webkit-appearance: none; - border: none; - padding: 0; - background: transparent; - -webkit-border-radius: 0; - font-weight: bold; - font-size: 17px; -} -.smallfield:first-child input { - -webkit-border-top-right-radius: 8px; -} -.smallfield:last-child input { - -webkit-border-bottom-right-radius: 8px; -} - diff --git a/error.php b/error.php deleted file mode 100755 index 79f4648..0000000 --- a/error.php +++ /dev/null @@ -1,71 +0,0 @@ -<?php -include('includes/include.php'); -?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"> - -<head> -<meta content="yes" name="apple-mobile-web-app-capable" /> -<meta content="text/html; charset=utf8" http-equiv="Content-Type" /> -<meta content="minimum-scale=1.0, width=device-width, maximum-scale=0.6667, user-scalable=no" name="viewport" /> -<link href="css/style.css" rel="stylesheet" type="text/css" /> -<script src="javascript/functions.js" type="text/javascript"></script> -<script src="javascript/ajax.js" type="text/javascript"></script> -<title>iStreamdev</title> -<link href="images/startup.png" rel="apple-touch-startup-image" /> -<link rel="apple-touch-icon" href="images/istreamdev.png"/> -<script type="text/javascript"> -function updateOrientation() { - switch(window.orientation) { - case 0: - orient = "portrait"; - break; - case -90: - orient = "landscape"; - break; - case 90: - orient = "landscape"; - break; - case 180: - orient = "portrait"; - break; - } - document.body.setAttribute("orient", orient); - window.scrollTo(0, 1); - - } -function sendForm(formid) { - var frm; - frm = document.getElementById(formid); - frm.submit(); -} -</script> -</head> - - -<?php - print "<body onorientationchange=\"updateOrientation();\" onload=\"updateOrientation();\">\r\n"; - print "<div id=\"topbar\" class=\"transparent\">\r\n"; - print "<div id=\"leftnav\">\r\n"; - print "<a href=\"javascript:sendForm('stopstream');\">Back</a></div>\r\n"; - print "<div id=\"title\">iStream</div>\r\n"; - print "</div>\r\n"; - print "<div id=\"content\">\r\n"; - print " <span class=\"graytitle\">Stream error</span>\r\n"; - print " <ul class=\"pageitem\">\r\n"; - print " Streaming not started. Something went wrong. Perhaps VDR couldn't decode the channel."; - print "</div>\r\n"; - print " <form name=\"stopstream\" id=\"stopstream\" method=\"post\" action=\"index.php\"><input name =\"action\" type=\"hidden\" id=\"action\" value=\"stopstream\" /><input name=\"cat\" type=\"hidden\" id=\"cat\" value=\"{$_SESSION['currentcat']}\" /></form>\r\n"; - -?> - -<div id="footer"> - - iStreamdev version: <? print $isdversion; ?> -</div> - -</body> - -</html> - - diff --git a/extensions/.svn/all-wcprops b/extensions/.svn/all-wcprops new file mode 100644 index 0000000..e72a5c1 --- /dev/null +++ b/extensions/.svn/all-wcprops @@ -0,0 +1,29 @@ +K 25
+svn:wc:ra_dav:version-url
+V 34
+/svn/!svn/ver/130/trunk/extensions
+END
+jqt.location.js
+K 25
+svn:wc:ra_dav:version-url
+V 49
+/svn/!svn/ver/87/trunk/extensions/jqt.location.js
+END
+jqt.autotitles.js
+K 25
+svn:wc:ra_dav:version-url
+V 52
+/svn/!svn/ver/130/trunk/extensions/jqt.autotitles.js
+END
+jqt.floaty.js
+K 25
+svn:wc:ra_dav:version-url
+V 47
+/svn/!svn/ver/92/trunk/extensions/jqt.floaty.js
+END
+jqt.offline.js
+K 25
+svn:wc:ra_dav:version-url
+V 48
+/svn/!svn/ver/88/trunk/extensions/jqt.offline.js
+END
diff --git a/extensions/.svn/entries b/extensions/.svn/entries new file mode 100644 index 0000000..c0c93cd --- /dev/null +++ b/extensions/.svn/entries @@ -0,0 +1,164 @@ +10
+
+dir
+133
+http://jqtouch.googlecode.com/svn/trunk/extensions
+http://jqtouch.googlecode.com/svn
+
+
+
+2010-01-07T21:41:55.246845Z
+130
+RBoulanouar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+210952ee-217a-11de-8f7e-2b794b28c5cd
+
+jqt.location.js
+file
+
+
+
+
+2010-03-04T14:47:55.242266Z
+62b4ccafb57c6d4ad68310e31b9be8c5
+2009-09-29T19:27:22.524742Z
+87
+davidcolbykaneda
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+2359
+
+jqt.autotitles.js
+file
+
+
+
+
+2010-03-04T14:47:55.242266Z
+7b9fb5c8e2cfa161627e35b8045a3ff6
+2010-01-07T21:41:55.246845Z
+130
+RBoulanouar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+1674
+
+jqt.floaty.js
+file
+
+
+
+
+2010-03-04T14:47:55.242266Z
+594e49444cb823a1f98b59728419b309
+2009-10-02T18:26:35.525065Z
+92
+davidcolbykaneda
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+3357
+
+jqt.offline.js
+file
+
+
+
+
+2010-03-04T14:47:55.243073Z
+f2301fb7d6f82d39cd9cf0e45edfa61d
+2009-09-30T17:50:08.206588Z
+88
+davidcolbykaneda
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+3820
+
diff --git a/extensions/.svn/text-base/jqt.autotitles.js.svn-base b/extensions/.svn/text-base/jqt.autotitles.js.svn-base new file mode 100644 index 0000000..74ba6f8 --- /dev/null +++ b/extensions/.svn/text-base/jqt.autotitles.js.svn-base @@ -0,0 +1,51 @@ +/* + + _/ _/_/ _/_/_/_/_/ _/ + _/ _/ _/ _/_/ _/ _/ _/_/_/ _/_/_/ + _/ _/ _/_/ _/ _/ _/ _/ _/ _/ _/ _/ + _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ + _/ _/_/ _/ _/ _/_/ _/_/_/ _/_/_/ _/ _/ + _/ + _/ + + Created by David Kaneda <http://www.davidkaneda.com> + Documentation and issue tracking on Google Code <http://code.google.com/p/jqtouch/> + + Special thanks to Jonathan Stark <http://jonathanstark.com/> + and pinch/zoom <http://www.pinchzoom.com/> + + (c) 2009 by jQTouch project members. + See LICENSE.txt for license. + +*/ + +(function($) { + if ($.jQTouch) + { + $.jQTouch.addExtension(function AutoTitles(jQT){ + + var titleSelector='.toolbar h1'; + + $(function(){ + $('#jqt').bind('pageAnimationStart', function(e, data){ + if (data.direction === 'in'){ + var $title = $(titleSelector, $(e.target)); + var $ref = $(e.target).data('referrer'); + if ($title.length && $ref){ + $title.html($ref.text()); + } + } + }); + }); + + function setTitleSelector(ts){ + titleSelector=ts; + } + + return { + setTitleSelector: setTitleSelector + } + + }); + } +})(jQuery);
\ No newline at end of file diff --git a/extensions/.svn/text-base/jqt.floaty.js.svn-base b/extensions/.svn/text-base/jqt.floaty.js.svn-base new file mode 100644 index 0000000..63fb5e6 --- /dev/null +++ b/extensions/.svn/text-base/jqt.floaty.js.svn-base @@ -0,0 +1,92 @@ +/* + + _/ _/_/ _/_/_/_/_/ _/ + _/ _/ _/ _/_/ _/ _/ _/_/_/ _/_/_/ + _/ _/ _/_/ _/ _/ _/ _/ _/ _/ _/ _/ + _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ + _/ _/_/ _/ _/ _/_/ _/_/_/ _/_/_/ _/ _/ + _/ + _/ + + Created by David Kaneda <http://www.davidkaneda.com> + Documentation and issue tracking on Google Code <http://code.google.com/p/jqtouch/> + + Special thanks to Jonathan Stark <http://jonathanstark.com/> + and pinch/zoom <http://www.pinchzoom.com/> + + (c) 2009 by jQTouch project members. + See LICENSE.txt for license. + +*/ + +(function($) { + if ($.jQTouch) + { + $.jQTouch.addExtension(function Floaty(jQT){ + + $.fn.makeFloaty = function(options){ + var defaults = { + align: 'top', + spacing: 20, + time: '.3s' + } + var settings = $.extend({}, defaults, options); + settings.align = (settings.align == 'top') ? 'top' : 'bottom'; + + return this.each(function(){ + var $el = $(this); + + $el.css({ + '-webkit-transition': 'top ' + settings.time + ' ease-in-out', + 'display': 'block', + 'min-height': '0 !important' + }).data('settings', settings); + + $(document).bind('scroll', function(){ + if ($el.data('floatyVisible') === true) + { + $el.scrollFloaty(); + } + }); + $el.scrollFloaty(); + }); + } + + $.fn.scrollFloaty = function(){ + return this.each(function(){ + var $el = $(this); + var settings = $el.data('settings'); + var wHeight = $('html').attr('clientHeight'); // WRONG + + var newY = window.pageYOffset + + ((settings.align == 'top') ? + settings.spacing : wHeight - settings.spacing - $el.get(0).offsetHeight); + + $el.css('top', newY).data('floatyVisible', true); + }); + } + + $.fn.hideFloaty = function(){ + return this.each(function(){ + var $el = $(this); + var oh = $el.get(0).offsetHeight; + + $el.css('top', -oh-10).data('floatyVisible', false); + }); + } + + $.fn.toggleFloaty = function(){ + return this.each(function(){ + var $el = $(this); + if ($el.data('floatyVisible') === true){ + $el.hideFloaty(); + } + else + { + $el.scrollFloaty(); + } + }); + } + }); + } +})(jQuery);
\ No newline at end of file diff --git a/extensions/.svn/text-base/jqt.location.js.svn-base b/extensions/.svn/text-base/jqt.location.js.svn-base new file mode 100644 index 0000000..a944953 --- /dev/null +++ b/extensions/.svn/text-base/jqt.location.js.svn-base @@ -0,0 +1,68 @@ +/* + + _/ _/_/ _/_/_/_/_/ _/ + _/ _/ _/ _/_/ _/ _/ _/_/_/ _/_/_/ + _/ _/ _/_/ _/ _/ _/ _/ _/ _/ _/ _/ + _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ + _/ _/_/ _/ _/ _/_/ _/_/_/ _/_/_/ _/ _/ + _/ + _/ + + Created by David Kaneda <http://www.davidkaneda.com> + Documentation and issue tracking on Google Code <http://code.google.com/p/jqtouch/> + + Special thanks to Jonathan Stark <http://jonathanstark.com/> + and pinch/zoom <http://www.pinchzoom.com/> + + (c) 2009 by jQTouch project members. + See LICENSE.txt for license. + +*/ + +(function($) { + if ($.jQTouch) + { + $.jQTouch.addExtension(function Location(){ + + var latitude, longitude, callback; + + function checkGeoLocation() { + return navigator.geolocation; + } + function updateLocation(fn) { + if (checkGeoLocation()) + { + callback = fn; + navigator.geolocation.getCurrentPosition(savePosition); + return true; + } else { + console.log('Device not capable of geo-location.'); + fn(false); + return false; + } + } + function savePosition(position) { + latitude = position.coords.latitude; + longitude = position.coords.longitude; + if (callback) { + callback(getLocation()); + } + } + function getLocation() { + if (latitude && longitude) { + return { + latitude: latitude, + longitude: longitude + } + } else { + console.log('No location available. Try calling updateLocation() first.'); + return false; + } + } + return { + updateLocation: updateLocation, + getLocation: getLocation + } + }); + } +})(jQuery);
\ No newline at end of file diff --git a/extensions/.svn/text-base/jqt.offline.js.svn-base b/extensions/.svn/text-base/jqt.offline.js.svn-base new file mode 100644 index 0000000..b333a16 --- /dev/null +++ b/extensions/.svn/text-base/jqt.offline.js.svn-base @@ -0,0 +1,97 @@ +/* + + _/ _/_/ _/_/_/_/_/ _/ + _/ _/ _/ _/_/ _/ _/ _/_/_/ _/_/_/ + _/ _/ _/_/ _/ _/ _/ _/ _/ _/ _/ _/ + _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ + _/ _/_/ _/ _/ _/_/ _/_/_/ _/_/_/ _/ _/ + _/ + _/ + + Created by David Kaneda <http://www.davidkaneda.com> + Documentation and issue tracking on Google Code <http://code.google.com/p/jqtouch/> + + Special thanks to Jonathan Stark <http://jonathanstark.com/> + + Lots of this code is specifically derived from Jonathan's book, + "Building iPhone Apps with HTML, CSS, and JavaScript" + + (c) 2009 by jQTouch project members. + See LICENSE.txt for license. + +*/ + +(function($) { + if ($.jQTouch) + { + $.jQTouch.addExtension(function Offline(){ + + // Convenience array of status values + var cacheStatusValues = []; + cacheStatusValues[0] = 'uncached'; + cacheStatusValues[1] = 'idle'; + cacheStatusValues[2] = 'checking'; + cacheStatusValues[3] = 'downloading'; + cacheStatusValues[4] = 'updateready'; + cacheStatusValues[5] = 'obsolete'; + + // Listeners for all possible events + var cache = window.applicationCache; + cache.addEventListener('cached', logEvent, false); + cache.addEventListener('checking', logEvent, false); + cache.addEventListener('downloading', logEvent, false); + cache.addEventListener('error', logEvent, false); + cache.addEventListener('noupdate', logEvent, false); + cache.addEventListener('obsolete', logEvent, false); + cache.addEventListener('progress', logEvent, false); + cache.addEventListener('updateready', logEvent, false); + + // Log every event to the console + function logEvent(e) { + var online, status, type, message; + online = (isOnline()) ? 'yes' : 'no'; + status = cacheStatusValues[cache.status]; + type = e.type; + message = 'online: ' + online; + message+= ', event: ' + type; + message+= ', status: ' + status; + if (type == 'error' && navigator.onLine) { + message+= ' There was an unknown error, check your Cache Manifest.'; + } + console.log(message); + } + + function isOnline() { + return navigator.onLine; + } + + if (!$('html').attr('manifest')) { + console.log('No Cache Manifest listed on the <html> tag.') + } + + // Swap in newly download files when update is ready + cache.addEventListener('updateready', function(e){ + // Don't perform "swap" if this is the first cache + if (cacheStatusValues[cache.status] != 'idle') { + cache.swapCache(); + console.log('Swapped/updated the Cache Manifest.'); + } + } + , false); + + // These two functions check for updates to the manifest file + function checkForUpdates(){ + cache.update(); + } + function autoCheckForUpdates(){ + setInterval(function(){cache.update()}, 10000); + } + + return { + isOnline: isOnline, + checkForUpdates: checkForUpdates, + autoCheckForUpdates: autoCheckForUpdates + } + }); + } +})(jQuery);
\ No newline at end of file diff --git a/extensions/jqt.autotitles.js b/extensions/jqt.autotitles.js new file mode 100644 index 0000000..f10142b --- /dev/null +++ b/extensions/jqt.autotitles.js @@ -0,0 +1,51 @@ +/*
+
+ _/ _/_/ _/_/_/_/_/ _/
+ _/ _/ _/ _/_/ _/ _/ _/_/_/ _/_/_/
+ _/ _/ _/_/ _/ _/ _/ _/ _/ _/ _/ _/
+ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/
+ _/ _/_/ _/ _/ _/_/ _/_/_/ _/_/_/ _/ _/
+ _/
+ _/
+
+ Created by David Kaneda <http://www.davidkaneda.com>
+ Documentation and issue tracking on Google Code <http://code.google.com/p/jqtouch/>
+
+ Special thanks to Jonathan Stark <http://jonathanstark.com/>
+ and pinch/zoom <http://www.pinchzoom.com/>
+
+ (c) 2009 by jQTouch project members.
+ See LICENSE.txt for license.
+
+*/
+
+(function($) {
+ if ($.jQTouch)
+ {
+ $.jQTouch.addExtension(function AutoTitles(jQT){
+
+ var titleSelector='.toolbar h1';
+
+ $(function(){
+ $('#jqt').bind('pageAnimationStart', function(e, data){
+ if (data.direction === 'in'){
+ var $title = $(titleSelector, $(e.target));
+ var $ref = $(e.target).data('referrer');
+ if ($title.length && $ref){
+ $title.html($ref.text());
+ }
+ }
+ });
+ });
+
+ function setTitleSelector(ts){
+ titleSelector=ts;
+ }
+
+ return {
+ setTitleSelector: setTitleSelector
+ }
+
+ });
+ }
+})(jQuery);
\ No newline at end of file diff --git a/extensions/jqt.floaty.js b/extensions/jqt.floaty.js new file mode 100644 index 0000000..2ae8f4d --- /dev/null +++ b/extensions/jqt.floaty.js @@ -0,0 +1,92 @@ +/*
+
+ _/ _/_/ _/_/_/_/_/ _/
+ _/ _/ _/ _/_/ _/ _/ _/_/_/ _/_/_/
+ _/ _/ _/_/ _/ _/ _/ _/ _/ _/ _/ _/
+ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/
+ _/ _/_/ _/ _/ _/_/ _/_/_/ _/_/_/ _/ _/
+ _/
+ _/
+
+ Created by David Kaneda <http://www.davidkaneda.com>
+ Documentation and issue tracking on Google Code <http://code.google.com/p/jqtouch/>
+
+ Special thanks to Jonathan Stark <http://jonathanstark.com/>
+ and pinch/zoom <http://www.pinchzoom.com/>
+
+ (c) 2009 by jQTouch project members.
+ See LICENSE.txt for license.
+
+*/
+
+(function($) {
+ if ($.jQTouch)
+ {
+ $.jQTouch.addExtension(function Floaty(jQT){
+
+ $.fn.makeFloaty = function(options){
+ var defaults = {
+ align: 'top',
+ spacing: 20,
+ time: '.3s'
+ }
+ var settings = $.extend({}, defaults, options);
+ settings.align = (settings.align == 'top') ? 'top' : 'bottom';
+
+ return this.each(function(){
+ var $el = $(this);
+
+ $el.css({
+ '-webkit-transition': 'top ' + settings.time + ' ease-in-out',
+ 'display': 'block',
+ 'min-height': '0 !important'
+ }).data('settings', settings);
+
+ $(document).bind('scroll', function(){
+ if ($el.data('floatyVisible') === true)
+ {
+ $el.scrollFloaty();
+ }
+ });
+ $el.scrollFloaty();
+ });
+ }
+
+ $.fn.scrollFloaty = function(){
+ return this.each(function(){
+ var $el = $(this);
+ var settings = $el.data('settings');
+ var wHeight = $('html').attr('clientHeight'); // WRONG
+
+ var newY = window.pageYOffset +
+ ((settings.align == 'top') ?
+ settings.spacing : wHeight - settings.spacing - $el.get(0).offsetHeight);
+
+ $el.css('top', newY).data('floatyVisible', true);
+ });
+ }
+
+ $.fn.hideFloaty = function(){
+ return this.each(function(){
+ var $el = $(this);
+ var oh = $el.get(0).offsetHeight;
+
+ $el.css('top', -oh-10).data('floatyVisible', false);
+ });
+ }
+
+ $.fn.toggleFloaty = function(){
+ return this.each(function(){
+ var $el = $(this);
+ if ($el.data('floatyVisible') === true){
+ $el.hideFloaty();
+ }
+ else
+ {
+ $el.scrollFloaty();
+ }
+ });
+ }
+ });
+ }
+})(jQuery);
\ No newline at end of file diff --git a/extensions/jqt.location.js b/extensions/jqt.location.js new file mode 100644 index 0000000..29b79a0 --- /dev/null +++ b/extensions/jqt.location.js @@ -0,0 +1,68 @@ +/*
+
+ _/ _/_/ _/_/_/_/_/ _/
+ _/ _/ _/ _/_/ _/ _/ _/_/_/ _/_/_/
+ _/ _/ _/_/ _/ _/ _/ _/ _/ _/ _/ _/
+ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/
+ _/ _/_/ _/ _/ _/_/ _/_/_/ _/_/_/ _/ _/
+ _/
+ _/
+
+ Created by David Kaneda <http://www.davidkaneda.com>
+ Documentation and issue tracking on Google Code <http://code.google.com/p/jqtouch/>
+
+ Special thanks to Jonathan Stark <http://jonathanstark.com/>
+ and pinch/zoom <http://www.pinchzoom.com/>
+
+ (c) 2009 by jQTouch project members.
+ See LICENSE.txt for license.
+
+*/
+
+(function($) {
+ if ($.jQTouch)
+ {
+ $.jQTouch.addExtension(function Location(){
+
+ var latitude, longitude, callback;
+
+ function checkGeoLocation() {
+ return navigator.geolocation;
+ }
+ function updateLocation(fn) {
+ if (checkGeoLocation())
+ {
+ callback = fn;
+ navigator.geolocation.getCurrentPosition(savePosition);
+ return true;
+ } else {
+ console.log('Device not capable of geo-location.');
+ fn(false);
+ return false;
+ }
+ }
+ function savePosition(position) {
+ latitude = position.coords.latitude;
+ longitude = position.coords.longitude;
+ if (callback) {
+ callback(getLocation());
+ }
+ }
+ function getLocation() {
+ if (latitude && longitude) {
+ return {
+ latitude: latitude,
+ longitude: longitude
+ }
+ } else {
+ console.log('No location available. Try calling updateLocation() first.');
+ return false;
+ }
+ }
+ return {
+ updateLocation: updateLocation,
+ getLocation: getLocation
+ }
+ });
+ }
+})(jQuery);
\ No newline at end of file diff --git a/extensions/jqt.offline.js b/extensions/jqt.offline.js new file mode 100644 index 0000000..6145727 --- /dev/null +++ b/extensions/jqt.offline.js @@ -0,0 +1,97 @@ +/*
+
+ _/ _/_/ _/_/_/_/_/ _/
+ _/ _/ _/ _/_/ _/ _/ _/_/_/ _/_/_/
+ _/ _/ _/_/ _/ _/ _/ _/ _/ _/ _/ _/
+ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/
+ _/ _/_/ _/ _/ _/_/ _/_/_/ _/_/_/ _/ _/
+ _/
+ _/
+
+ Created by David Kaneda <http://www.davidkaneda.com>
+ Documentation and issue tracking on Google Code <http://code.google.com/p/jqtouch/>
+
+ Special thanks to Jonathan Stark <http://jonathanstark.com/>
+
+ Lots of this code is specifically derived from Jonathan's book,
+ "Building iPhone Apps with HTML, CSS, and JavaScript"
+
+ (c) 2009 by jQTouch project members.
+ See LICENSE.txt for license.
+
+*/
+
+(function($) {
+ if ($.jQTouch)
+ {
+ $.jQTouch.addExtension(function Offline(){
+
+ // Convenience array of status values
+ var cacheStatusValues = [];
+ cacheStatusValues[0] = 'uncached';
+ cacheStatusValues[1] = 'idle';
+ cacheStatusValues[2] = 'checking';
+ cacheStatusValues[3] = 'downloading';
+ cacheStatusValues[4] = 'updateready';
+ cacheStatusValues[5] = 'obsolete';
+
+ // Listeners for all possible events
+ var cache = window.applicationCache;
+ cache.addEventListener('cached', logEvent, false);
+ cache.addEventListener('checking', logEvent, false);
+ cache.addEventListener('downloading', logEvent, false);
+ cache.addEventListener('error', logEvent, false);
+ cache.addEventListener('noupdate', logEvent, false);
+ cache.addEventListener('obsolete', logEvent, false);
+ cache.addEventListener('progress', logEvent, false);
+ cache.addEventListener('updateready', logEvent, false);
+
+ // Log every event to the console
+ function logEvent(e) {
+ var online, status, type, message;
+ online = (isOnline()) ? 'yes' : 'no';
+ status = cacheStatusValues[cache.status];
+ type = e.type;
+ message = 'online: ' + online;
+ message+= ', event: ' + type;
+ message+= ', status: ' + status;
+ if (type == 'error' && navigator.onLine) {
+ message+= ' There was an unknown error, check your Cache Manifest.';
+ }
+ console.log(message);
+ }
+
+ function isOnline() {
+ return navigator.onLine;
+ }
+
+ if (!$('html').attr('manifest')) {
+ console.log('No Cache Manifest listed on the <html> tag.')
+ }
+
+ // Swap in newly download files when update is ready
+ cache.addEventListener('updateready', function(e){
+ // Don't perform "swap" if this is the first cache
+ if (cacheStatusValues[cache.status] != 'idle') {
+ cache.swapCache();
+ console.log('Swapped/updated the Cache Manifest.');
+ }
+ }
+ , false);
+
+ // These two functions check for updates to the manifest file
+ function checkForUpdates(){
+ cache.update();
+ }
+ function autoCheckForUpdates(){
+ setInterval(function(){cache.update()}, 10000);
+ }
+
+ return {
+ isOnline: isOnline,
+ checkForUpdates: checkForUpdates,
+ autoCheckForUpdates: autoCheckForUpdates
+ }
+ });
+ }
+})(jQuery);
\ No newline at end of file diff --git a/extensions/jquery.blockUI.js b/extensions/jquery.blockUI.js new file mode 100644 index 0000000..f35de1c --- /dev/null +++ b/extensions/jquery.blockUI.js @@ -0,0 +1,477 @@ +/*!
+ * jQuery blockUI plugin
+ * Version 2.31 (06-JAN-2010)
+ * @requires jQuery v1.2.3 or later
+ *
+ * Examples at: http://malsup.com/jquery/block/
+ * Copyright (c) 2007-2008 M. Alsup
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+ *
+ * Thanks to Amir-Hossein Sobhi for some excellent contributions!
+ */
+
+;(function($) {
+
+if (/1\.(0|1|2)\.(0|1|2)/.test($.fn.jquery) || /^1.1/.test($.fn.jquery)) {
+ alert('blockUI requires jQuery v1.2.3 or later! You are using v' + $.fn.jquery);
+ return;
+}
+
+$.fn._fadeIn = $.fn.fadeIn;
+
+var noOp = function() {};
+
+// this bit is to ensure we don't call setExpression when we shouldn't (with extra muscle to handle
+// retarded userAgent strings on Vista)
+var mode = document.documentMode || 0;
+var setExpr = $.browser.msie && (($.browser.version < 8 && !mode) || mode < 8);
+var ie6 = $.browser.msie && /MSIE 6.0/.test(navigator.userAgent) && !mode;
+
+// global $ methods for blocking/unblocking the entire page
+$.blockUI = function(opts) { install(window, opts); };
+$.unblockUI = function(opts) { remove(window, opts); };
+
+// convenience method for quick growl-like notifications (http://www.google.com/search?q=growl)
+$.growlUI = function(title, message, timeout, onClose) {
+ var $m = $('<div class="growlUI"></div>');
+ if (title) $m.append('<h1>'+title+'</h1>');
+ if (message) $m.append('<h2>'+message+'</h2>');
+ if (timeout == undefined) timeout = 3000;
+ $.blockUI({
+ message: $m, fadeIn: 700, fadeOut: 1000, centerY: false,
+ timeout: timeout, showOverlay: false,
+ onUnblock: onClose,
+ css: $.blockUI.defaults.growlCSS
+ });
+};
+
+// plugin method for blocking element content
+$.fn.block = function(opts) {
+ return this.unblock({ fadeOut: 0 }).each(function() {
+ if ($.css(this,'position') == 'static')
+ this.style.position = 'relative';
+ if ($.browser.msie)
+ this.style.zoom = 1; // force 'hasLayout'
+ install(this, opts);
+ });
+};
+
+// plugin method for unblocking element content
+$.fn.unblock = function(opts) {
+ return this.each(function() {
+ remove(this, opts);
+ });
+};
+
+$.blockUI.version = 2.31; // 2nd generation blocking at no extra cost!
+
+// override these in your code to change the default behavior and style
+$.blockUI.defaults = {
+ // message displayed when blocking (use null for no message)
+ message: '<h1>Please wait...</h1>',
+
+ title: null, // title string; only used when theme == true
+ draggable: true, // only used when theme == true (requires jquery-ui.js to be loaded)
+
+ theme: false, // set to true to use with jQuery UI themes
+
+ // styles for the message when blocking; if you wish to disable
+ // these and use an external stylesheet then do this in your code:
+ // $.blockUI.defaults.css = {};
+ css: {
+ padding: 0,
+ margin: 0,
+ width: '30%',
+ top: '40%',
+ left: '35%',
+ textAlign: 'center',
+ color: '#000',
+ border: '3px solid #aaa',
+ backgroundColor:'#fff',
+ cursor: 'wait'
+ },
+
+ // minimal style set used when themes are used
+ themedCSS: {
+ width: '30%',
+ top: '40%',
+ left: '35%'
+ },
+
+ // styles for the overlay
+ overlayCSS: {
+ backgroundColor: '#000',
+ opacity: 0.6,
+ cursor: 'wait'
+ },
+
+ // styles applied when using $.growlUI
+ growlCSS: {
+ width: '350px',
+ top: '10px',
+ left: '',
+ right: '10px',
+ border: 'none',
+ padding: '5px',
+ opacity: 0.6,
+ cursor: 'default',
+ color: '#fff',
+ backgroundColor: '#000',
+ '-webkit-border-radius': '10px',
+ '-moz-border-radius': '10px'
+ },
+
+ // IE issues: 'about:blank' fails on HTTPS and javascript:false is s-l-o-w
+ // (hat tip to Jorge H. N. de Vasconcelos)
+ iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank',
+
+ // force usage of iframe in non-IE browsers (handy for blocking applets)
+ forceIframe: false,
+
+ // z-index for the blocking overlay
+ baseZ: 1000,
+
+ // set these to true to have the message automatically centered
+ centerX: true, // <-- only effects element blocking (page block controlled via css above)
+ centerY: true,
+
+ // allow body element to be stetched in ie6; this makes blocking look better
+ // on "short" pages. disable if you wish to prevent changes to the body height
+ allowBodyStretch: true,
+
+ // enable if you want key and mouse events to be disabled for content that is blocked
+ bindEvents: true,
+
+ // be default blockUI will supress tab navigation from leaving blocking content
+ // (if bindEvents is true)
+ constrainTabKey: true,
+
+ // fadeIn time in millis; set to 0 to disable fadeIn on block
+ fadeIn: 200,
+
+ // fadeOut time in millis; set to 0 to disable fadeOut on unblock
+ fadeOut: 400,
+
+ // time in millis to wait before auto-unblocking; set to 0 to disable auto-unblock
+ timeout: 0,
+
+ // disable if you don't want to show the overlay
+ showOverlay: true,
+
+ // if true, focus will be placed in the first available input field when
+ // page blocking
+ focusInput: true,
+
+ // suppresses the use of overlay styles on FF/Linux (due to performance issues with opacity)
+ applyPlatformOpacityRules: true,
+
+ // callback method invoked when fadeIn has completed and blocking message is visible
+ onBlock: null,
+
+ // callback method invoked when unblocking has completed; the callback is
+ // passed the element that has been unblocked (which is the window object for page
+ // blocks) and the options that were passed to the unblock call:
+ // onUnblock(element, options)
+ onUnblock: null,
+
+ // don't ask; if you really must know: http://groups.google.com/group/jquery-en/browse_thread/thread/36640a8730503595/2f6a79a77a78e493#2f6a79a77a78e493
+ quirksmodeOffsetHack: 4
+};
+
+// private data and functions follow...
+
+var pageBlock = null;
+var pageBlockEls = [];
+
+function install(el, opts) {
+ var full = (el == window);
+ var msg = opts && opts.message !== undefined ? opts.message : undefined;
+ opts = $.extend({}, $.blockUI.defaults, opts || {});
+ opts.overlayCSS = $.extend({}, $.blockUI.defaults.overlayCSS, opts.overlayCSS || {});
+ var css = $.extend({}, $.blockUI.defaults.css, opts.css || {});
+ var themedCSS = $.extend({}, $.blockUI.defaults.themedCSS, opts.themedCSS || {});
+ msg = msg === undefined ? opts.message : msg;
+
+ // remove the current block (if there is one)
+ if (full && pageBlock)
+ remove(window, {fadeOut:0});
+
+ // if an existing element is being used as the blocking content then we capture
+ // its current place in the DOM (and current display style) so we can restore
+ // it when we unblock
+ if (msg && typeof msg != 'string' && (msg.parentNode || msg.jquery)) {
+ var node = msg.jquery ? msg[0] : msg;
+ var data = {};
+ $(el).data('blockUI.history', data);
+ data.el = node;
+ data.parent = node.parentNode;
+ data.display = node.style.display;
+ data.position = node.style.position;
+ if (data.parent)
+ data.parent.removeChild(node);
+ }
+
+ var z = opts.baseZ;
+
+ // blockUI uses 3 layers for blocking, for simplicity they are all used on every platform;
+ // layer1 is the iframe layer which is used to supress bleed through of underlying content
+ // layer2 is the overlay layer which has opacity and a wait cursor (by default)
+ // layer3 is the message content that is displayed while blocking
+
+ var lyr1 = ($.browser.msie || opts.forceIframe)
+ ? $('<iframe class="blockUI" style="z-index:'+ (z++) +';display:none;border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0" src="'+opts.iframeSrc+'"></iframe>')
+ : $('<div class="blockUI" style="display:none"></div>');
+ var lyr2 = $('<div class="blockUI blockOverlay" style="z-index:'+ (z++) +';display:none;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"></div>');
+
+ var lyr3;
+ if (opts.theme && full) {
+ var s = '<div class="blockUI blockMsg blockPage ui-dialog ui-widget ui-corner-all" style="z-index:'+z+';display:none;position:fixed">' +
+ '<div class="ui-widget-header ui-dialog-titlebar blockTitle">'+(opts.title || ' ')+'</div>' +
+ '<div class="ui-widget-content ui-dialog-content"></div>' +
+ '</div>';
+ lyr3 = $(s);
+ }
+ else {
+ lyr3 = full ? $('<div class="blockUI blockMsg blockPage" style="z-index:'+z+';display:none;position:fixed"></div>')
+ : $('<div class="blockUI blockMsg blockElement" style="z-index:'+z+';display:none;position:absolute"></div>');
+ }
+
+ // if we have a message, style it
+ if (msg) {
+ if (opts.theme) {
+ lyr3.css(themedCSS);
+ lyr3.addClass('ui-widget-content');
+ }
+ else
+ lyr3.css(css);
+ }
+
+ // style the overlay
+ if (!opts.applyPlatformOpacityRules || !($.browser.mozilla && /Linux/.test(navigator.platform)))
+ lyr2.css(opts.overlayCSS);
+ lyr2.css('position', full ? 'fixed' : 'absolute');
+
+ // make iframe layer transparent in IE
+ if ($.browser.msie || opts.forceIframe)
+ lyr1.css('opacity',0.0);
+
+ //$([lyr1[0],lyr2[0],lyr3[0]]).appendTo(full ? 'body' : el);
+ var layers = [lyr1,lyr2,lyr3], $par = full ? $('body') : $(el);
+ $.each(layers, function() {
+ this.appendTo($par);
+ });
+
+ if (opts.theme && opts.draggable && $.fn.draggable) {
+ lyr3.draggable({
+ handle: '.ui-dialog-titlebar',
+ cancel: 'li'
+ });
+ }
+
+ // ie7 must use absolute positioning in quirks mode and to account for activex issues (when scrolling)
+ var expr = setExpr && (!$.boxModel || $('object,embed', full ? null : el).length > 0);
+ if (ie6 || expr) {
+ // give body 100% height
+ if (full && opts.allowBodyStretch && $.boxModel)
+ $('html,body').css('height','100%');
+
+ // fix ie6 issue when blocked element has a border width
+ if ((ie6 || !$.boxModel) && !full) {
+ var t = sz(el,'borderTopWidth'), l = sz(el,'borderLeftWidth');
+ var fixT = t ? '(0 - '+t+')' : 0;
+ var fixL = l ? '(0 - '+l+')' : 0;
+ }
+
+ // simulate fixed position
+ $.each([lyr1,lyr2,lyr3], function(i,o) {
+ var s = o[0].style;
+ s.position = 'absolute';
+ if (i < 2) {
+ full ? s.setExpression('height','Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.boxModel?0:'+opts.quirksmodeOffsetHack+') + "px"')
+ : s.setExpression('height','this.parentNode.offsetHeight + "px"');
+ full ? s.setExpression('width','jQuery.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"')
+ : s.setExpression('width','this.parentNode.offsetWidth + "px"');
+ if (fixL) s.setExpression('left', fixL);
+ if (fixT) s.setExpression('top', fixT);
+ }
+ else if (opts.centerY) {
+ if (full) s.setExpression('top','(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"');
+ s.marginTop = 0;
+ }
+ else if (!opts.centerY && full) {
+ var top = (opts.css && opts.css.top) ? parseInt(opts.css.top) : 0;
+ var expression = '((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + '+top+') + "px"';
+ s.setExpression('top',expression);
+ }
+ });
+ }
+
+ // show the message
+ if (msg) {
+ if (opts.theme)
+ lyr3.find('.ui-widget-content').append(msg);
+ else
+ lyr3.append(msg);
+ if (msg.jquery || msg.nodeType)
+ $(msg).show();
+ }
+
+ if (($.browser.msie || opts.forceIframe) && opts.showOverlay)
+ lyr1.show(); // opacity is zero
+ if (opts.fadeIn) {
+ var cb = opts.onBlock ? opts.onBlock : noOp;
+ var cb1 = (opts.showOverlay && !msg) ? cb : noOp;
+ var cb2 = msg ? cb : noOp;
+ if (opts.showOverlay)
+ lyr2._fadeIn(opts.fadeIn, cb1);
+ if (msg)
+ lyr3._fadeIn(opts.fadeIn, cb2);
+ }
+ else {
+ if (opts.showOverlay)
+ lyr2.show();
+ if (msg)
+ lyr3.show();
+ if (opts.onBlock)
+ opts.onBlock();
+ }
+
+ // bind key and mouse events
+ bind(1, el, opts);
+
+ if (full) {
+ pageBlock = lyr3[0];
+ pageBlockEls = $(':input:enabled:visible',pageBlock);
+ if (opts.focusInput)
+ setTimeout(focus, 20);
+ }
+ else
+ center(lyr3[0], opts.centerX, opts.centerY);
+
+ if (opts.timeout) {
+ // auto-unblock
+ var to = setTimeout(function() {
+ full ? $.unblockUI(opts) : $(el).unblock(opts);
+ }, opts.timeout);
+ $(el).data('blockUI.timeout', to);
+ }
+};
+
+// remove the block
+function remove(el, opts) {
+ var full = (el == window);
+ var $el = $(el);
+ var data = $el.data('blockUI.history');
+ var to = $el.data('blockUI.timeout');
+ if (to) {
+ clearTimeout(to);
+ $el.removeData('blockUI.timeout');
+ }
+ opts = $.extend({}, $.blockUI.defaults, opts || {});
+ bind(0, el, opts); // unbind events
+
+ var els;
+ if (full) // crazy selector to handle odd field errors in ie6/7
+ els = $('body').children().filter('.blockUI').add('body > .blockUI');
+ else
+ els = $('.blockUI', el);
+
+ if (full)
+ pageBlock = pageBlockEls = null;
+
+ if (opts.fadeOut) {
+ els.fadeOut(opts.fadeOut);
+ setTimeout(function() { reset(els,data,opts,el); }, opts.fadeOut);
+ }
+ else
+ reset(els, data, opts, el);
+};
+
+// move blocking element back into the DOM where it started
+function reset(els,data,opts,el) {
+ els.each(function(i,o) {
+ // remove via DOM calls so we don't lose event handlers
+ if (this.parentNode)
+ this.parentNode.removeChild(this);
+ });
+
+ if (data && data.el) {
+ data.el.style.display = data.display;
+ data.el.style.position = data.position;
+ if (data.parent)
+ data.parent.appendChild(data.el);
+ $(el).removeData('blockUI.history');
+ }
+
+ if (typeof opts.onUnblock == 'function')
+ opts.onUnblock(el,opts);
+};
+
+// bind/unbind the handler
+function bind(b, el, opts) {
+ var full = el == window, $el = $(el);
+
+ // don't bother unbinding if there is nothing to unbind
+ if (!b && (full && !pageBlock || !full && !$el.data('blockUI.isBlocked')))
+ return;
+ if (!full)
+ $el.data('blockUI.isBlocked', b);
+
+ // don't bind events when overlay is not in use or if bindEvents is false
+ if (!opts.bindEvents || (b && !opts.showOverlay))
+ return;
+
+ // bind anchors and inputs for mouse and key events
+ var events = 'mousedown mouseup keydown keypress';
+ b ? $(document).bind(events, opts, handler) : $(document).unbind(events, handler);
+
+// former impl...
+// var $e = $('a,:input');
+// b ? $e.bind(events, opts, handler) : $e.unbind(events, handler);
+};
+
+// event handler to suppress keyboard/mouse events when blocking
+function handler(e) {
+ // allow tab navigation (conditionally)
+ if (e.keyCode && e.keyCode == 9) {
+ if (pageBlock && e.data.constrainTabKey) {
+ var els = pageBlockEls;
+ var fwd = !e.shiftKey && e.target == els[els.length-1];
+ var back = e.shiftKey && e.target == els[0];
+ if (fwd || back) {
+ setTimeout(function(){focus(back)},10);
+ return false;
+ }
+ }
+ }
+ // allow events within the message content
+ if ($(e.target).parents('div.blockMsg').length > 0)
+ return true;
+
+ // allow events for content that is not being blocked
+ return $(e.target).parents().children().filter('div.blockUI').length == 0;
+};
+
+function focus(back) {
+ if (!pageBlockEls)
+ return;
+ var e = pageBlockEls[back===true ? pageBlockEls.length-1 : 0];
+ if (e)
+ e.focus();
+};
+
+function center(el, x, y) {
+ var p = el.parentNode, s = el.style;
+ var l = ((p.offsetWidth - el.offsetWidth)/2) - sz(p,'borderLeftWidth');
+ var t = ((p.offsetHeight - el.offsetHeight)/2) - sz(p,'borderTopWidth');
+ if (x) s.left = l > 0 ? (l+'px') : '0';
+ if (y) s.top = t > 0 ? (t+'px') : '0';
+};
+
+function sz(el, p) {
+ return parseInt($.css(el,p))||0;
+};
+
+})(jQuery);
diff --git a/extensions/jquery.httpstream.js b/extensions/jquery.httpstream.js new file mode 100644 index 0000000..e1be612 --- /dev/null +++ b/extensions/jquery.httpstream.js @@ -0,0 +1,161 @@ +/* jQuery ajax stream plugin
+* Version 0.1
+* Copyright (C) 2009 Chris Tarquini
+* Licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License (http://creativecommons.org/licenses/by-sa/3.0/)
+* Permissions beyond the scope of this license may be available by contacting petros000[at]hotmail.com.
+*/
+
+(function($) {
+
+// Save the original AJAX function
+var ajax_old = $.ajax;
+var get_old = $.get;
+var post_old = $.post;
+var active = true;
+// Add our settings
+$.ajaxSetup({stream: false,pollInterval: 500/*, onDataRecieved: function(){}*/ });
+$.enableAjaxStream = function(enable)
+{
+if(typeof enable == 'undefined') enable = !active;
+if(!enable)
+{
+$.ajax = ajax_old;
+$.get = get_old;
+$.post = post_old;
+active = false;
+}
+else
+{
+$.ajax = ajax_stream;
+$.get = ajax_get_stream;
+$.post = ajax_post_stream;
+active = true;
+}
+
+
+}
+var ajax_stream = $.ajax = function(options)
+{
+//copied from original ajax function
+ options = jQuery.extend(true, options, jQuery.extend(true, {}, jQuery.ajaxSettings, options));
+if(options.stream)
+{
+var timer = 0;
+var offset = 0;
+var xmlhttp = null;
+var lastlen = 0;
+var done = false;
+var hook = function(xhr)
+{
+xmlhttp = xhr;
+checkagain();
+}
+var fix = function(){ check('stream'); };// fixes weird bug with random numbers as arg
+var checkagain = function(){if(!done) timer = setTimeout(fix,options.pollInterval);}
+var check = function(status)
+{
+if(typeof status == 'undefined') status = "stream";
+if(xmlhttp.status < 3) return; //only get the latest packet if data has been sent
+var text = xmlhttp.responseText;
+if(status == 'stream') //if we arent streaming then just flush the buffer
+{
+if(text.length <= lastlen) { checkagain(); return;}
+lastlength = text.length;
+if(offset == text.length) { checkagain(); return;}
+}
+var pkt = text.substr(offset);
+offset = text.length;
+if($.isFunction(options.OnDataRecieved))
+{
+options.OnDataRecieved(pkt, status, xmlhttp.responseText, xmlhttp);
+}
+if(xmlhttp.status != 4)
+checkagain();
+}
+var complete = function(xhr,s)
+{
+clearTimeout(timer);//done..stop polling
+done = true;
+// send final call
+check(s);
+}
+// If the complete callback is set create a new callback that calls the users and outs
+if($.isFunction(options.success))
+{
+var oc = options.success;
+options.success = function(xhr,s){ complete(xhr,s); oc(xhr,s);};
+
+}
+else options.success = complete;
+// Set up our hook on the beforeSend
+if($.isFunction(options.beforeSend))
+{
+var obs = options.beforeSend;
+options.beforeSend = function(xhr){ obs(xhr); hook(xhr);};
+}
+else options.beforeSend = hook;
+
+}
+ajax_old(options);
+}
+
+var ajax_get_stream = $.get = function(url,data,callback,type,stream)
+{
+if($.isFunction(data))
+{
+var orgcb = callback;
+callback = data;
+if($.isFunction(orgcb))
+{
+stream = orgcb;
+}
+data = null;
+
+}
+if($.isFunction(type))
+{
+stream = type;
+type = undefined;
+}
+var dostream = $.isFunction(stream);
+ return jQuery.ajax({
+ type: "GET",
+ url: url,
+ data: data,
+ success: callback,
+ dataType: type,
+stream: dostream,
+OnDataRecieved: stream
+ });
+
+}
+
+var ajax_post_stream = $.post = function(url,data,callback,type,stream)
+{
+ if($.isFunction(data))
+ {
+var orgcb = callback;
+ callback = data;
+ data = {};
+if($.isFunction(orgcb)) { stream = orgcb;}
+
+ }
+ if($.isFunction(type))
+ {
+ stream = type;
+ type = undefined;
+ }
+ var dostream = $.isFunction(stream);
+ return jQuery.ajax({
+ type: "POST",
+ url: url,
+ data: data,
+ success: callback,
+ dataType: type,
+ stream: dostream,
+ OnDataRecieved: stream
+ });
+
+}
+
+})(jQuery);
diff --git a/extensions/jquery.scrollTo-min.js b/extensions/jquery.scrollTo-min.js new file mode 100644 index 0000000..73a3341 --- /dev/null +++ b/extensions/jquery.scrollTo-min.js @@ -0,0 +1,11 @@ +/**
+ * jQuery.ScrollTo - Easy element scrolling using jQuery.
+ * Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
+ * Dual licensed under MIT and GPL.
+ * Date: 5/25/2009
+ * @author Ariel Flesler
+ * @version 1.4.2
+ *
+ * http://flesler.blogspot.com/2007/10/jqueryscrollto.html
+ */
+;(function(d){var k=d.scrollTo=function(a,i,e){d(window).scrollTo(a,i,e)};k.defaults={axis:'xy',duration:parseFloat(d.fn.jquery)>=1.3?0:1};k.window=function(a){return d(window)._scrollable()};d.fn._scrollable=function(){return this.map(function(){var a=this,i=!a.nodeName||d.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!i)return a;var e=(a.contentWindow||a).document||a.ownerDocument||a;return d.browser.safari||e.compatMode=='BackCompat'?e.body:e.documentElement})};d.fn.scrollTo=function(n,j,b){if(typeof j=='object'){b=j;j=0}if(typeof b=='function')b={onAfter:b};if(n=='max')n=9e9;b=d.extend({},k.defaults,b);j=j||b.speed||b.duration;b.queue=b.queue&&b.axis.length>1;if(b.queue)j/=2;b.offset=p(b.offset);b.over=p(b.over);return this._scrollable().each(function(){var q=this,r=d(q),f=n,s,g={},u=r.is('html,body');switch(typeof f){case'number':case'string':if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(f)){f=p(f);break}f=d(f,this);case'object':if(f.is||f.style)s=(f=d(f)).offset()}d.each(b.axis.split(''),function(a,i){var e=i=='x'?'Left':'Top',h=e.toLowerCase(),c='scroll'+e,l=q[c],m=k.max(q,i);if(s){g[c]=s[h]+(u?0:l-r.offset()[h]);if(b.margin){g[c]-=parseInt(f.css('margin'+e))||0;g[c]-=parseInt(f.css('border'+e+'Width'))||0}g[c]+=b.offset[h]||0;if(b.over[h])g[c]+=f[i=='x'?'width':'height']()*b.over[h]}else{var o=f[h];g[c]=o.slice&&o.slice(-1)=='%'?parseFloat(o)/100*m:o}if(/^\d+$/.test(g[c]))g[c]=g[c]<=0?0:Math.min(g[c],m);if(!a&&b.queue){if(l!=g[c])t(b.onAfterFirst);delete g[c]}});t(b.onAfter);function t(a){r.animate(g,j,b.easing,a&&function(){a.call(this,n,b)})}}).end()};k.max=function(a,i){var e=i=='x'?'Width':'Height',h='scroll'+e;if(!d(a).is('html,body'))return a[h]-d(a)[e.toLowerCase()]();var c='client'+e,l=a.ownerDocument.documentElement,m=a.ownerDocument.body;return Math.max(l[h],m[h])-Math.min(l[c],m[c])};function p(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery);
\ No newline at end of file diff --git a/extensions/jquery.scrollTo.js b/extensions/jquery.scrollTo.js new file mode 100644 index 0000000..eec31e1 --- /dev/null +++ b/extensions/jquery.scrollTo.js @@ -0,0 +1,215 @@ +/**
+ * jQuery.ScrollTo
+ * Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
+ * Dual licensed under MIT and GPL.
+ * Date: 5/25/2009
+ *
+ * @projectDescription Easy element scrolling using jQuery.
+ * http://flesler.blogspot.com/2007/10/jqueryscrollto.html
+ * Works with jQuery +1.2.6. Tested on FF 2/3, IE 6/7/8, Opera 9.5/6, Safari 3, Chrome 1 on WinXP.
+ *
+ * @author Ariel Flesler
+ * @version 1.4.2
+ *
+ * @id jQuery.scrollTo
+ * @id jQuery.fn.scrollTo
+ * @param {String, Number, DOMElement, jQuery, Object} target Where to scroll the matched elements.
+ * The different options for target are:
+ * - A number position (will be applied to all axes).
+ * - A string position ('44', '100px', '+=90', etc ) will be applied to all axes
+ * - A jQuery/DOM element ( logically, child of the element to scroll )
+ * - A string selector, that will be relative to the element to scroll ( 'li:eq(2)', etc )
+ * - A hash { top:x, left:y }, x and y can be any kind of number/string like above.
+* - A percentage of the container's dimension/s, for example: 50% to go to the middle.
+ * - The string 'max' for go-to-end.
+ * @param {Number} duration The OVERALL length of the animation, this argument can be the settings object instead.
+ * @param {Object,Function} settings Optional set of settings or the onAfter callback.
+ * @option {String} axis Which axis must be scrolled, use 'x', 'y', 'xy' or 'yx'.
+ * @option {Number} duration The OVERALL length of the animation.
+ * @option {String} easing The easing method for the animation.
+ * @option {Boolean} margin If true, the margin of the target element will be deducted from the final position.
+ * @option {Object, Number} offset Add/deduct from the end position. One number for both axes or { top:x, left:y }.
+ * @option {Object, Number} over Add/deduct the height/width multiplied by 'over', can be { top:x, left:y } when using both axes.
+ * @option {Boolean} queue If true, and both axis are given, the 2nd axis will only be animated after the first one ends.
+ * @option {Function} onAfter Function to be called after the scrolling ends.
+ * @option {Function} onAfterFirst If queuing is activated, this function will be called after the first scrolling ends.
+ * @return {jQuery} Returns the same jQuery object, for chaining.
+ *
+ * @desc Scroll to a fixed position
+ * @example $('div').scrollTo( 340 );
+ *
+ * @desc Scroll relatively to the actual position
+ * @example $('div').scrollTo( '+=340px', { axis:'y' } );
+ *
+ * @dec Scroll using a selector (relative to the scrolled element)
+ * @example $('div').scrollTo( 'p.paragraph:eq(2)', 500, { easing:'swing', queue:true, axis:'xy' } );
+ *
+ * @ Scroll to a DOM element (same for jQuery object)
+ * @example var second_child = document.getElementById('container').firstChild.nextSibling;
+ * $('#container').scrollTo( second_child, { duration:500, axis:'x', onAfter:function(){
+ * alert('scrolled!!');
+ * }});
+ *
+ * @desc Scroll on both axes, to different values
+ * @example $('div').scrollTo( { top: 300, left:'+=200' }, { axis:'xy', offset:-20 } );
+ */
+;(function( $ ){
+
+ var $scrollTo = $.scrollTo = function( target, duration, settings ){
+ $(window).scrollTo( target, duration, settings );
+ };
+
+ $scrollTo.defaults = {
+ axis:'xy',
+ duration: parseFloat($.fn.jquery) >= 1.3 ? 0 : 1
+ };
+
+ // Returns the element that needs to be animated to scroll the window.
+ // Kept for backwards compatibility (specially for localScroll & serialScroll)
+ $scrollTo.window = function( scope ){
+ return $(window)._scrollable();
+ };
+
+ // Hack, hack, hack :)
+ // Returns the real elements to scroll (supports window/iframes, documents and regular nodes)
+ $.fn._scrollable = function(){
+ return this.map(function(){
+ var elem = this,
+ isWin = !elem.nodeName || $.inArray( elem.nodeName.toLowerCase(), ['iframe','#document','html','body'] ) != -1;
+
+ if( !isWin )
+ return elem;
+
+ var doc = (elem.contentWindow || elem).document || elem.ownerDocument || elem;
+
+ return $.browser.safari || doc.compatMode == 'BackCompat' ?
+ doc.body :
+ doc.documentElement;
+ });
+ };
+
+ $.fn.scrollTo = function( target, duration, settings ){
+ if( typeof duration == 'object' ){
+ settings = duration;
+ duration = 0;
+ }
+ if( typeof settings == 'function' )
+ settings = { onAfter:settings };
+
+ if( target == 'max' )
+ target = 9e9;
+
+ settings = $.extend( {}, $scrollTo.defaults, settings );
+ // Speed is still recognized for backwards compatibility
+ duration = duration || settings.speed || settings.duration;
+ // Make sure the settings are given right
+ settings.queue = settings.queue && settings.axis.length > 1;
+
+ if( settings.queue )
+ // Let's keep the overall duration
+ duration /= 2;
+ settings.offset = both( settings.offset );
+ settings.over = both( settings.over );
+
+ return this._scrollable().each(function(){
+ var elem = this,
+ $elem = $(elem),
+ targ = target, toff, attr = {},
+ win = $elem.is('html,body');
+
+ switch( typeof targ ){
+ // A number will pass the regex
+ case 'number':
+ case 'string':
+ if( /^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(targ) ){
+ targ = both( targ );
+ // We are done
+ break;
+ }
+ // Relative selector, no break!
+ targ = $(targ,this);
+ case 'object':
+ // DOMElement / jQuery
+ if( targ.is || targ.style )
+ // Get the real position of the target
+ toff = (targ = $(targ)).offset();
+ }
+ $.each( settings.axis.split(''), function( i, axis ){
+ var Pos = axis == 'x' ? 'Left' : 'Top',
+ pos = Pos.toLowerCase(),
+ key = 'scroll' + Pos,
+ old = elem[key],
+ max = $scrollTo.max(elem, axis);
+
+ if( toff ){// jQuery / DOMElement
+ attr[key] = toff[pos] + ( win ? 0 : old - $elem.offset()[pos] );
+
+ // If it's a dom element, reduce the margin
+ if( settings.margin ){
+ attr[key] -= parseInt(targ.css('margin'+Pos)) || 0;
+ attr[key] -= parseInt(targ.css('border'+Pos+'Width')) || 0;
+ }
+
+ attr[key] += settings.offset[pos] || 0;
+
+ if( settings.over[pos] )
+ // Scroll to a fraction of its width/height
+ attr[key] += targ[axis=='x'?'width':'height']() * settings.over[pos];
+ }else{
+ var val = targ[pos];
+ // Handle percentage values
+ attr[key] = val.slice && val.slice(-1) == '%' ?
+ parseFloat(val) / 100 * max
+ : val;
+ }
+
+ // Number or 'number'
+ if( /^\d+$/.test(attr[key]) )
+ // Check the limits
+ attr[key] = attr[key] <= 0 ? 0 : Math.min( attr[key], max );
+
+ // Queueing axes
+ if( !i && settings.queue ){
+ // Don't waste time animating, if there's no need.
+ if( old != attr[key] )
+ // Intermediate animation
+ animate( settings.onAfterFirst );
+ // Don't animate this axis again in the next iteration.
+ delete attr[key];
+ }
+ });
+
+ animate( settings.onAfter );
+
+ function animate( callback ){
+ $elem.animate( attr, duration, settings.easing, callback && function(){
+ callback.call(this, target, settings);
+ });
+ };
+
+ }).end();
+ };
+
+ // Max scrolling position, works on quirks mode
+ // It only fails (not too badly) on IE, quirks mode.
+ $scrollTo.max = function( elem, axis ){
+ var Dim = axis == 'x' ? 'Width' : 'Height',
+ scroll = 'scroll'+Dim;
+
+ if( !$(elem).is('html,body') )
+ return elem[scroll] - $(elem)[Dim.toLowerCase()]();
+
+ var size = 'client' + Dim,
+ html = elem.ownerDocument.documentElement,
+ body = elem.ownerDocument.body;
+
+ return Math.max( html[scroll], body[scroll] )
+ - Math.min( html[size] , body[size] );
+
+ };
+
+ function both( val ){
+ return typeof val == 'object' ? val : { top:val, left:val };
+ };
+
+})( jQuery );
\ No newline at end of file diff --git a/genplaylist.php b/genplaylist.php deleted file mode 100755 index c1c7135..0000000 --- a/genplaylist.php +++ /dev/null @@ -1,23 +0,0 @@ -<?php - - if (file_exists('config.php')) - include ('config.php'); - else - include ('config_default.php'); - include ('includes/inc_files.php'); - header('Content-Type: text/xml'); - echo "<?xml version=\"1.0\"?>\n"; - echo "<status>\n"; - - $path = $_REQUEST['path']; - $name = $_REQUEST['name']; - - exec('rm playlist/*'); - exec('echo > playlist/dummy.txt'); - exec('ln -s ' .addcslashes(quotemeta($path), " &'") .'* playlist'); - - echo "<m3u>ok</m3u>\n"; - - echo "</status>\n"; - -?> diff --git a/getid3/extension.cache.dbm.php b/getid3/extension.cache.dbm.php deleted file mode 100644 index 051bb1f..0000000 --- a/getid3/extension.cache.dbm.php +++ /dev/null @@ -1,222 +0,0 @@ -<?php -///////////////////////////////////////////////////////////////// -/// getID3() by James Heinrich <info@getid3.org> // -// available at http://getid3.sourceforge.net // -// or http://www.getid3.org // -///////////////////////////////////////////////////////////////// -// // -// extension.cache.dbm.php - part of getID3() // -// Please see readme.txt for more information // -// /// -///////////////////////////////////////////////////////////////// -// // -// This extension written by Allan Hansen <ahØartemis*dk> // -// /// -///////////////////////////////////////////////////////////////// - - -/** -* This is a caching extension for getID3(). It works the exact same -* way as the getID3 class, but return cached information very fast -* -* Example: -* -* Normal getID3 usage (example): -* -* require_once 'getid3/getid3.php'; -* $getID3 = new getID3; -* $getID3->encoding = 'UTF-8'; -* $info1 = $getID3->analyze('file1.flac'); -* $info2 = $getID3->analyze('file2.wv'); -* -* getID3_cached usage: -* -* require_once 'getid3/getid3.php'; -* require_once 'getid3/getid3/extension.cache.dbm.php'; -* $getID3 = new getID3_cached('db3', '/tmp/getid3_cache.dbm', -* '/tmp/getid3_cache.lock'); -* $getID3->encoding = 'UTF-8'; -* $info1 = $getID3->analyze('file1.flac'); -* $info2 = $getID3->analyze('file2.wv'); -* -* -* Supported Cache Types -* -* SQL Databases: (use extension.cache.mysql) -* -* cache_type cache_options -* ------------------------------------------------------------------- -* mysql host, database, username, password -* -* -* DBM-Style Databases: (this extension) -* -* cache_type cache_options -* ------------------------------------------------------------------- -* gdbm dbm_filename, lock_filename -* ndbm dbm_filename, lock_filename -* db2 dbm_filename, lock_filename -* db3 dbm_filename, lock_filename -* db4 dbm_filename, lock_filename (PHP5 required) -* -* PHP must have write access to both dbm_filename and lock_filename. -* -* -* Recommended Cache Types -* -* Infrequent updates, many reads any DBM -* Frequent updates mysql -*/ - - -class getID3_cached_dbm extends getID3 -{ - - // public: constructor - see top of this file for cache type and cache_options - function getID3_cached_dbm($cache_type, $dbm_filename, $lock_filename) { - - // Check for dba extension - if (!extension_loaded('dba')) { - die('PHP is not compiled with dba support, required to use DBM style cache.'); - } - - // Check for specific dba driver - if (function_exists('dba_handlers')) { // PHP 4.3.0+ - if (!in_array('db3', dba_handlers())) { - die('PHP is not compiled --with '.$cache_type.' support, required to use DBM style cache.'); - } - } - else { // PHP <= 4.2.3 - ob_start(); // nasty, buy the only way to check... - phpinfo(); - $contents = ob_get_contents(); - ob_end_clean(); - if (!strstr($contents, $cache_type)) { - die('PHP is not compiled --with '.$cache_type.' support, required to use DBM style cache.'); - } - } - - // Create lock file if needed - if (!file_exists($lock_filename)) { - if (!touch($lock_filename)) { - die('failed to create lock file: ' . $lock_filename); - } - } - - // Open lock file for writing - if (!is_writeable($lock_filename)) { - die('lock file: ' . $lock_filename . ' is not writable'); - } - $this->lock = fopen($lock_filename, 'w'); - - // Acquire exclusive write lock to lock file - flock($this->lock, LOCK_EX); - - // Create dbm-file if needed - if (!file_exists($dbm_filename)) { - if (!touch($dbm_filename)) { - die('failed to create dbm file: ' . $dbm_filename); - } - } - - // Try to open dbm file for writing - $this->dba = @dba_open($dbm_filename, 'w', $cache_type); - if (!$this->dba) { - - // Failed - create new dbm file - $this->dba = dba_open($dbm_filename, 'n', $cache_type); - - if (!$this->dba) { - die('failed to create dbm file: ' . $dbm_filename); - } - - // Insert getID3 version number - dba_insert(GETID3_VERSION, GETID3_VERSION, $this->dba); - } - - // Init misc values - $this->cache_type = $cache_type; - $this->dbm_filename = $dbm_filename; - - // Register destructor - register_shutdown_function(array($this, '__destruct')); - - // Check version number and clear cache if changed - if (dba_fetch(GETID3_VERSION, $this->dba) != GETID3_VERSION) { - $this->clear_cache(); - } - - parent::getID3(); - } - - - - // public: destuctor - function __destruct() { - - // Close dbm file - @dba_close($this->dba); - - // Release exclusive lock - @flock($this->lock, LOCK_UN); - - // Close lock file - @fclose($this->lock); - } - - - - // public: clear cache - function clear_cache() { - - // Close dbm file - dba_close($this->dba); - - // Create new dbm file - $this->dba = dba_open($this->dbm_filename, 'n', $this->cache_type); - - if (!$this->dba) { - die('failed to clear cache/recreate dbm file: ' . $this->dbm_filename); - } - - // Insert getID3 version number - dba_insert(GETID3_VERSION, GETID3_VERSION, $this->dba); - - // Reregister shutdown function - register_shutdown_function(array($this, '__destruct')); - } - - - - // public: analyze file - function analyze($filename) { - - if (file_exists($filename)) { - - // Calc key filename::mod_time::size - should be unique - $key = $filename . '::' . filemtime($filename) . '::' . filesize($filename); - - // Loopup key - $result = dba_fetch($key, $this->dba); - - // Hit - if ($result !== false) { - return unserialize($result); - } - } - - // Miss - $result = parent::analyze($filename); - - // Save result - if (file_exists($filename)) { - dba_insert($key, serialize($result), $this->dba); - } - - return $result; - } - -} - - -?>
\ No newline at end of file diff --git a/getid3/extension.cache.mysql.php b/getid3/extension.cache.mysql.php deleted file mode 100644 index 40ea688..0000000 --- a/getid3/extension.cache.mysql.php +++ /dev/null @@ -1,171 +0,0 @@ -<?php -///////////////////////////////////////////////////////////////// -/// getID3() by James Heinrich <info@getid3.org> // -// available at http://getid3.sourceforge.net // -// or http://www.getid3.org // -///////////////////////////////////////////////////////////////// -// // -// extension.cache.mysql.php - part of getID3() // -// Please see readme.txt for more information // -// /// -///////////////////////////////////////////////////////////////// -// // -// This extension written by Allan Hansen <ahØartemis*dk> // -// /// -///////////////////////////////////////////////////////////////// - - -/** -* This is a caching extension for getID3(). It works the exact same -* way as the getID3 class, but return cached information very fast -* -* Example: (see also demo.cache.mysql.php in /demo/) -* -* Normal getID3 usage (example): -* -* require_once 'getid3/getid3.php'; -* $getID3 = new getID3; -* $getID3->encoding = 'UTF-8'; -* $info1 = $getID3->analyze('file1.flac'); -* $info2 = $getID3->analyze('file2.wv'); -* -* getID3_cached usage: -* -* require_once 'getid3/getid3.php'; -* require_once 'getid3/getid3/extension.cache.mysql.php'; -* $getID3 = new getID3_cached_mysql('localhost', 'database', -* 'username', 'password'); -* $getID3->encoding = 'UTF-8'; -* $info1 = $getID3->analyze('file1.flac'); -* $info2 = $getID3->analyze('file2.wv'); -* -* -* Supported Cache Types (this extension) -* -* SQL Databases: -* -* cache_type cache_options -* ------------------------------------------------------------------- -* mysql host, database, username, password -* -* -* DBM-Style Databases: (use extension.cache.dbm) -* -* cache_type cache_options -* ------------------------------------------------------------------- -* gdbm dbm_filename, lock_filename -* ndbm dbm_filename, lock_filename -* db2 dbm_filename, lock_filename -* db3 dbm_filename, lock_filename -* db4 dbm_filename, lock_filename (PHP5 required) -* -* PHP must have write access to both dbm_filename and lock_filename. -* -* -* Recommended Cache Types -* -* Infrequent updates, many reads any DBM -* Frequent updates mysql -*/ - - -class getID3_cached_mysql extends getID3 -{ - - // private vars - var $cursor; - var $connection; - - - // public: constructor - see top of this file for cache type and cache_options - function getID3_cached_mysql($host, $database, $username, $password) { - - // Check for mysql support - if (!function_exists('mysql_pconnect')) { - die('PHP not compiled with mysql support.'); - } - - // Connect to database - $this->connection = mysql_pconnect($host, $username, $password); - if (!$this->connection) { - die('mysql_pconnect() failed - check permissions and spelling.'); - } - - // Select database - if (!mysql_select_db($database, $this->connection)) { - die('Cannot use database '.$database); - } - - // Create cache table if not exists - $this->create_table(); - - // Check version number and clear cache if changed - $this->cursor = mysql_query("SELECT `value` FROM `getid3_cache` WHERE (`filename` = '".GETID3_VERSION."') AND (`filesize` = '-1') AND (`filetime` = '-1') AND (`analyzetime` = '-1')", $this->connection); - list($version) = @mysql_fetch_array($this->cursor); - if ($version != GETID3_VERSION) { - $this->clear_cache(); - } - - parent::getID3(); - } - - - - // public: clear cache - function clear_cache() { - - $this->cursor = mysql_query("DELETE FROM `getid3_cache`", $this->connection); - $this->cursor = mysql_query("INSERT INTO `getid3_cache` VALUES ('".GETID3_VERSION."', -1, -1, -1, '".GETID3_VERSION."')", $this->connection); - } - - - - // public: analyze file - function analyze($filename) { - - if (file_exists($filename)) { - - // Short-hands - $filetime = filemtime($filename); - $filesize = filesize($filename); - $filenam2 = mysql_escape_string($filename); - - // Loopup file - $this->cursor = mysql_query("SELECT `value` FROM `getid3_cache` WHERE (`filename`='".$filenam2."') AND (`filesize`='".$filesize."') AND (`filetime`='".$filetime."')", $this->connection); - list($result) = @mysql_fetch_array($this->cursor); - - // Hit - if ($result) { - return unserialize($result); - } - } - - // Miss - $result = parent::analyze($filename); - - // Save result - if (file_exists($filename)) { - $res2 = mysql_escape_string(serialize($result)); - $this->cursor = mysql_query("INSERT INTO `getid3_cache` (`filename`, `filesize`, `filetime`, `analyzetime`, `value`) VALUES ('".$filenam2."', '".$filesize."', '".$filetime."', '".time()."', '".$res2."')", $this->connection); - } - return $result; - } - - - - // private: (re)create sql table - function create_table($drop = false) { - - $this->cursor = mysql_query("CREATE TABLE IF NOT EXISTS `getid3_cache` ( - `filename` VARCHAR(255) NOT NULL DEFAULT '', - `filesize` INT(11) NOT NULL DEFAULT '0', - `filetime` INT(11) NOT NULL DEFAULT '0', - `analyzetime` INT(11) NOT NULL DEFAULT '0', - `value` TEXT NOT NULL, - PRIMARY KEY (`filename`,`filesize`,`filetime`)) TYPE=MyISAM", $this->connection); - echo mysql_error($this->connection); - } -} - - -?>
\ No newline at end of file diff --git a/getid3/getid3.lib.php b/getid3/getid3.lib.php deleted file mode 100644 index 4ed5e36..0000000 --- a/getid3/getid3.lib.php +++ /dev/null @@ -1,1309 +0,0 @@ -<?php -///////////////////////////////////////////////////////////////// -/// getID3() by James Heinrich <info@getid3.org> // -// available at http://getid3.sourceforge.net // -// or http://www.getid3.org // -///////////////////////////////////////////////////////////////// -// // -// getid3.lib.php - part of getID3() // -// See readme.txt for more details // -// /// -///////////////////////////////////////////////////////////////// - - -class getid3_lib -{ - - function PrintHexBytes($string, $hex=true, $spaces=true, $htmlsafe=true) { - $returnstring = ''; - for ($i = 0; $i < strlen($string); $i++) { - if ($hex) { - $returnstring .= str_pad(dechex(ord($string{$i})), 2, '0', STR_PAD_LEFT); - } else { - $returnstring .= ' '.(ereg("[\x20-\x7E]", $string{$i}) ? $string{$i} : '¤'); - } - if ($spaces) { - $returnstring .= ' '; - } - } - if ($htmlsafe) { - $returnstring = htmlentities($returnstring); - } - return $returnstring; - } - - function SafeStripSlashes($text) { - if (get_magic_quotes_gpc()) { - return stripslashes($text); - } - return $text; - } - - - function trunc($floatnumber) { - // truncates a floating-point number at the decimal point - // returns int (if possible, otherwise float) - if ($floatnumber >= 1) { - $truncatednumber = floor($floatnumber); - } elseif ($floatnumber <= -1) { - $truncatednumber = ceil($floatnumber); - } else { - $truncatednumber = 0; - } - if ($truncatednumber <= 1073741824) { // 2^30 - $truncatednumber = (int) $truncatednumber; - } - return $truncatednumber; - } - - - function CastAsInt($floatnum) { - // convert to float if not already - $floatnum = (float) $floatnum; - - // convert a float to type int, only if possible - if (getid3_lib::trunc($floatnum) == $floatnum) { - // it's not floating point - if ($floatnum <= 2147483647) { // 2^31 - // it's within int range - $floatnum = (int) $floatnum; - } - } - return $floatnum; - } - - - function DecimalBinary2Float($binarynumerator) { - $numerator = getid3_lib::Bin2Dec($binarynumerator); - $denominator = getid3_lib::Bin2Dec('1'.str_repeat('0', strlen($binarynumerator))); - return ($numerator / $denominator); - } - - - function NormalizeBinaryPoint($binarypointnumber, $maxbits=52) { - // http://www.scri.fsu.edu/~jac/MAD3401/Backgrnd/binary.html - if (strpos($binarypointnumber, '.') === false) { - $binarypointnumber = '0.'.$binarypointnumber; - } elseif ($binarypointnumber{0} == '.') { - $binarypointnumber = '0'.$binarypointnumber; - } - $exponent = 0; - while (($binarypointnumber{0} != '1') || (substr($binarypointnumber, 1, 1) != '.')) { - if (substr($binarypointnumber, 1, 1) == '.') { - $exponent--; - $binarypointnumber = substr($binarypointnumber, 2, 1).'.'.substr($binarypointnumber, 3); - } else { - $pointpos = strpos($binarypointnumber, '.'); - $exponent += ($pointpos - 1); - $binarypointnumber = str_replace('.', '', $binarypointnumber); - $binarypointnumber = $binarypointnumber{0}.'.'.substr($binarypointnumber, 1); - } - } - $binarypointnumber = str_pad(substr($binarypointnumber, 0, $maxbits + 2), $maxbits + 2, '0', STR_PAD_RIGHT); - return array('normalized'=>$binarypointnumber, 'exponent'=>(int) $exponent); - } - - - function Float2BinaryDecimal($floatvalue) { - // http://www.scri.fsu.edu/~jac/MAD3401/Backgrnd/binary.html - $maxbits = 128; // to how many bits of precision should the calculations be taken? - $intpart = getid3_lib::trunc($floatvalue); - $floatpart = abs($floatvalue - $intpart); - $pointbitstring = ''; - while (($floatpart != 0) && (strlen($pointbitstring) < $maxbits)) { - $floatpart *= 2; - $pointbitstring .= (string) getid3_lib::trunc($floatpart); - $floatpart -= getid3_lib::trunc($floatpart); - } - $binarypointnumber = decbin($intpart).'.'.$pointbitstring; - return $binarypointnumber; - } - - - function Float2String($floatvalue, $bits) { - // http://www.scri.fsu.edu/~jac/MAD3401/Backgrnd/ieee-expl.html - switch ($bits) { - case 32: - $exponentbits = 8; - $fractionbits = 23; - break; - - case 64: - $exponentbits = 11; - $fractionbits = 52; - break; - - default: - return false; - break; - } - if ($floatvalue >= 0) { - $signbit = '0'; - } else { - $signbit = '1'; - } - $normalizedbinary = getid3_lib::NormalizeBinaryPoint(getid3_lib::Float2BinaryDecimal($floatvalue), $fractionbits); - $biasedexponent = pow(2, $exponentbits - 1) - 1 + $normalizedbinary['exponent']; // (127 or 1023) +/- exponent - $exponentbitstring = str_pad(decbin($biasedexponent), $exponentbits, '0', STR_PAD_LEFT); - $fractionbitstring = str_pad(substr($normalizedbinary['normalized'], 2), $fractionbits, '0', STR_PAD_RIGHT); - - return getid3_lib::BigEndian2String(getid3_lib::Bin2Dec($signbit.$exponentbitstring.$fractionbitstring), $bits % 8, false); - } - - - function LittleEndian2Float($byteword) { - return getid3_lib::BigEndian2Float(strrev($byteword)); - } - - - function BigEndian2Float($byteword) { - // ANSI/IEEE Standard 754-1985, Standard for Binary Floating Point Arithmetic - // http://www.psc.edu/general/software/packages/ieee/ieee.html - // http://www.scri.fsu.edu/~jac/MAD3401/Backgrnd/ieee.html - - $bitword = getid3_lib::BigEndian2Bin($byteword); - if (!$bitword) { - return 0; - } - $signbit = $bitword{0}; - - switch (strlen($byteword) * 8) { - case 32: - $exponentbits = 8; - $fractionbits = 23; - break; - - case 64: - $exponentbits = 11; - $fractionbits = 52; - break; - - case 80: - // 80-bit Apple SANE format - // http://www.mactech.com/articles/mactech/Vol.06/06.01/SANENormalized/ - $exponentstring = substr($bitword, 1, 15); - $isnormalized = intval($bitword{16}); - $fractionstring = substr($bitword, 17, 63); - $exponent = pow(2, getid3_lib::Bin2Dec($exponentstring) - 16383); - $fraction = $isnormalized + getid3_lib::DecimalBinary2Float($fractionstring); - $floatvalue = $exponent * $fraction; - if ($signbit == '1') { - $floatvalue *= -1; - } - return $floatvalue; - break; - - default: - return false; - break; - } - $exponentstring = substr($bitword, 1, $exponentbits); - $fractionstring = substr($bitword, $exponentbits + 1, $fractionbits); - $exponent = getid3_lib::Bin2Dec($exponentstring); - $fraction = getid3_lib::Bin2Dec($fractionstring); - - if (($exponent == (pow(2, $exponentbits) - 1)) && ($fraction != 0)) { - // Not a Number - $floatvalue = false; - } elseif (($exponent == (pow(2, $exponentbits) - 1)) && ($fraction == 0)) { - if ($signbit == '1') { - $floatvalue = '-infinity'; - } else { - $floatvalue = '+infinity'; - } - } elseif (($exponent == 0) && ($fraction == 0)) { - if ($signbit == '1') { - $floatvalue = -0; - } else { - $floatvalue = 0; - } - $floatvalue = ($signbit ? 0 : -0); - } elseif (($exponent == 0) && ($fraction != 0)) { - // These are 'unnormalized' values - $floatvalue = pow(2, (-1 * (pow(2, $exponentbits - 1) - 2))) * getid3_lib::DecimalBinary2Float($fractionstring); - if ($signbit == '1') { - $floatvalue *= -1; - } - } elseif ($exponent != 0) { - $floatvalue = pow(2, ($exponent - (pow(2, $exponentbits - 1) - 1))) * (1 + getid3_lib::DecimalBinary2Float($fractionstring)); - if ($signbit == '1') { - $floatvalue *= -1; - } - } - return (float) $floatvalue; - } - - - function BigEndian2Int($byteword, $synchsafe=false, $signed=false) { - $intvalue = 0; - $bytewordlen = strlen($byteword); - for ($i = 0; $i < $bytewordlen; $i++) { - if ($synchsafe) { // disregard MSB, effectively 7-bit bytes - $intvalue = $intvalue | (ord($byteword{$i}) & 0x7F) << (($bytewordlen - 1 - $i) * 7); - } else { - $intvalue += ord($byteword{$i}) * pow(256, ($bytewordlen - 1 - $i)); - } - } - if ($signed && !$synchsafe) { - // synchsafe ints are not allowed to be signed - switch ($bytewordlen) { - case 1: - case 2: - case 3: - case 4: - $signmaskbit = 0x80 << (8 * ($bytewordlen - 1)); - if ($intvalue & $signmaskbit) { - $intvalue = 0 - ($intvalue & ($signmaskbit - 1)); - } - break; - - default: - die('ERROR: Cannot have signed integers larger than 32-bits in getid3_lib::BigEndian2Int()'); - break; - } - } - return getid3_lib::CastAsInt($intvalue); - } - - - function LittleEndian2Int($byteword, $signed=false) { - return getid3_lib::BigEndian2Int(strrev($byteword), false, $signed); - } - - - function BigEndian2Bin($byteword) { - $binvalue = ''; - $bytewordlen = strlen($byteword); - for ($i = 0; $i < $bytewordlen; $i++) { - $binvalue .= str_pad(decbin(ord($byteword{$i})), 8, '0', STR_PAD_LEFT); - } - return $binvalue; - } - - - function BigEndian2String($number, $minbytes=1, $synchsafe=false, $signed=false) { - if ($number < 0) { - return false; - } - $maskbyte = (($synchsafe || $signed) ? 0x7F : 0xFF); - $intstring = ''; - if ($signed) { - if ($minbytes > 4) { - die('ERROR: Cannot have signed integers larger than 32-bits in getid3_lib::BigEndian2String()'); - } - $number = $number & (0x80 << (8 * ($minbytes - 1))); - } - while ($number != 0) { - $quotient = ($number / ($maskbyte + 1)); - $intstring = chr(ceil(($quotient - floor($quotient)) * $maskbyte)).$intstring; - $number = floor($quotient); - } - return str_pad($intstring, $minbytes, "\x00", STR_PAD_LEFT); - } - - - function Dec2Bin($number) { - while ($number >= 256) { - $bytes[] = (($number / 256) - (floor($number / 256))) * 256; - $number = floor($number / 256); - } - $bytes[] = $number; - $binstring = ''; - for ($i = 0; $i < count($bytes); $i++) { - $binstring = (($i == count($bytes) - 1) ? decbin($bytes[$i]) : str_pad(decbin($bytes[$i]), 8, '0', STR_PAD_LEFT)).$binstring; - } - return $binstring; - } - - - function Bin2Dec($binstring, $signed=false) { - $signmult = 1; - if ($signed) { - if ($binstring{0} == '1') { - $signmult = -1; - } - $binstring = substr($binstring, 1); - } - $decvalue = 0; - for ($i = 0; $i < strlen($binstring); $i++) { - $decvalue += ((int) substr($binstring, strlen($binstring) - $i - 1, 1)) * pow(2, $i); - } - return getid3_lib::CastAsInt($decvalue * $signmult); - } - - - function Bin2String($binstring) { - // return 'hi' for input of '0110100001101001' - $string = ''; - $binstringreversed = strrev($binstring); - for ($i = 0; $i < strlen($binstringreversed); $i += 8) { - $string = chr(getid3_lib::Bin2Dec(strrev(substr($binstringreversed, $i, 8)))).$string; - } - return $string; - } - - - function LittleEndian2String($number, $minbytes=1, $synchsafe=false) { - $intstring = ''; - while ($number > 0) { - if ($synchsafe) { - $intstring = $intstring.chr($number & 127); - $number >>= 7; - } else { - $intstring = $intstring.chr($number & 255); - $number >>= 8; - } - } - return str_pad($intstring, $minbytes, "\x00", STR_PAD_RIGHT); - } - - - function array_merge_clobber($array1, $array2) { - // written by kcØhireability*com - // taken from http://www.php.net/manual/en/function.array-merge-recursive.php - if (!is_array($array1) || !is_array($array2)) { - return false; - } - $newarray = $array1; - foreach ($array2 as $key => $val) { - if (is_array($val) && isset($newarray[$key]) && is_array($newarray[$key])) { - $newarray[$key] = getid3_lib::array_merge_clobber($newarray[$key], $val); - } else { - $newarray[$key] = $val; - } - } - return $newarray; - } - - - function array_merge_noclobber($array1, $array2) { - if (!is_array($array1) || !is_array($array2)) { - return false; - } - $newarray = $array1; - foreach ($array2 as $key => $val) { - if (is_array($val) && isset($newarray[$key]) && is_array($newarray[$key])) { - $newarray[$key] = getid3_lib::array_merge_noclobber($newarray[$key], $val); - } elseif (!isset($newarray[$key])) { - $newarray[$key] = $val; - } - } - return $newarray; - } - - - function fileextension($filename, $numextensions=1) { - if (strstr($filename, '.')) { - $reversedfilename = strrev($filename); - $offset = 0; - for ($i = 0; $i < $numextensions; $i++) { - $offset = strpos($reversedfilename, '.', $offset + 1); - if ($offset === false) { - return ''; - } - } - return strrev(substr($reversedfilename, 0, $offset)); - } - return ''; - } - - - function PlaytimeString($playtimeseconds) { - $sign = (($playtimeseconds < 0) ? '-' : ''); - $playtimeseconds = abs($playtimeseconds); - $contentseconds = round((($playtimeseconds / 60) - floor($playtimeseconds / 60)) * 60); - $contentminutes = floor($playtimeseconds / 60); - if ($contentseconds >= 60) { - $contentseconds -= 60; - $contentminutes++; - } - return $sign.intval($contentminutes).':'.str_pad($contentseconds, 2, 0, STR_PAD_LEFT); - } - - - function image_type_to_mime_type($imagetypeid) { - // only available in PHP v4.3.0+ - static $image_type_to_mime_type = array(); - if (empty($image_type_to_mime_type)) { - $image_type_to_mime_type[1] = 'image/gif'; // GIF - $image_type_to_mime_type[2] = 'image/jpeg'; // JPEG - $image_type_to_mime_type[3] = 'image/png'; // PNG - $image_type_to_mime_type[4] = 'application/x-shockwave-flash'; // Flash - $image_type_to_mime_type[5] = 'image/psd'; // PSD - $image_type_to_mime_type[6] = 'image/bmp'; // BMP - $image_type_to_mime_type[7] = 'image/tiff'; // TIFF: little-endian (Intel) - $image_type_to_mime_type[8] = 'image/tiff'; // TIFF: big-endian (Motorola) - //$image_type_to_mime_type[9] = 'image/jpc'; // JPC - //$image_type_to_mime_type[10] = 'image/jp2'; // JPC - //$image_type_to_mime_type[11] = 'image/jpx'; // JPC - //$image_type_to_mime_type[12] = 'image/jb2'; // JPC - $image_type_to_mime_type[13] = 'application/x-shockwave-flash'; // Shockwave - $image_type_to_mime_type[14] = 'image/iff'; // IFF - } - return (isset($image_type_to_mime_type[$imagetypeid]) ? $image_type_to_mime_type[$imagetypeid] : 'application/octet-stream'); - } - - - function DateMac2Unix($macdate) { - // Macintosh timestamp: seconds since 00:00h January 1, 1904 - // UNIX timestamp: seconds since 00:00h January 1, 1970 - return getid3_lib::CastAsInt($macdate - 2082844800); - } - - - function FixedPoint8_8($rawdata) { - return getid3_lib::BigEndian2Int(substr($rawdata, 0, 1)) + (float) (getid3_lib::BigEndian2Int(substr($rawdata, 1, 1)) / pow(2, 8)); - } - - - function FixedPoint16_16($rawdata) { - return getid3_lib::BigEndian2Int(substr($rawdata, 0, 2)) + (float) (getid3_lib::BigEndian2Int(substr($rawdata, 2, 2)) / pow(2, 16)); - } - - - function FixedPoint2_30($rawdata) { - $binarystring = getid3_lib::BigEndian2Bin($rawdata); - return getid3_lib::Bin2Dec(substr($binarystring, 0, 2)) + (float) (getid3_lib::Bin2Dec(substr($binarystring, 2, 30)) / 1073741824); - } - - - function CreateDeepArray($ArrayPath, $Separator, $Value) { - // assigns $Value to a nested array path: - // $foo = getid3_lib::CreateDeepArray('/path/to/my', '/', 'file.txt') - // is the same as: - // $foo = array('path'=>array('to'=>'array('my'=>array('file.txt')))); - // or - // $foo['path']['to']['my'] = 'file.txt'; - while ($ArrayPath && ($ArrayPath{0} == $Separator)) { - $ArrayPath = substr($ArrayPath, 1); - } - if (($pos = strpos($ArrayPath, $Separator)) !== false) { - $ReturnedArray[substr($ArrayPath, 0, $pos)] = getid3_lib::CreateDeepArray(substr($ArrayPath, $pos + 1), $Separator, $Value); - } else { - $ReturnedArray[$ArrayPath] = $Value; - } - return $ReturnedArray; - } - - function array_max($arraydata, $returnkey=false) { - $maxvalue = false; - $maxkey = false; - foreach ($arraydata as $key => $value) { - if (!is_array($value)) { - if ($value > $maxvalue) { - $maxvalue = $value; - $maxkey = $key; - } - } - } - return ($returnkey ? $maxkey : $maxvalue); - } - - function array_min($arraydata, $returnkey=false) { - $minvalue = false; - $minkey = false; - foreach ($arraydata as $key => $value) { - if (!is_array($value)) { - if ($value > $minvalue) { - $minvalue = $value; - $minkey = $key; - } - } - } - return ($returnkey ? $minkey : $minvalue); - } - - - function md5_file($file) { - - // md5_file() exists in PHP 4.2.0+. - if (function_exists('md5_file')) { - return md5_file($file); - } - - if (GETID3_OS_ISWINDOWS) { - - $RequiredFiles = array('cygwin1.dll', 'md5sum.exe'); - foreach ($RequiredFiles as $required_file) { - if (!is_readable(GETID3_HELPERAPPSDIR.$required_file)) { - die(implode(' and ', $RequiredFiles).' are required in '.GETID3_HELPERAPPSDIR.' for getid3_lib::md5_file() to function under Windows in PHP < v4.2.0'); - } - } - $commandline = GETID3_HELPERAPPSDIR.'md5sum.exe "'.str_replace('/', DIRECTORY_SEPARATOR, $file).'"'; - if (ereg("^[\\]?([0-9a-f]{32})", strtolower(`$commandline`), $r)) { - return $r[1]; - } - - } else { - - // The following works under UNIX only - $file = str_replace('`', '\\`', $file); - if (ereg("^([0-9a-f]{32})[ \t\n\r]", `md5sum "$file"`, $r)) { - return $r[1]; - } - - } - return false; - } - - - function sha1_file($file) { - - // sha1_file() exists in PHP 4.3.0+. - if (function_exists('sha1_file')) { - return sha1_file($file); - } - - $file = str_replace('`', '\\`', $file); - - if (GETID3_OS_ISWINDOWS) { - - $RequiredFiles = array('cygwin1.dll', 'sha1sum.exe'); - foreach ($RequiredFiles as $required_file) { - if (!is_readable(GETID3_HELPERAPPSDIR.$required_file)) { - die(implode(' and ', $RequiredFiles).' are required in '.GETID3_HELPERAPPSDIR.' for getid3_lib::sha1_file() to function under Windows in PHP < v4.3.0'); - } - } - $commandline = GETID3_HELPERAPPSDIR.'sha1sum.exe "'.str_replace('/', DIRECTORY_SEPARATOR, $file).'"'; - if (ereg("^sha1=([0-9a-f]{40})", strtolower(`$commandline`), $r)) { - return $r[1]; - } - - } else { - - $commandline = 'sha1sum '.escapeshellarg($file).''; - if (ereg("^([0-9a-f]{40})[ \t\n\r]", strtolower(`$commandline`), $r)) { - return $r[1]; - } - - } - - return false; - } - - - // Allan Hansen <ahØartemis*dk> - // getid3_lib::md5_data() - returns md5sum for a file from startuing position to absolute end position - function hash_data($file, $offset, $end, $algorithm) { - if ($end >= pow(2, 31)) { - return false; - } - - switch ($algorithm) { - case 'md5': - $hash_function = 'md5_file'; - $unix_call = 'md5sum'; - $windows_call = 'md5sum.exe'; - $hash_length = 32; - break; - - case 'sha1': - $hash_function = 'sha1_file'; - $unix_call = 'sha1sum'; - $windows_call = 'sha1sum.exe'; - $hash_length = 40; - break; - - default: - die('Invalid algorithm ('.$algorithm.') in getid3_lib::hash_data()'); - break; - } - $size = $end - $offset; - while (true) { - if (GETID3_OS_ISWINDOWS) { - - // It seems that sha1sum.exe for Windows only works on physical files, does not accept piped data - // Fall back to create-temp-file method: - if ($algorithm == 'sha1') { - break; - } - - $RequiredFiles = array('cygwin1.dll', 'head.exe', 'tail.exe', $windows_call); - foreach ($RequiredFiles as $required_file) { - if (!is_readable(GETID3_HELPERAPPSDIR.$required_file)) { - // helper apps not available - fall back to old method - break; - } - } - $commandline = GETID3_HELPERAPPSDIR.'head.exe -c '.$end.' "'.escapeshellarg(str_replace('/', DIRECTORY_SEPARATOR, $file)).'" | '; - $commandline .= GETID3_HELPERAPPSDIR.'tail.exe -c '.$size.' | '; - $commandline .= GETID3_HELPERAPPSDIR.$windows_call; - - } else { - - $commandline = 'head -c'.$end.' '.escapeshellarg($file).' | '; - $commandline .= 'tail -c'.$size.' | '; - $commandline .= $unix_call; - - } - if ((bool) ini_get('safe_mode')) { - $ThisFileInfo['warning'][] = 'PHP running in Safe Mode - backtick operator not available, using slower non-system-call '.$algorithm.' algorithm'; - break; - } - return substr(`$commandline`, 0, $hash_length); - } - - // try to create a temporary file in the system temp directory - invalid dirname should force to system temp dir - if (($data_filename = tempnam('*', 'getID3')) === false) { - // can't find anywhere to create a temp file, just die - return false; - } - - // Init - $result = false; - - // copy parts of file - if ($fp = @fopen($file, 'rb')) { - - if ($fp_data = @fopen($data_filename, 'wb')) { - - fseek($fp, $offset, SEEK_SET); - $byteslefttowrite = $end - $offset; - while (($byteslefttowrite > 0) && ($buffer = fread($fp, GETID3_FREAD_BUFFER_SIZE))) { - $byteswritten = fwrite($fp_data, $buffer, $byteslefttowrite); - $byteslefttowrite -= $byteswritten; - } - fclose($fp_data); - $result = getid3_lib::$hash_function($data_filename); - - } - fclose($fp); - } - unlink($data_filename); - return $result; - } - - - function iconv_fallback_int_utf8($charval) { - if ($charval < 128) { - // 0bbbbbbb - $newcharstring = chr($charval); - } elseif ($charval < 2048) { - // 110bbbbb 10bbbbbb - $newcharstring = chr(($charval >> 6) | 0xC0); - $newcharstring .= chr(($charval & 0x3F) | 0x80); - } elseif ($charval < 65536) { - // 1110bbbb 10bbbbbb 10bbbbbb - $newcharstring = chr(($charval >> 12) | 0xE0); - $newcharstring .= chr(($charval >> 6) | 0xC0); - $newcharstring .= chr(($charval & 0x3F) | 0x80); - } else { - // 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb - $newcharstring = chr(($charval >> 18) | 0xF0); - $newcharstring .= chr(($charval >> 12) | 0xC0); - $newcharstring .= chr(($charval >> 6) | 0xC0); - $newcharstring .= chr(($charval & 0x3F) | 0x80); - } - return $newcharstring; - } - - // ISO-8859-1 => UTF-8 - function iconv_fallback_iso88591_utf8($string, $bom=false) { - if (function_exists('utf8_encode')) { - return utf8_encode($string); - } - // utf8_encode() unavailable, use getID3()'s iconv_fallback() conversions (possibly PHP is compiled without XML support) - $newcharstring = ''; - if ($bom) { - $newcharstring .= "\xEF\xBB\xBF"; - } - for ($i = 0; $i < strlen($string); $i++) { - $charval = ord($string{$i}); - $newcharstring .= getid3_lib::iconv_fallback_int_utf8($charval); - } - return $newcharstring; - } - - // ISO-8859-1 => UTF-16BE - function iconv_fallback_iso88591_utf16be($string, $bom=false) { - $newcharstring = ''; - if ($bom) { - $newcharstring .= "\xFE\xFF"; - } - for ($i = 0; $i < strlen($string); $i++) { - $newcharstring .= "\x00".$string{$i}; - } - return $newcharstring; - } - - // ISO-8859-1 => UTF-16LE - function iconv_fallback_iso88591_utf16le($string, $bom=false) { - $newcharstring = ''; - if ($bom) { - $newcharstring .= "\xFF\xFE"; - } - for ($i = 0; $i < strlen($string); $i++) { - $newcharstring .= $string{$i}."\x00"; - } - return $newcharstring; - } - - // ISO-8859-1 => UTF-16LE (BOM) - function iconv_fallback_iso88591_utf16($string) { - return getid3_lib::iconv_fallback_iso88591_utf16le($string, true); - } - - // UTF-8 => ISO-8859-1 - function iconv_fallback_utf8_iso88591($string) { - if (function_exists('utf8_decode')) { - return utf8_decode($string); - } - // utf8_decode() unavailable, use getID3()'s iconv_fallback() conversions (possibly PHP is compiled without XML support) - $newcharstring = ''; - $offset = 0; - $stringlength = strlen($string); - while ($offset < $stringlength) { - if ((ord($string{$offset}) | 0x07) == 0xF7) { - // 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb - $charval = ((ord($string{($offset + 0)}) & 0x07) << 18) & - ((ord($string{($offset + 1)}) & 0x3F) << 12) & - ((ord($string{($offset + 2)}) & 0x3F) << 6) & - (ord($string{($offset + 3)}) & 0x3F); - $offset += 4; - } elseif ((ord($string{$offset}) | 0x0F) == 0xEF) { - // 1110bbbb 10bbbbbb 10bbbbbb - $charval = ((ord($string{($offset + 0)}) & 0x0F) << 12) & - ((ord($string{($offset + 1)}) & 0x3F) << 6) & - (ord($string{($offset + 2)}) & 0x3F); - $offset += 3; - } elseif ((ord($string{$offset}) | 0x1F) == 0xDF) { - // 110bbbbb 10bbbbbb - $charval = ((ord($string{($offset + 0)}) & 0x1F) << 6) & - (ord($string{($offset + 1)}) & 0x3F); - $offset += 2; - } elseif ((ord($string{$offset}) | 0x7F) == 0x7F) { - // 0bbbbbbb - $charval = ord($string{$offset}); - $offset += 1; - } else { - // error? throw some kind of warning here? - $charval = false; - $offset += 1; - } - if ($charval !== false) { - $newcharstring .= (($charval < 256) ? chr($charval) : '?'); - } - } - return $newcharstring; - } - - // UTF-8 => UTF-16BE - function iconv_fallback_utf8_utf16be($string, $bom=false) { - $newcharstring = ''; - if ($bom) { - $newcharstring .= "\xFE\xFF"; - } - $offset = 0; - $stringlength = strlen($string); - while ($offset < $stringlength) { - if ((ord($string{$offset}) | 0x07) == 0xF7) { - // 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb - $charval = ((ord($string{($offset + 0)}) & 0x07) << 18) & - ((ord($string{($offset + 1)}) & 0x3F) << 12) & - ((ord($string{($offset + 2)}) & 0x3F) << 6) & - (ord($string{($offset + 3)}) & 0x3F); - $offset += 4; - } elseif ((ord($string{$offset}) | 0x0F) == 0xEF) { - // 1110bbbb 10bbbbbb 10bbbbbb - $charval = ((ord($string{($offset + 0)}) & 0x0F) << 12) & - ((ord($string{($offset + 1)}) & 0x3F) << 6) & - (ord($string{($offset + 2)}) & 0x3F); - $offset += 3; - } elseif ((ord($string{$offset}) | 0x1F) == 0xDF) { - // 110bbbbb 10bbbbbb - $charval = ((ord($string{($offset + 0)}) & 0x1F) << 6) & - (ord($string{($offset + 1)}) & 0x3F); - $offset += 2; - } elseif ((ord($string{$offset}) | 0x7F) == 0x7F) { - // 0bbbbbbb - $charval = ord($string{$offset}); - $offset += 1; - } else { - // error? throw some kind of warning here? - $charval = false; - $offset += 1; - } - if ($charval !== false) { - $newcharstring .= (($charval < 65536) ? getid3_lib::BigEndian2String($charval, 2) : "\x00".'?'); - } - } - return $newcharstring; - } - - // UTF-8 => UTF-16LE - function iconv_fallback_utf8_utf16le($string, $bom=false) { - $newcharstring = ''; - if ($bom) { - $newcharstring .= "\xFF\xFE"; - } - $offset = 0; - $stringlength = strlen($string); - while ($offset < $stringlength) { - if ((ord($string{$offset}) | 0x07) == 0xF7) { - // 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb - $charval = ((ord($string{($offset + 0)}) & 0x07) << 18) & - ((ord($string{($offset + 1)}) & 0x3F) << 12) & - ((ord($string{($offset + 2)}) & 0x3F) << 6) & - (ord($string{($offset + 3)}) & 0x3F); - $offset += 4; - } elseif ((ord($string{$offset}) | 0x0F) == 0xEF) { - // 1110bbbb 10bbbbbb 10bbbbbb - $charval = ((ord($string{($offset + 0)}) & 0x0F) << 12) & - ((ord($string{($offset + 1)}) & 0x3F) << 6) & - (ord($string{($offset + 2)}) & 0x3F); - $offset += 3; - } elseif ((ord($string{$offset}) | 0x1F) == 0xDF) { - // 110bbbbb 10bbbbbb - $charval = ((ord($string{($offset + 0)}) & 0x1F) << 6) & - (ord($string{($offset + 1)}) & 0x3F); - $offset += 2; - } elseif ((ord($string{$offset}) | 0x7F) == 0x7F) { - // 0bbbbbbb - $charval = ord($string{$offset}); - $offset += 1; - } else { - // error? maybe throw some warning here? - $charval = false; - $offset += 1; - } - if ($charval !== false) { - $newcharstring .= (($charval < 65536) ? getid3_lib::LittleEndian2String($charval, 2) : '?'."\x00"); - } - } - return $newcharstring; - } - - // UTF-8 => UTF-16LE (BOM) - function iconv_fallback_utf8_utf16($string) { - return getid3_lib::iconv_fallback_utf8_utf16le($string, true); - } - - // UTF-16BE => UTF-8 - function iconv_fallback_utf16be_utf8($string) { - if (substr($string, 0, 2) == "\xFE\xFF") { - // strip BOM - $string = substr($string, 2); - } - $newcharstring = ''; - for ($i = 0; $i < strlen($string); $i += 2) { - $charval = getid3_lib::BigEndian2Int(substr($string, $i, 2)); - $newcharstring .= getid3_lib::iconv_fallback_int_utf8($charval); - } - return $newcharstring; - } - - // UTF-16LE => UTF-8 - function iconv_fallback_utf16le_utf8($string) { - if (substr($string, 0, 2) == "\xFF\xFE") { - // strip BOM - $string = substr($string, 2); - } - $newcharstring = ''; - for ($i = 0; $i < strlen($string); $i += 2) { - $charval = getid3_lib::LittleEndian2Int(substr($string, $i, 2)); - $newcharstring .= getid3_lib::iconv_fallback_int_utf8($charval); - } - return $newcharstring; - } - - // UTF-16BE => ISO-8859-1 - function iconv_fallback_utf16be_iso88591($string) { - if (substr($string, 0, 2) == "\xFE\xFF") { - // strip BOM - $string = substr($string, 2); - } - $newcharstring = ''; - for ($i = 0; $i < strlen($string); $i += 2) { - $charval = getid3_lib::BigEndian2Int(substr($string, $i, 2)); - $newcharstring .= (($charval < 256) ? chr($charval) : '?'); - } - return $newcharstring; - } - - // UTF-16LE => ISO-8859-1 - function iconv_fallback_utf16le_iso88591($string) { - if (substr($string, 0, 2) == "\xFF\xFE") { - // strip BOM - $string = substr($string, 2); - } - $newcharstring = ''; - for ($i = 0; $i < strlen($string); $i += 2) { - $charval = getid3_lib::LittleEndian2Int(substr($string, $i, 2)); - $newcharstring .= (($charval < 256) ? chr($charval) : '?'); - } - return $newcharstring; - } - - // UTF-16 (BOM) => ISO-8859-1 - function iconv_fallback_utf16_iso88591($string) { - $bom = substr($string, 0, 2); - if ($bom == "\xFE\xFF") { - return getid3_lib::iconv_fallback_utf16be_iso88591(substr($string, 2)); - } elseif ($bom == "\xFF\xFE") { - return getid3_lib::iconv_fallback_utf16le_iso88591(substr($string, 2)); - } - return $string; - } - - // UTF-16 (BOM) => UTF-8 - function iconv_fallback_utf16_utf8($string) { - $bom = substr($string, 0, 2); - if ($bom == "\xFE\xFF") { - return getid3_lib::iconv_fallback_utf16be_utf8(substr($string, 2)); - } elseif ($bom == "\xFF\xFE") { - return getid3_lib::iconv_fallback_utf16le_utf8(substr($string, 2)); - } - return $string; - } - - function iconv_fallback($in_charset, $out_charset, $string) { - - if ($in_charset == $out_charset) { - return $string; - } - - // iconv() availble - if (function_exists('iconv')) { - - if ($converted_string = @iconv($in_charset, $out_charset.'//TRANSLIT', $string)) { - switch ($out_charset) { - case 'ISO-8859-1': - $converted_string = rtrim($converted_string, "\x00"); - break; - } - return $converted_string; - } - - // iconv() may sometimes fail with "illegal character in input string" error message - // and return an empty string, but returning the unconverted string is more useful - return $string; - } - - - // iconv() not available - static $ConversionFunctionList = array(); - if (empty($ConversionFunctionList)) { - $ConversionFunctionList['ISO-8859-1']['UTF-8'] = 'iconv_fallback_iso88591_utf8'; - $ConversionFunctionList['ISO-8859-1']['UTF-16'] = 'iconv_fallback_iso88591_utf16'; - $ConversionFunctionList['ISO-8859-1']['UTF-16BE'] = 'iconv_fallback_iso88591_utf16be'; - $ConversionFunctionList['ISO-8859-1']['UTF-16LE'] = 'iconv_fallback_iso88591_utf16le'; - $ConversionFunctionList['UTF-8']['ISO-8859-1'] = 'iconv_fallback_utf8_iso88591'; - $ConversionFunctionList['UTF-8']['UTF-16'] = 'iconv_fallback_utf8_utf16'; - $ConversionFunctionList['UTF-8']['UTF-16BE'] = 'iconv_fallback_utf8_utf16be'; - $ConversionFunctionList['UTF-8']['UTF-16LE'] = 'iconv_fallback_utf8_utf16le'; - $ConversionFunctionList['UTF-16']['ISO-8859-1'] = 'iconv_fallback_utf16_iso88591'; - $ConversionFunctionList['UTF-16']['UTF-8'] = 'iconv_fallback_utf16_utf8'; - $ConversionFunctionList['UTF-16LE']['ISO-8859-1'] = 'iconv_fallback_utf16le_iso88591'; - $ConversionFunctionList['UTF-16LE']['UTF-8'] = 'iconv_fallback_utf16le_utf8'; - $ConversionFunctionList['UTF-16BE']['ISO-8859-1'] = 'iconv_fallback_utf16be_iso88591'; - $ConversionFunctionList['UTF-16BE']['UTF-8'] = 'iconv_fallback_utf16be_utf8'; - } - if (isset($ConversionFunctionList[strtoupper($in_charset)][strtoupper($out_charset)])) { - $ConversionFunction = $ConversionFunctionList[strtoupper($in_charset)][strtoupper($out_charset)]; - return getid3_lib::$ConversionFunction($string); - } - die('PHP does not have iconv() support - cannot convert from '.$in_charset.' to '.$out_charset); - } - - - function MultiByteCharString2HTML($string, $charset='ISO-8859-1') { - $HTMLstring = ''; - - switch ($charset) { - case 'ISO-8859-1': - case 'ISO8859-1': - case 'ISO-8859-15': - case 'ISO8859-15': - case 'cp866': - case 'ibm866': - case '866': - case 'cp1251': - case 'Windows-1251': - case 'win-1251': - case '1251': - case 'cp1252': - case 'Windows-1252': - case '1252': - case 'KOI8-R': - case 'koi8-ru': - case 'koi8r': - case 'BIG5': - case '950': - case 'GB2312': - case '936': - case 'BIG5-HKSCS': - case 'Shift_JIS': - case 'SJIS': - case '932': - case 'EUC-JP': - case 'EUCJP': - $HTMLstring = htmlentities($string, ENT_COMPAT, $charset); - break; - - case 'UTF-8': - $strlen = strlen($string); - for ($i = 0; $i < $strlen; $i++) { - $char_ord_val = ord($string{$i}); - $charval = 0; - if ($char_ord_val < 0x80) { - $charval = $char_ord_val; - } elseif ((($char_ord_val & 0xF0) >> 4) == 0x0F && $i+3 < $strlen) { - $charval = (($char_ord_val & 0x07) << 18); - $charval += ((ord($string{++$i}) & 0x3F) << 12); - $charval += ((ord($string{++$i}) & 0x3F) << 6); - $charval += (ord($string{++$i}) & 0x3F); - } elseif ((($char_ord_val & 0xE0) >> 5) == 0x07 && $i+2 < $strlen) { - $charval = (($char_ord_val & 0x0F) << 12); - $charval += ((ord($string{++$i}) & 0x3F) << 6); - $charval += (ord($string{++$i}) & 0x3F); - } elseif ((($char_ord_val & 0xC0) >> 6) == 0x03 && $i+1 < $strlen) { - $charval = (($char_ord_val & 0x1F) << 6); - $charval += (ord($string{++$i}) & 0x3F); - } - if (($charval >= 32) && ($charval <= 127)) { - $HTMLstring .= htmlentities(chr($charval)); - } else { - $HTMLstring .= '&#'.$charval.';'; - } - } - break; - - case 'UTF-16LE': - for ($i = 0; $i < strlen($string); $i += 2) { - $charval = getid3_lib::LittleEndian2Int(substr($string, $i, 2)); - if (($charval >= 32) && ($charval <= 127)) { - $HTMLstring .= chr($charval); - } else { - $HTMLstring .= '&#'.$charval.';'; - } - } - break; - - case 'UTF-16BE': - for ($i = 0; $i < strlen($string); $i += 2) { - $charval = getid3_lib::BigEndian2Int(substr($string, $i, 2)); - if (($charval >= 32) && ($charval <= 127)) { - $HTMLstring .= chr($charval); - } else { - $HTMLstring .= '&#'.$charval.';'; - } - } - break; - - default: - $HTMLstring = 'ERROR: Character set "'.$charset.'" not supported in MultiByteCharString2HTML()'; - break; - } - return $HTMLstring; - } - - - - function RGADnameLookup($namecode) { - static $RGADname = array(); - if (empty($RGADname)) { - $RGADname[0] = 'not set'; - $RGADname[1] = 'Track Gain Adjustment'; - $RGADname[2] = 'Album Gain Adjustment'; - } - - return (isset($RGADname[$namecode]) ? $RGADname[$namecode] : ''); - } - - - function RGADoriginatorLookup($originatorcode) { - static $RGADoriginator = array(); - if (empty($RGADoriginator)) { - $RGADoriginator[0] = 'unspecified'; - $RGADoriginator[1] = 'pre-set by artist/producer/mastering engineer'; - $RGADoriginator[2] = 'set by user'; - $RGADoriginator[3] = 'determined automatically'; - } - - return (isset($RGADoriginator[$originatorcode]) ? $RGADoriginator[$originatorcode] : ''); - } - - - function RGADadjustmentLookup($rawadjustment, $signbit) { - $adjustment = $rawadjustment / 10; - if ($signbit == 1) { - $adjustment *= -1; - } - return (float) $adjustment; - } - - - function RGADgainString($namecode, $originatorcode, $replaygain) { - if ($replaygain < 0) { - $signbit = '1'; - } else { - $signbit = '0'; - } - $storedreplaygain = intval(round($replaygain * 10)); - $gainstring = str_pad(decbin($namecode), 3, '0', STR_PAD_LEFT); - $gainstring .= str_pad(decbin($originatorcode), 3, '0', STR_PAD_LEFT); - $gainstring .= $signbit; - $gainstring .= str_pad(decbin($storedreplaygain), 9, '0', STR_PAD_LEFT); - - return $gainstring; - } - - function RGADamplitude2dB($amplitude) { - return 20 * log10($amplitude); - } - - - function GetDataImageSize($imgData, &$imageinfo) { - $GetDataImageSize = false; - if ($tempfilename = tempnam('*', 'getID3')) { - if ($tmp = @fopen($tempfilename, 'wb')) { - fwrite($tmp, $imgData); - fclose($tmp); - $GetDataImageSize = @GetImageSize($tempfilename, $imageinfo); - } - unlink($tempfilename); - } - return $GetDataImageSize; - } - - function ImageTypesLookup($imagetypeid) { - static $ImageTypesLookup = array(); - if (empty($ImageTypesLookup)) { - $ImageTypesLookup[1] = 'gif'; - $ImageTypesLookup[2] = 'jpeg'; - $ImageTypesLookup[3] = 'png'; - $ImageTypesLookup[4] = 'swf'; - $ImageTypesLookup[5] = 'psd'; - $ImageTypesLookup[6] = 'bmp'; - $ImageTypesLookup[7] = 'tiff (little-endian)'; - $ImageTypesLookup[8] = 'tiff (big-endian)'; - $ImageTypesLookup[9] = 'jpc'; - $ImageTypesLookup[10] = 'jp2'; - $ImageTypesLookup[11] = 'jpx'; - $ImageTypesLookup[12] = 'jb2'; - $ImageTypesLookup[13] = 'swc'; - $ImageTypesLookup[14] = 'iff'; - } - return (isset($ImageTypesLookup[$imagetypeid]) ? $ImageTypesLookup[$imagetypeid] : ''); - } - - function CopyTagsToComments(&$ThisFileInfo) { - - // Copy all entries from ['tags'] into common ['comments'] - if (!empty($ThisFileInfo['tags'])) { - foreach ($ThisFileInfo['tags'] as $tagtype => $tagarray) { - foreach ($tagarray as $tagname => $tagdata) { - foreach ($tagdata as $key => $value) { - if (!empty($value)) { - if (empty($ThisFileInfo['comments'][$tagname])) { - - // fall through and append value - - } elseif ($tagtype == 'id3v1') { - - $newvaluelength = strlen(trim($value)); - foreach ($ThisFileInfo['comments'][$tagname] as $existingkey => $existingvalue) { - $oldvaluelength = strlen(trim($existingvalue)); - if (($newvaluelength <= $oldvaluelength) && (substr($existingvalue, 0, $newvaluelength) == trim($value))) { - // new value is identical but shorter-than (or equal-length to) one already in comments - skip - break 2; - } - } - - } else { - - $newvaluelength = strlen(trim($value)); - foreach ($ThisFileInfo['comments'][$tagname] as $existingkey => $existingvalue) { - $oldvaluelength = strlen(trim($existingvalue)); - if (($newvaluelength > $oldvaluelength) && (substr(trim($value), 0, strlen($existingvalue)) == $existingvalue)) { - $ThisFileInfo['comments'][$tagname][$existingkey] = trim($value); - break 2; - } - } - - } - if (empty($ThisFileInfo['comments'][$tagname]) || !in_array(trim($value), $ThisFileInfo['comments'][$tagname])) { - $ThisFileInfo['comments'][$tagname][] = trim($value); - } - } - } - } - } - - // Copy to ['comments_html'] - foreach ($ThisFileInfo['comments'] as $field => $values) { - foreach ($values as $index => $value) { - $ThisFileInfo['comments_html'][$field][$index] = str_replace('�', '', getid3_lib::MultiByteCharString2HTML($value, $ThisFileInfo['encoding'])); - } - } - } - } - - - function EmbeddedLookup($key, $begin, $end, $file, $name) { - - // Cached - static $cache; - if (isset($cache[$file][$name])) { - return @$cache[$file][$name][$key]; - } - - // Init - $keylength = strlen($key); - $line_count = $end - $begin - 7; - - // Open php file - $fp = fopen($file, 'r'); - - // Discard $begin lines - for ($i = 0; $i < ($begin + 3); $i++) { - fgets($fp, 1024); - } - - // Loop thru line - while (0 < $line_count--) { - - // Read line - $line = ltrim(fgets($fp, 1024), "\t "); - - // METHOD A: only cache the matching key - less memory but slower on next lookup of not-previously-looked-up key - //$keycheck = substr($line, 0, $keylength); - //if ($key == $keycheck) { - // $cache[$file][$name][$keycheck] = substr($line, $keylength + 1); - // break; - //} - - // METHOD B: cache all keys in this lookup - more memory but faster on next lookup of not-previously-looked-up key - //$cache[$file][$name][substr($line, 0, $keylength)] = trim(substr($line, $keylength + 1)); - @list($ThisKey, $ThisValue) = explode("\t", $line, 2); - $cache[$file][$name][$ThisKey] = trim($ThisValue); - } - - // Close and return - fclose($fp); - return @$cache[$file][$name][$key]; - } - - function IncludeDependency($filename, $sourcefile, $DieOnFailure=false) { - global $GETID3_ERRORARRAY; - - if (file_exists($filename)) { - if (@include_once($filename)) { - return true; - } else { - $diemessage = basename($sourcefile).' depends on '.$filename.', which has errors'; - } - } else { - $diemessage = basename($sourcefile).' depends on '.$filename.', which is missing'; - } - if ($DieOnFailure) { - die($diemessage); - } else { - $GETID3_ERRORARRAY[] = $diemessage; - } - return false; - } - -} - -?>
\ No newline at end of file diff --git a/getid3/getid3.php b/getid3/getid3.php deleted file mode 100644 index f9dcf70..0000000 --- a/getid3/getid3.php +++ /dev/null @@ -1,1397 +0,0 @@ -<?php -///////////////////////////////////////////////////////////////// -/// getID3() by James Heinrich <info@getid3.org> // -// available at http://getid3.sourceforge.net // -// or http://www.getid3.org // -///////////////////////////////////////////////////////////////// -// // -// Please see readme.txt for more information // -// /// -///////////////////////////////////////////////////////////////// - -// Defines -define('GETID3_VERSION', '1.7.9-20090308'); -define('GETID3_FREAD_BUFFER_SIZE', 16384); // read buffer size in bytes - - - -class getID3 -{ - // public: Settings - var $encoding = 'ISO-8859-1'; // CASE SENSITIVE! - i.e. (must be supported by iconv()) - // Examples: ISO-8859-1 UTF-8 UTF-16 UTF-16BE - - var $encoding_id3v1 = 'ISO-8859-1'; // Should always be 'ISO-8859-1', but some tags may be written in other encodings such as 'EUC-CN' - - var $tempdir = '*'; // default '*' should use system temp dir - - // public: Optional tag checks - disable for speed. - var $option_tag_id3v1 = true; // Read and process ID3v1 tags - var $option_tag_id3v2 = true; // Read and process ID3v2 tags - var $option_tag_lyrics3 = true; // Read and process Lyrics3 tags - var $option_tag_apetag = true; // Read and process APE tags - var $option_tags_process = true; // Copy tags to root key 'tags' and encode to $this->encoding - var $option_tags_html = true; // Copy tags to root key 'tags_html' properly translated from various encodings to HTML entities - - // public: Optional tag/comment calucations - var $option_extra_info = true; // Calculate additional info such as bitrate, channelmode etc - - // public: Optional calculations - var $option_md5_data = false; // Get MD5 sum of data part - slow - var $option_md5_data_source = false; // Use MD5 of source file if availble - only FLAC and OptimFROG - var $option_sha1_data = false; // Get SHA1 sum of data part - slow - var $option_max_2gb_check = true; // Check whether file is larger than 2 Gb and thus not supported by PHP - - // private - var $filename; - - - // public: constructor - function getID3() - { - - $this->startup_error = ''; - $this->startup_warning = ''; - - // Check for PHP version >= 4.2.0 - if (phpversion() < '4.2.0') { - $this->startup_error .= 'getID3() requires PHP v4.2.0 or higher - you are running v'.phpversion(); - } - - // Check memory - $memory_limit = ini_get('memory_limit'); - if (eregi('([0-9]+)M', $memory_limit, $matches)) { - // could be stored as "16M" rather than 16777216 for example - $memory_limit = $matches[1] * 1048576; - } - if ($memory_limit <= 0) { - // memory limits probably disabled - } elseif ($memory_limit <= 3145728) { - $this->startup_error .= 'PHP has less than 3MB available memory and will very likely run out. Increase memory_limit in php.ini'; - } elseif ($memory_limit <= 12582912) { - $this->startup_warning .= 'PHP has less than 12MB available memory and might run out if all modules are loaded. Increase memory_limit in php.ini'; - } - - // Check safe_mode off - if ((bool) ini_get('safe_mode')) { - $this->warning('WARNING: Safe mode is on, shorten support disabled, md5data/sha1data for ogg vorbis disabled, ogg vorbos/flac tag writing disabled.'); - } - - - // define a constant rather than looking up every time it is needed - if (!defined('GETID3_OS_ISWINDOWS')) { - if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') { - define('GETID3_OS_ISWINDOWS', true); - } else { - define('GETID3_OS_ISWINDOWS', false); - } - } - - // Get base path of getID3() - ONCE - if (!defined('GETID3_INCLUDEPATH')) { - foreach (get_included_files() as $key => $val) { - if (basename($val) == 'getid3.php') { - define('GETID3_INCLUDEPATH', dirname($val).DIRECTORY_SEPARATOR); - break; - } - } - } - - // Load support library - if (!include_once(GETID3_INCLUDEPATH.'getid3.lib.php')) { - $this->startup_error .= 'getid3.lib.php is missing or corrupt'; - } - - - // Needed for Windows only: - // Define locations of helper applications for Shorten, VorbisComment, MetaFLAC - // as well as other helper functions such as head, tail, md5sum, etc - // IMPORTANT: This path cannot have spaces in it. If neccesary, use the 8dot3 equivalent - // ie for "C:/Program Files/Apache/" put "C:/PROGRA~1/APACHE/" - // IMPORTANT: This path must include the trailing slash - if (GETID3_OS_ISWINDOWS && !defined('GETID3_HELPERAPPSDIR')) { - - $helperappsdir = GETID3_INCLUDEPATH.'..'.DIRECTORY_SEPARATOR.'helperapps'; // must not have any space in this path - - if (!is_dir($helperappsdir)) { - $this->startup_error .= '"'.$helperappsdir.'" cannot be defined as GETID3_HELPERAPPSDIR because it does not exist'; - } elseif (strpos(realpath($helperappsdir), ' ') !== false) { - $DirPieces = explode(DIRECTORY_SEPARATOR, realpath($helperappsdir)); - foreach ($DirPieces as $key => $value) { - if ((strpos($value, '.') !== false) && (strpos($value, ' ') === false)) { - if (strpos($value, '.') > 8) { - $value = substr($value, 0, 6).'~1'; - } - } elseif ((strpos($value, ' ') !== false) || strlen($value) > 8) { - $value = substr($value, 0, 6).'~1'; - } - $DirPieces[$key] = strtoupper($value); - } - $this->startup_error .= 'GETID3_HELPERAPPSDIR must not have any spaces in it - use 8dot3 naming convention if neccesary (on this server that would be something like "'.implode(DIRECTORY_SEPARATOR, $DirPieces).'" - NOTE: this may or may not be the actual 8.3 equivalent of "'.$helperappsdir.'", please double-check). You can run "dir /x" from the commandline to see the correct 8.3-style names.'; - } - define('GETID3_HELPERAPPSDIR', realpath($helperappsdir).DIRECTORY_SEPARATOR); - } - - } - - - // public: setOption - function setOption($optArray) { - if (!is_array($optArray) || empty($optArray)) { - return false; - } - foreach ($optArray as $opt => $val) { - //if (isset($this, $opt) === false) { - if (isset($this->$opt) === false) { - continue; - } - $this->$opt = $val; - } - return true; - } - - - // public: analyze file - replaces GetAllFileInfo() and GetTagOnly() - function analyze($filename) { - - if (!empty($this->startup_error)) { - return $this->error($this->startup_error); - } - if (!empty($this->startup_warning)) { - $this->warning($this->startup_warning); - } - - // init result array and set parameters - $this->info = array(); - $this->info['GETID3_VERSION'] = GETID3_VERSION; - - // Check encoding/iconv support - if (!function_exists('iconv') && !in_array($this->encoding, array('ISO-8859-1', 'UTF-8', 'UTF-16LE', 'UTF-16BE', 'UTF-16'))) { - $errormessage = 'iconv() support is needed for encodings other than ISO-8859-1, UTF-8, UTF-16LE, UTF16-BE, UTF-16. '; - if (GETID3_OS_ISWINDOWS) { - $errormessage .= 'PHP does not have iconv() support. Please enable php_iconv.dll in php.ini, and copy iconv.dll from c:/php/dlls to c:/windows/system32'; - } else { - $errormessage .= 'PHP is not compiled with iconv() support. Please recompile with the --with-iconv switch'; - } - return $this->error($errormessage); - } - - // Disable magic_quotes_runtime, if neccesary - $old_magic_quotes_runtime = get_magic_quotes_runtime(); // store current setting of magic_quotes_runtime - if ($old_magic_quotes_runtime) { - set_magic_quotes_runtime(0); // turn off magic_quotes_runtime - if (get_magic_quotes_runtime()) { - return $this->error('Could not disable magic_quotes_runtime - getID3() cannot work properly with this setting enabled'); - } - } - - // remote files not supported - if (preg_match('/^(ht|f)tp:\/\//', $filename)) { - return $this->error('Remote files are not supported in this version of getID3() - please copy the file locally first'); - } - - $filename = str_replace('/', DIRECTORY_SEPARATOR, $filename); - $filename = preg_replace('#'.preg_quote(DIRECTORY_SEPARATOR).'{2,}#', DIRECTORY_SEPARATOR, $filename); - - // open local file - if (file_exists($filename) && ($fp = @fopen($filename, 'rb'))) { - // great - } else { - return $this->error('Could not open file "'.$filename.'"'); - } - - // set parameters - $this->info['filesize'] = filesize($filename); - - // option_max_2gb_check - if ($this->option_max_2gb_check) { - // PHP doesn't support integers larger than 31-bit (~2GB) - // filesize() simply returns (filesize % (pow(2, 32)), no matter the actual filesize - // ftell() returns 0 if seeking to the end is beyond the range of unsigned integer - fseek($fp, 0, SEEK_END); - if ((($this->info['filesize'] != 0) && (ftell($fp) == 0)) || - ($this->info['filesize'] < 0) || - (ftell($fp) < 0)) { - $real_filesize = false; - if (GETID3_OS_ISWINDOWS) { - $commandline = 'dir /-C "'.str_replace('/', DIRECTORY_SEPARATOR, $filename).'"'; - $dir_output = `$commandline`; - if (eregi('1 File\(s\)[ ]+([0-9]+) bytes', $dir_output, $matches)) { - $real_filesize = (float) $matches[1]; - } - } else { - $commandline = 'ls -o -g -G --time-style=long-iso '.escapeshellarg($filename); - $dir_output = `$commandline`; - if (eregi('([0-9]+) ([0-9]{4}-[0-9]{2}\-[0-9]{2} [0-9]{2}:[0-9]{2}) '.preg_quote($filename).'$', $dir_output, $matches)) { - $real_filesize = (float) $matches[1]; - } - } - if ($real_filesize === false) { - unset($this->info['filesize']); - fclose($fp); - return $this->error('File is most likely larger than 2GB and is not supported by PHP'); - } elseif ($real_filesize < pow(2, 31)) { - unset($this->info['filesize']); - fclose($fp); - return $this->error('PHP seems to think the file is larger than 2GB, but filesystem reports it as '.number_format($real_filesize, 3).'GB, please report to info@getid3.org'); - } - $this->info['filesize'] = $real_filesize; - $this->error('File is larger than 2GB (filesystem reports it as '.number_format($real_filesize, 3).'GB) and is not properly supported by PHP.'); - } - } - - // set more parameters - $this->info['avdataoffset'] = 0; - $this->info['avdataend'] = $this->info['filesize']; - $this->info['fileformat'] = ''; // filled in later - $this->info['audio']['dataformat'] = ''; // filled in later, unset if not used - $this->info['video']['dataformat'] = ''; // filled in later, unset if not used - $this->info['tags'] = array(); // filled in later, unset if not used - $this->info['error'] = array(); // filled in later, unset if not used - $this->info['warning'] = array(); // filled in later, unset if not used - $this->info['comments'] = array(); // filled in later, unset if not used - $this->info['encoding'] = $this->encoding; // required by id3v2 and iso modules - can be unset at the end if desired - - // set redundant parameters - might be needed in some include file - $this->info['filename'] = basename($filename); - $this->info['filepath'] = str_replace('\\', '/', realpath(dirname($filename))); - $this->info['filenamepath'] = $this->info['filepath'].'/'.$this->info['filename']; - - - // handle ID3v2 tag - done first - already at beginning of file - // ID3v2 detection (even if not parsing) is always done otherwise fileformat is much harder to detect - if ($this->option_tag_id3v2) { - - $GETID3_ERRORARRAY = &$this->info['warning']; - if (getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.tag.id3v2.php', __FILE__, false)) { - $tag = new getid3_id3v2($fp, $this->info); - unset($tag); - } - - } else { - - fseek($fp, 0, SEEK_SET); - $header = fread($fp, 10); - if (substr($header, 0, 3) == 'ID3' && strlen($header) == 10) { - $this->info['id3v2']['header'] = true; - $this->info['id3v2']['majorversion'] = ord($header{3}); - $this->info['id3v2']['minorversion'] = ord($header{4}); - $this->info['id3v2']['headerlength'] = getid3_lib::BigEndian2Int(substr($header, 6, 4), 1) + 10; // length of ID3v2 tag in 10-byte header doesn't include 10-byte header length - - $this->info['id3v2']['tag_offset_start'] = 0; - $this->info['id3v2']['tag_offset_end'] = $this->info['id3v2']['tag_offset_start'] + $this->info['id3v2']['headerlength']; - $this->info['avdataoffset'] = $this->info['id3v2']['tag_offset_end']; - } - - } - - - // handle ID3v1 tag - if ($this->option_tag_id3v1) { - if (!@include_once(GETID3_INCLUDEPATH.'module.tag.id3v1.php')) { - return $this->error('module.tag.id3v1.php is missing - you may disable option_tag_id3v1.'); - } - $tag = new getid3_id3v1($fp, $this->info); - unset($tag); - } - - // handle APE tag - if ($this->option_tag_apetag) { - if (!@include_once(GETID3_INCLUDEPATH.'module.tag.apetag.php')) { - return $this->error('module.tag.apetag.php is missing - you may disable option_tag_apetag.'); - } - $tag = new getid3_apetag($fp, $this->info); - unset($tag); - } - - // handle lyrics3 tag - if ($this->option_tag_lyrics3) { - if (!@include_once(GETID3_INCLUDEPATH.'module.tag.lyrics3.php')) { - return $this->error('module.tag.lyrics3.php is missing - you may disable option_tag_lyrics3.'); - } - $tag = new getid3_lyrics3($fp, $this->info); - unset($tag); - } - - // read 32 kb file data - fseek($fp, $this->info['avdataoffset'], SEEK_SET); - $formattest = fread($fp, 32774); - - // determine format - $determined_format = $this->GetFileFormat($formattest, $filename); - - // unable to determine file format - if (!$determined_format) { - fclose($fp); - return $this->error('unable to determine file format'); - } - - // check for illegal ID3 tags - if (isset($determined_format['fail_id3']) && (in_array('id3v1', $this->info['tags']) || in_array('id3v2', $this->info['tags']))) { - if ($determined_format['fail_id3'] === 'ERROR') { - fclose($fp); - return $this->error('ID3 tags not allowed on this file type.'); - } elseif ($determined_format['fail_id3'] === 'WARNING') { - $this->info['warning'][] = 'ID3 tags not allowed on this file type.'; - } - } - - // check for illegal APE tags - if (isset($determined_format['fail_ape']) && in_array('ape', $this->info['tags'])) { - if ($determined_format['fail_ape'] === 'ERROR') { - fclose($fp); - return $this->error('APE tags not allowed on this file type.'); - } elseif ($determined_format['fail_ape'] === 'WARNING') { - $this->info['warning'][] = 'APE tags not allowed on this file type.'; - } - } - - // set mime type - $this->info['mime_type'] = $determined_format['mime_type']; - - // supported format signature pattern detected, but module deleted - if (!file_exists(GETID3_INCLUDEPATH.$determined_format['include'])) { - fclose($fp); - return $this->error('Format not supported, module "'.$determined_format['include'].'" was removed.'); - } - - // module requires iconv support - if (!function_exists('iconv') && @$determined_format['iconv_req']) { - return $this->error('iconv support is required for this module ('.$determined_format['include'].').'); - } - - // include module - include_once(GETID3_INCLUDEPATH.$determined_format['include']); - - // instantiate module class - $class_name = 'getid3_'.$determined_format['module']; - if (!class_exists($class_name)) { - return $this->error('Format not supported, module "'.$determined_format['include'].'" is corrupt.'); - } - if (isset($determined_format['option'])) { - $class = new $class_name($fp, $this->info, $determined_format['option']); - } else { - $class = new $class_name($fp, $this->info); - } - unset($class); - - // close file - fclose($fp); - - // process all tags - copy to 'tags' and convert charsets - if ($this->option_tags_process) { - $this->HandleAllTags(); - } - - // perform more calculations - if ($this->option_extra_info) { - $this->ChannelsBitratePlaytimeCalculations(); - $this->CalculateCompressionRatioVideo(); - $this->CalculateCompressionRatioAudio(); - $this->CalculateReplayGain(); - $this->ProcessAudioStreams(); - } - - // get the MD5 sum of the audio/video portion of the file - without ID3/APE/Lyrics3/etc header/footer tags - if ($this->option_md5_data) { - // do not cald md5_data if md5_data_source is present - set by flac only - future MPC/SV8 too - if (!$this->option_md5_data_source || empty($this->info['md5_data_source'])) { - $this->getHashdata('md5'); - } - } - - // get the SHA1 sum of the audio/video portion of the file - without ID3/APE/Lyrics3/etc header/footer tags - if ($this->option_sha1_data) { - $this->getHashdata('sha1'); - } - - // remove undesired keys - $this->CleanUp(); - - // restore magic_quotes_runtime setting - set_magic_quotes_runtime($old_magic_quotes_runtime); - - // return info array - return $this->info; - } - - - // private: error handling - function error($message) { - - $this->CleanUp(); - - $this->info['error'][] = $message; - return $this->info; - } - - - // private: warning handling - function warning($message) { - $this->info['warning'][] = $message; - return true; - } - - - // private: CleanUp - function CleanUp() { - - // remove possible empty keys - $AVpossibleEmptyKeys = array('dataformat', 'bits_per_sample', 'encoder_options', 'streams', 'bitrate'); - foreach ($AVpossibleEmptyKeys as $dummy => $key) { - if (empty($this->info['audio'][$key]) && isset($this->info['audio'][$key])) { - unset($this->info['audio'][$key]); - } - if (empty($this->info['video'][$key]) && isset($this->info['video'][$key])) { - unset($this->info['video'][$key]); - } - } - - // remove empty root keys - if (!empty($this->info)) { - foreach ($this->info as $key => $value) { - if (empty($this->info[$key]) && ($this->info[$key] !== 0) && ($this->info[$key] !== '0')) { - unset($this->info[$key]); - } - } - } - - // remove meaningless entries from unknown-format files - if (empty($this->info['fileformat'])) { - if (isset($this->info['avdataoffset'])) { - unset($this->info['avdataoffset']); - } - if (isset($this->info['avdataend'])) { - unset($this->info['avdataend']); - } - } - } - - - // return array containing information about all supported formats - function GetFileFormatArray() { - static $format_info = array(); - if (empty($format_info)) { - $format_info = array( - - // Audio formats - - // AC-3 - audio - Dolby AC-3 / Dolby Digital - 'ac3' => array( - 'pattern' => '^\x0B\x77', - 'group' => 'audio', - 'module' => 'ac3', - 'mime_type' => 'audio/ac3', - ), - - // AAC - audio - Advanced Audio Coding (AAC) - ADIF format - 'adif' => array( - 'pattern' => '^ADIF', - 'group' => 'audio', - 'module' => 'aac', - 'option' => 'adif', - 'mime_type' => 'application/octet-stream', - 'fail_ape' => 'WARNING', - ), - - - // AAC - audio - Advanced Audio Coding (AAC) - ADTS format (very similar to MP3) - 'adts' => array( - 'pattern' => '^\xFF[\xF0-\xF1\xF8-\xF9]', - 'group' => 'audio', - 'module' => 'aac', - 'option' => 'adts', - 'mime_type' => 'application/octet-stream', - 'fail_ape' => 'WARNING', - ), - - - // AU - audio - NeXT/Sun AUdio (AU) - 'au' => array( - 'pattern' => '^\.snd', - 'group' => 'audio', - 'module' => 'au', - 'mime_type' => 'audio/basic', - ), - - // AVR - audio - Audio Visual Research - 'avr' => array( - 'pattern' => '^2BIT', - 'group' => 'audio', - 'module' => 'avr', - 'mime_type' => 'application/octet-stream', - ), - - // BONK - audio - Bonk v0.9+ - 'bonk' => array( - 'pattern' => '^\x00(BONK|INFO|META| ID3)', - 'group' => 'audio', - 'module' => 'bonk', - 'mime_type' => 'audio/xmms-bonk', - ), - - // DSS - audio - Digital Speech Standard - 'dss' => array( - 'pattern' => '^[\x02]dss', - 'group' => 'audio', - 'module' => 'dss', - 'mime_type' => 'application/octet-stream', - ), - - // DTS - audio - Dolby Theatre System - 'dts' => array( - 'pattern' => '^\x7F\xFE\x80\x01', - 'group' => 'audio', - 'module' => 'dts', - 'mime_type' => 'audio/dts', - ), - - // FLAC - audio - Free Lossless Audio Codec - 'flac' => array( - 'pattern' => '^fLaC', - 'group' => 'audio', - 'module' => 'flac', - 'mime_type' => 'audio/x-flac', - ), - - // LA - audio - Lossless Audio (LA) - 'la' => array( - 'pattern' => '^LA0[2-4]', - 'group' => 'audio', - 'module' => 'la', - 'mime_type' => 'application/octet-stream', - ), - - // LPAC - audio - Lossless Predictive Audio Compression (LPAC) - 'lpac' => array( - 'pattern' => '^LPAC', - 'group' => 'audio', - 'module' => 'lpac', - 'mime_type' => 'application/octet-stream', - ), - - // MIDI - audio - MIDI (Musical Instrument Digital Interface) - 'midi' => array( - 'pattern' => '^MThd', - 'group' => 'audio', - 'module' => 'midi', - 'mime_type' => 'audio/midi', - ), - - // MAC - audio - Monkey's Audio Compressor - 'mac' => array( - 'pattern' => '^MAC ', - 'group' => 'audio', - 'module' => 'monkey', - 'mime_type' => 'application/octet-stream', - ), - -// has been known to produce false matches in random files (e.g. JPEGs), leave out until more precise matching available -// // MOD - audio - MODule (assorted sub-formats) -// 'mod' => array( -// 'pattern' => '^.{1080}(M\\.K\\.|M!K!|FLT4|FLT8|[5-9]CHN|[1-3][0-9]CH)', -// 'group' => 'audio', -// 'module' => 'mod', -// 'option' => 'mod', -// 'mime_type' => 'audio/mod', -// ), - - // MOD - audio - MODule (Impulse Tracker) - 'it' => array( - 'pattern' => '^IMPM', - 'group' => 'audio', - 'module' => 'mod', - 'option' => 'it', - 'mime_type' => 'audio/it', - ), - - // MOD - audio - MODule (eXtended Module, various sub-formats) - 'xm' => array( - 'pattern' => '^Extended Module', - 'group' => 'audio', - 'module' => 'mod', - 'option' => 'xm', - 'mime_type' => 'audio/xm', - ), - - // MOD - audio - MODule (ScreamTracker) - 's3m' => array( - 'pattern' => '^.{44}SCRM', - 'group' => 'audio', - 'module' => 'mod', - 'option' => 's3m', - 'mime_type' => 'audio/s3m', - ), - - // MPC - audio - Musepack / MPEGplus - 'mpc' => array( - 'pattern' => '^(MPCK|MP\+|[\x00\x01\x10\x11\x40\x41\x50\x51\x80\x81\x90\x91\xC0\xC1\xD0\xD1][\x20-37][\x00\x20\x40\x60\x80\xA0\xC0\xE0])', - 'group' => 'audio', - 'module' => 'mpc', - 'mime_type' => 'audio/x-musepack', - ), - - // MP3 - audio - MPEG-audio Layer 3 (very similar to AAC-ADTS) - 'mp3' => array( - 'pattern' => '^\xFF[\xE2-\xE7\xF2-\xF7\xFA-\xFF][\x00-\xEB]', - 'group' => 'audio', - 'module' => 'mp3', - 'mime_type' => 'audio/mpeg', - ), - - // OFR - audio - OptimFROG - 'ofr' => array( - 'pattern' => '^(\*RIFF|OFR)', - 'group' => 'audio', - 'module' => 'optimfrog', - 'mime_type' => 'application/octet-stream', - ), - - // RKAU - audio - RKive AUdio compressor - 'rkau' => array( - 'pattern' => '^RKA', - 'group' => 'audio', - 'module' => 'rkau', - 'mime_type' => 'application/octet-stream', - ), - - // SHN - audio - Shorten - 'shn' => array( - 'pattern' => '^ajkg', - 'group' => 'audio', - 'module' => 'shorten', - 'mime_type' => 'audio/xmms-shn', - 'fail_id3' => 'ERROR', - 'fail_ape' => 'ERROR', - ), - - // TTA - audio - TTA Lossless Audio Compressor (http://tta.corecodec.org) - 'tta' => array( - 'pattern' => '^TTA', // could also be '^TTA(\x01|\x02|\x03|2|1)' - 'group' => 'audio', - 'module' => 'tta', - 'mime_type' => 'application/octet-stream', - ), - - // VOC - audio - Creative Voice (VOC) - 'voc' => array( - 'pattern' => '^Creative Voice File', - 'group' => 'audio', - 'module' => 'voc', - 'mime_type' => 'audio/voc', - ), - - // VQF - audio - transform-domain weighted interleave Vector Quantization Format (VQF) - 'vqf' => array( - 'pattern' => '^TWIN', - 'group' => 'audio', - 'module' => 'vqf', - 'mime_type' => 'application/octet-stream', - ), - - // WV - audio - WavPack (v4.0+) - 'wv' => array( - 'pattern' => '^wvpk', - 'group' => 'audio', - 'module' => 'wavpack', - 'mime_type' => 'application/octet-stream', - ), - - - // Audio-Video formats - - // ASF - audio/video - Advanced Streaming Format, Windows Media Video, Windows Media Audio - 'asf' => array( - 'pattern' => '^\x30\x26\xB2\x75\x8E\x66\xCF\x11\xA6\xD9\x00\xAA\x00\x62\xCE\x6C', - 'group' => 'audio-video', - 'module' => 'asf', - 'mime_type' => 'video/x-ms-asf', - 'iconv_req' => false, - ), - - // BINK - audio/video - Bink / Smacker - 'bink' => array( - 'pattern' => '^(BIK|SMK)', - 'group' => 'audio-video', - 'module' => 'bink', - 'mime_type' => 'application/octet-stream', - ), - - // FLV - audio/video - FLash Video - 'flv' => array( - 'pattern' => '^FLV\x01', - 'group' => 'audio-video', - 'module' => 'flv', - 'mime_type' => 'video/x-flv', - ), - - // MKAV - audio/video - Mastroka - 'matroska' => array( - 'pattern' => '^\x1A\x45\xDF\xA3', - 'group' => 'audio-video', - 'module' => 'matroska', - 'mime_type' => 'video/x-matroska', // may also be audio/x-matroska - ), - - // MPEG - audio/video - MPEG (Moving Pictures Experts Group) - 'mpeg' => array( - 'pattern' => '^\x00\x00\x01(\xBA|\xB3)', - 'group' => 'audio-video', - 'module' => 'mpeg', - 'mime_type' => 'video/mpeg', - ), - - // NSV - audio/video - Nullsoft Streaming Video (NSV) - 'nsv' => array( - 'pattern' => '^NSV[sf]', - 'group' => 'audio-video', - 'module' => 'nsv', - 'mime_type' => 'application/octet-stream', - ), - - // Ogg - audio/video - Ogg (Ogg-Vorbis, Ogg-FLAC, Speex, Ogg-Theora(*), Ogg-Tarkin(*)) - 'ogg' => array( - 'pattern' => '^OggS', - 'group' => 'audio', - 'module' => 'ogg', - 'mime_type' => 'application/ogg', - 'fail_id3' => 'WARNING', - 'fail_ape' => 'WARNING', - ), - - // QT - audio/video - Quicktime - 'quicktime' => array( - 'pattern' => '^.{4}(cmov|free|ftyp|mdat|moov|pnot|skip|wide)', - 'group' => 'audio-video', - 'module' => 'quicktime', - 'mime_type' => 'video/quicktime', - ), - - // RIFF - audio/video - Resource Interchange File Format (RIFF) / WAV / AVI / CD-audio / SDSS = renamed variant used by SmartSound QuickTracks (www.smartsound.com) / FORM = Audio Interchange File Format (AIFF) - 'riff' => array( - 'pattern' => '^(RIFF|SDSS|FORM)', - 'group' => 'audio-video', - 'module' => 'riff', - 'mime_type' => 'audio/x-wave', - 'fail_ape' => 'WARNING', - ), - - // Real - audio/video - RealAudio, RealVideo - 'real' => array( - 'pattern' => '^(\\.RMF|\\.ra)', - 'group' => 'audio-video', - 'module' => 'real', - 'mime_type' => 'audio/x-realaudio', - ), - - // SWF - audio/video - ShockWave Flash - 'swf' => array( - 'pattern' => '^(F|C)WS', - 'group' => 'audio-video', - 'module' => 'swf', - 'mime_type' => 'application/x-shockwave-flash', - ), - - - // Still-Image formats - - // BMP - still image - Bitmap (Windows, OS/2; uncompressed, RLE8, RLE4) - 'bmp' => array( - 'pattern' => '^BM', - 'group' => 'graphic', - 'module' => 'bmp', - 'mime_type' => 'image/bmp', - 'fail_id3' => 'ERROR', - 'fail_ape' => 'ERROR', - ), - - // GIF - still image - Graphics Interchange Format - 'gif' => array( - 'pattern' => '^GIF', - 'group' => 'graphic', - 'module' => 'gif', - 'mime_type' => 'image/gif', - 'fail_id3' => 'ERROR', - 'fail_ape' => 'ERROR', - ), - - // JPEG - still image - Joint Photographic Experts Group (JPEG) - 'jpg' => array( - 'pattern' => '^\xFF\xD8\xFF', - 'group' => 'graphic', - 'module' => 'jpg', - 'mime_type' => 'image/jpeg', - 'fail_id3' => 'ERROR', - 'fail_ape' => 'ERROR', - ), - - // PCD - still image - Kodak Photo CD - 'pcd' => array( - 'pattern' => '^.{2048}PCD_IPI\x00', - 'group' => 'graphic', - 'module' => 'pcd', - 'mime_type' => 'image/x-photo-cd', - 'fail_id3' => 'ERROR', - 'fail_ape' => 'ERROR', - ), - - - // PNG - still image - Portable Network Graphics (PNG) - 'png' => array( - 'pattern' => '^\x89\x50\x4E\x47\x0D\x0A\x1A\x0A', - 'group' => 'graphic', - 'module' => 'png', - 'mime_type' => 'image/png', - 'fail_id3' => 'ERROR', - 'fail_ape' => 'ERROR', - ), - - - // SVG - still image - Scalable Vector Graphics (SVG) - 'svg' => array( - 'pattern' => '<!DOCTYPE svg PUBLIC ', - 'group' => 'graphic', - 'module' => 'svg', - 'mime_type' => 'image/svg+xml', - 'fail_id3' => 'ERROR', - 'fail_ape' => 'ERROR', - ), - - - // TIFF - still image - Tagged Information File Format (TIFF) - 'tiff' => array( - 'pattern' => '^(II\x2A\x00|MM\x00\x2A)', - 'group' => 'graphic', - 'module' => 'tiff', - 'mime_type' => 'image/tiff', - 'fail_id3' => 'ERROR', - 'fail_ape' => 'ERROR', - ), - - - // Data formats - - // ISO - data - International Standards Organization (ISO) CD-ROM Image - 'iso' => array( - 'pattern' => '^.{32769}CD001', - 'group' => 'misc', - 'module' => 'iso', - 'mime_type' => 'application/octet-stream', - 'fail_id3' => 'ERROR', - 'fail_ape' => 'ERROR', - 'iconv_req' => false, - ), - - // RAR - data - RAR compressed data - 'rar' => array( - 'pattern' => '^Rar\!', - 'group' => 'archive', - 'module' => 'rar', - 'mime_type' => 'application/octet-stream', - 'fail_id3' => 'ERROR', - 'fail_ape' => 'ERROR', - ), - - // SZIP - audio/data - SZIP compressed data - 'szip' => array( - 'pattern' => '^SZ\x0A\x04', - 'group' => 'archive', - 'module' => 'szip', - 'mime_type' => 'application/octet-stream', - 'fail_id3' => 'ERROR', - 'fail_ape' => 'ERROR', - ), - - // TAR - data - TAR compressed data - 'tar' => array( - 'pattern' => '^.{100}[0-9\x20]{7}\x00[0-9\x20]{7}\x00[0-9\x20]{7}\x00[0-9\x20\x00]{12}[0-9\x20\x00]{12}', - 'group' => 'archive', - 'module' => 'tar', - 'mime_type' => 'application/x-tar', - 'fail_id3' => 'ERROR', - 'fail_ape' => 'ERROR', - ), - - // GZIP - data - GZIP compressed data - 'gz' => array( - 'pattern' => '^\x1F\x8B\x08', - 'group' => 'archive', - 'module' => 'gzip', - 'mime_type' => 'application/x-gzip', - 'fail_id3' => 'ERROR', - 'fail_ape' => 'ERROR', - ), - - // ZIP - data - ZIP compressed data - 'zip' => array( - 'pattern' => '^PK\x03\x04', - 'group' => 'archive', - 'module' => 'zip', - 'mime_type' => 'application/zip', - 'fail_id3' => 'ERROR', - 'fail_ape' => 'ERROR', - ), - - - // Misc other formats - - // PAR2 - data - Parity Volume Set Specification 2.0 - 'par2' => array ( - 'pattern' => '^PAR2\x00PKT', - 'group' => 'misc', - 'module' => 'par2', - 'mime_type' => 'application/octet-stream', - 'fail_id3' => 'ERROR', - 'fail_ape' => 'ERROR', - ), - - // PDF - data - Portable Document Format - 'pdf' => array( - 'pattern' => '^\x25PDF', - 'group' => 'misc', - 'module' => 'pdf', - 'mime_type' => 'application/pdf', - 'fail_id3' => 'ERROR', - 'fail_ape' => 'ERROR', - ), - - // MSOFFICE - data - ZIP compressed data - 'msoffice' => array( - 'pattern' => '^\xD0\xCF\x11\xE0', // D0CF11E == DOCFILE == Microsoft Office Document - 'group' => 'misc', - 'module' => 'msoffice', - 'mime_type' => 'application/octet-stream', - 'fail_id3' => 'ERROR', - 'fail_ape' => 'ERROR', - ), - ); - } - - return $format_info; - } - - - - function GetFileFormat(&$filedata, $filename='') { - // this function will determine the format of a file based on usually - // the first 2-4 bytes of the file (8 bytes for PNG, 16 bytes for JPG, - // and in the case of ISO CD image, 6 bytes offset 32kb from the start - // of the file). - - // Identify file format - loop through $format_info and detect with reg expr - foreach ($this->GetFileFormatArray() as $format_name => $info) { - // Using preg_match() instead of ereg() - much faster - // The /s switch on preg_match() forces preg_match() NOT to treat - // newline (0x0A) characters as special chars but do a binary match - if (preg_match('/'.$info['pattern'].'/s', $filedata)) { - $info['include'] = 'module.'.$info['group'].'.'.$info['module'].'.php'; - return $info; - } - } - - - if (preg_match('/\.mp[123a]$/i', $filename)) { - // Too many mp3 encoders on the market put gabage in front of mpeg files - // use assume format on these if format detection failed - $GetFileFormatArray = $this->GetFileFormatArray(); - $info = $GetFileFormatArray['mp3']; - $info['include'] = 'module.'.$info['group'].'.'.$info['module'].'.php'; - return $info; - } - - return false; - } - - - // converts array to $encoding charset from $this->encoding - function CharConvert(&$array, $encoding) { - - // identical encoding - end here - if ($encoding == $this->encoding) { - return; - } - - // loop thru array - foreach ($array as $key => $value) { - - // go recursive - if (is_array($value)) { - $this->CharConvert($array[$key], $encoding); - } - - // convert string - elseif (is_string($value)) { - $array[$key] = trim(getid3_lib::iconv_fallback($encoding, $this->encoding, $value)); - } - } - } - - - function HandleAllTags() { - - // key name => array (tag name, character encoding) - static $tags; - if (empty($tags)) { - $tags = array( - 'asf' => array('asf' , 'UTF-16LE'), - 'midi' => array('midi' , 'ISO-8859-1'), - 'nsv' => array('nsv' , 'ISO-8859-1'), - 'ogg' => array('vorbiscomment' , 'UTF-8'), - 'png' => array('png' , 'UTF-8'), - 'tiff' => array('tiff' , 'ISO-8859-1'), - 'quicktime' => array('quicktime' , 'ISO-8859-1'), - 'real' => array('real' , 'ISO-8859-1'), - 'vqf' => array('vqf' , 'ISO-8859-1'), - 'zip' => array('zip' , 'ISO-8859-1'), - 'riff' => array('riff' , 'ISO-8859-1'), - 'lyrics3' => array('lyrics3' , 'ISO-8859-1'), - 'id3v1' => array('id3v1' , $this->encoding_id3v1), - 'id3v2' => array('id3v2' , 'UTF-8'), // not according to the specs (every frame can have a different encoding), but getID3() force-converts all encodings to UTF-8 - 'ape' => array('ape' , 'UTF-8') - ); - } - - // loop thru comments array - foreach ($tags as $comment_name => $tagname_encoding_array) { - list($tag_name, $encoding) = $tagname_encoding_array; - - // fill in default encoding type if not already present - if (isset($this->info[$comment_name]) && !isset($this->info[$comment_name]['encoding'])) { - $this->info[$comment_name]['encoding'] = $encoding; - } - - // copy comments if key name set - if (!empty($this->info[$comment_name]['comments'])) { - - foreach ($this->info[$comment_name]['comments'] as $tag_key => $valuearray) { - foreach ($valuearray as $key => $value) { - if (strlen(trim($value)) > 0) { - $this->info['tags'][trim($tag_name)][trim($tag_key)][] = $value; // do not trim!! Unicode characters will get mangled if trailing nulls are removed! - } - } - } - - if (!isset($this->info['tags'][$tag_name])) { - // comments are set but contain nothing but empty strings, so skip - continue; - } - - if ($this->option_tags_html) { - foreach ($this->info['tags'][$tag_name] as $tag_key => $valuearray) { - foreach ($valuearray as $key => $value) { - if (is_string($value)) { - //$this->info['tags_html'][$tag_name][$tag_key][$key] = getid3_lib::MultiByteCharString2HTML($value, $encoding); - $this->info['tags_html'][$tag_name][$tag_key][$key] = str_replace('�', '', getid3_lib::MultiByteCharString2HTML($value, $encoding)); - } else { - $this->info['tags_html'][$tag_name][$tag_key][$key] = $value; - } - } - } - } - - $this->CharConvert($this->info['tags'][$tag_name], $encoding); // only copy gets converted! - } - - } - return true; - } - - - function getHashdata($algorithm) { - switch ($algorithm) { - case 'md5': - case 'sha1': - break; - - default: - return $this->error('bad algorithm "'.$algorithm.'" in getHashdata()'); - break; - } - - if ((@$this->info['fileformat'] == 'ogg') && (@$this->info['audio']['dataformat'] == 'vorbis')) { - - // We cannot get an identical md5_data value for Ogg files where the comments - // span more than 1 Ogg page (compared to the same audio data with smaller - // comments) using the normal getID3() method of MD5'ing the data between the - // end of the comments and the end of the file (minus any trailing tags), - // because the page sequence numbers of the pages that the audio data is on - // do not match. Under normal circumstances, where comments are smaller than - // the nominal 4-8kB page size, then this is not a problem, but if there are - // very large comments, the only way around it is to strip off the comment - // tags with vorbiscomment and MD5 that file. - // This procedure must be applied to ALL Ogg files, not just the ones with - // comments larger than 1 page, because the below method simply MD5's the - // whole file with the comments stripped, not just the portion after the - // comments block (which is the standard getID3() method. - - // The above-mentioned problem of comments spanning multiple pages and changing - // page sequence numbers likely happens for OggSpeex and OggFLAC as well, but - // currently vorbiscomment only works on OggVorbis files. - - if ((bool) ini_get('safe_mode')) { - - $this->info['warning'][] = 'Failed making system call to vorbiscomment.exe - '.$algorithm.'_data is incorrect - error returned: PHP running in Safe Mode (backtick operator not available)'; - $this->info[$algorithm.'_data'] = false; - - } else { - - // Prevent user from aborting script - $old_abort = ignore_user_abort(true); - - // Create empty file - $empty = tempnam('*', 'getID3'); - touch($empty); - - - // Use vorbiscomment to make temp file without comments - $temp = tempnam('*', 'getID3'); - $file = $this->info['filenamepath']; - - if (GETID3_OS_ISWINDOWS) { - - if (file_exists(GETID3_HELPERAPPSDIR.'vorbiscomment.exe')) { - - $commandline = '"'.GETID3_HELPERAPPSDIR.'vorbiscomment.exe" -w -c "'.$empty.'" "'.$file.'" "'.$temp.'"'; - $VorbisCommentError = `$commandline`; - - } else { - - $VorbisCommentError = 'vorbiscomment.exe not found in '.GETID3_HELPERAPPSDIR; - - } - - } else { - - $commandline = 'vorbiscomment -w -c "'.$empty.'" "'.$file.'" "'.$temp.'" 2>&1'; - $commandline = 'vorbiscomment -w -c '.escapeshellarg($empty).' '.escapeshellarg($file).' '.escapeshellarg($temp).' 2>&1'; - $VorbisCommentError = `$commandline`; - - } - - if (!empty($VorbisCommentError)) { - - $this->info['warning'][] = 'Failed making system call to vorbiscomment(.exe) - '.$algorithm.'_data will be incorrect. If vorbiscomment is unavailable, please download from http://www.vorbis.com/download.psp and put in the getID3() directory. Error returned: '.$VorbisCommentError; - $this->info[$algorithm.'_data'] = false; - - } else { - - // Get hash of newly created file - switch ($algorithm) { - case 'md5': - $this->info[$algorithm.'_data'] = getid3_lib::md5_file($temp); - break; - - case 'sha1': - $this->info[$algorithm.'_data'] = getid3_lib::sha1_file($temp); - break; - } - } - - // Clean up - unlink($empty); - unlink($temp); - - // Reset abort setting - ignore_user_abort($old_abort); - - } - - } else { - - if (!empty($this->info['avdataoffset']) || (isset($this->info['avdataend']) && ($this->info['avdataend'] < $this->info['filesize']))) { - - // get hash from part of file - $this->info[$algorithm.'_data'] = getid3_lib::hash_data($this->info['filenamepath'], $this->info['avdataoffset'], $this->info['avdataend'], $algorithm); - - } else { - - // get hash from whole file - switch ($algorithm) { - case 'md5': - $this->info[$algorithm.'_data'] = getid3_lib::md5_file($this->info['filenamepath']); - break; - - case 'sha1': - $this->info[$algorithm.'_data'] = getid3_lib::sha1_file($this->info['filenamepath']); - break; - } - } - - } - return true; - } - - - function ChannelsBitratePlaytimeCalculations() { - - // set channelmode on audio - if (@$this->info['audio']['channels'] == '1') { - $this->info['audio']['channelmode'] = 'mono'; - } elseif (@$this->info['audio']['channels'] == '2') { - $this->info['audio']['channelmode'] = 'stereo'; - } - - // Calculate combined bitrate - audio + video - $CombinedBitrate = 0; - $CombinedBitrate += (isset($this->info['audio']['bitrate']) ? $this->info['audio']['bitrate'] : 0); - $CombinedBitrate += (isset($this->info['video']['bitrate']) ? $this->info['video']['bitrate'] : 0); - if (($CombinedBitrate > 0) && empty($this->info['bitrate'])) { - $this->info['bitrate'] = $CombinedBitrate; - } - //if ((isset($this->info['video']) && !isset($this->info['video']['bitrate'])) || (isset($this->info['audio']) && !isset($this->info['audio']['bitrate']))) { - // // for example, VBR MPEG video files cannot determine video bitrate: - // // should not set overall bitrate and playtime from audio bitrate only - // unset($this->info['bitrate']); - //} - - // video bitrate undetermined, but calculable - if (isset($this->info['video']['dataformat']) && $this->info['video']['dataformat'] && (!isset($this->info['video']['bitrate']) || ($this->info['video']['bitrate'] == 0))) { - // if video bitrate not set - if (isset($this->info['audio']['bitrate']) && ($this->info['audio']['bitrate'] > 0) && ($this->info['audio']['bitrate'] == $this->info['bitrate'])) { - // AND if audio bitrate is set to same as overall bitrate - if (isset($this->info['playtime_seconds']) && ($this->info['playtime_seconds'] > 0)) { - // AND if playtime is set - if (isset($this->info['avdataend']) && isset($this->info['avdataoffset'])) { - // AND if AV data offset start/end is known - // THEN we can calculate the video bitrate - $this->info['bitrate'] = round((($this->info['avdataend'] - $this->info['avdataoffset']) * 8) / $this->info['playtime_seconds']); - $this->info['video']['bitrate'] = $this->info['bitrate'] - $this->info['audio']['bitrate']; - } - } - } - } - - if ((!isset($this->info['playtime_seconds']) || ($this->info['playtime_seconds'] <= 0)) && !empty($this->info['bitrate'])) { - $this->info['playtime_seconds'] = (($this->info['avdataend'] - $this->info['avdataoffset']) * 8) / $this->info['bitrate']; - } - - if (!isset($this->info['bitrate']) && !empty($this->info['playtime_seconds'])) { - $this->info['bitrate'] = (($this->info['avdataend'] - $this->info['avdataoffset']) * 8) / $this->info['playtime_seconds']; - } -//echo '<pre>'; -//var_dump($this->info['bitrate']); -//var_dump($this->info['audio']['bitrate']); -//var_dump($this->info['video']['bitrate']); -//echo '</pre>'; - if (isset($this->info['bitrate']) && empty($this->info['audio']['bitrate']) && empty($this->info['video']['bitrate'])) { - if (isset($this->info['audio']['dataformat']) && empty($this->info['video']['resolution_x'])) { - // audio only - $this->info['audio']['bitrate'] = $this->info['bitrate']; - } elseif (isset($this->info['video']['resolution_x']) && empty($this->info['audio']['dataformat'])) { - // video only - $this->info['video']['bitrate'] = $this->info['bitrate']; - } - } - - // Set playtime string - if (!empty($this->info['playtime_seconds']) && empty($this->info['playtime_string'])) { - $this->info['playtime_string'] = getid3_lib::PlaytimeString($this->info['playtime_seconds']); - } - } - - - function CalculateCompressionRatioVideo() { - if (empty($this->info['video'])) { - return false; - } - if (empty($this->info['video']['resolution_x']) || empty($this->info['video']['resolution_y'])) { - return false; - } - if (empty($this->info['video']['bits_per_sample'])) { - return false; - } - - switch ($this->info['video']['dataformat']) { - case 'bmp': - case 'gif': - case 'jpeg': - case 'jpg': - case 'png': - case 'tiff': - $FrameRate = 1; - $PlaytimeSeconds = 1; - $BitrateCompressed = $this->info['filesize'] * 8; - break; - - default: - if (!empty($this->info['video']['frame_rate'])) { - $FrameRate = $this->info['video']['frame_rate']; - } else { - return false; - } - if (!empty($this->info['playtime_seconds'])) { - $PlaytimeSeconds = $this->info['playtime_seconds']; - } else { - return false; - } - if (!empty($this->info['video']['bitrate'])) { - $BitrateCompressed = $this->info['video']['bitrate']; - } else { - return false; - } - break; - } - $BitrateUncompressed = $this->info['video']['resolution_x'] * $this->info['video']['resolution_y'] * $this->info['video']['bits_per_sample'] * $FrameRate; - - $this->info['video']['compression_ratio'] = $BitrateCompressed / $BitrateUncompressed; - return true; - } - - - function CalculateCompressionRatioAudio() { - if (empty($this->info['audio']['bitrate']) || empty($this->info['audio']['channels']) || empty($this->info['audio']['sample_rate'])) { - return false; - } - $this->info['audio']['compression_ratio'] = $this->info['audio']['bitrate'] / ($this->info['audio']['channels'] * $this->info['audio']['sample_rate'] * (!empty($this->info['audio']['bits_per_sample']) ? $this->info['audio']['bits_per_sample'] : 16)); - - if (!empty($this->info['audio']['streams'])) { - foreach ($this->info['audio']['streams'] as $streamnumber => $streamdata) { - if (!empty($streamdata['bitrate']) && !empty($streamdata['channels']) && !empty($streamdata['sample_rate'])) { - $this->info['audio']['streams'][$streamnumber]['compression_ratio'] = $streamdata['bitrate'] / ($streamdata['channels'] * $streamdata['sample_rate'] * (!empty($streamdata['bits_per_sample']) ? $streamdata['bits_per_sample'] : 16)); - } - } - } - return true; - } - - - function CalculateReplayGain() { - if (isset($this->info['replay_gain'])) { - $this->info['replay_gain']['reference_volume'] = 89; - if (isset($this->info['replay_gain']['track']['adjustment'])) { - $this->info['replay_gain']['track']['volume'] = $this->info['replay_gain']['reference_volume'] - $this->info['replay_gain']['track']['adjustment']; - } - if (isset($this->info['replay_gain']['album']['adjustment'])) { - $this->info['replay_gain']['album']['volume'] = $this->info['replay_gain']['reference_volume'] - $this->info['replay_gain']['album']['adjustment']; - } - - if (isset($this->info['replay_gain']['track']['peak'])) { - $this->info['replay_gain']['track']['max_noclip_gain'] = 0 - getid3_lib::RGADamplitude2dB($this->info['replay_gain']['track']['peak']); - } - if (isset($this->info['replay_gain']['album']['peak'])) { - $this->info['replay_gain']['album']['max_noclip_gain'] = 0 - getid3_lib::RGADamplitude2dB($this->info['replay_gain']['album']['peak']); - } - } - return true; - } - - function ProcessAudioStreams() { - if (!empty($this->info['audio']['bitrate']) || !empty($this->info['audio']['channels']) || !empty($this->info['audio']['sample_rate'])) { - if (!isset($this->info['audio']['streams'])) { - foreach ($this->info['audio'] as $key => $value) { - if ($key != 'streams') { - $this->info['audio']['streams'][0][$key] = $value; - } - } - } - } - return true; - } - - function getid3_tempnam() { - return tempnam($this->tempdir, 'gI3'); - } - -} - -?>
\ No newline at end of file diff --git a/getid3/module.archive.gzip.php b/getid3/module.archive.gzip.php deleted file mode 100644 index 7e9376f..0000000 --- a/getid3/module.archive.gzip.php +++ /dev/null @@ -1,271 +0,0 @@ -<?php -///////////////////////////////////////////////////////////////// -/// getID3() by James Heinrich <info@getid3.org> // -// available at http://getid3.sourceforge.net // -// or http://www.getid3.org // -///////////////////////////////////////////////////////////////// -// See readme.txt for more details // -///////////////////////////////////////////////////////////////// -// // -// module.archive.gzip.php // -// module for analyzing GZIP files // -// dependencies: NONE // -// /// -///////////////////////////////////////////////////////////////// -// // -// Module originally written by // -// Mike Mozolin <teddybearØmail*ru> // -// // -///////////////////////////////////////////////////////////////// - - -class getid3_gzip { - - // public: Optional file list - disable for speed. - var $option_gzip_parse_contents = false; // decode gzipped files, if possible, and parse recursively (.tar.gz for example) - - function getid3_gzip(&$fd, &$ThisFileInfo) { - $ThisFileInfo['fileformat'] = 'gzip'; - - $start_length = 10; - $unpack_header = 'a1id1/a1id2/a1cmethod/a1flags/a4mtime/a1xflags/a1os'; - //+---+---+---+---+---+---+---+---+---+---+ - //|ID1|ID2|CM |FLG| MTIME |XFL|OS | - //+---+---+---+---+---+---+---+---+---+---+ - @fseek($fd, 0); - $buffer = @fread($fd, $ThisFileInfo['filesize']); - - $arr_members = explode("\x1F\x8B\x08", $buffer); - while (true) { - $is_wrong_members = false; - $num_members = intval(count($arr_members)); - for ($i = 0; $i < $num_members; $i++) { - if (strlen($arr_members[$i]) == 0) { - continue; - } - $buf = "\x1F\x8B\x08".$arr_members[$i]; - - $attr = unpack($unpack_header, substr($buf, 0, $start_length)); - if (!$this->get_os_type(ord($attr['os']))) { - // Merge member with previous if wrong OS type - $arr_members[$i - 1] .= $buf; - $arr_members[$i] = ''; - $is_wrong_members = true; - continue; - } - } - if (!$is_wrong_members) { - break; - } - } - - $ThisFileInfo['gzip']['files'] = array(); - - $fpointer = 0; - $idx = 0; - for ($i = 0; $i < $num_members; $i++) { - if (strlen($arr_members[$i]) == 0) { - continue; - } - $thisThisFileInfo = &$ThisFileInfo['gzip']['member_header'][++$idx]; - - $buff = "\x1F\x8B\x08".$arr_members[$i]; - - $attr = unpack($unpack_header, substr($buff, 0, $start_length)); - $thisThisFileInfo['filemtime'] = getid3_lib::LittleEndian2Int($attr['mtime']); - $thisThisFileInfo['raw']['id1'] = ord($attr['cmethod']); - $thisThisFileInfo['raw']['id2'] = ord($attr['cmethod']); - $thisThisFileInfo['raw']['cmethod'] = ord($attr['cmethod']); - $thisThisFileInfo['raw']['os'] = ord($attr['os']); - $thisThisFileInfo['raw']['xflags'] = ord($attr['xflags']); - $thisThisFileInfo['raw']['flags'] = ord($attr['flags']); - - $thisThisFileInfo['flags']['crc16'] = (bool) ($thisThisFileInfo['raw']['flags'] & 0x02); - $thisThisFileInfo['flags']['extra'] = (bool) ($thisThisFileInfo['raw']['flags'] & 0x04); - $thisThisFileInfo['flags']['filename'] = (bool) ($thisThisFileInfo['raw']['flags'] & 0x08); - $thisThisFileInfo['flags']['comment'] = (bool) ($thisThisFileInfo['raw']['flags'] & 0x10); - - $thisThisFileInfo['compression'] = $this->get_xflag_type($thisThisFileInfo['raw']['xflags']); - - $thisThisFileInfo['os'] = $this->get_os_type($thisThisFileInfo['raw']['os']); - if (!$thisThisFileInfo['os']) { - $ThisFileInfo['error'][] = 'Read error on gzip file'; - return false; - } - - $fpointer = 10; - $arr_xsubfield = array(); - // bit 2 - FLG.FEXTRA - //+---+---+=================================+ - //| XLEN |...XLEN bytes of "extra field"...| - //+---+---+=================================+ - if ($thisThisFileInfo['flags']['extra']) { - $w_xlen = substr($buff, $fpointer, 2); - $xlen = getid3_lib::LittleEndian2Int($w_xlen); - $fpointer += 2; - - $thisThisFileInfo['raw']['xfield'] = substr($buff, $fpointer, $xlen); - // Extra SubFields - //+---+---+---+---+==================================+ - //|SI1|SI2| LEN |... LEN bytes of subfield data ...| - //+---+---+---+---+==================================+ - $idx = 0; - while (true) { - if ($idx >= $xlen) { - break; - } - $si1 = ord(substr($buff, $fpointer + $idx++, 1)); - $si2 = ord(substr($buff, $fpointer + $idx++, 1)); - if (($si1 == 0x41) && ($si2 == 0x70)) { - $w_xsublen = substr($buff, $fpointer + $idx, 2); - $xsublen = getid3_lib::LittleEndian2Int($w_xsublen); - $idx += 2; - $arr_xsubfield[] = substr($buff, $fpointer + $idx, $xsublen); - $idx += $xsublen; - } else { - break; - } - } - $fpointer += $xlen; - } - // bit 3 - FLG.FNAME - //+=========================================+ - //|...original file name, zero-terminated...| - //+=========================================+ - // GZIP files may have only one file, with no filename, so assume original filename is current filename without .gz - $thisThisFileInfo['filename'] = eregi_replace('.gz$', '', $ThisFileInfo['filename']); - if ($thisThisFileInfo['flags']['filename']) { - while (true) { - if (ord($buff[$fpointer]) == 0) { - $fpointer++; - break; - } - $thisThisFileInfo['filename'] .= $buff[$fpointer]; - $fpointer++; - } - } - // bit 4 - FLG.FCOMMENT - //+===================================+ - //|...file comment, zero-terminated...| - //+===================================+ - if ($thisThisFileInfo['flags']['comment']) { - while (true) { - if (ord($buff[$fpointer]) == 0) { - $fpointer++; - break; - } - $thisThisFileInfo['comment'] .= $buff[$fpointer]; - $fpointer++; - } - } - // bit 1 - FLG.FHCRC - //+---+---+ - //| CRC16 | - //+---+---+ - if ($thisThisFileInfo['flags']['crc16']) { - $w_crc = substr($buff, $fpointer, 2); - $thisThisFileInfo['crc16'] = getid3_lib::LittleEndian2Int($w_crc); - $fpointer += 2; - } - // bit 0 - FLG.FTEXT - //if ($thisThisFileInfo['raw']['flags'] & 0x01) { - // Ignored... - //} - // bits 5, 6, 7 - reserved - - $thisThisFileInfo['crc32'] = getid3_lib::LittleEndian2Int(substr($buff, strlen($buff) - 8, 4)); - $thisThisFileInfo['filesize'] = getid3_lib::LittleEndian2Int(substr($buff, strlen($buff) - 4)); - - $ThisFileInfo['gzip']['files'] = getid3_lib::array_merge_clobber($ThisFileInfo['gzip']['files'], getid3_lib::CreateDeepArray($thisThisFileInfo['filename'], '/', $thisThisFileInfo['filesize'])); - - if ($this->option_gzip_parse_contents) { - // Try to inflate GZip - $csize = 0; - $inflated = ''; - $chkcrc32 = ''; - if (function_exists('gzinflate')) { - $cdata = substr($buff, $fpointer); - $cdata = substr($cdata, 0, strlen($cdata) - 8); - $csize = strlen($cdata); - $inflated = gzinflate($cdata); - - // Calculate CRC32 for inflated content - $thisThisFileInfo['crc32_valid'] = (bool) (sprintf('%u', crc32($inflated)) == $thisThisFileInfo['crc32']); - - // determine format - $formattest = substr($inflated, 0, 32774); - $newgetID3 = new getID3(); - $determined_format = $newgetID3->GetFileFormat($formattest); - unset($newgetID3); - - // file format is determined - switch (@$determined_format['module']) { - case 'tar': - // view TAR-file info - if (file_exists(GETID3_INCLUDEPATH.$determined_format['include']) && @include_once(GETID3_INCLUDEPATH.$determined_format['include'])) { - if (($temp_tar_filename = tempnam('*', 'getID3')) === false) { - // can't find anywhere to create a temp file, abort - $ThisFileInfo['error'][] = 'Unable to create temp file to parse TAR inside GZIP file'; - break; - } - if ($fp_temp_tar = fopen($temp_tar_filename, 'w+b')) { - fwrite($fp_temp_tar, $inflated); - rewind($fp_temp_tar); - $getid3_tar = new getid3_tar($fp_temp_tar, $dummy); - $ThisFileInfo['gzip']['member_header'][$idx]['tar'] = $dummy['tar']; - unset($dummy); - unset($getid3_tar); - fclose($fp_temp_tar); - unlink($temp_tar_filename); - } else { - $ThisFileInfo['error'][] = 'Unable to fopen() temp file to parse TAR inside GZIP file'; - break; - } - } - break; - - case '': - default: - // unknown or unhandled format - break; - } - } - } - } - return true; - } - - // Converts the OS type - function get_os_type($key) { - static $os_type = array( - '0' => 'FAT filesystem (MS-DOS, OS/2, NT/Win32)', - '1' => 'Amiga', - '2' => 'VMS (or OpenVMS)', - '3' => 'Unix', - '4' => 'VM/CMS', - '5' => 'Atari TOS', - '6' => 'HPFS filesystem (OS/2, NT)', - '7' => 'Macintosh', - '8' => 'Z-System', - '9' => 'CP/M', - '10' => 'TOPS-20', - '11' => 'NTFS filesystem (NT)', - '12' => 'QDOS', - '13' => 'Acorn RISCOS', - '255' => 'unknown' - ); - return @$os_type[$key]; - } - - // Converts the eXtra FLags - function get_xflag_type($key) { - static $xflag_type = array( - '0' => 'unknown', - '2' => 'maximum compression', - '4' => 'fastest algorithm' - ); - return @$xflag_type[$key]; - } -} - -?> diff --git a/getid3/module.archive.rar.php b/getid3/module.archive.rar.php deleted file mode 100644 index 9d9e9f6..0000000 --- a/getid3/module.archive.rar.php +++ /dev/null @@ -1,52 +0,0 @@ -<?php -///////////////////////////////////////////////////////////////// -/// getID3() by James Heinrich <info@getid3.org> // -// available at http://getid3.sourceforge.net // -// or http://www.getid3.org // -///////////////////////////////////////////////////////////////// -// See readme.txt for more details // -///////////////////////////////////////////////////////////////// -// // -// module.archive.rar.php // -// module for analyzing RAR files // -// dependencies: NONE // -// /// -///////////////////////////////////////////////////////////////// - - -class getid3_rar -{ - - var $option_use_rar_extension = false; - - function getid3_rar(&$fd, &$ThisFileInfo) { - - $ThisFileInfo['fileformat'] = 'rar'; - - if ($this->option_use_rar_extension === true) { - if (function_exists('rar_open')) { - if ($rp = rar_open($ThisFileInfo['filename'])) { - $ThisFileInfo['rar']['files'] = array();
- $entries = rar_list($rp);
- foreach ($entries as $entry) {
- $ThisFileInfo['rar']['files'] = getid3_lib::array_merge_clobber($ThisFileInfo['rar']['files'], getid3_lib::CreateDeepArray($entry->getName(), '/', $entry->getUnpackedSize())); - } - rar_close($rp); - return true; - } else { - $ThisFileInfo['error'][] = 'failed to rar_open('.$ThisFileInfo['filename'].')'; - }
- } else { - $ThisFileInfo['error'][] = 'RAR support does not appear to be available in this PHP installation'; - } - } else { - $ThisFileInfo['error'][] = 'PHP-RAR processing has been disabled (set $getid3_rar->option_use_rar_extension=true to enable)'; - } - return false; - - } - -} - - -?>
\ No newline at end of file diff --git a/getid3/module.archive.szip.php b/getid3/module.archive.szip.php deleted file mode 100644 index 2513c85..0000000 --- a/getid3/module.archive.szip.php +++ /dev/null @@ -1,97 +0,0 @@ -<?php -///////////////////////////////////////////////////////////////// -/// getID3() by James Heinrich <info@getid3.org> // -// available at http://getid3.sourceforge.net // -// or http://www.getid3.org // -///////////////////////////////////////////////////////////////// -// See readme.txt for more details // -///////////////////////////////////////////////////////////////// -// // -// module.archive.szip.php // -// module for analyzing SZIP compressed files // -// dependencies: NONE // -// /// -///////////////////////////////////////////////////////////////// - - -class getid3_szip -{ - - function getid3_szip(&$fd, &$ThisFileInfo) { - - fseek($fd, $ThisFileInfo['avdataoffset'], SEEK_SET); - $SZIPHeader = fread($fd, 6); - if (substr($SZIPHeader, 0, 4) != 'SZ'."\x0A\x04") { - $ThisFileInfo['error'][] = 'Expecting "SZ[x0A][x04]" at offset '.$ThisFileInfo['avdataoffset'].', found "'.substr($SZIPHeader, 0, 4).'"'; - return false; - } - - $ThisFileInfo['fileformat'] = 'szip'; - - $ThisFileInfo['szip']['major_version'] = getid3_lib::BigEndian2Int(substr($SZIPHeader, 4, 1)); - $ThisFileInfo['szip']['minor_version'] = getid3_lib::BigEndian2Int(substr($SZIPHeader, 5, 1)); - - while (!feof($fd)) { - $NextBlockID = fread($fd, 2); - switch ($NextBlockID) { - case 'SZ': - // Note that szip files can be concatenated, this has the same effect as - // concatenating the files. this also means that global header blocks - // might be present between directory/data blocks. - fseek($fd, 4, SEEK_CUR); - break; - - case 'BH': - $BHheaderbytes = getid3_lib::BigEndian2Int(fread($fd, 3)); - $BHheaderdata = fread($fd, $BHheaderbytes); - $BHheaderoffset = 0; - while (strpos($BHheaderdata, "\x00", $BHheaderoffset) > 0) { - //filename as \0 terminated string (empty string indicates end) - //owner as \0 terminated string (empty is same as last file) - //group as \0 terminated string (empty is same as last file) - //3 byte filelength in this block - //2 byte access flags - //4 byte creation time (like in unix) - //4 byte modification time (like in unix) - //4 byte access time (like in unix) - - $BHdataArray['filename'] = substr($BHheaderdata, $BHheaderoffset, strcspn($BHheaderdata, "\x00")); - $BHheaderoffset += (strlen($BHdataArray['filename']) + 1); - - $BHdataArray['owner'] = substr($BHheaderdata, $BHheaderoffset, strcspn($BHheaderdata, "\x00")); - $BHheaderoffset += (strlen($BHdataArray['owner']) + 1); - - $BHdataArray['group'] = substr($BHheaderdata, $BHheaderoffset, strcspn($BHheaderdata, "\x00")); - $BHheaderoffset += (strlen($BHdataArray['group']) + 1); - - $BHdataArray['filelength'] = getid3_lib::BigEndian2Int(substr($BHheaderdata, $BHheaderoffset, 3)); - $BHheaderoffset += 3; - - $BHdataArray['access_flags'] = getid3_lib::BigEndian2Int(substr($BHheaderdata, $BHheaderoffset, 2)); - $BHheaderoffset += 2; - - $BHdataArray['creation_time'] = getid3_lib::BigEndian2Int(substr($BHheaderdata, $BHheaderoffset, 4)); - $BHheaderoffset += 4; - - $BHdataArray['modification_time'] = getid3_lib::BigEndian2Int(substr($BHheaderdata, $BHheaderoffset, 4)); - $BHheaderoffset += 4; - - $BHdataArray['access_time'] = getid3_lib::BigEndian2Int(substr($BHheaderdata, $BHheaderoffset, 4)); - $BHheaderoffset += 4; - - $ThisFileInfo['szip']['BH'][] = $BHdataArray; - } - break; - - default: - break 2; - } - } - - return true; - - } - -} - -?>
\ No newline at end of file diff --git a/getid3/module.archive.tar.php b/getid3/module.archive.tar.php deleted file mode 100644 index aa4390f..0000000 --- a/getid3/module.archive.tar.php +++ /dev/null @@ -1,175 +0,0 @@ -<?php -///////////////////////////////////////////////////////////////// -/// getID3() by James Heinrich <info@getid3.org> // -// available at http://getid3.sourceforge.net // -// or http://www.getid3.org // -///////////////////////////////////////////////////////////////// -// See readme.txt for more details // -///////////////////////////////////////////////////////////////// -// // -// module.archive.tar.php // -// module for analyzing TAR files // -// dependencies: NONE // -// /// -///////////////////////////////////////////////////////////////// -// // -// Module originally written by // -// Mike Mozolin <teddybearØmail*ru> // -// // -///////////////////////////////////////////////////////////////// - - -class getid3_tar { - - function getid3_tar(&$fd, &$ThisFileInfo) { - $ThisFileInfo['fileformat'] = 'tar'; - $ThisFileInfo['tar']['files'] = array(); - - $unpack_header = 'a100fname/a8mode/a8uid/a8gid/a12size/a12mtime/a8chksum/a1typflag/a100lnkname/a6magic/a2ver/a32uname/a32gname/a8devmaj/a8devmin/a155prefix'; - $null_512k = str_repeat("\x00", 512); // end-of-file marker - - @fseek($fd, 0); - while (!feof($fd)) { - $buffer = fread($fd, 512); - if (strlen($buffer) < 512) { - break; - } - - // check the block - $checksum = 0; - for ($i = 0; $i < 148; $i++) { - $checksum += ord($buffer{$i}); - } - for ($i = 148; $i < 156; $i++) { - $checksum += ord(' '); - } - for ($i = 156; $i < 512; $i++) { - $checksum += ord($buffer{$i}); - } - $attr = unpack($unpack_header, $buffer); - $name = trim(@$attr['fname']); - $mode = octdec(trim(@$attr['mode'])); - $uid = octdec(trim(@$attr['uid'])); - $gid = octdec(trim(@$attr['gid'])); - $size = octdec(trim(@$attr['size'])); - $mtime = octdec(trim(@$attr['mtime'])); - $chksum = octdec(trim(@$attr['chksum'])); - $typflag = trim(@$attr['typflag']); - $lnkname = trim(@$attr['lnkname']); - $magic = trim(@$attr['magic']); - $ver = trim(@$attr['ver']); - $uname = trim(@$attr['uname']); - $gname = trim(@$attr['gname']); - $devmaj = octdec(trim(@$attr['devmaj'])); - $devmin = octdec(trim(@$attr['devmin'])); - $prefix = trim(@$attr['prefix']); - if (($checksum == 256) && ($chksum == 0)) { - // EOF Found - break; - } - if ($prefix) { - $name = $prefix.'/'.$name; - } - if ((preg_match('#/$#', $name)) && !$name) { - $typeflag = 5; - } - if ($buffer == $null_512k) { - // it's the end of the tar-file... - break; - } - - // Read to the next chunk - fseek($fd, $size, SEEK_CUR); - - $diff = $size % 512; - if ($diff != 0) { - // Padding, throw away - fseek($fd, (512 - $diff), SEEK_CUR); - } - // Protect against tar-files with garbage at the end - if ($name == '') { - break; - } - $ThisFileInfo['tar']['file_details'][$name] = array ( - 'name' => $name, - 'mode_raw' => $mode, - 'mode' => getid3_tar::display_perms($mode), - 'uid' => $uid, - 'gid' => $gid, - 'size' => $size, - 'mtime' => $mtime, - 'chksum' => $chksum, - 'typeflag' => getid3_tar::get_flag_type($typflag), - 'linkname' => $lnkname, - 'magic' => $magic, - 'version' => $ver, - 'uname' => $uname, - 'gname' => $gname, - 'devmajor' => $devmaj, - 'devminor' => $devmin - ); - $ThisFileInfo['tar']['files'] = getid3_lib::array_merge_clobber($ThisFileInfo['tar']['files'], getid3_lib::CreateDeepArray($ThisFileInfo['tar']['file_details'][$name]['name'], '/', $size)); - } - return true; - } - - // Parses the file mode to file permissions - function display_perms($mode) { - // Determine Type - if ($mode & 0x1000) $type='p'; // FIFO pipe - elseif ($mode & 0x2000) $type='c'; // Character special - elseif ($mode & 0x4000) $type='d'; // Directory - elseif ($mode & 0x6000) $type='b'; // Block special - elseif ($mode & 0x8000) $type='-'; // Regular - elseif ($mode & 0xA000) $type='l'; // Symbolic Link - elseif ($mode & 0xC000) $type='s'; // Socket - else $type='u'; // UNKNOWN - - // Determine permissions - $owner['read'] = (($mode & 00400) ? 'r' : '-'); - $owner['write'] = (($mode & 00200) ? 'w' : '-'); - $owner['execute'] = (($mode & 00100) ? 'x' : '-'); - $group['read'] = (($mode & 00040) ? 'r' : '-'); - $group['write'] = (($mode & 00020) ? 'w' : '-'); - $group['execute'] = (($mode & 00010) ? 'x' : '-'); - $world['read'] = (($mode & 00004) ? 'r' : '-'); - $world['write'] = (($mode & 00002) ? 'w' : '-'); - $world['execute'] = (($mode & 00001) ? 'x' : '-'); - - // Adjust for SUID, SGID and sticky bit - if ($mode & 0x800) $owner['execute'] = ($owner['execute'] == 'x') ? 's' : 'S'; - if ($mode & 0x400) $group['execute'] = ($group['execute'] == 'x') ? 's' : 'S'; - if ($mode & 0x200) $world['execute'] = ($world['execute'] == 'x') ? 't' : 'T'; - - $s = sprintf('%1s', $type); - $s .= sprintf('%1s%1s%1s', $owner['read'], $owner['write'], $owner['execute']); - $s .= sprintf('%1s%1s%1s', $group['read'], $group['write'], $group['execute']); - $s .= sprintf('%1s%1s%1s'."\n", $world['read'], $world['write'], $world['execute']); - return $s; - } - - // Converts the file type - function get_flag_type($typflag) { - static $flag_types = array( - '0' => 'LF_NORMAL', - '1' => 'LF_LINK', - '2' => 'LF_SYNLINK', - '3' => 'LF_CHR', - '4' => 'LF_BLK', - '5' => 'LF_DIR', - '6' => 'LF_FIFO', - '7' => 'LF_CONFIG', - 'D' => 'LF_DUMPDIR', - 'K' => 'LF_LONGLINK', - 'L' => 'LF_LONGNAME', - 'M' => 'LF_MULTIVOL', - 'N' => 'LF_NAMES', - 'S' => 'LF_SPARSE', - 'V' => 'LF_VOLHDR' - ); - return @$flag_types[$typflag]; - } - -} - -?>
\ No newline at end of file diff --git a/getid3/module.archive.zip.php b/getid3/module.archive.zip.php deleted file mode 100644 index 1d2be06..0000000 --- a/getid3/module.archive.zip.php +++ /dev/null @@ -1,416 +0,0 @@ -<?php -///////////////////////////////////////////////////////////////// -/// getID3() by James Heinrich <info@getid3.org> // -// available at http://getid3.sourceforge.net // -// or http://www.getid3.org // -///////////////////////////////////////////////////////////////// -// See readme.txt for more details // -///////////////////////////////////////////////////////////////// -// // -// module.archive.zip.php // -// module for analyzing pkZip files // -// dependencies: NONE // -// /// -///////////////////////////////////////////////////////////////// - - -class getid3_zip -{ - - function getid3_zip(&$fd, &$ThisFileInfo) { - - $ThisFileInfo['fileformat'] = 'zip'; - $ThisFileInfo['zip']['encoding'] = 'ISO-8859-1'; - $ThisFileInfo['zip']['files'] = array(); - - $ThisFileInfo['zip']['compressed_size'] = 0; - $ThisFileInfo['zip']['uncompressed_size'] = 0; - $ThisFileInfo['zip']['entries_count'] = 0; - - if ($ThisFileInfo['filesize'] < pow(2, 31)) { - $EOCDsearchData = ''; - $EOCDsearchCounter = 0; - while ($EOCDsearchCounter++ < 512) { - - fseek($fd, -128 * $EOCDsearchCounter, SEEK_END); - $EOCDsearchData = fread($fd, 128).$EOCDsearchData; - - if (strstr($EOCDsearchData, 'PK'."\x05\x06")) { - - $EOCDposition = strpos($EOCDsearchData, 'PK'."\x05\x06"); - fseek($fd, (-128 * $EOCDsearchCounter) + $EOCDposition, SEEK_END); - $ThisFileInfo['zip']['end_central_directory'] = $this->ZIPparseEndOfCentralDirectory($fd); - - fseek($fd, $ThisFileInfo['zip']['end_central_directory']['directory_offset'], SEEK_SET); - $ThisFileInfo['zip']['entries_count'] = 0; - while ($centraldirectoryentry = $this->ZIPparseCentralDirectory($fd)) { - $ThisFileInfo['zip']['central_directory'][] = $centraldirectoryentry; - $ThisFileInfo['zip']['entries_count']++; - $ThisFileInfo['zip']['compressed_size'] += $centraldirectoryentry['compressed_size']; - $ThisFileInfo['zip']['uncompressed_size'] += $centraldirectoryentry['uncompressed_size']; - - if ($centraldirectoryentry['uncompressed_size'] > 0) { - $ThisFileInfo['zip']['files'] = getid3_lib::array_merge_clobber($ThisFileInfo['zip']['files'], getid3_lib::CreateDeepArray($centraldirectoryentry['filename'], '/', $centraldirectoryentry['uncompressed_size'])); - } - } - - if ($ThisFileInfo['zip']['entries_count'] == 0) { - $ThisFileInfo['error'][] = 'No Central Directory entries found (truncated file?)'; - return false; - } - - if (!empty($ThisFileInfo['zip']['end_central_directory']['comment'])) { - $ThisFileInfo['zip']['comments']['comment'][] = $ThisFileInfo['zip']['end_central_directory']['comment']; - } - - if (isset($ThisFileInfo['zip']['central_directory'][0]['compression_method'])) { - $ThisFileInfo['zip']['compression_method'] = $ThisFileInfo['zip']['central_directory'][0]['compression_method']; - } - if (isset($ThisFileInfo['zip']['central_directory'][0]['flags']['compression_speed'])) { - $ThisFileInfo['zip']['compression_speed'] = $ThisFileInfo['zip']['central_directory'][0]['flags']['compression_speed']; - } - if (isset($ThisFileInfo['zip']['compression_method']) && ($ThisFileInfo['zip']['compression_method'] == 'store') && !isset($ThisFileInfo['zip']['compression_speed'])) { - $ThisFileInfo['zip']['compression_speed'] = 'store'; - } - - return true; - - } - } - } - - if ($this->getZIPentriesFilepointer($fd, $ThisFileInfo)) { - - // central directory couldn't be found and/or parsed - // scan through actual file data entries, recover as much as possible from probable trucated file - if ($ThisFileInfo['zip']['compressed_size'] > ($ThisFileInfo['filesize'] - 46 - 22)) { - $ThisFileInfo['error'][] = 'Warning: Truncated file! - Total compressed file sizes ('.$ThisFileInfo['zip']['compressed_size'].' bytes) is greater than filesize minus Central Directory and End Of Central Directory structures ('.($ThisFileInfo['filesize'] - 46 - 22).' bytes)'; - } - $ThisFileInfo['error'][] = 'Cannot find End Of Central Directory - returned list of files in [zip][entries] array may not be complete'; - foreach ($ThisFileInfo['zip']['entries'] as $key => $valuearray) { - $ThisFileInfo['zip']['files'][$valuearray['filename']] = $valuearray['uncompressed_size']; - } - return true; - - } else { - - unset($ThisFileInfo['zip']); - $ThisFileInfo['fileformat'] = ''; - $ThisFileInfo['error'][] = 'Cannot find End Of Central Directory (truncated file?)'; - return false; - - } - } - - - function getZIPHeaderFilepointerTopDown(&$fd, &$ThisFileInfo) { - $ThisFileInfo['fileformat'] = 'zip'; - - $ThisFileInfo['zip']['compressed_size'] = 0; - $ThisFileInfo['zip']['uncompressed_size'] = 0; - $ThisFileInfo['zip']['entries_count'] = 0; - - rewind($fd); - while ($fileentry = $this->ZIPparseLocalFileHeader($fd)) { - $ThisFileInfo['zip']['entries'][] = $fileentry; - $ThisFileInfo['zip']['entries_count']++; - } - if ($ThisFileInfo['zip']['entries_count'] == 0) { - $ThisFileInfo['error'][] = 'No Local File Header entries found'; - return false; - } - - $ThisFileInfo['zip']['entries_count'] = 0; - while ($centraldirectoryentry = $this->ZIPparseCentralDirectory($fd)) { - $ThisFileInfo['zip']['central_directory'][] = $centraldirectoryentry; - $ThisFileInfo['zip']['entries_count']++; - $ThisFileInfo['zip']['compressed_size'] += $centraldirectoryentry['compressed_size']; - $ThisFileInfo['zip']['uncompressed_size'] += $centraldirectoryentry['uncompressed_size']; - } - if ($ThisFileInfo['zip']['entries_count'] == 0) { - $ThisFileInfo['error'][] = 'No Central Directory entries found (truncated file?)'; - return false; - } - - if ($EOCD = $this->ZIPparseEndOfCentralDirectory($fd)) { - $ThisFileInfo['zip']['end_central_directory'] = $EOCD; - } else { - $ThisFileInfo['error'][] = 'No End Of Central Directory entry found (truncated file?)'; - return false; - } - - if (!empty($ThisFileInfo['zip']['end_central_directory']['comment'])) { - $ThisFileInfo['zip']['comments']['comment'][] = $ThisFileInfo['zip']['end_central_directory']['comment']; - } - - return true; - } - - - function getZIPentriesFilepointer(&$fd, &$ThisFileInfo) { - $ThisFileInfo['zip']['compressed_size'] = 0; - $ThisFileInfo['zip']['uncompressed_size'] = 0; - $ThisFileInfo['zip']['entries_count'] = 0; - - rewind($fd); - while ($fileentry = $this->ZIPparseLocalFileHeader($fd)) { - $ThisFileInfo['zip']['entries'][] = $fileentry; - $ThisFileInfo['zip']['entries_count']++; - $ThisFileInfo['zip']['compressed_size'] += $fileentry['compressed_size']; - $ThisFileInfo['zip']['uncompressed_size'] += $fileentry['uncompressed_size']; - } - if ($ThisFileInfo['zip']['entries_count'] == 0) { - $ThisFileInfo['error'][] = 'No Local File Header entries found'; - return false; - } - - return true; - } - - - function ZIPparseLocalFileHeader(&$fd) { - $LocalFileHeader['offset'] = ftell($fd); - - $ZIPlocalFileHeader = fread($fd, 30); - - $LocalFileHeader['raw']['signature'] = getid3_lib::LittleEndian2Int(substr($ZIPlocalFileHeader, 0, 4)); - if ($LocalFileHeader['raw']['signature'] != 0x04034B50) { - // invalid Local File Header Signature - fseek($fd, $LocalFileHeader['offset'], SEEK_SET); // seek back to where filepointer originally was so it can be handled properly - return false; - } - $LocalFileHeader['raw']['extract_version'] = getid3_lib::LittleEndian2Int(substr($ZIPlocalFileHeader, 4, 2)); - $LocalFileHeader['raw']['general_flags'] = getid3_lib::LittleEndian2Int(substr($ZIPlocalFileHeader, 6, 2)); - $LocalFileHeader['raw']['compression_method'] = getid3_lib::LittleEndian2Int(substr($ZIPlocalFileHeader, 8, 2)); - $LocalFileHeader['raw']['last_mod_file_time'] = getid3_lib::LittleEndian2Int(substr($ZIPlocalFileHeader, 10, 2)); - $LocalFileHeader['raw']['last_mod_file_date'] = getid3_lib::LittleEndian2Int(substr($ZIPlocalFileHeader, 12, 2)); - $LocalFileHeader['raw']['crc_32'] = getid3_lib::LittleEndian2Int(substr($ZIPlocalFileHeader, 14, 4)); - $LocalFileHeader['raw']['compressed_size'] = getid3_lib::LittleEndian2Int(substr($ZIPlocalFileHeader, 18, 4)); - $LocalFileHeader['raw']['uncompressed_size'] = getid3_lib::LittleEndian2Int(substr($ZIPlocalFileHeader, 22, 4)); - $LocalFileHeader['raw']['filename_length'] = getid3_lib::LittleEndian2Int(substr($ZIPlocalFileHeader, 26, 2)); - $LocalFileHeader['raw']['extra_field_length'] = getid3_lib::LittleEndian2Int(substr($ZIPlocalFileHeader, 28, 2)); - - $LocalFileHeader['extract_version'] = sprintf('%1.1f', $LocalFileHeader['raw']['extract_version'] / 10); - $LocalFileHeader['host_os'] = $this->ZIPversionOSLookup(($LocalFileHeader['raw']['extract_version'] & 0xFF00) >> 8); - $LocalFileHeader['compression_method'] = $this->ZIPcompressionMethodLookup($LocalFileHeader['raw']['compression_method']); - $LocalFileHeader['compressed_size'] = $LocalFileHeader['raw']['compressed_size']; - $LocalFileHeader['uncompressed_size'] = $LocalFileHeader['raw']['uncompressed_size']; - $LocalFileHeader['flags'] = $this->ZIPparseGeneralPurposeFlags($LocalFileHeader['raw']['general_flags'], $LocalFileHeader['raw']['compression_method']); - $LocalFileHeader['last_modified_timestamp'] = $this->DOStime2UNIXtime($LocalFileHeader['raw']['last_mod_file_date'], $LocalFileHeader['raw']['last_mod_file_time']); - - $FilenameExtrafieldLength = $LocalFileHeader['raw']['filename_length'] + $LocalFileHeader['raw']['extra_field_length']; - if ($FilenameExtrafieldLength > 0) { - $ZIPlocalFileHeader .= fread($fd, $FilenameExtrafieldLength); - - if ($LocalFileHeader['raw']['filename_length'] > 0) { - $LocalFileHeader['filename'] = substr($ZIPlocalFileHeader, 30, $LocalFileHeader['raw']['filename_length']); - } - if ($LocalFileHeader['raw']['extra_field_length'] > 0) { - $LocalFileHeader['raw']['extra_field_data'] = substr($ZIPlocalFileHeader, 30 + $LocalFileHeader['raw']['filename_length'], $LocalFileHeader['raw']['extra_field_length']); - } - } - - $LocalFileHeader['data_offset'] = ftell($fd); - //$LocalFileHeader['compressed_data'] = fread($fd, $LocalFileHeader['raw']['compressed_size']); - fseek($fd, $LocalFileHeader['raw']['compressed_size'], SEEK_CUR); - - if ($LocalFileHeader['flags']['data_descriptor_used']) { - $DataDescriptor = fread($fd, 12); - $LocalFileHeader['data_descriptor']['crc_32'] = getid3_lib::LittleEndian2Int(substr($DataDescriptor, 0, 4)); - $LocalFileHeader['data_descriptor']['compressed_size'] = getid3_lib::LittleEndian2Int(substr($DataDescriptor, 4, 4)); - $LocalFileHeader['data_descriptor']['uncompressed_size'] = getid3_lib::LittleEndian2Int(substr($DataDescriptor, 8, 4)); - } - - return $LocalFileHeader; - } - - - function ZIPparseCentralDirectory(&$fd) { - $CentralDirectory['offset'] = ftell($fd); - - $ZIPcentralDirectory = fread($fd, 46); - - $CentralDirectory['raw']['signature'] = getid3_lib::LittleEndian2Int(substr($ZIPcentralDirectory, 0, 4)); - if ($CentralDirectory['raw']['signature'] != 0x02014B50) { - // invalid Central Directory Signature - fseek($fd, $CentralDirectory['offset'], SEEK_SET); // seek back to where filepointer originally was so it can be handled properly - return false; - } - $CentralDirectory['raw']['create_version'] = getid3_lib::LittleEndian2Int(substr($ZIPcentralDirectory, 4, 2)); - $CentralDirectory['raw']['extract_version'] = getid3_lib::LittleEndian2Int(substr($ZIPcentralDirectory, 6, 2)); - $CentralDirectory['raw']['general_flags'] = getid3_lib::LittleEndian2Int(substr($ZIPcentralDirectory, 8, 2)); - $CentralDirectory['raw']['compression_method'] = getid3_lib::LittleEndian2Int(substr($ZIPcentralDirectory, 10, 2)); - $CentralDirectory['raw']['last_mod_file_time'] = getid3_lib::LittleEndian2Int(substr($ZIPcentralDirectory, 12, 2)); - $CentralDirectory['raw']['last_mod_file_date'] = getid3_lib::LittleEndian2Int(substr($ZIPcentralDirectory, 14, 2)); - $CentralDirectory['raw']['crc_32'] = getid3_lib::LittleEndian2Int(substr($ZIPcentralDirectory, 16, 4)); - $CentralDirectory['raw']['compressed_size'] = getid3_lib::LittleEndian2Int(substr($ZIPcentralDirectory, 20, 4)); - $CentralDirectory['raw']['uncompressed_size'] = getid3_lib::LittleEndian2Int(substr($ZIPcentralDirectory, 24, 4)); - $CentralDirectory['raw']['filename_length'] = getid3_lib::LittleEndian2Int(substr($ZIPcentralDirectory, 28, 2)); - $CentralDirectory['raw']['extra_field_length'] = getid3_lib::LittleEndian2Int(substr($ZIPcentralDirectory, 30, 2)); - $CentralDirectory['raw']['file_comment_length'] = getid3_lib::LittleEndian2Int(substr($ZIPcentralDirectory, 32, 2)); - $CentralDirectory['raw']['disk_number_start'] = getid3_lib::LittleEndian2Int(substr($ZIPcentralDirectory, 34, 2)); - $CentralDirectory['raw']['internal_file_attrib'] = getid3_lib::LittleEndian2Int(substr($ZIPcentralDirectory, 36, 2)); - $CentralDirectory['raw']['external_file_attrib'] = getid3_lib::LittleEndian2Int(substr($ZIPcentralDirectory, 38, 4)); - $CentralDirectory['raw']['local_header_offset'] = getid3_lib::LittleEndian2Int(substr($ZIPcentralDirectory, 42, 4)); - - $CentralDirectory['entry_offset'] = $CentralDirectory['raw']['local_header_offset']; - $CentralDirectory['create_version'] = sprintf('%1.1f', $CentralDirectory['raw']['create_version'] / 10); - $CentralDirectory['extract_version'] = sprintf('%1.1f', $CentralDirectory['raw']['extract_version'] / 10); - $CentralDirectory['host_os'] = $this->ZIPversionOSLookup(($CentralDirectory['raw']['extract_version'] & 0xFF00) >> 8); - $CentralDirectory['compression_method'] = $this->ZIPcompressionMethodLookup($CentralDirectory['raw']['compression_method']); - $CentralDirectory['compressed_size'] = $CentralDirectory['raw']['compressed_size']; - $CentralDirectory['uncompressed_size'] = $CentralDirectory['raw']['uncompressed_size']; - $CentralDirectory['flags'] = $this->ZIPparseGeneralPurposeFlags($CentralDirectory['raw']['general_flags'], $CentralDirectory['raw']['compression_method']); - $CentralDirectory['last_modified_timestamp'] = $this->DOStime2UNIXtime($CentralDirectory['raw']['last_mod_file_date'], $CentralDirectory['raw']['last_mod_file_time']); - - $FilenameExtrafieldCommentLength = $CentralDirectory['raw']['filename_length'] + $CentralDirectory['raw']['extra_field_length'] + $CentralDirectory['raw']['file_comment_length']; - if ($FilenameExtrafieldCommentLength > 0) { - $FilenameExtrafieldComment = fread($fd, $FilenameExtrafieldCommentLength); - - if ($CentralDirectory['raw']['filename_length'] > 0) { - $CentralDirectory['filename'] = substr($FilenameExtrafieldComment, 0, $CentralDirectory['raw']['filename_length']); - } - if ($CentralDirectory['raw']['extra_field_length'] > 0) { - $CentralDirectory['raw']['extra_field_data'] = substr($FilenameExtrafieldComment, $CentralDirectory['raw']['filename_length'], $CentralDirectory['raw']['extra_field_length']); - } - if ($CentralDirectory['raw']['file_comment_length'] > 0) { - $CentralDirectory['file_comment'] = substr($FilenameExtrafieldComment, $CentralDirectory['raw']['filename_length'] + $CentralDirectory['raw']['extra_field_length'], $CentralDirectory['raw']['file_comment_length']); - } - } - - return $CentralDirectory; - } - - function ZIPparseEndOfCentralDirectory(&$fd) { - $EndOfCentralDirectory['offset'] = ftell($fd); - - $ZIPendOfCentralDirectory = fread($fd, 22); - - $EndOfCentralDirectory['signature'] = getid3_lib::LittleEndian2Int(substr($ZIPendOfCentralDirectory, 0, 4)); - if ($EndOfCentralDirectory['signature'] != 0x06054B50) { - // invalid End Of Central Directory Signature - fseek($fd, $EndOfCentralDirectory['offset'], SEEK_SET); // seek back to where filepointer originally was so it can be handled properly - return false; - } - $EndOfCentralDirectory['disk_number_current'] = getid3_lib::LittleEndian2Int(substr($ZIPendOfCentralDirectory, 4, 2)); - $EndOfCentralDirectory['disk_number_start_directory'] = getid3_lib::LittleEndian2Int(substr($ZIPendOfCentralDirectory, 6, 2)); - $EndOfCentralDirectory['directory_entries_this_disk'] = getid3_lib::LittleEndian2Int(substr($ZIPendOfCentralDirectory, 8, 2)); - $EndOfCentralDirectory['directory_entries_total'] = getid3_lib::LittleEndian2Int(substr($ZIPendOfCentralDirectory, 10, 2)); - $EndOfCentralDirectory['directory_size'] = getid3_lib::LittleEndian2Int(substr($ZIPendOfCentralDirectory, 12, 4)); - $EndOfCentralDirectory['directory_offset'] = getid3_lib::LittleEndian2Int(substr($ZIPendOfCentralDirectory, 16, 4)); - $EndOfCentralDirectory['comment_length'] = getid3_lib::LittleEndian2Int(substr($ZIPendOfCentralDirectory, 20, 2)); - - if ($EndOfCentralDirectory['comment_length'] > 0) { - $EndOfCentralDirectory['comment'] = fread($fd, $EndOfCentralDirectory['comment_length']); - } - - return $EndOfCentralDirectory; - } - - - function ZIPparseGeneralPurposeFlags($flagbytes, $compressionmethod) { - $ParsedFlags['encrypted'] = (bool) ($flagbytes & 0x0001); - - switch ($compressionmethod) { - case 6: - $ParsedFlags['dictionary_size'] = (($flagbytes & 0x0002) ? 8192 : 4096); - $ParsedFlags['shannon_fano_trees'] = (($flagbytes & 0x0004) ? 3 : 2); - break; - - case 8: - case 9: - switch (($flagbytes & 0x0006) >> 1) { - case 0: - $ParsedFlags['compression_speed'] = 'normal'; - break; - case 1: - $ParsedFlags['compression_speed'] = 'maximum'; - break; - case 2: - $ParsedFlags['compression_speed'] = 'fast'; - break; - case 3: - $ParsedFlags['compression_speed'] = 'superfast'; - break; - } - break; - } - $ParsedFlags['data_descriptor_used'] = (bool) ($flagbytes & 0x0008); - - return $ParsedFlags; - } - - - function ZIPversionOSLookup($index) { - static $ZIPversionOSLookup = array( - 0 => 'MS-DOS and OS/2 (FAT / VFAT / FAT32 file systems)', - 1 => 'Amiga', - 2 => 'OpenVMS', - 3 => 'Unix', - 4 => 'VM/CMS', - 5 => 'Atari ST', - 6 => 'OS/2 H.P.F.S.', - 7 => 'Macintosh', - 8 => 'Z-System', - 9 => 'CP/M', - 10 => 'Windows NTFS', - 11 => 'MVS', - 12 => 'VSE', - 13 => 'Acorn Risc', - 14 => 'VFAT', - 15 => 'Alternate MVS', - 16 => 'BeOS', - 17 => 'Tandem' - ); - - return (isset($ZIPversionOSLookup[$index]) ? $ZIPversionOSLookup[$index] : '[unknown]'); - } - - function ZIPcompressionMethodLookup($index) { - static $ZIPcompressionMethodLookup = array( - 0 => 'store', - 1 => 'shrink', - 2 => 'reduce-1', - 3 => 'reduce-2', - 4 => 'reduce-3', - 5 => 'reduce-4', - 6 => 'implode', - 7 => 'tokenize', - 8 => 'deflate', - 9 => 'deflate64', - 10 => 'PKWARE Date Compression Library Imploding' - ); - - return (isset($ZIPcompressionMethodLookup[$index]) ? $ZIPcompressionMethodLookup[$index] : '[unknown]'); - } - - function DOStime2UNIXtime($DOSdate, $DOStime) { - // wFatDate - // Specifies the MS-DOS date. The date is a packed 16-bit value with the following format: - // Bits Contents - // 0-4 Day of the month (1-31) - // 5-8 Month (1 = January, 2 = February, and so on) - // 9-15 Year offset from 1980 (add 1980 to get actual year) - - $UNIXday = ($DOSdate & 0x001F); - $UNIXmonth = (($DOSdate & 0x01E0) >> 5); - $UNIXyear = (($DOSdate & 0xFE00) >> 9) + 1980; - - // wFatTime - // Specifies the MS-DOS time. The time is a packed 16-bit value with the following format: - // Bits Contents - // 0-4 Second divided by 2 - // 5-10 Minute (0-59) - // 11-15 Hour (0-23 on a 24-hour clock) - - $UNIXsecond = ($DOStime & 0x001F) * 2; - $UNIXminute = (($DOStime & 0x07E0) >> 5); - $UNIXhour = (($DOStime & 0xF800) >> 11); - - return gmmktime($UNIXhour, $UNIXminute, $UNIXsecond, $UNIXmonth, $UNIXday, $UNIXyear); - } - -} - - -?>
\ No newline at end of file diff --git a/getid3/module.audio-video.asf.php b/getid3/module.audio-video.asf.php deleted file mode 100644 index 4526291..0000000 --- a/getid3/module.audio-video.asf.php +++ /dev/null @@ -1,1673 +0,0 @@ -<?php -///////////////////////////////////////////////////////////////// -/// getID3() by James Heinrich <info@getid3.org> // -// available at http://getid3.sourceforge.net // -// or http://www.getid3.org // -///////////////////////////////////////////////////////////////// -// See readme.txt for more details // -///////////////////////////////////////////////////////////////// -// // -// module.audio-video.asf.php // -// module for analyzing ASF, WMA and WMV files // -// dependencies: module.audio-video.riff.php // -// /// -///////////////////////////////////////////////////////////////// - -getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio-video.riff.php', __FILE__, true); - -$GUIDarray = getid3_asf::KnownGUIDs(); -foreach ($GUIDarray as $GUIDname => $hexstringvalue) { - // initialize all GUID constants - define($GUIDname, getid3_asf::GUIDtoBytestring($hexstringvalue)); -} - - - -class getid3_asf -{ - - function getid3_asf(&$fd, &$ThisFileInfo) { - - // Shortcuts - $thisfile_audio = &$ThisFileInfo['audio']; - $thisfile_video = &$ThisFileInfo['video']; - $ThisFileInfo['asf'] = array(); - $thisfile_asf = &$ThisFileInfo['asf']; - $thisfile_asf['comments'] = array(); - $thisfile_asf_comments = &$thisfile_asf['comments']; - $thisfile_asf['header_object'] = array(); - $thisfile_asf_headerobject = &$thisfile_asf['header_object']; - - - // ASF structure: - // * Header Object [required] - // * File Properties Object [required] (global file attributes) - // * Stream Properties Object [required] (defines media stream & characteristics) - // * Header Extension Object [required] (additional functionality) - // * Content Description Object (bibliographic information) - // * Script Command Object (commands for during playback) - // * Marker Object (named jumped points within the file) - // * Data Object [required] - // * Data Packets - // * Index Object - - // Header Object: (mandatory, one only) - // Field Name Field Type Size (bits) - // Object ID GUID 128 // GUID for header object - GETID3_ASF_Header_Object - // Object Size QWORD 64 // size of header object, including 30 bytes of Header Object header - // Number of Header Objects DWORD 32 // number of objects in header object - // Reserved1 BYTE 8 // hardcoded: 0x01 - // Reserved2 BYTE 8 // hardcoded: 0x02 - - $ThisFileInfo['fileformat'] = 'asf'; - - fseek($fd, $ThisFileInfo['avdataoffset'], SEEK_SET); - $HeaderObjectData = fread($fd, 30); - - $thisfile_asf_headerobject['objectid'] = substr($HeaderObjectData, 0, 16); - $thisfile_asf_headerobject['objectid_guid'] = $this->BytestringToGUID($thisfile_asf_headerobject['objectid']); - if ($thisfile_asf_headerobject['objectid'] != GETID3_ASF_Header_Object) { - $ThisFileInfo['warning'][] = 'ASF header GUID {'.$this->BytestringToGUID($thisfile_asf_headerobject['objectid']).'} does not match expected "GETID3_ASF_Header_Object" GUID {'.$this->BytestringToGUID(GETID3_ASF_Header_Object).'}'; - unset($ThisFileInfo['fileformat']); - unset($ThisFileInfo['asf']); - return false; - break; - } - $thisfile_asf_headerobject['objectsize'] = getid3_lib::LittleEndian2Int(substr($HeaderObjectData, 16, 8)); - $thisfile_asf_headerobject['headerobjects'] = getid3_lib::LittleEndian2Int(substr($HeaderObjectData, 24, 4)); - $thisfile_asf_headerobject['reserved1'] = getid3_lib::LittleEndian2Int(substr($HeaderObjectData, 28, 1)); - $thisfile_asf_headerobject['reserved2'] = getid3_lib::LittleEndian2Int(substr($HeaderObjectData, 29, 1)); - - $ASFHeaderData = fread($fd, $thisfile_asf_headerobject['objectsize'] - 30); - $offset = 0; - - for ($HeaderObjectsCounter = 0; $HeaderObjectsCounter < $thisfile_asf_headerobject['headerobjects']; $HeaderObjectsCounter++) { - $NextObjectGUID = substr($ASFHeaderData, $offset, 16); - $offset += 16; - $NextObjectGUIDtext = $this->BytestringToGUID($NextObjectGUID); - $NextObjectSize = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 8)); - $offset += 8; - switch ($NextObjectGUID) { - - case GETID3_ASF_File_Properties_Object: - // File Properties Object: (mandatory, one only) - // Field Name Field Type Size (bits) - // Object ID GUID 128 // GUID for file properties object - GETID3_ASF_File_Properties_Object - // Object Size QWORD 64 // size of file properties object, including 104 bytes of File Properties Object header - // File ID GUID 128 // unique ID - identical to File ID in Data Object - // File Size QWORD 64 // entire file in bytes. Invalid if Broadcast Flag == 1 - // Creation Date QWORD 64 // date & time of file creation. Maybe invalid if Broadcast Flag == 1 - // Data Packets Count QWORD 64 // number of data packets in Data Object. Invalid if Broadcast Flag == 1 - // Play Duration QWORD 64 // playtime, in 100-nanosecond units. Invalid if Broadcast Flag == 1 - // Send Duration QWORD 64 // time needed to send file, in 100-nanosecond units. Players can ignore this value. Invalid if Broadcast Flag == 1 - // Preroll QWORD 64 // time to buffer data before starting to play file, in 1-millisecond units. If <> 0, PlayDuration and PresentationTime have been offset by this amount - // Flags DWORD 32 // - // * Broadcast Flag bits 1 (0x01) // file is currently being written, some header values are invalid - // * Seekable Flag bits 1 (0x02) // is file seekable - // * Reserved bits 30 (0xFFFFFFFC) // reserved - set to zero - // Minimum Data Packet Size DWORD 32 // in bytes. should be same as Maximum Data Packet Size. Invalid if Broadcast Flag == 1 - // Maximum Data Packet Size DWORD 32 // in bytes. should be same as Minimum Data Packet Size. Invalid if Broadcast Flag == 1 - // Maximum Bitrate DWORD 32 // maximum instantaneous bitrate in bits per second for entire file, including all data streams and ASF overhead - - // shortcut - $thisfile_asf['file_properties_object'] = array(); - $thisfile_asf_filepropertiesobject = &$thisfile_asf['file_properties_object']; - - $thisfile_asf_filepropertiesobject['objectid'] = $NextObjectGUID; - $thisfile_asf_filepropertiesobject['objectid_guid'] = $NextObjectGUIDtext; - $thisfile_asf_filepropertiesobject['objectsize'] = $NextObjectSize; - $thisfile_asf_filepropertiesobject['fileid'] = substr($ASFHeaderData, $offset, 16); - $offset += 16; - $thisfile_asf_filepropertiesobject['fileid_guid'] = $this->BytestringToGUID($thisfile_asf_filepropertiesobject['fileid']); - $thisfile_asf_filepropertiesobject['filesize'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 8)); - $offset += 8; - $thisfile_asf_filepropertiesobject['creation_date'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 8)); - $thisfile_asf_filepropertiesobject['creation_date_unix'] = $this->FILETIMEtoUNIXtime($thisfile_asf_filepropertiesobject['creation_date']); - $offset += 8; - $thisfile_asf_filepropertiesobject['data_packets'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 8)); - $offset += 8; - $thisfile_asf_filepropertiesobject['play_duration'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 8)); - $offset += 8; - $thisfile_asf_filepropertiesobject['send_duration'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 8)); - $offset += 8; - $thisfile_asf_filepropertiesobject['preroll'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 8)); - $offset += 8; - $thisfile_asf_filepropertiesobject['flags_raw'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4)); - $offset += 4; - $thisfile_asf_filepropertiesobject['flags']['broadcast'] = (bool) ($thisfile_asf_filepropertiesobject['flags_raw'] & 0x0001); - $thisfile_asf_filepropertiesobject['flags']['seekable'] = (bool) ($thisfile_asf_filepropertiesobject['flags_raw'] & 0x0002); - - $thisfile_asf_filepropertiesobject['min_packet_size'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4)); - $offset += 4; - $thisfile_asf_filepropertiesobject['max_packet_size'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4)); - $offset += 4; - $thisfile_asf_filepropertiesobject['max_bitrate'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4)); - $offset += 4; - - if ($thisfile_asf_filepropertiesobject['flags']['broadcast']) { - - // broadcast flag is set, some values invalid - unset($thisfile_asf_filepropertiesobject['filesize']); - unset($thisfile_asf_filepropertiesobject['data_packets']); - unset($thisfile_asf_filepropertiesobject['play_duration']); - unset($thisfile_asf_filepropertiesobject['send_duration']); - unset($thisfile_asf_filepropertiesobject['min_packet_size']); - unset($thisfile_asf_filepropertiesobject['max_packet_size']); - - } else { - - // broadcast flag NOT set, perform calculations - $ThisFileInfo['playtime_seconds'] = ($thisfile_asf_filepropertiesobject['play_duration'] / 10000000) - ($thisfile_asf_filepropertiesobject['preroll'] / 1000); - - //$ThisFileInfo['bitrate'] = $thisfile_asf_filepropertiesobject['max_bitrate']; - $ThisFileInfo['bitrate'] = ((isset($thisfile_asf_filepropertiesobject['filesize']) ? $thisfile_asf_filepropertiesobject['filesize'] : $ThisFileInfo['filesize']) * 8) / $ThisFileInfo['playtime_seconds']; - } - break; - - case GETID3_ASF_Stream_Properties_Object: - // Stream Properties Object: (mandatory, one per media stream) - // Field Name Field Type Size (bits) - // Object ID GUID 128 // GUID for stream properties object - GETID3_ASF_Stream_Properties_Object - // Object Size QWORD 64 // size of stream properties object, including 78 bytes of Stream Properties Object header - // Stream Type GUID 128 // GETID3_ASF_Audio_Media, GETID3_ASF_Video_Media or GETID3_ASF_Command_Media - // Error Correction Type GUID 128 // GETID3_ASF_Audio_Spread for audio-only streams, GETID3_ASF_No_Error_Correction for other stream types - // Time Offset QWORD 64 // 100-nanosecond units. typically zero. added to all timestamps of samples in the stream - // Type-Specific Data Length DWORD 32 // number of bytes for Type-Specific Data field - // Error Correction Data Length DWORD 32 // number of bytes for Error Correction Data field - // Flags WORD 16 // - // * Stream Number bits 7 (0x007F) // number of this stream. 1 <= valid <= 127 - // * Reserved bits 8 (0x7F80) // reserved - set to zero - // * Encrypted Content Flag bits 1 (0x8000) // stream contents encrypted if set - // Reserved DWORD 32 // reserved - set to zero - // Type-Specific Data BYTESTREAM variable // type-specific format data, depending on value of Stream Type - // Error Correction Data BYTESTREAM variable // error-correction-specific format data, depending on value of Error Correct Type - - // There is one GETID3_ASF_Stream_Properties_Object for each stream (audio, video) but the - // stream number isn't known until halfway through decoding the structure, hence it - // it is decoded to a temporary variable and then stuck in the appropriate index later - - $StreamPropertiesObjectData['objectid'] = $NextObjectGUID; - $StreamPropertiesObjectData['objectid_guid'] = $NextObjectGUIDtext; - $StreamPropertiesObjectData['objectsize'] = $NextObjectSize; - $StreamPropertiesObjectData['stream_type'] = substr($ASFHeaderData, $offset, 16); - $offset += 16; - $StreamPropertiesObjectData['stream_type_guid'] = $this->BytestringToGUID($StreamPropertiesObjectData['stream_type']); - $StreamPropertiesObjectData['error_correct_type'] = substr($ASFHeaderData, $offset, 16); - $offset += 16; - $StreamPropertiesObjectData['error_correct_guid'] = $this->BytestringToGUID($StreamPropertiesObjectData['error_correct_type']); - $StreamPropertiesObjectData['time_offset'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 8)); - $offset += 8; - $StreamPropertiesObjectData['type_data_length'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4)); - $offset += 4; - $StreamPropertiesObjectData['error_data_length'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4)); - $offset += 4; - $StreamPropertiesObjectData['flags_raw'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); - $offset += 2; - $StreamPropertiesObjectStreamNumber = $StreamPropertiesObjectData['flags_raw'] & 0x007F; - $StreamPropertiesObjectData['flags']['encrypted'] = (bool) ($StreamPropertiesObjectData['flags_raw'] & 0x8000); - - $offset += 4; // reserved - DWORD - $StreamPropertiesObjectData['type_specific_data'] = substr($ASFHeaderData, $offset, $StreamPropertiesObjectData['type_data_length']); - $offset += $StreamPropertiesObjectData['type_data_length']; - $StreamPropertiesObjectData['error_correct_data'] = substr($ASFHeaderData, $offset, $StreamPropertiesObjectData['error_data_length']); - $offset += $StreamPropertiesObjectData['error_data_length']; - - switch ($StreamPropertiesObjectData['stream_type']) { - - case GETID3_ASF_Audio_Media: - $thisfile_audio['dataformat'] = (!empty($thisfile_audio['dataformat']) ? $thisfile_audio['dataformat'] : 'asf'); - $thisfile_audio['bitrate_mode'] = (!empty($thisfile_audio['bitrate_mode']) ? $thisfile_audio['bitrate_mode'] : 'cbr'); - - $audiodata = getid3_riff::RIFFparseWAVEFORMATex(substr($StreamPropertiesObjectData['type_specific_data'], 0, 16)); - unset($audiodata['raw']); - $thisfile_audio = getid3_lib::array_merge_noclobber($audiodata, $thisfile_audio); - break; - - case GETID3_ASF_Video_Media: - $thisfile_video['dataformat'] = (!empty($thisfile_video['dataformat']) ? $thisfile_video['dataformat'] : 'asf'); - $thisfile_video['bitrate_mode'] = (!empty($thisfile_video['bitrate_mode']) ? $thisfile_video['bitrate_mode'] : 'cbr'); - break; - - case GETID3_ASF_Command_Media: - default: - // do nothing - break; - - } - - $thisfile_asf['stream_properties_object'][$StreamPropertiesObjectStreamNumber] = $StreamPropertiesObjectData; - unset($StreamPropertiesObjectData); // clear for next stream, if any - break; - - case GETID3_ASF_Header_Extension_Object: - // Header Extension Object: (mandatory, one only) - // Field Name Field Type Size (bits) - // Object ID GUID 128 // GUID for Header Extension object - GETID3_ASF_Header_Extension_Object - // Object Size QWORD 64 // size of Header Extension object, including 46 bytes of Header Extension Object header - // Reserved Field 1 GUID 128 // hardcoded: GETID3_ASF_Reserved_1 - // Reserved Field 2 WORD 16 // hardcoded: 0x00000006 - // Header Extension Data Size DWORD 32 // in bytes. valid: 0, or > 24. equals object size minus 46 - // Header Extension Data BYTESTREAM variable // array of zero or more extended header objects - - // shortcut - $thisfile_asf['header_extension_object'] = array(); - $thisfile_asf_headerextensionobject = &$thisfile_asf['header_extension_object']; - - $thisfile_asf_headerextensionobject['objectid'] = $NextObjectGUID; - $thisfile_asf_headerextensionobject['objectid_guid'] = $NextObjectGUIDtext; - $thisfile_asf_headerextensionobject['objectsize'] = $NextObjectSize; - $thisfile_asf_headerextensionobject['reserved_1'] = substr($ASFHeaderData, $offset, 16); - $offset += 16; - $thisfile_asf_headerextensionobject['reserved_1_guid'] = $this->BytestringToGUID($thisfile_asf_headerextensionobject['reserved_1']); - if ($thisfile_asf_headerextensionobject['reserved_1'] != GETID3_ASF_Reserved_1) { - $ThisFileInfo['warning'][] = 'header_extension_object.reserved_1 GUID ('.$this->BytestringToGUID($thisfile_asf_headerextensionobject['reserved_1']).') does not match expected "GETID3_ASF_Reserved_1" GUID ('.$this->BytestringToGUID(GETID3_ASF_Reserved_1).')'; - //return false; - break; - } - $thisfile_asf_headerextensionobject['reserved_2'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); - $offset += 2; - if ($thisfile_asf_headerextensionobject['reserved_2'] != 6) { - $ThisFileInfo['warning'][] = 'header_extension_object.reserved_2 ('.getid3_lib::PrintHexBytes($thisfile_asf_headerextensionobject['reserved_2']).') does not match expected value of "6"'; - //return false; - break; - } - $thisfile_asf_headerextensionobject['extension_data_size'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4)); - $offset += 4; - $thisfile_asf_headerextensionobject['extension_data'] = substr($ASFHeaderData, $offset, $thisfile_asf_headerextensionobject['extension_data_size']); - $offset += $thisfile_asf_headerextensionobject['extension_data_size']; - break; - - case GETID3_ASF_Codec_List_Object: - // Codec List Object: (optional, one only) - // Field Name Field Type Size (bits) - // Object ID GUID 128 // GUID for Codec List object - GETID3_ASF_Codec_List_Object - // Object Size QWORD 64 // size of Codec List object, including 44 bytes of Codec List Object header - // Reserved GUID 128 // hardcoded: 86D15241-311D-11D0-A3A4-00A0C90348F6 - // Codec Entries Count DWORD 32 // number of entries in Codec Entries array - // Codec Entries array of: variable // - // * Type WORD 16 // 0x0001 = Video Codec, 0x0002 = Audio Codec, 0xFFFF = Unknown Codec - // * Codec Name Length WORD 16 // number of Unicode characters stored in the Codec Name field - // * Codec Name WCHAR variable // array of Unicode characters - name of codec used to create the content - // * Codec Description Length WORD 16 // number of Unicode characters stored in the Codec Description field - // * Codec Description WCHAR variable // array of Unicode characters - description of format used to create the content - // * Codec Information Length WORD 16 // number of Unicode characters stored in the Codec Information field - // * Codec Information BYTESTREAM variable // opaque array of information bytes about the codec used to create the content - - // shortcut - $thisfile_asf['codec_list_object'] = array(); - $thisfile_asf_codeclistobject = &$thisfile_asf['codec_list_object']; - - $thisfile_asf_codeclistobject['objectid'] = $NextObjectGUID; - $thisfile_asf_codeclistobject['objectid_guid'] = $NextObjectGUIDtext; - $thisfile_asf_codeclistobject['objectsize'] = $NextObjectSize; - $thisfile_asf_codeclistobject['reserved'] = substr($ASFHeaderData, $offset, 16); - $offset += 16; - $thisfile_asf_codeclistobject['reserved_guid'] = $this->BytestringToGUID($thisfile_asf_codeclistobject['reserved']); - if ($thisfile_asf_codeclistobject['reserved'] != $this->GUIDtoBytestring('86D15241-311D-11D0-A3A4-00A0C90348F6')) { - $ThisFileInfo['warning'][] = 'codec_list_object.reserved GUID {'.$this->BytestringToGUID($thisfile_asf_codeclistobject['reserved']).'} does not match expected "GETID3_ASF_Reserved_1" GUID {86D15241-311D-11D0-A3A4-00A0C90348F6}'; - //return false; - break; - } - $thisfile_asf_codeclistobject['codec_entries_count'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4)); - $offset += 4; - for ($CodecEntryCounter = 0; $CodecEntryCounter < $thisfile_asf_codeclistobject['codec_entries_count']; $CodecEntryCounter++) { - // shortcut - $thisfile_asf_codeclistobject['codec_entries'][$CodecEntryCounter] = array(); - $thisfile_asf_codeclistobject_codecentries_current = &$thisfile_asf_codeclistobject['codec_entries'][$CodecEntryCounter]; - - $thisfile_asf_codeclistobject_codecentries_current['type_raw'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); - $offset += 2; - $thisfile_asf_codeclistobject_codecentries_current['type'] = $this->ASFCodecListObjectTypeLookup($thisfile_asf_codeclistobject_codecentries_current['type_raw']); - - $CodecNameLength = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)) * 2; // 2 bytes per character - $offset += 2; - $thisfile_asf_codeclistobject_codecentries_current['name'] = substr($ASFHeaderData, $offset, $CodecNameLength); - $offset += $CodecNameLength; - - $CodecDescriptionLength = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)) * 2; // 2 bytes per character - $offset += 2; - $thisfile_asf_codeclistobject_codecentries_current['description'] = substr($ASFHeaderData, $offset, $CodecDescriptionLength); - $offset += $CodecDescriptionLength; - - $CodecInformationLength = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); - $offset += 2; - $thisfile_asf_codeclistobject_codecentries_current['information'] = substr($ASFHeaderData, $offset, $CodecInformationLength); - $offset += $CodecInformationLength; - - if ($thisfile_asf_codeclistobject_codecentries_current['type_raw'] == 2) { - // audio codec - if (strpos($thisfile_asf_codeclistobject_codecentries_current['description'], ',') === false) { - $ThisFileInfo['error'][] = '[asf][codec_list_object][codec_entries]['.$CodecEntryCounter.'][description] expected to contain comma-seperated list of parameters: "'.$thisfile_asf_codeclistobject_codecentries_current['description'].'"'; - return false; - } - list($AudioCodecBitrate, $AudioCodecFrequency, $AudioCodecChannels) = explode(',', $this->TrimConvert($thisfile_asf_codeclistobject_codecentries_current['description'])); - $thisfile_audio['codec'] = $this->TrimConvert($thisfile_asf_codeclistobject_codecentries_current['name']); - - if (!isset($thisfile_audio['bitrate']) && strstr($AudioCodecBitrate, 'kbps')) { - $thisfile_audio['bitrate'] = (int) (trim(str_replace('kbps', '', $AudioCodecBitrate)) * 1000); - } - //if (!isset($thisfile_video['bitrate']) && isset($thisfile_audio['bitrate']) && isset($thisfile_asf['file_properties_object']['max_bitrate']) && ($thisfile_asf_codeclistobject['codec_entries_count'] > 1)) { - if (!@$thisfile_video['bitrate'] && @$thisfile_audio['bitrate'] && @$ThisFileInfo['bitrate']) { - //$thisfile_video['bitrate'] = $thisfile_asf['file_properties_object']['max_bitrate'] - $thisfile_audio['bitrate']; - $thisfile_video['bitrate'] = $ThisFileInfo['bitrate'] - $thisfile_audio['bitrate']; - } - - $AudioCodecFrequency = (int) trim(str_replace('kHz', '', $AudioCodecFrequency)); - switch ($AudioCodecFrequency) { - case 8: - case 8000: - $thisfile_audio['sample_rate'] = 8000; - break; - - case 11: - case 11025: - $thisfile_audio['sample_rate'] = 11025; - break; - - case 12: - case 12000: - $thisfile_audio['sample_rate'] = 12000; - break; - - case 16: - case 16000: - $thisfile_audio['sample_rate'] = 16000; - break; - - case 22: - case 22050: - $thisfile_audio['sample_rate'] = 22050; - break; - - case 24: - case 24000: - $thisfile_audio['sample_rate'] = 24000; - break; - - case 32: - case 32000: - $thisfile_audio['sample_rate'] = 32000; - break; - - case 44: - case 441000: - $thisfile_audio['sample_rate'] = 44100; - break; - - case 48: - case 48000: - $thisfile_audio['sample_rate'] = 48000; - break; - - default: - $ThisFileInfo['warning'][] = 'unknown frequency: "'.$AudioCodecFrequency.'" ('.$this->TrimConvert($thisfile_asf_codeclistobject_codecentries_current['description']).')'; - break; - } - - if (!isset($thisfile_audio['channels'])) { - if (strstr($AudioCodecChannels, 'stereo')) { - $thisfile_audio['channels'] = 2; - } elseif (strstr($AudioCodecChannels, 'mono')) { - $thisfile_audio['channels'] = 1; - } - } - } - } - break; - - case GETID3_ASF_Script_Command_Object: - // Script Command Object: (optional, one only) - // Field Name Field Type Size (bits) - // Object ID GUID 128 // GUID for Script Command object - GETID3_ASF_Script_Command_Object - // Object Size QWORD 64 // size of Script Command object, including 44 bytes of Script Command Object header - // Reserved GUID 128 // hardcoded: 4B1ACBE3-100B-11D0-A39B-00A0C90348F6 - // Commands Count WORD 16 // number of Commands structures in the Script Commands Objects - // Command Types Count WORD 16 // number of Command Types structures in the Script Commands Objects - // Command Types array of: variable // - // * Command Type Name Length WORD 16 // number of Unicode characters for Command Type Name - // * Command Type Name WCHAR variable // array of Unicode characters - name of a type of command - // Commands array of: variable // - // * Presentation Time DWORD 32 // presentation time of that command, in milliseconds - // * Type Index WORD 16 // type of this command, as a zero-based index into the array of Command Types of this object - // * Command Name Length WORD 16 // number of Unicode characters for Command Name - // * Command Name WCHAR variable // array of Unicode characters - name of this command - - // shortcut - $thisfile_asf['script_command_object'] = array(); - $thisfile_asf_scriptcommandobject = &$thisfile_asf['script_command_object']; - - $thisfile_asf_scriptcommandobject['objectid'] = $NextObjectGUID; - $thisfile_asf_scriptcommandobject['objectid_guid'] = $NextObjectGUIDtext; - $thisfile_asf_scriptcommandobject['objectsize'] = $NextObjectSize; - $thisfile_asf_scriptcommandobject['reserved'] = substr($ASFHeaderData, $offset, 16); - $offset += 16; - $thisfile_asf_scriptcommandobject['reserved_guid'] = $this->BytestringToGUID($thisfile_asf_scriptcommandobject['reserved']); - if ($thisfile_asf_scriptcommandobject['reserved'] != $this->GUIDtoBytestring('4B1ACBE3-100B-11D0-A39B-00A0C90348F6')) { - $ThisFileInfo['warning'][] = 'script_command_object.reserved GUID {'.$this->BytestringToGUID($thisfile_asf_scriptcommandobject['reserved']).'} does not match expected "GETID3_ASF_Reserved_1" GUID {4B1ACBE3-100B-11D0-A39B-00A0C90348F6}'; - //return false; - break; - } - $thisfile_asf_scriptcommandobject['commands_count'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); - $offset += 2; - $thisfile_asf_scriptcommandobject['command_types_count'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); - $offset += 2; - for ($CommandTypesCounter = 0; $CommandTypesCounter < $thisfile_asf_scriptcommandobject['command_types_count']; $CommandTypesCounter++) { - $CommandTypeNameLength = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)) * 2; // 2 bytes per character - $offset += 2; - $thisfile_asf_scriptcommandobject['command_types'][$CommandTypesCounter]['name'] = substr($ASFHeaderData, $offset, $CommandTypeNameLength); - $offset += $CommandTypeNameLength; - } - for ($CommandsCounter = 0; $CommandsCounter < $thisfile_asf_scriptcommandobject['commands_count']; $CommandsCounter++) { - $thisfile_asf_scriptcommandobject['commands'][$CommandsCounter]['presentation_time'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4)); - $offset += 4; - $thisfile_asf_scriptcommandobject['commands'][$CommandsCounter]['type_index'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); - $offset += 2; - - $CommandTypeNameLength = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)) * 2; // 2 bytes per character - $offset += 2; - $thisfile_asf_scriptcommandobject['commands'][$CommandsCounter]['name'] = substr($ASFHeaderData, $offset, $CommandTypeNameLength); - $offset += $CommandTypeNameLength; - } - break; - - case GETID3_ASF_Marker_Object: - // Marker Object: (optional, one only) - // Field Name Field Type Size (bits) - // Object ID GUID 128 // GUID for Marker object - GETID3_ASF_Marker_Object - // Object Size QWORD 64 // size of Marker object, including 48 bytes of Marker Object header - // Reserved GUID 128 // hardcoded: 4CFEDB20-75F6-11CF-9C0F-00A0C90349CB - // Markers Count DWORD 32 // number of Marker structures in Marker Object - // Reserved WORD 16 // hardcoded: 0x0000 - // Name Length WORD 16 // number of bytes in the Name field - // Name WCHAR variable // name of the Marker Object - // Markers array of: variable // - // * Offset QWORD 64 // byte offset into Data Object - // * Presentation Time QWORD 64 // in 100-nanosecond units - // * Entry Length WORD 16 // length in bytes of (Send Time + Flags + Marker Description Length + Marker Description + Padding) - // * Send Time DWORD 32 // in milliseconds - // * Flags DWORD 32 // hardcoded: 0x00000000 - // * Marker Description Length DWORD 32 // number of bytes in Marker Description field - // * Marker Description WCHAR variable // array of Unicode characters - description of marker entry - // * Padding BYTESTREAM variable // optional padding bytes - - // shortcut - $thisfile_asf['marker_object'] = array(); - $thisfile_asf_markerobject = &$thisfile_asf['marker_object']; - - $thisfile_asf_markerobject['objectid'] = $NextObjectGUID; - $thisfile_asf_markerobject['objectid_guid'] = $NextObjectGUIDtext; - $thisfile_asf_markerobject['objectsize'] = $NextObjectSize; - $thisfile_asf_markerobject['reserved'] = substr($ASFHeaderData, $offset, 16); - $offset += 16; - $thisfile_asf_markerobject['reserved_guid'] = $this->BytestringToGUID($thisfile_asf_markerobject['reserved']); - if ($thisfile_asf_markerobject['reserved'] != $this->GUIDtoBytestring('4CFEDB20-75F6-11CF-9C0F-00A0C90349CB')) { - $ThisFileInfo['warning'][] = 'marker_object.reserved GUID {'.$this->BytestringToGUID($thisfile_asf_markerobject['reserved_1']).'} does not match expected "GETID3_ASF_Reserved_1" GUID {4CFEDB20-75F6-11CF-9C0F-00A0C90349CB}'; - break; - } - $thisfile_asf_markerobject['markers_count'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4)); - $offset += 4; - $thisfile_asf_markerobject['reserved_2'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); - $offset += 2; - if ($thisfile_asf_markerobject['reserved_2'] != 0) { - $ThisFileInfo['warning'][] = 'marker_object.reserved_2 ('.getid3_lib::PrintHexBytes($thisfile_asf_markerobject['reserved_2']).') does not match expected value of "0"'; - break; - } - $thisfile_asf_markerobject['name_length'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); - $offset += 2; - $thisfile_asf_markerobject['name'] = substr($ASFHeaderData, $offset, $thisfile_asf_markerobject['name_length']); - $offset += $thisfile_asf_markerobject['name_length']; - for ($MarkersCounter = 0; $MarkersCounter < $thisfile_asf_markerobject['markers_count']; $MarkersCounter++) { - $thisfile_asf_markerobject['markers'][$MarkersCounter]['offset'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 8)); - $offset += 8; - $thisfile_asf_markerobject['markers'][$MarkersCounter]['presentation_time'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 8)); - $offset += 8; - $thisfile_asf_markerobject['markers'][$MarkersCounter]['entry_length'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); - $offset += 2; - $thisfile_asf_markerobject['markers'][$MarkersCounter]['send_time'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4)); - $offset += 4; - $thisfile_asf_markerobject['markers'][$MarkersCounter]['flags'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4)); - $offset += 4; - $thisfile_asf_markerobject['markers'][$MarkersCounter]['marker_description_length'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4)); - $offset += 4; - $thisfile_asf_markerobject['markers'][$MarkersCounter]['marker_description'] = substr($ASFHeaderData, $offset, $thisfile_asf_markerobject['markers'][$MarkersCounter]['marker_description_length']); - $offset += $thisfile_asf_markerobject['markers'][$MarkersCounter]['marker_description_length']; - $PaddingLength = $thisfile_asf_markerobject['markers'][$MarkersCounter]['entry_length'] - 4 - 4 - 4 - $thisfile_asf_markerobject['markers'][$MarkersCounter]['marker_description_length']; - if ($PaddingLength > 0) { - $thisfile_asf_markerobject['markers'][$MarkersCounter]['padding'] = substr($ASFHeaderData, $offset, $PaddingLength); - $offset += $PaddingLength; - } - } - break; - - case GETID3_ASF_Bitrate_Mutual_Exclusion_Object: - // Bitrate Mutual Exclusion Object: (optional) - // Field Name Field Type Size (bits) - // Object ID GUID 128 // GUID for Bitrate Mutual Exclusion object - GETID3_ASF_Bitrate_Mutual_Exclusion_Object - // Object Size QWORD 64 // size of Bitrate Mutual Exclusion object, including 42 bytes of Bitrate Mutual Exclusion Object header - // Exlusion Type GUID 128 // nature of mutual exclusion relationship. one of: (GETID3_ASF_Mutex_Bitrate, GETID3_ASF_Mutex_Unknown) - // Stream Numbers Count WORD 16 // number of video streams - // Stream Numbers WORD variable // array of mutually exclusive video stream numbers. 1 <= valid <= 127 - - // shortcut - $thisfile_asf['bitrate_mutual_exclusion_object'] = array(); - $thisfile_asf_bitratemutualexclusionobject = &$thisfile_asf['bitrate_mutual_exclusion_object']; - - $thisfile_asf_bitratemutualexclusionobject['objectid'] = $NextObjectGUID; - $thisfile_asf_bitratemutualexclusionobject['objectid_guid'] = $NextObjectGUIDtext; - $thisfile_asf_bitratemutualexclusionobject['objectsize'] = $NextObjectSize; - $thisfile_asf_bitratemutualexclusionobject['reserved'] = substr($ASFHeaderData, $offset, 16); - $thisfile_asf_bitratemutualexclusionobject['reserved_guid'] = $this->BytestringToGUID($thisfile_asf_bitratemutualexclusionobject['reserved']); - $offset += 16; - if (($thisfile_asf_bitratemutualexclusionobject['reserved'] != GETID3_ASF_Mutex_Bitrate) && ($thisfile_asf_bitratemutualexclusionobject['reserved'] != GETID3_ASF_Mutex_Unknown)) { - $ThisFileInfo['warning'][] = 'bitrate_mutual_exclusion_object.reserved GUID {'.$this->BytestringToGUID($thisfile_asf_bitratemutualexclusionobject['reserved']).'} does not match expected "GETID3_ASF_Mutex_Bitrate" GUID {'.$this->BytestringToGUID(GETID3_ASF_Mutex_Bitrate).'} or "GETID3_ASF_Mutex_Unknown" GUID {'.$this->BytestringToGUID(GETID3_ASF_Mutex_Unknown).'}'; - //return false; - break; - } - $thisfile_asf_bitratemutualexclusionobject['stream_numbers_count'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); - $offset += 2; - for ($StreamNumberCounter = 0; $StreamNumberCounter < $thisfile_asf_bitratemutualexclusionobject['stream_numbers_count']; $StreamNumberCounter++) { - $thisfile_asf_bitratemutualexclusionobject['stream_numbers'][$StreamNumberCounter] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); - $offset += 2; - } - break; - - case GETID3_ASF_Error_Correction_Object: - // Error Correction Object: (optional, one only) - // Field Name Field Type Size (bits) - // Object ID GUID 128 // GUID for Error Correction object - GETID3_ASF_Error_Correction_Object - // Object Size QWORD 64 // size of Error Correction object, including 44 bytes of Error Correction Object header - // Error Correction Type GUID 128 // type of error correction. one of: (GETID3_ASF_No_Error_Correction, GETID3_ASF_Audio_Spread) - // Error Correction Data Length DWORD 32 // number of bytes in Error Correction Data field - // Error Correction Data BYTESTREAM variable // structure depends on value of Error Correction Type field - - // shortcut - $thisfile_asf['error_correction_object'] = array(); - $thisfile_asf_errorcorrectionobject = &$thisfile_asf['error_correction_object']; - - $thisfile_asf_errorcorrectionobject['objectid'] = $NextObjectGUID; - $thisfile_asf_errorcorrectionobject['objectid_guid'] = $NextObjectGUIDtext; - $thisfile_asf_errorcorrectionobject['objectsize'] = $NextObjectSize; - $thisfile_asf_errorcorrectionobject['error_correction_type'] = substr($ASFHeaderData, $offset, 16); - $offset += 16; - $thisfile_asf_errorcorrectionobject['error_correction_guid'] = $this->BytestringToGUID($thisfile_asf_errorcorrectionobject['error_correction_type']); - $thisfile_asf_errorcorrectionobject['error_correction_data_length'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4)); - $offset += 4; - switch ($thisfile_asf_errorcorrectionobject['error_correction_type']) { - case GETID3_ASF_No_Error_Correction: - // should be no data, but just in case there is, skip to the end of the field - $offset += $thisfile_asf_errorcorrectionobject['error_correction_data_length']; - break; - - case GETID3_ASF_Audio_Spread: - // Field Name Field Type Size (bits) - // Span BYTE 8 // number of packets over which audio will be spread. - // Virtual Packet Length WORD 16 // size of largest audio payload found in audio stream - // Virtual Chunk Length WORD 16 // size of largest audio payload found in audio stream - // Silence Data Length WORD 16 // number of bytes in Silence Data field - // Silence Data BYTESTREAM variable // hardcoded: 0x00 * (Silence Data Length) bytes - - $thisfile_asf_errorcorrectionobject['span'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 1)); - $offset += 1; - $thisfile_asf_errorcorrectionobject['virtual_packet_length'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); - $offset += 2; - $thisfile_asf_errorcorrectionobject['virtual_chunk_length'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); - $offset += 2; - $thisfile_asf_errorcorrectionobject['silence_data_length'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); - $offset += 2; - $thisfile_asf_errorcorrectionobject['silence_data'] = substr($ASFHeaderData, $offset, $thisfile_asf_errorcorrectionobject['silence_data_length']); - $offset += $thisfile_asf_errorcorrectionobject['silence_data_length']; - break; - - default: - $ThisFileInfo['warning'][] = 'error_correction_object.error_correction_type GUID {'.$this->BytestringToGUID($thisfile_asf_errorcorrectionobject['reserved']).'} does not match expected "GETID3_ASF_No_Error_Correction" GUID {'.$this->BytestringToGUID(GETID3_ASF_No_Error_Correction).'} or "GETID3_ASF_Audio_Spread" GUID {'.$this->BytestringToGUID(GETID3_ASF_Audio_Spread).'}'; - //return false; - break; - } - - break; - - case GETID3_ASF_Content_Description_Object: - // Content Description Object: (optional, one only) - // Field Name Field Type Size (bits) - // Object ID GUID 128 // GUID for Content Description object - GETID3_ASF_Content_Description_Object - // Object Size QWORD 64 // size of Content Description object, including 34 bytes of Content Description Object header - // Title Length WORD 16 // number of bytes in Title field - // Author Length WORD 16 // number of bytes in Author field - // Copyright Length WORD 16 // number of bytes in Copyright field - // Description Length WORD 16 // number of bytes in Description field - // Rating Length WORD 16 // number of bytes in Rating field - // Title WCHAR 16 // array of Unicode characters - Title - // Author WCHAR 16 // array of Unicode characters - Author - // Copyright WCHAR 16 // array of Unicode characters - Copyright - // Description WCHAR 16 // array of Unicode characters - Description - // Rating WCHAR 16 // array of Unicode characters - Rating - - // shortcut - $thisfile_asf['content_description_object'] = array(); - $thisfile_asf_contentdescriptionobject = &$thisfile_asf['content_description_object']; - - $thisfile_asf_contentdescriptionobject['objectid'] = $NextObjectGUID; - $thisfile_asf_contentdescriptionobject['objectid_guid'] = $NextObjectGUIDtext; - $thisfile_asf_contentdescriptionobject['objectsize'] = $NextObjectSize; - $thisfile_asf_contentdescriptionobject['title_length'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); - $offset += 2; - $thisfile_asf_contentdescriptionobject['author_length'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); - $offset += 2; - $thisfile_asf_contentdescriptionobject['copyright_length'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); - $offset += 2; - $thisfile_asf_contentdescriptionobject['description_length'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); - $offset += 2; - $thisfile_asf_contentdescriptionobject['rating_length'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); - $offset += 2; - $thisfile_asf_contentdescriptionobject['title'] = substr($ASFHeaderData, $offset, $thisfile_asf_contentdescriptionobject['title_length']); - $offset += $thisfile_asf_contentdescriptionobject['title_length']; - $thisfile_asf_contentdescriptionobject['author'] = substr($ASFHeaderData, $offset, $thisfile_asf_contentdescriptionobject['author_length']); - $offset += $thisfile_asf_contentdescriptionobject['author_length']; - $thisfile_asf_contentdescriptionobject['copyright'] = substr($ASFHeaderData, $offset, $thisfile_asf_contentdescriptionobject['copyright_length']); - $offset += $thisfile_asf_contentdescriptionobject['copyright_length']; - $thisfile_asf_contentdescriptionobject['description'] = substr($ASFHeaderData, $offset, $thisfile_asf_contentdescriptionobject['description_length']); - $offset += $thisfile_asf_contentdescriptionobject['description_length']; - $thisfile_asf_contentdescriptionobject['rating'] = substr($ASFHeaderData, $offset, $thisfile_asf_contentdescriptionobject['rating_length']); - $offset += $thisfile_asf_contentdescriptionobject['rating_length']; - - $ASFcommentKeysToCopy = array('title'=>'title', 'author'=>'artist', 'copyright'=>'copyright', 'description'=>'comment', 'rating'=>'rating'); - foreach ($ASFcommentKeysToCopy as $keytocopyfrom => $keytocopyto) { - if (!empty($thisfile_asf_contentdescriptionobject[$keytocopyfrom])) { - $thisfile_asf_comments[$keytocopyto][] = $this->TrimTerm($thisfile_asf_contentdescriptionobject[$keytocopyfrom]); - } - } - break; - - case GETID3_ASF_Extended_Content_Description_Object: - // Extended Content Description Object: (optional, one only) - // Field Name Field Type Size (bits) - // Object ID GUID 128 // GUID for Extended Content Description object - GETID3_ASF_Extended_Content_Description_Object - // Object Size QWORD 64 // size of ExtendedContent Description object, including 26 bytes of Extended Content Description Object header - // Content Descriptors Count WORD 16 // number of entries in Content Descriptors list - // Content Descriptors array of: variable // - // * Descriptor Name Length WORD 16 // size in bytes of Descriptor Name field - // * Descriptor Name WCHAR variable // array of Unicode characters - Descriptor Name - // * Descriptor Value Data Type WORD 16 // Lookup array: - // 0x0000 = Unicode String (variable length) - // 0x0001 = BYTE array (variable length) - // 0x0002 = BOOL (DWORD, 32 bits) - // 0x0003 = DWORD (DWORD, 32 bits) - // 0x0004 = QWORD (QWORD, 64 bits) - // 0x0005 = WORD (WORD, 16 bits) - // * Descriptor Value Length WORD 16 // number of bytes stored in Descriptor Value field - // * Descriptor Value variable variable // value for Content Descriptor - - // shortcut - $thisfile_asf['extended_content_description_object'] = array(); - $thisfile_asf_extendedcontentdescriptionobject = &$thisfile_asf['extended_content_description_object']; - - $thisfile_asf_extendedcontentdescriptionobject['objectid'] = $NextObjectGUID; - $thisfile_asf_extendedcontentdescriptionobject['objectid_guid'] = $NextObjectGUIDtext; - $thisfile_asf_extendedcontentdescriptionobject['objectsize'] = $NextObjectSize; - $thisfile_asf_extendedcontentdescriptionobject['content_descriptors_count'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); - $offset += 2; - for ($ExtendedContentDescriptorsCounter = 0; $ExtendedContentDescriptorsCounter < $thisfile_asf_extendedcontentdescriptionobject['content_descriptors_count']; $ExtendedContentDescriptorsCounter++) { - // shortcut - $thisfile_asf_extendedcontentdescriptionobject['content_descriptors'][$ExtendedContentDescriptorsCounter] = array(); - $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current = &$thisfile_asf_extendedcontentdescriptionobject['content_descriptors'][$ExtendedContentDescriptorsCounter]; - - $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['base_offset'] = $offset + 30; - $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['name_length'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); - $offset += 2; - $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['name'] = substr($ASFHeaderData, $offset, $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['name_length']); - $offset += $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['name_length']; - $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value_type'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); - $offset += 2; - $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value_length'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); - $offset += 2; - $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'] = substr($ASFHeaderData, $offset, $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value_length']); - $offset += $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value_length']; - switch ($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value_type']) { - case 0x0000: // Unicode string - break; - - case 0x0001: // BYTE array - // do nothing - break; - - case 0x0002: // BOOL - $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'] = (bool) getid3_lib::LittleEndian2Int($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']); - break; - - case 0x0003: // DWORD - case 0x0004: // QWORD - case 0x0005: // WORD - $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'] = getid3_lib::LittleEndian2Int($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']); - break; - - default: - $ThisFileInfo['warning'][] = 'extended_content_description.content_descriptors.'.$ExtendedContentDescriptorsCounter.'.value_type is invalid ('.$thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value_type'].')'; - //return false; - break; - } - switch ($this->TrimConvert(strtolower($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['name']))) { - - case 'wm/albumartist': - case 'artist': - $thisfile_asf_comments['artist'] = array($this->TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'])); - break; - - case 'wm/albumtitle': - case 'album': - $thisfile_asf_comments['album'] = array($this->TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'])); - break; - - case 'wm/genre': - case 'genre': - $thisfile_asf_comments['genre'] = array($this->TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'])); - break; - - case 'wm/tracknumber': - case 'tracknumber': - $thisfile_asf_comments['track'] = array(intval($this->TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']))); - break; - - case 'wm/track': - if (empty($thisfile_asf_comments['track'])) { - $thisfile_asf_comments['track'] = array(1 + $this->TrimConvert($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'])); - } - break; - - case 'wm/year': - case 'year': - case 'date': - $thisfile_asf_comments['year'] = array( $this->TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'])); - break; - - case 'wm/lyrics': - case 'lyrics': - $thisfile_asf_comments['lyrics'] = array($this->TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'])); - break; - - case 'isvbr': - if ($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']) { - $thisfile_audio['bitrate_mode'] = 'vbr'; - $thisfile_video['bitrate_mode'] = 'vbr'; - } - break; - - case 'id3': - // id3v2 module might not be loaded - if (class_exists('getid3_id3v2')) { - $tempfile = tempnam('*', 'getID3'); - $tempfilehandle = fopen($tempfile, "wb"); - $tempThisfileInfo = array('encoding'=>$ThisFileInfo['encoding']); - fwrite($tempfilehandle, $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']); - fclose($tempfilehandle); - - $tempfilehandle = fopen($tempfile, "rb"); - $id3 = new getid3_id3v2($tempfilehandle, $tempThisfileInfo); - unset($id3); - fclose($tempfilehandle); - unlink($tempfile); - - $ThisFileInfo['id3v2'] = $tempThisfileInfo['id3v2']; - unset($tempThisfileInfo); - } - break; - - case 'wm/encodingtime': - $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['encoding_time_unix'] = $this->FILETIMEtoUNIXtime($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']); - $thisfile_asf_comments['encoding_time_unix'] = array($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['encoding_time_unix']); - break; - - case 'wm/picture': - //typedef struct _WMPicture{ - // LPWSTR pwszMIMEType; - // BYTE bPictureType; - // LPWSTR pwszDescription; - // DWORD dwDataLen; - // BYTE* pbData; - //} WM_PICTURE; - - $wm_picture_offset = 0; - $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['image_type_id'] = getid3_lib::LittleEndian2Int(substr($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'], $wm_picture_offset, 1)); - $wm_picture_offset += 1; - $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['image_type'] = $this->WMpictureTypeLookup($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['image_type_id']); - $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['image_size'] = getid3_lib::LittleEndian2Int(substr($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'], $wm_picture_offset, 4)); - $wm_picture_offset += 4; - - $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['image_mime'] = ''; - do { - $next_byte_pair = substr($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'], $wm_picture_offset, 2); - $wm_picture_offset += 2; - $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['image_mime'] .= $next_byte_pair; - } while ($next_byte_pair !== "\x00\x00"); - - $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['image_description'] = ''; - do { - $next_byte_pair = substr($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'], $wm_picture_offset, 2); - $wm_picture_offset += 2; - $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['image_description'] .= $next_byte_pair; - } while ($next_byte_pair !== "\x00\x00"); - - $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['dataoffset'] = $wm_picture_offset; - $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['data'] = substr($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'], $wm_picture_offset); - unset($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']); - - break; - - default: - switch ($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value_type']) { - case 0: // Unicode string - if (substr($this->TrimConvert($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['name']), 0, 3) == 'WM/') { - $thisfile_asf_comments[str_replace('wm/', '', strtolower($this->TrimConvert($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['name'])))] = array($this->TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'])); - } - break; - - case 1: - break; - } - break; - } - - } - break; - - case GETID3_ASF_Stream_Bitrate_Properties_Object: - // Stream Bitrate Properties Object: (optional, one only) - // Field Name Field Type Size (bits) - // Object ID GUID 128 // GUID for Stream Bitrate Properties object - GETID3_ASF_Stream_Bitrate_Properties_Object - // Object Size QWORD 64 // size of Extended Content Description object, including 26 bytes of Stream Bitrate Properties Object header - // Bitrate Records Count WORD 16 // number of records in Bitrate Records - // Bitrate Records array of: variable // - // * Flags WORD 16 // - // * * Stream Number bits 7 (0x007F) // number of this stream - // * * Reserved bits 9 (0xFF80) // hardcoded: 0 - // * Average Bitrate DWORD 32 // in bits per second - - // shortcut - $thisfile_asf['stream_bitrate_properties_object'] = array(); - $thisfile_asf_streambitratepropertiesobject = &$thisfile_asf['stream_bitrate_properties_object']; - - $thisfile_asf_streambitratepropertiesobject['objectid'] = $NextObjectGUID; - $thisfile_asf_streambitratepropertiesobject['objectid_guid'] = $NextObjectGUIDtext; - $thisfile_asf_streambitratepropertiesobject['objectsize'] = $NextObjectSize; - $thisfile_asf_streambitratepropertiesobject['bitrate_records_count'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); - $offset += 2; - for ($BitrateRecordsCounter = 0; $BitrateRecordsCounter < $thisfile_asf_streambitratepropertiesobject['bitrate_records_count']; $BitrateRecordsCounter++) { - $thisfile_asf_streambitratepropertiesobject['bitrate_records'][$BitrateRecordsCounter]['flags_raw'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); - $offset += 2; - $thisfile_asf_streambitratepropertiesobject['bitrate_records'][$BitrateRecordsCounter]['flags']['stream_number'] = $thisfile_asf_streambitratepropertiesobject['bitrate_records'][$BitrateRecordsCounter]['flags_raw'] & 0x007F; - $thisfile_asf_streambitratepropertiesobject['bitrate_records'][$BitrateRecordsCounter]['bitrate'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4)); - $offset += 4; - } - break; - - case GETID3_ASF_Padding_Object: - // Padding Object: (optional) - // Field Name Field Type Size (bits) - // Object ID GUID 128 // GUID for Padding object - GETID3_ASF_Padding_Object - // Object Size QWORD 64 // size of Padding object, including 24 bytes of ASF Padding Object header - // Padding Data BYTESTREAM variable // ignore - - // shortcut - $thisfile_asf['padding_object'] = array(); - $thisfile_asf_paddingobject = &$thisfile_asf['padding_object']; - - $thisfile_asf_paddingobject['objectid'] = $NextObjectGUID; - $thisfile_asf_paddingobject['objectid_guid'] = $NextObjectGUIDtext; - $thisfile_asf_paddingobject['objectsize'] = $NextObjectSize; - $thisfile_asf_paddingobject['padding_length'] = $thisfile_asf_paddingobject['objectsize'] - 16 - 8; - $thisfile_asf_paddingobject['padding'] = substr($ASFHeaderData, $offset, $thisfile_asf_paddingobject['padding_length']); - $offset += ($NextObjectSize - 16 - 8); - break; - - case GETID3_ASF_Extended_Content_Encryption_Object: - case GETID3_ASF_Content_Encryption_Object: - // WMA DRM - just ignore - $offset += ($NextObjectSize - 16 - 8); - break; - - default: - // Implementations shall ignore any standard or non-standard object that they do not know how to handle. - if ($this->GUIDname($NextObjectGUIDtext)) { - $ThisFileInfo['warning'][] = 'unhandled GUID "'.$this->GUIDname($NextObjectGUIDtext).'" {'.$NextObjectGUIDtext.'} in ASF header at offset '.($offset - 16 - 8); - } else { - $ThisFileInfo['warning'][] = 'unknown GUID {'.$NextObjectGUIDtext.'} in ASF header at offset '.($offset - 16 - 8); - } - $offset += ($NextObjectSize - 16 - 8); - break; - } - } - if (isset($thisfile_asf_streambitrateproperties['bitrate_records_count'])) { - $ASFbitrateAudio = 0; - $ASFbitrateVideo = 0; - for ($BitrateRecordsCounter = 0; $BitrateRecordsCounter < $thisfile_asf_streambitrateproperties['bitrate_records_count']; $BitrateRecordsCounter++) { - if (isset($thisfile_asf_codeclistobject['codec_entries'][$BitrateRecordsCounter])) { - switch ($thisfile_asf_codeclistobject['codec_entries'][$BitrateRecordsCounter]['type_raw']) { - case 1: - $ASFbitrateVideo += $thisfile_asf_streambitrateproperties['bitrate_records'][$BitrateRecordsCounter]['bitrate']; - break; - - case 2: - $ASFbitrateAudio += $thisfile_asf_streambitrateproperties['bitrate_records'][$BitrateRecordsCounter]['bitrate']; - break; - - default: - // do nothing - break; - } - } - } - if ($ASFbitrateAudio > 0) { - $thisfile_audio['bitrate'] = $ASFbitrateAudio; - } - if ($ASFbitrateVideo > 0) { - $thisfile_video['bitrate'] = $ASFbitrateVideo; - } - } - if (isset($thisfile_asf['stream_properties_object']) && is_array($thisfile_asf['stream_properties_object'])) { - - $thisfile_audio['bitrate'] = 0; - $thisfile_video['bitrate'] = 0; - - foreach ($thisfile_asf['stream_properties_object'] as $streamnumber => $streamdata) { - - switch ($streamdata['stream_type']) { - case GETID3_ASF_Audio_Media: - // Field Name Field Type Size (bits) - // Codec ID / Format Tag WORD 16 // unique ID of audio codec - defined as wFormatTag field of WAVEFORMATEX structure - // Number of Channels WORD 16 // number of channels of audio - defined as nChannels field of WAVEFORMATEX structure - // Samples Per Second DWORD 32 // in Hertz - defined as nSamplesPerSec field of WAVEFORMATEX structure - // Average number of Bytes/sec DWORD 32 // bytes/sec of audio stream - defined as nAvgBytesPerSec field of WAVEFORMATEX structure - // Block Alignment WORD 16 // block size in bytes of audio codec - defined as nBlockAlign field of WAVEFORMATEX structure - // Bits per sample WORD 16 // bits per sample of mono data. set to zero for variable bitrate codecs. defined as wBitsPerSample field of WAVEFORMATEX structure - // Codec Specific Data Size WORD 16 // size in bytes of Codec Specific Data buffer - defined as cbSize field of WAVEFORMATEX structure - // Codec Specific Data BYTESTREAM variable // array of codec-specific data bytes - - // shortcut - $thisfile_asf['audio_media'][$streamnumber] = array(); - $thisfile_asf_audiomedia_currentstream = &$thisfile_asf['audio_media'][$streamnumber]; - - $audiomediaoffset = 0; - - $thisfile_asf_audiomedia_currentstream = getid3_riff::RIFFparseWAVEFORMATex(substr($streamdata['type_specific_data'], $audiomediaoffset, 16)); - $audiomediaoffset += 16; - - $thisfile_audio['lossless'] = false; - switch ($thisfile_asf_audiomedia_currentstream['raw']['wFormatTag']) { - case 0x0001: // PCM - case 0x0163: // WMA9 Lossless - $thisfile_audio['lossless'] = true; - break; - } - - if (!empty($thisfile_asf['stream_bitrate_properties_object']['bitrate_records'])) { - foreach ($thisfile_asf['stream_bitrate_properties_object']['bitrate_records'] as $dummy => $dataarray) { - if (@$dataarray['flags']['stream_number'] == $streamnumber) { - $thisfile_asf_audiomedia_currentstream['bitrate'] = $dataarray['bitrate']; - $thisfile_audio['bitrate'] += $dataarray['bitrate']; - break; - } - } - } else { - if (@$thisfile_asf_audiomedia_currentstream['bytes_sec']) { - $thisfile_audio['bitrate'] += $thisfile_asf_audiomedia_currentstream['bytes_sec'] * 8; - } elseif (@$thisfile_asf_audiomedia_currentstream['bitrate']) { - $thisfile_audio['bitrate'] += $thisfile_asf_audiomedia_currentstream['bitrate']; - } - } - $thisfile_audio['streams'][$streamnumber] = $thisfile_asf_audiomedia_currentstream; - $thisfile_audio['streams'][$streamnumber]['wformattag'] = $thisfile_asf_audiomedia_currentstream['raw']['wFormatTag']; - $thisfile_audio['streams'][$streamnumber]['lossless'] = $thisfile_audio['lossless']; - $thisfile_audio['streams'][$streamnumber]['bitrate'] = $thisfile_audio['bitrate']; - $thisfile_audio['streams'][$streamnumber]['dataformat'] = 'wma'; - unset($thisfile_audio['streams'][$streamnumber]['raw']); - - $thisfile_asf_audiomedia_currentstream['codec_data_size'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $audiomediaoffset, 2)); - $audiomediaoffset += 2; - $thisfile_asf_audiomedia_currentstream['codec_data'] = substr($streamdata['type_specific_data'], $audiomediaoffset, $thisfile_asf_audiomedia_currentstream['codec_data_size']); - $audiomediaoffset += $thisfile_asf_audiomedia_currentstream['codec_data_size']; - - break; - - case GETID3_ASF_Video_Media: - // Field Name Field Type Size (bits) - // Encoded Image Width DWORD 32 // width of image in pixels - // Encoded Image Height DWORD 32 // height of image in pixels - // Reserved Flags BYTE 8 // hardcoded: 0x02 - // Format Data Size WORD 16 // size of Format Data field in bytes - // Format Data array of: variable // - // * Format Data Size DWORD 32 // number of bytes in Format Data field, in bytes - defined as biSize field of BITMAPINFOHEADER structure - // * Image Width LONG 32 // width of encoded image in pixels - defined as biWidth field of BITMAPINFOHEADER structure - // * Image Height LONG 32 // height of encoded image in pixels - defined as biHeight field of BITMAPINFOHEADER structure - // * Reserved WORD 16 // hardcoded: 0x0001 - defined as biPlanes field of BITMAPINFOHEADER structure - // * Bits Per Pixel Count WORD 16 // bits per pixel - defined as biBitCount field of BITMAPINFOHEADER structure - // * Compression ID FOURCC 32 // fourcc of video codec - defined as biCompression field of BITMAPINFOHEADER structure - // * Image Size DWORD 32 // image size in bytes - defined as biSizeImage field of BITMAPINFOHEADER structure - // * Horizontal Pixels / Meter DWORD 32 // horizontal resolution of target device in pixels per meter - defined as biXPelsPerMeter field of BITMAPINFOHEADER structure - // * Vertical Pixels / Meter DWORD 32 // vertical resolution of target device in pixels per meter - defined as biYPelsPerMeter field of BITMAPINFOHEADER structure - // * Colors Used Count DWORD 32 // number of color indexes in the color table that are actually used - defined as biClrUsed field of BITMAPINFOHEADER structure - // * Important Colors Count DWORD 32 // number of color index required for displaying bitmap. if zero, all colors are required. defined as biClrImportant field of BITMAPINFOHEADER structure - // * Codec Specific Data BYTESTREAM variable // array of codec-specific data bytes - - // shortcut - $thisfile_asf['video_media'][$streamnumber] = array(); - $thisfile_asf_videomedia_currentstream = &$thisfile_asf['video_media'][$streamnumber]; - - $videomediaoffset = 0; - $thisfile_asf_videomedia_currentstream['image_width'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 4)); - $videomediaoffset += 4; - $thisfile_asf_videomedia_currentstream['image_height'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 4)); - $videomediaoffset += 4; - $thisfile_asf_videomedia_currentstream['flags'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 1)); - $videomediaoffset += 1; - $thisfile_asf_videomedia_currentstream['format_data_size'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 2)); - $videomediaoffset += 2; - $thisfile_asf_videomedia_currentstream['format_data']['format_data_size'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 4)); - $videomediaoffset += 4; - $thisfile_asf_videomedia_currentstream['format_data']['image_width'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 4)); - $videomediaoffset += 4; - $thisfile_asf_videomedia_currentstream['format_data']['image_height'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 4)); - $videomediaoffset += 4; - $thisfile_asf_videomedia_currentstream['format_data']['reserved'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 2)); - $videomediaoffset += 2; - $thisfile_asf_videomedia_currentstream['format_data']['bits_per_pixel'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 2)); - $videomediaoffset += 2; - $thisfile_asf_videomedia_currentstream['format_data']['codec_fourcc'] = substr($streamdata['type_specific_data'], $videomediaoffset, 4); - $videomediaoffset += 4; - $thisfile_asf_videomedia_currentstream['format_data']['image_size'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 4)); - $videomediaoffset += 4; - $thisfile_asf_videomedia_currentstream['format_data']['horizontal_pels'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 4)); - $videomediaoffset += 4; - $thisfile_asf_videomedia_currentstream['format_data']['vertical_pels'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 4)); - $videomediaoffset += 4; - $thisfile_asf_videomedia_currentstream['format_data']['colors_used'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 4)); - $videomediaoffset += 4; - $thisfile_asf_videomedia_currentstream['format_data']['colors_important'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 4)); - $videomediaoffset += 4; - $thisfile_asf_videomedia_currentstream['format_data']['codec_data'] = substr($streamdata['type_specific_data'], $videomediaoffset); - - if (!empty($thisfile_asf['stream_bitrate_properties_object']['bitrate_records'])) { - foreach ($thisfile_asf['stream_bitrate_properties_object']['bitrate_records'] as $dummy => $dataarray) { - if (@$dataarray['flags']['stream_number'] == $streamnumber) { - $thisfile_asf_videomedia_currentstream['bitrate'] = $dataarray['bitrate']; - $thisfile_video['streams'][$streamnumber]['bitrate'] = $dataarray['bitrate']; - $thisfile_video['bitrate'] += $dataarray['bitrate']; - break; - } - } - } - - $thisfile_asf_videomedia_currentstream['format_data']['codec'] = getid3_riff::RIFFfourccLookup($thisfile_asf_videomedia_currentstream['format_data']['codec_fourcc']); - - $thisfile_video['streams'][$streamnumber]['fourcc'] = $thisfile_asf_videomedia_currentstream['format_data']['codec_fourcc']; - $thisfile_video['streams'][$streamnumber]['codec'] = $thisfile_asf_videomedia_currentstream['format_data']['codec']; - $thisfile_video['streams'][$streamnumber]['resolution_x'] = $thisfile_asf_videomedia_currentstream['image_width']; - $thisfile_video['streams'][$streamnumber]['resolution_y'] = $thisfile_asf_videomedia_currentstream['image_height']; - $thisfile_video['streams'][$streamnumber]['bits_per_sample'] = $thisfile_asf_videomedia_currentstream['format_data']['bits_per_pixel']; - break; - - default: - break; - } - } - } - - while (ftell($fd) < $ThisFileInfo['avdataend']) { - $NextObjectDataHeader = fread($fd, 24); - $offset = 0; - $NextObjectGUID = substr($NextObjectDataHeader, 0, 16); - $offset += 16; - $NextObjectGUIDtext = $this->BytestringToGUID($NextObjectGUID); - $NextObjectSize = getid3_lib::LittleEndian2Int(substr($NextObjectDataHeader, $offset, 8)); - $offset += 8; - - switch ($NextObjectGUID) { - case GETID3_ASF_Data_Object: - // Data Object: (mandatory, one only) - // Field Name Field Type Size (bits) - // Object ID GUID 128 // GUID for Data object - GETID3_ASF_Data_Object - // Object Size QWORD 64 // size of Data object, including 50 bytes of Data Object header. may be 0 if FilePropertiesObject.BroadcastFlag == 1 - // File ID GUID 128 // unique identifier. identical to File ID field in Header Object - // Total Data Packets QWORD 64 // number of Data Packet entries in Data Object. invalid if FilePropertiesObject.BroadcastFlag == 1 - // Reserved WORD 16 // hardcoded: 0x0101 - - // shortcut - $thisfile_asf['data_object'] = array(); - $thisfile_asf_dataobject = &$thisfile_asf['data_object']; - - $DataObjectData = $NextObjectDataHeader.fread($fd, 50 - 24); - $offset = 24; - - $thisfile_asf_dataobject['objectid'] = $NextObjectGUID; - $thisfile_asf_dataobject['objectid_guid'] = $NextObjectGUIDtext; - $thisfile_asf_dataobject['objectsize'] = $NextObjectSize; - - $thisfile_asf_dataobject['fileid'] = substr($DataObjectData, $offset, 16); - $offset += 16; - $thisfile_asf_dataobject['fileid_guid'] = $this->BytestringToGUID($thisfile_asf_dataobject['fileid']); - $thisfile_asf_dataobject['total_data_packets'] = getid3_lib::LittleEndian2Int(substr($DataObjectData, $offset, 8)); - $offset += 8; - $thisfile_asf_dataobject['reserved'] = getid3_lib::LittleEndian2Int(substr($DataObjectData, $offset, 2)); - $offset += 2; - if ($thisfile_asf_dataobject['reserved'] != 0x0101) { - $ThisFileInfo['warning'][] = 'data_object.reserved ('.getid3_lib::PrintHexBytes($thisfile_asf_dataobject['reserved']).') does not match expected value of "0x0101"'; - //return false; - break; - } - - // Data Packets array of: variable // - // * Error Correction Flags BYTE 8 // - // * * Error Correction Data Length bits 4 // if Error Correction Length Type == 00, size of Error Correction Data in bytes, else hardcoded: 0000 - // * * Opaque Data Present bits 1 // - // * * Error Correction Length Type bits 2 // number of bits for size of the error correction data. hardcoded: 00 - // * * Error Correction Present bits 1 // If set, use Opaque Data Packet structure, else use Payload structure - // * Error Correction Data - - $ThisFileInfo['avdataoffset'] = ftell($fd); - fseek($fd, ($thisfile_asf_dataobject['objectsize'] - 50), SEEK_CUR); // skip actual audio/video data - $ThisFileInfo['avdataend'] = ftell($fd); - break; - - case GETID3_ASF_Simple_Index_Object: - // Simple Index Object: (optional, recommended, one per video stream) - // Field Name Field Type Size (bits) - // Object ID GUID 128 // GUID for Simple Index object - GETID3_ASF_Data_Object - // Object Size QWORD 64 // size of Simple Index object, including 56 bytes of Simple Index Object header - // File ID GUID 128 // unique identifier. may be zero or identical to File ID field in Data Object and Header Object - // Index Entry Time Interval QWORD 64 // interval between index entries in 100-nanosecond units - // Maximum Packet Count DWORD 32 // maximum packet count for all index entries - // Index Entries Count DWORD 32 // number of Index Entries structures - // Index Entries array of: variable // - // * Packet Number DWORD 32 // number of the Data Packet associated with this index entry - // * Packet Count WORD 16 // number of Data Packets to sent at this index entry - - // shortcut - $thisfile_asf['simple_index_object'] = array(); - $thisfile_asf_simpleindexobject = &$thisfile_asf['simple_index_object']; - - $SimpleIndexObjectData = $NextObjectDataHeader.fread($fd, 56 - 24); - $offset = 24; - - $thisfile_asf_simpleindexobject['objectid'] = $NextObjectGUID; - $thisfile_asf_simpleindexobject['objectid_guid'] = $NextObjectGUIDtext; - $thisfile_asf_simpleindexobject['objectsize'] = $NextObjectSize; - - $thisfile_asf_simpleindexobject['fileid'] = substr($SimpleIndexObjectData, $offset, 16); - $offset += 16; - $thisfile_asf_simpleindexobject['fileid_guid'] = $this->BytestringToGUID($thisfile_asf_simpleindexobject['fileid']); - $thisfile_asf_simpleindexobject['index_entry_time_interval'] = getid3_lib::LittleEndian2Int(substr($SimpleIndexObjectData, $offset, 8)); - $offset += 8; - $thisfile_asf_simpleindexobject['maximum_packet_count'] = getid3_lib::LittleEndian2Int(substr($SimpleIndexObjectData, $offset, 4)); - $offset += 4; - $thisfile_asf_simpleindexobject['index_entries_count'] = getid3_lib::LittleEndian2Int(substr($SimpleIndexObjectData, $offset, 4)); - $offset += 4; - - $IndexEntriesData = $SimpleIndexObjectData.fread($fd, 6 * $thisfile_asf_simpleindexobject['index_entries_count']); - for ($IndexEntriesCounter = 0; $IndexEntriesCounter < $thisfile_asf_simpleindexobject['index_entries_count']; $IndexEntriesCounter++) { - $thisfile_asf_simpleindexobject['index_entries'][$IndexEntriesCounter]['packet_number'] = getid3_lib::LittleEndian2Int(substr($IndexEntriesData, $offset, 4)); - $offset += 4; - $thisfile_asf_simpleindexobject['index_entries'][$IndexEntriesCounter]['packet_count'] = getid3_lib::LittleEndian2Int(substr($IndexEntriesData, $offset, 4)); - $offset += 2; - } - - break; - - case GETID3_ASF_Index_Object: - // 6.2 ASF top-level Index Object (optional but recommended when appropriate, 0 or 1) - // Field Name Field Type Size (bits) - // Object ID GUID 128 // GUID for the Index Object - GETID3_ASF_Index_Object - // Object Size QWORD 64 // Specifies the size, in bytes, of the Index Object, including at least 34 bytes of Index Object header - // Index Entry Time Interval DWORD 32 // Specifies the time interval between each index entry in ms. - // Index Specifiers Count WORD 16 // Specifies the number of Index Specifiers structures in this Index Object. - // Index Blocks Count DWORD 32 // Specifies the number of Index Blocks structures in this Index Object. - - // Index Entry Time Interval DWORD 32 // Specifies the time interval between index entries in milliseconds. This value cannot be 0. - // Index Specifiers Count WORD 16 // Specifies the number of entries in the Index Specifiers list. Valid values are 1 and greater. - // Index Specifiers array of: varies // - // * Stream Number WORD 16 // Specifies the stream number that the Index Specifiers refer to. Valid values are between 1 and 127. - // * Index Type WORD 16 // Specifies Index Type values as follows: - // 1 = Nearest Past Data Packet - indexes point to the data packet whose presentation time is closest to the index entry time. - // 2 = Nearest Past Media Object - indexes point to the closest data packet containing an entire object or first fragment of an object. - // 3 = 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. - // Index Entry Count DWORD 32 // Specifies the number of Index Entries in the block. - // * Block Positions QWORD varies // Specifies a list of byte offsets of the beginnings of the blocks relative to the beginning of the first Data Packet (i.e., the beginning of the Data Object + 50 bytes). The number of entries in this list is specified by the value of the Index Specifiers Count field. The order of those byte offsets is tied to the order in which Index Specifiers are listed. - // * Index Entries array of: varies // - // * * Offsets DWORD varies // An offset value of 0xffffffff indicates an invalid offset value - - // shortcut - $thisfile_asf['asf_index_object'] = array(); - $thisfile_asf_asfindexobject = &$thisfile_asf['asf_index_object']; - - $ASFIndexObjectData = $NextObjectDataHeader.fread($fd, 34 - 24); - $offset = 24; - - $thisfile_asf_asfindexobject['objectid'] = $NextObjectGUID; - $thisfile_asf_asfindexobject['objectid_guid'] = $NextObjectGUIDtext; - $thisfile_asf_asfindexobject['objectsize'] = $NextObjectSize; - - $thisfile_asf_asfindexobject['entry_time_interval'] = getid3_lib::LittleEndian2Int(substr($ASFIndexObjectData, $offset, 4)); - $offset += 4; - $thisfile_asf_asfindexobject['index_specifiers_count'] = getid3_lib::LittleEndian2Int(substr($ASFIndexObjectData, $offset, 2)); - $offset += 2; - $thisfile_asf_asfindexobject['index_blocks_count'] = getid3_lib::LittleEndian2Int(substr($ASFIndexObjectData, $offset, 4)); - $offset += 4; - - $ASFIndexObjectData .= fread($fd, 4 * $thisfile_asf_asfindexobject['index_specifiers_count']); - for ($IndexSpecifiersCounter = 0; $IndexSpecifiersCounter < $thisfile_asf_asfindexobject['index_specifiers_count']; $IndexSpecifiersCounter++) { - $IndexSpecifierStreamNumber = getid3_lib::LittleEndian2Int(substr($ASFIndexObjectData, $offset, 2)); - $offset += 2; - $thisfile_asf_asfindexobject['index_specifiers'][$IndexSpecifiersCounter]['stream_number'] = $IndexSpecifierStreamNumber; - $thisfile_asf_asfindexobject['index_specifiers'][$IndexSpecifiersCounter]['index_type'] = getid3_lib::LittleEndian2Int(substr($ASFIndexObjectData, $offset, 2)); - $offset += 2; - $thisfile_asf_asfindexobject['index_specifiers'][$IndexSpecifiersCounter]['index_type_text'] = $this->ASFIndexObjectIndexTypeLookup($thisfile_asf_asfindexobject['index_specifiers'][$IndexSpecifiersCounter]['index_type']); - } - - $ASFIndexObjectData .= fread($fd, 4); - $thisfile_asf_asfindexobject['index_entry_count'] = getid3_lib::LittleEndian2Int(substr($ASFIndexObjectData, $offset, 4)); - $offset += 4; - - $ASFIndexObjectData .= fread($fd, 8 * $thisfile_asf_asfindexobject['index_specifiers_count']); - for ($IndexSpecifiersCounter = 0; $IndexSpecifiersCounter < $thisfile_asf_asfindexobject['index_specifiers_count']; $IndexSpecifiersCounter++) { - $thisfile_asf_asfindexobject['block_positions'][$IndexSpecifiersCounter] = getid3_lib::LittleEndian2Int(substr($ASFIndexObjectData, $offset, 8)); - $offset += 8; - } - - $ASFIndexObjectData .= fread($fd, 4 * $thisfile_asf_asfindexobject['index_specifiers_count'] * $thisfile_asf_asfindexobject['index_entry_count']); - for ($IndexEntryCounter = 0; $IndexEntryCounter < $thisfile_asf_asfindexobject['index_entry_count']; $IndexEntryCounter++) { - for ($IndexSpecifiersCounter = 0; $IndexSpecifiersCounter < $thisfile_asf_asfindexobject['index_specifiers_count']; $IndexSpecifiersCounter++) { - $thisfile_asf_asfindexobject['offsets'][$IndexSpecifiersCounter][$IndexEntryCounter] = getid3_lib::LittleEndian2Int(substr($ASFIndexObjectData, $offset, 4)); - $offset += 4; - } - } - break; - - - default: - // Implementations shall ignore any standard or non-standard object that they do not know how to handle. - if ($this->GUIDname($NextObjectGUIDtext)) { - $ThisFileInfo['warning'][] = 'unhandled GUID "'.$this->GUIDname($NextObjectGUIDtext).'" {'.$NextObjectGUIDtext.'} in ASF body at offset '.($offset - 16 - 8); - } else { - $ThisFileInfo['warning'][] = 'unknown GUID {'.$NextObjectGUIDtext.'} in ASF body at offset '.(ftell($fd) - 16 - 8); - } - fseek($fd, ($NextObjectSize - 16 - 8), SEEK_CUR); - break; - } - } - - if (isset($thisfile_asf_codeclistobject['codec_entries']) && is_array($thisfile_asf_codeclistobject['codec_entries'])) { - foreach ($thisfile_asf_codeclistobject['codec_entries'] as $streamnumber => $streamdata) { - switch ($streamdata['information']) { - case 'WMV1': - case 'WMV2': - case 'WMV3': - case 'MSS1': - case 'MSS2': - case 'WMVA': - case 'WVC1': - case 'WMVP': - case 'WVP2': - $thisfile_video['dataformat'] = 'wmv'; - $ThisFileInfo['mime_type'] = 'video/x-ms-wmv'; - break; - - case 'MP42': - case 'MP43': - case 'MP4S': - case 'mp4s': - $thisfile_video['dataformat'] = 'asf'; - $ThisFileInfo['mime_type'] = 'video/x-ms-asf'; - break; - - default: - switch ($streamdata['type_raw']) { - case 1: - if (strstr($this->TrimConvert($streamdata['name']), 'Windows Media')) { - $thisfile_video['dataformat'] = 'wmv'; - if ($ThisFileInfo['mime_type'] == 'video/x-ms-asf') { - $ThisFileInfo['mime_type'] = 'video/x-ms-wmv'; - } - } - break; - - case 2: - if (strstr($this->TrimConvert($streamdata['name']), 'Windows Media')) { - $thisfile_audio['dataformat'] = 'wma'; - if ($ThisFileInfo['mime_type'] == 'video/x-ms-asf') { - $ThisFileInfo['mime_type'] = 'audio/x-ms-wma'; - } - } - break; - - } - break; - } - } - } - - switch (@$thisfile_audio['codec']) { - case 'MPEG Layer-3': - $thisfile_audio['dataformat'] = 'mp3'; - break; - - default: - break; - } - - if (isset($thisfile_asf_codeclistobject['codec_entries'])) { - foreach ($thisfile_asf_codeclistobject['codec_entries'] as $streamnumber => $streamdata) { - switch ($streamdata['type_raw']) { - - case 1: // video - $thisfile_video['encoder'] = $this->TrimConvert($thisfile_asf_codeclistobject['codec_entries'][$streamnumber]['name']); - break; - - case 2: // audio - $thisfile_audio['encoder'] = $this->TrimConvert($thisfile_asf_codeclistobject['codec_entries'][$streamnumber]['name']); - - // AH 2003-10-01 - $thisfile_audio['encoder_options'] = $this->TrimConvert($thisfile_asf_codeclistobject['codec_entries'][0]['description']); - - $thisfile_audio['codec'] = $thisfile_audio['encoder']; - break; - - default: - $ThisFileInfo['warning'][] = 'Unknown streamtype: [codec_list_object][codec_entries]['.$streamnumber.'][type_raw] == '.$streamdata['type_raw']; - break; - - } - } - } - - if (isset($ThisFileInfo['audio'])) { - $thisfile_audio['lossless'] = (isset($thisfile_audio['lossless']) ? $thisfile_audio['lossless'] : false); - $thisfile_audio['dataformat'] = (!empty($thisfile_audio['dataformat']) ? $thisfile_audio['dataformat'] : 'asf'); - } - if (!empty($thisfile_video['dataformat'])) { - $thisfile_video['lossless'] = (isset($thisfile_audio['lossless']) ? $thisfile_audio['lossless'] : false); - $thisfile_video['pixel_aspect_ratio'] = (isset($thisfile_audio['pixel_aspect_ratio']) ? $thisfile_audio['pixel_aspect_ratio'] : (float) 1); - $thisfile_video['dataformat'] = (!empty($thisfile_video['dataformat']) ? $thisfile_video['dataformat'] : 'asf'); - } - if (!empty($thisfile_video['streams'])) { - $thisfile_video['streams']['resolution_x'] = 0; - $thisfile_video['streams']['resolution_y'] = 0; - foreach ($thisfile_video['streams'] as $key => $valuearray) { - if (($valuearray['resolution_x'] > $thisfile_video['streams']['resolution_x']) || ($valuearray['resolution_y'] > $thisfile_video['streams']['resolution_y'])) { - $thisfile_video['resolution_x'] = $valuearray['resolution_x']; - $thisfile_video['resolution_y'] = $valuearray['resolution_y']; - } - } - } - $ThisFileInfo['bitrate'] = @$thisfile_audio['bitrate'] + @$thisfile_video['bitrate']; - - if ((!isset($ThisFileInfo['playtime_seconds']) || ($ThisFileInfo['playtime_seconds'] <= 0)) && ($ThisFileInfo['bitrate'] > 0)) { - $ThisFileInfo['playtime_seconds'] = ($ThisFileInfo['filesize'] - $ThisFileInfo['avdataoffset']) / ($ThisFileInfo['bitrate'] / 8); - } - - return true; - } - - function ASFCodecListObjectTypeLookup($CodecListType) { - static $ASFCodecListObjectTypeLookup = array(); - if (empty($ASFCodecListObjectTypeLookup)) { - $ASFCodecListObjectTypeLookup[0x0001] = 'Video Codec'; - $ASFCodecListObjectTypeLookup[0x0002] = 'Audio Codec'; - $ASFCodecListObjectTypeLookup[0xFFFF] = 'Unknown Codec'; - } - - return (isset($ASFCodecListObjectTypeLookup[$CodecListType]) ? $ASFCodecListObjectTypeLookup[$CodecListType] : 'Invalid Codec Type'); - } - - function KnownGUIDs() { - static $GUIDarray = array(); - if (empty($GUIDarray)) { - $GUIDarray['GETID3_ASF_Extended_Stream_Properties_Object'] = '14E6A5CB-C672-4332-8399-A96952065B5A'; - $GUIDarray['GETID3_ASF_Padding_Object'] = '1806D474-CADF-4509-A4BA-9AABCB96AAE8'; - $GUIDarray['GETID3_ASF_Payload_Ext_Syst_Pixel_Aspect_Ratio'] = '1B1EE554-F9EA-4BC8-821A-376B74E4C4B8'; - $GUIDarray['GETID3_ASF_Script_Command_Object'] = '1EFB1A30-0B62-11D0-A39B-00A0C90348F6'; - $GUIDarray['GETID3_ASF_No_Error_Correction'] = '20FB5700-5B55-11CF-A8FD-00805F5C442B'; - $GUIDarray['GETID3_ASF_Content_Branding_Object'] = '2211B3FA-BD23-11D2-B4B7-00A0C955FC6E'; - $GUIDarray['GETID3_ASF_Content_Encryption_Object'] = '2211B3FB-BD23-11D2-B4B7-00A0C955FC6E'; - $GUIDarray['GETID3_ASF_Digital_Signature_Object'] = '2211B3FC-BD23-11D2-B4B7-00A0C955FC6E'; - $GUIDarray['GETID3_ASF_Extended_Content_Encryption_Object'] = '298AE614-2622-4C17-B935-DAE07EE9289C'; - $GUIDarray['GETID3_ASF_Simple_Index_Object'] = '33000890-E5B1-11CF-89F4-00A0C90349CB'; - $GUIDarray['GETID3_ASF_Degradable_JPEG_Media'] = '35907DE0-E415-11CF-A917-00805F5C442B'; - $GUIDarray['GETID3_ASF_Payload_Extension_System_Timecode'] = '399595EC-8667-4E2D-8FDB-98814CE76C1E'; - $GUIDarray['GETID3_ASF_Binary_Media'] = '3AFB65E2-47EF-40F2-AC2C-70A90D71D343'; - $GUIDarray['GETID3_ASF_Timecode_Index_Object'] = '3CB73FD0-0C4A-4803-953D-EDF7B6228F0C'; - $GUIDarray['GETID3_ASF_Metadata_Library_Object'] = '44231C94-9498-49D1-A141-1D134E457054'; - $GUIDarray['GETID3_ASF_Reserved_3'] = '4B1ACBE3-100B-11D0-A39B-00A0C90348F6'; - $GUIDarray['GETID3_ASF_Reserved_4'] = '4CFEDB20-75F6-11CF-9C0F-00A0C90349CB'; - $GUIDarray['GETID3_ASF_Command_Media'] = '59DACFC0-59E6-11D0-A3AC-00A0C90348F6'; - $GUIDarray['GETID3_ASF_Header_Extension_Object'] = '5FBF03B5-A92E-11CF-8EE3-00C00C205365'; - $GUIDarray['GETID3_ASF_Media_Object_Index_Parameters_Obj'] = '6B203BAD-3F11-4E84-ACA8-D7613DE2CFA7'; - $GUIDarray['GETID3_ASF_Header_Object'] = '75B22630-668E-11CF-A6D9-00AA0062CE6C'; - $GUIDarray['GETID3_ASF_Content_Description_Object'] = '75B22633-668E-11CF-A6D9-00AA0062CE6C'; - $GUIDarray['GETID3_ASF_Error_Correction_Object'] = '75B22635-668E-11CF-A6D9-00AA0062CE6C'; - $GUIDarray['GETID3_ASF_Data_Object'] = '75B22636-668E-11CF-A6D9-00AA0062CE6C'; - $GUIDarray['GETID3_ASF_Web_Stream_Media_Subtype'] = '776257D4-C627-41CB-8F81-7AC7FF1C40CC'; - $GUIDarray['GETID3_ASF_Stream_Bitrate_Properties_Object'] = '7BF875CE-468D-11D1-8D82-006097C9A2B2'; - $GUIDarray['GETID3_ASF_Language_List_Object'] = '7C4346A9-EFE0-4BFC-B229-393EDE415C85'; - $GUIDarray['GETID3_ASF_Codec_List_Object'] = '86D15240-311D-11D0-A3A4-00A0C90348F6'; - $GUIDarray['GETID3_ASF_Reserved_2'] = '86D15241-311D-11D0-A3A4-00A0C90348F6'; - $GUIDarray['GETID3_ASF_File_Properties_Object'] = '8CABDCA1-A947-11CF-8EE4-00C00C205365'; - $GUIDarray['GETID3_ASF_File_Transfer_Media'] = '91BD222C-F21C-497A-8B6D-5AA86BFC0185'; - $GUIDarray['GETID3_ASF_Old_RTP_Extension_Data'] = '96800C63-4C94-11D1-837B-0080C7A37F95'; - $GUIDarray['GETID3_ASF_Advanced_Mutual_Exclusion_Object'] = 'A08649CF-4775-4670-8A16-6E35357566CD'; - $GUIDarray['GETID3_ASF_Bandwidth_Sharing_Object'] = 'A69609E6-517B-11D2-B6AF-00C04FD908E9'; - $GUIDarray['GETID3_ASF_Reserved_1'] = 'ABD3D211-A9BA-11cf-8EE6-00C00C205365'; - $GUIDarray['GETID3_ASF_Bandwidth_Sharing_Exclusive'] = 'AF6060AA-5197-11D2-B6AF-00C04FD908E9'; - $GUIDarray['GETID3_ASF_Bandwidth_Sharing_Partial'] = 'AF6060AB-5197-11D2-B6AF-00C04FD908E9'; - $GUIDarray['GETID3_ASF_JFIF_Media'] = 'B61BE100-5B4E-11CF-A8FD-00805F5C442B'; - $GUIDarray['GETID3_ASF_Stream_Properties_Object'] = 'B7DC0791-A9B7-11CF-8EE6-00C00C205365'; - $GUIDarray['GETID3_ASF_Video_Media'] = 'BC19EFC0-5B4D-11CF-A8FD-00805F5C442B'; - $GUIDarray['GETID3_ASF_Audio_Spread'] = 'BFC3CD50-618F-11CF-8BB2-00AA00B4E220'; - $GUIDarray['GETID3_ASF_Metadata_Object'] = 'C5F8CBEA-5BAF-4877-8467-AA8C44FA4CCA'; - $GUIDarray['GETID3_ASF_Payload_Ext_Syst_Sample_Duration'] = 'C6BD9450-867F-4907-83A3-C77921B733AD'; - $GUIDarray['GETID3_ASF_Group_Mutual_Exclusion_Object'] = 'D1465A40-5A79-4338-B71B-E36B8FD6C249'; - $GUIDarray['GETID3_ASF_Extended_Content_Description_Object'] = 'D2D0A440-E307-11D2-97F0-00A0C95EA850'; - $GUIDarray['GETID3_ASF_Stream_Prioritization_Object'] = 'D4FED15B-88D3-454F-81F0-ED5C45999E24'; - $GUIDarray['GETID3_ASF_Payload_Ext_System_Content_Type'] = 'D590DC20-07BC-436C-9CF7-F3BBFBF1A4DC'; - $GUIDarray['GETID3_ASF_Old_File_Properties_Object'] = 'D6E229D0-35DA-11D1-9034-00A0C90349BE'; - $GUIDarray['GETID3_ASF_Old_ASF_Header_Object'] = 'D6E229D1-35DA-11D1-9034-00A0C90349BE'; - $GUIDarray['GETID3_ASF_Old_ASF_Data_Object'] = 'D6E229D2-35DA-11D1-9034-00A0C90349BE'; - $GUIDarray['GETID3_ASF_Index_Object'] = 'D6E229D3-35DA-11D1-9034-00A0C90349BE'; - $GUIDarray['GETID3_ASF_Old_Stream_Properties_Object'] = 'D6E229D4-35DA-11D1-9034-00A0C90349BE'; - $GUIDarray['GETID3_ASF_Old_Content_Description_Object'] = 'D6E229D5-35DA-11D1-9034-00A0C90349BE'; - $GUIDarray['GETID3_ASF_Old_Script_Command_Object'] = 'D6E229D6-35DA-11D1-9034-00A0C90349BE'; - $GUIDarray['GETID3_ASF_Old_Marker_Object'] = 'D6E229D7-35DA-11D1-9034-00A0C90349BE'; - $GUIDarray['GETID3_ASF_Old_Component_Download_Object'] = 'D6E229D8-35DA-11D1-9034-00A0C90349BE'; - $GUIDarray['GETID3_ASF_Old_Stream_Group_Object'] = 'D6E229D9-35DA-11D1-9034-00A0C90349BE'; - $GUIDarray['GETID3_ASF_Old_Scalable_Object'] = 'D6E229DA-35DA-11D1-9034-00A0C90349BE'; - $GUIDarray['GETID3_ASF_Old_Prioritization_Object'] = 'D6E229DB-35DA-11D1-9034-00A0C90349BE'; - $GUIDarray['GETID3_ASF_Bitrate_Mutual_Exclusion_Object'] = 'D6E229DC-35DA-11D1-9034-00A0C90349BE'; - $GUIDarray['GETID3_ASF_Old_Inter_Media_Dependency_Object'] = 'D6E229DD-35DA-11D1-9034-00A0C90349BE'; - $GUIDarray['GETID3_ASF_Old_Rating_Object'] = 'D6E229DE-35DA-11D1-9034-00A0C90349BE'; - $GUIDarray['GETID3_ASF_Index_Parameters_Object'] = 'D6E229DF-35DA-11D1-9034-00A0C90349BE'; - $GUIDarray['GETID3_ASF_Old_Color_Table_Object'] = 'D6E229E0-35DA-11D1-9034-00A0C90349BE'; - $GUIDarray['GETID3_ASF_Old_Language_List_Object'] = 'D6E229E1-35DA-11D1-9034-00A0C90349BE'; - $GUIDarray['GETID3_ASF_Old_Audio_Media'] = 'D6E229E2-35DA-11D1-9034-00A0C90349BE'; - $GUIDarray['GETID3_ASF_Old_Video_Media'] = 'D6E229E3-35DA-11D1-9034-00A0C90349BE'; - $GUIDarray['GETID3_ASF_Old_Image_Media'] = 'D6E229E4-35DA-11D1-9034-00A0C90349BE'; - $GUIDarray['GETID3_ASF_Old_Timecode_Media'] = 'D6E229E5-35DA-11D1-9034-00A0C90349BE'; - $GUIDarray['GETID3_ASF_Old_Text_Media'] = 'D6E229E6-35DA-11D1-9034-00A0C90349BE'; - $GUIDarray['GETID3_ASF_Old_MIDI_Media'] = 'D6E229E7-35DA-11D1-9034-00A0C90349BE'; - $GUIDarray['GETID3_ASF_Old_Command_Media'] = 'D6E229E8-35DA-11D1-9034-00A0C90349BE'; - $GUIDarray['GETID3_ASF_Old_No_Error_Concealment'] = 'D6E229EA-35DA-11D1-9034-00A0C90349BE'; - $GUIDarray['GETID3_ASF_Old_Scrambled_Audio'] = 'D6E229EB-35DA-11D1-9034-00A0C90349BE'; - $GUIDarray['GETID3_ASF_Old_No_Color_Table'] = 'D6E229EC-35DA-11D1-9034-00A0C90349BE'; - $GUIDarray['GETID3_ASF_Old_SMPTE_Time'] = 'D6E229ED-35DA-11D1-9034-00A0C90349BE'; - $GUIDarray['GETID3_ASF_Old_ASCII_Text'] = 'D6E229EE-35DA-11D1-9034-00A0C90349BE'; - $GUIDarray['GETID3_ASF_Old_Unicode_Text'] = 'D6E229EF-35DA-11D1-9034-00A0C90349BE'; - $GUIDarray['GETID3_ASF_Old_HTML_Text'] = 'D6E229F0-35DA-11D1-9034-00A0C90349BE'; - $GUIDarray['GETID3_ASF_Old_URL_Command'] = 'D6E229F1-35DA-11D1-9034-00A0C90349BE'; - $GUIDarray['GETID3_ASF_Old_Filename_Command'] = 'D6E229F2-35DA-11D1-9034-00A0C90349BE'; - $GUIDarray['GETID3_ASF_Old_ACM_Codec'] = 'D6E229F3-35DA-11D1-9034-00A0C90349BE'; - $GUIDarray['GETID3_ASF_Old_VCM_Codec'] = 'D6E229F4-35DA-11D1-9034-00A0C90349BE'; - $GUIDarray['GETID3_ASF_Old_QuickTime_Codec'] = 'D6E229F5-35DA-11D1-9034-00A0C90349BE'; - $GUIDarray['GETID3_ASF_Old_DirectShow_Transform_Filter'] = 'D6E229F6-35DA-11D1-9034-00A0C90349BE'; - $GUIDarray['GETID3_ASF_Old_DirectShow_Rendering_Filter'] = 'D6E229F7-35DA-11D1-9034-00A0C90349BE'; - $GUIDarray['GETID3_ASF_Old_No_Enhancement'] = 'D6E229F8-35DA-11D1-9034-00A0C90349BE'; - $GUIDarray['GETID3_ASF_Old_Unknown_Enhancement_Type'] = 'D6E229F9-35DA-11D1-9034-00A0C90349BE'; - $GUIDarray['GETID3_ASF_Old_Temporal_Enhancement'] = 'D6E229FA-35DA-11D1-9034-00A0C90349BE'; - $GUIDarray['GETID3_ASF_Old_Spatial_Enhancement'] = 'D6E229FB-35DA-11D1-9034-00A0C90349BE'; - $GUIDarray['GETID3_ASF_Old_Quality_Enhancement'] = 'D6E229FC-35DA-11D1-9034-00A0C90349BE'; - $GUIDarray['GETID3_ASF_Old_Number_of_Channels_Enhancement'] = 'D6E229FD-35DA-11D1-9034-00A0C90349BE'; - $GUIDarray['GETID3_ASF_Old_Frequency_Response_Enhancement'] = 'D6E229FE-35DA-11D1-9034-00A0C90349BE'; - $GUIDarray['GETID3_ASF_Old_Media_Object'] = 'D6E229FF-35DA-11D1-9034-00A0C90349BE'; - $GUIDarray['GETID3_ASF_Mutex_Language'] = 'D6E22A00-35DA-11D1-9034-00A0C90349BE'; - $GUIDarray['GETID3_ASF_Mutex_Bitrate'] = 'D6E22A01-35DA-11D1-9034-00A0C90349BE'; - $GUIDarray['GETID3_ASF_Mutex_Unknown'] = 'D6E22A02-35DA-11D1-9034-00A0C90349BE'; - $GUIDarray['GETID3_ASF_Old_ASF_Placeholder_Object'] = 'D6E22A0E-35DA-11D1-9034-00A0C90349BE'; - $GUIDarray['GETID3_ASF_Old_Data_Unit_Extension_Object'] = 'D6E22A0F-35DA-11D1-9034-00A0C90349BE'; - $GUIDarray['GETID3_ASF_Web_Stream_Format'] = 'DA1E6B13-8359-4050-B398-388E965BF00C'; - $GUIDarray['GETID3_ASF_Payload_Ext_System_File_Name'] = 'E165EC0E-19ED-45D7-B4A7-25CBD1E28E9B'; - $GUIDarray['GETID3_ASF_Marker_Object'] = 'F487CD01-A951-11CF-8EE6-00C00C205365'; - $GUIDarray['GETID3_ASF_Timecode_Index_Parameters_Object'] = 'F55E496D-9797-4B5D-8C8B-604DFE9BFB24'; - $GUIDarray['GETID3_ASF_Audio_Media'] = 'F8699E40-5B4D-11CF-A8FD-00805F5C442B'; - $GUIDarray['GETID3_ASF_Media_Object_Index_Object'] = 'FEB103F8-12AD-4C64-840F-2A1D2F7AD48C'; - $GUIDarray['GETID3_ASF_Alt_Extended_Content_Encryption_Obj'] = 'FF889EF1-ADEE-40DA-9E71-98704BB928CE'; - } - return $GUIDarray; - } - - function GUIDname($GUIDstring) { - static $GUIDarray = array(); - if (empty($GUIDarray)) { - $GUIDarray = $this->KnownGUIDs(); - } - return array_search($GUIDstring, $GUIDarray); - } - - function ASFIndexObjectIndexTypeLookup($id) { - static $ASFIndexObjectIndexTypeLookup = array(); - if (empty($ASFIndexObjectIndexTypeLookup)) { - $ASFIndexObjectIndexTypeLookup[1] = 'Nearest Past Data Packet'; - $ASFIndexObjectIndexTypeLookup[2] = 'Nearest Past Media Object'; - $ASFIndexObjectIndexTypeLookup[3] = 'Nearest Past Cleanpoint'; - } - return (isset($ASFIndexObjectIndexTypeLookup[$id]) ? $ASFIndexObjectIndexTypeLookup[$id] : 'invalid'); - } - - function GUIDtoBytestring($GUIDstring) { - // Microsoft defines these 16-byte (128-bit) GUIDs in the strangest way: - // first 4 bytes are in little-endian order - // next 2 bytes are appended in little-endian order - // next 2 bytes are appended in little-endian order - // next 2 bytes are appended in big-endian order - // next 6 bytes are appended in big-endian order - - // AaBbCcDd-EeFf-GgHh-IiJj-KkLlMmNnOoPp is stored as this 16-byte string: - // $Dd $Cc $Bb $Aa $Ff $Ee $Hh $Gg $Ii $Jj $Kk $Ll $Mm $Nn $Oo $Pp - - $hexbytecharstring = chr(hexdec(substr($GUIDstring, 6, 2))); - $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 4, 2))); - $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 2, 2))); - $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 0, 2))); - - $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 11, 2))); - $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 9, 2))); - - $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 16, 2))); - $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 14, 2))); - - $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 19, 2))); - $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 21, 2))); - - $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 24, 2))); - $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 26, 2))); - $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 28, 2))); - $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 30, 2))); - $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 32, 2))); - $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 34, 2))); - - return $hexbytecharstring; - } - - function BytestringToGUID($Bytestring) { - $GUIDstring = str_pad(dechex(ord($Bytestring{3})), 2, '0', STR_PAD_LEFT); - $GUIDstring .= str_pad(dechex(ord($Bytestring{2})), 2, '0', STR_PAD_LEFT); - $GUIDstring .= str_pad(dechex(ord($Bytestring{1})), 2, '0', STR_PAD_LEFT); - $GUIDstring .= str_pad(dechex(ord($Bytestring{0})), 2, '0', STR_PAD_LEFT); - $GUIDstring .= '-'; - $GUIDstring .= str_pad(dechex(ord($Bytestring{5})), 2, '0', STR_PAD_LEFT); - $GUIDstring .= str_pad(dechex(ord($Bytestring{4})), 2, '0', STR_PAD_LEFT); - $GUIDstring .= '-'; - $GUIDstring .= str_pad(dechex(ord($Bytestring{7})), 2, '0', STR_PAD_LEFT); - $GUIDstring .= str_pad(dechex(ord($Bytestring{6})), 2, '0', STR_PAD_LEFT); - $GUIDstring .= '-'; - $GUIDstring .= str_pad(dechex(ord($Bytestring{8})), 2, '0', STR_PAD_LEFT); - $GUIDstring .= str_pad(dechex(ord($Bytestring{9})), 2, '0', STR_PAD_LEFT); - $GUIDstring .= '-'; - $GUIDstring .= str_pad(dechex(ord($Bytestring{10})), 2, '0', STR_PAD_LEFT); - $GUIDstring .= str_pad(dechex(ord($Bytestring{11})), 2, '0', STR_PAD_LEFT); - $GUIDstring .= str_pad(dechex(ord($Bytestring{12})), 2, '0', STR_PAD_LEFT); - $GUIDstring .= str_pad(dechex(ord($Bytestring{13})), 2, '0', STR_PAD_LEFT); - $GUIDstring .= str_pad(dechex(ord($Bytestring{14})), 2, '0', STR_PAD_LEFT); - $GUIDstring .= str_pad(dechex(ord($Bytestring{15})), 2, '0', STR_PAD_LEFT); - - return strtoupper($GUIDstring); - } - - function FILETIMEtoUNIXtime($FILETIME, $round=true) { - // FILETIME is a 64-bit unsigned integer representing - // the number of 100-nanosecond intervals since January 1, 1601 - // UNIX timestamp is number of seconds since January 1, 1970 - // 116444736000000000 = 10000000 * 60 * 60 * 24 * 365 * 369 + 89 leap days - if ($round) { - return intval(round(($FILETIME - 116444736000000000) / 10000000)); - } - return ($FILETIME - 116444736000000000) / 10000000; - } - - function WMpictureTypeLookup($WMpictureType) { - static $WMpictureTypeLookup = array(); - if (empty($WMpictureTypeLookup)) { - $WMpictureTypeLookup[0x03] = getid3_lib::iconv_fallback('ISO-8859-1', 'UTF-16LE', 'Front Cover'); - $WMpictureTypeLookup[0x04] = getid3_lib::iconv_fallback('ISO-8859-1', 'UTF-16LE', 'Back Cover'); - $WMpictureTypeLookup[0x00] = getid3_lib::iconv_fallback('ISO-8859-1', 'UTF-16LE', 'User Defined'); - $WMpictureTypeLookup[0x05] = getid3_lib::iconv_fallback('ISO-8859-1', 'UTF-16LE', 'Leaflet Page'); - $WMpictureTypeLookup[0x06] = getid3_lib::iconv_fallback('ISO-8859-1', 'UTF-16LE', 'Media Label'); - $WMpictureTypeLookup[0x07] = getid3_lib::iconv_fallback('ISO-8859-1', 'UTF-16LE', 'Lead Artist'); - $WMpictureTypeLookup[0x08] = getid3_lib::iconv_fallback('ISO-8859-1', 'UTF-16LE', 'Artist'); - $WMpictureTypeLookup[0x09] = getid3_lib::iconv_fallback('ISO-8859-1', 'UTF-16LE', 'Conductor'); - $WMpictureTypeLookup[0x0A] = getid3_lib::iconv_fallback('ISO-8859-1', 'UTF-16LE', 'Band'); - $WMpictureTypeLookup[0x0B] = getid3_lib::iconv_fallback('ISO-8859-1', 'UTF-16LE', 'Composer'); - $WMpictureTypeLookup[0x0C] = getid3_lib::iconv_fallback('ISO-8859-1', 'UTF-16LE', 'Lyricist'); - $WMpictureTypeLookup[0x0D] = getid3_lib::iconv_fallback('ISO-8859-1', 'UTF-16LE', 'Recording Location'); - $WMpictureTypeLookup[0x0E] = getid3_lib::iconv_fallback('ISO-8859-1', 'UTF-16LE', 'During Recording'); - $WMpictureTypeLookup[0x0F] = getid3_lib::iconv_fallback('ISO-8859-1', 'UTF-16LE', 'During Performance'); - $WMpictureTypeLookup[0x10] = getid3_lib::iconv_fallback('ISO-8859-1', 'UTF-16LE', 'Video Screen Capture'); - $WMpictureTypeLookup[0x12] = getid3_lib::iconv_fallback('ISO-8859-1', 'UTF-16LE', 'Illustration'); - $WMpictureTypeLookup[0x13] = getid3_lib::iconv_fallback('ISO-8859-1', 'UTF-16LE', 'Band Logotype'); - $WMpictureTypeLookup[0x14] = getid3_lib::iconv_fallback('ISO-8859-1', 'UTF-16LE', 'Publisher Logotype'); - } - return @$WMpictureTypeLookup[$WMpictureType]; - } - - - // Remove terminator 00 00 and convert UNICODE to Latin-1 - function TrimConvert($string) { - - // remove terminator, only if present (it should be, but...) - if (substr($string, strlen($string) - 2, 2) == "\x00\x00") { - $string = substr($string, 0, strlen($string) - 2); - } - - // convert - return trim(getid3_lib::iconv_fallback('UTF-16LE', 'ISO-8859-1', $string), ' '); - } - - - function TrimTerm($string) { - - // remove terminator, only if present (it should be, but...) - if (substr($string, -2) == "\x00\x00") { - $string = substr($string, 0, -2); - } - return $string; - } - - -} - - -?>
\ No newline at end of file diff --git a/getid3/module.audio-video.bink.php b/getid3/module.audio-video.bink.php deleted file mode 100644 index 2ebc6fe..0000000 --- a/getid3/module.audio-video.bink.php +++ /dev/null @@ -1,70 +0,0 @@ -<?php -///////////////////////////////////////////////////////////////// -/// getID3() by James Heinrich <info@getid3.org> // -// available at http://getid3.sourceforge.net // -// or http://www.getid3.org // -///////////////////////////////////////////////////////////////// -// See readme.txt for more details // -///////////////////////////////////////////////////////////////// -// // -// module.audio.bink.php // -// module for analyzing Bink or Smacker audio-video files // -// dependencies: NONE // -// /// -///////////////////////////////////////////////////////////////// - - -class getid3_bink -{ - - function getid3_bink(&$fd, &$ThisFileInfo) { - -$ThisFileInfo['error'][] = 'Bink / Smacker files not properly processed by this version of getID3()'; - - fseek($fd, $ThisFileInfo['avdataoffset'], SEEK_SET); - $fileTypeID = fread($fd, 3); - switch ($fileTypeID) { - case 'BIK': - return $this->ParseBink($fd, $ThisFileInfo); - break; - - case 'SMK': - return $this->ParseSmacker($fd, $ThisFileInfo); - break; - - default: - $ThisFileInfo['error'][] = 'Expecting "BIK" or "SMK" at offset '.$ThisFileInfo['avdataoffset'].', found "'.$fileTypeID.'"'; - return false; - break; - } - - return true; - - } - - function ParseBink(&$fd, &$ThisFileInfo) { - $ThisFileInfo['fileformat'] = 'bink'; - $ThisFileInfo['video']['dataformat'] = 'bink'; - - $fileData = 'BIK'.fread($fd, 13); - - $ThisFileInfo['bink']['data_size'] = getid3_lib::LittleEndian2Int(substr($fileData, 4, 4)); - $ThisFileInfo['bink']['frame_count'] = getid3_lib::LittleEndian2Int(substr($fileData, 8, 2)); - - if (($ThisFileInfo['avdataend'] - $ThisFileInfo['avdataoffset']) != ($ThisFileInfo['bink']['data_size'] + 8)) { - $ThisFileInfo['error'][] = 'Probably truncated file: expecting '.$ThisFileInfo['bink']['data_size'].' bytes, found '.($ThisFileInfo['avdataend'] - $ThisFileInfo['avdataoffset']); - } - - return true; - } - - function ParseSmacker(&$fd, &$ThisFileInfo) { - $ThisFileInfo['fileformat'] = 'smacker'; - $ThisFileInfo['video']['dataformat'] = 'smacker'; - - return false; - } - -} - -?>
\ No newline at end of file diff --git a/getid3/module.audio-video.flv.php b/getid3/module.audio-video.flv.php deleted file mode 100644 index 69c48c1..0000000 --- a/getid3/module.audio-video.flv.php +++ /dev/null @@ -1,505 +0,0 @@ -<?php -///////////////////////////////////////////////////////////////// -/// getID3() by James Heinrich <info@getid3.org> // -// available at http://getid3.sourceforge.net // -// or http://www.getid3.org // -// // -// FLV module by Seth Kaufman <seth@whirl-i-gig.com> // -// // -// * version 0.1 (26 June 2005) // -// // -// minor modifications by James Heinrich <info@getid3.org> // -// * version 0.1.1 (15 July 2005) // -// // -// Support for On2 VP6 codec and meta information // -// by Steve Webster <steve.webster@featurecreep.com> // -// * version 0.2 (22 February 2006) // -// // -// Modified to not read entire file into memory // -// by James Heinrich <info@getid3.org> // -// * version 0.3 (15 June 2006) // -// // -// Bugfixes for incorrectly parsed FLV dimensions // -// and incorrect parsing of onMetaTag // -// by Evgeny Moysevich <moysevich@gmail.com> // -// * version 0.4 (07 December 2007) // -// // -///////////////////////////////////////////////////////////////// -// // -// module.audio-video.flv.php // -// module for analyzing Shockwave Flash Video files // -// dependencies: NONE // -// /// -///////////////////////////////////////////////////////////////// - -define('GETID3_FLV_TAG_AUDIO', 8); -define('GETID3_FLV_TAG_VIDEO', 9); -define('GETID3_FLV_TAG_META', 18); - -define('GETID3_FLV_VIDEO_H263', 2); -define('GETID3_FLV_VIDEO_SCREEN', 3); -define('GETID3_FLV_VIDEO_VP6', 4); - -class getid3_flv -{ - - function getid3_flv(&$fd, &$ThisFileInfo, $ReturnAllTagData=false) { -//$start_time = microtime(true); - fseek($fd, $ThisFileInfo['avdataoffset'], SEEK_SET); - - $FLVdataLength = $ThisFileInfo['avdataend'] - $ThisFileInfo['avdataoffset']; - $FLVheader = fread($fd, 5); - - $ThisFileInfo['fileformat'] = 'flv'; - $ThisFileInfo['flv']['header']['signature'] = substr($FLVheader, 0, 3); - $ThisFileInfo['flv']['header']['version'] = getid3_lib::BigEndian2Int(substr($FLVheader, 3, 1)); - $TypeFlags = getid3_lib::BigEndian2Int(substr($FLVheader, 4, 1)); - - if ($ThisFileInfo['flv']['header']['signature'] != 'FLV') { - $ThisFileInfo['error'][] = 'Expecting "FLV" at offset '.$ThisFileInfo['avdataoffset'].', found "'.$ThisFileInfo['flv']['header']['signature'].'"'; - unset($ThisFileInfo['flv']); - unset($ThisFileInfo['fileformat']); - return false; - } - - $ThisFileInfo['flv']['header']['hasAudio'] = (bool) ($TypeFlags & 0x04); - $ThisFileInfo['flv']['header']['hasVideo'] = (bool) ($TypeFlags & 0x01); - - $FrameSizeDataLength = getid3_lib::BigEndian2Int(fread($fd, 4)); - $FLVheaderFrameLength = 9; - if ($FrameSizeDataLength > $FLVheaderFrameLength) { - fseek($fd, $FrameSizeDataLength - $FLVheaderFrameLength, SEEK_CUR); - } -//echo __LINE__.'='.number_format(microtime(true) - $start_time, 3).'<br>'; - - $Duration = 0; - $found_video = false; - $found_audio = false; - $found_meta = false; - while ((ftell($fd) + 16) < $ThisFileInfo['avdataend']) { - $ThisTagHeader = fread($fd, 16); - - $PreviousTagLength = getid3_lib::BigEndian2Int(substr($ThisTagHeader, 0, 4)); - $TagType = getid3_lib::BigEndian2Int(substr($ThisTagHeader, 4, 1)); - $DataLength = getid3_lib::BigEndian2Int(substr($ThisTagHeader, 5, 3)); - $Timestamp = getid3_lib::BigEndian2Int(substr($ThisTagHeader, 8, 3)); - $LastHeaderByte = getid3_lib::BigEndian2Int(substr($ThisTagHeader, 15, 1)); - $NextOffset = ftell($fd) - 1 + $DataLength; - if ($Timestamp > $Duration) { - $Duration = $Timestamp; - } - -//echo __LINE__.'['.ftell($fd).']=('.$TagType.')='.number_format(microtime(true) - $start_time, 3).'<br>'; - - switch ($TagType) { - case GETID3_FLV_TAG_AUDIO: - if (!$found_audio) { - $found_audio = true; - $ThisFileInfo['flv']['audio']['audioFormat'] = $LastHeaderByte & 0x07; - $ThisFileInfo['flv']['audio']['audioRate'] = ($LastHeaderByte & 0x30) / 0x10; - $ThisFileInfo['flv']['audio']['audioSampleSize'] = ($LastHeaderByte & 0x40) / 0x40; - $ThisFileInfo['flv']['audio']['audioType'] = ($LastHeaderByte & 0x80) / 0x80; - } - break; - - case GETID3_FLV_TAG_VIDEO: - if (!$found_video) { - $found_video = true; - $ThisFileInfo['flv']['video']['videoCodec'] = $LastHeaderByte & 0x07; - - $FLVvideoHeader = fread($fd, 11); - - if ($ThisFileInfo['flv']['video']['videoCodec'] != GETID3_FLV_VIDEO_VP6) { - - $PictureSizeType = (getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 3, 2))) >> 7; - $PictureSizeType = $PictureSizeType & 0x0007; - $ThisFileInfo['flv']['header']['videoSizeType'] = $PictureSizeType; - switch ($PictureSizeType) { - case 0: - //$PictureSizeEnc = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 5, 2)); - //$PictureSizeEnc <<= 1; - //$ThisFileInfo['video']['resolution_x'] = ($PictureSizeEnc & 0xFF00) >> 8; - //$PictureSizeEnc = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 6, 2)); - //$PictureSizeEnc <<= 1; - //$ThisFileInfo['video']['resolution_y'] = ($PictureSizeEnc & 0xFF00) >> 8; - - $PictureSizeEnc['x'] = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 4, 2)); - $PictureSizeEnc['y'] = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 5, 2)); - $PictureSizeEnc['x'] >>= 7; - $PictureSizeEnc['y'] >>= 7; - $ThisFileInfo['video']['resolution_x'] = $PictureSizeEnc['x'] & 0xFF; - $ThisFileInfo['video']['resolution_y'] = $PictureSizeEnc['y'] & 0xFF; - break; - - case 1: - $PictureSizeEnc['x'] = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 4, 3)); - $PictureSizeEnc['y'] = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 6, 3)); - $PictureSizeEnc['x'] >>= 7; - $PictureSizeEnc['y'] >>= 7; - $ThisFileInfo['video']['resolution_x'] = $PictureSizeEnc['x'] & 0xFFFF; - $ThisFileInfo['video']['resolution_y'] = $PictureSizeEnc['y'] & 0xFFFF; - break; - - case 2: - $ThisFileInfo['video']['resolution_x'] = 352; - $ThisFileInfo['video']['resolution_y'] = 288; - break; - - case 3: - $ThisFileInfo['video']['resolution_x'] = 176; - $ThisFileInfo['video']['resolution_y'] = 144; - break; - - case 4: - $ThisFileInfo['video']['resolution_x'] = 128; - $ThisFileInfo['video']['resolution_y'] = 96; - break; - - case 5: - $ThisFileInfo['video']['resolution_x'] = 320; - $ThisFileInfo['video']['resolution_y'] = 240; - break; - - case 6: - $ThisFileInfo['video']['resolution_x'] = 160; - $ThisFileInfo['video']['resolution_y'] = 120; - break; - - default: - $ThisFileInfo['video']['resolution_x'] = 0; - $ThisFileInfo['video']['resolution_y'] = 0; - break; - - } - } - } - break; - - // Meta tag - case GETID3_FLV_TAG_META: - if (!$found_meta) { - $found_meta = true; - fseek($fd, -1, SEEK_CUR); - $reader = new AMFReader(new AMFStream(fread($fd, $DataLength))); - $eventName = $reader->readData(); - $ThisFileInfo['meta'][$eventName] = $reader->readData(); - unset($reader); - - $ThisFileInfo['video']['frame_rate'] = @$ThisFileInfo['meta']['onMetaData']['framerate']; - $ThisFileInfo['video']['resolution_x'] = @$ThisFileInfo['meta']['onMetaData']['width']; - $ThisFileInfo['video']['resolution_y'] = @$ThisFileInfo['meta']['onMetaData']['height']; - } - break; - - default: - // noop - break; - } - - fseek($fd, $NextOffset, SEEK_SET); - } - - if ($ThisFileInfo['playtime_seconds'] = $Duration / 1000) { - $ThisFileInfo['bitrate'] = ($ThisFileInfo['avdataend'] - $ThisFileInfo['avdataoffset']) / $ThisFileInfo['playtime_seconds']; - } - - if ($ThisFileInfo['flv']['header']['hasAudio']) { - $ThisFileInfo['audio']['codec'] = $this->FLVaudioFormat($ThisFileInfo['flv']['audio']['audioFormat']); - $ThisFileInfo['audio']['sample_rate'] = $this->FLVaudioRate($ThisFileInfo['flv']['audio']['audioRate']); - $ThisFileInfo['audio']['bits_per_sample'] = $this->FLVaudioBitDepth($ThisFileInfo['flv']['audio']['audioSampleSize']); - - $ThisFileInfo['audio']['channels'] = $ThisFileInfo['flv']['audio']['audioType'] + 1; // 0=mono,1=stereo - $ThisFileInfo['audio']['lossless'] = ($ThisFileInfo['flv']['audio']['audioFormat'] ? false : true); // 0=uncompressed - $ThisFileInfo['audio']['dataformat'] = 'flv'; - } - if (@$ThisFileInfo['flv']['header']['hasVideo']) { - $ThisFileInfo['video']['codec'] = $this->FLVvideoCodec($ThisFileInfo['flv']['video']['videoCodec']); - $ThisFileInfo['video']['dataformat'] = 'flv'; - $ThisFileInfo['video']['lossless'] = false; - } - - return true; - } - - - function FLVaudioFormat($id) { - $FLVaudioFormat = array( - 0 => 'uncompressed', - 1 => 'ADPCM', - 2 => 'mp3', - 5 => 'Nellymoser 8kHz mono', - 6 => 'Nellymoser', - ); - return (@$FLVaudioFormat[$id] ? @$FLVaudioFormat[$id] : false); - } - - function FLVaudioRate($id) { - $FLVaudioRate = array( - 0 => 5500, - 1 => 11025, - 2 => 22050, - 3 => 44100, - ); - return (@$FLVaudioRate[$id] ? @$FLVaudioRate[$id] : false); - } - - function FLVaudioBitDepth($id) { - $FLVaudioBitDepth = array( - 0 => 8, - 1 => 16, - ); - return (@$FLVaudioBitDepth[$id] ? @$FLVaudioBitDepth[$id] : false); - } - - function FLVvideoCodec($id) { - $FLVvideoCodec = array( - GETID3_FLV_VIDEO_H263 => 'Sorenson H.263', - GETID3_FLV_VIDEO_SCREEN => 'Screen video', - GETID3_FLV_VIDEO_VP6 => 'On2 VP6', - ); - return (@$FLVvideoCodec[$id] ? @$FLVvideoCodec[$id] : false); - } -} - -class AMFStream { - var $bytes; - var $pos; - - function AMFStream(&$bytes) { - $this->bytes =& $bytes; - $this->pos = 0; - } - - function readByte() { - return getid3_lib::BigEndian2Int(substr($this->bytes, $this->pos++, 1)); - } - - function readInt() { - return ($this->readByte() << 8) + $this->readByte(); - } - - function readLong() { - return ($this->readByte() << 24) + ($this->readByte() << 16) + ($this->readByte() << 8) + $this->readByte(); - } - - function readDouble() { - return getid3_lib::BigEndian2Float($this->read(8)); - } - - function readUTF() { - $length = $this->readInt(); - return $this->read($length); - } - - function readLongUTF() { - $length = $this->readLong(); - return $this->read($length); - } - - function read($length) { - $val = substr($this->bytes, $this->pos, $length); - $this->pos += $length; - return $val; - } - - function peekByte() { - $pos = $this->pos; - $val = $this->readByte(); - $this->pos = $pos; - return $val; - } - - function peekInt() { - $pos = $this->pos; - $val = $this->readInt(); - $this->pos = $pos; - return $val; - } - - function peekLong() { - $pos = $this->pos; - $val = $this->readLong(); - $this->pos = $pos; - return $val; - } - - function peekDouble() { - $pos = $this->pos; - $val = $this->readDouble(); - $this->pos = $pos; - return $val; - } - - function peekUTF() { - $pos = $this->pos; - $val = $this->readUTF(); - $this->pos = $pos; - return $val; - } - - function peekLongUTF() { - $pos = $this->pos; - $val = $this->readLongUTF(); - $this->pos = $pos; - return $val; - } -} - -class AMFReader { - var $stream; - - function AMFReader(&$stream) { - $this->stream =& $stream; - } - - function readData() { - $value = null; - - $type = $this->stream->readByte(); - switch ($type) { - - // Double - case 0: - $value = $this->readDouble(); - break; - - // Boolean - case 1: - $value = $this->readBoolean(); - break; - - // String - case 2: - $value = $this->readString(); - break; - - // Object - case 3: - $value = $this->readObject(); - break; - - // null - case 6: - return null; - break; - - // Mixed array - case 8: - $value = $this->readMixedArray(); - break; - - // Array - case 10: - $value = $this->readArray(); - break; - - // Date - case 11: - $value = $this->readDate(); - break; - - // Long string - case 13: - $value = $this->readLongString(); - break; - - // XML (handled as string) - case 15: - $value = $this->readXML(); - break; - - // Typed object (handled as object) - case 16: - $value = $this->readTypedObject(); - break; - - // Long string - default: - $value = '(unknown or unsupported data type)'; - break; - } - - return $value; - } - - function readDouble() { - return $this->stream->readDouble(); - } - - function readBoolean() { - return $this->stream->readByte() == 1; - } - - function readString() { - return $this->stream->readUTF(); - } - - function readObject() { - // Get highest numerical index - ignored -// $highestIndex = $this->stream->readLong(); - - $data = array(); - - while ($key = $this->stream->readUTF()) { - $data[$key] = $this->readData(); - } - // Mixed array record ends with empty string (0x00 0x00) and 0x09 - if (($key == '') && ($this->stream->peekByte() == 0x09)) { - // Consume byte - $this->stream->readByte(); - } - return $data; - } - - function readMixedArray() { - // Get highest numerical index - ignored - $highestIndex = $this->stream->readLong(); - - $data = array(); - - while ($key = $this->stream->readUTF()) { - if (is_numeric($key)) { - $key = (float) $key; - } - $data[$key] = $this->readData(); - } - // Mixed array record ends with empty string (0x00 0x00) and 0x09 - if (($key == '') && ($this->stream->peekByte() == 0x09)) { - // Consume byte - $this->stream->readByte(); - } - - return $data; - } - - function readArray() { - $length = $this->stream->readLong(); - $data = array(); - - for ($i = 0; $i < $length; $i++) { - $data[] = $this->readData(); - } - return $data; - } - - function readDate() { - $timestamp = $this->stream->readDouble(); - $timezone = $this->stream->readInt(); - return $timestamp; - } - - function readLongString() { - return $this->stream->readLongUTF(); - } - - function readXML() { - return $this->stream->readLongUTF(); - } - - function readTypedObject() { - $className = $this->stream->readUTF(); - return $this->readObject(); - } -} - -?>
\ No newline at end of file diff --git a/getid3/module.audio-video.matroska.php b/getid3/module.audio-video.matroska.php deleted file mode 100644 index 004056e..0000000 --- a/getid3/module.audio-video.matroska.php +++ /dev/null @@ -1,1712 +0,0 @@ -<?php -///////////////////////////////////////////////////////////////// -/// getID3() by James Heinrich <info@getid3.org> // -// available at http://getid3.sourceforge.net // -// or http://www.getid3.org // -///////////////////////////////////////////////////////////////// -// See readme.txt for more details // -///////////////////////////////////////////////////////////////// -// // -// module.audio-video.matriska.php // -// module for analyzing Matroska containers // -// dependencies: NONE // -// /// -///////////////////////////////////////////////////////////////// - - -define('EBML_ID_CHAPTERS', 0x0043A770); // [10][43][A7][70] -- A system to define basic menus and partition data. For more detailed information, look at the Chapters Explanation. -define('EBML_ID_SEEKHEAD', 0x014D9B74); // [11][4D][9B][74] -- Contains the position of other level 1 elements. -define('EBML_ID_TAGS', 0x0254C367); // [12][54][C3][67] -- Element containing elements specific to Tracks/Chapters. A list of valid tags can be found here. -define('EBML_ID_INFO', 0x0549A966); // [15][49][A9][66] -- Contains miscellaneous general information and statistics on the file. -define('EBML_ID_TRACKS', 0x0654AE6B); // [16][54][AE][6B] -- A top-level block of information with many tracks described. -define('EBML_ID_SEGMENT', 0x08538067); // [18][53][80][67] -- This element contains all other top-level (level 1) elements. Typically a Matroska file is composed of 1 segment. -define('EBML_ID_ATTACHMENTS', 0x0941A469); // [19][41][A4][69] -- Contain attached files. -define('EBML_ID_EBML', 0x0A45DFA3); // [1A][45][DF][A3] -- Set the EBML characteristics of the data to follow. Each EBML document has to start with this. -define('EBML_ID_CUES', 0x0C53BB6B); // [1C][53][BB][6B] -- A top-level element to speed seeking access. All entries are local to the segment. -define('EBML_ID_CLUSTER', 0x0F43B675); // [1F][43][B6][75] -- The lower level element containing the (monolithic) Block structure. -define('EBML_ID_LANGUAGE', 0x02B59C); // [22][B5][9C] -- Specifies the language of the track in the Matroska languages form. -define('EBML_ID_TRACKTIMECODESCALE', 0x03314F); // [23][31][4F] -- The scale to apply on this track to work at normal speed in relation with other tracks (mostly used to adjust video speed when the audio length differs). -define('EBML_ID_DEFAULTDURATION', 0x03E383); // [23][E3][83] -- Number of nanoseconds (i.e. not scaled) per frame. -define('EBML_ID_CODECNAME', 0x058688); // [25][86][88] -- A human-readable string specifying the codec. -define('EBML_ID_CODECDOWNLOADURL', 0x06B240); // [26][B2][40] -- A URL to download about the codec used. -define('EBML_ID_TIMECODESCALE', 0x0AD7B1); // [2A][D7][B1] -- Timecode scale in nanoseconds (1.000.000 means all timecodes in the segment are expressed in milliseconds). -define('EBML_ID_COLOURSPACE', 0x0EB524); // [2E][B5][24] -- Same value as in AVI (32 bits). -define('EBML_ID_GAMMAVALUE', 0x0FB523); // [2F][B5][23] -- Gamma Value. -define('EBML_ID_CODECSETTINGS', 0x1A9697); // [3A][96][97] -- A string describing the encoding setting used. -define('EBML_ID_CODECINFOURL', 0x1B4040); // [3B][40][40] -- A URL to find information about the codec used. -define('EBML_ID_PREVFILENAME', 0x1C83AB); // [3C][83][AB] -- An escaped filename corresponding to the previous segment. -define('EBML_ID_PREVUID', 0x1CB923); // [3C][B9][23] -- A unique ID to identify the previous chained segment (128 bits). -define('EBML_ID_NEXTFILENAME', 0x1E83BB); // [3E][83][BB] -- An escaped filename corresponding to the next segment. -define('EBML_ID_NEXTUID', 0x1EB923); // [3E][B9][23] -- A unique ID to identify the next chained segment (128 bits). -define('EBML_ID_CONTENTCOMPALGO', 0x0254); // [42][54] -- The compression algorithm used. Algorithms that have been specified so far are: -define('EBML_ID_CONTENTCOMPSETTINGS', 0x0255); // [42][55] -- Settings that might be needed by the decompressor. For Header Stripping (ContentCompAlgo=3), the bytes that were removed from the beggining of each frames of the track. -define('EBML_ID_DOCTYPE', 0x0282); // [42][82] -- A string that describes the type of document that follows this EBML header ('matroska' in our case). -define('EBML_ID_DOCTYPEREADVERSION', 0x0285); // [42][85] -- The minimum DocType version an interpreter has to support to read this file. -define('EBML_ID_EBMLVERSION', 0x0286); // [42][86] -- The version of EBML parser used to create the file. -define('EBML_ID_DOCTYPEVERSION', 0x0287); // [42][87] -- The version of DocType interpreter used to create the file. -define('EBML_ID_EBMLMAXIDLENGTH', 0x02F2); // [42][F2] -- The maximum length of the IDs you'll find in this file (4 or less in Matroska). -define('EBML_ID_EBMLMAXSIZELENGTH', 0x02F3); // [42][F3] -- The maximum length of the sizes you'll find in this file (8 or less in Matroska). This does not override the element size indicated at the beginning of an element. Elements that have an indicated size which is larger than what is allowed by EBMLMaxSizeLength shall be considered invalid. -define('EBML_ID_EBMLREADVERSION', 0x02F7); // [42][F7] -- The minimum EBML version a parser has to support to read this file. -define('EBML_ID_CHAPLANGUAGE', 0x037C); // [43][7C] -- The languages corresponding to the string, in the bibliographic ISO-639-2 form. -define('EBML_ID_CHAPCOUNTRY', 0x037E); // [43][7E] -- The countries corresponding to the string, same 2 octets as in Internet domains. -define('EBML_ID_SEGMENTFAMILY', 0x0444); // [44][44] -- A randomly generated unique ID that all segments related to each other must use (128 bits). -define('EBML_ID_DATEUTC', 0x0461); // [44][61] -- Date of the origin of timecode (value 0), i.e. production date. -define('EBML_ID_TAGLANGUAGE', 0x047A); // [44][7A] -- Specifies the language of the tag specified, in the Matroska languages form. -define('EBML_ID_TAGDEFAULT', 0x0484); // [44][84] -- Indication to know if this is the default/original language to use for the given tag. -define('EBML_ID_TAGBINARY', 0x0485); // [44][85] -- The values of the Tag if it is binary. Note that this cannot be used in the same SimpleTag as TagString. -define('EBML_ID_TAGSTRING', 0x0487); // [44][87] -- The value of the Tag. -define('EBML_ID_DURATION', 0x0489); // [44][89] -- Duration of the segment (based on TimecodeScale). -define('EBML_ID_CHAPPROCESSPRIVATE', 0x050D); // [45][0D] -- Some optional data attached to the ChapProcessCodecID information. For ChapProcessCodecID = 1, it is the "DVD level" equivalent. -define('EBML_ID_CHAPTERFLAGENABLED', 0x0598); // [45][98] -- Specify wether the chapter is enabled. It can be enabled/disabled by a Control Track. When disabled, the movie should skip all the content between the TimeStart and TimeEnd of this chapter. -define('EBML_ID_TAGNAME', 0x05A3); // [45][A3] -- The name of the Tag that is going to be stored. -define('EBML_ID_EDITIONENTRY', 0x05B9); // [45][B9] -- Contains all information about a segment edition. -define('EBML_ID_EDITIONUID', 0x05BC); // [45][BC] -- A unique ID to identify the edition. It's useful for tagging an edition. -define('EBML_ID_EDITIONFLAGHIDDEN', 0x05BD); // [45][BD] -- If an edition is hidden (1), it should not be available to the user interface (but still to Control Tracks). -define('EBML_ID_EDITIONFLAGDEFAULT', 0x05DB); // [45][DB] -- If a flag is set (1) the edition should be used as the default one. -define('EBML_ID_EDITIONFLAGORDERED', 0x05DD); // [45][DD] -- Specify if the chapters can be defined multiple times and the order to play them is enforced. -define('EBML_ID_FILEDATA', 0x065C); // [46][5C] -- The data of the file. -define('EBML_ID_FILEMIMETYPE', 0x0660); // [46][60] -- MIME type of the file. -define('EBML_ID_FILENAME', 0x066E); // [46][6E] -- Filename of the attached file. -define('EBML_ID_FILEREFERRAL', 0x0675); // [46][75] -- A binary value that a track/codec can refer to when the attachment is needed. -define('EBML_ID_FILEDESCRIPTION', 0x067E); // [46][7E] -- A human-friendly name for the attached file. -define('EBML_ID_FILEUID', 0x06AE); // [46][AE] -- Unique ID representing the file, as random as possible. -define('EBML_ID_CONTENTENCALGO', 0x07E1); // [47][E1] -- The encryption algorithm used. The value '0' means that the contents have not been encrypted but only signed. Predefined values: -define('EBML_ID_CONTENTENCKEYID', 0x07E2); // [47][E2] -- For public key algorithms this is the ID of the public key the the data was encrypted with. -define('EBML_ID_CONTENTSIGNATURE', 0x07E3); // [47][E3] -- A cryptographic signature of the contents. -define('EBML_ID_CONTENTSIGKEYID', 0x07E4); // [47][E4] -- This is the ID of the private key the data was signed with. -define('EBML_ID_CONTENTSIGALGO', 0x07E5); // [47][E5] -- The algorithm used for the signature. A value of '0' means that the contents have not been signed but only encrypted. Predefined values: -define('EBML_ID_CONTENTSIGHASHALGO', 0x07E6); // [47][E6] -- The hash algorithm used for the signature. A value of '0' means that the contents have not been signed but only encrypted. Predefined values: -define('EBML_ID_MUXINGAPP', 0x0D80); // [4D][80] -- Muxing application or library ("libmatroska-0.4.3"). -define('EBML_ID_SEEK', 0x0DBB); // [4D][BB] -- Contains a single seek entry to an EBML element. -define('EBML_ID_CONTENTENCODINGORDER', 0x1031); // [50][31] -- Tells when this modification was used during encoding/muxing starting with 0 and counting upwards. The decoder/demuxer has to start with the highest order number it finds and work its way down. This value has to be unique over all ContentEncodingOrder elements in the segment. -define('EBML_ID_CONTENTENCODINGSCOPE', 0x1032); // [50][32] -- A bit field that describes which elements have been modified in this way. Values (big endian) can be OR'ed. Possible values: -define('EBML_ID_CONTENTENCODINGTYPE', 0x1033); // [50][33] -- A value describing what kind of transformation has been done. Possible values: -define('EBML_ID_CONTENTCOMPRESSION', 0x1034); // [50][34] -- Settings describing the compression used. Must be present if the value of ContentEncodingType is 0 and absent otherwise. Each block must be decompressable even if no previous block is available in order not to prevent seeking. -define('EBML_ID_CONTENTENCRYPTION', 0x1035); // [50][35] -- Settings describing the encryption used. Must be present if the value of ContentEncodingType is 1 and absent otherwise. -define('EBML_ID_CUEREFNUMBER', 0x135F); // [53][5F] -- Number of the referenced Block of Track X in the specified Cluster. -define('EBML_ID_NAME', 0x136E); // [53][6E] -- A human-readable track name. -define('EBML_ID_CUEBLOCKNUMBER', 0x1378); // [53][78] -- Number of the Block in the specified Cluster. -define('EBML_ID_TRACKOFFSET', 0x137F); // [53][7F] -- A value to add to the Block's Timecode. This can be used to adjust the playback offset of a track. -define('EBML_ID_SEEKID', 0x13AB); // [53][AB] -- The binary ID corresponding to the element name. -define('EBML_ID_SEEKPOSITION', 0x13AC); // [53][AC] -- The position of the element in the segment in octets (0 = first level 1 element). -define('EBML_ID_STEREOMODE', 0x13B8); // [53][B8] -- Stereo-3D video mode on 2 bits (0: mono, 1: right eye, 2: left eye, 3: both eyes). -define('EBML_ID_PIXELCROPBOTTOM', 0x14AA); // [54][AA] -- The number of video pixels to remove at the bottom of the image (for HDTV content). -define('EBML_ID_DISPLAYWIDTH', 0x14B0); // [54][B0] -- Width of the video frames to display. -define('EBML_ID_DISPLAYUNIT', 0x14B2); // [54][B2] -- Type of the unit for DisplayWidth/Height (0: pixels, 1: centimeters, 2: inches). -define('EBML_ID_ASPECTRATIOTYPE', 0x14B3); // [54][B3] -- Specify the possible modifications to the aspect ratio (0: free resizing, 1: keep aspect ratio, 2: fixed). -define('EBML_ID_DISPLAYHEIGHT', 0x14BA); // [54][BA] -- Height of the video frames to display. -define('EBML_ID_PIXELCROPTOP', 0x14BB); // [54][BB] -- The number of video pixels to remove at the top of the image. -define('EBML_ID_PIXELCROPLEFT', 0x14CC); // [54][CC] -- The number of video pixels to remove on the left of the image. -define('EBML_ID_PIXELCROPRIGHT', 0x14DD); // [54][DD] -- The number of video pixels to remove on the right of the image. -define('EBML_ID_FLAGFORCED', 0x15AA); // [55][AA] -- Set if that track MUST be used during playback. There can be many forced track for a kind (audio, video or subs), the player should select the one which language matches the user preference or the default + forced track. Overlay MAY happen between a forced and non-forced track of the same kind. -define('EBML_ID_MAXBLOCKADDITIONID', 0x15EE); // [55][EE] -- The maximum value of BlockAddID. A value 0 means there is no BlockAdditions for this track. -define('EBML_ID_WRITINGAPP', 0x1741); // [57][41] -- Writing application ("mkvmerge-0.3.3"). -define('EBML_ID_CLUSTERSILENTTRACKS', 0x1854); // [58][54] -- The list of tracks that are not used in that part of the stream. It is useful when using overlay tracks on seeking. Then you should decide what track to use. -define('EBML_ID_CLUSTERSILENTTRACKNUMBER', 0x18D7); // [58][D7] -- One of the track number that are not used from now on in the stream. It could change later if not specified as silent in a further Cluster. -define('EBML_ID_ATTACHEDFILE', 0x21A7); // [61][A7] -- An attached file. -define('EBML_ID_CONTENTENCODING', 0x2240); // [62][40] -- Settings for one content encoding like compression or encryption. -define('EBML_ID_BITDEPTH', 0x2264); // [62][64] -- Bits per sample, mostly used for PCM. -define('EBML_ID_CODECPRIVATE', 0x23A2); // [63][A2] -- Private data only known to the codec. -define('EBML_ID_TARGETS', 0x23C0); // [63][C0] -- Contain all UIDs where the specified meta data apply. It is void to describe everything in the segment. -define('EBML_ID_CHAPTERPHYSICALEQUIV', 0x23C3); // [63][C3] -- Specify the physical equivalent of this ChapterAtom like "DVD" (60) or "SIDE" (50), see complete list of values. -define('EBML_ID_TAGCHAPTERUID', 0x23C4); // [63][C4] -- A unique ID to identify the Chapter(s) the tags belong to. If the value is 0 at this level, the tags apply to all chapters in the Segment. -define('EBML_ID_TAGTRACKUID', 0x23C5); // [63][C5] -- A unique ID to identify the Track(s) the tags belong to. If the value is 0 at this level, the tags apply to all tracks in the Segment. -define('EBML_ID_ATTACHMENTUID', 0x23C6); // [63][C6] -- A unique ID to identify the Attachment(s) the tags belong to. If the value is 0 at this level, the tags apply to all the attachments in the Segment. -define('EBML_ID_TAGEDITIONUID', 0x23C9); // [63][C9] -- A unique ID to identify the EditionEntry(s) the tags belong to. If the value is 0 at this level, the tags apply to all editions in the Segment. -define('EBML_ID_TARGETTYPE', 0x23CA); // [63][CA] -- An informational string that can be used to display the logical level of the target like "ALBUM", "TRACK", "MOVIE", "CHAPTER", etc (see TargetType). -define('EBML_ID_TRACKTRANSLATE', 0x2624); // [66][24] -- The track identification for the given Chapter Codec. -define('EBML_ID_TRACKTRANSLATETRACKID', 0x26A5); // [66][A5] -- The binary value used to represent this track in the chapter codec data. The format depends on the ChapProcessCodecID used. -define('EBML_ID_TRACKTRANSLATECODEC', 0x26BF); // [66][BF] -- The chapter codec using this ID (0: Matroska Script, 1: DVD-menu). -define('EBML_ID_TRACKTRANSLATEEDITIONUID', 0x26FC); // [66][FC] -- Specify an edition UID on which this translation applies. When not specified, it means for all editions found in the segment. -define('EBML_ID_SIMPLETAG', 0x27C8); // [67][C8] -- Contains general information about the target. -define('EBML_ID_TARGETTYPEVALUE', 0x28CA); // [68][CA] -- A number to indicate the logical level of the target (see TargetType). -define('EBML_ID_CHAPPROCESSCOMMAND', 0x2911); // [69][11] -- Contains all the commands associated to the Atom. -define('EBML_ID_CHAPPROCESSTIME', 0x2922); // [69][22] -- Defines when the process command should be handled (0: during the whole chapter, 1: before starting playback, 2: after playback of the chapter). -define('EBML_ID_CHAPTERTRANSLATE', 0x2924); // [69][24] -- A tuple of corresponding ID used by chapter codecs to represent this segment. -define('EBML_ID_CHAPPROCESSDATA', 0x2933); // [69][33] -- Contains the command information. The data should be interpreted depending on the ChapProcessCodecID value. For ChapProcessCodecID = 1, the data correspond to the binary DVD cell pre/post commands. -define('EBML_ID_CHAPPROCESS', 0x2944); // [69][44] -- Contains all the commands associated to the Atom. -define('EBML_ID_CHAPPROCESSCODECID', 0x2955); // [69][55] -- Contains the type of the codec used for the processing. A value of 0 means native Matroska processing (to be defined), a value of 1 means the DVD command set is used. More codec IDs can be added later. -define('EBML_ID_CHAPTERTRANSLATEID', 0x29A5); // [69][A5] -- The binary value used to represent this segment in the chapter codec data. The format depends on the ChapProcessCodecID used. -define('EBML_ID_CHAPTERTRANSLATECODEC', 0x29BF); // [69][BF] -- The chapter codec using this ID (0: Matroska Script, 1: DVD-menu). -define('EBML_ID_CHAPTERTRANSLATEEDITIONUID', 0x29FC); // [69][FC] -- Specify an edition UID on which this correspondance applies. When not specified, it means for all editions found in the segment. -define('EBML_ID_CONTENTENCODINGS', 0x2D80); // [6D][80] -- Settings for several content encoding mechanisms like compression or encryption. -define('EBML_ID_MINCACHE', 0x2DE7); // [6D][E7] -- The minimum number of frames a player should be able to cache during playback. If set to 0, the reference pseudo-cache system is not used. -define('EBML_ID_MAXCACHE', 0x2DF8); // [6D][F8] -- The maximum cache size required to store referenced frames in and the current frame. 0 means no cache is needed. -define('EBML_ID_CHAPTERSEGMENTUID', 0x2E67); // [6E][67] -- A segment to play in place of this chapter. Edition ChapterSegmentEditionUID should be used for this segment, otherwise no edition is used. -define('EBML_ID_CHAPTERSEGMENTEDITIONUID', 0x2EBC); // [6E][BC] -- The edition to play from the segment linked in ChapterSegmentUID. -define('EBML_ID_TRACKOVERLAY', 0x2FAB); // [6F][AB] -- Specify that this track is an overlay track for the Track specified (in the u-integer). That means when this track has a gap (see SilentTracks) the overlay track should be used instead. The order of multiple TrackOverlay matters, the first one is the one that should be used. If not found it should be the second, etc. -define('EBML_ID_TAG', 0x3373); // [73][73] -- Element containing elements specific to Tracks/Chapters. -define('EBML_ID_SEGMENTFILENAME', 0x3384); // [73][84] -- A filename corresponding to this segment. -define('EBML_ID_SEGMENTUID', 0x33A4); // [73][A4] -- A randomly generated unique ID to identify the current segment between many others (128 bits). -define('EBML_ID_CHAPTERUID', 0x33C4); // [73][C4] -- A unique ID to identify the Chapter. -define('EBML_ID_TRACKUID', 0x33C5); // [73][C5] -- A unique ID to identify the Track. This should be kept the same when making a direct stream copy of the Track to another file. -define('EBML_ID_ATTACHMENTLINK', 0x3446); // [74][46] -- The UID of an attachment that is used by this codec. -define('EBML_ID_CLUSTERBLOCKADDITIONS', 0x35A1); // [75][A1] -- Contain additional blocks to complete the main one. An EBML parser that has no knowledge of the Block structure could still see and use/skip these data. -define('EBML_ID_CHANNELPOSITIONS', 0x347B); // [7D][7B] -- Table of horizontal angles for each successive channel, see appendix. -define('EBML_ID_OUTPUTSAMPLINGFREQUENCY', 0x38B5); // [78][B5] -- Real output sampling frequency in Hz (used for SBR techniques). -define('EBML_ID_TITLE', 0x3BA9); // [7B][A9] -- General name of the segment. -define('EBML_ID_CHAPTERDISPLAY', 0x00); // [80] -- Contains all possible strings to use for the chapter display. -define('EBML_ID_TRACKTYPE', 0x03); // [83] -- A set of track types coded on 8 bits (1: video, 2: audio, 3: complex, 0x10: logo, 0x11: subtitle, 0x12: buttons, 0x20: control). -define('EBML_ID_CHAPSTRING', 0x05); // [85] -- Contains the string to use as the chapter atom. -define('EBML_ID_CODECID', 0x06); // [86] -- An ID corresponding to the codec, see the codec page for more info. -define('EBML_ID_FLAGDEFAULT', 0x08); // [88] -- Set if that track (audio, video or subs) SHOULD be used if no language found matches the user preference. -define('EBML_ID_CHAPTERTRACKNUMBER', 0x09); // [89] -- UID of the Track to apply this chapter too. In the absense of a control track, choosing this chapter will select the listed Tracks and deselect unlisted tracks. Absense of this element indicates that the Chapter should be applied to any currently used Tracks. -define('EBML_ID_CLUSTERSLICES', 0x0E); // [8E] -- Contains slices description. -define('EBML_ID_CHAPTERTRACK', 0x0F); // [8F] -- List of tracks on which the chapter applies. If this element is not present, all tracks apply -define('EBML_ID_CHAPTERTIMESTART', 0x11); // [91] -- Timecode of the start of Chapter (not scaled). -define('EBML_ID_CHAPTERTIMEEND', 0x12); // [92] -- Timecode of the end of Chapter (timecode excluded, not scaled). -define('EBML_ID_CUEREFTIME', 0x16); // [96] -- Timecode of the referenced Block. -define('EBML_ID_CUEREFCLUSTER', 0x17); // [97] -- Position of the Cluster containing the referenced Block. -define('EBML_ID_CHAPTERFLAGHIDDEN', 0x18); // [98] -- If a chapter is hidden (1), it should not be available to the user interface (but still to Control Tracks). -define('EBML_ID_FLAGINTERLACED', 0x1A); // [9A] -- Set if the video is interlaced. -define('EBML_ID_CLUSTERBLOCKDURATION', 0x1B); // [9B] -- The duration of the Block (based on TimecodeScale). This element is mandatory when DefaultDuration is set for the track. When not written and with no DefaultDuration, the value is assumed to be the difference between the timecode of this Block and the timecode of the next Block in "display" order (not coding order). This element can be useful at the end of a Track (as there is not other Block available), or when there is a break in a track like for subtitle tracks. -define('EBML_ID_FLAGLACING', 0x1C); // [9C] -- Set if the track may contain blocks using lacing. -define('EBML_ID_CHANNELS', 0x1F); // [9F] -- Numbers of channels in the track. -define('EBML_ID_CLUSTERBLOCKGROUP', 0x20); // [A0] -- Basic container of information containing a single Block or BlockVirtual, and information specific to that Block/VirtualBlock. -define('EBML_ID_CLUSTERBLOCK', 0x21); // [A1] -- Block containing the actual data to be rendered and a timecode relative to the Cluster Timecode. -define('EBML_ID_CLUSTERBLOCKVIRTUAL', 0x22); // [A2] -- A Block with no data. It must be stored in the stream at the place the real Block should be in display order. -define('EBML_ID_CLUSTERSIMPLEBLOCK', 0x23); // [A3] -- Similar to Block but without all the extra information, mostly used to reduced overhead when no extra feature is needed. -define('EBML_ID_CLUSTERCODECSTATE', 0x24); // [A4] -- The new codec state to use. Data interpretation is private to the codec. This information should always be referenced by a seek entry. -define('EBML_ID_CLUSTERBLOCKADDITIONAL', 0x25); // [A5] -- Interpreted by the codec as it wishes (using the BlockAddID). -define('EBML_ID_CLUSTERBLOCKMORE', 0x26); // [A6] -- Contain the BlockAdditional and some parameters. -define('EBML_ID_CLUSTERPOSITION', 0x27); // [A7] -- Position of the Cluster in the segment (0 in live broadcast streams). It might help to resynchronise offset on damaged streams. -define('EBML_ID_CODECDECODEALL', 0x2A); // [AA] -- The codec can decode potentially damaged data. -define('EBML_ID_CLUSTERPREVSIZE', 0x2B); // [AB] -- Size of the previous Cluster, in octets. Can be useful for backward playing. -define('EBML_ID_TRACKENTRY', 0x2E); // [AE] -- Describes a track with all elements. -define('EBML_ID_CLUSTERENCRYPTEDBLOCK', 0x2F); // [AF] -- Similar to SimpleBlock but the data inside the Block are Transformed (encrypt and/or signed). -define('EBML_ID_PIXELWIDTH', 0x30); // [B0] -- Width of the encoded video frames in pixels. -define('EBML_ID_CUETIME', 0x33); // [B3] -- Absolute timecode according to the segment time base. -define('EBML_ID_SAMPLINGFREQUENCY', 0x35); // [B5] -- Sampling frequency in Hz. -define('EBML_ID_CHAPTERATOM', 0x36); // [B6] -- Contains the atom information to use as the chapter atom (apply to all tracks). -define('EBML_ID_CUETRACKPOSITIONS', 0x37); // [B7] -- Contain positions for different tracks corresponding to the timecode. -define('EBML_ID_FLAGENABLED', 0x39); // [B9] -- Set if the track is used. -define('EBML_ID_PIXELHEIGHT', 0x3A); // [BA] -- Height of the encoded video frames in pixels. -define('EBML_ID_CUEPOINT', 0x3B); // [BB] -- Contains all information relative to a seek point in the segment. -define('EBML_ID_CRC32', 0x3F); // [BF] -- The CRC is computed on all the data of the Master element it's in, regardless of its position. It's recommended to put the CRC value at the beggining of the Master element for easier reading. All level 1 elements should include a CRC-32. -define('EBML_ID_CLUSTERBLOCKADDITIONID', 0x4B); // [CB] -- The ID of the BlockAdditional element (0 is the main Block). -define('EBML_ID_CLUSTERLACENUMBER', 0x4C); // [CC] -- The reverse number of the frame in the lace (0 is the last frame, 1 is the next to last, etc). While there are a few files in the wild with this element, it is no longer in use and has been deprecated. Being able to interpret this element is not required for playback. -define('EBML_ID_CLUSTERFRAMENUMBER', 0x4D); // [CD] -- The number of the frame to generate from this lace with this delay (allow you to generate many frames from the same Block/Frame). -define('EBML_ID_CLUSTERDELAY', 0x4E); // [CE] -- The (scaled) delay to apply to the element. -define('EBML_ID_CLUSTERDURATION', 0x4F); // [CF] -- The (scaled) duration to apply to the element. -define('EBML_ID_TRACKNUMBER', 0x57); // [D7] -- The track number as used in the Block Header (using more than 127 tracks is not encouraged, though the design allows an unlimited number). -define('EBML_ID_CUEREFERENCE', 0x5B); // [DB] -- The Clusters containing the required referenced Blocks. -define('EBML_ID_VIDEO', 0x60); // [E0] -- Video settings. -define('EBML_ID_AUDIO', 0x61); // [E1] -- Audio settings. -define('EBML_ID_CLUSTERTIMESLICE', 0x68); // [E8] -- Contains extra time information about the data contained in the Block. While there are a few files in the wild with this element, it is no longer in use and has been deprecated. Being able to interpret this element is not required for playback. -define('EBML_ID_CUECODECSTATE', 0x6A); // [EA] -- The position of the Codec State corresponding to this Cue element. 0 means that the data is taken from the initial Track Entry. -define('EBML_ID_CUEREFCODECSTATE', 0x6B); // [EB] -- The position of the Codec State corresponding to this referenced element. 0 means that the data is taken from the initial Track Entry. -define('EBML_ID_VOID', 0x6C); // [EC] -- Used to void damaged data, to avoid unexpected behaviors when using damaged data. The content is discarded. Also used to reserve space in a sub-element for later use. -define('EBML_ID_CLUSTERTIMECODE', 0x67); // [E7] -- Absolute timecode of the cluster (based on TimecodeScale). -define('EBML_ID_CLUSTERBLOCKADDID', 0x6E); // [EE] -- An ID to identify the BlockAdditional level. -define('EBML_ID_CUECLUSTERPOSITION', 0x71); // [F1] -- The position of the Cluster containing the required Block. -define('EBML_ID_CUETRACK', 0x77); // [F7] -- The track for which a position is given. -define('EBML_ID_CLUSTERREFERENCEPRIORITY', 0x7A); // [FA] -- This frame is referenced and has the specified cache priority. In cache only a frame of the same or higher priority can replace this frame. A value of 0 means the frame is not referenced. -define('EBML_ID_CLUSTERREFERENCEBLOCK', 0x7B); // [FB] -- Timecode of another frame used as a reference (ie: B or P frame). The timecode is relative to the block it's attached to. -define('EBML_ID_CLUSTERREFERENCEVIRTUAL', 0x7D); // [FD] -- Relative position of the data that should be in position of the virtual block. - - -class getid3_matroska -{ - var $read_buffer_size = 32768; // size of read buffer, 32kB is default - var $hide_clusters = true; // if true, do not return information about CLUSTER chunks, since there's a lot of them and they're not usually useful - var $warnings = array(); - - function getid3_matroska(&$fd, &$ThisFileInfo) { - - // http://www.matroska.org/technical/specs/index.html#EBMLBasics - $offset = $ThisFileInfo['avdataoffset']; - $EBMLdata = ''; - $EBMLdata_offset = $offset; - - if ($ThisFileInfo['avdataend'] > 2147483648) { - $this->warnings[] = 'This version of getID3() may or may not correctly handle Matroska files larger than 2GB'; - } - - while ($offset < $ThisFileInfo['avdataend']) { - $this->EnsureBufferHasEnoughData($fd, $EBMLdata, $offset, $EBMLdata_offset); - - $top_element_offset = $offset; - $top_element_id = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset); - $top_element_length = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset); - if ($top_element_length === false) { - $this->warnings[] = 'invalid chunk length at '.$top_element_offset; - $offset = pow(2, 63); - break; - } - $top_element_endoffset = $offset + $top_element_length; - switch ($top_element_id) { - case EBML_ID_EBML: - $ThisFileInfo['fileformat'] = 'matroska'; - $ThisFileInfo['matroska']['header']['offset'] = $top_element_offset; - $ThisFileInfo['matroska']['header']['length'] = $top_element_length; - - while ($offset < $top_element_endoffset) { - $this->EnsureBufferHasEnoughData($fd, $EBMLdata, $offset, $EBMLdata_offset); - $element_data = array(); - $element_data_offset = $offset; - $element_data['id'] = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset); - $element_data['id_name'] = $this->EBMLidName($element_data['id']); - $element_data['length'] = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset); - $end_offset = $offset + $element_data['length']; - - switch ($element_data['id']) { - case EBML_ID_EBMLVERSION: - case EBML_ID_EBMLREADVERSION: - case EBML_ID_EBMLMAXIDLENGTH: - case EBML_ID_EBMLMAXSIZELENGTH: - case EBML_ID_DOCTYPEVERSION: - case EBML_ID_DOCTYPEREADVERSION: - $element_data['data'] = getid3_lib::BigEndian2Int(substr($EBMLdata, $offset - $EBMLdata_offset, $element_data['length'])); - break; - case EBML_ID_DOCTYPE: - $element_data['data'] = trim(substr($EBMLdata, $offset - $EBMLdata_offset, $element_data['length']), "\x00"); - break; - default: - $this->warnings[] = 'Unhandled track.video element['.__LINE__.'] ('.$element_data['id'].'::'.$element_data['id_name'].') at '.$element_data_offset; - break; - } - $offset = $end_offset; - $ThisFileInfo['matroska']['header']['elements'][] = $element_data; - } - break; - - - case EBML_ID_SEGMENT: - $ThisFileInfo['matroska']['segment'][0]['offset'] = $top_element_offset; - $ThisFileInfo['matroska']['segment'][0]['length'] = $top_element_length; - - $segment_key = -1; - while ($offset < $ThisFileInfo['avdataend']) { - $this->EnsureBufferHasEnoughData($fd, $EBMLdata, $offset, $EBMLdata_offset); - - $element_data = array(); - $element_data['offset'] = $offset; - $element_data['id'] = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset); - $element_data['id_name'] = $this->EBMLidName($element_data['id']); - $element_data['length'] = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset); - if ($element_data['length'] === false) { - $this->warnings[] = 'invalid chunk length at '.$element_data['offset']; - //$offset = pow(2, 63); - $offset = $ThisFileInfo['avdataend']; - break; - } - $element_end = $offset + $element_data['length']; - switch ($element_data['id']) { - //case EBML_ID_CLUSTER: - // // too many cluster entries, probably not useful - // break; - case false: - $this->warnings[] = 'invalid ID at '.$element_data['offset']; - $offset = $element_end; - continue 3; - default: - $ThisFileInfo['matroska']['segments'][] = $element_data; - break; - } - $segment_key++; - - switch ($element_data['id']) { - case EBML_ID_SEEKHEAD: // Contains the position of other level 1 elements - while ($offset < $element_end) { - $this->EnsureBufferHasEnoughData($fd, $EBMLdata, $offset, $EBMLdata_offset); - $seek_entry = array(); - $seek_entry['offset'] = $offset; - $seek_entry['id'] = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset); - $seek_entry['id_name'] = $this->EBMLidName($seek_entry['id']); - $seek_entry['length'] = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset); - $seek_end_offset = $offset + $seek_entry['length']; - switch ($seek_entry['id']) { - case EBML_ID_SEEK: // Contains a single seek entry to an EBML element - while ($offset < $seek_end_offset) { - $this->EnsureBufferHasEnoughData($fd, $EBMLdata, $offset, $EBMLdata_offset); - $id = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset); - $length = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset); - $value = substr($EBMLdata, $offset - $EBMLdata_offset, $length); - $offset += $length; - switch ($id) { - case EBML_ID_SEEKID: - $dummy = 0; - $seek_entry['target_id'] = $this->readEBMLint($value, $dummy); - $seek_entry['target_name'] = $this->EBMLidName($seek_entry['target_id']); - break; - case EBML_ID_SEEKPOSITION: - $seek_entry['target_offset'] = $element_data['offset'] + getid3_lib::BigEndian2Int($value); - break; - default: - $ThisFileInfo['error'][] = 'Unhandled segment['.__LINE__.'] ('.$id.') at '.$offset; - break; - } - } - $ThisFileInfo['matroska']['seek'][] = $seek_entry; - //switch ($seek_entry['target_id']) { - // case EBML_ID_CLUSTER: - // // too many cluster seek points, probably not useful - // break; - // default: - // $ThisFileInfo['matroska']['seek'][] = $seek_entry; - // break; - //} - break; - default: - $this->warnings[] = 'Unhandled seekhead element['.__LINE__.'] ('.$seek_entry['id'].') at '.$offset; - break; - } - $offset = $seek_end_offset; - } - break; - - case EBML_ID_TRACKS: // information about all tracks in segment - $ThisFileInfo['matroska']['tracks'] = $element_data; - while ($offset < $element_end) { - $this->EnsureBufferHasEnoughData($fd, $EBMLdata, $offset, $EBMLdata_offset); - $track_entry = array(); - $track_entry['offset'] = $offset; - $track_entry['id'] = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset); - $track_entry['id_name'] = $this->EBMLidName($track_entry['id']); - $track_entry['length'] = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset); - $track_entry_endoffset = $offset + $track_entry['length']; - switch ($track_entry['id']) { - case EBML_ID_TRACKENTRY: //subelements: Describes a track with all elements. - while ($offset < $track_entry_endoffset) { - $this->EnsureBufferHasEnoughData($fd, $EBMLdata, $offset, $EBMLdata_offset); - $subelement_offset = $offset; - $subelement_id = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset); - $subelement_idname = $this->EBMLidName($subelement_id); - $subelement_length = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset); - $subelement_end = $offset + $subelement_length; - switch ($subelement_id) { - case EBML_ID_TRACKNUMBER: - case EBML_ID_TRACKUID: - case EBML_ID_TRACKTYPE: - case EBML_ID_MINCACHE: - case EBML_ID_MAXCACHE: - case EBML_ID_MAXBLOCKADDITIONID: - case EBML_ID_DEFAULTDURATION: // nanoseconds per frame - $track_entry[$subelement_idname] = getid3_lib::BigEndian2Int(substr($EBMLdata, $offset - $EBMLdata_offset, $subelement_length)); - break; - case EBML_ID_TRACKTIMECODESCALE: - $track_entry[$subelement_idname] = getid3_lib::BigEndian2Float(substr($EBMLdata, $offset - $EBMLdata_offset, $subelement_length)); - break; - case EBML_ID_CODECID: - case EBML_ID_LANGUAGE: - case EBML_ID_NAME: - case EBML_ID_CODECPRIVATE: - $track_entry[$subelement_idname] = trim(substr($EBMLdata, $offset - $EBMLdata_offset, $subelement_length), "\x00"); - break; - case EBML_ID_FLAGENABLED: - case EBML_ID_FLAGDEFAULT: - case EBML_ID_FLAGFORCED: - case EBML_ID_FLAGLACING: - case EBML_ID_CODECDECODEALL: - $track_entry[$subelement_idname] = (bool) getid3_lib::BigEndian2Int(substr($EBMLdata, $offset - $EBMLdata_offset, $subelement_length)); - break; - case EBML_ID_VIDEO: - while ($offset < $subelement_end) { - $this->EnsureBufferHasEnoughData($fd, $EBMLdata, $offset, $EBMLdata_offset); - $sub_subelement_offset = $offset; - $sub_subelement_id = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset); - $sub_subelement_idname = $this->EBMLidName($sub_subelement_id); - $sub_subelement_length = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset); - $sub_subelement_end = $offset + $sub_subelement_length; - switch ($sub_subelement_id) { - case EBML_ID_PIXELWIDTH: - case EBML_ID_PIXELHEIGHT: - case EBML_ID_STEREOMODE: - case EBML_ID_PIXELCROPBOTTOM: - case EBML_ID_PIXELCROPTOP: - case EBML_ID_PIXELCROPLEFT: - case EBML_ID_PIXELCROPRIGHT: - case EBML_ID_DISPLAYWIDTH: - case EBML_ID_DISPLAYHEIGHT: - case EBML_ID_DISPLAYUNIT: - case EBML_ID_ASPECTRATIOTYPE: - $track_entry[$sub_subelement_idname] = getid3_lib::BigEndian2Int(substr($EBMLdata, $offset - $EBMLdata_offset, $sub_subelement_length)); - break; - case EBML_ID_FLAGINTERLACED: - $track_entry[$sub_subelement_idname] = (bool) getid3_lib::BigEndian2Int(substr($EBMLdata, $offset - $EBMLdata_offset, $sub_subelement_length)); - break; - case EBML_ID_GAMMAVALUE: - $track_entry[$sub_subelement_idname] = getid3_lib::BigEndian2Float(substr($EBMLdata, $offset - $EBMLdata_offset, $sub_subelement_length)); - break; - case EBML_ID_COLOURSPACE: - $track_entry[$sub_subelement_idname] = trim(substr($EBMLdata, $offset - $EBMLdata_offset, $sub_subelement_length), "\x00"); - break; - default: - $this->warnings[] = 'Unhandled track.video element['.__LINE__.'] ('.$sub_subelement_id.'::'.$sub_subelement_idname.') at '.$sub_subelement_offset; - break; - } - $offset = $sub_subelement_end; - } - - if ((@$track_entry[$this->EBMLidName(EBML_ID_CODECID)] == 'V_MS/VFW/FOURCC') && isset($track_entry[$this->EBMLidName(EBML_ID_CODECPRIVATE)])) { - if (getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio-video.riff.php', __FILE__, false)) { - $track_entry['codec_private_parsed'] = getid3_riff::ParseBITMAPINFOHEADER($track_entry[$this->EBMLidName(EBML_ID_CODECPRIVATE)]); - } else { - $this->warnings[] = 'Unable to parse codec private data['.__LINE__.'] because cannot include "module.audio-video.riff.php"'; - } - } - break; - case EBML_ID_AUDIO: - while ($offset < $subelement_end) { - $this->EnsureBufferHasEnoughData($fd, $EBMLdata, $offset, $EBMLdata_offset); - $sub_subelement_offset = $offset; - $sub_subelement_id = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset); - $sub_subelement_idname = $this->EBMLidName($sub_subelement_id); - $sub_subelement_length = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset); - $sub_subelement_end = $offset + $sub_subelement_length; - switch ($sub_subelement_id) { - case EBML_ID_CHANNELS: - case EBML_ID_BITDEPTH: - $track_entry[$sub_subelement_idname] = getid3_lib::BigEndian2Int(substr($EBMLdata, $offset - $EBMLdata_offset, $sub_subelement_length)); - break; - case EBML_ID_SAMPLINGFREQUENCY: - case EBML_ID_OUTPUTSAMPLINGFREQUENCY: - $track_entry[$sub_subelement_idname] = getid3_lib::BigEndian2Float(substr($EBMLdata, $offset - $EBMLdata_offset, $sub_subelement_length)); - break; - case EBML_ID_CHANNELPOSITIONS: - $track_entry[$sub_subelement_idname] = trim(substr($EBMLdata, $offset - $EBMLdata_offset, $sub_subelement_length), "\x00"); - break; - default: - $this->warnings[] = 'Unhandled track.video element['.__LINE__.'] ('.$sub_subelement_id.'::'.$sub_subelement_idname.') at '.$sub_subelement_offset; - break; - } - $offset = $sub_subelement_end; - } - break; - - case EBML_ID_CONTENTENCODINGS: - while ($offset < $subelement_end) { - $this->EnsureBufferHasEnoughData($fd, $EBMLdata, $offset, $EBMLdata_offset); - $sub_subelement_offset = $offset; - $sub_subelement_id = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset); - $sub_subelement_idname = $this->EBMLidName($sub_subelement_id); - $sub_subelement_length = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset); - $sub_subelement_end = $offset + $sub_subelement_length; - switch ($sub_subelement_id) { - case EBML_ID_CONTENTENCODING: - while ($offset < $sub_subelement_end) { - $this->EnsureBufferHasEnoughData($fd, $EBMLdata, $offset, $EBMLdata_offset); - $sub_sub_subelement_offset = $offset; - $sub_sub_subelement_id = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset); - $sub_sub_subelement_idname = $this->EBMLidName($sub_sub_subelement_id); - $sub_sub_subelement_length = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset); - $sub_sub_subelement_end = $offset + $sub_sub_subelement_length; - switch ($sub_sub_subelement_id) { - case EBML_ID_CONTENTENCODINGORDER: - case EBML_ID_CONTENTENCODINGSCOPE: - case EBML_ID_CONTENTENCODINGTYPE: - $track_entry[$sub_subelement_idname][$sub_sub_subelement_idname] = getid3_lib::BigEndian2Int(substr($EBMLdata, $offset - $EBMLdata_offset, $sub_sub_subelement_length)); - break; - case EBML_ID_CONTENTCOMPRESSION: - while ($offset < $sub_sub_subelement_end) { - $this->EnsureBufferHasEnoughData($fd, $EBMLdata, $offset, $EBMLdata_offset); - $sub_sub_sub_subelement_offset = $offset; - $sub_sub_sub_subelement_id = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset); - $sub_sub_sub_subelement_idname = $this->EBMLidName($sub_sub_subelement_id); - $sub_sub_sub_subelement_length = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset); - $sub_sub_sub_subelement_end = $offset + $sub_sub_sub_subelement_length; - switch ($sub_sub_sub_subelement_id) { - case EBML_ID_CONTENTCOMPALGO: - $track_entry[$sub_subelement_idname][$sub_sub_subelement_idname][$sub_sub_sub_subelement_idname] = getid3_lib::BigEndian2Int(substr($EBMLdata, $offset - $EBMLdata_offset, $sub_sub_sub_subelement_length)); - break; - case EBML_ID_CONTENTCOMPSETTINGS: - $track_entry[$sub_subelement_idname][$sub_sub_subelement_idname][$sub_sub_sub_subelement_idname] = substr($EBMLdata, $offset - $EBMLdata_offset, $sub_sub_sub_subelement_length); - break; - default: - $this->warnings[] = 'Unhandled track.contentencodings.contentencoding.contentcompression element['.__LINE__.'] ('.$subelement_id.'::'.$subelement_idname.' ['.$subelement_length.' bytes]) at '.$subelement_offset; - break; - } - $offset = $sub_sub_sub_subelement_end; - } - break; - - case EBML_ID_CONTENTENCRYPTION: - while ($offset < $sub_sub_subelement_end) { - $this->EnsureBufferHasEnoughData($fd, $EBMLdata, $offset, $EBMLdata_offset); - $sub_sub_sub_subelement_offset = $offset; - $sub_sub_sub_subelement_id = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset); - $sub_sub_sub_subelement_idname = $this->EBMLidName($sub_sub_subelement_id); - $sub_sub_sub_subelement_length = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset); - $sub_sub_sub_subelement_end = $offset + $sub_sub_sub_subelement_length; - switch ($sub_sub_sub_subelement_id) { - case EBML_ID_CONTENTENCALGO: - case EBML_ID_CONTENTSIGALGO: - case EBML_ID_CONTENTSIGHASHALGO: - $track_entry[$sub_subelement_idname][$sub_sub_subelement_idname][$sub_sub_sub_subelement_idname] = getid3_lib::BigEndian2Int(substr($EBMLdata, $offset - $EBMLdata_offset, $sub_sub_sub_subelement_length)); - break; - case EBML_ID_CONTENTENCKEYID: - case EBML_ID_CONTENTSIGNATURE: - case EBML_ID_CONTENTSIGKEYID: - $track_entry[$sub_subelement_idname][$sub_sub_subelement_idname][$sub_sub_sub_subelement_idname] = substr($EBMLdata, $offset - $EBMLdata_offset, $sub_sub_sub_subelement_length); - break; - default: - $this->warnings[] = 'Unhandled track.contentencodings.contentencoding.contentcompression element['.__LINE__.'] ('.$subelement_id.'::'.$subelement_idname.' ['.$subelement_length.' bytes]) at '.$subelement_offset; - break; - } - $offset = $sub_sub_sub_subelement_end; - } - break; - - default: - $this->warnings[] = 'Unhandled track.contentencodings.contentencoding element['.__LINE__.'] ('.$subelement_id.'::'.$subelement_idname.' ['.$subelement_length.' bytes]) at '.$subelement_offset; - break; - } - $offset = $sub_sub_subelement_end; - } - break; - default: - $this->warnings[] = 'Unhandled track.contentencodings element['.__LINE__.'] ('.$subelement_id.'::'.$subelement_idname.' ['.$subelement_length.' bytes]) at '.$subelement_offset; - break; - } - $offset = $sub_subelement_end; - } - break; - - default: - $this->warnings[] = 'Unhandled track element['.__LINE__.'] ('.$subelement_id.'::'.$subelement_idname.' ['.$subelement_length.' bytes]) at '.$subelement_offset; - break; - } - $offset = $subelement_end; - } - break; - default: - $this->warnings[] = 'Unhandled track element['.__LINE__.'] ('.$track_entry['id'].'::'.$track_entry['id_name'].') at '.$track_entry['offset']; - $offset = $track_entry_endoffset; - break; - } - $ThisFileInfo['matroska']['tracks']['tracks'][] = $track_entry; - } - break; - - case EBML_ID_INFO: // Contains the position of other level 1 elements - $info_entry = array(); - while ($offset < $element_end) { - $this->EnsureBufferHasEnoughData($fd, $EBMLdata, $offset, $EBMLdata_offset); - $subelement_offset = $offset; - $subelement_id = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset); - $subelement_idname = $this->EBMLidName($subelement_id); - $subelement_length = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset); - $subelement_end = $offset + $subelement_length; - switch ($subelement_id) { - case EBML_ID_CHAPTERTRANSLATEEDITIONUID: - case EBML_ID_CHAPTERTRANSLATECODEC: - case EBML_ID_TIMECODESCALE: - $info_entry[$subelement_idname] = getid3_lib::BigEndian2Int(substr($EBMLdata, $offset - $EBMLdata_offset, $subelement_length)); - break; - case EBML_ID_DURATION: - $info_entry[$subelement_idname] = getid3_lib::BigEndian2Float(substr($EBMLdata, $offset - $EBMLdata_offset, $subelement_length)); - break; - case EBML_ID_DATEUTC: - $info_entry[$subelement_idname] = getid3_lib::BigEndian2Int(substr($EBMLdata, $offset - $EBMLdata_offset, $subelement_length)); - $info_entry[$subelement_idname.'_unix'] = $this->EBMLdate2unix($info_entry[$subelement_idname]); - break; - case EBML_ID_SEGMENTUID: - case EBML_ID_PREVUID: - case EBML_ID_NEXTUID: - case EBML_ID_SEGMENTFAMILY: - case EBML_ID_CHAPTERTRANSLATEID: - $info_entry[$subelement_idname] = trim(substr($EBMLdata, $offset - $EBMLdata_offset, $subelement_length), "\x00"); - break; - case EBML_ID_SEGMENTFILENAME: - case EBML_ID_PREVFILENAME: - case EBML_ID_NEXTFILENAME: - case EBML_ID_TITLE: - case EBML_ID_MUXINGAPP: - case EBML_ID_WRITINGAPP: - $info_entry[$subelement_idname] = trim(substr($EBMLdata, $offset - $EBMLdata_offset, $subelement_length), "\x00"); - break; - default: - $this->warnings[] = 'Unhandled info element['.__LINE__.'] ('.$subelement_id.'::'.$subelement_idname.' ['.$subelement_length.' bytes]) at '.$subelement_offset; - break; - } - $offset = $subelement_end; - } - $ThisFileInfo['matroska']['info'][] = $info_entry; - break; - - case EBML_ID_CUES: - $cues_entry = array(); - while ($offset < $element_end) { - $this->EnsureBufferHasEnoughData($fd, $EBMLdata, $offset, $EBMLdata_offset); - $subelement_offset = $offset; - $subelement_id = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset); - $subelement_idname = $this->EBMLidName($subelement_id); - $subelement_length = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset); - $subelement_end = $offset + $subelement_length; - switch ($subelement_id) { - case EBML_ID_CUEPOINT: - $cuepoint_entry = array(); - while ($offset < $subelement_end) { - $this->EnsureBufferHasEnoughData($fd, $EBMLdata, $offset, $EBMLdata_offset); - $sub_subelement_offset = $offset; - $sub_subelement_id = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset); - $sub_subelement_idname = $this->EBMLidName($sub_subelement_id); - $sub_subelement_length = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset); - $sub_subelement_end = $offset + $sub_subelement_length; - switch ($sub_subelement_id) { - case EBML_ID_CUETRACKPOSITIONS: - while ($offset < $sub_subelement_end) { - $this->EnsureBufferHasEnoughData($fd, $EBMLdata, $offset, $EBMLdata_offset); - $sub_sub_subelement_offset = $offset; - $sub_sub_subelement_id = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset); - $sub_sub_subelement_idname = $this->EBMLidName($sub_sub_subelement_id); - $sub_sub_subelement_length = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset); - $sub_sub_subelement_end = $offset + $sub_sub_subelement_length; - switch ($sub_sub_subelement_id) { - case EBML_ID_CUETRACK: - $cuepoint_entry[$sub_sub_subelement_idname] = getid3_lib::BigEndian2Int(substr($EBMLdata, $offset - $EBMLdata_offset, $sub_sub_subelement_length)); - break; - default: - $this->warnings[] = 'Unhandled cues.cuepoint.cuetrackpositions element['.__LINE__.'] ('.$sub_sub_subelement_id.'::'.$sub_sub_subelement_idname.') at '.$sub_sub_subelement_offset; - break; - } - $offset = $sub_subelement_end; - } - break; - case EBML_ID_CUETIME: - $cuepoint_entry[$subelement_idname] = getid3_lib::BigEndian2Int(substr($EBMLdata, $offset - $EBMLdata_offset, $sub_subelement_length)); - break; - default: - $this->warnings[] = 'Unhandled cues.cuepoint element['.__LINE__.'] ('.$sub_subelement_id.'::'.$sub_subelement_idname.') at '.$sub_subelement_offset; - break; - } - $offset = $sub_subelement_end; - } - $cues_entry[] = $cuepoint_entry; - $offset = $sub_subelement_end; - break; - default: - $this->warnings[] = 'Unhandled cues element['.__LINE__.'] ('.$subelement_id.'::'.$subelement_idname.' ['.$subelement_length.' bytes]) at '.$subelement_offset; - break; - } - $offset = $subelement_end; - } - $ThisFileInfo['matroska']['cues'] = $cues_entry; - break; - - case EBML_ID_TAGS: - $tags_entry = array(); - while ($offset < $element_end) { - $this->EnsureBufferHasEnoughData($fd, $EBMLdata, $offset, $EBMLdata_offset); - $subelement_offset = $offset; - $subelement_id = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset); - $subelement_idname = $this->EBMLidName($subelement_id); - $subelement_length = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset); - $subelement_end = $offset + $subelement_length; - switch ($subelement_id) { - case EBML_ID_WRITINGAPP: - $tags_entry[$subelement_idname] = substr($EBMLdata, $offset - $EBMLdata_offset, $subelement_length); - break; - case EBML_ID_TAG: - $tag_entry = array(); - while ($offset < $subelement_end) { - $this->EnsureBufferHasEnoughData($fd, $EBMLdata, $offset, $EBMLdata_offset); - $sub_subelement_offset = $offset; - $sub_subelement_id = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset); - $sub_subelement_idname = $this->EBMLidName($sub_subelement_id); - $sub_subelement_length = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset); - $sub_subelement_end = $offset + $sub_subelement_length; - switch ($sub_subelement_id) { - case EBML_ID_TARGETS: - $targets_entry = array(); - while ($offset < $sub_subelement_end) { - $this->EnsureBufferHasEnoughData($fd, $EBMLdata, $offset, $EBMLdata_offset); - $sub_sub_subelement_offset = $offset; - $sub_sub_subelement_id = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset); - $sub_sub_subelement_idname = $this->EBMLidName($sub_sub_subelement_id); - $sub_sub_subelement_length = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset); - $sub_sub_subelement_end = $offset + $sub_sub_subelement_length; - switch ($sub_sub_subelement_id) { - case EBML_ID_TARGETTYPEVALUE: - case EBML_ID_EDITIONUID: - case EBML_ID_CHAPTERUID: - case EBML_ID_ATTACHMENTUID: - case EBML_ID_TAGTRACKUID: - case EBML_ID_TAGCHAPTERUID: - $targets_entry[$sub_sub_subelement_idname] = getid3_lib::BigEndian2Int(substr($EBMLdata, $offset - $EBMLdata_offset, $sub_sub_subelement_length)); - break; - default: - $this->warnings[] = 'Unhandled tag.targets element['.__LINE__.'] ('.$sub_sub_subelement_id.'::'.$sub_sub_subelement_idname.') at '.$sub_sub_subelement_offset; - break; - } - $offset = $sub_sub_subelement_end; - } - $tag_entry[$sub_subelement_idname][] = $targets_entry; - break; - case EBML_ID_SIMPLETAG: - $simpletag_entry = array(); - while ($offset < $sub_subelement_end) { - $this->EnsureBufferHasEnoughData($fd, $EBMLdata, $offset, $EBMLdata_offset); - $sub_sub_subelement_offset = $offset; - $sub_sub_subelement_id = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset); - $sub_sub_subelement_idname = $this->EBMLidName($sub_sub_subelement_id); - $sub_sub_subelement_length = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset); - $sub_sub_subelement_end = $offset + $sub_sub_subelement_length; - switch ($sub_sub_subelement_id) { - case EBML_ID_TAGNAME: - case EBML_ID_TAGLANGUAGE: - case EBML_ID_TAGSTRING: - case EBML_ID_TAGBINARY: - $simpletag_entry[$sub_sub_subelement_idname] = substr($EBMLdata, $offset - $EBMLdata_offset, $sub_sub_subelement_length); - break; - case EBML_ID_TAGDEFAULT: - $simpletag_entry[$sub_sub_subelement_idname] = (bool) getid3_lib::BigEndian2Int(substr($EBMLdata, $offset - $EBMLdata_offset, $sub_sub_subelement_length)); - break; - default: - $this->warnings[] = 'Unhandled tag.simpletag element['.__LINE__.'] ('.$sub_sub_subelement_id.'::'.$sub_sub_subelement_idname.') at '.$sub_sub_subelement_offset; - break; - } - $offset = $sub_sub_subelement_end; - } - $tag_entry[$sub_subelement_idname][] = $simpletag_entry; - break; - case EBML_ID_TARGETTYPE: - $tag_entry[$sub_subelement_idname] = substr($EBMLdata, $offset - $EBMLdata_offset, $sub_subelement_length); - break; - case EBML_ID_TRACKUID: - $tag_entry[$sub_subelement_idname] = getid3_lib::BigEndian2Int(substr($EBMLdata, $offset - $EBMLdata_offset, $sub_subelement_length)); - break; - default: - $this->warnings[] = 'Unhandled tags.tag element['.__LINE__.'] ('.$sub_subelement_id.'::'.$sub_subelement_idname.') at '.$sub_subelement_offset; - break; - } - $offset = $sub_subelement_end; - } - $tags_entry['tags'][] = $tag_entry; - $offset = $sub_subelement_end; - break; - default: - $this->warnings[] = 'Unhandled tags element['.__LINE__.'] ('.$subelement_id.'::'.$subelement_idname.' ['.$subelement_length.' bytes]) at '.$subelement_offset; - break; - } - $offset = $subelement_end; - } - $ThisFileInfo['matroska']['tags'] = $tags_entry; - break; - - - case EBML_ID_ATTACHMENTS: - while ($offset < $element_end) { - $this->EnsureBufferHasEnoughData($fd, $EBMLdata, $offset, $EBMLdata_offset); - $subelement_offset = $offset; - $subelement_id = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset); - $subelement_idname = $this->EBMLidName($subelement_id); - $subelement_length = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset); - $subelement_end = $offset + $subelement_length; - switch ($subelement_id) { - case EBML_ID_ATTACHEDFILE: - $attachedfile_entry = array(); - while ($offset < $subelement_end) { - $this->EnsureBufferHasEnoughData($fd, $EBMLdata, $offset, $EBMLdata_offset); - $sub_subelement_offset = $offset; - $sub_subelement_id = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset); - $sub_subelement_idname = $this->EBMLidName($sub_subelement_id); - $sub_subelement_length = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset); - $sub_subelement_end = $offset + $sub_subelement_length; - switch ($sub_subelement_id) { - case EBML_ID_FILEDESCRIPTION: - case EBML_ID_FILENAME: - case EBML_ID_FILEMIMETYPE: - $attachedfile_entry[$sub_subelement_idname] = substr($EBMLdata, $offset - $EBMLdata_offset, $sub_subelement_length); - break; - - case EBML_ID_FILEDATA: - $attachedfile_entry['data_offset'] = $offset; - $attachedfile_entry['data_length'] = $sub_subelement_length; - if ($sub_subelement_length < 1024) { - $attachedfile_entry[$sub_subelement_idname] = substr($EBMLdata, $offset - $EBMLdata_offset, $sub_subelement_length); - } - break; - - case EBML_ID_FILEUID: - $attachedfile_entry[$sub_subelement_idname] = getid3_lib::BigEndian2Int(substr($EBMLdata, $offset - $EBMLdata_offset, $sub_subelement_length)); - break; - - default: - $this->warnings[] = 'Unhandled attachment.attachedfile element['.__LINE__.'] ('.$sub_subelement_id.'::'.$sub_subelement_idname.') at '.$sub_subelement_offset; - break; - } - $offset = $sub_subelement_end; - } - $ThisFileInfo['matroska']['attachments'][] = $attachedfile_entry; - $offset = $sub_subelement_end; - break; - default: - $this->warnings[] = 'Unhandled tags element['.__LINE__.'] ('.$subelement_id.'::'.$subelement_idname.' ['.$subelement_length.' bytes]) at '.$subelement_offset; - break; - } - $offset = $subelement_end; - } - break; - - - case EBML_ID_CHAPTERS: // not important to us, contains mostly actual audio/video data, ignore - while ($offset < $element_end) { - $this->EnsureBufferHasEnoughData($fd, $EBMLdata, $offset, $EBMLdata_offset); - $subelement_offset = $offset; - $subelement_id = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset); - $subelement_idname = $this->EBMLidName($subelement_id); - $subelement_length = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset); - $subelement_end = $offset + $subelement_length; - switch ($subelement_id) { - case EBML_ID_EDITIONENTRY: - $editionentry_entry = array(); - while ($offset < $subelement_end) { - $this->EnsureBufferHasEnoughData($fd, $EBMLdata, $offset, $EBMLdata_offset); - $sub_subelement_offset = $offset; - $sub_subelement_id = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset); - $sub_subelement_idname = $this->EBMLidName($sub_subelement_id); - $sub_subelement_length = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset); - $sub_subelement_end = $offset + $sub_subelement_length; - switch ($sub_subelement_id) { - case EBML_ID_EDITIONUID: - $editionentry_entry[$sub_subelement_idname] = getid3_lib::BigEndian2Int(substr($EBMLdata, $offset - $EBMLdata_offset, $sub_subelement_length)); - break; - case EBML_ID_EDITIONFLAGHIDDEN: - case EBML_ID_EDITIONFLAGDEFAULT: - case EBML_ID_EDITIONFLAGORDERED: - $editionentry_entry[$sub_subelement_idname] = (bool) getid3_lib::BigEndian2Int(substr($EBMLdata, $offset - $EBMLdata_offset, $sub_subelement_length)); - break; - case EBML_ID_CHAPTERATOM: - $chapteratom_entry = array(); - while ($offset < $sub_subelement_end) { - $this->EnsureBufferHasEnoughData($fd, $EBMLdata, $offset, $EBMLdata_offset); - $sub_sub_subelement_offset = $offset; - $sub_sub_subelement_id = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset); - $sub_sub_subelement_idname = $this->EBMLidName($sub_sub_subelement_id); - $sub_sub_subelement_length = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset); - $sub_sub_subelement_end = $offset + $sub_sub_subelement_length; - switch ($sub_sub_subelement_id) { - case EBML_ID_CHAPTERSEGMENTUID: - case EBML_ID_CHAPTERSEGMENTEDITIONUID: - $chapteratom_entry[$sub_sub_subelement_idname] = substr($EBMLdata, $offset - $EBMLdata_offset, $sub_sub_subelement_length); - break; - case EBML_ID_CHAPTERFLAGENABLED: - case EBML_ID_CHAPTERFLAGHIDDEN: - $chapteratom_entry[$sub_sub_subelement_idname] = (bool) getid3_lib::BigEndian2Int(substr($EBMLdata, $offset - $EBMLdata_offset, $sub_sub_subelement_length)); - break; - case EBML_ID_CHAPTERUID: - case EBML_ID_CHAPTERTIMESTART: - case EBML_ID_CHAPTERTIMEEND: - $chapteratom_entry[$sub_sub_subelement_idname] = getid3_lib::BigEndian2Int(substr($EBMLdata, $offset - $EBMLdata_offset, $sub_sub_subelement_length)); - break; - case EBML_ID_CHAPTERTRACK: - $chaptertrack_entry = array(); - while ($offset < $sub_sub_subelement_end) { - $this->EnsureBufferHasEnoughData($fd, $EBMLdata, $offset, $EBMLdata_offset); - $sub_sub_sub_subelement_offset = $offset; - $sub_sub_sub_subelement_id = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset); - $sub_sub_sub_subelement_idname = $this->EBMLidName($sub_sub_subelement_id); - $sub_sub_sub_subelement_length = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset); - $sub_sub_sub_subelement_end = $offset + $sub_sub_sub_subelement_length; - switch ($sub_sub_sub_subelement_id) { - case EBML_ID_CHAPTERTRACKNUMBER: - $chaptertrack_entry[$sub_sub_sub_subelement_idname] = getid3_lib::BigEndian2Int(substr($EBMLdata, $offset - $EBMLdata_offset, $sub_sub_sub_subelement_length)); - break; - default: - $this->warnings[] = 'Unhandled chapters.editionentry.chapteratom.chaptertrack element['.__LINE__.'] ('.$sub_sub_sub_subelement_id.'::'.$sub_sub_sub_subelement_idname.') at '.$sub_sub_sub_subelement_offset; - break; - } - $offset = $sub_sub_sub_subelement_end; - } - $chapteratom_entry[$sub_sub_subelement_idname][] = $chaptertrack_entry; - break; - case EBML_ID_CHAPTERDISPLAY: - $chapterdisplay_entry = array(); - while ($offset < $sub_sub_subelement_end) { - $this->EnsureBufferHasEnoughData($fd, $EBMLdata, $offset, $EBMLdata_offset); - $sub_sub_sub_subelement_offset = $offset; - $sub_sub_sub_subelement_id = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset); - $sub_sub_sub_subelement_idname = $this->EBMLidName($sub_sub_sub_subelement_id); - $sub_sub_sub_subelement_length = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset); - $sub_sub_sub_subelement_end = $offset + $sub_sub_sub_subelement_length; - switch ($sub_sub_sub_subelement_id) { - case EBML_ID_CHAPSTRING: - case EBML_ID_CHAPLANGUAGE: - case EBML_ID_CHAPCOUNTRY: - $chapterdisplay_entry[$sub_sub_sub_subelement_idname] = substr($EBMLdata, $offset - $EBMLdata_offset, $sub_sub_sub_subelement_length); - break; - default: - $this->warnings[] = 'Unhandled chapters.editionentry.chapteratom.chapterdisplay element['.__LINE__.'] ('.$sub_sub_sub_subelement_id.'::'.$sub_sub_sub_subelement_idname.') at '.$sub_sub_sub_subelement_offset; - break; - } - $offset = $sub_sub_sub_subelement_end; - } - $chapteratom_entry[$sub_sub_subelement_idname][] = $chapterdisplay_entry; - break; - default: - $this->warnings[] = 'Unhandled chapters.editionentry.chapteratom element['.__LINE__.'] ('.$sub_sub_subelement_id.'::'.$sub_sub_subelement_idname.') at '.$sub_sub_subelement_offset; - break; - } - $offset = $sub_sub_subelement_end; - } - $editionentry_entry[$sub_subelement_idname][] = $chapteratom_entry; - break; - default: - $this->warnings[] = 'Unhandled chapters.editionentry element['.__LINE__.'] ('.$sub_subelement_id.'::'.$sub_subelement_idname.') at '.$sub_subelement_offset; - break; - } - $offset = $sub_subelement_end; - } - $ThisFileInfo['matroska']['chapters'][] = $editionentry_entry; - $offset = $sub_subelement_end; - break; - default: - $this->warnings[] = 'Unhandled chapters element['.__LINE__.'] ('.$subelement_id.'::'.$subelement_idname.' ['.$subelement_length.' bytes]) at '.$subelement_offset; - break; - } - $offset = $subelement_end; - } - break; - - - case EBML_ID_VOID: // padding, ignore - $void_entry = array(); - $void_entry['offset'] = $offset; - $ThisFileInfo['matroska']['void'][] = $void_entry; - break; - - case EBML_ID_CLUSTER: // not important to us, contains mostly actual audio/video data, ignore - $cluster_entry = array(); - while ($offset < $element_end) { - $this->EnsureBufferHasEnoughData($fd, $EBMLdata, $offset, $EBMLdata_offset); - $subelement_offset = $offset; -//var_dump($offset); - $subelement_id = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset); -//var_dump($subelement_id); -//echo '<br>'; - $subelement_idname = $this->EBMLidName($subelement_id); - $subelement_length = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset); -//var_dump($subelement_length); - $subelement_end = $offset + $subelement_length; -//exit; - switch ($subelement_id) { - case EBML_ID_CLUSTERTIMECODE: - case EBML_ID_CLUSTERPOSITION: - case EBML_ID_CLUSTERPREVSIZE: - $cluster_entry[$subelement_idname] = getid3_lib::BigEndian2Int(substr($EBMLdata, $offset - $EBMLdata_offset, $subelement_length)); - break; - - case EBML_ID_CLUSTERSILENTTRACKS: - $cluster_silent_tracks = array(); - while ($offset < $subelement_end) { - $this->EnsureBufferHasEnoughData($fd, $EBMLdata, $offset, $EBMLdata_offset); - $sub_subelement_offset = $offset; - $sub_subelement_id = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset); - $sub_subelement_idname = $this->EBMLidName($sub_subelement_id); - $sub_subelement_length = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset); - $sub_subelement_end = $offset + $sub_subelement_length; - switch ($sub_subelement_id) { - case EBML_ID_CLUSTERSILENTTRACKNUMBER: - $cluster_silent_tracks[] = getid3_lib::BigEndian2Int(substr($EBMLdata, $offset - $EBMLdata_offset, $sub_subelement_length)); - break; - default: - $this->warnings[] = 'Unhandled clusters.silenttracks element['.__LINE__.'] ('.$sub_subelement_id.'::'.$sub_subelement_idname.') at '.$sub_subelement_offset; - break; - } - $offset = $sub_subelement_end; - } - $cluster_entry[$subelement_idname][] = $cluster_silent_tracks; - $offset = $sub_subelement_end; - break; - - case EBML_ID_CLUSTERBLOCKGROUP: - $cluster_block_group = array('offset'=>$offset); - while ($offset < $subelement_end) { - $this->EnsureBufferHasEnoughData($fd, $EBMLdata, $offset, $EBMLdata_offset); - $sub_subelement_offset = $offset; - $sub_subelement_id = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset); - $sub_subelement_idname = $this->EBMLidName($sub_subelement_id); - $sub_subelement_length = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset); - $sub_subelement_end = $offset + $sub_subelement_length; - switch ($sub_subelement_id) { - case EBML_ID_CLUSTERBLOCK: - $cluster_block_data = array(); - $cluster_block_data['tracknumber'] = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset); - $cluster_block_data['timecode'] = getid3_lib::BigEndian2Int(substr($EBMLdata, $offset, 2)); - $offset += 2; - // unsure whether this is 1 octect or 2 octets? (http://matroska.org/technical/specs/index.html#block_structure) - $cluster_block_data['flags_raw'] = getid3_lib::BigEndian2Int(substr($EBMLdata, $offset, 1)); - $offset += 1; - //$cluster_block_data['flags']['reserved1'] = (($cluster_block_data['flags_raw'] & 0xF0) >> 4); - $cluster_block_data['flags']['invisible'] = (bool) (($cluster_block_data['flags_raw'] & 0x08) >> 3); - $cluster_block_data['flags']['lacing'] = (($cluster_block_data['flags_raw'] & 0x06) >> 1); - //$cluster_block_data['flags']['reserved2'] = (($cluster_block_data['flags_raw'] & 0x01) >> 0); - $cluster_block_data['flags']['lacing_type'] = $this->MatroskaBlockLacingType($cluster_block_data['flags']['lacing']); - if ($cluster_block_data['flags']['lacing'] != 0) { - $cluster_block_data['lace_frames'] = getid3_lib::BigEndian2Int(substr($EBMLdata, $offset, 1)); // Number of frames in the lace-1 (uint8) - $offset += 1; - if ($cluster_block_data['flags']['lacing'] != 2) { - $cluster_block_data['lace_frames'] = getid3_lib::BigEndian2Int(substr($EBMLdata, $offset, 1)); // Lace-coded size of each frame of the lace, except for the last one (multiple uint8). *This is not used with Fixed-size lacing as it is calculated automatically from (total size of lace) / (number of frames in lace). - $offset += 1; - } - } - if (!isset($ThisFileInfo['matroska']['track_data_offsets'][$cluster_block_data['tracknumber']])) { - $ThisFileInfo['matroska']['track_data_offsets'][$cluster_block_data['tracknumber']] = $offset; - } - $cluster_block_group[$sub_subelement_idname] = $cluster_block_data; - break; - - case EBML_ID_CLUSTERREFERENCEPRIORITY: // unsigned-int - case EBML_ID_CLUSTERBLOCKDURATION: // unsigned-int - $cluster_block_group[$sub_subelement_idname] = getid3_lib::BigEndian2Int(substr($EBMLdata, $offset - $EBMLdata_offset, $sub_subelement_length)); - break; - - case EBML_ID_CLUSTERREFERENCEBLOCK: // signed-int - $cluster_block_group[$sub_subelement_idname] = getid3_lib::BigEndian2Int(substr($EBMLdata, $offset - $EBMLdata_offset, $sub_subelement_length), false, true); - break; - - default: - $this->warnings[] = 'Unhandled clusters.blockgroup element['.__LINE__.'] ('.$sub_subelement_id.'::'.$sub_subelement_idname.') at '.$sub_subelement_offset; - break; - } - $offset = $sub_subelement_end; - } - $cluster_entry[$subelement_idname][] = $cluster_block_group; - $offset = $sub_subelement_end; - break; - - default: - $this->warnings[] = 'Unhandled cluster element['.__LINE__.'] ('.$subelement_id.'::'.$subelement_idname.' ['.$subelement_length.' bytes]) at '.$subelement_offset; - break; - } - $offset = $subelement_end; - } - $ThisFileInfo['matroska']['cluster'][] = $cluster_entry; - - // check to see if all the data we need exists already, if so, break out of the loop - if (isset($ThisFileInfo['matroska']['info']) && is_array($ThisFileInfo['matroska']['info'])) { - if (isset($ThisFileInfo['matroska']['tracks']['tracks']) && is_array($ThisFileInfo['matroska']['tracks']['tracks'])) { - break 2; - } - } - break; - - default: - if ($element_data['id_name'] == dechex($element_data['id'])) { - $ThisFileInfo['error'][] = 'Unhandled segment['.__LINE__.'] ('.$element_data['id'].') at '.$element_data_offset; - } else { - $this->warnings[] = 'Unhandled segment['.__LINE__.'] ('.$element_data['id'].'::'.$element_data['id_name'].') at '.$element_data['offset']; - } - break; - } - $offset = $element_end; - } - break; - - - default: - $ThisFileInfo['error'][] = 'Unhandled chunk['.__LINE__.'] ('.$top_element_id.') at '.$offset; - break; - } - $offset = $top_element_endoffset; - } - - - - if (isset($ThisFileInfo['matroska']['info']) && is_array($ThisFileInfo['matroska']['info'])) { - foreach ($ThisFileInfo['matroska']['info'] as $key => $infoarray) { - if (isset($infoarray['Duration'])) { - // TimecodeScale is how many nanoseconds each Duration unit is - $ThisFileInfo['playtime_seconds'] = $infoarray['Duration'] * ((isset($infoarray['TimecodeScale']) ? $infoarray['TimecodeScale'] : 1000000) / 1000000000); - break; - } - } - } - if (isset($ThisFileInfo['matroska']['tracks']['tracks']) && is_array($ThisFileInfo['matroska']['tracks']['tracks'])) { - foreach ($ThisFileInfo['matroska']['tracks']['tracks'] as $key => $trackarray) { - $track_info = array(); - switch (@$trackarray['TrackType']) { - case 1: // Video - if (@$trackarray['PixelWidth']) { $track_info['resolution_x'] = $trackarray['PixelWidth']; } - if (@$trackarray['PixelHeight']) { $track_info['resolution_y'] = $trackarray['PixelHeight']; } - if (@$trackarray['DisplayWidth']) { $track_info['display_x'] = $trackarray['DisplayWidth']; } - if (@$trackarray['DisplayHeight']) { $track_info['display_y'] = $trackarray['DisplayHeight']; } - if (@$trackarray['DefaultDuration']) { $track_info['frame_rate'] = round(1000000000 / $trackarray['DefaultDuration'], 3); } - if (@$trackarray['CodecID']) { $track_info['dataformat'] = $this->MatroskaCodecIDtoCommonName($trackarray['CodecID']); } - if (!empty($trackarray['codec_private_parsed']['fourcc'])) { - $track_info['fourcc'] = $trackarray['codec_private_parsed']['fourcc']; - } - $ThisFileInfo['video']['streams'][] = $track_info; - if (isset($track_info['resolution_x']) && empty($ThisFileInfo['video']['resolution_x'])) { - foreach ($track_info as $key => $value) { - $ThisFileInfo['video'][$key] = $value; - } - } - break; - case 2: // Audio - if (@$trackarray['CodecID']) { $track_info['dataformat'] = $this->MatroskaCodecIDtoCommonName($trackarray['CodecID']); } - if (@$trackarray['SamplingFrequency']) { $track_info['sample_rate'] = $trackarray['SamplingFrequency']; } - if (@$trackarray['Channels']) { $track_info['channels'] = $trackarray['Channels']; } - if (@$trackarray['BitDepth']) { $track_info['bits_per_sample'] = $trackarray['BitDepth']; } - switch (@$trackarray[$this->EBMLidName(EBML_ID_CODECID)]) { - case 'A_PCM/INT/LIT': - case 'A_PCM/INT/BIG': - $track_info['bitrate'] = $trackarray['SamplingFrequency'] * $trackarray['Channels'] * $trackarray['BitDepth']; - break; - - case 'A_AC3': - if (getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio.ac3.php', __FILE__, false)) { - $ac3_thisfileinfo = array('avdataoffset'=>$ThisFileInfo['matroska']['track_data_offsets'][$trackarray['TrackNumber']]); - $getid3_ac3 = new getid3_ac3($fd, $ac3_thisfileinfo); - $ThisFileInfo['matroska']['track_codec_parsed'][$trackarray['TrackNumber']] = $ac3_thisfileinfo; - if (!empty($ac3_thisfileinfo['error'])) { - foreach ($ac3_thisfileinfo['error'] as $newerror) { - $this->warnings[] = 'getid3_ac3() says: ['.$newerror.']'; - } - } - if (!empty($ac3_thisfileinfo['warning'])) { - foreach ($ac3_thisfileinfo['warning'] as $newerror) { - $this->warnings[] = 'getid3_ac3() says: ['.$newerror.']'; - } - } - if (isset($ac3_thisfileinfo['audio']) && is_array($ac3_thisfileinfo['audio'])) { - foreach ($ac3_thisfileinfo['audio'] as $key => $value) { - $track_info[$key] = $value; - } - } - unset($ac3_thisfileinfo); - unset($getid3_ac3); - } else { - $this->warnings[] = 'Unable to parse audio data['.__LINE__.'] because cannot include "module.audio.ac3.php"'; - } - break; - - case 'A_DTS': - $dts_offset = $ThisFileInfo['matroska']['track_data_offsets'][$trackarray['TrackNumber']]; - // this is a NASTY hack, but sometimes audio data is off by a byte or two and not sure why, email info@getid3.org if you can explain better - fseek($fd, $dts_offset, SEEK_SET); - $magic_test = fread($fd, 8); - for ($i = 0; $i < 4; $i++) { - // look to see if DTS "magic" is here, if so adjust offset by that many bytes - if (substr($magic_test, $i, 4) == "\x7F\xFE\x80\x01") { - $dts_offset += $i; - break; - } - } - if (getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio.dts.php', __FILE__, false)) { - $dts_thisfileinfo = array('avdataoffset'=>$dts_offset); - $getid3_dts = new getid3_dts($fd, $dts_thisfileinfo); - $ThisFileInfo['matroska']['track_codec_parsed'][$trackarray['TrackNumber']] = $dts_thisfileinfo; - if (!empty($dts_thisfileinfo['error'])) { - foreach ($dts_thisfileinfo['error'] as $newerror) { - $this->warnings[] = 'getid3_dts() says: ['.$newerror.']'; - } - } - if (!empty($dts_thisfileinfo['warning'])) { - foreach ($dts_thisfileinfo['warning'] as $newerror) { - $this->warnings[] = 'getid3_dts() says: ['.$newerror.']'; - } - } - if (isset($dts_thisfileinfo['audio']) && is_array($dts_thisfileinfo['audio'])) { - foreach ($dts_thisfileinfo['audio'] as $key => $value) { - $track_info[$key] = $value; - } - } - unset($dts_thisfileinfo); - unset($getid3_dts); - } else { - $this->warnings[] = 'Unable to parse audio data['.__LINE__.'] because cannot include "module.audio.dts.php"'; - } - break; - - //case 'A_AAC': - // if (getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio.aac.php', __FILE__, false)) { - // $aac_thisfileinfo = array('avdataoffset'=>$ThisFileInfo['matroska']['track_data_offsets'][$trackarray['TrackNumber']]); - // $getid3_aac = new getid3_aac($fd, $aac_thisfileinfo); - // $ThisFileInfo['matroska']['track_codec_parsed'][$trackarray['TrackNumber']] = $aac_thisfileinfo; - // if (isset($aac_thisfileinfo['audio']) && is_array($aac_thisfileinfo['audio'])) { - // foreach ($aac_thisfileinfo['audio'] as $key => $value) { - // $track_info[$key] = $value; - // } - // } - // unset($aac_thisfileinfo); - // unset($getid3_aac); - // } else { - // $this->warnings[] = 'Unable to parse audio data['.__LINE__.'] because cannot include "module.audio.aac.php"'; - // } - // break; - - case 'A_MPEG/L3': - if (getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio.mp3.php', __FILE__, false)) { - $mp3_thisfileinfo = array( - 'avdataoffset' => $ThisFileInfo['matroska']['track_data_offsets'][$trackarray['TrackNumber']], - 'avdataend' => $ThisFileInfo['matroska']['track_data_offsets'][$trackarray['TrackNumber']] + 1024, - ); - $getid3_mp3 = new getid3_mp3($fd, $mp3_thisfileinfo); - $getid3_mp3->allow_bruteforce = true; - //getid3_mp3::getOnlyMPEGaudioInfo($fd, $mp3_thisfileinfo, $offset, false); - $ThisFileInfo['matroska']['track_codec_parsed'][$trackarray['TrackNumber']] = $mp3_thisfileinfo; - if (!empty($mp3_thisfileinfo['error'])) { - foreach ($mp3_thisfileinfo['error'] as $newerror) { - $this->warnings[] = 'getid3_mp3() says: ['.$newerror.']'; - } - } - if (!empty($mp3_thisfileinfo['warning'])) { - foreach ($mp3_thisfileinfo['warning'] as $newerror) { - $this->warnings[] = 'getid3_mp3() says: ['.$newerror.']'; - } - } - if (isset($mp3_thisfileinfo['audio']) && is_array($mp3_thisfileinfo['audio'])) { - foreach ($mp3_thisfileinfo['audio'] as $key => $value) { - $track_info[$key] = $value; - } - } - unset($mp3_thisfileinfo); - unset($getid3_mp3); - } else { - $this->warnings[] = 'Unable to parse audio data['.__LINE__.'] because cannot include "module.audio.mp3.php"'; - } - break; - - case 'A_VORBIS': - if (isset($trackarray['CodecPrivate'])) { - // this is a NASTY hack, email info@getid3.org if you have a better idea how to get this info out - $found_vorbis = false; - for ($vorbis_offset = 1; $vorbis_offset < 16; $vorbis_offset++) { - if (substr($trackarray['CodecPrivate'], $vorbis_offset, 6) == 'vorbis') { - $vorbis_offset--; - $found_vorbis = true; - break; - } - } - if ($found_vorbis) { - if (getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio.ogg.php', __FILE__, false)) { - $vorbis_fileinfo = array(); - $oggpageinfo['page_seqno'] = 0; - getid3_ogg::ParseVorbisPageHeader($trackarray['CodecPrivate'], $vorbis_offset, $vorbis_fileinfo, $oggpageinfo); - $ThisFileInfo['matroska']['track_codec_parsed'][$trackarray['TrackNumber']] = $vorbis_fileinfo; - if (!empty($vorbis_fileinfo['error'])) { - foreach ($vorbis_fileinfo['error'] as $newerror) { - $this->warnings[] = 'getid3_ogg() says: ['.$newerror.']'; - } - } - if (!empty($vorbis_fileinfo['warning'])) { - foreach ($vorbis_fileinfo['warning'] as $newerror) { - $this->warnings[] = 'getid3_ogg() says: ['.$newerror.']'; - } - } - if (isset($vorbis_fileinfo['audio']) && is_array($vorbis_fileinfo['audio'])) { - foreach ($vorbis_fileinfo['audio'] as $key => $value) { - $track_info[$key] = $value; - } - } - if (@$vorbis_fileinfo['ogg']['bitrate_average']) { - $track_info['bitrate'] = $vorbis_fileinfo['ogg']['bitrate_average']; - } elseif (@$vorbis_fileinfo['ogg']['bitrate_nominal']) { - $track_info['bitrate'] = $vorbis_fileinfo['ogg']['bitrate_nominal']; - } - unset($vorbis_fileinfo); - unset($oggpageinfo); - } else { - $this->warnings[] = 'Unable to parse audio data['.__LINE__.'] because cannot include "module.audio.ogg.php"'; - } - } else { - } - } else { - } - break; - - default: - $this->warnings[] = 'Unhandled audio type "'.@$trackarray[$this->EBMLidName(EBML_ID_CODECID)].'"'; - break; - } - - - $ThisFileInfo['audio']['streams'][] = $track_info; - if (isset($track_info['dataformat']) && empty($ThisFileInfo['audio']['dataformat'])) { - foreach ($track_info as $key => $value) { - $ThisFileInfo['audio'][$key] = $value; - } - } - break; - default: - // ignore, do nothing - break; - } - } - } - - if ($this->hide_clusters) { - // too much data returned that is usually not useful - if (isset($ThisFileInfo['matroska']['segments']) && is_array($ThisFileInfo['matroska']['segments'])) { - foreach ($ThisFileInfo['matroska']['segments'] as $key => $segmentsarray) { - if ($segmentsarray['id'] == EBML_ID_CLUSTER) { - unset($ThisFileInfo['matroska']['segments'][$key]); - } - } - } - if (isset($ThisFileInfo['matroska']['seek']) && is_array($ThisFileInfo['matroska']['seek'])) { - foreach ($ThisFileInfo['matroska']['seek'] as $key => $seekarray) { - if ($seekarray['target_id'] == EBML_ID_CLUSTER) { - unset($ThisFileInfo['matroska']['seek'][$key]); - } - } - } - //unset($ThisFileInfo['matroska']['cluster']); - //unset($ThisFileInfo['matroska']['track_data_offsets']); - } - - if (!empty($ThisFileInfo['video']['streams'])) { - $ThisFileInfo['mime_type'] = 'video/x-matroska'; - } elseif (!empty($ThisFileInfo['video']['streams'])) { - $ThisFileInfo['mime_type'] = 'audio/x-matroska'; - } elseif (isset($ThisFileInfo['mime_type'])) { - unset($ThisFileInfo['mime_type']); - } - - foreach ($this->warnings as $key => $value) { - $ThisFileInfo['warning'][] = $value; - } - - return true; - } - - -/////////////////////////////////////// - - - function EnsureBufferHasEnoughData(&$fd, &$EBMLdata, &$offset, &$EBMLdata_offset) { - $min_data = 1024; - if ($offset > 2147450880) { // 2^31 - 2^15 (2G-32k) - $offset = pow(2,63); - return false; - } elseif (($offset - $EBMLdata_offset) >= (strlen($EBMLdata) - $min_data)) { - fseek($fd, $offset, SEEK_SET); - $EBMLdata_offset = ftell($fd); - $EBMLdata = fread($fd, $this->read_buffer_size); - } - return true; - } - - function readEBMLint(&$string, &$offset, $dataoffset=0) { - $actual_offset = $offset - $dataoffset; - if ($offset > 2147450880) { // 2^31 - 2^15 (2G-32k) - $this->warnings[] = 'aborting readEBMLint() because $offset larger than 2GB'; - return false; - } elseif ($actual_offset >= strlen($string)) { - $this->warnings[] = '$actual_offset > $string in readEBMLint($string['.strlen($string).'], '.$offset.', '.$dataoffset.')'; - return false; - } elseif ($actual_offset < 0) { - $this->warnings[] = '$actual_offset < 0 in readEBMLint($string['.strlen($string).'], '.$offset.', '.$dataoffset.')'; - return false; - } - $first_byte_int = ord($string{$actual_offset}); - if (0x80 & $first_byte_int) { - $length = 1; - } elseif (0x40 & $first_byte_int) { - $length = 2; - } elseif (0x20 & $first_byte_int) { - $length = 3; - } elseif (0x10 & $first_byte_int) { - $length = 4; - } elseif (0x08 & $first_byte_int) { - $length = 5; - } elseif (0x04 & $first_byte_int) { - $length = 6; - } elseif (0x02 & $first_byte_int) { - $length = 7; - } elseif (0x01 & $first_byte_int) { - $length = 8; - } else { - $offset = pow(2,63); // abort processing, skip to end of file - $this->warnings[] = 'invalid EBML integer (leading 0x00) at '.$offset; - return false; - } - $int_value = $this->EBML2Int(substr($string, $actual_offset, $length)); - $offset += $length; - return $int_value; - } - - function EBML2Int($EBMLstring) { - // http://matroska.org/specs/ - - // Element ID coded with an UTF-8 like system: - // 1xxx xxxx - Class A IDs (2^7 -2 possible values) (base 0x8X) - // 01xx xxxx xxxx xxxx - Class B IDs (2^14-2 possible values) (base 0x4X 0xXX) - // 001x xxxx xxxx xxxx xxxx xxxx - Class C IDs (2^21-2 possible values) (base 0x2X 0xXX 0xXX) - // 0001 xxxx xxxx xxxx xxxx xxxx xxxx xxxx - Class D IDs (2^28-2 possible values) (base 0x1X 0xXX 0xXX 0xXX) - // Values with all x at 0 and 1 are reserved (hence the -2). - - // Data size, in octets, is also coded with an UTF-8 like system : - // 1xxx xxxx - value 0 to 2^7-2 - // 01xx xxxx xxxx xxxx - value 0 to 2^14-2 - // 001x xxxx xxxx xxxx xxxx xxxx - value 0 to 2^21-2 - // 0001 xxxx xxxx xxxx xxxx xxxx xxxx xxxx - value 0 to 2^28-2 - // 0000 1xxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx - value 0 to 2^35-2 - // 0000 01xx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx - value 0 to 2^42-2 - // 0000 001x xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx - value 0 to 2^49-2 - // 0000 0001 xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx - value 0 to 2^56-2 - - $first_byte_int = ord($EBMLstring{0}); - if (0x80 & $first_byte_int) { - $EBMLstring{0} = chr($first_byte_int & 0x7F); - } elseif (0x40 & $first_byte_int) { - $EBMLstring{0} = chr($first_byte_int & 0x3F); - } elseif (0x20 & $first_byte_int) { - $EBMLstring{0} = chr($first_byte_int & 0x1F); - } elseif (0x10 & $first_byte_int) { - $EBMLstring{0} = chr($first_byte_int & 0x0F); - } elseif (0x08 & $first_byte_int) { - $EBMLstring{0} = chr($first_byte_int & 0x07); - } elseif (0x04 & $first_byte_int) { - $EBMLstring{0} = chr($first_byte_int & 0x03); - } elseif (0x02 & $first_byte_int) { - $EBMLstring{0} = chr($first_byte_int & 0x01); - } elseif (0x01 & $first_byte_int) { - $EBMLstring{0} = chr($first_byte_int & 0x00); - } else { - return false; - } - return getid3_lib::BigEndian2Int($EBMLstring); - } - - - function EBMLdate2unix($EBMLdatestamp) { - // Date - signed 8 octets integer in nanoseconds with 0 indicating the precise beginning of the millennium (at 2001-01-01T00:00:00,000000000 UTC) - // 978307200 == mktime(0, 0, 0, 1, 1, 2001) == January 1, 2001 12:00:00am UTC - return round(($EBMLdatestamp / 1000000000) + 978307200); - } - - - function MatroskaBlockLacingType($lacingtype) { - // http://matroska.org/technical/specs/index.html#block_structure - static $MatroskaBlockLacingType = array(); - if (empty($MatroskaBlockLacingType)) { - $MatroskaBlockLacingType[0x00] = 'no lacing'; - $MatroskaBlockLacingType[0x01] = 'Xiph lacing'; - $MatroskaBlockLacingType[0x02] = 'fixed-size lacing'; - $MatroskaBlockLacingType[0x03] = 'EBML lacing'; - } - return (isset($MatroskaBlockLacingType[$lacingtype]) ? $MatroskaBlockLacingType[$lacingtype] : $lacingtype); - } - - function MatroskaCodecIDtoCommonName($codecid) { - // http://www.matroska.org/technical/specs/codecid/index.html - static $MatroskaCodecIDlist = array(); - if (empty($MatroskaCodecIDlist)) { - $MatroskaCodecIDlist['A_AAC'] = 'aac'; - $MatroskaCodecIDlist['A_AAC/MPEG2/LC'] = 'aac'; - $MatroskaCodecIDlist['A_AC3'] = 'ac3'; - $MatroskaCodecIDlist['A_DTS'] = 'dts'; - $MatroskaCodecIDlist['A_FLAC'] = 'flac'; - $MatroskaCodecIDlist['A_MPEG/L1'] = 'mp1'; - $MatroskaCodecIDlist['A_MPEG/L2'] = 'mp2'; - $MatroskaCodecIDlist['A_MPEG/L3'] = 'mp3'; - $MatroskaCodecIDlist['A_PCM/INT/LIT'] = 'pcm'; // PCM Integer Little Endian - $MatroskaCodecIDlist['A_PCM/INT/BIG'] = 'pcm'; // PCM Integer Big Endian - $MatroskaCodecIDlist['A_QUICKTIME/QDMC'] = 'quicktime'; // Quicktime: QDesign Music - $MatroskaCodecIDlist['A_QUICKTIME/QDM2'] = 'quicktime'; // Quicktime: QDesign Music v2 - $MatroskaCodecIDlist['A_VORBIS'] = 'vorbis'; - $MatroskaCodecIDlist['V_MPEG1'] = 'mpeg'; - $MatroskaCodecIDlist['V_THEORA'] = 'theora'; - $MatroskaCodecIDlist['V_REAL/RV40'] = 'real'; - $MatroskaCodecIDlist['V_REAL/RV10'] = 'real'; - $MatroskaCodecIDlist['V_REAL/RV20'] = 'real'; - $MatroskaCodecIDlist['V_REAL/RV30'] = 'real'; - $MatroskaCodecIDlist['V_QUICKTIME'] = 'quicktime'; // Quicktime - $MatroskaCodecIDlist['V_MPEG4/ISO/AP'] = 'mpeg4'; - $MatroskaCodecIDlist['V_MPEG4/ISO/ASP'] = 'mpeg4'; - $MatroskaCodecIDlist['V_MPEG4/ISO/AVC'] = 'h264'; - $MatroskaCodecIDlist['V_MPEG4/ISO/SP'] = 'mpeg4'; - } - return (isset($MatroskaCodecIDlist[$codecid]) ? $MatroskaCodecIDlist[$codecid] : $codecid); - } - - function EBMLidName($value) { - static $EBMLidList = array(); - if (empty($EBMLidList)) { - $EBMLidList[EBML_ID_ASPECTRATIOTYPE] = 'AspectRatioType'; - $EBMLidList[EBML_ID_ATTACHEDFILE] = 'AttachedFile'; - $EBMLidList[EBML_ID_ATTACHMENTLINK] = 'AttachmentLink'; - $EBMLidList[EBML_ID_ATTACHMENTS] = 'Attachments'; - $EBMLidList[EBML_ID_ATTACHMENTUID] = 'AttachmentUID'; - $EBMLidList[EBML_ID_AUDIO] = 'Audio'; - $EBMLidList[EBML_ID_BITDEPTH] = 'BitDepth'; - $EBMLidList[EBML_ID_CHANNELPOSITIONS] = 'ChannelPositions'; - $EBMLidList[EBML_ID_CHANNELS] = 'Channels'; - $EBMLidList[EBML_ID_CHAPCOUNTRY] = 'ChapCountry'; - $EBMLidList[EBML_ID_CHAPLANGUAGE] = 'ChapLanguage'; - $EBMLidList[EBML_ID_CHAPPROCESS] = 'ChapProcess'; - $EBMLidList[EBML_ID_CHAPPROCESSCODECID] = 'ChapProcessCodecID'; - $EBMLidList[EBML_ID_CHAPPROCESSCOMMAND] = 'ChapProcessCommand'; - $EBMLidList[EBML_ID_CHAPPROCESSDATA] = 'ChapProcessData'; - $EBMLidList[EBML_ID_CHAPPROCESSPRIVATE] = 'ChapProcessPrivate'; - $EBMLidList[EBML_ID_CHAPPROCESSTIME] = 'ChapProcessTime'; - $EBMLidList[EBML_ID_CHAPSTRING] = 'ChapString'; - $EBMLidList[EBML_ID_CHAPTERATOM] = 'ChapterAtom'; - $EBMLidList[EBML_ID_CHAPTERDISPLAY] = 'ChapterDisplay'; - $EBMLidList[EBML_ID_CHAPTERFLAGENABLED] = 'ChapterFlagEnabled'; - $EBMLidList[EBML_ID_CHAPTERFLAGHIDDEN] = 'ChapterFlagHidden'; - $EBMLidList[EBML_ID_CHAPTERPHYSICALEQUIV] = 'ChapterPhysicalEquiv'; - $EBMLidList[EBML_ID_CHAPTERS] = 'Chapters'; - $EBMLidList[EBML_ID_CHAPTERSEGMENTEDITIONUID] = 'ChapterSegmentEditionUID'; - $EBMLidList[EBML_ID_CHAPTERSEGMENTUID] = 'ChapterSegmentUID'; - $EBMLidList[EBML_ID_CHAPTERTIMEEND] = 'ChapterTimeEnd'; - $EBMLidList[EBML_ID_CHAPTERTIMESTART] = 'ChapterTimeStart'; - $EBMLidList[EBML_ID_CHAPTERTRACK] = 'ChapterTrack'; - $EBMLidList[EBML_ID_CHAPTERTRACKNUMBER] = 'ChapterTrackNumber'; - $EBMLidList[EBML_ID_CHAPTERTRANSLATE] = 'ChapterTranslate'; - $EBMLidList[EBML_ID_CHAPTERTRANSLATECODEC] = 'ChapterTranslateCodec'; - $EBMLidList[EBML_ID_CHAPTERTRANSLATEEDITIONUID] = 'ChapterTranslateEditionUID'; - $EBMLidList[EBML_ID_CHAPTERTRANSLATEID] = 'ChapterTranslateID'; - $EBMLidList[EBML_ID_CHAPTERUID] = 'ChapterUID'; - $EBMLidList[EBML_ID_CLUSTER] = 'Cluster'; - $EBMLidList[EBML_ID_CLUSTERBLOCK] = 'ClusterBlock'; - $EBMLidList[EBML_ID_CLUSTERBLOCKADDID] = 'ClusterBlockAddID'; - $EBMLidList[EBML_ID_CLUSTERBLOCKADDITIONAL] = 'ClusterBlockAdditional'; - $EBMLidList[EBML_ID_CLUSTERBLOCKADDITIONID] = 'ClusterBlockAdditionID'; - $EBMLidList[EBML_ID_CLUSTERBLOCKADDITIONS] = 'ClusterBlockAdditions'; - $EBMLidList[EBML_ID_CLUSTERBLOCKDURATION] = 'ClusterBlockDuration'; - $EBMLidList[EBML_ID_CLUSTERBLOCKGROUP] = 'ClusterBlockGroup'; - $EBMLidList[EBML_ID_CLUSTERBLOCKMORE] = 'ClusterBlockMore'; - $EBMLidList[EBML_ID_CLUSTERBLOCKVIRTUAL] = 'ClusterBlockVirtual'; - $EBMLidList[EBML_ID_CLUSTERCODECSTATE] = 'ClusterCodecState'; - $EBMLidList[EBML_ID_CLUSTERDELAY] = 'ClusterDelay'; - $EBMLidList[EBML_ID_CLUSTERDURATION] = 'ClusterDuration'; - $EBMLidList[EBML_ID_CLUSTERENCRYPTEDBLOCK] = 'ClusterEncryptedBlock'; - $EBMLidList[EBML_ID_CLUSTERFRAMENUMBER] = 'ClusterFrameNumber'; - $EBMLidList[EBML_ID_CLUSTERLACENUMBER] = 'ClusterLaceNumber'; - $EBMLidList[EBML_ID_CLUSTERPOSITION] = 'ClusterPosition'; - $EBMLidList[EBML_ID_CLUSTERPREVSIZE] = 'ClusterPrevSize'; - $EBMLidList[EBML_ID_CLUSTERREFERENCEBLOCK] = 'ClusterReferenceBlock'; - $EBMLidList[EBML_ID_CLUSTERREFERENCEPRIORITY] = 'ClusterReferencePriority'; - $EBMLidList[EBML_ID_CLUSTERREFERENCEVIRTUAL] = 'ClusterReferenceVirtual'; - $EBMLidList[EBML_ID_CLUSTERSILENTTRACKNUMBER] = 'ClusterSilentTrackNumber'; - $EBMLidList[EBML_ID_CLUSTERSILENTTRACKS] = 'ClusterSilentTracks'; - $EBMLidList[EBML_ID_CLUSTERSIMPLEBLOCK] = 'ClusterSimpleBlock'; - $EBMLidList[EBML_ID_CLUSTERTIMECODE] = 'ClusterTimecode'; - $EBMLidList[EBML_ID_CLUSTERTIMESLICE] = 'ClusterTimeSlice'; - $EBMLidList[EBML_ID_CODECDECODEALL] = 'CodecDecodeAll'; - $EBMLidList[EBML_ID_CODECDOWNLOADURL] = 'CodecDownloadURL'; - $EBMLidList[EBML_ID_CODECID] = 'CodecID'; - $EBMLidList[EBML_ID_CODECINFOURL] = 'CodecInfoURL'; - $EBMLidList[EBML_ID_CODECNAME] = 'CodecName'; - $EBMLidList[EBML_ID_CODECPRIVATE] = 'CodecPrivate'; - $EBMLidList[EBML_ID_CODECSETTINGS] = 'CodecSettings'; - $EBMLidList[EBML_ID_COLOURSPACE] = 'ColourSpace'; - $EBMLidList[EBML_ID_CONTENTCOMPALGO] = 'ContentCompAlgo'; - $EBMLidList[EBML_ID_CONTENTCOMPRESSION] = 'ContentCompression'; - $EBMLidList[EBML_ID_CONTENTCOMPSETTINGS] = 'ContentCompSettings'; - $EBMLidList[EBML_ID_CONTENTENCALGO] = 'ContentEncAlgo'; - $EBMLidList[EBML_ID_CONTENTENCKEYID] = 'ContentEncKeyID'; - $EBMLidList[EBML_ID_CONTENTENCODING] = 'ContentEncoding'; - $EBMLidList[EBML_ID_CONTENTENCODINGORDER] = 'ContentEncodingOrder'; - $EBMLidList[EBML_ID_CONTENTENCODINGS] = 'ContentEncodings'; - $EBMLidList[EBML_ID_CONTENTENCODINGSCOPE] = 'ContentEncodingScope'; - $EBMLidList[EBML_ID_CONTENTENCODINGTYPE] = 'ContentEncodingType'; - $EBMLidList[EBML_ID_CONTENTENCRYPTION] = 'ContentEncryption'; - $EBMLidList[EBML_ID_CONTENTSIGALGO] = 'ContentSigAlgo'; - $EBMLidList[EBML_ID_CONTENTSIGHASHALGO] = 'ContentSigHashAlgo'; - $EBMLidList[EBML_ID_CONTENTSIGKEYID] = 'ContentSigKeyID'; - $EBMLidList[EBML_ID_CONTENTSIGNATURE] = 'ContentSignature'; - $EBMLidList[EBML_ID_CRC32] = 'CRC32'; - $EBMLidList[EBML_ID_CUEBLOCKNUMBER] = 'CueBlockNumber'; - $EBMLidList[EBML_ID_CUECLUSTERPOSITION] = 'CueClusterPosition'; - $EBMLidList[EBML_ID_CUECODECSTATE] = 'CueCodecState'; - $EBMLidList[EBML_ID_CUEPOINT] = 'CuePoint'; - $EBMLidList[EBML_ID_CUEREFCLUSTER] = 'CueRefCluster'; - $EBMLidList[EBML_ID_CUEREFCODECSTATE] = 'CueRefCodecState'; - $EBMLidList[EBML_ID_CUEREFERENCE] = 'CueReference'; - $EBMLidList[EBML_ID_CUEREFNUMBER] = 'CueRefNumber'; - $EBMLidList[EBML_ID_CUEREFTIME] = 'CueRefTime'; - $EBMLidList[EBML_ID_CUES] = 'Cues'; - $EBMLidList[EBML_ID_CUETIME] = 'CueTime'; - $EBMLidList[EBML_ID_CUETRACK] = 'CueTrack'; - $EBMLidList[EBML_ID_CUETRACKPOSITIONS] = 'CueTrackPositions'; - $EBMLidList[EBML_ID_DATEUTC] = 'DateUTC'; - $EBMLidList[EBML_ID_DEFAULTDURATION] = 'DefaultDuration'; - $EBMLidList[EBML_ID_DISPLAYHEIGHT] = 'DisplayHeight'; - $EBMLidList[EBML_ID_DISPLAYUNIT] = 'DisplayUnit'; - $EBMLidList[EBML_ID_DISPLAYWIDTH] = 'DisplayWidth'; - $EBMLidList[EBML_ID_DOCTYPE] = 'DocType'; - $EBMLidList[EBML_ID_DOCTYPEREADVERSION] = 'DocTypeReadVersion'; - $EBMLidList[EBML_ID_DOCTYPEVERSION] = 'DocTypeVersion'; - $EBMLidList[EBML_ID_DURATION] = 'Duration'; - $EBMLidList[EBML_ID_EBMLMAXIDLENGTH] = 'EBMLMaxIDLength'; - $EBMLidList[EBML_ID_EBMLMAXSIZELENGTH] = 'EBMLMaxSizeLength'; - $EBMLidList[EBML_ID_EBMLREADVERSION] = 'EBMLReadVersion'; - $EBMLidList[EBML_ID_EBMLVERSION] = 'EBMLVersion'; - $EBMLidList[EBML_ID_EDITIONENTRY] = 'EditionEntry'; - $EBMLidList[EBML_ID_EDITIONFLAGDEFAULT] = 'EditionFlagDefault'; - $EBMLidList[EBML_ID_EDITIONFLAGHIDDEN] = 'EditionFlagHidden'; - $EBMLidList[EBML_ID_EDITIONFLAGORDERED] = 'EditionFlagOrdered'; - $EBMLidList[EBML_ID_EDITIONUID] = 'EditionUID'; - $EBMLidList[EBML_ID_FILEDATA] = 'FileData'; - $EBMLidList[EBML_ID_FILEDESCRIPTION] = 'FileDescription'; - $EBMLidList[EBML_ID_FILEMIMETYPE] = 'FileMimeType'; - $EBMLidList[EBML_ID_FILENAME] = 'FileName'; - $EBMLidList[EBML_ID_FILEREFERRAL] = 'FileReferral'; - $EBMLidList[EBML_ID_FILEUID] = 'FileUID'; - $EBMLidList[EBML_ID_FLAGDEFAULT] = 'FlagDefault'; - $EBMLidList[EBML_ID_FLAGENABLED] = 'FlagEnabled'; - $EBMLidList[EBML_ID_FLAGFORCED] = 'FlagForced'; - $EBMLidList[EBML_ID_FLAGINTERLACED] = 'FlagInterlaced'; - $EBMLidList[EBML_ID_FLAGLACING] = 'FlagLacing'; - $EBMLidList[EBML_ID_GAMMAVALUE] = 'GammaValue'; - $EBMLidList[EBML_ID_INFO] = 'Info'; - $EBMLidList[EBML_ID_LANGUAGE] = 'Language'; - $EBMLidList[EBML_ID_MAXBLOCKADDITIONID] = 'MaxBlockAdditionID'; - $EBMLidList[EBML_ID_MAXCACHE] = 'MaxCache'; - $EBMLidList[EBML_ID_MINCACHE] = 'MinCache'; - $EBMLidList[EBML_ID_MUXINGAPP] = 'MuxingApp'; - $EBMLidList[EBML_ID_NAME] = 'Name'; - $EBMLidList[EBML_ID_NEXTFILENAME] = 'NextFilename'; - $EBMLidList[EBML_ID_NEXTUID] = 'NextUID'; - $EBMLidList[EBML_ID_OUTPUTSAMPLINGFREQUENCY] = 'OutputSamplingFrequency'; - $EBMLidList[EBML_ID_PIXELCROPBOTTOM] = 'PixelCropBottom'; - $EBMLidList[EBML_ID_PIXELCROPLEFT] = 'PixelCropLeft'; - $EBMLidList[EBML_ID_PIXELCROPRIGHT] = 'PixelCropRight'; - $EBMLidList[EBML_ID_PIXELCROPTOP] = 'PixelCropTop'; - $EBMLidList[EBML_ID_PIXELHEIGHT] = 'PixelHeight'; - $EBMLidList[EBML_ID_PIXELWIDTH] = 'PixelWidth'; - $EBMLidList[EBML_ID_PREVFILENAME] = 'PrevFilename'; - $EBMLidList[EBML_ID_PREVUID] = 'PrevUID'; - $EBMLidList[EBML_ID_SAMPLINGFREQUENCY] = 'SamplingFrequency'; - $EBMLidList[EBML_ID_SEEK] = 'Seek'; - $EBMLidList[EBML_ID_SEEKHEAD] = 'SeekHead'; - $EBMLidList[EBML_ID_SEEKID] = 'SeekID'; - $EBMLidList[EBML_ID_SEEKPOSITION] = 'SeekPosition'; - $EBMLidList[EBML_ID_SEGMENTFAMILY] = 'SegmentFamily'; - $EBMLidList[EBML_ID_SEGMENTFILENAME] = 'SegmentFilename'; - $EBMLidList[EBML_ID_SEGMENTUID] = 'SegmentUID'; - $EBMLidList[EBML_ID_SIMPLETAG] = 'SimpleTag'; - $EBMLidList[EBML_ID_CLUSTERSLICES] = 'ClusterSlices'; - $EBMLidList[EBML_ID_STEREOMODE] = 'StereoMode'; - $EBMLidList[EBML_ID_TAG] = 'Tag'; - $EBMLidList[EBML_ID_TAGBINARY] = 'TagBinary'; - $EBMLidList[EBML_ID_TAGCHAPTERUID] = 'TagChapterUID'; - $EBMLidList[EBML_ID_TAGDEFAULT] = 'TagDefault'; - $EBMLidList[EBML_ID_TAGEDITIONUID] = 'TagEditionUID'; - $EBMLidList[EBML_ID_TAGLANGUAGE] = 'TagLanguage'; - $EBMLidList[EBML_ID_TAGNAME] = 'TagName'; - $EBMLidList[EBML_ID_TAGTRACKUID] = 'TagTrackUID'; - $EBMLidList[EBML_ID_TAGS] = 'Tags'; - $EBMLidList[EBML_ID_TAGSTRING] = 'TagString'; - $EBMLidList[EBML_ID_TARGETS] = 'Targets'; - $EBMLidList[EBML_ID_TARGETTYPE] = 'TargetType'; - $EBMLidList[EBML_ID_TARGETTYPEVALUE] = 'TargetTypeValue'; - $EBMLidList[EBML_ID_TIMECODESCALE] = 'TimecodeScale'; - $EBMLidList[EBML_ID_TITLE] = 'Title'; - $EBMLidList[EBML_ID_TRACKENTRY] = 'TrackEntry'; - $EBMLidList[EBML_ID_TRACKNUMBER] = 'TrackNumber'; - $EBMLidList[EBML_ID_TRACKOFFSET] = 'TrackOffset'; - $EBMLidList[EBML_ID_TRACKOVERLAY] = 'TrackOverlay'; - $EBMLidList[EBML_ID_TRACKS] = 'Tracks'; - $EBMLidList[EBML_ID_TRACKTIMECODESCALE] = 'TrackTimecodeScale'; - $EBMLidList[EBML_ID_TRACKTRANSLATE] = 'TrackTranslate'; - $EBMLidList[EBML_ID_TRACKTRANSLATECODEC] = 'TrackTranslateCodec'; - $EBMLidList[EBML_ID_TRACKTRANSLATEEDITIONUID] = 'TrackTranslateEditionUID'; - $EBMLidList[EBML_ID_TRACKTRANSLATETRACKID] = 'TrackTranslateTrackID'; - $EBMLidList[EBML_ID_TRACKTYPE] = 'TrackType'; - $EBMLidList[EBML_ID_TRACKUID] = 'TrackUID'; - $EBMLidList[EBML_ID_VIDEO] = 'Video'; - $EBMLidList[EBML_ID_VOID] = 'Void'; - $EBMLidList[EBML_ID_WRITINGAPP] = 'WritingApp'; - } - return (isset($EBMLidList[$value]) ? $EBMLidList[$value] : dechex($value)); - } - -} - -?>
\ No newline at end of file diff --git a/getid3/module.audio-video.mpeg.php b/getid3/module.audio-video.mpeg.php deleted file mode 100644 index 8f48784..0000000 --- a/getid3/module.audio-video.mpeg.php +++ /dev/null @@ -1,292 +0,0 @@ -<?php -///////////////////////////////////////////////////////////////// -/// getID3() by James Heinrich <info@getid3.org> // -// available at http://getid3.sourceforge.net // -// or http://www.getid3.org // -///////////////////////////////////////////////////////////////// -// See readme.txt for more details // -///////////////////////////////////////////////////////////////// -// // -// module.audio-video.mpeg.php // -// module for analyzing MPEG files // -// dependencies: module.audio.mp3.php // -// /// -///////////////////////////////////////////////////////////////// - -getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio.mp3.php', __FILE__, true); - -define('GETID3_MPEG_VIDEO_PICTURE_START', "\x00\x00\x01\x00"); -define('GETID3_MPEG_VIDEO_USER_DATA_START', "\x00\x00\x01\xB2"); -define('GETID3_MPEG_VIDEO_SEQUENCE_HEADER', "\x00\x00\x01\xB3"); -define('GETID3_MPEG_VIDEO_SEQUENCE_ERROR', "\x00\x00\x01\xB4"); -define('GETID3_MPEG_VIDEO_EXTENSION_START', "\x00\x00\x01\xB5"); -define('GETID3_MPEG_VIDEO_SEQUENCE_END', "\x00\x00\x01\xB7"); -define('GETID3_MPEG_VIDEO_GROUP_START', "\x00\x00\x01\xB8"); -define('GETID3_MPEG_AUDIO_START', "\x00\x00\x01\xC0"); - - -class getid3_mpeg -{ - - function getid3_mpeg(&$fd, &$ThisFileInfo) { - if ($ThisFileInfo['avdataend'] <= $ThisFileInfo['avdataoffset']) { - $ThisFileInfo['error'][] = '"avdataend" ('.$ThisFileInfo['avdataend'].') is unexpectedly less-than-or-equal-to "avdataoffset" ('.$ThisFileInfo['avdataoffset'].')'; - return false; - } - $ThisFileInfo['fileformat'] = 'mpeg'; - fseek($fd, $ThisFileInfo['avdataoffset'], SEEK_SET); - $MPEGstreamData = fread($fd, min(100000, $ThisFileInfo['avdataend'] - $ThisFileInfo['avdataoffset'])); - $MPEGstreamDataLength = strlen($MPEGstreamData); - - $foundVideo = true; - $VideoChunkOffset = 0; - while (substr($MPEGstreamData, $VideoChunkOffset++, 4) !== GETID3_MPEG_VIDEO_SEQUENCE_HEADER) { - if ($VideoChunkOffset >= $MPEGstreamDataLength) { - $foundVideo = false; - break; - } - } - if ($foundVideo) { - - // Start code 32 bits - // horizontal frame size 12 bits - // vertical frame size 12 bits - // pixel aspect ratio 4 bits - // frame rate 4 bits - // bitrate 18 bits - // marker bit 1 bit - // VBV buffer size 10 bits - // constrained parameter flag 1 bit - // intra quant. matrix flag 1 bit - // intra quant. matrix values 512 bits (present if matrix flag == 1) - // non-intra quant. matrix flag 1 bit - // non-intra quant. matrix values 512 bits (present if matrix flag == 1) - - $ThisFileInfo['video']['dataformat'] = 'mpeg'; - - $VideoChunkOffset += (strlen(GETID3_MPEG_VIDEO_SEQUENCE_HEADER) - 1); - - $FrameSizeDWORD = getid3_lib::BigEndian2Int(substr($MPEGstreamData, $VideoChunkOffset, 3)); - $VideoChunkOffset += 3; - - $AspectRatioFrameRateDWORD = getid3_lib::BigEndian2Int(substr($MPEGstreamData, $VideoChunkOffset, 1)); - $VideoChunkOffset += 1; - - $assortedinformation = getid3_lib::BigEndian2Bin(substr($MPEGstreamData, $VideoChunkOffset, 4)); - $VideoChunkOffset += 4; - - $ThisFileInfo['mpeg']['video']['raw']['framesize_horizontal'] = ($FrameSizeDWORD & 0xFFF000) >> 12; // 12 bits for horizontal frame size - $ThisFileInfo['mpeg']['video']['raw']['framesize_vertical'] = ($FrameSizeDWORD & 0x000FFF); // 12 bits for vertical frame size - $ThisFileInfo['mpeg']['video']['raw']['pixel_aspect_ratio'] = ($AspectRatioFrameRateDWORD & 0xF0) >> 4; - $ThisFileInfo['mpeg']['video']['raw']['frame_rate'] = ($AspectRatioFrameRateDWORD & 0x0F); - - $ThisFileInfo['mpeg']['video']['framesize_horizontal'] = $ThisFileInfo['mpeg']['video']['raw']['framesize_horizontal']; - $ThisFileInfo['mpeg']['video']['framesize_vertical'] = $ThisFileInfo['mpeg']['video']['raw']['framesize_vertical']; - - $ThisFileInfo['mpeg']['video']['pixel_aspect_ratio'] = $this->MPEGvideoAspectRatioLookup($ThisFileInfo['mpeg']['video']['raw']['pixel_aspect_ratio']); - $ThisFileInfo['mpeg']['video']['pixel_aspect_ratio_text'] = $this->MPEGvideoAspectRatioTextLookup($ThisFileInfo['mpeg']['video']['raw']['pixel_aspect_ratio']); - $ThisFileInfo['mpeg']['video']['frame_rate'] = $this->MPEGvideoFramerateLookup($ThisFileInfo['mpeg']['video']['raw']['frame_rate']); - - $ThisFileInfo['mpeg']['video']['raw']['bitrate'] = getid3_lib::Bin2Dec(substr($assortedinformation, 0, 18)); - $ThisFileInfo['mpeg']['video']['raw']['marker_bit'] = (bool) getid3_lib::Bin2Dec(substr($assortedinformation, 18, 1)); - $ThisFileInfo['mpeg']['video']['raw']['vbv_buffer_size'] = getid3_lib::Bin2Dec(substr($assortedinformation, 19, 10)); - $ThisFileInfo['mpeg']['video']['raw']['constrained_param_flag'] = (bool) getid3_lib::Bin2Dec(substr($assortedinformation, 29, 1)); - $ThisFileInfo['mpeg']['video']['raw']['intra_quant_flag'] = (bool) getid3_lib::Bin2Dec(substr($assortedinformation, 30, 1)); - if ($ThisFileInfo['mpeg']['video']['raw']['intra_quant_flag']) { - - // read 512 bits - $ThisFileInfo['mpeg']['video']['raw']['intra_quant'] = getid3_lib::BigEndian2Bin(substr($MPEGstreamData, $VideoChunkOffset, 64)); - $VideoChunkOffset += 64; - - $ThisFileInfo['mpeg']['video']['raw']['non_intra_quant_flag'] = (bool) getid3_lib::Bin2Dec(substr($ThisFileInfo['mpeg']['video']['raw']['intra_quant'], 511, 1)); - $ThisFileInfo['mpeg']['video']['raw']['intra_quant'] = getid3_lib::Bin2Dec(substr($assortedinformation, 31, 1)).substr(getid3_lib::BigEndian2Bin(substr($MPEGstreamData, $VideoChunkOffset, 64)), 0, 511); - - if ($ThisFileInfo['mpeg']['video']['raw']['non_intra_quant_flag']) { - $ThisFileInfo['mpeg']['video']['raw']['non_intra_quant'] = substr($MPEGstreamData, $VideoChunkOffset, 64); - $VideoChunkOffset += 64; - } - - } else { - - $ThisFileInfo['mpeg']['video']['raw']['non_intra_quant_flag'] = (bool) getid3_lib::Bin2Dec(substr($assortedinformation, 31, 1)); - if ($ThisFileInfo['mpeg']['video']['raw']['non_intra_quant_flag']) { - $ThisFileInfo['mpeg']['video']['raw']['non_intra_quant'] = substr($MPEGstreamData, $VideoChunkOffset, 64); - $VideoChunkOffset += 64; - } - - } - - if ($ThisFileInfo['mpeg']['video']['raw']['bitrate'] == 0x3FFFF) { // 18 set bits - - $ThisFileInfo['warning'][] = 'This version of getID3() ['.GETID3_VERSION.'] cannot determine average bitrate of VBR MPEG video files'; - $ThisFileInfo['mpeg']['video']['bitrate_mode'] = 'vbr'; - - } else { - - $ThisFileInfo['mpeg']['video']['bitrate'] = $ThisFileInfo['mpeg']['video']['raw']['bitrate'] * 400; - $ThisFileInfo['mpeg']['video']['bitrate_mode'] = 'cbr'; - $ThisFileInfo['video']['bitrate'] = $ThisFileInfo['mpeg']['video']['bitrate']; - - } - - $ThisFileInfo['video']['resolution_x'] = $ThisFileInfo['mpeg']['video']['framesize_horizontal']; - $ThisFileInfo['video']['resolution_y'] = $ThisFileInfo['mpeg']['video']['framesize_vertical']; - $ThisFileInfo['video']['frame_rate'] = $ThisFileInfo['mpeg']['video']['frame_rate']; - $ThisFileInfo['video']['bitrate_mode'] = $ThisFileInfo['mpeg']['video']['bitrate_mode']; - $ThisFileInfo['video']['pixel_aspect_ratio'] = $ThisFileInfo['mpeg']['video']['pixel_aspect_ratio']; - $ThisFileInfo['video']['lossless'] = false; - $ThisFileInfo['video']['bits_per_sample'] = 24; - - } else { - - $ThisFileInfo['error'][] = 'Could not find start of video block in the first 100,000 bytes (or before end of file) - this might not be an MPEG-video file?'; - - } - - //0x000001B3 begins the sequence_header of every MPEG video stream. - //But in MPEG-2, this header must immediately be followed by an - //extension_start_code (0x000001B5) with a sequence_extension ID (1). - //(This extension contains all the additional MPEG-2 stuff.) - //MPEG-1 doesn't have this extension, so that's a sure way to tell the - //difference between MPEG-1 and MPEG-2 video streams. - - if (substr($MPEGstreamData, $VideoChunkOffset, 4) == GETID3_MPEG_VIDEO_EXTENSION_START) { - $ThisFileInfo['video']['codec'] = 'MPEG-2'; - } else { - $ThisFileInfo['video']['codec'] = 'MPEG-1'; - } - - - $AudioChunkOffset = 0; - while (true) { - while (substr($MPEGstreamData, $AudioChunkOffset++, 4) !== GETID3_MPEG_AUDIO_START) { - if ($AudioChunkOffset >= $MPEGstreamDataLength) { - break 2; - } - } - - for ($i = 0; $i <= 7; $i++) { - // some files have the MPEG-audio header 8 bytes after the end of the $00 $00 $01 $C0 signature, some have it up to 13 bytes (or more?) after - // I have no idea why or what the difference is, so this is a stupid hack. - // If anybody has any better idea of what's going on, please let me know - info@getid3.org - - $dummy = $ThisFileInfo; - if (getid3_mp3::decodeMPEGaudioHeader($fd, ($AudioChunkOffset + 3) + 8 + $i, $dummy, false)) { - $ThisFileInfo = $dummy; - $ThisFileInfo['audio']['bitrate_mode'] = 'cbr'; - $ThisFileInfo['audio']['lossless'] = false; - break 2; - - } - } - } - - // Temporary hack to account for interleaving overhead: - if (!empty($ThisFileInfo['video']['bitrate']) && !empty($ThisFileInfo['audio']['bitrate'])) { - $ThisFileInfo['playtime_seconds'] = (($ThisFileInfo['avdataend'] - $ThisFileInfo['avdataoffset']) * 8) / ($ThisFileInfo['video']['bitrate'] + $ThisFileInfo['audio']['bitrate']); - - // Interleaved MPEG audio/video files have a certain amount of overhead that varies - // by both video and audio bitrates, and not in any sensible, linear/logarithmic patter - // Use interpolated lookup tables to approximately guess how much is overhead, because - // playtime is calculated as filesize / total-bitrate - $ThisFileInfo['playtime_seconds'] *= $this->MPEGsystemNonOverheadPercentage($ThisFileInfo['video']['bitrate'], $ThisFileInfo['audio']['bitrate']); - - //switch ($ThisFileInfo['video']['bitrate']) { - // case('5000000'): - // $multiplier = 0.93292642112380355828048824319889; - // break; - // case('5500000'): - // $multiplier = 0.93582895375200989965359777343219; - // break; - // case('6000000'): - // $multiplier = 0.93796247714820932532911373859139; - // break; - // case('7000000'): - // $multiplier = 0.9413264083635103463010117778776; - // break; - // default: - // $multiplier = 1; - // break; - //} - //$ThisFileInfo['playtime_seconds'] *= $multiplier; - //$ThisFileInfo['warning'][] = 'Interleaved MPEG audio/video playtime may be inaccurate. With current hack should be within a few seconds of accurate. Report to info@getid3.org if off by more than 10 seconds.'; - if ($ThisFileInfo['video']['bitrate'] < 50000) { - $ThisFileInfo['warning'][] = 'Interleaved MPEG audio/video playtime may be slightly inaccurate for video bitrates below 100kbps. Except in extreme low-bitrate situations, error should be less than 1%. Report to info@getid3.org if greater than this.'; - } - } - - return true; - } - - - function MPEGsystemNonOverheadPercentage($VideoBitrate, $AudioBitrate) { - $OverheadPercentage = 0; - - $AudioBitrate = max(min($AudioBitrate / 1000, 384), 32); // limit to range of 32kbps - 384kbps (should be only legal bitrates, but maybe VBR?) - $VideoBitrate = max(min($VideoBitrate / 1000, 10000), 10); // limit to range of 10kbps - 10Mbps (beyond that curves flatten anyways, no big loss) - - - //OMBB[audiobitrate] = array(video-10kbps, video-100kbps, video-1000kbps, video-10000kbps) - $OverheadMultiplierByBitrate[32] = array(0, 0.9676287944368530, 0.9802276264360310, 0.9844916183244460, 0.9852821845179940); - $OverheadMultiplierByBitrate[48] = array(0, 0.9779100089209830, 0.9787770035359320, 0.9846738664076130, 0.9852683013799960); - $OverheadMultiplierByBitrate[56] = array(0, 0.9731249855367600, 0.9776624308938040, 0.9832606361852130, 0.9843922606633340); - $OverheadMultiplierByBitrate[64] = array(0, 0.9755642683275760, 0.9795256705493390, 0.9836573009193170, 0.9851122539404470); - $OverheadMultiplierByBitrate[96] = array(0, 0.9788025247497290, 0.9798553314148700, 0.9822956869792560, 0.9834815119124690); - $OverheadMultiplierByBitrate[128] = array(0, 0.9816940050925480, 0.9821675936072120, 0.9829756927470870, 0.9839763420152050); - $OverheadMultiplierByBitrate[160] = array(0, 0.9825894094561180, 0.9820913399073960, 0.9823907143253970, 0.9832821783651570); - $OverheadMultiplierByBitrate[192] = array(0, 0.9832038474336260, 0.9825731694317960, 0.9821028622712400, 0.9828262076447620); - $OverheadMultiplierByBitrate[224] = array(0, 0.9836516298538770, 0.9824718601823890, 0.9818302180625380, 0.9823735101626480); - $OverheadMultiplierByBitrate[256] = array(0, 0.9845863022094920, 0.9837229411967540, 0.9824521662210830, 0.9828645172100790); - $OverheadMultiplierByBitrate[320] = array(0, 0.9849565280263180, 0.9837683142805110, 0.9822885275960400, 0.9824424382727190); - $OverheadMultiplierByBitrate[384] = array(0, 0.9856094774357600, 0.9844573394432720, 0.9825970399837330, 0.9824673808303890); - - $BitrateToUseMin = 32; - $BitrateToUseMax = 32; - $previousBitrate = 32; - foreach ($OverheadMultiplierByBitrate as $key => $value) { - if ($AudioBitrate >= $previousBitrate) { - $BitrateToUseMin = $previousBitrate; - } - if ($AudioBitrate < $key) { - $BitrateToUseMax = $key; - break; - } - $previousBitrate = $key; - } - $FactorA = ($BitrateToUseMax - $AudioBitrate) / ($BitrateToUseMax - $BitrateToUseMin); - - $VideoBitrateLog10 = log10($VideoBitrate); - $VideoFactorMin1 = $OverheadMultiplierByBitrate[$BitrateToUseMin][floor($VideoBitrateLog10)]; - $VideoFactorMin2 = $OverheadMultiplierByBitrate[$BitrateToUseMax][floor($VideoBitrateLog10)]; - $VideoFactorMax1 = $OverheadMultiplierByBitrate[$BitrateToUseMin][ceil($VideoBitrateLog10)]; - $VideoFactorMax2 = $OverheadMultiplierByBitrate[$BitrateToUseMax][ceil($VideoBitrateLog10)]; - $FactorV = $VideoBitrateLog10 - floor($VideoBitrateLog10); - - $OverheadPercentage = $VideoFactorMin1 * $FactorA * $FactorV; - $OverheadPercentage += $VideoFactorMin2 * (1 - $FactorA) * $FactorV; - $OverheadPercentage += $VideoFactorMax1 * $FactorA * (1 - $FactorV); - $OverheadPercentage += $VideoFactorMax2 * (1 - $FactorA) * (1 - $FactorV); - - return $OverheadPercentage; - } - - - function MPEGvideoFramerateLookup($rawframerate) { - $MPEGvideoFramerateLookup = array(0, 23.976, 24, 25, 29.97, 30, 50, 59.94, 60); - return (isset($MPEGvideoFramerateLookup[$rawframerate]) ? (float) $MPEGvideoFramerateLookup[$rawframerate] : (float) 0); - } - - function MPEGvideoAspectRatioLookup($rawaspectratio) { - $MPEGvideoAspectRatioLookup = array(0, 1, 0.6735, 0.7031, 0.7615, 0.8055, 0.8437, 0.8935, 0.9157, 0.9815, 1.0255, 1.0695, 1.0950, 1.1575, 1.2015, 0); - return (isset($MPEGvideoAspectRatioLookup[$rawaspectratio]) ? (float) $MPEGvideoAspectRatioLookup[$rawaspectratio] : (float) 0); - } - - function MPEGvideoAspectRatioTextLookup($rawaspectratio) { - $MPEGvideoAspectRatioTextLookup = array('forbidden', 'square pixels', '0.6735', '16:9, 625 line, PAL', '0.7615', '0.8055', '16:9, 525 line, NTSC', '0.8935', '4:3, 625 line, PAL, CCIR601', '0.9815', '1.0255', '1.0695', '4:3, 525 line, NTSC, CCIR601', '1.1575', '1.2015', 'reserved'); - return (isset($MPEGvideoAspectRatioTextLookup[$rawaspectratio]) ? $MPEGvideoAspectRatioTextLookup[$rawaspectratio] : ''); - } - -} - - -?>
\ No newline at end of file diff --git a/getid3/module.audio-video.nsv.php b/getid3/module.audio-video.nsv.php deleted file mode 100644 index dab0338..0000000 --- a/getid3/module.audio-video.nsv.php +++ /dev/null @@ -1,224 +0,0 @@ -<?php -///////////////////////////////////////////////////////////////// -/// getID3() by James Heinrich <info@getid3.org> // -// available at http://getid3.sourceforge.net // -// or http://www.getid3.org // -///////////////////////////////////////////////////////////////// -// See readme.txt for more details // -///////////////////////////////////////////////////////////////// -// // -// module.audio.nsv.php // -// module for analyzing Nullsoft NSV files // -// dependencies: NONE // -// /// -///////////////////////////////////////////////////////////////// - - -class getid3_nsv -{ - - function getid3_nsv(&$fd, &$ThisFileInfo) { - - fseek($fd, $ThisFileInfo['avdataoffset'], SEEK_SET); - $NSVheader = fread($fd, 4); - - switch ($NSVheader) { - case 'NSVs': - if ($this->getNSVsHeaderFilepointer($fd, $ThisFileInfo, 0)) { - $ThisFileInfo['fileformat'] = 'nsv'; - $ThisFileInfo['audio']['dataformat'] = 'nsv'; - $ThisFileInfo['video']['dataformat'] = 'nsv'; - $ThisFileInfo['audio']['lossless'] = false; - $ThisFileInfo['video']['lossless'] = false; - } - break; - - case 'NSVf': - if ($this->getNSVfHeaderFilepointer($fd, $ThisFileInfo, 0)) { - $ThisFileInfo['fileformat'] = 'nsv'; - $ThisFileInfo['audio']['dataformat'] = 'nsv'; - $ThisFileInfo['video']['dataformat'] = 'nsv'; - $ThisFileInfo['audio']['lossless'] = false; - $ThisFileInfo['video']['lossless'] = false; - $this->getNSVsHeaderFilepointer($fd, $ThisFileInfo, $ThisFileInfo['nsv']['NSVf']['header_length']); - } - break; - - default: - $ThisFileInfo['error'][] = 'Expecting "NSVs" or "NSVf" at offset '.$ThisFileInfo['avdataoffset'].', found "'.$NSVheader.'"'; - return false; - break; - } - - if (!isset($ThisFileInfo['nsv']['NSVf'])) { - $ThisFileInfo['warning'][] = 'NSVf header not present - cannot calculate playtime or bitrate'; - } - - return true; - } - - function getNSVsHeaderFilepointer(&$fd, &$ThisFileInfo, $fileoffset) { - fseek($fd, $fileoffset, SEEK_SET); - $NSVsheader = fread($fd, 28); - $offset = 0; - - $ThisFileInfo['nsv']['NSVs']['identifier'] = substr($NSVsheader, $offset, 4); - $offset += 4; - - if ($ThisFileInfo['nsv']['NSVs']['identifier'] != 'NSVs') { - $ThisFileInfo['error'][] = 'expected "NSVs" at offset ('.$fileoffset.'), found "'.$ThisFileInfo['nsv']['NSVs']['identifier'].'" instead'; - unset($ThisFileInfo['nsv']['NSVs']); - return false; - } - - $ThisFileInfo['nsv']['NSVs']['offset'] = $fileoffset; - - $ThisFileInfo['nsv']['NSVs']['video_codec'] = substr($NSVsheader, $offset, 4); - $offset += 4; - $ThisFileInfo['nsv']['NSVs']['audio_codec'] = substr($NSVsheader, $offset, 4); - $offset += 4; - $ThisFileInfo['nsv']['NSVs']['resolution_x'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 2)); - $offset += 2; - $ThisFileInfo['nsv']['NSVs']['resolution_y'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 2)); - $offset += 2; - - $ThisFileInfo['nsv']['NSVs']['framerate_index'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 1)); - $offset += 1; - //$ThisFileInfo['nsv']['NSVs']['unknown1b'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 1)); - $offset += 1; - //$ThisFileInfo['nsv']['NSVs']['unknown1c'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 1)); - $offset += 1; - //$ThisFileInfo['nsv']['NSVs']['unknown1d'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 1)); - $offset += 1; - //$ThisFileInfo['nsv']['NSVs']['unknown2a'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 1)); - $offset += 1; - //$ThisFileInfo['nsv']['NSVs']['unknown2b'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 1)); - $offset += 1; - //$ThisFileInfo['nsv']['NSVs']['unknown2c'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 1)); - $offset += 1; - //$ThisFileInfo['nsv']['NSVs']['unknown2d'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 1)); - $offset += 1; - - switch ($ThisFileInfo['nsv']['NSVs']['audio_codec']) { - case 'PCM ': - $ThisFileInfo['nsv']['NSVs']['bits_channel'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 1)); - $offset += 1; - $ThisFileInfo['nsv']['NSVs']['channels'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 1)); - $offset += 1; - $ThisFileInfo['nsv']['NSVs']['sample_rate'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 2)); - $offset += 2; - - $ThisFileInfo['audio']['sample_rate'] = $ThisFileInfo['nsv']['NSVs']['sample_rate']; - break; - - case 'MP3 ': - case 'NONE': - default: - //$ThisFileInfo['nsv']['NSVs']['unknown3'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 4)); - $offset += 4; - break; - } - - $ThisFileInfo['video']['resolution_x'] = $ThisFileInfo['nsv']['NSVs']['resolution_x']; - $ThisFileInfo['video']['resolution_y'] = $ThisFileInfo['nsv']['NSVs']['resolution_y']; - $ThisFileInfo['nsv']['NSVs']['frame_rate'] = $this->NSVframerateLookup($ThisFileInfo['nsv']['NSVs']['framerate_index']); - $ThisFileInfo['video']['frame_rate'] = $ThisFileInfo['nsv']['NSVs']['frame_rate']; - $ThisFileInfo['video']['bits_per_sample'] = 24; - $ThisFileInfo['video']['pixel_aspect_ratio'] = (float) 1; - - return true; - } - - function getNSVfHeaderFilepointer(&$fd, &$ThisFileInfo, $fileoffset, $getTOCoffsets=false) { - fseek($fd, $fileoffset, SEEK_SET); - $NSVfheader = fread($fd, 28); - $offset = 0; - - $ThisFileInfo['nsv']['NSVf']['identifier'] = substr($NSVfheader, $offset, 4); - $offset += 4; - - if ($ThisFileInfo['nsv']['NSVf']['identifier'] != 'NSVf') { - $ThisFileInfo['error'][] = 'expected "NSVf" at offset ('.$fileoffset.'), found "'.$ThisFileInfo['nsv']['NSVf']['identifier'].'" instead'; - unset($ThisFileInfo['nsv']['NSVf']); - return false; - } - - $ThisFileInfo['nsv']['NSVs']['offset'] = $fileoffset; - - $ThisFileInfo['nsv']['NSVf']['header_length'] = getid3_lib::LittleEndian2Int(substr($NSVfheader, $offset, 4)); - $offset += 4; - $ThisFileInfo['nsv']['NSVf']['file_size'] = getid3_lib::LittleEndian2Int(substr($NSVfheader, $offset, 4)); - $offset += 4; - - if ($ThisFileInfo['nsv']['NSVf']['file_size'] > $ThisFileInfo['avdataend']) { - $ThisFileInfo['warning'][] = 'truncated file - NSVf header indicates '.$ThisFileInfo['nsv']['NSVf']['file_size'].' bytes, file actually '.$ThisFileInfo['avdataend'].' bytes'; - } - - $ThisFileInfo['nsv']['NSVf']['playtime_ms'] = getid3_lib::LittleEndian2Int(substr($NSVfheader, $offset, 4)); - $offset += 4; - $ThisFileInfo['nsv']['NSVf']['meta_size'] = getid3_lib::LittleEndian2Int(substr($NSVfheader, $offset, 4)); - $offset += 4; - $ThisFileInfo['nsv']['NSVf']['TOC_entries_1'] = getid3_lib::LittleEndian2Int(substr($NSVfheader, $offset, 4)); - $offset += 4; - $ThisFileInfo['nsv']['NSVf']['TOC_entries_2'] = getid3_lib::LittleEndian2Int(substr($NSVfheader, $offset, 4)); - $offset += 4; - - if ($ThisFileInfo['nsv']['NSVf']['playtime_ms'] == 0) { - $ThisFileInfo['error'][] = 'Corrupt NSV file: NSVf.playtime_ms == zero'; - return false; - } - - $NSVfheader .= fread($fd, $ThisFileInfo['nsv']['NSVf']['meta_size'] + (4 * $ThisFileInfo['nsv']['NSVf']['TOC_entries_1']) + (4 * $ThisFileInfo['nsv']['NSVf']['TOC_entries_2'])); - $NSVfheaderlength = strlen($NSVfheader); - $ThisFileInfo['nsv']['NSVf']['metadata'] = substr($NSVfheader, $offset, $ThisFileInfo['nsv']['NSVf']['meta_size']); - $offset += $ThisFileInfo['nsv']['NSVf']['meta_size']; - - if ($getTOCoffsets) { - $TOCcounter = 0; - while ($TOCcounter < $ThisFileInfo['nsv']['NSVf']['TOC_entries_1']) { - if ($TOCcounter < $ThisFileInfo['nsv']['NSVf']['TOC_entries_1']) { - $ThisFileInfo['nsv']['NSVf']['TOC_1'][$TOCcounter] = getid3_lib::LittleEndian2Int(substr($NSVfheader, $offset, 4)); - $offset += 4; - $TOCcounter++; - } - } - } - - if (trim($ThisFileInfo['nsv']['NSVf']['metadata']) != '') { - $ThisFileInfo['nsv']['NSVf']['metadata'] = str_replace('`', "\x01", $ThisFileInfo['nsv']['NSVf']['metadata']); - $CommentPairArray = explode("\x01".' ', $ThisFileInfo['nsv']['NSVf']['metadata']); - foreach ($CommentPairArray as $CommentPair) { - if (strstr($CommentPair, '='."\x01")) { - list($key, $value) = explode('='."\x01", $CommentPair, 2); - $ThisFileInfo['nsv']['comments'][strtolower($key)][] = trim(str_replace("\x01", '', $value)); - } - } - } - - $ThisFileInfo['playtime_seconds'] = $ThisFileInfo['nsv']['NSVf']['playtime_ms'] / 1000; - $ThisFileInfo['bitrate'] = ($ThisFileInfo['nsv']['NSVf']['file_size'] * 8) / $ThisFileInfo['playtime_seconds']; - - return true; - } - - - function NSVframerateLookup($framerateindex) { - if ($framerateindex <= 127) { - return (float) $framerateindex; - } - - static $NSVframerateLookup = array(); - if (empty($NSVframerateLookup)) { - $NSVframerateLookup[129] = (float) 29.970; - $NSVframerateLookup[131] = (float) 23.976; - $NSVframerateLookup[133] = (float) 14.985; - $NSVframerateLookup[197] = (float) 59.940; - $NSVframerateLookup[199] = (float) 47.952; - } - return (isset($NSVframerateLookup[$framerateindex]) ? $NSVframerateLookup[$framerateindex] : false); - } - -} - - -?>
\ No newline at end of file diff --git a/getid3/module.audio-video.quicktime.php b/getid3/module.audio-video.quicktime.php deleted file mode 100644 index 681daf7..0000000 --- a/getid3/module.audio-video.quicktime.php +++ /dev/null @@ -1,1382 +0,0 @@ -<?php -///////////////////////////////////////////////////////////////// -/// getID3() by James Heinrich <info@getid3.org> // -// available at http://getid3.sourceforge.net // -// or http://www.getid3.org // -///////////////////////////////////////////////////////////////// -// See readme.txt for more details // -///////////////////////////////////////////////////////////////// -// // -// module.audio-video.quicktime.php // -// module for analyzing Quicktime and MP3-in-MP4 files // -// dependencies: module.audio.mp3.php // -// /// -///////////////////////////////////////////////////////////////// - -getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio.mp3.php', __FILE__, true); - -class getid3_quicktime -{ - - function getid3_quicktime(&$fd, &$ThisFileInfo, $ReturnAtomData=true, $ParseAllPossibleAtoms=false) { - - $ThisFileInfo['fileformat'] = 'quicktime'; - $ThisFileInfo['quicktime']['hinting'] = false; - - fseek($fd, $ThisFileInfo['avdataoffset'], SEEK_SET); - - $offset = 0; - $atomcounter = 0; - - while ($offset < $ThisFileInfo['avdataend']) { - if ($offset >= pow(2, 31)) { - $ThisFileInfo['error'][] = 'Unable to parse atom at offset '.$offset.' because beyond 2GB limit of PHP filesystem functions'; - break; - } - fseek($fd, $offset, SEEK_SET); - $AtomHeader = fread($fd, 8); - - $atomsize = getid3_lib::BigEndian2Int(substr($AtomHeader, 0, 4)); - $atomname = substr($AtomHeader, 4, 4); - - // 64-bit MOV patch by jlegateØktnc*com - if ($atomsize == 1) { - $atomsize = getid3_lib::BigEndian2Int(fread($fd, 8)); - } - - $ThisFileInfo['quicktime'][$atomname]['name'] = $atomname; - $ThisFileInfo['quicktime'][$atomname]['size'] = $atomsize; - $ThisFileInfo['quicktime'][$atomname]['offset'] = $offset; - - if (($offset + $atomsize) > $ThisFileInfo['avdataend']) { - $ThisFileInfo['error'][] = 'Atom at offset '.$offset.' claims to go beyond end-of-file (length: '.$atomsize.' bytes)'; - return false; - } - - if ($atomsize == 0) { - // Furthermore, for historical reasons the list of atoms is optionally - // terminated by a 32-bit integer set to 0. If you are writing a program - // to read user data atoms, you should allow for the terminating 0. - break; - } - switch ($atomname) { - case 'mdat': // Media DATa atom - // 'mdat' contains the actual data for the audio/video - if (($atomsize > 8) && (!isset($ThisFileInfo['avdataend_tmp']) || ($ThisFileInfo['quicktime'][$atomname]['size'] > ($ThisFileInfo['avdataend_tmp'] - $ThisFileInfo['avdataoffset'])))) { - - $ThisFileInfo['avdataoffset'] = $ThisFileInfo['quicktime'][$atomname]['offset'] + 8; - $OldAVDataEnd = $ThisFileInfo['avdataend']; - $ThisFileInfo['avdataend'] = $ThisFileInfo['quicktime'][$atomname]['offset'] + $ThisFileInfo['quicktime'][$atomname]['size']; - - if (getid3_mp3::MPEGaudioHeaderValid(getid3_mp3::MPEGaudioHeaderDecode(fread($fd, 4)))) { - getid3_mp3::getOnlyMPEGaudioInfo($fd, $ThisFileInfo, $ThisFileInfo['avdataoffset'], false); - if (isset($ThisFileInfo['mpeg']['audio'])) { - $ThisFileInfo['audio']['dataformat'] = 'mp3'; - $ThisFileInfo['audio']['codec'] = (!empty($ThisFileInfo['mpeg']['audio']['encoder']) ? $ThisFileInfo['mpeg']['audio']['encoder'] : (!empty($ThisFileInfo['mpeg']['audio']['codec']) ? $ThisFileInfo['mpeg']['audio']['codec'] : (!empty($ThisFileInfo['mpeg']['audio']['LAME']) ? 'LAME' :'mp3'))); - $ThisFileInfo['audio']['sample_rate'] = $ThisFileInfo['mpeg']['audio']['sample_rate']; - $ThisFileInfo['audio']['channels'] = $ThisFileInfo['mpeg']['audio']['channels']; - $ThisFileInfo['audio']['bitrate'] = $ThisFileInfo['mpeg']['audio']['bitrate']; - $ThisFileInfo['audio']['bitrate_mode'] = strtolower($ThisFileInfo['mpeg']['audio']['bitrate_mode']); - $ThisFileInfo['bitrate'] = $ThisFileInfo['audio']['bitrate']; - } - } - $ThisFileInfo['avdataend'] = $OldAVDataEnd; - unset($OldAVDataEnd); - - } - break; - - case 'free': // FREE space atom - case 'skip': // SKIP atom - case 'wide': // 64-bit expansion placeholder atom - // 'free', 'skip' and 'wide' are just padding, contains no useful data at all - break; - - default: - $atomHierarchy = array(); - $ThisFileInfo['quicktime'][$atomname] = $this->QuicktimeParseAtom($atomname, $atomsize, fread($fd, $atomsize), $ThisFileInfo, $offset, $atomHierarchy, $ParseAllPossibleAtoms); - break; - } - - $offset += $atomsize; - $atomcounter++; - } - - if (!empty($ThisFileInfo['avdataend_tmp'])) { - // this value is assigned to a temp value and then erased because - // otherwise any atoms beyond the 'mdat' atom would not get parsed - $ThisFileInfo['avdataend'] = $ThisFileInfo['avdataend_tmp']; - unset($ThisFileInfo['avdataend_tmp']); - } - - if (!isset($ThisFileInfo['bitrate']) && isset($ThisFileInfo['playtime_seconds'])) { - $ThisFileInfo['bitrate'] = (($ThisFileInfo['avdataend'] - $ThisFileInfo['avdataoffset']) * 8) / $ThisFileInfo['playtime_seconds']; - } - if (isset($ThisFileInfo['bitrate']) && !isset($ThisFileInfo['audio']['bitrate']) && !isset($ThisFileInfo['quicktime']['video'])) { - $ThisFileInfo['audio']['bitrate'] = $ThisFileInfo['bitrate']; - } - if (@$ThisFileInfo['playtime_seconds'] && !isset($ThisFileInfo['video']['frame_rate']) && !empty($ThisFileInfo['quicktime']['stts_framecount'])) { - foreach ($ThisFileInfo['quicktime']['stts_framecount'] as $key => $samples_count) { - $samples_per_second = $samples_count / $ThisFileInfo['playtime_seconds']; - if ($samples_per_second > 240) { - // has to be audio samples - } else { - $ThisFileInfo['video']['frame_rate'] = $samples_per_second; - break; - } - } - } - if (($ThisFileInfo['audio']['dataformat'] == 'mp4') && empty($ThisFileInfo['video']['resolution_x'])) { - $ThisFileInfo['fileformat'] = 'mp4'; - $ThisFileInfo['mime_type'] = 'audio/mp4'; - unset($ThisFileInfo['video']['dataformat']); - } - - if (!$ReturnAtomData) { - unset($ThisFileInfo['quicktime']['moov']); - } - - if (empty($ThisFileInfo['audio']['dataformat']) && !empty($ThisFileInfo['quicktime']['audio'])) { - $ThisFileInfo['audio']['dataformat'] = 'quicktime'; - } - if (empty($ThisFileInfo['video']['dataformat']) && !empty($ThisFileInfo['quicktime']['video'])) { - $ThisFileInfo['video']['dataformat'] = 'quicktime'; - } - - return true; - } - - function QuicktimeParseAtom($atomname, $atomsize, $atomdata, &$ThisFileInfo, $baseoffset, &$atomHierarchy, $ParseAllPossibleAtoms) { - // http://developer.apple.com/techpubs/quicktime/qtdevdocs/APIREF/INDEX/atomalphaindex.htm - - array_push($atomHierarchy, $atomname); - $atomstructure['hierarchy'] = implode(' ', $atomHierarchy); - $atomstructure['name'] = $atomname; - $atomstructure['size'] = $atomsize; - $atomstructure['offset'] = $baseoffset; - - switch ($atomname) { - case 'moov': // MOVie container atom - case 'trak': // TRAcK container atom - case 'clip': // CLIPping container atom - case 'matt': // track MATTe container atom - case 'edts': // EDiTS container atom - case 'tref': // Track REFerence container atom - case 'mdia': // MeDIA container atom - case 'minf': // Media INFormation container atom - case 'dinf': // Data INFormation container atom - case 'udta': // User DaTA container atom - case 'cmov': // Compressed MOVie container atom - case 'rmra': // Reference Movie Record Atom - case 'rmda': // Reference Movie Descriptor Atom - case 'gmhd': // Generic Media info HeaDer atom (seen on QTVR) - $atomstructure['subatoms'] = $this->QuicktimeParseContainerAtom($atomdata, $ThisFileInfo, $baseoffset + 8, $atomHierarchy, $ParseAllPossibleAtoms); - break; - - case 'stbl': // Sample TaBLe container atom - $atomstructure['subatoms'] = $this->QuicktimeParseContainerAtom($atomdata, $ThisFileInfo, $baseoffset + 8, $atomHierarchy, $ParseAllPossibleAtoms); - $isVideo = false; - $framerate = 0; - $framecount = 0; - foreach ($atomstructure['subatoms'] as $key => $value_array) { - if (isset($value_array['sample_description_table'])) { - foreach ($value_array['sample_description_table'] as $key2 => $value_array2) { - if (isset($value_array2['data_format'])) { - switch ($value_array2['data_format']) { - case 'avc1': - case 'mp4v': - // video data - $isVideo = true; - break; - case 'mp4a': - // audio data - break; - } - } - } - } elseif (isset($value_array['time_to_sample_table'])) { - foreach ($value_array['time_to_sample_table'] as $key2 => $value_array2) { - if (isset($value_array2['sample_count']) && isset($value_array2['sample_duration'])) { - $framerate = round($ThisFileInfo['quicktime']['time_scale'] / $value_array2['sample_duration'], 3); - $framecount = $value_array2['sample_count']; - } - } - } - } - if ($isVideo && $framerate) { - $ThisFileInfo['quicktime']['video']['frame_rate'] = $framerate; - $ThisFileInfo['video']['frame_rate'] = $ThisFileInfo['quicktime']['video']['frame_rate']; - } - if ($isVideo && $framecount) { - $ThisFileInfo['quicktime']['video']['frame_count'] = $framecount; - } - break; - - - case '©cpy': - case '©day': - case '©dir': - case '©ed1': - case '©ed2': - case '©ed3': - case '©ed4': - case '©ed5': - case '©ed6': - case '©ed7': - case '©ed8': - case '©ed9': - case '©fmt': - case '©inf': - case '©prd': - case '©prf': - case '©req': - case '©src': - case '©wrt': - case '©nam': - case '©cmt': - case '©wrn': - case '©hst': - case '©mak': - case '©mod': - case '©PRD': - case '©swr': - case '©aut': - case '©ART': - case '©trk': - case '©alb': - case '©com': - case '©gen': - case '©ope': - case '©url': - case '©enc': - $atomstructure['data_length'] = getid3_lib::BigEndian2Int(substr($atomdata, 0, 2)); - $atomstructure['language_id'] = getid3_lib::BigEndian2Int(substr($atomdata, 2, 2)); - $atomstructure['data'] = substr($atomdata, 4); - - $atomstructure['language'] = $this->QuicktimeLanguageLookup($atomstructure['language_id']); - if (empty($ThisFileInfo['comments']['language']) || (!in_array($atomstructure['language'], $ThisFileInfo['comments']['language']))) { - $ThisFileInfo['comments']['language'][] = $atomstructure['language']; - } - $this->CopyToAppropriateCommentsSection($atomname, $atomstructure['data'], $ThisFileInfo); - break; - - - case 'play': // auto-PLAY atom - $atomstructure['autoplay'] = (bool) getid3_lib::BigEndian2Int(substr($atomdata, 0, 1)); - - $ThisFileInfo['quicktime']['autoplay'] = $atomstructure['autoplay']; - break; - - - case 'WLOC': // Window LOCation atom - $atomstructure['location_x'] = getid3_lib::BigEndian2Int(substr($atomdata, 0, 2)); - $atomstructure['location_y'] = getid3_lib::BigEndian2Int(substr($atomdata, 2, 2)); - break; - - - case 'LOOP': // LOOPing atom - case 'SelO': // play SELection Only atom - case 'AllF': // play ALL Frames atom - $atomstructure['data'] = getid3_lib::BigEndian2Int($atomdata); - break; - - - case 'name': // - case 'MCPS': // Media Cleaner PRo - case '@PRM': // adobe PReMiere version - case '@PRQ': // adobe PRemiere Quicktime version - $atomstructure['data'] = $atomdata; - break; - - - case 'cmvd': // Compressed MooV Data atom - // Code by ubergeekØubergeek*tv based on information from - // http://developer.apple.com/quicktime/icefloe/dispatch012.html - $atomstructure['unCompressedSize'] = getid3_lib::BigEndian2Int(substr($atomdata, 0, 4)); - - $CompressedFileData = substr($atomdata, 4); - if ($UncompressedHeader = @gzuncompress($CompressedFileData)) { - $atomstructure['subatoms'] = $this->QuicktimeParseContainerAtom($UncompressedHeader, $ThisFileInfo, 0, $atomHierarchy, $ParseAllPossibleAtoms); - } else { - $ThisFileInfo['warning'][] = 'Error decompressing compressed MOV atom at offset '.$atomstructure['offset']; - } - break; - - - case 'dcom': // Data COMpression atom - $atomstructure['compression_id'] = $atomdata; - $atomstructure['compression_text'] = $this->QuicktimeDCOMLookup($atomdata); - break; - - - case 'rdrf': // Reference movie Data ReFerence atom - $atomstructure['version'] = getid3_lib::BigEndian2Int(substr($atomdata, 0, 1)); - $atomstructure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atomdata, 1, 3)); - $atomstructure['flags']['internal_data'] = (bool) ($atomstructure['flags_raw'] & 0x000001); - - $atomstructure['reference_type_name'] = substr($atomdata, 4, 4); - $atomstructure['reference_length'] = getid3_lib::BigEndian2Int(substr($atomdata, 8, 4)); - switch ($atomstructure['reference_type_name']) { - case 'url ': - $atomstructure['url'] = $this->NoNullString(substr($atomdata, 12)); - break; - - case 'alis': - $atomstructure['file_alias'] = substr($atomdata, 12); - break; - - case 'rsrc': - $atomstructure['resource_alias'] = substr($atomdata, 12); - break; - - default: - $atomstructure['data'] = substr($atomdata, 12); - break; - } - break; - - - case 'rmqu': // Reference Movie QUality atom - $atomstructure['movie_quality'] = getid3_lib::BigEndian2Int($atomdata); - break; - - - case 'rmcs': // Reference Movie Cpu Speed atom - $atomstructure['version'] = getid3_lib::BigEndian2Int(substr($atomdata, 0, 1)); - $atomstructure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atomdata, 1, 3)); // hardcoded: 0x0000 - $atomstructure['cpu_speed_rating'] = getid3_lib::BigEndian2Int(substr($atomdata, 4, 2)); - break; - - - case 'rmvc': // Reference Movie Version Check atom - $atomstructure['version'] = getid3_lib::BigEndian2Int(substr($atomdata, 0, 1)); - $atomstructure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atomdata, 1, 3)); // hardcoded: 0x0000 - $atomstructure['gestalt_selector'] = substr($atomdata, 4, 4); - $atomstructure['gestalt_value_mask'] = getid3_lib::BigEndian2Int(substr($atomdata, 8, 4)); - $atomstructure['gestalt_value'] = getid3_lib::BigEndian2Int(substr($atomdata, 12, 4)); - $atomstructure['gestalt_check_type'] = getid3_lib::BigEndian2Int(substr($atomdata, 14, 2)); - break; - - - case 'rmcd': // Reference Movie Component check atom - $atomstructure['version'] = getid3_lib::BigEndian2Int(substr($atomdata, 0, 1)); - $atomstructure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atomdata, 1, 3)); // hardcoded: 0x0000 - $atomstructure['component_type'] = substr($atomdata, 4, 4); - $atomstructure['component_subtype'] = substr($atomdata, 8, 4); - $atomstructure['component_manufacturer'] = substr($atomdata, 12, 4); - $atomstructure['component_flags_raw'] = getid3_lib::BigEndian2Int(substr($atomdata, 16, 4)); - $atomstructure['component_flags_mask'] = getid3_lib::BigEndian2Int(substr($atomdata, 20, 4)); - $atomstructure['component_min_version'] = getid3_lib::BigEndian2Int(substr($atomdata, 24, 4)); - break; - - - case 'rmdr': // Reference Movie Data Rate atom - $atomstructure['version'] = getid3_lib::BigEndian2Int(substr($atomdata, 0, 1)); - $atomstructure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atomdata, 1, 3)); // hardcoded: 0x0000 - $atomstructure['data_rate'] = getid3_lib::BigEndian2Int(substr($atomdata, 4, 4)); - - $atomstructure['data_rate_bps'] = $atomstructure['data_rate'] * 10; - break; - - - case 'rmla': // Reference Movie Language Atom - $atomstructure['version'] = getid3_lib::BigEndian2Int(substr($atomdata, 0, 1)); - $atomstructure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atomdata, 1, 3)); // hardcoded: 0x0000 - $atomstructure['language_id'] = getid3_lib::BigEndian2Int(substr($atomdata, 4, 2)); - - $atomstructure['language'] = $this->QuicktimeLanguageLookup($atomstructure['language_id']); - if (empty($ThisFileInfo['comments']['language']) || (!in_array($atomstructure['language'], $ThisFileInfo['comments']['language']))) { - $ThisFileInfo['comments']['language'][] = $atomstructure['language']; - } - break; - - - case 'rmla': // Reference Movie Language Atom - $atomstructure['version'] = getid3_lib::BigEndian2Int(substr($atomdata, 0, 1)); - $atomstructure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atomdata, 1, 3)); // hardcoded: 0x0000 - $atomstructure['track_id'] = getid3_lib::BigEndian2Int(substr($atomdata, 4, 2)); - break; - - - case 'ptv ': // Print To Video - defines a movie's full screen mode - // http://developer.apple.com/documentation/QuickTime/APIREF/SOURCESIV/at_ptv-_pg.htm - $atomstructure['display_size_raw'] = getid3_lib::BigEndian2Int(substr($atomdata, 0, 2)); - $atomstructure['reserved_1'] = getid3_lib::BigEndian2Int(substr($atomdata, 2, 2)); // hardcoded: 0x0000 - $atomstructure['reserved_2'] = getid3_lib::BigEndian2Int(substr($atomdata, 4, 2)); // hardcoded: 0x0000 - $atomstructure['slide_show_flag'] = getid3_lib::BigEndian2Int(substr($atomdata, 6, 1)); - $atomstructure['play_on_open_flag'] = getid3_lib::BigEndian2Int(substr($atomdata, 7, 1)); - - $atomstructure['flags']['play_on_open'] = (bool) $atomstructure['play_on_open_flag']; - $atomstructure['flags']['slide_show'] = (bool) $atomstructure['slide_show_flag']; - - $ptv_lookup[0] = 'normal'; - $ptv_lookup[1] = 'double'; - $ptv_lookup[2] = 'half'; - $ptv_lookup[3] = 'full'; - $ptv_lookup[4] = 'current'; - if (isset($ptv_lookup[$atomstructure['display_size_raw']])) { - $atomstructure['display_size'] = $ptv_lookup[$atomstructure['display_size_raw']]; - } else { - $ThisFileInfo['warning'][] = 'unknown "ptv " display constant ('.$atomstructure['display_size_raw'].')'; - } - break; - - - case 'stsd': // Sample Table Sample Description atom - $atomstructure['version'] = getid3_lib::BigEndian2Int(substr($atomdata, 0, 1)); - $atomstructure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atomdata, 1, 3)); // hardcoded: 0x0000 - $atomstructure['number_entries'] = getid3_lib::BigEndian2Int(substr($atomdata, 4, 4)); - $stsdEntriesDataOffset = 8; - for ($i = 0; $i < $atomstructure['number_entries']; $i++) { - $atomstructure['sample_description_table'][$i]['size'] = getid3_lib::BigEndian2Int(substr($atomdata, $stsdEntriesDataOffset, 4)); - $stsdEntriesDataOffset += 4; - $atomstructure['sample_description_table'][$i]['data_format'] = substr($atomdata, $stsdEntriesDataOffset, 4); - $stsdEntriesDataOffset += 4; - $atomstructure['sample_description_table'][$i]['reserved'] = getid3_lib::BigEndian2Int(substr($atomdata, $stsdEntriesDataOffset, 6)); - $stsdEntriesDataOffset += 6; - $atomstructure['sample_description_table'][$i]['reference_index'] = getid3_lib::BigEndian2Int(substr($atomdata, $stsdEntriesDataOffset, 2)); - $stsdEntriesDataOffset += 2; - $atomstructure['sample_description_table'][$i]['data'] = substr($atomdata, $stsdEntriesDataOffset, ($atomstructure['sample_description_table'][$i]['size'] - 4 - 4 - 6 - 2)); - $stsdEntriesDataOffset += ($atomstructure['sample_description_table'][$i]['size'] - 4 - 4 - 6 - 2); - - $atomstructure['sample_description_table'][$i]['encoder_version'] = getid3_lib::BigEndian2Int(substr($atomstructure['sample_description_table'][$i]['data'], 0, 2)); - $atomstructure['sample_description_table'][$i]['encoder_revision'] = getid3_lib::BigEndian2Int(substr($atomstructure['sample_description_table'][$i]['data'], 2, 2)); - $atomstructure['sample_description_table'][$i]['encoder_vendor'] = substr($atomstructure['sample_description_table'][$i]['data'], 4, 4); - - switch ($atomstructure['sample_description_table'][$i]['encoder_vendor']) { - - case "\x00\x00\x00\x00": - // audio atom - $atomstructure['sample_description_table'][$i]['audio_channels'] = getid3_lib::BigEndian2Int(substr($atomstructure['sample_description_table'][$i]['data'], 8, 2)); - $atomstructure['sample_description_table'][$i]['audio_bit_depth'] = getid3_lib::BigEndian2Int(substr($atomstructure['sample_description_table'][$i]['data'], 10, 2)); - $atomstructure['sample_description_table'][$i]['audio_compression_id'] = getid3_lib::BigEndian2Int(substr($atomstructure['sample_description_table'][$i]['data'], 12, 2)); - $atomstructure['sample_description_table'][$i]['audio_packet_size'] = getid3_lib::BigEndian2Int(substr($atomstructure['sample_description_table'][$i]['data'], 14, 2)); - $atomstructure['sample_description_table'][$i]['audio_sample_rate'] = getid3_lib::FixedPoint16_16(substr($atomstructure['sample_description_table'][$i]['data'], 16, 4)); - - switch ($atomstructure['sample_description_table'][$i]['data_format']) { - case 'avc1': - case 'mp4v': - $ThisFileInfo['fileformat'] = 'mp4'; - $ThisFileInfo['video']['fourcc'] = $atomstructure['sample_description_table'][$i]['data_format']; - $ThisFileInfo['warning'][] = 'This version ('.GETID3_VERSION.') of getID3() does not fully support MPEG-4 audio/video streams'; - break; - - case 'qtvr': - $ThisFileInfo['video']['dataformat'] = 'quicktimevr'; - break; - - case 'mp4a': - default: - $ThisFileInfo['quicktime']['audio']['codec'] = $this->QuicktimeAudioCodecLookup($atomstructure['sample_description_table'][$i]['data_format']); - $ThisFileInfo['quicktime']['audio']['sample_rate'] = $atomstructure['sample_description_table'][$i]['audio_sample_rate']; - $ThisFileInfo['quicktime']['audio']['channels'] = $atomstructure['sample_description_table'][$i]['audio_channels']; - $ThisFileInfo['quicktime']['audio']['bit_depth'] = $atomstructure['sample_description_table'][$i]['audio_bit_depth']; - $ThisFileInfo['audio']['codec'] = $ThisFileInfo['quicktime']['audio']['codec']; - $ThisFileInfo['audio']['sample_rate'] = $ThisFileInfo['quicktime']['audio']['sample_rate']; - $ThisFileInfo['audio']['channels'] = $ThisFileInfo['quicktime']['audio']['channels']; - $ThisFileInfo['audio']['bits_per_sample'] = $ThisFileInfo['quicktime']['audio']['bit_depth']; - switch ($atomstructure['sample_description_table'][$i]['data_format']) { - case 'raw ': // PCM - case 'alac': // Apple Lossless Audio Codec - $ThisFileInfo['audio']['lossless'] = true; - break; - default: - $ThisFileInfo['audio']['lossless'] = false; - break; - } - break; - } - break; - - default: - switch ($atomstructure['sample_description_table'][$i]['data_format']) { - case 'mp4s': - $ThisFileInfo['fileformat'] = 'mp4'; - break; - - default: - // video atom - $atomstructure['sample_description_table'][$i]['video_temporal_quality'] = getid3_lib::BigEndian2Int(substr($atomstructure['sample_description_table'][$i]['data'], 8, 4)); - $atomstructure['sample_description_table'][$i]['video_spatial_quality'] = getid3_lib::BigEndian2Int(substr($atomstructure['sample_description_table'][$i]['data'], 12, 4)); - $atomstructure['sample_description_table'][$i]['video_frame_width'] = getid3_lib::BigEndian2Int(substr($atomstructure['sample_description_table'][$i]['data'], 16, 2)); - $atomstructure['sample_description_table'][$i]['video_frame_height'] = getid3_lib::BigEndian2Int(substr($atomstructure['sample_description_table'][$i]['data'], 18, 2)); - $atomstructure['sample_description_table'][$i]['video_resolution_x'] = getid3_lib::FixedPoint16_16(substr($atomstructure['sample_description_table'][$i]['data'], 20, 4)); - $atomstructure['sample_description_table'][$i]['video_resolution_y'] = getid3_lib::FixedPoint16_16(substr($atomstructure['sample_description_table'][$i]['data'], 24, 4)); - $atomstructure['sample_description_table'][$i]['video_data_size'] = getid3_lib::BigEndian2Int(substr($atomstructure['sample_description_table'][$i]['data'], 28, 4)); - $atomstructure['sample_description_table'][$i]['video_frame_count'] = getid3_lib::BigEndian2Int(substr($atomstructure['sample_description_table'][$i]['data'], 32, 2)); - $atomstructure['sample_description_table'][$i]['video_encoder_name_len'] = getid3_lib::BigEndian2Int(substr($atomstructure['sample_description_table'][$i]['data'], 34, 1)); - $atomstructure['sample_description_table'][$i]['video_encoder_name'] = substr($atomstructure['sample_description_table'][$i]['data'], 35, $atomstructure['sample_description_table'][$i]['video_encoder_name_len']); - $atomstructure['sample_description_table'][$i]['video_pixel_color_depth'] = getid3_lib::BigEndian2Int(substr($atomstructure['sample_description_table'][$i]['data'], 66, 2)); - $atomstructure['sample_description_table'][$i]['video_color_table_id'] = getid3_lib::BigEndian2Int(substr($atomstructure['sample_description_table'][$i]['data'], 68, 2)); - - $atomstructure['sample_description_table'][$i]['video_pixel_color_type'] = (($atomstructure['sample_description_table'][$i]['video_pixel_color_depth'] > 32) ? 'grayscale' : 'color'); - $atomstructure['sample_description_table'][$i]['video_pixel_color_name'] = $this->QuicktimeColorNameLookup($atomstructure['sample_description_table'][$i]['video_pixel_color_depth']); - - if ($atomstructure['sample_description_table'][$i]['video_pixel_color_name'] != 'invalid') { - $ThisFileInfo['quicktime']['video']['codec_fourcc'] = $atomstructure['sample_description_table'][$i]['data_format']; - $ThisFileInfo['quicktime']['video']['codec_fourcc_lookup'] = $this->QuicktimeVideoCodecLookup($atomstructure['sample_description_table'][$i]['data_format']); - $ThisFileInfo['quicktime']['video']['codec'] = $atomstructure['sample_description_table'][$i]['video_encoder_name']; - $ThisFileInfo['quicktime']['video']['color_depth'] = $atomstructure['sample_description_table'][$i]['video_pixel_color_depth']; - $ThisFileInfo['quicktime']['video']['color_depth_name'] = $atomstructure['sample_description_table'][$i]['video_pixel_color_name']; - - $ThisFileInfo['video']['codec'] = $ThisFileInfo['quicktime']['video']['codec']; - $ThisFileInfo['video']['bits_per_sample'] = $ThisFileInfo['quicktime']['video']['color_depth']; - } - $ThisFileInfo['video']['lossless'] = false; - $ThisFileInfo['video']['pixel_aspect_ratio'] = (float) 1; - break; - } - break; - } - switch (strtolower($atomstructure['sample_description_table'][$i]['data_format'])) { - case 'mp4a': - $ThisFileInfo['audio']['dataformat'] = 'mp4'; - $ThisFileInfo['quicktime']['audio']['codec'] = 'mp4'; - break; - - case '3ivx': - case '3iv1': - case '3iv2': - $ThisFileInfo['video']['dataformat'] = '3ivx'; - break; - - case 'xvid': - $ThisFileInfo['video']['dataformat'] = 'xvid'; - break; - - case 'mp4v': - $ThisFileInfo['video']['dataformat'] = 'mpeg4'; - break; - - case 'divx': - case 'div1': - case 'div2': - case 'div3': - case 'div4': - case 'div5': - case 'div6': - $TDIVXileInfo['video']['dataformat'] = 'divx'; - break; - - default: - // do nothing - break; - } - unset($atomstructure['sample_description_table'][$i]['data']); - } - break; - - - case 'stts': // Sample Table Time-to-Sample atom - $atomstructure['version'] = getid3_lib::BigEndian2Int(substr($atomdata, 0, 1)); - $atomstructure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atomdata, 1, 3)); // hardcoded: 0x0000 - $atomstructure['number_entries'] = getid3_lib::BigEndian2Int(substr($atomdata, 4, 4)); - $sttsEntriesDataOffset = 8; - //$FrameRateCalculatorArray = array(); - $frames_count = 0; - for ($i = 0; $i < $atomstructure['number_entries']; $i++) { - $atomstructure['time_to_sample_table'][$i]['sample_count'] = getid3_lib::BigEndian2Int(substr($atomdata, $sttsEntriesDataOffset, 4)); - $sttsEntriesDataOffset += 4; - $atomstructure['time_to_sample_table'][$i]['sample_duration'] = getid3_lib::BigEndian2Int(substr($atomdata, $sttsEntriesDataOffset, 4)); - $sttsEntriesDataOffset += 4; - - $frames_count += $atomstructure['time_to_sample_table'][$i]['sample_count']; - - // THIS SECTION REPLACED WITH CODE IN "stbl" ATOM - //if (!empty($ThisFileInfo['quicktime']['time_scale']) && (@$atomstructure['time_to_sample_table'][$i]['sample_duration'] > 0)) { - // $stts_new_framerate = $ThisFileInfo['quicktime']['time_scale'] / $atomstructure['time_to_sample_table'][$i]['sample_duration']; - // if ($stts_new_framerate <= 60) { - // // some atoms have durations of "1" giving a very large framerate, which probably is not right - // $ThisFileInfo['video']['frame_rate'] = max(@$ThisFileInfo['video']['frame_rate'], $stts_new_framerate); - // } - //} - // - //@$FrameRateCalculatorArray[($ThisFileInfo['quicktime']['time_scale'] / $atomstructure['time_to_sample_table'][$i]['sample_duration'])] += $atomstructure['time_to_sample_table'][$i]['sample_count']; - } - $ThisFileInfo['quicktime']['stts_framecount'][] = $frames_count; - //$sttsFramesTotal = 0; - //$sttsSecondsTotal = 0; - //foreach ($FrameRateCalculatorArray as $frames_per_second => $frame_count) { - // if (($frames_per_second > 60) || ($frames_per_second < 1)) { - // // not video FPS information, probably audio information - // $sttsFramesTotal = 0; - // $sttsSecondsTotal = 0; - // break; - // } - // $sttsFramesTotal += $frame_count; - // $sttsSecondsTotal += $frame_count / $frames_per_second; - //} - //if (($sttsFramesTotal > 0) && ($sttsSecondsTotal > 0)) { - // if (($sttsFramesTotal / $sttsSecondsTotal) > @$ThisFileInfo['video']['frame_rate']) { - // $ThisFileInfo['video']['frame_rate'] = $sttsFramesTotal / $sttsSecondsTotal; - // } - //} - break; - - - case 'stss': // Sample Table Sync Sample (key frames) atom - if ($ParseAllPossibleAtoms) { - $atomstructure['version'] = getid3_lib::BigEndian2Int(substr($atomdata, 0, 1)); - $atomstructure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atomdata, 1, 3)); // hardcoded: 0x0000 - $atomstructure['number_entries'] = getid3_lib::BigEndian2Int(substr($atomdata, 4, 4)); - $stssEntriesDataOffset = 8; - for ($i = 0; $i < $atomstructure['number_entries']; $i++) { - $atomstructure['time_to_sample_table'][$i] = getid3_lib::BigEndian2Int(substr($atomdata, $stssEntriesDataOffset, 4)); - $stssEntriesDataOffset += 4; - } - } - break; - - - case 'stsc': // Sample Table Sample-to-Chunk atom - if ($ParseAllPossibleAtoms) { - $atomstructure['version'] = getid3_lib::BigEndian2Int(substr($atomdata, 0, 1)); - $atomstructure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atomdata, 1, 3)); // hardcoded: 0x0000 - $atomstructure['number_entries'] = getid3_lib::BigEndian2Int(substr($atomdata, 4, 4)); - $stscEntriesDataOffset = 8; - for ($i = 0; $i < $atomstructure['number_entries']; $i++) { - $atomstructure['sample_to_chunk_table'][$i]['first_chunk'] = getid3_lib::BigEndian2Int(substr($atomdata, $stscEntriesDataOffset, 4)); - $stscEntriesDataOffset += 4; - $atomstructure['sample_to_chunk_table'][$i]['samples_per_chunk'] = getid3_lib::BigEndian2Int(substr($atomdata, $stscEntriesDataOffset, 4)); - $stscEntriesDataOffset += 4; - $atomstructure['sample_to_chunk_table'][$i]['sample_description'] = getid3_lib::BigEndian2Int(substr($atomdata, $stscEntriesDataOffset, 4)); - $stscEntriesDataOffset += 4; - } - } - break; - - - case 'stsz': // Sample Table SiZe atom - if ($ParseAllPossibleAtoms) { - $atomstructure['version'] = getid3_lib::BigEndian2Int(substr($atomdata, 0, 1)); - $atomstructure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atomdata, 1, 3)); // hardcoded: 0x0000 - $atomstructure['sample_size'] = getid3_lib::BigEndian2Int(substr($atomdata, 4, 4)); - $atomstructure['number_entries'] = getid3_lib::BigEndian2Int(substr($atomdata, 8, 4)); - $stszEntriesDataOffset = 12; - if ($atomstructure['sample_size'] == 0) { - for ($i = 0; $i < $atomstructure['number_entries']; $i++) { - $atomstructure['sample_size_table'][$i] = getid3_lib::BigEndian2Int(substr($atomdata, $stszEntriesDataOffset, 4)); - $stszEntriesDataOffset += 4; - } - } - } - break; - - - case 'stco': // Sample Table Chunk Offset atom - if ($ParseAllPossibleAtoms) { - $atomstructure['version'] = getid3_lib::BigEndian2Int(substr($atomdata, 0, 1)); - $atomstructure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atomdata, 1, 3)); // hardcoded: 0x0000 - $atomstructure['number_entries'] = getid3_lib::BigEndian2Int(substr($atomdata, 4, 4)); - $stcoEntriesDataOffset = 8; - for ($i = 0; $i < $atomstructure['number_entries']; $i++) { - $atomstructure['chunk_offset_table'][$i] = getid3_lib::BigEndian2Int(substr($atomdata, $stcoEntriesDataOffset, 4)); - $stcoEntriesDataOffset += 4; - } - } - break; - - - case 'co64': // Chunk Offset 64-bit (version of "stco" that supports > 2GB files) - if ($ParseAllPossibleAtoms) { - $atomstructure['version'] = getid3_lib::BigEndian2Int(substr($atomdata, 0, 1)); - $atomstructure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atomdata, 1, 3)); // hardcoded: 0x0000 - $atomstructure['number_entries'] = getid3_lib::BigEndian2Int(substr($atomdata, 4, 4)); - $stcoEntriesDataOffset = 8; - for ($i = 0; $i < $atomstructure['number_entries']; $i++) { - $atomstructure['chunk_offset_table'][$i] = getid3_lib::BigEndian2Int(substr($atomdata, $stcoEntriesDataOffset, 8)); - $stcoEntriesDataOffset += 8; - } - } - break; - - - case 'dref': // Data REFerence atom - $atomstructure['version'] = getid3_lib::BigEndian2Int(substr($atomdata, 0, 1)); - $atomstructure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atomdata, 1, 3)); // hardcoded: 0x0000 - $atomstructure['number_entries'] = getid3_lib::BigEndian2Int(substr($atomdata, 4, 4)); - $drefDataOffset = 8; - for ($i = 0; $i < $atomstructure['number_entries']; $i++) { - $atomstructure['data_references'][$i]['size'] = getid3_lib::BigEndian2Int(substr($atomdata, $drefDataOffset, 4)); - $drefDataOffset += 4; - $atomstructure['data_references'][$i]['type'] = substr($atomdata, $drefDataOffset, 4); - $drefDataOffset += 4; - $atomstructure['data_references'][$i]['version'] = getid3_lib::BigEndian2Int(substr($atomdata, $drefDataOffset, 1)); - $drefDataOffset += 1; - $atomstructure['data_references'][$i]['flags_raw'] = getid3_lib::BigEndian2Int(substr($atomdata, $drefDataOffset, 3)); // hardcoded: 0x0000 - $drefDataOffset += 3; - $atomstructure['data_references'][$i]['data'] = substr($atomdata, $drefDataOffset, ($atomstructure['data_references'][$i]['size'] - 4 - 4 - 1 - 3)); - $drefDataOffset += ($atomstructure['data_references'][$i]['size'] - 4 - 4 - 1 - 3); - - $atomstructure['data_references'][$i]['flags']['self_reference'] = (bool) ($atomstructure['data_references'][$i]['flags_raw'] & 0x001); - } - break; - - - case 'gmin': // base Media INformation atom - $atomstructure['version'] = getid3_lib::BigEndian2Int(substr($atomdata, 0, 1)); - $atomstructure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atomdata, 1, 3)); // hardcoded: 0x0000 - $atomstructure['graphics_mode'] = getid3_lib::BigEndian2Int(substr($atomdata, 4, 2)); - $atomstructure['opcolor_red'] = getid3_lib::BigEndian2Int(substr($atomdata, 6, 2)); - $atomstructure['opcolor_green'] = getid3_lib::BigEndian2Int(substr($atomdata, 8, 2)); - $atomstructure['opcolor_blue'] = getid3_lib::BigEndian2Int(substr($atomdata, 10, 2)); - $atomstructure['balance'] = getid3_lib::BigEndian2Int(substr($atomdata, 12, 2)); - $atomstructure['reserved'] = getid3_lib::BigEndian2Int(substr($atomdata, 14, 2)); - break; - - - case 'smhd': // Sound Media information HeaDer atom - $atomstructure['version'] = getid3_lib::BigEndian2Int(substr($atomdata, 0, 1)); - $atomstructure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atomdata, 1, 3)); // hardcoded: 0x0000 - $atomstructure['balance'] = getid3_lib::BigEndian2Int(substr($atomdata, 4, 2)); - $atomstructure['reserved'] = getid3_lib::BigEndian2Int(substr($atomdata, 6, 2)); - break; - - - case 'vmhd': // Video Media information HeaDer atom - $atomstructure['version'] = getid3_lib::BigEndian2Int(substr($atomdata, 0, 1)); - $atomstructure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atomdata, 1, 3)); - $atomstructure['graphics_mode'] = getid3_lib::BigEndian2Int(substr($atomdata, 4, 2)); - $atomstructure['opcolor_red'] = getid3_lib::BigEndian2Int(substr($atomdata, 6, 2)); - $atomstructure['opcolor_green'] = getid3_lib::BigEndian2Int(substr($atomdata, 8, 2)); - $atomstructure['opcolor_blue'] = getid3_lib::BigEndian2Int(substr($atomdata, 10, 2)); - - $atomstructure['flags']['no_lean_ahead'] = (bool) ($atomstructure['flags_raw'] & 0x001); - break; - - - case 'hdlr': // HanDLeR reference atom - $atomstructure['version'] = getid3_lib::BigEndian2Int(substr($atomdata, 0, 1)); - $atomstructure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atomdata, 1, 3)); // hardcoded: 0x0000 - $atomstructure['component_type'] = substr($atomdata, 4, 4); - $atomstructure['component_subtype'] = substr($atomdata, 8, 4); - $atomstructure['component_manufacturer'] = substr($atomdata, 12, 4); - $atomstructure['component_flags_raw'] = getid3_lib::BigEndian2Int(substr($atomdata, 16, 4)); - $atomstructure['component_flags_mask'] = getid3_lib::BigEndian2Int(substr($atomdata, 20, 4)); - $atomstructure['component_name'] = $this->Pascal2String(substr($atomdata, 24)); - - if (($atomstructure['component_subtype'] == 'STpn') && ($atomstructure['component_manufacturer'] == 'zzzz')) { - $ThisFileInfo['video']['dataformat'] = 'quicktimevr'; - } - break; - - - case 'mdhd': // MeDia HeaDer atom - $atomstructure['version'] = getid3_lib::BigEndian2Int(substr($atomdata, 0, 1)); - $atomstructure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atomdata, 1, 3)); // hardcoded: 0x0000 - $atomstructure['creation_time'] = getid3_lib::BigEndian2Int(substr($atomdata, 4, 4)); - $atomstructure['modify_time'] = getid3_lib::BigEndian2Int(substr($atomdata, 8, 4)); - $atomstructure['time_scale'] = getid3_lib::BigEndian2Int(substr($atomdata, 12, 4)); - $atomstructure['duration'] = getid3_lib::BigEndian2Int(substr($atomdata, 16, 4)); - $atomstructure['language_id'] = getid3_lib::BigEndian2Int(substr($atomdata, 20, 2)); - $atomstructure['quality'] = getid3_lib::BigEndian2Int(substr($atomdata, 22, 2)); - - if ($atomstructure['time_scale'] == 0) { - $ThisFileInfo['error'][] = 'Corrupt Quicktime file: mdhd.time_scale == zero'; - return false; - } - $ThisFileInfo['quicktime']['time_scale'] = max(@$ThisFileInfo['quicktime']['time_scale'], $atomstructure['time_scale']); - - $atomstructure['creation_time_unix'] = getid3_lib::DateMac2Unix($atomstructure['creation_time']); - $atomstructure['modify_time_unix'] = getid3_lib::DateMac2Unix($atomstructure['modify_time']); - $atomstructure['playtime_seconds'] = $atomstructure['duration'] / $atomstructure['time_scale']; - $atomstructure['language'] = $this->QuicktimeLanguageLookup($atomstructure['language_id']); - if (empty($ThisFileInfo['comments']['language']) || (!in_array($atomstructure['language'], $ThisFileInfo['comments']['language']))) { - $ThisFileInfo['comments']['language'][] = $atomstructure['language']; - } - break; - - - case 'pnot': // Preview atom - $atomstructure['modification_date'] = getid3_lib::BigEndian2Int(substr($atomdata, 0, 4)); // "standard Macintosh format" - $atomstructure['version_number'] = getid3_lib::BigEndian2Int(substr($atomdata, 4, 2)); // hardcoded: 0x00 - $atomstructure['atom_type'] = substr($atomdata, 6, 4); // usually: 'PICT' - $atomstructure['atom_index'] = getid3_lib::BigEndian2Int(substr($atomdata, 10, 2)); // usually: 0x01 - - $atomstructure['modification_date_unix'] = getid3_lib::DateMac2Unix($atomstructure['modification_date']); - break; - - - case 'crgn': // Clipping ReGioN atom - $atomstructure['region_size'] = getid3_lib::BigEndian2Int(substr($atomdata, 0, 2)); // The Region size, Region boundary box, - $atomstructure['boundary_box'] = getid3_lib::BigEndian2Int(substr($atomdata, 2, 8)); // and Clipping region data fields - $atomstructure['clipping_data'] = substr($atomdata, 10); // constitute a QuickDraw region. - break; - - - case 'load': // track LOAD settings atom - $atomstructure['preload_start_time'] = getid3_lib::BigEndian2Int(substr($atomdata, 0, 4)); - $atomstructure['preload_duration'] = getid3_lib::BigEndian2Int(substr($atomdata, 4, 4)); - $atomstructure['preload_flags_raw'] = getid3_lib::BigEndian2Int(substr($atomdata, 8, 4)); - $atomstructure['default_hints_raw'] = getid3_lib::BigEndian2Int(substr($atomdata, 12, 4)); - - $atomstructure['default_hints']['double_buffer'] = (bool) ($atomstructure['default_hints_raw'] & 0x0020); - $atomstructure['default_hints']['high_quality'] = (bool) ($atomstructure['default_hints_raw'] & 0x0100); - break; - - - case 'tmcd': // TiMe CoDe atom - case 'chap': // CHAPter list atom - case 'sync': // SYNChronization atom - case 'scpt': // tranSCriPT atom - case 'ssrc': // non-primary SouRCe atom - for ($i = 0; $i < (strlen($atomdata) % 4); $i++) { - $atomstructure['track_id'][$i] = getid3_lib::BigEndian2Int(substr($atomdata, $i * 4, 4)); - } - break; - - - case 'elst': // Edit LiST atom - $atomstructure['version'] = getid3_lib::BigEndian2Int(substr($atomdata, 0, 1)); - $atomstructure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atomdata, 1, 3)); // hardcoded: 0x0000 - $atomstructure['number_entries'] = getid3_lib::BigEndian2Int(substr($atomdata, 4, 4)); - for ($i = 0; $i < $atomstructure['number_entries']; $i++ ) { - $atomstructure['edit_list'][$i]['track_duration'] = getid3_lib::BigEndian2Int(substr($atomdata, 8 + ($i * 12) + 0, 4)); - $atomstructure['edit_list'][$i]['media_time'] = getid3_lib::BigEndian2Int(substr($atomdata, 8 + ($i * 12) + 4, 4)); - $atomstructure['edit_list'][$i]['media_rate'] = getid3_lib::FixedPoint16_16(substr($atomdata, 8 + ($i * 12) + 8, 4)); - } - break; - - - case 'kmat': // compressed MATte atom - $atomstructure['version'] = getid3_lib::BigEndian2Int(substr($atomdata, 0, 1)); - $atomstructure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atomdata, 1, 3)); // hardcoded: 0x0000 - $atomstructure['matte_data_raw'] = substr($atomdata, 4); - break; - - - case 'ctab': // Color TABle atom - $atomstructure['color_table_seed'] = getid3_lib::BigEndian2Int(substr($atomdata, 0, 4)); // hardcoded: 0x00000000 - $atomstructure['color_table_flags'] = getid3_lib::BigEndian2Int(substr($atomdata, 4, 2)); // hardcoded: 0x8000 - $atomstructure['color_table_size'] = getid3_lib::BigEndian2Int(substr($atomdata, 6, 2)) + 1; - for ($colortableentry = 0; $colortableentry < $atomstructure['color_table_size']; $colortableentry++) { - $atomstructure['color_table'][$colortableentry]['alpha'] = getid3_lib::BigEndian2Int(substr($atomdata, 8 + ($colortableentry * 8) + 0, 2)); - $atomstructure['color_table'][$colortableentry]['red'] = getid3_lib::BigEndian2Int(substr($atomdata, 8 + ($colortableentry * 8) + 2, 2)); - $atomstructure['color_table'][$colortableentry]['green'] = getid3_lib::BigEndian2Int(substr($atomdata, 8 + ($colortableentry * 8) + 4, 2)); - $atomstructure['color_table'][$colortableentry]['blue'] = getid3_lib::BigEndian2Int(substr($atomdata, 8 + ($colortableentry * 8) + 6, 2)); - } - break; - - - case 'mvhd': // MoVie HeaDer atom - $atomstructure['version'] = getid3_lib::BigEndian2Int(substr($atomdata, 0, 1)); - $atomstructure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atomdata, 1, 3)); - $atomstructure['creation_time'] = getid3_lib::BigEndian2Int(substr($atomdata, 4, 4)); - $atomstructure['modify_time'] = getid3_lib::BigEndian2Int(substr($atomdata, 8, 4)); - $atomstructure['time_scale'] = getid3_lib::BigEndian2Int(substr($atomdata, 12, 4)); - $atomstructure['duration'] = getid3_lib::BigEndian2Int(substr($atomdata, 16, 4)); - $atomstructure['preferred_rate'] = getid3_lib::FixedPoint16_16(substr($atomdata, 20, 4)); - $atomstructure['preferred_volume'] = getid3_lib::FixedPoint8_8(substr($atomdata, 24, 2)); - $atomstructure['reserved'] = substr($atomdata, 26, 10); - $atomstructure['matrix_a'] = getid3_lib::FixedPoint16_16(substr($atomdata, 36, 4)); - $atomstructure['matrix_b'] = getid3_lib::FixedPoint16_16(substr($atomdata, 40, 4)); - $atomstructure['matrix_u'] = getid3_lib::FixedPoint2_30(substr($atomdata, 44, 4)); - $atomstructure['matrix_c'] = getid3_lib::FixedPoint16_16(substr($atomdata, 48, 4)); - $atomstructure['matrix_d'] = getid3_lib::FixedPoint16_16(substr($atomdata, 52, 4)); - $atomstructure['matrix_v'] = getid3_lib::FixedPoint2_30(substr($atomdata, 56, 4)); - $atomstructure['matrix_x'] = getid3_lib::FixedPoint16_16(substr($atomdata, 60, 4)); - $atomstructure['matrix_y'] = getid3_lib::FixedPoint16_16(substr($atomdata, 64, 4)); - $atomstructure['matrix_w'] = getid3_lib::FixedPoint2_30(substr($atomdata, 68, 4)); - $atomstructure['preview_time'] = getid3_lib::BigEndian2Int(substr($atomdata, 72, 4)); - $atomstructure['preview_duration'] = getid3_lib::BigEndian2Int(substr($atomdata, 76, 4)); - $atomstructure['poster_time'] = getid3_lib::BigEndian2Int(substr($atomdata, 80, 4)); - $atomstructure['selection_time'] = getid3_lib::BigEndian2Int(substr($atomdata, 84, 4)); - $atomstructure['selection_duration'] = getid3_lib::BigEndian2Int(substr($atomdata, 88, 4)); - $atomstructure['current_time'] = getid3_lib::BigEndian2Int(substr($atomdata, 92, 4)); - $atomstructure['next_track_id'] = getid3_lib::BigEndian2Int(substr($atomdata, 96, 4)); - - if ($atomstructure['time_scale'] == 0) { - $ThisFileInfo['error'][] = 'Corrupt Quicktime file: mvhd.time_scale == zero'; - return false; - } - $atomstructure['creation_time_unix'] = getid3_lib::DateMac2Unix($atomstructure['creation_time']); - $atomstructure['modify_time_unix'] = getid3_lib::DateMac2Unix($atomstructure['modify_time']); - $ThisFileInfo['quicktime']['time_scale'] = max(@$ThisFileInfo['quicktime']['time_scale'], $atomstructure['time_scale']); - $ThisFileInfo['quicktime']['display_scale'] = $atomstructure['matrix_a']; - $ThisFileInfo['playtime_seconds'] = $atomstructure['duration'] / $atomstructure['time_scale']; - break; - - - case 'tkhd': // TracK HeaDer atom - $atomstructure['version'] = getid3_lib::BigEndian2Int(substr($atomdata, 0, 1)); - $atomstructure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atomdata, 1, 3)); - $atomstructure['creation_time'] = getid3_lib::BigEndian2Int(substr($atomdata, 4, 4)); - $atomstructure['modify_time'] = getid3_lib::BigEndian2Int(substr($atomdata, 8, 4)); - $atomstructure['trackid'] = getid3_lib::BigEndian2Int(substr($atomdata, 12, 4)); - $atomstructure['reserved1'] = getid3_lib::BigEndian2Int(substr($atomdata, 16, 4)); - $atomstructure['duration'] = getid3_lib::BigEndian2Int(substr($atomdata, 20, 4)); - $atomstructure['reserved2'] = getid3_lib::BigEndian2Int(substr($atomdata, 24, 8)); - $atomstructure['layer'] = getid3_lib::BigEndian2Int(substr($atomdata, 32, 2)); - $atomstructure['alternate_group'] = getid3_lib::BigEndian2Int(substr($atomdata, 34, 2)); - $atomstructure['volume'] = getid3_lib::FixedPoint8_8(substr($atomdata, 36, 2)); - $atomstructure['reserved3'] = getid3_lib::BigEndian2Int(substr($atomdata, 38, 2)); - $atomstructure['matrix_a'] = getid3_lib::FixedPoint16_16(substr($atomdata, 40, 4)); - $atomstructure['matrix_b'] = getid3_lib::FixedPoint16_16(substr($atomdata, 44, 4)); - $atomstructure['matrix_u'] = getid3_lib::FixedPoint16_16(substr($atomdata, 48, 4)); - $atomstructure['matrix_c'] = getid3_lib::FixedPoint16_16(substr($atomdata, 52, 4)); - $atomstructure['matrix_d'] = getid3_lib::FixedPoint16_16(substr($atomdata, 56, 4)); - $atomstructure['matrix_v'] = getid3_lib::FixedPoint16_16(substr($atomdata, 60, 4)); - $atomstructure['matrix_x'] = getid3_lib::FixedPoint2_30(substr($atomdata, 64, 4)); - $atomstructure['matrix_y'] = getid3_lib::FixedPoint2_30(substr($atomdata, 68, 4)); - $atomstructure['matrix_w'] = getid3_lib::FixedPoint2_30(substr($atomdata, 72, 4)); - $atomstructure['width'] = getid3_lib::FixedPoint16_16(substr($atomdata, 76, 4)); - $atomstructure['height'] = getid3_lib::FixedPoint16_16(substr($atomdata, 80, 4)); - - $atomstructure['flags']['enabled'] = (bool) ($atomstructure['flags_raw'] & 0x0001); - $atomstructure['flags']['in_movie'] = (bool) ($atomstructure['flags_raw'] & 0x0002); - $atomstructure['flags']['in_preview'] = (bool) ($atomstructure['flags_raw'] & 0x0004); - $atomstructure['flags']['in_poster'] = (bool) ($atomstructure['flags_raw'] & 0x0008); - $atomstructure['creation_time_unix'] = getid3_lib::DateMac2Unix($atomstructure['creation_time']); - $atomstructure['modify_time_unix'] = getid3_lib::DateMac2Unix($atomstructure['modify_time']); - - if (!isset($ThisFileInfo['video']['resolution_x']) || !isset($ThisFileInfo['video']['resolution_y'])) { - $ThisFileInfo['video']['resolution_x'] = $atomstructure['width']; - $ThisFileInfo['video']['resolution_y'] = $atomstructure['height']; - } - if ($atomstructure['flags']['enabled'] == 1) { - $ThisFileInfo['video']['resolution_x'] = max($ThisFileInfo['video']['resolution_x'], $atomstructure['width']); - $ThisFileInfo['video']['resolution_y'] = max($ThisFileInfo['video']['resolution_y'], $atomstructure['height']); - } - if (!empty($ThisFileInfo['video']['resolution_x']) && !empty($ThisFileInfo['video']['resolution_y'])) { - $ThisFileInfo['quicktime']['video']['resolution_x'] = $ThisFileInfo['video']['resolution_x']; - $ThisFileInfo['quicktime']['video']['resolution_y'] = $ThisFileInfo['video']['resolution_y']; - } else { - unset($ThisFileInfo['video']['resolution_x']); - unset($ThisFileInfo['video']['resolution_y']); - unset($ThisFileInfo['quicktime']['video']); - } - break; - - - case 'meta': // METAdata atom - // http://www.geocities.com/xhelmboyx/quicktime/formats/qti-layout.txt - $NextTagPosition = strpos($atomdata, '©'); - while ($NextTagPosition < strlen($atomdata)) { - $metaItemSize = getid3_lib::BigEndian2Int(substr($atomdata, $NextTagPosition - 4, 4)) - 4; - if ($metaItemSize == -4) { - break; - } - $metaItemRaw = substr($atomdata, $NextTagPosition, $metaItemSize); - $metaItemKey = substr($metaItemRaw, 0, 4); - $metaItemData = substr($metaItemRaw, 20); - $NextTagPosition += $metaItemSize + 4; - - $this->CopyToAppropriateCommentsSection($metaItemKey, $metaItemData, $ThisFileInfo); - } - break; - - case 'ftyp': // FileTYPe (?) atom (for MP4 it seems) - $atomstructure['signature'] = substr($atomdata, 0, 4); - $atomstructure['unknown_1'] = getid3_lib::BigEndian2Int(substr($atomdata, 4, 4)); - $atomstructure['fourcc'] = substr($atomdata, 8, 4); - break; - - case 'mdat': // Media DATa atom - case 'free': // FREE space atom - case 'skip': // SKIP atom - case 'wide': // 64-bit expansion placeholder atom - // 'mdat' data is too big to deal with, contains no useful metadata - // 'free', 'skip' and 'wide' are just padding, contains no useful data at all - - // When writing QuickTime files, it is sometimes necessary to update an atom's size. - // It is impossible to update a 32-bit atom to a 64-bit atom since the 32-bit atom - // is only 8 bytes in size, and the 64-bit atom requires 16 bytes. Therefore, QuickTime - // puts an 8-byte placeholder atom before any atoms it may have to update the size of. - // In this way, if the atom needs to be converted from a 32-bit to a 64-bit atom, the - // placeholder atom can be overwritten to obtain the necessary 8 extra bytes. - // The placeholder atom has a type of kWideAtomPlaceholderType ( 'wide' ). - break; - - - case 'nsav': // NoSAVe atom - // http://developer.apple.com/technotes/tn/tn2038.html - $atomstructure['data'] = getid3_lib::BigEndian2Int(substr($atomdata, 0, 4)); - break; - - case 'ctyp': // Controller TYPe atom (seen on QTVR) - // http://homepages.slingshot.co.nz/~helmboy/quicktime/formats/qtm-layout.txt - // some controller names are: - // 0x00 + 'std' for linear movie - // 'none' for no controls - $atomstructure['ctyp'] = substr($atomdata, 0, 4); - switch ($atomstructure['ctyp']) { - case 'qtvr': - $ThisFileInfo['video']['dataformat'] = 'quicktimevr'; - break; - } - break; - - case 'pano': // PANOrama track (seen on QTVR) - $atomstructure['pano'] = getid3_lib::BigEndian2Int(substr($atomdata, 0, 4)); - break; - - case 'hint': // HINT track - case 'hinf': // - case 'hinv': // - case 'hnti': // - $ThisFileInfo['quicktime']['hinting'] = true; - break; - - case 'imgt': // IMaGe Track reference (kQTVRImageTrackRefType) (seen on QTVR) - for ($i = 0; $i < ($atomstructure['size'] - 8); $i += 4) { - $atomstructure['imgt'][] = getid3_lib::BigEndian2Int(substr($atomdata, $i, 4)); - } - break; - - case 'FXTC': // Something to do with Adobe After Effects (?) - case 'PrmA': - case 'code': - case 'FIEL': // this is NOT "fiel" (Field Ordering) as describe here: http://developer.apple.com/documentation/QuickTime/QTFF/QTFFChap3/chapter_4_section_2.html - // Observed-but-not-handled atom types are just listed here - // to prevent warnings being generated - $atomstructure['data'] = $atomdata; - break; - - default: - $ThisFileInfo['warning'][] = 'Unknown QuickTime atom type: "'.$atomname.'" at offset '.$baseoffset; - $atomstructure['data'] = $atomdata; - break; - } - array_pop($atomHierarchy); - return $atomstructure; - } - - function QuicktimeParseContainerAtom($atomdata, &$ThisFileInfo, $baseoffset, &$atomHierarchy, $ParseAllPossibleAtoms) { - $atomstructure = false; - $subatomoffset = 0; - $subatomcounter = 0; - if ((strlen($atomdata) == 4) && (getid3_lib::BigEndian2Int($atomdata) == 0x00000000)) { - return false; - } - while ($subatomoffset < strlen($atomdata)) { - $subatomsize = getid3_lib::BigEndian2Int(substr($atomdata, $subatomoffset + 0, 4)); - $subatomname = substr($atomdata, $subatomoffset + 4, 4); - $subatomdata = substr($atomdata, $subatomoffset + 8, $subatomsize - 8); - if ($subatomsize == 0) { - // Furthermore, for historical reasons the list of atoms is optionally - // terminated by a 32-bit integer set to 0. If you are writing a program - // to read user data atoms, you should allow for the terminating 0. - return $atomstructure; - } - - $atomstructure[$subatomcounter] = $this->QuicktimeParseAtom($subatomname, $subatomsize, $subatomdata, $ThisFileInfo, $baseoffset + $subatomoffset, $atomHierarchy, $ParseAllPossibleAtoms); - - $subatomoffset += $subatomsize; - $subatomcounter++; - } - return $atomstructure; - } - - - function QuicktimeLanguageLookup($languageid) { - static $QuicktimeLanguageLookup = array(); - if (empty($QuicktimeLanguageLookup)) { - $QuicktimeLanguageLookup[0] = 'English'; - $QuicktimeLanguageLookup[1] = 'French'; - $QuicktimeLanguageLookup[2] = 'German'; - $QuicktimeLanguageLookup[3] = 'Italian'; - $QuicktimeLanguageLookup[4] = 'Dutch'; - $QuicktimeLanguageLookup[5] = 'Swedish'; - $QuicktimeLanguageLookup[6] = 'Spanish'; - $QuicktimeLanguageLookup[7] = 'Danish'; - $QuicktimeLanguageLookup[8] = 'Portuguese'; - $QuicktimeLanguageLookup[9] = 'Norwegian'; - $QuicktimeLanguageLookup[10] = 'Hebrew'; - $QuicktimeLanguageLookup[11] = 'Japanese'; - $QuicktimeLanguageLookup[12] = 'Arabic'; - $QuicktimeLanguageLookup[13] = 'Finnish'; - $QuicktimeLanguageLookup[14] = 'Greek'; - $QuicktimeLanguageLookup[15] = 'Icelandic'; - $QuicktimeLanguageLookup[16] = 'Maltese'; - $QuicktimeLanguageLookup[17] = 'Turkish'; - $QuicktimeLanguageLookup[18] = 'Croatian'; - $QuicktimeLanguageLookup[19] = 'Chinese (Traditional)'; - $QuicktimeLanguageLookup[20] = 'Urdu'; - $QuicktimeLanguageLookup[21] = 'Hindi'; - $QuicktimeLanguageLookup[22] = 'Thai'; - $QuicktimeLanguageLookup[23] = 'Korean'; - $QuicktimeLanguageLookup[24] = 'Lithuanian'; - $QuicktimeLanguageLookup[25] = 'Polish'; - $QuicktimeLanguageLookup[26] = 'Hungarian'; - $QuicktimeLanguageLookup[27] = 'Estonian'; - $QuicktimeLanguageLookup[28] = 'Lettish'; - $QuicktimeLanguageLookup[28] = 'Latvian'; - $QuicktimeLanguageLookup[29] = 'Saamisk'; - $QuicktimeLanguageLookup[29] = 'Lappish'; - $QuicktimeLanguageLookup[30] = 'Faeroese'; - $QuicktimeLanguageLookup[31] = 'Farsi'; - $QuicktimeLanguageLookup[31] = 'Persian'; - $QuicktimeLanguageLookup[32] = 'Russian'; - $QuicktimeLanguageLookup[33] = 'Chinese (Simplified)'; - $QuicktimeLanguageLookup[34] = 'Flemish'; - $QuicktimeLanguageLookup[35] = 'Irish'; - $QuicktimeLanguageLookup[36] = 'Albanian'; - $QuicktimeLanguageLookup[37] = 'Romanian'; - $QuicktimeLanguageLookup[38] = 'Czech'; - $QuicktimeLanguageLookup[39] = 'Slovak'; - $QuicktimeLanguageLookup[40] = 'Slovenian'; - $QuicktimeLanguageLookup[41] = 'Yiddish'; - $QuicktimeLanguageLookup[42] = 'Serbian'; - $QuicktimeLanguageLookup[43] = 'Macedonian'; - $QuicktimeLanguageLookup[44] = 'Bulgarian'; - $QuicktimeLanguageLookup[45] = 'Ukrainian'; - $QuicktimeLanguageLookup[46] = 'Byelorussian'; - $QuicktimeLanguageLookup[47] = 'Uzbek'; - $QuicktimeLanguageLookup[48] = 'Kazakh'; - $QuicktimeLanguageLookup[49] = 'Azerbaijani'; - $QuicktimeLanguageLookup[50] = 'AzerbaijanAr'; - $QuicktimeLanguageLookup[51] = 'Armenian'; - $QuicktimeLanguageLookup[52] = 'Georgian'; - $QuicktimeLanguageLookup[53] = 'Moldavian'; - $QuicktimeLanguageLookup[54] = 'Kirghiz'; - $QuicktimeLanguageLookup[55] = 'Tajiki'; - $QuicktimeLanguageLookup[56] = 'Turkmen'; - $QuicktimeLanguageLookup[57] = 'Mongolian'; - $QuicktimeLanguageLookup[58] = 'MongolianCyr'; - $QuicktimeLanguageLookup[59] = 'Pashto'; - $QuicktimeLanguageLookup[60] = 'Kurdish'; - $QuicktimeLanguageLookup[61] = 'Kashmiri'; - $QuicktimeLanguageLookup[62] = 'Sindhi'; - $QuicktimeLanguageLookup[63] = 'Tibetan'; - $QuicktimeLanguageLookup[64] = 'Nepali'; - $QuicktimeLanguageLookup[65] = 'Sanskrit'; - $QuicktimeLanguageLookup[66] = 'Marathi'; - $QuicktimeLanguageLookup[67] = 'Bengali'; - $QuicktimeLanguageLookup[68] = 'Assamese'; - $QuicktimeLanguageLookup[69] = 'Gujarati'; - $QuicktimeLanguageLookup[70] = 'Punjabi'; - $QuicktimeLanguageLookup[71] = 'Oriya'; - $QuicktimeLanguageLookup[72] = 'Malayalam'; - $QuicktimeLanguageLookup[73] = 'Kannada'; - $QuicktimeLanguageLookup[74] = 'Tamil'; - $QuicktimeLanguageLookup[75] = 'Telugu'; - $QuicktimeLanguageLookup[76] = 'Sinhalese'; - $QuicktimeLanguageLookup[77] = 'Burmese'; - $QuicktimeLanguageLookup[78] = 'Khmer'; - $QuicktimeLanguageLookup[79] = 'Lao'; - $QuicktimeLanguageLookup[80] = 'Vietnamese'; - $QuicktimeLanguageLookup[81] = 'Indonesian'; - $QuicktimeLanguageLookup[82] = 'Tagalog'; - $QuicktimeLanguageLookup[83] = 'MalayRoman'; - $QuicktimeLanguageLookup[84] = 'MalayArabic'; - $QuicktimeLanguageLookup[85] = 'Amharic'; - $QuicktimeLanguageLookup[86] = 'Tigrinya'; - $QuicktimeLanguageLookup[87] = 'Galla'; - $QuicktimeLanguageLookup[87] = 'Oromo'; - $QuicktimeLanguageLookup[88] = 'Somali'; - $QuicktimeLanguageLookup[89] = 'Swahili'; - $QuicktimeLanguageLookup[90] = 'Ruanda'; - $QuicktimeLanguageLookup[91] = 'Rundi'; - $QuicktimeLanguageLookup[92] = 'Chewa'; - $QuicktimeLanguageLookup[93] = 'Malagasy'; - $QuicktimeLanguageLookup[94] = 'Esperanto'; - $QuicktimeLanguageLookup[128] = 'Welsh'; - $QuicktimeLanguageLookup[129] = 'Basque'; - $QuicktimeLanguageLookup[130] = 'Catalan'; - $QuicktimeLanguageLookup[131] = 'Latin'; - $QuicktimeLanguageLookup[132] = 'Quechua'; - $QuicktimeLanguageLookup[133] = 'Guarani'; - $QuicktimeLanguageLookup[134] = 'Aymara'; - $QuicktimeLanguageLookup[135] = 'Tatar'; - $QuicktimeLanguageLookup[136] = 'Uighur'; - $QuicktimeLanguageLookup[137] = 'Dzongkha'; - $QuicktimeLanguageLookup[138] = 'JavaneseRom'; - } - return (isset($QuicktimeLanguageLookup[$languageid]) ? $QuicktimeLanguageLookup[$languageid] : 'invalid'); - } - - function QuicktimeVideoCodecLookup($codecid) { - static $QuicktimeVideoCodecLookup = array(); - if (empty($QuicktimeVideoCodecLookup)) { - $QuicktimeVideoCodecLookup['3IVX'] = '3ivx MPEG-4'; - $QuicktimeVideoCodecLookup['3IV1'] = '3ivx MPEG-4 v1'; - $QuicktimeVideoCodecLookup['3IV2'] = '3ivx MPEG-4 v2'; - $QuicktimeVideoCodecLookup['avr '] = 'AVR-JPEG'; - $QuicktimeVideoCodecLookup['base'] = 'Base'; - $QuicktimeVideoCodecLookup['WRLE'] = 'BMP'; - $QuicktimeVideoCodecLookup['cvid'] = 'Cinepak'; - $QuicktimeVideoCodecLookup['clou'] = 'Cloud'; - $QuicktimeVideoCodecLookup['cmyk'] = 'CMYK'; - $QuicktimeVideoCodecLookup['yuv2'] = 'ComponentVideo'; - $QuicktimeVideoCodecLookup['yuvu'] = 'ComponentVideoSigned'; - $QuicktimeVideoCodecLookup['yuvs'] = 'ComponentVideoUnsigned'; - $QuicktimeVideoCodecLookup['dvc '] = 'DVC-NTSC'; - $QuicktimeVideoCodecLookup['dvcp'] = 'DVC-PAL'; - $QuicktimeVideoCodecLookup['dvpn'] = 'DVCPro-NTSC'; - $QuicktimeVideoCodecLookup['dvpp'] = 'DVCPro-PAL'; - $QuicktimeVideoCodecLookup['fire'] = 'Fire'; - $QuicktimeVideoCodecLookup['flic'] = 'FLC'; - $QuicktimeVideoCodecLookup['b48r'] = '48RGB'; - $QuicktimeVideoCodecLookup['gif '] = 'GIF'; - $QuicktimeVideoCodecLookup['smc '] = 'Graphics'; - $QuicktimeVideoCodecLookup['h261'] = 'H261'; - $QuicktimeVideoCodecLookup['h263'] = 'H263'; - $QuicktimeVideoCodecLookup['IV41'] = 'Indeo4'; - $QuicktimeVideoCodecLookup['jpeg'] = 'JPEG'; - $QuicktimeVideoCodecLookup['PNTG'] = 'MacPaint'; - $QuicktimeVideoCodecLookup['msvc'] = 'Microsoft Video1'; - $QuicktimeVideoCodecLookup['mjpa'] = 'Motion JPEG-A'; - $QuicktimeVideoCodecLookup['mjpb'] = 'Motion JPEG-B'; - $QuicktimeVideoCodecLookup['myuv'] = 'MPEG YUV420'; - $QuicktimeVideoCodecLookup['dmb1'] = 'OpenDML JPEG'; - $QuicktimeVideoCodecLookup['kpcd'] = 'PhotoCD'; - $QuicktimeVideoCodecLookup['8BPS'] = 'Planar RGB'; - $QuicktimeVideoCodecLookup['png '] = 'PNG'; - $QuicktimeVideoCodecLookup['qdrw'] = 'QuickDraw'; - $QuicktimeVideoCodecLookup['qdgx'] = 'QuickDrawGX'; - $QuicktimeVideoCodecLookup['raw '] = 'RAW'; - $QuicktimeVideoCodecLookup['.SGI'] = 'SGI'; - $QuicktimeVideoCodecLookup['b16g'] = '16Gray'; - $QuicktimeVideoCodecLookup['b64a'] = '64ARGB'; - $QuicktimeVideoCodecLookup['SVQ1'] = 'Sorenson Video 1'; - $QuicktimeVideoCodecLookup['SVQ1'] = 'Sorenson Video 3'; - $QuicktimeVideoCodecLookup['syv9'] = 'Sorenson YUV9'; - $QuicktimeVideoCodecLookup['tga '] = 'Targa'; - $QuicktimeVideoCodecLookup['b32a'] = '32AlphaGray'; - $QuicktimeVideoCodecLookup['tiff'] = 'TIFF'; - $QuicktimeVideoCodecLookup['path'] = 'Vector'; - $QuicktimeVideoCodecLookup['rpza'] = 'Video'; - $QuicktimeVideoCodecLookup['ripl'] = 'WaterRipple'; - $QuicktimeVideoCodecLookup['WRAW'] = 'Windows RAW'; - $QuicktimeVideoCodecLookup['y420'] = 'YUV420'; - } - return (isset($QuicktimeVideoCodecLookup[$codecid]) ? $QuicktimeVideoCodecLookup[$codecid] : ''); - } - - function QuicktimeAudioCodecLookup($codecid) { - static $QuicktimeAudioCodecLookup = array(); - if (empty($QuicktimeAudioCodecLookup)) { - $QuicktimeAudioCodecLookup['.mp3'] = 'Fraunhofer MPEG Layer-III alias'; - $QuicktimeAudioCodecLookup['aac '] = 'ISO/IEC 14496-3 AAC'; - $QuicktimeAudioCodecLookup['agsm'] = 'Apple GSM 10:1'; - $QuicktimeAudioCodecLookup['alac'] = 'Apple Lossless Audio Codec'; - $QuicktimeAudioCodecLookup['alaw'] = 'A-law 2:1'; - $QuicktimeAudioCodecLookup['conv'] = 'Sample Format'; - $QuicktimeAudioCodecLookup['dvca'] = 'DV'; - $QuicktimeAudioCodecLookup['dvi '] = 'DV 4:1'; - $QuicktimeAudioCodecLookup['eqal'] = 'Frequency Equalizer'; - $QuicktimeAudioCodecLookup['fl32'] = '32-bit Floating Point'; - $QuicktimeAudioCodecLookup['fl64'] = '64-bit Floating Point'; - $QuicktimeAudioCodecLookup['ima4'] = 'Interactive Multimedia Association 4:1'; - $QuicktimeAudioCodecLookup['in24'] = '24-bit Integer'; - $QuicktimeAudioCodecLookup['in32'] = '32-bit Integer'; - $QuicktimeAudioCodecLookup['lpc '] = 'LPC 23:1'; - $QuicktimeAudioCodecLookup['MAC3'] = 'Macintosh Audio Compression/Expansion (MACE) 3:1'; - $QuicktimeAudioCodecLookup['MAC6'] = 'Macintosh Audio Compression/Expansion (MACE) 6:1'; - $QuicktimeAudioCodecLookup['mixb'] = '8-bit Mixer'; - $QuicktimeAudioCodecLookup['mixw'] = '16-bit Mixer'; - $QuicktimeAudioCodecLookup['mp4a'] = 'ISO/IEC 14496-3 AAC'; - $QuicktimeAudioCodecLookup['MS'."\x00\x02"] = 'Microsoft ADPCM'; - $QuicktimeAudioCodecLookup['MS'."\x00\x11"] = 'DV IMA'; - $QuicktimeAudioCodecLookup['MS'."\x00\x55"] = 'Fraunhofer MPEG Layer III'; - $QuicktimeAudioCodecLookup['NONE'] = 'No Encoding'; - $QuicktimeAudioCodecLookup['Qclp'] = 'Qualcomm PureVoice'; - $QuicktimeAudioCodecLookup['QDM2'] = 'QDesign Music 2'; - $QuicktimeAudioCodecLookup['QDMC'] = 'QDesign Music 1'; - $QuicktimeAudioCodecLookup['ratb'] = '8-bit Rate'; - $QuicktimeAudioCodecLookup['ratw'] = '16-bit Rate'; - $QuicktimeAudioCodecLookup['raw '] = 'raw PCM'; - $QuicktimeAudioCodecLookup['sour'] = 'Sound Source'; - $QuicktimeAudioCodecLookup['sowt'] = 'signed/two\'s complement (Little Endian)'; - $QuicktimeAudioCodecLookup['str1'] = 'Iomega MPEG layer II'; - $QuicktimeAudioCodecLookup['str2'] = 'Iomega MPEG *layer II'; - $QuicktimeAudioCodecLookup['str3'] = 'Iomega MPEG **layer II'; - $QuicktimeAudioCodecLookup['str4'] = 'Iomega MPEG ***layer II'; - $QuicktimeAudioCodecLookup['twos'] = 'signed/two\'s complement (Big Endian)'; - $QuicktimeAudioCodecLookup['ulaw'] = 'mu-law 2:1'; - } - return (isset($QuicktimeAudioCodecLookup[$codecid]) ? $QuicktimeAudioCodecLookup[$codecid] : ''); - } - - function QuicktimeDCOMLookup($compressionid) { - static $QuicktimeDCOMLookup = array(); - if (empty($QuicktimeDCOMLookup)) { - $QuicktimeDCOMLookup['zlib'] = 'ZLib Deflate'; - $QuicktimeDCOMLookup['adec'] = 'Apple Compression'; - } - return (isset($QuicktimeDCOMLookup[$compressionid]) ? $QuicktimeDCOMLookup[$compressionid] : ''); - } - - function QuicktimeColorNameLookup($colordepthid) { - static $QuicktimeColorNameLookup = array(); - if (empty($QuicktimeColorNameLookup)) { - $QuicktimeColorNameLookup[1] = '2-color (monochrome)'; - $QuicktimeColorNameLookup[2] = '4-color'; - $QuicktimeColorNameLookup[4] = '16-color'; - $QuicktimeColorNameLookup[8] = '256-color'; - $QuicktimeColorNameLookup[16] = 'thousands (16-bit color)'; - $QuicktimeColorNameLookup[24] = 'millions (24-bit color)'; - $QuicktimeColorNameLookup[32] = 'millions+ (32-bit color)'; - $QuicktimeColorNameLookup[33] = 'black & white'; - $QuicktimeColorNameLookup[34] = '4-gray'; - $QuicktimeColorNameLookup[36] = '16-gray'; - $QuicktimeColorNameLookup[40] = '256-gray'; - } - return (isset($QuicktimeColorNameLookup[$colordepthid]) ? $QuicktimeColorNameLookup[$colordepthid] : 'invalid'); - } - - function CopyToAppropriateCommentsSection($keyname, $data, &$ThisFileInfo) { - static $handyatomtranslatorarray = array(); - if (empty($handyatomtranslatorarray)) { - $handyatomtranslatorarray['©cpy'] = 'copyright'; - $handyatomtranslatorarray['©day'] = 'creation_date'; - $handyatomtranslatorarray['©dir'] = 'director'; - $handyatomtranslatorarray['©ed1'] = 'edit1'; - $handyatomtranslatorarray['©ed2'] = 'edit2'; - $handyatomtranslatorarray['©ed3'] = 'edit3'; - $handyatomtranslatorarray['©ed4'] = 'edit4'; - $handyatomtranslatorarray['©ed5'] = 'edit5'; - $handyatomtranslatorarray['©ed6'] = 'edit6'; - $handyatomtranslatorarray['©ed7'] = 'edit7'; - $handyatomtranslatorarray['©ed8'] = 'edit8'; - $handyatomtranslatorarray['©ed9'] = 'edit9'; - $handyatomtranslatorarray['©fmt'] = 'format'; - $handyatomtranslatorarray['©inf'] = 'information'; - $handyatomtranslatorarray['©prd'] = 'producer'; - $handyatomtranslatorarray['©prf'] = 'performers'; - $handyatomtranslatorarray['©req'] = 'system_requirements'; - $handyatomtranslatorarray['©src'] = 'source_credit'; - $handyatomtranslatorarray['©wrt'] = 'writer'; - - // http://www.geocities.com/xhelmboyx/quicktime/formats/qtm-layout.txt - $handyatomtranslatorarray['©nam'] = 'title'; - $handyatomtranslatorarray['©cmt'] = 'comment'; - $handyatomtranslatorarray['©wrn'] = 'warning'; - $handyatomtranslatorarray['©hst'] = 'host_computer'; - $handyatomtranslatorarray['©mak'] = 'make'; - $handyatomtranslatorarray['©mod'] = 'model'; - $handyatomtranslatorarray['©PRD'] = 'product'; - $handyatomtranslatorarray['©swr'] = 'software'; - $handyatomtranslatorarray['©aut'] = 'author'; - $handyatomtranslatorarray['©ART'] = 'artist'; - $handyatomtranslatorarray['©trk'] = 'track'; - $handyatomtranslatorarray['©alb'] = 'album'; - $handyatomtranslatorarray['©com'] = 'comment'; - $handyatomtranslatorarray['©gen'] = 'genre'; - $handyatomtranslatorarray['©ope'] = 'composer'; - $handyatomtranslatorarray['©url'] = 'url'; - $handyatomtranslatorarray['©enc'] = 'encoder'; - } - if (isset($handyatomtranslatorarray[$keyname])) { - $ThisFileInfo['quicktime']['comments'][$handyatomtranslatorarray[$keyname]][] = $data; - } - - return true; - } - - function NoNullString($nullterminatedstring) { - // remove the single null terminator on null terminated strings - if (substr($nullterminatedstring, strlen($nullterminatedstring) - 1, 1) === "\x00") { - return substr($nullterminatedstring, 0, strlen($nullterminatedstring) - 1); - } - return $nullterminatedstring; - } - - function Pascal2String($pascalstring) { - // Pascal strings have 1 unsigned byte at the beginning saying how many chars (1-255) are in the string - return substr($pascalstring, 1); - } - -} - -?>
\ No newline at end of file diff --git a/getid3/module.audio-video.real.php b/getid3/module.audio-video.real.php deleted file mode 100644 index 013f478..0000000 --- a/getid3/module.audio-video.real.php +++ /dev/null @@ -1,528 +0,0 @@ -<?php -///////////////////////////////////////////////////////////////// -/// getID3() by James Heinrich <info@getid3.org> // -// available at http://getid3.sourceforge.net // -// or http://www.getid3.org // -///////////////////////////////////////////////////////////////// -// See readme.txt for more details // -///////////////////////////////////////////////////////////////// -// // -// module.audio-video.real.php // -// module for analyzing Real Audio/Video files // -// dependencies: module.audio-video.riff.php // -// /// -///////////////////////////////////////////////////////////////// - -getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio-video.riff.php', __FILE__, true); - -class getid3_real -{ - - function getid3_real(&$fd, &$ThisFileInfo) { - $ThisFileInfo['fileformat'] = 'real'; - $ThisFileInfo['bitrate'] = 0; - $ThisFileInfo['playtime_seconds'] = 0; - - fseek($fd, $ThisFileInfo['avdataoffset'], SEEK_SET); - $ChunkCounter = 0; - while (ftell($fd) < $ThisFileInfo['avdataend']) { - $ChunkData = fread($fd, 8); - $ChunkName = substr($ChunkData, 0, 4); - $ChunkSize = getid3_lib::BigEndian2Int(substr($ChunkData, 4, 4)); - - if ($ChunkName == '.ra'."\xFD") { - $ChunkData .= fread($fd, $ChunkSize - 8); - if ($this->ParseOldRAheader(substr($ChunkData, 0, 128), $ThisFileInfo['real']['old_ra_header'])) { - $ThisFileInfo['audio']['dataformat'] = 'real'; - $ThisFileInfo['audio']['lossless'] = false; - $ThisFileInfo['audio']['sample_rate'] = $ThisFileInfo['real']['old_ra_header']['sample_rate']; - $ThisFileInfo['audio']['bits_per_sample'] = $ThisFileInfo['real']['old_ra_header']['bits_per_sample']; - $ThisFileInfo['audio']['channels'] = $ThisFileInfo['real']['old_ra_header']['channels']; - - $ThisFileInfo['playtime_seconds'] = 60 * ($ThisFileInfo['real']['old_ra_header']['audio_bytes'] / $ThisFileInfo['real']['old_ra_header']['bytes_per_minute']); - $ThisFileInfo['audio']['bitrate'] = 8 * ($ThisFileInfo['real']['old_ra_header']['audio_bytes'] / $ThisFileInfo['playtime_seconds']); - $ThisFileInfo['audio']['codec'] = $this->RealAudioCodecFourCClookup($ThisFileInfo['real']['old_ra_header']['fourcc'], $ThisFileInfo['audio']['bitrate']); - - foreach ($ThisFileInfo['real']['old_ra_header']['comments'] as $key => $valuearray) { - if (strlen(trim($valuearray[0])) > 0) { - $ThisFileInfo['real']['comments'][$key][] = trim($valuearray[0]); - } - } - return true; - } - $ThisFileInfo['error'][] = 'There was a problem parsing this RealAudio file. Please submit it for analysis to http://www.getid3.org/upload/ or info@getid3.org'; - unset($ThisFileInfo['bitrate']); - unset($ThisFileInfo['playtime_seconds']); - return false; - } - - // shortcut - $ThisFileInfo['real']['chunks'][$ChunkCounter] = array(); - $thisfile_real_chunks_currentchunk = &$ThisFileInfo['real']['chunks'][$ChunkCounter]; - - $thisfile_real_chunks_currentchunk['name'] = $ChunkName; - $thisfile_real_chunks_currentchunk['offset'] = ftell($fd) - 8; - $thisfile_real_chunks_currentchunk['length'] = $ChunkSize; - if (($thisfile_real_chunks_currentchunk['offset'] + $thisfile_real_chunks_currentchunk['length']) > $ThisFileInfo['avdataend']) { - $ThisFileInfo['warning'][] = 'Chunk "'.$thisfile_real_chunks_currentchunk['name'].'" at offset '.$thisfile_real_chunks_currentchunk['offset'].' claims to be '.$thisfile_real_chunks_currentchunk['length'].' bytes long, which is beyond end of file'; - return false; - } - - if ($ChunkSize > (GETID3_FREAD_BUFFER_SIZE + 8)) { - - $ChunkData .= fread($fd, GETID3_FREAD_BUFFER_SIZE - 8); - fseek($fd, $thisfile_real_chunks_currentchunk['offset'] + $ChunkSize, SEEK_SET); - - } elseif(($ChunkSize - 8) > 0) { - - $ChunkData .= fread($fd, $ChunkSize - 8); - - } - $offset = 8; - - switch ($ChunkName) { - - case '.RMF': // RealMedia File Header - $thisfile_real_chunks_currentchunk['object_version'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 2)); - $offset += 2; - switch ($thisfile_real_chunks_currentchunk['object_version']) { - - case 0: - $thisfile_real_chunks_currentchunk['file_version'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 4)); - $offset += 4; - $thisfile_real_chunks_currentchunk['headers_count'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 4)); - $offset += 4; - break; - - default: - //$ThisFileInfo['warning'][] = 'Expected .RMF-object_version to be "0", actual value is "'.$thisfile_real_chunks_currentchunk['object_version'].'" (should not be a problem)'; - break; - - } - break; - - - case 'PROP': // Properties Header - $thisfile_real_chunks_currentchunk['object_version'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 2)); - $offset += 2; - if ($thisfile_real_chunks_currentchunk['object_version'] == 0) { - $thisfile_real_chunks_currentchunk['max_bit_rate'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 4)); - $offset += 4; - $thisfile_real_chunks_currentchunk['avg_bit_rate'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 4)); - $offset += 4; - $thisfile_real_chunks_currentchunk['max_packet_size'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 4)); - $offset += 4; - $thisfile_real_chunks_currentchunk['avg_packet_size'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 4)); - $offset += 4; - $thisfile_real_chunks_currentchunk['num_packets'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 4)); - $offset += 4; - $thisfile_real_chunks_currentchunk['duration'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 4)); - $offset += 4; - $thisfile_real_chunks_currentchunk['preroll'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 4)); - $offset += 4; - $thisfile_real_chunks_currentchunk['index_offset'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 4)); - $offset += 4; - $thisfile_real_chunks_currentchunk['data_offset'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 4)); - $offset += 4; - $thisfile_real_chunks_currentchunk['num_streams'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 2)); - $offset += 2; - $thisfile_real_chunks_currentchunk['flags_raw'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 2)); - $offset += 2; - $ThisFileInfo['playtime_seconds'] = $thisfile_real_chunks_currentchunk['duration'] / 1000; - if ($thisfile_real_chunks_currentchunk['duration'] > 0) { - $ThisFileInfo['bitrate'] += $thisfile_real_chunks_currentchunk['avg_bit_rate']; - } - $thisfile_real_chunks_currentchunk['flags']['save_enabled'] = (bool) ($thisfile_real_chunks_currentchunk['flags_raw'] & 0x0001); - $thisfile_real_chunks_currentchunk['flags']['perfect_play'] = (bool) ($thisfile_real_chunks_currentchunk['flags_raw'] & 0x0002); - $thisfile_real_chunks_currentchunk['flags']['live_broadcast'] = (bool) ($thisfile_real_chunks_currentchunk['flags_raw'] & 0x0004); - } - break; - - case 'MDPR': // Media Properties Header - $thisfile_real_chunks_currentchunk['object_version'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 2)); - $offset += 2; - if ($thisfile_real_chunks_currentchunk['object_version'] == 0) { - $thisfile_real_chunks_currentchunk['stream_number'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 2)); - $offset += 2; - $thisfile_real_chunks_currentchunk['max_bit_rate'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 4)); - $offset += 4; - $thisfile_real_chunks_currentchunk['avg_bit_rate'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 4)); - $offset += 4; - $thisfile_real_chunks_currentchunk['max_packet_size'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 4)); - $offset += 4; - $thisfile_real_chunks_currentchunk['avg_packet_size'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 4)); - $offset += 4; - $thisfile_real_chunks_currentchunk['start_time'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 4)); - $offset += 4; - $thisfile_real_chunks_currentchunk['preroll'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 4)); - $offset += 4; - $thisfile_real_chunks_currentchunk['duration'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 4)); - $offset += 4; - $thisfile_real_chunks_currentchunk['stream_name_size'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 1)); - $offset += 1; - $thisfile_real_chunks_currentchunk['stream_name'] = substr($ChunkData, $offset, $thisfile_real_chunks_currentchunk['stream_name_size']); - $offset += $thisfile_real_chunks_currentchunk['stream_name_size']; - $thisfile_real_chunks_currentchunk['mime_type_size'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 1)); - $offset += 1; - $thisfile_real_chunks_currentchunk['mime_type'] = substr($ChunkData, $offset, $thisfile_real_chunks_currentchunk['mime_type_size']); - $offset += $thisfile_real_chunks_currentchunk['mime_type_size']; - $thisfile_real_chunks_currentchunk['type_specific_len'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 4)); - $offset += 4; - $thisfile_real_chunks_currentchunk['type_specific_data'] = substr($ChunkData, $offset, $thisfile_real_chunks_currentchunk['type_specific_len']); - $offset += $thisfile_real_chunks_currentchunk['type_specific_len']; - - // shortcut - $thisfile_real_chunks_currentchunk_typespecificdata = &$thisfile_real_chunks_currentchunk['type_specific_data']; - - switch ($thisfile_real_chunks_currentchunk['mime_type']) { - case 'video/x-pn-realvideo': - case 'video/x-pn-multirate-realvideo': - // http://www.freelists.org/archives/matroska-devel/07-2003/msg00010.html - - // shortcut - $thisfile_real_chunks_currentchunk['video_info'] = array(); - $thisfile_real_chunks_currentchunk_videoinfo = &$thisfile_real_chunks_currentchunk['video_info']; - - $thisfile_real_chunks_currentchunk_videoinfo['dwSize'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, 0, 4)); - $thisfile_real_chunks_currentchunk_videoinfo['fourcc1'] = substr($thisfile_real_chunks_currentchunk_typespecificdata, 4, 4); - $thisfile_real_chunks_currentchunk_videoinfo['fourcc2'] = substr($thisfile_real_chunks_currentchunk_typespecificdata, 8, 4); - $thisfile_real_chunks_currentchunk_videoinfo['width'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, 12, 2)); - $thisfile_real_chunks_currentchunk_videoinfo['height'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, 14, 2)); - $thisfile_real_chunks_currentchunk_videoinfo['bits_per_sample'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, 16, 2)); - //$thisfile_real_chunks_currentchunk_videoinfo['unknown1'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, 18, 2)); - //$thisfile_real_chunks_currentchunk_videoinfo['unknown2'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, 20, 2)); - $thisfile_real_chunks_currentchunk_videoinfo['frames_per_second'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, 22, 2)); - //$thisfile_real_chunks_currentchunk_videoinfo['unknown3'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, 24, 2)); - //$thisfile_real_chunks_currentchunk_videoinfo['unknown4'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, 26, 2)); - //$thisfile_real_chunks_currentchunk_videoinfo['unknown5'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, 28, 2)); - //$thisfile_real_chunks_currentchunk_videoinfo['unknown6'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, 30, 2)); - //$thisfile_real_chunks_currentchunk_videoinfo['unknown7'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, 32, 2)); - //$thisfile_real_chunks_currentchunk_videoinfo['unknown8'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, 34, 2)); - //$thisfile_real_chunks_currentchunk_videoinfo['unknown9'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, 36, 2)); - - $thisfile_real_chunks_currentchunk_videoinfo['codec'] = getid3_riff::RIFFfourccLookup($thisfile_real_chunks_currentchunk_videoinfo['fourcc2']); - - $ThisFileInfo['video']['resolution_x'] = $thisfile_real_chunks_currentchunk_videoinfo['width']; - $ThisFileInfo['video']['resolution_y'] = $thisfile_real_chunks_currentchunk_videoinfo['height']; - $ThisFileInfo['video']['frame_rate'] = (float) $thisfile_real_chunks_currentchunk_videoinfo['frames_per_second']; - $ThisFileInfo['video']['codec'] = $thisfile_real_chunks_currentchunk_videoinfo['codec']; - $ThisFileInfo['video']['bits_per_sample'] = $thisfile_real_chunks_currentchunk_videoinfo['bits_per_sample']; - break; - - case 'audio/x-pn-realaudio': - case 'audio/x-pn-multirate-realaudio': - $this->ParseOldRAheader($thisfile_real_chunks_currentchunk_typespecificdata, $thisfile_real_chunks_currentchunk['parsed_audio_data']); - - $ThisFileInfo['audio']['sample_rate'] = $thisfile_real_chunks_currentchunk['parsed_audio_data']['sample_rate']; - $ThisFileInfo['audio']['bits_per_sample'] = $thisfile_real_chunks_currentchunk['parsed_audio_data']['bits_per_sample']; - $ThisFileInfo['audio']['channels'] = $thisfile_real_chunks_currentchunk['parsed_audio_data']['channels']; - if (!empty($ThisFileInfo['audio']['dataformat'])) { - foreach ($ThisFileInfo['audio'] as $key => $value) { - if ($key != 'streams') { - $ThisFileInfo['audio']['streams'][$thisfile_real_chunks_currentchunk['stream_number']][$key] = $value; - } - } - } - break; - - case 'logical-fileinfo': - // shortcut - $thisfile_real_chunks_currentchunk['logical_fileinfo'] = array(); - $thisfile_real_chunks_currentchunk_logicalfileinfo = &$thisfile_real_chunks_currentchunk['logical_fileinfo']; - - $thisfile_real_chunks_currentchunk_logicalfileinfo_offset = 0; - $thisfile_real_chunks_currentchunk_logicalfileinfo['logical_fileinfo_length'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, $thisfile_real_chunks_currentchunk_logicalfileinfo_offset, 4)); - $thisfile_real_chunks_currentchunk_logicalfileinfo_offset += 4; - - //$thisfile_real_chunks_currentchunk_logicalfileinfo['unknown1'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, $thisfile_real_chunks_currentchunk_logicalfileinfo_offset, 4)); - $thisfile_real_chunks_currentchunk_logicalfileinfo_offset += 4; - - $thisfile_real_chunks_currentchunk_logicalfileinfo['num_tags'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, $thisfile_real_chunks_currentchunk_logicalfileinfo_offset, 4)); - $thisfile_real_chunks_currentchunk_logicalfileinfo_offset += 4; - - //$thisfile_real_chunks_currentchunk_logicalfileinfo['unknown2'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, $thisfile_real_chunks_currentchunk_logicalfileinfo_offset, 4)); - $thisfile_real_chunks_currentchunk_logicalfileinfo_offset += 4; - - //$thisfile_real_chunks_currentchunk_logicalfileinfo['d'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, $thisfile_real_chunks_currentchunk_logicalfileinfo_offset, 1)); - - //$thisfile_real_chunks_currentchunk_logicalfileinfo['one_type'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, $thisfile_real_chunks_currentchunk_logicalfileinfo_offset, 4)); - //$thisfile_real_chunks_currentchunk_logicalfileinfo_thislength = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, 4 + $thisfile_real_chunks_currentchunk_logicalfileinfo_offset, 2)); - //$thisfile_real_chunks_currentchunk_logicalfileinfo['one'] = substr($thisfile_real_chunks_currentchunk_typespecificdata, 6 + $thisfile_real_chunks_currentchunk_logicalfileinfo_offset, $thisfile_real_chunks_currentchunk_logicalfileinfo_thislength); - //$thisfile_real_chunks_currentchunk_logicalfileinfo_offset += (6 + $thisfile_real_chunks_currentchunk_logicalfileinfo_thislength); - - break; - - } - - - if (empty($ThisFileInfo['playtime_seconds'])) { - $ThisFileInfo['playtime_seconds'] = max($ThisFileInfo['playtime_seconds'], ($thisfile_real_chunks_currentchunk['duration'] + $thisfile_real_chunks_currentchunk['start_time']) / 1000); - } - if ($thisfile_real_chunks_currentchunk['duration'] > 0) { - switch ($thisfile_real_chunks_currentchunk['mime_type']) { - case 'audio/x-pn-realaudio': - case 'audio/x-pn-multirate-realaudio': - $ThisFileInfo['audio']['bitrate'] = (isset($ThisFileInfo['audio']['bitrate']) ? $ThisFileInfo['audio']['bitrate'] : 0) + $thisfile_real_chunks_currentchunk['avg_bit_rate']; - $ThisFileInfo['audio']['codec'] = $this->RealAudioCodecFourCClookup($thisfile_real_chunks_currentchunk['parsed_audio_data']['fourcc'], $ThisFileInfo['audio']['bitrate']); - $ThisFileInfo['audio']['dataformat'] = 'real'; - $ThisFileInfo['audio']['lossless'] = false; - break; - - case 'video/x-pn-realvideo': - case 'video/x-pn-multirate-realvideo': - $ThisFileInfo['video']['bitrate'] = (isset($ThisFileInfo['video']['bitrate']) ? $ThisFileInfo['video']['bitrate'] : 0) + $thisfile_real_chunks_currentchunk['avg_bit_rate']; - $ThisFileInfo['video']['bitrate_mode'] = 'cbr'; - $ThisFileInfo['video']['dataformat'] = 'real'; - $ThisFileInfo['video']['lossless'] = false; - $ThisFileInfo['video']['pixel_aspect_ratio'] = (float) 1; - break; - - case 'audio/x-ralf-mpeg4-generic': - $ThisFileInfo['audio']['bitrate'] = (isset($ThisFileInfo['audio']['bitrate']) ? $ThisFileInfo['audio']['bitrate'] : 0) + $thisfile_real_chunks_currentchunk['avg_bit_rate']; - $ThisFileInfo['audio']['codec'] = 'RealAudio Lossless'; - $ThisFileInfo['audio']['dataformat'] = 'real'; - $ThisFileInfo['audio']['lossless'] = true; - break; - } - $ThisFileInfo['bitrate'] = (isset($ThisFileInfo['video']['bitrate']) ? $ThisFileInfo['video']['bitrate'] : 0) + (isset($ThisFileInfo['audio']['bitrate']) ? $ThisFileInfo['audio']['bitrate'] : 0); - } - } - break; - - case 'CONT': // Content Description Header (text comments) - $thisfile_real_chunks_currentchunk['object_version'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 2)); - $offset += 2; - if ($thisfile_real_chunks_currentchunk['object_version'] == 0) { - $thisfile_real_chunks_currentchunk['title_len'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 2)); - $offset += 2; - $thisfile_real_chunks_currentchunk['title'] = (string) substr($ChunkData, $offset, $thisfile_real_chunks_currentchunk['title_len']); - $offset += $thisfile_real_chunks_currentchunk['title_len']; - - $thisfile_real_chunks_currentchunk['artist_len'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 2)); - $offset += 2; - $thisfile_real_chunks_currentchunk['artist'] = (string) substr($ChunkData, $offset, $thisfile_real_chunks_currentchunk['artist_len']); - $offset += $thisfile_real_chunks_currentchunk['artist_len']; - - $thisfile_real_chunks_currentchunk['copyright_len'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 2)); - $offset += 2; - $thisfile_real_chunks_currentchunk['copyright'] = (string) substr($ChunkData, $offset, $thisfile_real_chunks_currentchunk['copyright_len']); - $offset += $thisfile_real_chunks_currentchunk['copyright_len']; - - $thisfile_real_chunks_currentchunk['comment_len'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 2)); - $offset += 2; - $thisfile_real_chunks_currentchunk['comment'] = (string) substr($ChunkData, $offset, $thisfile_real_chunks_currentchunk['comment_len']); - $offset += $thisfile_real_chunks_currentchunk['comment_len']; - - - $commentkeystocopy = array('title'=>'title', 'artist'=>'artist', 'copyright'=>'copyright', 'comment'=>'comment'); - foreach ($commentkeystocopy as $key => $val) { - if ($thisfile_real_chunks_currentchunk[$key]) { - $ThisFileInfo['real']['comments'][$val][] = trim($thisfile_real_chunks_currentchunk[$key]); - } - } - - } - break; - - - case 'DATA': // Data Chunk Header - // do nothing - break; - - case 'INDX': // Index Section Header - $thisfile_real_chunks_currentchunk['object_version'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 2)); - $offset += 2; - if ($thisfile_real_chunks_currentchunk['object_version'] == 0) { - $thisfile_real_chunks_currentchunk['num_indices'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 4)); - $offset += 4; - $thisfile_real_chunks_currentchunk['stream_number'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 2)); - $offset += 2; - $thisfile_real_chunks_currentchunk['next_index_header'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 4)); - $offset += 4; - - if ($thisfile_real_chunks_currentchunk['next_index_header'] == 0) { - // last index chunk found, ignore rest of file - break 2; - } else { - // non-last index chunk, seek to next index chunk (skipping actual index data) - fseek($fd, $thisfile_real_chunks_currentchunk['next_index_header'], SEEK_SET); - } - } - break; - - default: - $ThisFileInfo['warning'][] = 'Unhandled RealMedia chunk "'.$ChunkName.'" at offset '.$thisfile_real_chunks_currentchunk['offset']; - break; - } - $ChunkCounter++; - } - - if (!empty($ThisFileInfo['audio']['streams'])) { - $ThisFileInfo['audio']['bitrate'] = 0; - foreach ($ThisFileInfo['audio']['streams'] as $key => $valuearray) { - $ThisFileInfo['audio']['bitrate'] += $valuearray['bitrate']; - } - } - - return true; - } - - - function ParseOldRAheader($OldRAheaderData, &$ParsedArray) { - // http://www.freelists.org/archives/matroska-devel/07-2003/msg00010.html - - $ParsedArray = array(); - $ParsedArray['magic'] = substr($OldRAheaderData, 0, 4); - if ($ParsedArray['magic'] != '.ra'."\xFD") { - return false; - } - $ParsedArray['version1'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 4, 2)); - - if ($ParsedArray['version1'] < 3) { - - return false; - - } elseif ($ParsedArray['version1'] == 3) { - - $ParsedArray['fourcc1'] = '.ra3'; - $ParsedArray['bits_per_sample'] = 16; // hard-coded for old versions? - $ParsedArray['sample_rate'] = 8000; // hard-coded for old versions? - - $ParsedArray['header_size'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 6, 2)); - $ParsedArray['channels'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 8, 2)); // always 1 (?) - //$ParsedArray['unknown1'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 10, 2)); - //$ParsedArray['unknown2'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 12, 2)); - //$ParsedArray['unknown3'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 14, 2)); - $ParsedArray['bytes_per_minute'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 16, 2)); - $ParsedArray['audio_bytes'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 18, 4)); - $ParsedArray['comments_raw'] = substr($OldRAheaderData, 22, $ParsedArray['header_size'] - 22 + 1); // not including null terminator - - $commentoffset = 0; - $commentlength = getid3_lib::BigEndian2Int(substr($ParsedArray['comments_raw'], $commentoffset++, 1)); - $ParsedArray['comments']['title'][] = substr($ParsedArray['comments_raw'], $commentoffset, $commentlength); - $commentoffset += $commentlength; - - $commentlength = getid3_lib::BigEndian2Int(substr($ParsedArray['comments_raw'], $commentoffset++, 1)); - $ParsedArray['comments']['artist'][] = substr($ParsedArray['comments_raw'], $commentoffset, $commentlength); - $commentoffset += $commentlength; - - $commentlength = getid3_lib::BigEndian2Int(substr($ParsedArray['comments_raw'], $commentoffset++, 1)); - $ParsedArray['comments']['copyright'][] = substr($ParsedArray['comments_raw'], $commentoffset, $commentlength); - $commentoffset += $commentlength; - - $commentoffset++; // final null terminator (?) - $commentoffset++; // fourcc length (?) should be 4 - $ParsedArray['fourcc'] = substr($OldRAheaderData, 23 + $commentoffset, 4); - - } elseif ($ParsedArray['version1'] <= 5) { - - //$ParsedArray['unknown1'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 6, 2)); - $ParsedArray['fourcc1'] = substr($OldRAheaderData, 8, 4); - $ParsedArray['file_size'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 12, 4)); - $ParsedArray['version2'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 16, 2)); - $ParsedArray['header_size'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 18, 4)); - $ParsedArray['codec_flavor_id'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 22, 2)); - $ParsedArray['coded_frame_size'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 24, 4)); - $ParsedArray['audio_bytes'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 28, 4)); - $ParsedArray['bytes_per_minute'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 32, 4)); - //$ParsedArray['unknown5'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 36, 4)); - $ParsedArray['sub_packet_h'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 40, 2)); - $ParsedArray['frame_size'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 42, 2)); - $ParsedArray['sub_packet_size'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 44, 2)); - //$ParsedArray['unknown6'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 46, 2)); - - switch ($ParsedArray['version1']) { - - case 4: - $ParsedArray['sample_rate'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 48, 2)); - //$ParsedArray['unknown8'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 50, 2)); - $ParsedArray['bits_per_sample'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 52, 2)); - $ParsedArray['channels'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 54, 2)); - $ParsedArray['length_fourcc2'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 56, 1)); - $ParsedArray['fourcc2'] = substr($OldRAheaderData, 57, 4); - $ParsedArray['length_fourcc3'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 61, 1)); - $ParsedArray['fourcc3'] = substr($OldRAheaderData, 62, 4); - //$ParsedArray['unknown9'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 66, 1)); - //$ParsedArray['unknown10'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 67, 2)); - $ParsedArray['comments_raw'] = substr($OldRAheaderData, 69, $ParsedArray['header_size'] - 69 + 16); - - $commentoffset = 0; - $commentlength = getid3_lib::BigEndian2Int(substr($ParsedArray['comments_raw'], $commentoffset++, 1)); - $ParsedArray['comments']['title'][] = substr($ParsedArray['comments_raw'], $commentoffset, $commentlength); - $commentoffset += $commentlength; - - $commentlength = getid3_lib::BigEndian2Int(substr($ParsedArray['comments_raw'], $commentoffset++, 1)); - $ParsedArray['comments']['artist'][] = substr($ParsedArray['comments_raw'], $commentoffset, $commentlength); - $commentoffset += $commentlength; - - $commentlength = getid3_lib::BigEndian2Int(substr($ParsedArray['comments_raw'], $commentoffset++, 1)); - $ParsedArray['comments']['copyright'][] = substr($ParsedArray['comments_raw'], $commentoffset, $commentlength); - $commentoffset += $commentlength; - break; - - case 5: - $ParsedArray['sample_rate'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 48, 4)); - $ParsedArray['sample_rate2'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 52, 4)); - $ParsedArray['bits_per_sample'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 56, 4)); - $ParsedArray['channels'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 60, 2)); - $ParsedArray['genr'] = substr($OldRAheaderData, 62, 4); - $ParsedArray['fourcc3'] = substr($OldRAheaderData, 66, 4); - $ParsedArray['comments'] = array(); - break; - } - $ParsedArray['fourcc'] = $ParsedArray['fourcc3']; - - } - foreach ($ParsedArray['comments'] as $key => $value) { - if ($ParsedArray['comments'][$key][0] === false) { - $ParsedArray['comments'][$key][0] = ''; - } - } - - return true; - } - - function RealAudioCodecFourCClookup($fourcc, $bitrate) { - static $RealAudioCodecFourCClookup = array(); - if (empty($RealAudioCodecFourCClookup)) { - // http://www.its.msstate.edu/net/real/reports/config/tags.stats - // http://www.freelists.org/archives/matroska-devel/06-2003/fullthread18.html - - $RealAudioCodecFourCClookup['14_4'][8000] = 'RealAudio v2 (14.4kbps)'; - $RealAudioCodecFourCClookup['14.4'][8000] = 'RealAudio v2 (14.4kbps)'; - $RealAudioCodecFourCClookup['lpcJ'][8000] = 'RealAudio v2 (14.4kbps)'; - $RealAudioCodecFourCClookup['28_8'][15200] = 'RealAudio v2 (28.8kbps)'; - $RealAudioCodecFourCClookup['28.8'][15200] = 'RealAudio v2 (28.8kbps)'; - $RealAudioCodecFourCClookup['sipr'][4933] = 'RealAudio v4 (5kbps Voice)'; - $RealAudioCodecFourCClookup['sipr'][6444] = 'RealAudio v4 (6.5kbps Voice)'; - $RealAudioCodecFourCClookup['sipr'][8444] = 'RealAudio v4 (8.5kbps Voice)'; - $RealAudioCodecFourCClookup['sipr'][16000] = 'RealAudio v4 (16kbps Wideband)'; - $RealAudioCodecFourCClookup['dnet'][8000] = 'RealAudio v3 (8kbps Music)'; - $RealAudioCodecFourCClookup['dnet'][16000] = 'RealAudio v3 (16kbps Music Low Response)'; - $RealAudioCodecFourCClookup['dnet'][15963] = 'RealAudio v3 (16kbps Music Mid/High Response)'; - $RealAudioCodecFourCClookup['dnet'][20000] = 'RealAudio v3 (20kbps Music Stereo)'; - $RealAudioCodecFourCClookup['dnet'][32000] = 'RealAudio v3 (32kbps Music Mono)'; - $RealAudioCodecFourCClookup['dnet'][31951] = 'RealAudio v3 (32kbps Music Stereo)'; - $RealAudioCodecFourCClookup['dnet'][39965] = 'RealAudio v3 (40kbps Music Mono)'; - $RealAudioCodecFourCClookup['dnet'][40000] = 'RealAudio v3 (40kbps Music Stereo)'; - $RealAudioCodecFourCClookup['dnet'][79947] = 'RealAudio v3 (80kbps Music Mono)'; - $RealAudioCodecFourCClookup['dnet'][80000] = 'RealAudio v3 (80kbps Music Stereo)'; - - $RealAudioCodecFourCClookup['dnet'][0] = 'RealAudio v3'; - $RealAudioCodecFourCClookup['sipr'][0] = 'RealAudio v4'; - $RealAudioCodecFourCClookup['cook'][0] = 'RealAudio G2'; - $RealAudioCodecFourCClookup['atrc'][0] = 'RealAudio 8'; - } - $roundbitrate = intval(round($bitrate)); - if (isset($RealAudioCodecFourCClookup[$fourcc][$roundbitrate])) { - return $RealAudioCodecFourCClookup[$fourcc][$roundbitrate]; - } elseif (isset($RealAudioCodecFourCClookup[$fourcc][0])) { - return $RealAudioCodecFourCClookup[$fourcc][0]; - } - return $fourcc; - } - -} - - -?>
\ No newline at end of file diff --git a/getid3/module.audio-video.riff.php b/getid3/module.audio-video.riff.php deleted file mode 100644 index a5174ad..0000000 --- a/getid3/module.audio-video.riff.php +++ /dev/null @@ -1,2110 +0,0 @@ -<?php -///////////////////////////////////////////////////////////////// -/// getID3() by James Heinrich <info@getid3.org> // -// available at http://getid3.sourceforge.net // -// or http://www.getid3.org // -///////////////////////////////////////////////////////////////// -// See readme.txt for more details // -///////////////////////////////////////////////////////////////// -// // -// module.audio-video.riff.php // -// module for analyzing RIFF files // -// multiple formats supported by this module: // -// Wave, AVI, AIFF/AIFC, (MP3,AC3)/RIFF, Wavpack v3, 8SVX // -// dependencies: module.audio.mp3.php // -// module.audio.ac3.php (optional) // -// module.audio.dts.php (optional) // -// /// -///////////////////////////////////////////////////////////////// - -getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio.mp3.php', __FILE__, true); - -class getid3_riff -{ - - function getid3_riff(&$fd, &$ThisFileInfo) { - - // initialize these values to an empty array, otherwise they default to NULL - // and you can't append array values to a NULL value - $ThisFileInfo['riff'] = array('raw'=>array()); - - // Shortcuts - $thisfile_riff = &$ThisFileInfo['riff']; - $thisfile_riff_raw = &$thisfile_riff['raw']; - $thisfile_audio = &$ThisFileInfo['audio']; - $thisfile_video = &$ThisFileInfo['video']; - $thisfile_avdataoffset = &$ThisFileInfo['avdataoffset']; - $thisfile_avdataend = &$ThisFileInfo['avdataend']; - $thisfile_audio_dataformat = &$thisfile_audio['dataformat']; - $thisfile_riff_audio = &$thisfile_riff['audio']; - $thisfile_riff_video = &$thisfile_riff['video']; - - - $Original['avdataoffset'] = $thisfile_avdataoffset; - $Original['avdataend'] = $thisfile_avdataend; - - fseek($fd, $thisfile_avdataoffset, SEEK_SET); - $RIFFheader = fread($fd, 12); - $RIFFsubtype = substr($RIFFheader, 8, 4); - switch (substr($RIFFheader, 0, 4)) { - case 'FORM': - $ThisFileInfo['fileformat'] = 'aiff'; - $RIFFheaderSize = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($RIFFheader, 4, 4)); - $thisfile_riff[$RIFFsubtype] = getid3_riff::ParseRIFF($fd, $thisfile_avdataoffset + 12, $thisfile_avdataoffset + $RIFFheaderSize, $ThisFileInfo); - $thisfile_riff['header_size'] = $RIFFheaderSize; - break; - - case 'RIFF': - case 'SDSS': // SDSS is identical to RIFF, just renamed. Used by SmartSound QuickTracks (www.smartsound.com) - case 'RMP3': // RMP3 is identical to RIFF, just renamed. Used by [unknown program] when creating RIFF-MP3s - if ($RIFFsubtype == 'RMP3') { - // RMP3 is identical to WAVE, just renamed. Used by [unknown program] when creating RIFF-MP3s - $RIFFsubtype = 'WAVE'; - } - - $ThisFileInfo['fileformat'] = 'riff'; - $RIFFheaderSize = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($RIFFheader, 4, 4)); - $thisfile_riff['header_size'] = $RIFFheaderSize; - $thisfile_riff[$RIFFsubtype] = getid3_riff::ParseRIFF($fd, $thisfile_avdataoffset + 12, $thisfile_avdataoffset + $RIFFheaderSize, $ThisFileInfo); - - fseek($fd, $thisfile_avdataoffset + $RIFFheaderSize); - $nextRIFFheader = fread($fd, 20); - if (substr($nextRIFFheader, 8, 4) == 'RIFF') { - $nextRIFFsize = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($nextRIFFheader, 12, 4)); - $nextRIFFtype = substr($nextRIFFheader, 16, 4).'<br>'; - $thisfile_riff[$nextRIFFtype]['offset'] = ftell($fd) - 4; - $thisfile_riff[$nextRIFFtype]['size'] = $nextRIFFsize; - $ThisFileInfo['avdataend'] = $thisfile_riff[$nextRIFFtype]['offset'] + $thisfile_riff[$nextRIFFtype]['size']; - $ThisFileInfo['error'][] = 'AVI extends beyond 2GB and PHP filesystem functions cannot read that far, playtime is probably wrong'; - $ThisFileInfo['warning'][] = '[avdataend] value may be incorrect, multiple AVIX chunks may be present'; - $thisfile_riff[$nextRIFFtype] = getid3_riff::ParseRIFF($fd, $thisfile_riff[$nextRIFFtype]['offset'] + 4, $thisfile_riff[$nextRIFFtype]['offset'] + $thisfile_riff[$nextRIFFtype]['size'], $ThisFileInfo); - } - if ($RIFFsubtype == 'WAVE') { - $thisfile_riff_WAVE = &$thisfile_riff['WAVE']; - } - break; - - default: - $ThisFileInfo['error'][] = 'Cannot parse RIFF (this is maybe not a RIFF / WAV / AVI file?) - expecting "FORM|RIFF|SDSS|RMP3" found "'.$RIFFsubtype.'" instead'; - unset($ThisFileInfo['fileformat']); - return false; - break; - } - - $streamindex = 0; - switch ($RIFFsubtype) { - case 'WAVE': - if (empty($thisfile_audio['bitrate_mode'])) { - $thisfile_audio['bitrate_mode'] = 'cbr'; - } - if (empty($thisfile_audio_dataformat)) { - $thisfile_audio_dataformat = 'wav'; - } - - if (isset($thisfile_riff_WAVE['data'][0]['offset'])) { - $thisfile_avdataoffset = $thisfile_riff_WAVE['data'][0]['offset'] + 8; - $thisfile_avdataend = $thisfile_avdataoffset + $thisfile_riff_WAVE['data'][0]['size']; - } - if (isset($thisfile_riff_WAVE['fmt '][0]['data'])) { - - $thisfile_riff_audio[$streamindex] = getid3_riff::RIFFparseWAVEFORMATex($thisfile_riff_WAVE['fmt '][0]['data']); - $thisfile_audio['wformattag'] = $thisfile_riff_audio[$streamindex]['raw']['wFormatTag']; - if (@$thisfile_riff_audio[$streamindex]['bitrate'] == 0) { - $ThisFileInfo['error'][] = 'Corrupt RIFF file: bitrate_audio == zero'; - return false; - } - $thisfile_riff_raw['fmt '] = $thisfile_riff_audio[$streamindex]['raw']; - unset($thisfile_riff_audio[$streamindex]['raw']); - $thisfile_audio['streams'][$streamindex] = $thisfile_riff_audio[$streamindex]; - - $thisfile_audio = getid3_lib::array_merge_noclobber($thisfile_audio, $thisfile_riff_audio[$streamindex]); - if (substr($thisfile_audio['codec'], 0, strlen('unknown: 0x')) == 'unknown: 0x') { - $ThisFileInfo['warning'][] = 'Audio codec = '.$thisfile_audio['codec']; - } - $thisfile_audio['bitrate'] = $thisfile_riff_audio[$streamindex]['bitrate']; - - $ThisFileInfo['playtime_seconds'] = (float) ((($thisfile_avdataend - $thisfile_avdataoffset) * 8) / $thisfile_audio['bitrate']); - - $thisfile_audio['lossless'] = false; - if (isset($thisfile_riff_WAVE['data'][0]['offset']) && isset($thisfile_riff_raw['fmt ']['wFormatTag'])) { - switch ($thisfile_riff_raw['fmt ']['wFormatTag']) { - - case 0x0001: // PCM - $thisfile_audio['lossless'] = true; - break; - - case 0x2000: // AC-3 - $thisfile_audio_dataformat = 'ac3'; - break; - - default: - // do nothing - break; - - } - } - $thisfile_audio['streams'][$streamindex]['wformattag'] = $thisfile_audio['wformattag']; - $thisfile_audio['streams'][$streamindex]['bitrate_mode'] = $thisfile_audio['bitrate_mode']; - $thisfile_audio['streams'][$streamindex]['lossless'] = $thisfile_audio['lossless']; - $thisfile_audio['streams'][$streamindex]['dataformat'] = $thisfile_audio_dataformat; - } - - if (isset($thisfile_riff_WAVE['rgad'][0]['data'])) { - - // shortcuts - $rgadData = &$thisfile_riff_WAVE['rgad'][0]['data']; - $thisfile_riff_raw['rgad'] = array('track'=>array(), 'album'=>array()); - $thisfile_riff_raw_rgad = &$thisfile_riff_raw['rgad']; - $thisfile_riff_raw_rgad_track = &$thisfile_riff_raw_rgad['track']; - $thisfile_riff_raw_rgad_album = &$thisfile_riff_raw_rgad['album']; - - $thisfile_riff_raw_rgad['fPeakAmplitude'] = getid3_lib::LittleEndian2Float(substr($rgadData, 0, 4)); - $thisfile_riff_raw_rgad['nRadioRgAdjust'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($rgadData, 4, 2)); - $thisfile_riff_raw_rgad['nAudiophileRgAdjust'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($rgadData, 6, 2)); - - $nRadioRgAdjustBitstring = str_pad(getid3_lib::Dec2Bin($thisfile_riff_raw_rgad['nRadioRgAdjust']), 16, '0', STR_PAD_LEFT); - $nAudiophileRgAdjustBitstring = str_pad(getid3_lib::Dec2Bin($thisfile_riff_raw_rgad['nAudiophileRgAdjust']), 16, '0', STR_PAD_LEFT); - $thisfile_riff_raw_rgad_track['name'] = getid3_lib::Bin2Dec(substr($nRadioRgAdjustBitstring, 0, 3)); - $thisfile_riff_raw_rgad_track['originator'] = getid3_lib::Bin2Dec(substr($nRadioRgAdjustBitstring, 3, 3)); - $thisfile_riff_raw_rgad_track['signbit'] = getid3_lib::Bin2Dec(substr($nRadioRgAdjustBitstring, 6, 1)); - $thisfile_riff_raw_rgad_track['adjustment'] = getid3_lib::Bin2Dec(substr($nRadioRgAdjustBitstring, 7, 9)); - $thisfile_riff_raw_rgad_album['name'] = getid3_lib::Bin2Dec(substr($nAudiophileRgAdjustBitstring, 0, 3)); - $thisfile_riff_raw_rgad_album['originator'] = getid3_lib::Bin2Dec(substr($nAudiophileRgAdjustBitstring, 3, 3)); - $thisfile_riff_raw_rgad_album['signbit'] = getid3_lib::Bin2Dec(substr($nAudiophileRgAdjustBitstring, 6, 1)); - $thisfile_riff_raw_rgad_album['adjustment'] = getid3_lib::Bin2Dec(substr($nAudiophileRgAdjustBitstring, 7, 9)); - - $thisfile_riff['rgad']['peakamplitude'] = $thisfile_riff_raw_rgad['fPeakAmplitude']; - if (($thisfile_riff_raw_rgad_track['name'] != 0) && ($thisfile_riff_raw_rgad_track['originator'] != 0)) { - $thisfile_riff['rgad']['track']['name'] = getid3_lib::RGADnameLookup($thisfile_riff_raw_rgad_track['name']); - $thisfile_riff['rgad']['track']['originator'] = getid3_lib::RGADoriginatorLookup($thisfile_riff_raw_rgad_track['originator']); - $thisfile_riff['rgad']['track']['adjustment'] = getid3_lib::RGADadjustmentLookup($thisfile_riff_raw_rgad_track['adjustment'], $thisfile_riff_raw_rgad_track['signbit']); - } - if (($thisfile_riff_raw_rgad_album['name'] != 0) && ($thisfile_riff_raw_rgad_album['originator'] != 0)) { - $thisfile_riff['rgad']['album']['name'] = getid3_lib::RGADnameLookup($thisfile_riff_raw_rgad_album['name']); - $thisfile_riff['rgad']['album']['originator'] = getid3_lib::RGADoriginatorLookup($thisfile_riff_raw_rgad_album['originator']); - $thisfile_riff['rgad']['album']['adjustment'] = getid3_lib::RGADadjustmentLookup($thisfile_riff_raw_rgad_album['adjustment'], $thisfile_riff_raw_rgad_album['signbit']); - } - } - - if (isset($thisfile_riff_WAVE['fact'][0]['data'])) { - $thisfile_riff_raw['fact']['NumberOfSamples'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($thisfile_riff_WAVE['fact'][0]['data'], 0, 4)); - - // This should be a good way of calculating exact playtime, - // but some sample files have had incorrect number of samples, - // so cannot use this method - - // if (!empty($thisfile_riff_raw['fmt ']['nSamplesPerSec'])) { - // $ThisFileInfo['playtime_seconds'] = (float) $thisfile_riff_raw['fact']['NumberOfSamples'] / $thisfile_riff_raw['fmt ']['nSamplesPerSec']; - // } - } - if (!empty($thisfile_riff_raw['fmt ']['nAvgBytesPerSec'])) { - $thisfile_audio['bitrate'] = getid3_lib::CastAsInt($thisfile_riff_raw['fmt ']['nAvgBytesPerSec'] * 8); - } - - if (isset($thisfile_riff_WAVE['bext'][0]['data'])) { - // shortcut - $thisfile_riff_WAVE_bext_0 = &$thisfile_riff_WAVE['bext'][0]; - - $thisfile_riff_WAVE_bext_0['title'] = trim(substr($thisfile_riff_WAVE_bext_0['data'], 0, 256)); - $thisfile_riff_WAVE_bext_0['author'] = trim(substr($thisfile_riff_WAVE_bext_0['data'], 256, 32)); - $thisfile_riff_WAVE_bext_0['reference'] = trim(substr($thisfile_riff_WAVE_bext_0['data'], 288, 32)); - $thisfile_riff_WAVE_bext_0['origin_date'] = substr($thisfile_riff_WAVE_bext_0['data'], 320, 10); - $thisfile_riff_WAVE_bext_0['origin_time'] = substr($thisfile_riff_WAVE_bext_0['data'], 330, 8); - $thisfile_riff_WAVE_bext_0['time_reference'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_bext_0['data'], 338, 8)); - $thisfile_riff_WAVE_bext_0['bwf_version'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_bext_0['data'], 346, 1)); - $thisfile_riff_WAVE_bext_0['reserved'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_bext_0['data'], 347, 254)); - $thisfile_riff_WAVE_bext_0['coding_history'] = explode("\r\n", trim(substr($thisfile_riff_WAVE_bext_0['data'], 601))); - - $thisfile_riff_WAVE_bext_0['origin_date_unix'] = gmmktime( - substr($thisfile_riff_WAVE_bext_0['origin_time'], 0, 2), - substr($thisfile_riff_WAVE_bext_0['origin_time'], 3, 2), - substr($thisfile_riff_WAVE_bext_0['origin_time'], 6, 2), - substr($thisfile_riff_WAVE_bext_0['origin_date'], 5, 2), - substr($thisfile_riff_WAVE_bext_0['origin_date'], 8, 2), - substr($thisfile_riff_WAVE_bext_0['origin_date'], 0, 4)); - - $thisfile_riff['comments']['author'][] = $thisfile_riff_WAVE_bext_0['author']; - $thisfile_riff['comments']['title'][] = $thisfile_riff_WAVE_bext_0['title']; - } - - if (isset($thisfile_riff_WAVE['MEXT'][0]['data'])) { - // shortcut - $thisfile_riff_WAVE_MEXT_0 = &$thisfile_riff_WAVE['MEXT'][0]; - - $thisfile_riff_WAVE_MEXT_0['raw']['sound_information'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_MEXT_0['data'], 0, 2)); - $thisfile_riff_WAVE_MEXT_0['flags']['homogenous'] = (bool) ($thisfile_riff_WAVE_MEXT_0['raw']['sound_information'] & 0x0001); - if ($thisfile_riff_WAVE_MEXT_0['flags']['homogenous']) { - $thisfile_riff_WAVE_MEXT_0['flags']['padding'] = ($thisfile_riff_WAVE_MEXT_0['raw']['sound_information'] & 0x0002) ? false : true; - $thisfile_riff_WAVE_MEXT_0['flags']['22_or_44'] = (bool) ($thisfile_riff_WAVE_MEXT_0['raw']['sound_information'] & 0x0004); - $thisfile_riff_WAVE_MEXT_0['flags']['free_format'] = (bool) ($thisfile_riff_WAVE_MEXT_0['raw']['sound_information'] & 0x0008); - - $thisfile_riff_WAVE_MEXT_0['nominal_frame_size'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_MEXT_0['data'], 2, 2)); - } - $thisfile_riff_WAVE_MEXT_0['anciliary_data_length'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_MEXT_0['data'], 6, 2)); - $thisfile_riff_WAVE_MEXT_0['raw']['anciliary_data_def'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_MEXT_0['data'], 8, 2)); - $thisfile_riff_WAVE_MEXT_0['flags']['anciliary_data_left'] = (bool) ($thisfile_riff_WAVE_MEXT_0['raw']['anciliary_data_def'] & 0x0001); - $thisfile_riff_WAVE_MEXT_0['flags']['anciliary_data_free'] = (bool) ($thisfile_riff_WAVE_MEXT_0['raw']['anciliary_data_def'] & 0x0002); - $thisfile_riff_WAVE_MEXT_0['flags']['anciliary_data_right'] = (bool) ($thisfile_riff_WAVE_MEXT_0['raw']['anciliary_data_def'] & 0x0004); - } - - if (isset($thisfile_riff_WAVE['cart'][0]['data'])) { - // shortcut - $thisfile_riff_WAVE_cart_0 = &$thisfile_riff_WAVE['cart'][0]; - - $thisfile_riff_WAVE_cart_0['version'] = substr($thisfile_riff_WAVE_cart_0['data'], 0, 4); - $thisfile_riff_WAVE_cart_0['title'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 4, 64)); - $thisfile_riff_WAVE_cart_0['artist'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 68, 64)); - $thisfile_riff_WAVE_cart_0['cut_id'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 132, 64)); - $thisfile_riff_WAVE_cart_0['client_id'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 196, 64)); - $thisfile_riff_WAVE_cart_0['category'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 260, 64)); - $thisfile_riff_WAVE_cart_0['classification'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 324, 64)); - $thisfile_riff_WAVE_cart_0['out_cue'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 388, 64)); - $thisfile_riff_WAVE_cart_0['start_date'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 452, 10)); - $thisfile_riff_WAVE_cart_0['start_time'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 462, 8)); - $thisfile_riff_WAVE_cart_0['end_date'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 470, 10)); - $thisfile_riff_WAVE_cart_0['end_time'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 480, 8)); - $thisfile_riff_WAVE_cart_0['producer_app_id'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 488, 64)); - $thisfile_riff_WAVE_cart_0['producer_app_version'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 552, 64)); - $thisfile_riff_WAVE_cart_0['user_defined_text'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 616, 64)); - $thisfile_riff_WAVE_cart_0['zero_db_reference'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_cart_0['data'], 680, 4), true); - for ($i = 0; $i < 8; $i++) { - $thisfile_riff_WAVE_cart_0['post_time'][$i]['usage_fourcc'] = substr($thisfile_riff_WAVE_cart_0['data'], 684 + ($i * 8), 4); - $thisfile_riff_WAVE_cart_0['post_time'][$i]['timer_value'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_cart_0['data'], 684 + ($i * 8) + 4, 4)); - } - $thisfile_riff_WAVE_cart_0['url'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 748, 1024)); - $thisfile_riff_WAVE_cart_0['tag_text'] = explode("\r\n", trim(substr($thisfile_riff_WAVE_cart_0['data'], 1772))); - - $thisfile_riff['comments']['artist'][] = $thisfile_riff_WAVE_cart_0['artist']; - $thisfile_riff['comments']['title'][] = $thisfile_riff_WAVE_cart_0['title']; - } - - if (!isset($thisfile_audio['bitrate']) && isset($thisfile_riff_audio[$streamindex]['bitrate'])) { - $thisfile_audio['bitrate'] = $thisfile_riff_audio[$streamindex]['bitrate']; - $ThisFileInfo['playtime_seconds'] = (float) ((($thisfile_avdataend - $thisfile_avdataoffset) * 8) / $thisfile_audio['bitrate']); - } - - if (!empty($ThisFileInfo['wavpack'])) { - $thisfile_audio_dataformat = 'wavpack'; - $thisfile_audio['bitrate_mode'] = 'vbr'; - $thisfile_audio['encoder'] = 'WavPack v'.$ThisFileInfo['wavpack']['version']; - - // Reset to the way it was - RIFF parsing will have messed this up - $thisfile_avdataend = $Original['avdataend']; - $thisfile_audio['bitrate'] = (($thisfile_avdataend - $thisfile_avdataoffset) * 8) / $ThisFileInfo['playtime_seconds']; - - fseek($fd, $thisfile_avdataoffset - 44, SEEK_SET); - $RIFFdata = fread($fd, 44); - $OrignalRIFFheaderSize = getid3_lib::LittleEndian2Int(substr($RIFFdata, 4, 4)) + 8; - $OrignalRIFFdataSize = getid3_lib::LittleEndian2Int(substr($RIFFdata, 40, 4)) + 44; - - if ($OrignalRIFFheaderSize > $OrignalRIFFdataSize) { - $thisfile_avdataend -= ($OrignalRIFFheaderSize - $OrignalRIFFdataSize); - fseek($fd, $thisfile_avdataend, SEEK_SET); - $RIFFdata .= fread($fd, $OrignalRIFFheaderSize - $OrignalRIFFdataSize); - } - - // move the data chunk after all other chunks (if any) - // so that the RIFF parser doesn't see EOF when trying - // to skip over the data chunk - $RIFFdata = substr($RIFFdata, 0, 36).substr($RIFFdata, 44).substr($RIFFdata, 36, 8); - getid3_riff::ParseRIFFdata($RIFFdata, $ThisFileInfo); - } - - if (isset($thisfile_riff_raw['fmt ']['wFormatTag'])) { - switch ($thisfile_riff_raw['fmt ']['wFormatTag']) { - case 0x08AE: // ClearJump LiteWave - $thisfile_audio['bitrate_mode'] = 'vbr'; - $thisfile_audio_dataformat = 'litewave'; - - //typedef struct tagSLwFormat { - // WORD m_wCompFormat; // low byte defines compression method, high byte is compression flags - // DWORD m_dwScale; // scale factor for lossy compression - // DWORD m_dwBlockSize; // number of samples in encoded blocks - // WORD m_wQuality; // alias for the scale factor - // WORD m_wMarkDistance; // distance between marks in bytes - // WORD m_wReserved; - // - // //following paramters are ignored if CF_FILESRC is not set - // DWORD m_dwOrgSize; // original file size in bytes - // WORD m_bFactExists; // indicates if 'fact' chunk exists in the original file - // DWORD m_dwRiffChunkSize; // riff chunk size in the original file - // - // PCMWAVEFORMAT m_OrgWf; // original wave format - // }SLwFormat, *PSLwFormat; - - // shortcut - $thisfile_riff['litewave']['raw'] = array(); - $thisfile_riff_litewave = &$thisfile_riff['litewave']; - $thisfile_riff_litewave_raw = &$thisfile_riff_litewave['raw']; - - $thisfile_riff_litewave_raw['compression_method'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE['fmt '][0]['data'], 18, 1)); - $thisfile_riff_litewave_raw['compression_flags'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE['fmt '][0]['data'], 19, 1)); - $thisfile_riff_litewave_raw['m_dwScale'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE['fmt '][0]['data'], 20, 4)); - $thisfile_riff_litewave_raw['m_dwBlockSize'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE['fmt '][0]['data'], 24, 4)); - $thisfile_riff_litewave_raw['m_wQuality'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE['fmt '][0]['data'], 28, 2)); - $thisfile_riff_litewave_raw['m_wMarkDistance'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE['fmt '][0]['data'], 30, 2)); - $thisfile_riff_litewave_raw['m_wReserved'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE['fmt '][0]['data'], 32, 2)); - $thisfile_riff_litewave_raw['m_dwOrgSize'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE['fmt '][0]['data'], 34, 4)); - $thisfile_riff_litewave_raw['m_bFactExists'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE['fmt '][0]['data'], 38, 2)); - $thisfile_riff_litewave_raw['m_dwRiffChunkSize'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE['fmt '][0]['data'], 40, 4)); - - //$thisfile_riff_litewave['quality_factor'] = intval(round((2000 - $thisfile_riff_litewave_raw['m_dwScale']) / 20)); - $thisfile_riff_litewave['quality_factor'] = $thisfile_riff_litewave_raw['m_wQuality']; - - $thisfile_riff_litewave['flags']['raw_source'] = ($thisfile_riff_litewave_raw['compression_flags'] & 0x01) ? false : true; - $thisfile_riff_litewave['flags']['vbr_blocksize'] = ($thisfile_riff_litewave_raw['compression_flags'] & 0x02) ? false : true; - $thisfile_riff_litewave['flags']['seekpoints'] = (bool) ($thisfile_riff_litewave_raw['compression_flags'] & 0x04); - - $thisfile_audio['lossless'] = (($thisfile_riff_litewave_raw['m_wQuality'] == 100) ? true : false); - $thisfile_audio['encoder_options'] = '-q'.$thisfile_riff_litewave['quality_factor']; - break; - - default: - break; - } - } - if ($thisfile_avdataend > $ThisFileInfo['filesize']) { - switch (@$thisfile_audio_dataformat) { - case 'wavpack': // WavPack - case 'lpac': // LPAC - case 'ofr': // OptimFROG - case 'ofs': // OptimFROG DualStream - // lossless compressed audio formats that keep original RIFF headers - skip warning - break; - - case 'litewave': - if (($thisfile_avdataend - $ThisFileInfo['filesize']) == 1) { - // LiteWave appears to incorrectly *not* pad actual output file - // to nearest WORD boundary so may appear to be short by one - // byte, in which case - skip warning - } else { - // Short by more than one byte, throw warning - $ThisFileInfo['warning'][] = 'Probably truncated file - expecting '.$thisfile_riff[$RIFFsubtype]['data'][0]['size'].' bytes of data, only found '.($ThisFileInfo['filesize'] - $thisfile_avdataoffset).' (short by '.($thisfile_riff[$RIFFsubtype]['data'][0]['size'] - ($ThisFileInfo['filesize'] - $thisfile_avdataoffset)).' bytes)'; - $thisfile_avdataend = $ThisFileInfo['filesize']; - } - break; - - default: - if ((($thisfile_avdataend - $ThisFileInfo['filesize']) == 1) && (($thisfile_riff[$RIFFsubtype]['data'][0]['size'] % 2) == 0) && ((($ThisFileInfo['filesize'] - $thisfile_avdataoffset) % 2) == 1)) { - // output file appears to be incorrectly *not* padded to nearest WORD boundary - // Output less severe warning - $ThisFileInfo['warning'][] = 'File should probably be padded to nearest WORD boundary, but it is not (expecting '.$thisfile_riff[$RIFFsubtype]['data'][0]['size'].' bytes of data, only found '.($ThisFileInfo['filesize'] - $thisfile_avdataoffset).' therefore short by '.($thisfile_riff[$RIFFsubtype]['data'][0]['size'] - ($ThisFileInfo['filesize'] - $thisfile_avdataoffset)).' bytes)'; - $thisfile_avdataend = $ThisFileInfo['filesize']; - break; - } - // Short by more than one byte, throw warning - $ThisFileInfo['warning'][] = 'Probably truncated file - expecting '.$thisfile_riff[$RIFFsubtype]['data'][0]['size'].' bytes of data, only found '.($ThisFileInfo['filesize'] - $thisfile_avdataoffset).' (short by '.($thisfile_riff[$RIFFsubtype]['data'][0]['size'] - ($ThisFileInfo['filesize'] - $thisfile_avdataoffset)).' bytes)'; - $thisfile_avdataend = $ThisFileInfo['filesize']; - break; - } - } - if (!empty($ThisFileInfo['mpeg']['audio']['LAME']['audio_bytes'])) { - if ((($thisfile_avdataend - $thisfile_avdataoffset) - $ThisFileInfo['mpeg']['audio']['LAME']['audio_bytes']) == 1) { - $thisfile_avdataend--; - $ThisFileInfo['warning'][] = 'Extra null byte at end of MP3 data assumed to be RIFF padding and therefore ignored'; - } - } - if (@$thisfile_audio_dataformat == 'ac3') { - unset($thisfile_audio['bits_per_sample']); - if (!empty($ThisFileInfo['ac3']['bitrate']) && ($ThisFileInfo['ac3']['bitrate'] != $thisfile_audio['bitrate'])) { - $thisfile_audio['bitrate'] = $ThisFileInfo['ac3']['bitrate']; - } - } - break; - - case 'AVI ': - $thisfile_video['bitrate_mode'] = 'vbr'; // maybe not, but probably - $thisfile_video['dataformat'] = 'avi'; - $ThisFileInfo['mime_type'] = 'video/avi'; - - if (isset($thisfile_riff[$RIFFsubtype]['movi']['offset'])) { - $thisfile_avdataoffset = $thisfile_riff[$RIFFsubtype]['movi']['offset'] + 8; - $thisfile_avdataend = $thisfile_avdataoffset + $thisfile_riff[$RIFFsubtype]['movi']['size']; - if ($thisfile_avdataend > $ThisFileInfo['filesize']) { - $ThisFileInfo['warning'][] = 'Probably truncated file - expecting '.$thisfile_riff[$RIFFsubtype]['movi']['size'].' bytes of data, only found '.($ThisFileInfo['filesize'] - $thisfile_avdataoffset).' (short by '.($thisfile_riff[$RIFFsubtype]['movi']['size'] - ($ThisFileInfo['filesize'] - $thisfile_avdataoffset)).' bytes)'; - $thisfile_avdataend = $ThisFileInfo['filesize']; - } - } - - if (isset($thisfile_riff['AVI ']['hdrl']['strl']['indx'])) { - //$bIndexType = array( - // 0x00 => 'AVI_INDEX_OF_INDEXES', - // 0x01 => 'AVI_INDEX_OF_CHUNKS', - // 0x80 => 'AVI_INDEX_IS_DATA', - //); - //$bIndexSubtype = array( - // 0x01 => array( - // 0x01 => 'AVI_INDEX_2FIELD', - // ), - //); - foreach ($thisfile_riff['AVI ']['hdrl']['strl']['indx'] as $streamnumber => $steamdataarray) { - $thisfile_riff_avi_hdrl_strl_indx_stream_data = &$thisfile_riff['AVI ']['hdrl']['strl']['indx'][$streamnumber]['data']; - - $thisfile_riff_raw['indx'][$streamnumber]['wLongsPerEntry'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($thisfile_riff_avi_hdrl_strl_indx_stream_data, 0, 2)); - $thisfile_riff_raw['indx'][$streamnumber]['bIndexSubType'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($thisfile_riff_avi_hdrl_strl_indx_stream_data, 2, 1)); - $thisfile_riff_raw['indx'][$streamnumber]['bIndexType'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($thisfile_riff_avi_hdrl_strl_indx_stream_data, 3, 1)); - $thisfile_riff_raw['indx'][$streamnumber]['nEntriesInUse'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($thisfile_riff_avi_hdrl_strl_indx_stream_data, 4, 4)); - $thisfile_riff_raw['indx'][$streamnumber]['dwChunkId'] = substr($thisfile_riff_avi_hdrl_strl_indx_stream_data, 8, 4); - $thisfile_riff_raw['indx'][$streamnumber]['dwReserved'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($thisfile_riff_avi_hdrl_strl_indx_stream_data, 12, 4)); - - //$thisfile_riff_raw['indx'][$streamnumber]['bIndexType_name'] = @$bIndexType[$thisfile_riff_raw['indx'][$streamnumber]['bIndexType']]; - //$thisfile_riff_raw['indx'][$streamnumber]['bIndexSubType_name'] = @$bIndexSubtype[$thisfile_riff_raw['indx'][$streamnumber]['bIndexType']][$thisfile_riff_raw['indx'][$streamnumber]['bIndexSubType']]; - - unset($thisfile_riff_avi_hdrl_strl_indx_stream_data); - } - } - if (isset($thisfile_riff['AVI ']['hdrl']['avih'][$streamindex]['data'])) { - $avihData = $thisfile_riff['AVI ']['hdrl']['avih'][$streamindex]['data']; - - // shortcut - $thisfile_riff_raw['avih'] = array(); - $thisfile_riff_raw_avih = &$thisfile_riff_raw['avih']; - - $thisfile_riff_raw_avih['dwMicroSecPerFrame'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($avihData, 0, 4)); // frame display rate (or 0L) - if ($thisfile_riff_raw_avih['dwMicroSecPerFrame'] == 0) { - $ThisFileInfo['error'][] = 'Corrupt RIFF file: avih.dwMicroSecPerFrame == zero'; - return false; - } - $thisfile_riff_raw_avih['dwMaxBytesPerSec'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($avihData, 4, 4)); // max. transfer rate - $thisfile_riff_raw_avih['dwPaddingGranularity'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($avihData, 8, 4)); // pad to multiples of this size; normally 2K. - $thisfile_riff_raw_avih['dwFlags'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($avihData, 12, 4)); // the ever-present flags - $thisfile_riff_raw_avih['dwTotalFrames'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($avihData, 16, 4)); // # frames in file - $thisfile_riff_raw_avih['dwInitialFrames'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($avihData, 20, 4)); - $thisfile_riff_raw_avih['dwStreams'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($avihData, 24, 4)); - $thisfile_riff_raw_avih['dwSuggestedBufferSize'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($avihData, 28, 4)); - $thisfile_riff_raw_avih['dwWidth'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($avihData, 32, 4)); - $thisfile_riff_raw_avih['dwHeight'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($avihData, 36, 4)); - $thisfile_riff_raw_avih['dwScale'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($avihData, 40, 4)); - $thisfile_riff_raw_avih['dwRate'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($avihData, 44, 4)); - $thisfile_riff_raw_avih['dwStart'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($avihData, 48, 4)); - $thisfile_riff_raw_avih['dwLength'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($avihData, 52, 4)); - - $thisfile_riff_raw_avih['flags']['hasindex'] = (bool) ($thisfile_riff_raw_avih['dwFlags'] & 0x00000010); - $thisfile_riff_raw_avih['flags']['mustuseindex'] = (bool) ($thisfile_riff_raw_avih['dwFlags'] & 0x00000020); - $thisfile_riff_raw_avih['flags']['interleaved'] = (bool) ($thisfile_riff_raw_avih['dwFlags'] & 0x00000100); - $thisfile_riff_raw_avih['flags']['trustcktype'] = (bool) ($thisfile_riff_raw_avih['dwFlags'] & 0x00000800); - $thisfile_riff_raw_avih['flags']['capturedfile'] = (bool) ($thisfile_riff_raw_avih['dwFlags'] & 0x00010000); - $thisfile_riff_raw_avih['flags']['copyrighted'] = (bool) ($thisfile_riff_raw_avih['dwFlags'] & 0x00020010); - - // shortcut - $thisfile_riff_video[$streamindex] = array(); - $thisfile_riff_video_current = &$thisfile_riff_video[$streamindex]; - - if ($thisfile_riff_raw_avih['dwWidth'] > 0) { - $thisfile_riff_video_current['frame_width'] = $thisfile_riff_raw_avih['dwWidth']; - $thisfile_video['resolution_x'] = $thisfile_riff_video_current['frame_width']; - } - if ($thisfile_riff_raw_avih['dwHeight'] > 0) { - $thisfile_riff_video_current['frame_height'] = $thisfile_riff_raw_avih['dwHeight']; - $thisfile_video['resolution_y'] = $thisfile_riff_video_current['frame_height']; - } - if ($thisfile_riff_raw_avih['dwTotalFrames'] > 0) { - $thisfile_riff_video_current['total_frames'] = $thisfile_riff_raw_avih['dwTotalFrames']; - $thisfile_video['total_frames'] = $thisfile_riff_video_current['total_frames']; - } - - $thisfile_riff_video_current['frame_rate'] = round(1000000 / $thisfile_riff_raw_avih['dwMicroSecPerFrame'], 3); - $thisfile_video['frame_rate'] = $thisfile_riff_video_current['frame_rate']; - } - if (isset($thisfile_riff['AVI ']['hdrl']['strl']['strh'][0]['data'])) { - if (is_array($thisfile_riff['AVI ']['hdrl']['strl']['strh'])) { - for ($i = 0; $i < count($thisfile_riff['AVI ']['hdrl']['strl']['strh']); $i++) { - if (isset($thisfile_riff['AVI ']['hdrl']['strl']['strh'][$i]['data'])) { - $strhData = $thisfile_riff['AVI ']['hdrl']['strl']['strh'][$i]['data']; - $strhfccType = substr($strhData, 0, 4); - - if (isset($thisfile_riff['AVI ']['hdrl']['strl']['strf'][$i]['data'])) { - $strfData = $thisfile_riff['AVI ']['hdrl']['strl']['strf'][$i]['data']; - - // shortcut - $thisfile_riff_raw_strf_strhfccType_streamindex = &$thisfile_riff_raw['strf'][$strhfccType][$streamindex]; - - switch ($strhfccType) { - case 'auds': - $thisfile_audio['bitrate_mode'] = 'cbr'; - $thisfile_audio_dataformat = 'wav'; - if (isset($thisfile_riff_audio) && is_array($thisfile_riff_audio)) { - $streamindex = count($thisfile_riff_audio); - } - - $thisfile_riff_audio[$streamindex] = getid3_riff::RIFFparseWAVEFORMATex($strfData); - $thisfile_audio['wformattag'] = $thisfile_riff_audio[$streamindex]['raw']['wFormatTag']; - - // shortcut - $thisfile_audio['streams'][$streamindex] = $thisfile_riff_audio[$streamindex]; - $thisfile_audio_streams_currentstream = &$thisfile_audio['streams'][$streamindex]; - - if ($thisfile_audio_streams_currentstream['bits_per_sample'] == 0) { - unset($thisfile_audio_streams_currentstream['bits_per_sample']); - } - $thisfile_audio_streams_currentstream['wformattag'] = $thisfile_audio_streams_currentstream['raw']['wFormatTag']; - unset($thisfile_audio_streams_currentstream['raw']); - - // shortcut - $thisfile_riff_raw['strf'][$strhfccType][$streamindex] = $thisfile_riff_audio[$streamindex]['raw']; - - unset($thisfile_riff_audio[$streamindex]['raw']); - $thisfile_audio = getid3_lib::array_merge_noclobber($thisfile_audio, $thisfile_riff_audio[$streamindex]); - - $thisfile_audio['lossless'] = false; - switch ($thisfile_riff_raw_strf_strhfccType_streamindex['wFormatTag']) { - case 0x0001: // PCM - $thisfile_audio_dataformat = 'wav'; - $thisfile_audio['lossless'] = true; - break; - - case 0x0050: // MPEG Layer 2 or Layer 1 - $thisfile_audio_dataformat = 'mp2'; // Assume Layer-2 - break; - - case 0x0055: // MPEG Layer 3 - $thisfile_audio_dataformat = 'mp3'; - break; - - case 0x00FF: // AAC - $thisfile_audio_dataformat = 'aac'; - break; - - case 0x0161: // Windows Media v7 / v8 / v9 - case 0x0162: // Windows Media Professional v9 - case 0x0163: // Windows Media Lossess v9 - $thisfile_audio_dataformat = 'wma'; - break; - - case 0x2000: // AC-3 - $thisfile_audio_dataformat = 'ac3'; - break; - - case 0x2001: // DTS - $thisfile_audio_dataformat = 'dts'; - break; - - default: - $thisfile_audio_dataformat = 'wav'; - break; - } - $thisfile_audio_streams_currentstream['dataformat'] = $thisfile_audio_dataformat; - $thisfile_audio_streams_currentstream['lossless'] = $thisfile_audio['lossless']; - $thisfile_audio_streams_currentstream['bitrate_mode'] = $thisfile_audio['bitrate_mode']; - break; - - - case 'iavs': - case 'vids': - // shortcut - $thisfile_riff_raw['strh'][$i] = array(); - $thisfile_riff_raw_strh_current = &$thisfile_riff_raw['strh'][$i]; - - $thisfile_riff_raw_strh_current['fccType'] = substr($strhData, 0, 4); // same as $strhfccType; - $thisfile_riff_raw_strh_current['fccHandler'] = substr($strhData, 4, 4); - $thisfile_riff_raw_strh_current['dwFlags'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($strhData, 8, 4)); // Contains AVITF_* flags - $thisfile_riff_raw_strh_current['wPriority'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($strhData, 12, 2)); - $thisfile_riff_raw_strh_current['wLanguage'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($strhData, 14, 2)); - $thisfile_riff_raw_strh_current['dwInitialFrames'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($strhData, 16, 4)); - $thisfile_riff_raw_strh_current['dwScale'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($strhData, 20, 4)); - $thisfile_riff_raw_strh_current['dwRate'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($strhData, 24, 4)); - $thisfile_riff_raw_strh_current['dwStart'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($strhData, 28, 4)); - $thisfile_riff_raw_strh_current['dwLength'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($strhData, 32, 4)); - $thisfile_riff_raw_strh_current['dwSuggestedBufferSize'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($strhData, 36, 4)); - $thisfile_riff_raw_strh_current['dwQuality'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($strhData, 40, 4)); - $thisfile_riff_raw_strh_current['dwSampleSize'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($strhData, 44, 4)); - $thisfile_riff_raw_strh_current['rcFrame'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($strhData, 48, 4)); - - $thisfile_riff_video_current['codec'] = getid3_riff::RIFFfourccLookup($thisfile_riff_raw_strh_current['fccHandler']); - $thisfile_video['fourcc'] = $thisfile_riff_raw_strh_current['fccHandler']; - if (!$thisfile_riff_video_current['codec'] && isset($thisfile_riff_raw_strf_strhfccType_streamindex['fourcc']) && getid3_riff::RIFFfourccLookup($thisfile_riff_raw_strf_strhfccType_streamindex['fourcc'])) { - $thisfile_riff_video_current['codec'] = getid3_riff::RIFFfourccLookup($thisfile_riff_raw_strf_strhfccType_streamindex['fourcc']); - $thisfile_video['fourcc'] = $thisfile_riff_raw_strf_strhfccType_streamindex['fourcc']; - } - $thisfile_video['codec'] = $thisfile_riff_video_current['codec']; - $thisfile_video['pixel_aspect_ratio'] = (float) 1; - switch ($thisfile_riff_raw_strh_current['fccHandler']) { - case 'HFYU': // Huffman Lossless Codec - case 'IRAW': // Intel YUV Uncompressed - case 'YUY2': // Uncompressed YUV 4:2:2 - $thisfile_video['lossless'] = true; - break; - - default: - $thisfile_video['lossless'] = false; - break; - } - - switch ($strhfccType) { - case 'vids': - $thisfile_riff_raw_strf_strhfccType_streamindex = getid3_riff::ParseBITMAPINFOHEADER(substr($strfData, 0, 40), ($ThisFileInfo['fileformat'] == 'riff')); - //$thisfile_riff_raw_strf_strhfccType_streamindex['biSize'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($strfData, 0, 4)); // number of bytes required by the BITMAPINFOHEADER structure - //$thisfile_riff_raw_strf_strhfccType_streamindex['biWidth'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($strfData, 4, 4)); // width of the bitmap in pixels - //$thisfile_riff_raw_strf_strhfccType_streamindex['biHeight'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($strfData, 8, 4)); // height of the bitmap in pixels. If biHeight is positive, the bitmap is a 'bottom-up' DIB and its origin is the lower left corner. If biHeight is negative, the bitmap is a 'top-down' DIB and its origin is the upper left corner - //$thisfile_riff_raw_strf_strhfccType_streamindex['biPlanes'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($strfData, 12, 2)); // number of color planes on the target device. In most cases this value must be set to 1 - //$thisfile_riff_raw_strf_strhfccType_streamindex['biBitCount'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($strfData, 14, 2)); // Specifies the number of bits per pixels - //$thisfile_riff_raw_strf_strhfccType_streamindex['fourcc'] = substr($strfData, 16, 4); // - //$thisfile_riff_raw_strf_strhfccType_streamindex['biSizeImage'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($strfData, 20, 4)); // size of the bitmap data section of the image (the actual pixel data, excluding BITMAPINFOHEADER and RGBQUAD structures) - //$thisfile_riff_raw_strf_strhfccType_streamindex['biXPelsPerMeter'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($strfData, 24, 4)); // horizontal resolution, in pixels per metre, of the target device - //$thisfile_riff_raw_strf_strhfccType_streamindex['biYPelsPerMeter'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($strfData, 28, 4)); // vertical resolution, in pixels per metre, of the target device - //$thisfile_riff_raw_strf_strhfccType_streamindex['biClrUsed'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($strfData, 32, 4)); // actual number of color indices in the color table used by the bitmap. If this value is zero, the bitmap uses the maximum number of colors corresponding to the value of the biBitCount member for the compression mode specified by biCompression - //$thisfile_riff_raw_strf_strhfccType_streamindex['biClrImportant'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($strfData, 36, 4)); // number of color indices that are considered important for displaying the bitmap. If this value is zero, all colors are important - - $thisfile_video['bits_per_sample'] = $thisfile_riff_raw_strf_strhfccType_streamindex['biBitCount']; - - if ($thisfile_riff_video_current['codec'] == 'DV') { - $thisfile_riff_video_current['dv_type'] = 2; - } - break; - - case 'iavs': - $thisfile_riff_video_current['dv_type'] = 1; - break; - } - break; - - default: - $ThisFileInfo['warning'][] = 'Unhandled fccType for stream ('.$i.'): "'.$strhfccType.'"'; - break; - - } - } - } - - if (isset($thisfile_riff_raw_strf_strhfccType_streamindex['fourcc']) && getid3_riff::RIFFfourccLookup($thisfile_riff_raw_strf_strhfccType_streamindex['fourcc'])) { - - $thisfile_riff_video_current['codec'] = getid3_riff::RIFFfourccLookup($thisfile_riff_raw_strf_strhfccType_streamindex['fourcc']); - $thisfile_video['codec'] = $thisfile_riff_video_current['codec']; - $thisfile_video['fourcc'] = $thisfile_riff_raw_strf_strhfccType_streamindex['fourcc']; - - switch ($thisfile_riff_raw_strf_strhfccType_streamindex['fourcc']) { - case 'HFYU': // Huffman Lossless Codec - case 'IRAW': // Intel YUV Uncompressed - case 'YUY2': // Uncompressed YUV 4:2:2 - $thisfile_video['lossless'] = true; - $thisfile_video['bits_per_sample'] = 24; - break; - - default: - $thisfile_video['lossless'] = false; - $thisfile_video['bits_per_sample'] = 24; - break; - } - - } - } - } - } - break; - - case 'CDDA': - $thisfile_audio['bitrate_mode'] = 'cbr'; - $thisfile_audio_dataformat = 'cda'; - $thisfile_audio['lossless'] = true; - unset($ThisFileInfo['mime_type']); - - $thisfile_avdataoffset = 44; - - if (isset($thisfile_riff['CDDA']['fmt '][0]['data'])) { - // shortcut - $thisfile_riff_CDDA_fmt_0 = &$thisfile_riff['CDDA']['fmt '][0]; - - $thisfile_riff_CDDA_fmt_0['unknown1'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($thisfile_riff_CDDA_fmt_0['data'], 0, 2)); - $thisfile_riff_CDDA_fmt_0['track_num'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($thisfile_riff_CDDA_fmt_0['data'], 2, 2)); - $thisfile_riff_CDDA_fmt_0['disc_id'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($thisfile_riff_CDDA_fmt_0['data'], 4, 4)); - $thisfile_riff_CDDA_fmt_0['start_offset_frame'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($thisfile_riff_CDDA_fmt_0['data'], 8, 4)); - $thisfile_riff_CDDA_fmt_0['playtime_frames'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($thisfile_riff_CDDA_fmt_0['data'], 12, 4)); - $thisfile_riff_CDDA_fmt_0['unknown6'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($thisfile_riff_CDDA_fmt_0['data'], 16, 4)); - $thisfile_riff_CDDA_fmt_0['unknown7'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($thisfile_riff_CDDA_fmt_0['data'], 20, 4)); - - $thisfile_riff_CDDA_fmt_0['start_offset_seconds'] = (float) $thisfile_riff_CDDA_fmt_0['start_offset_frame'] / 75; - $thisfile_riff_CDDA_fmt_0['playtime_seconds'] = (float) $thisfile_riff_CDDA_fmt_0['playtime_frames'] / 75; - $ThisFileInfo['comments']['track'] = $thisfile_riff_CDDA_fmt_0['track_num']; - $ThisFileInfo['playtime_seconds'] = $thisfile_riff_CDDA_fmt_0['playtime_seconds']; - - // hardcoded data for CD-audio - $thisfile_audio['sample_rate'] = 44100; - $thisfile_audio['channels'] = 2; - $thisfile_audio['bits_per_sample'] = 16; - $thisfile_audio['bitrate'] = $thisfile_audio['sample_rate'] * $thisfile_audio['channels'] * $thisfile_audio['bits_per_sample']; - $thisfile_audio['bitrate_mode'] = 'cbr'; - } - break; - - - case 'AIFF': - case 'AIFC': - $thisfile_audio['bitrate_mode'] = 'cbr'; - $thisfile_audio_dataformat = 'aiff'; - $thisfile_audio['lossless'] = true; - $ThisFileInfo['mime_type'] = 'audio/x-aiff'; - - if (isset($thisfile_riff[$RIFFsubtype]['SSND'][0]['offset'])) { - $thisfile_avdataoffset = $thisfile_riff[$RIFFsubtype]['SSND'][0]['offset'] + 8; - $thisfile_avdataend = $thisfile_avdataoffset + $thisfile_riff[$RIFFsubtype]['SSND'][0]['size']; - if ($thisfile_avdataend > $ThisFileInfo['filesize']) { - if (($thisfile_avdataend == ($ThisFileInfo['filesize'] + 1)) && (($ThisFileInfo['filesize'] % 2) == 1)) { - // structures rounded to 2-byte boundary, but dumb encoders - // forget to pad end of file to make this actually work - } else { - $ThisFileInfo['warning'][] = 'Probable truncated AIFF file: expecting '.$thisfile_riff[$RIFFsubtype]['SSND'][0]['size'].' bytes of audio data, only '.($ThisFileInfo['filesize'] - $thisfile_avdataoffset).' bytes found'; - } - $thisfile_avdataend = $ThisFileInfo['filesize']; - } - } - - if (isset($thisfile_riff[$RIFFsubtype]['COMM'][0]['data'])) { - - // shortcut - $thisfile_riff_RIFFsubtype_COMM_0_data = &$thisfile_riff[$RIFFsubtype]['COMM'][0]['data']; - - $thisfile_riff_audio['channels'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 0, 2), true); - $thisfile_riff_audio['total_samples'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 2, 4), false); - $thisfile_riff_audio['bits_per_sample'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 6, 2), true); - $thisfile_riff_audio['sample_rate'] = (int) getid3_lib::BigEndian2Float(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 8, 10)); - - if ($thisfile_riff[$RIFFsubtype]['COMM'][0]['size'] > 18) { - $thisfile_riff_audio['codec_fourcc'] = substr($thisfile_riff_RIFFsubtype_COMM_0_data, 18, 4); - $CodecNameSize = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 22, 1), false); - $thisfile_riff_audio['codec_name'] = substr($thisfile_riff_RIFFsubtype_COMM_0_data, 23, $CodecNameSize); - switch ($thisfile_riff_audio['codec_name']) { - case 'NONE': - $thisfile_audio['codec'] = 'Pulse Code Modulation (PCM)'; - $thisfile_audio['lossless'] = true; - break; - - case '': - switch ($thisfile_riff_audio['codec_fourcc']) { - // http://developer.apple.com/qa/snd/snd07.html - case 'sowt': - $thisfile_riff_audio['codec_name'] = 'Two\'s Compliment Little-Endian PCM'; - $thisfile_audio['lossless'] = true; - break; - - case 'twos': - $thisfile_riff_audio['codec_name'] = 'Two\'s Compliment Big-Endian PCM'; - $thisfile_audio['lossless'] = true; - break; - - default: - break; - } - break; - - default: - $thisfile_audio['codec'] = $thisfile_riff_audio['codec_name']; - $thisfile_audio['lossless'] = false; - break; - } - } - - $thisfile_audio['channels'] = $thisfile_riff_audio['channels']; - if ($thisfile_riff_audio['bits_per_sample'] > 0) { - $thisfile_audio['bits_per_sample'] = $thisfile_riff_audio['bits_per_sample']; - } - $thisfile_audio['sample_rate'] = $thisfile_riff_audio['sample_rate']; - if ($thisfile_audio['sample_rate'] == 0) { - $ThisFileInfo['error'][] = 'Corrupted AIFF file: sample_rate == zero'; - return false; - } - $ThisFileInfo['playtime_seconds'] = $thisfile_riff_audio['total_samples'] / $thisfile_audio['sample_rate']; - } - - if (isset($thisfile_riff[$RIFFsubtype]['COMT'])) { - $offset = 0; - $CommentCount = getid3_lib::BigEndian2Int(substr($thisfile_riff[$RIFFsubtype]['COMT'][0]['data'], $offset, 2), false); - $offset += 2; - for ($i = 0; $i < $CommentCount; $i++) { - $ThisFileInfo['comments_raw'][$i]['timestamp'] = getid3_lib::BigEndian2Int(substr($thisfile_riff[$RIFFsubtype]['COMT'][0]['data'], $offset, 4), false); - $offset += 4; - $ThisFileInfo['comments_raw'][$i]['marker_id'] = getid3_lib::BigEndian2Int(substr($thisfile_riff[$RIFFsubtype]['COMT'][0]['data'], $offset, 2), true); - $offset += 2; - $CommentLength = getid3_lib::BigEndian2Int(substr($thisfile_riff[$RIFFsubtype]['COMT'][0]['data'], $offset, 2), false); - $offset += 2; - $ThisFileInfo['comments_raw'][$i]['comment'] = substr($thisfile_riff[$RIFFsubtype]['COMT'][0]['data'], $offset, $CommentLength); - $offset += $CommentLength; - - $ThisFileInfo['comments_raw'][$i]['timestamp_unix'] = getid3_lib::DateMac2Unix($ThisFileInfo['comments_raw'][$i]['timestamp']); - $thisfile_riff['comments']['comment'][] = $ThisFileInfo['comments_raw'][$i]['comment']; - } - } - - $CommentsChunkNames = array('NAME'=>'title', 'author'=>'artist', '(c) '=>'copyright', 'ANNO'=>'comment'); - foreach ($CommentsChunkNames as $key => $value) { - if (isset($thisfile_riff[$RIFFsubtype][$key][0]['data'])) { - $thisfile_riff['comments'][$value][] = $thisfile_riff[$RIFFsubtype][$key][0]['data']; - } - } - break; - - case '8SVX': - $thisfile_audio['bitrate_mode'] = 'cbr'; - $thisfile_audio_dataformat = '8svx'; - $thisfile_audio['bits_per_sample'] = 8; - $thisfile_audio['channels'] = 1; // overridden below, if need be - $ThisFileInfo['mime_type'] = 'audio/x-aiff'; - - if (isset($thisfile_riff[$RIFFsubtype]['BODY'][0]['offset'])) { - $thisfile_avdataoffset = $thisfile_riff[$RIFFsubtype]['BODY'][0]['offset'] + 8; - $thisfile_avdataend = $thisfile_avdataoffset + $thisfile_riff[$RIFFsubtype]['BODY'][0]['size']; - if ($thisfile_avdataend > $ThisFileInfo['filesize']) { - $ThisFileInfo['warning'][] = 'Probable truncated AIFF file: expecting '.$thisfile_riff[$RIFFsubtype]['BODY'][0]['size'].' bytes of audio data, only '.($ThisFileInfo['filesize'] - $thisfile_avdataoffset).' bytes found'; - } - } - - if (isset($thisfile_riff[$RIFFsubtype]['VHDR'][0]['offset'])) { - // shortcut - $thisfile_riff_RIFFsubtype_VHDR_0 = &$thisfile_riff[$RIFFsubtype]['VHDR'][0]; - - $thisfile_riff_RIFFsubtype_VHDR_0['oneShotHiSamples'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 0, 4)); - $thisfile_riff_RIFFsubtype_VHDR_0['repeatHiSamples'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 4, 4)); - $thisfile_riff_RIFFsubtype_VHDR_0['samplesPerHiCycle'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 8, 4)); - $thisfile_riff_RIFFsubtype_VHDR_0['samplesPerSec'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 12, 2)); - $thisfile_riff_RIFFsubtype_VHDR_0['ctOctave'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 14, 1)); - $thisfile_riff_RIFFsubtype_VHDR_0['sCompression'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 15, 1)); - $thisfile_riff_RIFFsubtype_VHDR_0['Volume'] = getid3_lib::FixedPoint16_16(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 16, 4)); - - $thisfile_audio['sample_rate'] = $thisfile_riff_RIFFsubtype_VHDR_0['samplesPerSec']; - - switch ($thisfile_riff_RIFFsubtype_VHDR_0['sCompression']) { - case 0: - $thisfile_audio['codec'] = 'Pulse Code Modulation (PCM)'; - $thisfile_audio['lossless'] = true; - $ActualBitsPerSample = 8; - break; - - case 1: - $thisfile_audio['codec'] = 'Fibonacci-delta encoding'; - $thisfile_audio['lossless'] = false; - $ActualBitsPerSample = 4; - break; - - default: - $ThisFileInfo['warning'][] = 'Unexpected sCompression value in 8SVX.VHDR chunk - expecting 0 or 1, found "'.sCompression.'"'; - break; - } - } - - if (isset($thisfile_riff[$RIFFsubtype]['CHAN'][0]['data'])) { - $ChannelsIndex = getid3_lib::BigEndian2Int(substr($thisfile_riff[$RIFFsubtype]['CHAN'][0]['data'], 0, 4)); - switch ($ChannelsIndex) { - case 6: // Stereo - $thisfile_audio['channels'] = 2; - break; - - case 2: // Left channel only - case 4: // Right channel only - $thisfile_audio['channels'] = 1; - break; - - default: - $ThisFileInfo['warning'][] = 'Unexpected value in 8SVX.CHAN chunk - expecting 2 or 4 or 6, found "'.$ChannelsIndex.'"'; - break; - } - - } - - $CommentsChunkNames = array('NAME'=>'title', 'author'=>'artist', '(c) '=>'copyright', 'ANNO'=>'comment'); - foreach ($CommentsChunkNames as $key => $value) { - if (isset($thisfile_riff[$RIFFsubtype][$key][0]['data'])) { - $thisfile_riff['comments'][$value][] = $thisfile_riff[$RIFFsubtype][$key][0]['data']; - } - } - - $thisfile_audio['bitrate'] = $thisfile_audio['sample_rate'] * $ActualBitsPerSample * $thisfile_audio['channels']; - if (!empty($thisfile_audio['bitrate'])) { - $ThisFileInfo['playtime_seconds'] = ($thisfile_avdataend - $thisfile_avdataoffset) / ($thisfile_audio['bitrate'] / 8); - } - break; - - - case 'CDXA': - $ThisFileInfo['mime_type'] = 'video/mpeg'; - if (!empty($thisfile_riff['CDXA']['data'][0]['size'])) { - $GETID3_ERRORARRAY = &$ThisFileInfo['warning']; - if (getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio-video.mpeg.php', __FILE__, false)) { - $dummy = $ThisFileInfo; - $dummy['error'] = array(); - $mpeg_scanner = new getid3_mpeg($fd, $dummy); - if (empty($dummy['error'])) { - $ThisFileInfo['audio'] = $dummy['audio']; - $ThisFileInfo['video'] = $dummy['video']; - $ThisFileInfo['mpeg'] = $dummy['mpeg']; - $ThisFileInfo['warning'] = $dummy['warning']; - } - unset($mpeg_scanner); - } - } - break; - - - default: - $ThisFileInfo['error'][] = 'Unknown RIFF type: expecting one of (WAVE|RMP3|AVI |CDDA|AIFF|AIFC|8SVX|CDXA), found "'.$RIFFsubtype.'" instead'; - unset($ThisFileInfo['fileformat']); - break; - } - - if (@$thisfile_riff_raw['fmt ']['wFormatTag'] == 1) { - // http://www.mega-nerd.com/erikd/Blog/Windiots/dts.html - fseek($fd, $ThisFileInfo['avdataoffset'], SEEK_SET); - $FirstFourBytes = fread($fd, 4); - if (preg_match('/^\xFF\x1F\x00\xE8/s', $FirstFourBytes)) { - // DTSWAV - $thisfile_audio_dataformat = 'dts'; - } elseif (preg_match('/^\x7F\xFF\x80\x01/s', $FirstFourBytes)) { - // DTS, but this probably shouldn't happen - $thisfile_audio_dataformat = 'dts'; - } - } - - - if (isset($thisfile_riff_WAVE['DISP']) && is_array($thisfile_riff_WAVE['DISP'])) { - $thisfile_riff['comments']['title'][] = trim(substr($thisfile_riff_WAVE['DISP'][count($thisfile_riff_WAVE['DISP']) - 1]['data'], 4)); - } - if (isset($thisfile_riff_WAVE['INFO']) && is_array($thisfile_riff_WAVE['INFO'])) { - $this->RIFFcommentsParse($thisfile_riff_WAVE['INFO'], $thisfile_riff['comments']); - } - - if (empty($thisfile_audio['encoder']) && !empty($ThisFileInfo['mpeg']['audio']['LAME']['short_version'])) { - $thisfile_audio['encoder'] = $ThisFileInfo['mpeg']['audio']['LAME']['short_version']; - } - - if (!isset($ThisFileInfo['playtime_seconds'])) { - $ThisFileInfo['playtime_seconds'] = 0; - } - if (isset($thisfile_riff_raw['avih']['dwTotalFrames']) && isset($thisfile_riff_raw['avih']['dwMicroSecPerFrame'])) { - $ThisFileInfo['playtime_seconds'] = $thisfile_riff_raw['avih']['dwTotalFrames'] * ($thisfile_riff_raw['avih']['dwMicroSecPerFrame'] / 1000000); - } - - if ($ThisFileInfo['playtime_seconds'] > 0) { - if (isset($thisfile_riff_audio) && isset($thisfile_riff_video)) { - - if (!isset($ThisFileInfo['bitrate'])) { - $ThisFileInfo['bitrate'] = ((($thisfile_avdataend - $thisfile_avdataoffset) / $ThisFileInfo['playtime_seconds']) * 8); - } - - } elseif (isset($thisfile_riff_audio) && !isset($thisfile_riff_video)) { - - if (!isset($thisfile_audio['bitrate'])) { - $thisfile_audio['bitrate'] = ((($thisfile_avdataend - $thisfile_avdataoffset) / $ThisFileInfo['playtime_seconds']) * 8); - } - - } elseif (!isset($thisfile_riff_audio) && isset($thisfile_riff_video)) { - - if (!isset($thisfile_video['bitrate'])) { - $thisfile_video['bitrate'] = ((($thisfile_avdataend - $thisfile_avdataoffset) / $ThisFileInfo['playtime_seconds']) * 8); - } - - } - } - - - if (isset($thisfile_riff_video) && isset($thisfile_audio['bitrate']) && ($thisfile_audio['bitrate'] > 0) && ($ThisFileInfo['playtime_seconds'] > 0)) { - - $ThisFileInfo['bitrate'] = ((($thisfile_avdataend - $thisfile_avdataoffset) / $ThisFileInfo['playtime_seconds']) * 8); - $thisfile_audio['bitrate'] = 0; - $thisfile_video['bitrate'] = $ThisFileInfo['bitrate']; - foreach ($thisfile_riff_audio as $channelnumber => $audioinfoarray) { - $thisfile_video['bitrate'] -= $audioinfoarray['bitrate']; - $thisfile_audio['bitrate'] += $audioinfoarray['bitrate']; - } - if ($thisfile_video['bitrate'] <= 0) { - unset($thisfile_video['bitrate']); - } - if ($thisfile_audio['bitrate'] <= 0) { - unset($thisfile_audio['bitrate']); - } - } - - if (isset($ThisFileInfo['mpeg']['audio'])) { - $thisfile_audio_dataformat = 'mp'.$ThisFileInfo['mpeg']['audio']['layer']; - $thisfile_audio['sample_rate'] = $ThisFileInfo['mpeg']['audio']['sample_rate']; - $thisfile_audio['channels'] = $ThisFileInfo['mpeg']['audio']['channels']; - $thisfile_audio['bitrate'] = $ThisFileInfo['mpeg']['audio']['bitrate']; - $thisfile_audio['bitrate_mode'] = strtolower($ThisFileInfo['mpeg']['audio']['bitrate_mode']); - if (!empty($ThisFileInfo['mpeg']['audio']['codec'])) { - $thisfile_audio['codec'] = $ThisFileInfo['mpeg']['audio']['codec'].' '.$thisfile_audio['codec']; - } - if (!empty($thisfile_audio['streams'])) { - foreach ($thisfile_audio['streams'] as $streamnumber => $streamdata) { - if ($streamdata['dataformat'] == $thisfile_audio_dataformat) { - $thisfile_audio['streams'][$streamnumber]['sample_rate'] = $thisfile_audio['sample_rate']; - $thisfile_audio['streams'][$streamnumber]['channels'] = $thisfile_audio['channels']; - $thisfile_audio['streams'][$streamnumber]['bitrate'] = $thisfile_audio['bitrate']; - $thisfile_audio['streams'][$streamnumber]['bitrate_mode'] = $thisfile_audio['bitrate_mode']; - $thisfile_audio['streams'][$streamnumber]['codec'] = $thisfile_audio['codec']; - } - } - } - $thisfile_audio['encoder_options'] = getid3_mp3::GuessEncoderOptions($ThisFileInfo); - } - - - if (!empty($thisfile_riff_raw['fmt ']['wBitsPerSample']) && ($thisfile_riff_raw['fmt ']['wBitsPerSample'] > 0)) { - switch ($thisfile_audio_dataformat) { - case 'ac3': - // ignore bits_per_sample - break; - - default: - $thisfile_audio['bits_per_sample'] = $thisfile_riff_raw['fmt ']['wBitsPerSample']; - break; - } - } - - - if (empty($thisfile_riff_raw)) { - unset($thisfile_riff['raw']); - } - if (empty($thisfile_riff_audio)) { - unset($thisfile_riff['audio']); - } - if (empty($thisfile_riff_video)) { - unset($thisfile_riff['video']); - } - - return true; - } - - - function RIFFcommentsParse(&$RIFFinfoArray, &$CommentsTargetArray) { - $RIFFinfoKeyLookup = array( - 'IARL'=>'archivallocation', - 'IART'=>'artist', - 'ICDS'=>'costumedesigner', - 'ICMS'=>'commissionedby', - 'ICMT'=>'comment', - 'ICNT'=>'country', - 'ICOP'=>'copyright', - 'ICRD'=>'creationdate', - 'IDIM'=>'dimensions', - 'IDIT'=>'digitizationdate', - 'IDPI'=>'resolution', - 'IDST'=>'distributor', - 'IEDT'=>'editor', - 'IENG'=>'engineers', - 'IFRM'=>'accountofparts', - 'IGNR'=>'genre', - 'IKEY'=>'keywords', - 'ILGT'=>'lightness', - 'ILNG'=>'language', - 'IMED'=>'orignalmedium', - 'IMUS'=>'composer', - 'INAM'=>'title', - 'IPDS'=>'productiondesigner', - 'IPLT'=>'palette', - 'IPRD'=>'product', - 'IPRO'=>'producer', - 'IPRT'=>'part', - 'IRTD'=>'rating', - 'ISBJ'=>'subject', - 'ISFT'=>'software', - 'ISGN'=>'secondarygenre', - 'ISHP'=>'sharpness', - 'ISRC'=>'sourcesupplier', - 'ISRF'=>'digitizationsource', - 'ISTD'=>'productionstudio', - 'ISTR'=>'starring', - 'ITCH'=>'encoded_by', - 'IWEB'=>'url', - 'IWRI'=>'writer' - ); - foreach ($RIFFinfoKeyLookup as $key => $value) { - if (isset($RIFFinfoArray[$key])) { - foreach ($RIFFinfoArray[$key] as $commentid => $commentdata) { - if (trim($commentdata['data']) != '') { - @$CommentsTargetArray[$value][] = trim($commentdata['data']); - } - } - } - } - return true; - } - - function ParseRIFF(&$fd, $startoffset, $maxoffset, &$ThisFileInfo) { - $maxoffset = min($maxoffset, $ThisFileInfo['avdataend']); - - $RIFFchunk = false; - $FoundAllChunksWeNeed = false; - - if (($startoffset < 0) || ($startoffset >= pow(2, 31))) { - $ThisFileInfo['warning'][] = 'Unable to ParseRIFF() at '.$startoffset.' because beyond 2GB limit of PHP filesystem functions'; - return false; - } - fseek($fd, $startoffset, SEEK_SET); - - while (ftell($fd) < $maxoffset) { - $chunkname = fread($fd, 4); - if (strlen($chunkname) < 4) { - $ThisFileInfo['error'][] = 'Expecting chunk name at offset '.(ftell($fd) - 4).' but found nothing. Aborting RIFF parsing.'; - break; - } - - $chunksize = getid3_riff::EitherEndian2Int($ThisFileInfo, fread($fd, 4)); - if ($chunksize == 0) { - $ThisFileInfo['warning'][] = 'Chunk size at offset '.(ftell($fd) - 4).' is zero. Aborting RIFF parsing.'; - continue; - } - if (($chunksize % 2) != 0) { - // all structures are packed on word boundaries - $chunksize++; - } - - switch ($chunkname) { - case 'LIST': - $listname = fread($fd, 4); - if (eregi('^(movi|rec )$', $listname)) { - $RIFFchunk[$listname]['offset'] = ftell($fd) - 4; - $RIFFchunk[$listname]['size'] = $chunksize; - - if ($FoundAllChunksWeNeed) { - - // skip over - - } else { - - $WhereWeWere = ftell($fd); - $AudioChunkHeader = fread($fd, 12); - $AudioChunkStreamNum = substr($AudioChunkHeader, 0, 2); - $AudioChunkStreamType = substr($AudioChunkHeader, 2, 2); - $AudioChunkSize = getid3_lib::LittleEndian2Int(substr($AudioChunkHeader, 4, 4)); - - if ($AudioChunkStreamType == 'wb') { - $FirstFourBytes = substr($AudioChunkHeader, 8, 4); - if (preg_match('/^\xFF[\xE2-\xE7\xF2-\xF7\xFA-\xFF][\x00-\xEB]/s', $FirstFourBytes)) { - // MP3 - if (getid3_mp3::MPEGaudioHeaderBytesValid($FirstFourBytes)) { - $dummy = $ThisFileInfo; - $dummy['avdataoffset'] = ftell($fd) - 4; - $dummy['avdataend'] = ftell($fd) + $AudioChunkSize; - getid3_mp3::getOnlyMPEGaudioInfo($fd, $dummy, $dummy['avdataoffset'], false); - if (isset($dummy['mpeg']['audio'])) { - $ThisFileInfo = $dummy; - $ThisFileInfo['audio']['dataformat'] = 'mp'.$ThisFileInfo['mpeg']['audio']['layer']; - $ThisFileInfo['audio']['sample_rate'] = $ThisFileInfo['mpeg']['audio']['sample_rate']; - $ThisFileInfo['audio']['channels'] = $ThisFileInfo['mpeg']['audio']['channels']; - $ThisFileInfo['audio']['bitrate'] = $ThisFileInfo['mpeg']['audio']['bitrate']; - $ThisFileInfo['bitrate'] = $ThisFileInfo['audio']['bitrate']; - $ThisFileInfo['audio']['bitrate_mode'] = strtolower($ThisFileInfo['mpeg']['audio']['bitrate_mode']); - } - unset($dummy); - } - - } elseif (preg_match('/^\x0B\x77/s', $FirstFourBytes)) { - - // AC3 - $GETID3_ERRORARRAY = &$ThisFileInfo['warning']; - if (getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio.ac3.php', __FILE__, false)) { - - $dummy = $ThisFileInfo; - $dummy['avdataoffset'] = ftell($fd) - 4; - $dummy['avdataend'] = ftell($fd) + $AudioChunkSize; - $dummy['error'] = array(); - $ac3_tag = new getid3_ac3($fd, $dummy); - if (empty($dummy['error'])) { - $ThisFileInfo['audio'] = $dummy['audio']; - $ThisFileInfo['ac3'] = $dummy['ac3']; - $ThisFileInfo['warning'] = $dummy['warning']; - } - unset($ac3_tag); - - } - - } - - } - - $FoundAllChunksWeNeed = true; - fseek($fd, $WhereWeWere, SEEK_SET); - - } - fseek($fd, $chunksize - 4, SEEK_CUR); - - //} elseif (ereg('^[0-9]{2}(wb|pc|dc|db)$', $listname)) { - // - // // data chunk, ignore - // - } else { - - if (!isset($RIFFchunk[$listname])) { - $RIFFchunk[$listname] = array(); - } - $LISTchunkParent = $listname; - $LISTchunkMaxOffset = ftell($fd) - 4 + $chunksize; - if ($parsedChunk = getid3_riff::ParseRIFF($fd, ftell($fd), ftell($fd) + $chunksize - 4, $ThisFileInfo)) { - $RIFFchunk[$listname] = array_merge_recursive($RIFFchunk[$listname], $parsedChunk); - } - - } - break; - - default: - if (eregi('^[0-9]{2}(wb|pc|dc|db)$', $chunkname)) { - $nextoffset = ftell($fd) + $chunksize; - if (($nextoffset < 0) || ($nextoffset >= pow(2, 31))) { - $ThisFileInfo['warning'][] = 'Unable to parse chunk at offset '.$nextoffset.' because beyond 2GB limit of PHP filesystem functions'; - break 2; - } - fseek($fd, $nextoffset, SEEK_SET); - break; - } - $thisindex = 0; - if (isset($RIFFchunk[$chunkname]) && is_array($RIFFchunk[$chunkname])) { - $thisindex = count($RIFFchunk[$chunkname]); - } - $RIFFchunk[$chunkname][$thisindex]['offset'] = ftell($fd) - 8; - $RIFFchunk[$chunkname][$thisindex]['size'] = $chunksize; - switch ($chunkname) { - case 'data': - $ThisFileInfo['avdataoffset'] = ftell($fd); - $ThisFileInfo['avdataend'] = $ThisFileInfo['avdataoffset'] + $chunksize; - - $RIFFdataChunkContentsTest = fread($fd, 36); - - if ((strlen($RIFFdataChunkContentsTest) > 0) && preg_match('/^\xFF[\xE2-\xE7\xF2-\xF7\xFA-\xFF][\x00-\xEB]/s', substr($RIFFdataChunkContentsTest, 0, 4))) { - - // Probably is MP3 data - if (getid3_mp3::MPEGaudioHeaderBytesValid(substr($RIFFdataChunkContentsTest, 0, 4))) { - - // copy info array - $dummy = $ThisFileInfo; - - getid3_mp3::getOnlyMPEGaudioInfo($fd, $dummy, $RIFFchunk[$chunkname][$thisindex]['offset'], false); - - // use dummy array unless error - if (empty($dummy['error'])) { - $ThisFileInfo = $dummy; - } - } - - } elseif ((strlen($RIFFdataChunkContentsTest) > 0) && (substr($RIFFdataChunkContentsTest, 0, 2) == "\x0B\x77")) { - - // This is probably AC-3 data - $GETID3_ERRORARRAY = &$ThisFileInfo['warning']; - if (getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio.ac3.php', __FILE__, false)) { - - $dummy = $ThisFileInfo; - $dummy['avdataoffset'] = $RIFFchunk[$chunkname][$thisindex]['offset']; - $dummy['avdataend'] = $dummy['avdataoffset'] + $RIFFchunk[$chunkname][$thisindex]['size']; - $dummy['error'] = array(); - - $ac3_tag = new getid3_ac3($fd, $dummy); - if (empty($dummy['error'])) { - $ThisFileInfo['audio'] = $dummy['audio']; - $ThisFileInfo['ac3'] = $dummy['ac3']; - $ThisFileInfo['warning'] = $dummy['warning']; - } - unset($ac3_tag); - - } - - } elseif ((strlen($RIFFdataChunkContentsTest) > 0) && (substr($RIFFdataChunkContentsTest, 8, 2) == "\x77\x0B")) { - - // Dolby Digital WAV - // AC-3 content, but not encoded in same format as normal AC-3 file - // For one thing, byte order is swapped - - $GETID3_ERRORARRAY = &$ThisFileInfo['warning']; - if (getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio.ac3.php', __FILE__, false)) { - - // ok to use tmpfile here - only 56 bytes - if ($fd_temp = tmpfile()) { - - for ($i = 0; $i < 28; $i += 2) { - // swap byte order - fwrite($fd_temp, substr($RIFFdataChunkContentsTest, 8 + $i + 1, 1)); - fwrite($fd_temp, substr($RIFFdataChunkContentsTest, 8 + $i + 0, 1)); - } - - $dummy = $ThisFileInfo; - $dummy['avdataoffset'] = 0; - $dummy['avdataend'] = 20; - $dummy['error'] = array(); - $ac3_tag = new getid3_ac3($fd_temp, $dummy); - fclose($fd_temp); - if (empty($dummy['error'])) { - $ThisFileInfo['audio'] = $dummy['audio']; - $ThisFileInfo['ac3'] = $dummy['ac3']; - $ThisFileInfo['warning'] = $dummy['warning']; - } else { - $ThisFileInfo['error'][] = 'Errors parsing DolbyDigital WAV: '.explode(';', $dummy['error']); - } - unset($ac3_tag); - - } else { - - $ThisFileInfo['error'][] = 'Could not create temporary file to analyze DolbyDigital WAV'; - - } - - } - - } elseif ((strlen($RIFFdataChunkContentsTest) > 0) && (substr($RIFFdataChunkContentsTest, 0, 4) == 'wvpk')) { - - // This is WavPack data - $ThisFileInfo['wavpack']['offset'] = $RIFFchunk[$chunkname][$thisindex]['offset']; - $ThisFileInfo['wavpack']['size'] = getid3_lib::LittleEndian2Int(substr($RIFFdataChunkContentsTest, 4, 4)); - getid3_riff::RIFFparseWavPackHeader(substr($RIFFdataChunkContentsTest, 8, 28), $ThisFileInfo); - - } else { - - // This is some other kind of data (quite possibly just PCM) - // do nothing special, just skip it - - } - $nextoffset = $RIFFchunk[$chunkname][$thisindex]['offset'] + 8 + $chunksize; - if (($nextoffset < 0) || ($nextoffset >= pow(2, 31))) { - $ThisFileInfo['warning'][] = 'Unable to parse chunk at offset '.$nextoffset.' because beyond 2GB limit of PHP filesystem functions'; - break 3; - } - fseek($fd, $RIFFchunk[$chunkname][$thisindex]['offset'] + 8 + $chunksize, SEEK_SET); - break; - - case 'bext': - case 'cart': - case 'fmt ': - case 'strh': - case 'strf': - case 'indx': - case 'MEXT': - case 'DISP': - // always read data in - $RIFFchunk[$chunkname][$thisindex]['data'] = fread($fd, $chunksize); - break; - - default: - if (!ereg('^[0-9]{2}(wb|pc|dc|db)$', $chunkname) && !empty($LISTchunkParent) && (($RIFFchunk[$chunkname][$thisindex]['offset'] + $RIFFchunk[$chunkname][$thisindex]['size']) <= $LISTchunkMaxOffset)) { - $RIFFchunk[$LISTchunkParent][$chunkname][$thisindex]['offset'] = $RIFFchunk[$chunkname][$thisindex]['offset']; - $RIFFchunk[$LISTchunkParent][$chunkname][$thisindex]['size'] = $RIFFchunk[$chunkname][$thisindex]['size']; - unset($RIFFchunk[$chunkname][$thisindex]['offset']); - unset($RIFFchunk[$chunkname][$thisindex]['size']); - if (isset($RIFFchunk[$chunkname][$thisindex]) && empty($RIFFchunk[$chunkname][$thisindex])) { - unset($RIFFchunk[$chunkname][$thisindex]); - } - if (isset($RIFFchunk[$chunkname]) && empty($RIFFchunk[$chunkname])) { - unset($RIFFchunk[$chunkname]); - } - $RIFFchunk[$LISTchunkParent][$chunkname][$thisindex]['data'] = fread($fd, $chunksize); - } elseif ($chunksize < 2048) { - // only read data in if smaller than 2kB - $RIFFchunk[$chunkname][$thisindex]['data'] = fread($fd, $chunksize); - } else { - $nextoffset = ftell($fd) + $chunksize; - if (($nextoffset < 0) || ($nextoffset >= pow(2, 31))) { - $ThisFileInfo['warning'][] = 'Unable to parse chunk at offset '.$nextoffset.' because beyond 2GB limit of PHP filesystem functions'; - break 3; - } - fseek($fd, $nextoffset, SEEK_SET); - } - break; - } - break; - - } - - } - - return $RIFFchunk; - } - - - function ParseRIFFdata(&$RIFFdata, &$ThisFileInfo) { - if ($RIFFdata) { - - $tempfile = tempnam('*', 'getID3'); - $fp_temp = fopen($tempfile, "wb"); - $RIFFdataLength = strlen($RIFFdata); - $NewLengthString = getid3_lib::LittleEndian2String($RIFFdataLength, 4); - for ($i = 0; $i < 4; $i++) { - $RIFFdata{$i + 4} = $NewLengthString{$i}; - } - fwrite($fp_temp, $RIFFdata); - fclose($fp_temp); - - $fp_temp = fopen($tempfile, "rb"); - $dummy = array('filesize'=>$RIFFdataLength, 'filenamepath'=>$ThisFileInfo['filenamepath'], 'tags'=>$ThisFileInfo['tags'], 'avdataoffset'=>0, 'avdataend'=>$RIFFdataLength, 'warning'=>$ThisFileInfo['warning'], 'error'=>$ThisFileInfo['error'], 'comments'=>$ThisFileInfo['comments'], 'audio'=>(isset($ThisFileInfo['audio']) ? $ThisFileInfo['audio'] : array()), 'video'=>(isset($ThisFileInfo['video']) ? $ThisFileInfo['video'] : array())); - $riff = new getid3_riff($fp_temp, $dummy); - $ThisFileInfo['riff'] = $dummy['riff']; - $ThisFileInfo['warning'] = $dummy['warning']; - $ThisFileInfo['error'] = $dummy['error']; - $ThisFileInfo['tags'] = $dummy['tags']; - $ThisFileInfo['comments'] = $dummy['comments']; - unset($riff); - fclose($fp_temp); - unlink($tempfile); - return true; - } - return false; - } - - - function RIFFparseWAVEFORMATex($WaveFormatExData) { - // shortcut - $WaveFormatEx['raw'] = array(); - $WaveFormatEx_raw = &$WaveFormatEx['raw']; - - $WaveFormatEx_raw['wFormatTag'] = getid3_lib::LittleEndian2Int(substr($WaveFormatExData, 0, 2)); - $WaveFormatEx_raw['nChannels'] = getid3_lib::LittleEndian2Int(substr($WaveFormatExData, 2, 2)); - $WaveFormatEx_raw['nSamplesPerSec'] = getid3_lib::LittleEndian2Int(substr($WaveFormatExData, 4, 4)); - $WaveFormatEx_raw['nAvgBytesPerSec'] = getid3_lib::LittleEndian2Int(substr($WaveFormatExData, 8, 4)); - $WaveFormatEx_raw['nBlockAlign'] = getid3_lib::LittleEndian2Int(substr($WaveFormatExData, 12, 2)); - $WaveFormatEx_raw['wBitsPerSample'] = getid3_lib::LittleEndian2Int(substr($WaveFormatExData, 14, 2)); - if (strlen($WaveFormatExData) > 16) { - $WaveFormatEx_raw['cbSize'] = getid3_lib::LittleEndian2Int(substr($WaveFormatExData, 16, 2)); - } - - $WaveFormatEx['codec'] = getid3_riff::RIFFwFormatTagLookup($WaveFormatEx_raw['wFormatTag']); - $WaveFormatEx['channels'] = $WaveFormatEx_raw['nChannels']; - $WaveFormatEx['sample_rate'] = $WaveFormatEx_raw['nSamplesPerSec']; - $WaveFormatEx['bitrate'] = $WaveFormatEx_raw['nAvgBytesPerSec'] * 8; - $WaveFormatEx['bits_per_sample'] = $WaveFormatEx_raw['wBitsPerSample']; - - return $WaveFormatEx; - } - - - function RIFFparseWavPackHeader($WavPackChunkData, &$ThisFileInfo) { - // typedef struct { - // char ckID [4]; - // long ckSize; - // short version; - // short bits; // added for version 2.00 - // short flags, shift; // added for version 3.00 - // long total_samples, crc, crc2; - // char extension [4], extra_bc, extras [3]; - // } WavpackHeader; - - // shortcut - $ThisFileInfo['wavpack'] = array(); - $thisfile_wavpack = &$ThisFileInfo['wavpack']; - - $thisfile_wavpack['version'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 0, 2)); - if ($thisfile_wavpack['version'] >= 2) { - $thisfile_wavpack['bits'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 2, 2)); - } - if ($thisfile_wavpack['version'] >= 3) { - $thisfile_wavpack['flags_raw'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 4, 2)); - $thisfile_wavpack['shift'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 6, 2)); - $thisfile_wavpack['total_samples'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 8, 4)); - $thisfile_wavpack['crc1'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 12, 4)); - $thisfile_wavpack['crc2'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 16, 4)); - $thisfile_wavpack['extension'] = substr($WavPackChunkData, 20, 4); - $thisfile_wavpack['extra_bc'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 24, 1)); - for ($i = 0; $i <= 2; $i++) { - $thisfile_wavpack['extras'][] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 25 + $i, 1)); - } - - // shortcut - $thisfile_wavpack['flags'] = array(); - $thisfile_wavpack_flags = &$thisfile_wavpack['flags']; - - $thisfile_wavpack_flags['mono'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x000001); - $thisfile_wavpack_flags['fast_mode'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x000002); - $thisfile_wavpack_flags['raw_mode'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x000004); - $thisfile_wavpack_flags['calc_noise'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x000008); - $thisfile_wavpack_flags['high_quality'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x000010); - $thisfile_wavpack_flags['3_byte_samples'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x000020); - $thisfile_wavpack_flags['over_20_bits'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x000040); - $thisfile_wavpack_flags['use_wvc'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x000080); - $thisfile_wavpack_flags['noiseshaping'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x000100); - $thisfile_wavpack_flags['very_fast_mode'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x000200); - $thisfile_wavpack_flags['new_high_quality'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x000400); - $thisfile_wavpack_flags['cancel_extreme'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x000800); - $thisfile_wavpack_flags['cross_decorrelation'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x001000); - $thisfile_wavpack_flags['new_decorrelation'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x002000); - $thisfile_wavpack_flags['joint_stereo'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x004000); - $thisfile_wavpack_flags['extra_decorrelation'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x008000); - $thisfile_wavpack_flags['override_noiseshape'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x010000); - $thisfile_wavpack_flags['override_jointstereo'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x020000); - $thisfile_wavpack_flags['copy_source_filetime'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x040000); - $thisfile_wavpack_flags['create_exe'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x080000); - } - - return true; - } - - function ParseBITMAPINFOHEADER($BITMAPINFOHEADER, $littleEndian=true) { - // yes it's ugly to instantiate a getid3_lib object here, suggested alternative please? - $getid3_lib = new getid3_lib(); - $functionname = ($littleEndian ? 'LittleEndian2Int' : 'BigEndian2Int'); - $parsed['biSize'] = $getid3_lib->$functionname(substr($BITMAPINFOHEADER, 0, 4)); // number of bytes required by the BITMAPINFOHEADER structure - $parsed['biWidth'] = $getid3_lib->$functionname(substr($BITMAPINFOHEADER, 4, 4)); // width of the bitmap in pixels - $parsed['biHeight'] = $getid3_lib->$functionname(substr($BITMAPINFOHEADER, 8, 4)); // height of the bitmap in pixels. If biHeight is positive, the bitmap is a 'bottom-up' DIB and its origin is the lower left corner. If biHeight is negative, the bitmap is a 'top-down' DIB and its origin is the upper left corner - $parsed['biPlanes'] = $getid3_lib->$functionname(substr($BITMAPINFOHEADER, 12, 2)); // number of color planes on the target device. In most cases this value must be set to 1 - $parsed['biBitCount'] = $getid3_lib->$functionname(substr($BITMAPINFOHEADER, 14, 2)); // Specifies the number of bits per pixels - $parsed['fourcc'] = substr($BITMAPINFOHEADER, 16, 4); // compression identifier - $parsed['biSizeImage'] = $getid3_lib->$functionname(substr($BITMAPINFOHEADER, 20, 4)); // size of the bitmap data section of the image (the actual pixel data, excluding BITMAPINFOHEADER and RGBQUAD structures) - $parsed['biXPelsPerMeter'] = $getid3_lib->$functionname(substr($BITMAPINFOHEADER, 24, 4)); // horizontal resolution, in pixels per metre, of the target device - $parsed['biYPelsPerMeter'] = $getid3_lib->$functionname(substr($BITMAPINFOHEADER, 28, 4)); // vertical resolution, in pixels per metre, of the target device - $parsed['biClrUsed'] = $getid3_lib->$functionname(substr($BITMAPINFOHEADER, 32, 4)); // actual number of color indices in the color table used by the bitmap. If this value is zero, the bitmap uses the maximum number of colors corresponding to the value of the biBitCount member for the compression mode specified by biCompression - $parsed['biClrImportant'] = $getid3_lib->$functionname(substr($BITMAPINFOHEADER, 36, 4)); // number of color indices that are considered important for displaying the bitmap. If this value is zero, all colors are important
- return $parsed; - }
- - function RIFFwFormatTagLookup($wFormatTag) { - - $begin = __LINE__; - - /** This is not a comment! - - 0x0000 Microsoft Unknown Wave Format - 0x0001 Pulse Code Modulation (PCM) - 0x0002 Microsoft ADPCM - 0x0003 IEEE Float - 0x0004 Compaq Computer VSELP - 0x0005 IBM CVSD - 0x0006 Microsoft A-Law - 0x0007 Microsoft mu-Law - 0x0008 Microsoft DTS - 0x0010 OKI ADPCM - 0x0011 Intel DVI/IMA ADPCM - 0x0012 Videologic MediaSpace ADPCM - 0x0013 Sierra Semiconductor ADPCM - 0x0014 Antex Electronics G.723 ADPCM - 0x0015 DSP Solutions DigiSTD - 0x0016 DSP Solutions DigiFIX - 0x0017 Dialogic OKI ADPCM - 0x0018 MediaVision ADPCM - 0x0019 Hewlett-Packard CU - 0x0020 Yamaha ADPCM - 0x0021 Speech Compression Sonarc - 0x0022 DSP Group TrueSpeech - 0x0023 Echo Speech EchoSC1 - 0x0024 Audiofile AF36 - 0x0025 Audio Processing Technology APTX - 0x0026 AudioFile AF10 - 0x0027 Prosody 1612 - 0x0028 LRC - 0x0030 Dolby AC2 - 0x0031 Microsoft GSM 6.10 - 0x0032 MSNAudio - 0x0033 Antex Electronics ADPCME - 0x0034 Control Resources VQLPC - 0x0035 DSP Solutions DigiREAL - 0x0036 DSP Solutions DigiADPCM - 0x0037 Control Resources CR10 - 0x0038 Natural MicroSystems VBXADPCM - 0x0039 Crystal Semiconductor IMA ADPCM - 0x003A EchoSC3 - 0x003B Rockwell ADPCM - 0x003C Rockwell Digit LK - 0x003D Xebec - 0x0040 Antex Electronics G.721 ADPCM - 0x0041 G.728 CELP - 0x0042 MSG723 - 0x0050 MPEG Layer-2 or Layer-1 - 0x0052 RT24 - 0x0053 PAC - 0x0055 MPEG Layer-3 - 0x0059 Lucent G.723 - 0x0060 Cirrus - 0x0061 ESPCM - 0x0062 Voxware - 0x0063 Canopus Atrac - 0x0064 G.726 ADPCM - 0x0065 G.722 ADPCM - 0x0066 DSAT - 0x0067 DSAT Display - 0x0069 Voxware Byte Aligned - 0x0070 Voxware AC8 - 0x0071 Voxware AC10 - 0x0072 Voxware AC16 - 0x0073 Voxware AC20 - 0x0074 Voxware MetaVoice - 0x0075 Voxware MetaSound - 0x0076 Voxware RT29HW - 0x0077 Voxware VR12 - 0x0078 Voxware VR18 - 0x0079 Voxware TQ40 - 0x0080 Softsound - 0x0081 Voxware TQ60 - 0x0082 MSRT24 - 0x0083 G.729A - 0x0084 MVI MV12 - 0x0085 DF G.726 - 0x0086 DF GSM610 - 0x0088 ISIAudio - 0x0089 Onlive - 0x0091 SBC24 - 0x0092 Dolby AC3 SPDIF - 0x0093 MediaSonic G.723 - 0x0094 Aculab PLC Prosody 8kbps - 0x0097 ZyXEL ADPCM - 0x0098 Philips LPCBB - 0x0099 Packed - 0x00FF AAC - 0x0100 Rhetorex ADPCM - 0x0101 IBM mu-law - 0x0102 IBM A-law - 0x0103 IBM AVC Adaptive Differential Pulse Code Modulation (ADPCM) - 0x0111 Vivo G.723 - 0x0112 Vivo Siren - 0x0123 Digital G.723 - 0x0125 Sanyo LD ADPCM - 0x0130 Sipro Lab Telecom ACELP NET - 0x0131 Sipro Lab Telecom ACELP 4800 - 0x0132 Sipro Lab Telecom ACELP 8V3 - 0x0133 Sipro Lab Telecom G.729 - 0x0134 Sipro Lab Telecom G.729A - 0x0135 Sipro Lab Telecom Kelvin - 0x0140 Windows Media Video V8 - 0x0150 Qualcomm PureVoice - 0x0151 Qualcomm HalfRate - 0x0155 Ring Zero Systems TUB GSM - 0x0160 Microsoft Audio 1 - 0x0161 Windows Media Audio V7 / V8 / V9 - 0x0162 Windows Media Audio Professional V9 - 0x0163 Windows Media Audio Lossless V9 - 0x0200 Creative Labs ADPCM - 0x0202 Creative Labs Fastspeech8 - 0x0203 Creative Labs Fastspeech10 - 0x0210 UHER Informatic GmbH ADPCM - 0x0220 Quarterdeck - 0x0230 I-link Worldwide VC - 0x0240 Aureal RAW Sport - 0x0250 Interactive Products HSX - 0x0251 Interactive Products RPELP - 0x0260 Consistent Software CS2 - 0x0270 Sony SCX - 0x0300 Fujitsu FM Towns Snd - 0x0400 BTV Digital - 0x0401 Intel Music Coder - 0x0450 QDesign Music - 0x0680 VME VMPCM - 0x0681 AT&T Labs TPC - 0x08AE ClearJump LiteWave - 0x1000 Olivetti GSM - 0x1001 Olivetti ADPCM - 0x1002 Olivetti CELP - 0x1003 Olivetti SBC - 0x1004 Olivetti OPR - 0x1100 Lernout & Hauspie Codec (0x1100) - 0x1101 Lernout & Hauspie CELP Codec (0x1101) - 0x1102 Lernout & Hauspie SBC Codec (0x1102) - 0x1103 Lernout & Hauspie SBC Codec (0x1103) - 0x1104 Lernout & Hauspie SBC Codec (0x1104) - 0x1400 Norris - 0x1401 AT&T ISIAudio - 0x1500 Soundspace Music Compression - 0x181C VoxWare RT24 Speech - 0x1FC4 NCT Soft ALF2CD (www.nctsoft.com) - 0x2000 Dolby AC3 - 0x2001 Dolby DTS - 0x2002 WAVE_FORMAT_14_4 - 0x2003 WAVE_FORMAT_28_8 - 0x2004 WAVE_FORMAT_COOK - 0x2005 WAVE_FORMAT_DNET - 0x674F Ogg Vorbis 1 - 0x6750 Ogg Vorbis 2 - 0x6751 Ogg Vorbis 3 - 0x676F Ogg Vorbis 1+ - 0x6770 Ogg Vorbis 2+ - 0x6771 Ogg Vorbis 3+ - 0x7A21 GSM-AMR (CBR, no SID) - 0x7A22 GSM-AMR (VBR, including SID) - 0xFFFE WAVE_FORMAT_EXTENSIBLE - 0xFFFF WAVE_FORMAT_DEVELOPMENT - - */ - - return getid3_lib::EmbeddedLookup('0x'.str_pad(strtoupper(dechex($wFormatTag)), 4, '0', STR_PAD_LEFT), $begin, __LINE__, __FILE__, 'riff-wFormatTag'); - - } - - - function RIFFfourccLookup($fourcc) { - - $begin = __LINE__; - - /** This is not a comment! - - swot http://developer.apple.com/qa/snd/snd07.html - ____ No Codec (____) - _BIT BI_BITFIELDS (Raw RGB) - _JPG JPEG compressed - _PNG PNG compressed W3C/ISO/IEC (RFC-2083) - _RAW Full Frames (Uncompressed) - _RGB Raw RGB Bitmap - _RL4 RLE 4bpp RGB - _RL8 RLE 8bpp RGB - 3IV1 3ivx MPEG-4 v1 - 3IV2 3ivx MPEG-4 v2 - 3IVX 3ivx MPEG-4 - AASC Autodesk Animator - ABYR Kensington ?ABYR? - AEMI Array Microsystems VideoONE MPEG1-I Capture - AFLC Autodesk Animator FLC - AFLI Autodesk Animator FLI - AMPG Array Microsystems VideoONE MPEG - ANIM Intel RDX (ANIM) - AP41 AngelPotion Definitive - ASV1 Asus Video v1 - ASV2 Asus Video v2 - ASVX Asus Video 2.0 (audio) - AUR2 AuraVision Aura 2 Codec - YUV 4:2:2 - AURA AuraVision Aura 1 Codec - YUV 4:1:1 - AVDJ Independent JPEG Group\'s codec (AVDJ) - AVRN Independent JPEG Group\'s codec (AVRN) - AYUV 4:4:4 YUV (AYUV) - AZPR Quicktime Apple Video (AZPR) - BGR Raw RGB32 - BLZ0 Blizzard DivX MPEG-4 - BTVC Conexant Composite Video - BINK RAD Game Tools Bink Video - BT20 Conexant Prosumer Video - BTCV Conexant Composite Video Codec - BW10 Data Translation Broadway MPEG Capture - CC12 Intel YUV12 - CDVC Canopus DV - CFCC Digital Processing Systems DPS Perception - CGDI Microsoft Office 97 Camcorder Video - CHAM Winnov Caviara Champagne - CJPG Creative WebCam JPEG - CLJR Cirrus Logic YUV 4:1:1 - CMYK Common Data Format in Printing (Colorgraph) - CPLA Weitek 4:2:0 YUV Planar - CRAM Microsoft Video 1 (CRAM) - cvid Radius Cinepak - CVID Radius Cinepak - CWLT Microsoft Color WLT DIB - CYUV Creative Labs YUV - CYUY ATI YUV - D261 H.261 - D263 H.263 - DIB Device Independent Bitmap - DIV1 FFmpeg OpenDivX - DIV2 Microsoft MPEG-4 v1/v2 - DIV3 DivX ;-) MPEG-4 v3.x Low-Motion - DIV4 DivX ;-) MPEG-4 v3.x Fast-Motion - DIV5 DivX MPEG-4 v5.x - DIV6 DivX ;-) (MS MPEG-4 v3.x) - DIVX DivX MPEG-4 v4 (OpenDivX / Project Mayo) - divx DivX MPEG-4 - DMB1 Matrox Rainbow Runner hardware MJPEG - DMB2 Paradigm MJPEG - DSVD ?DSVD? - DUCK Duck TrueMotion 1.0 - DPS0 DPS/Leitch Reality Motion JPEG - DPSC DPS/Leitch PAR Motion JPEG - DV25 Matrox DVCPRO codec - DV50 Matrox DVCPRO50 codec - DVC IEC 61834 and SMPTE 314M (DVC/DV Video) - DVCP IEC 61834 and SMPTE 314M (DVC/DV Video) - DVHD IEC Standard DV 1125 lines @ 30fps / 1250 lines @ 25fps - DVMA Darim Vision DVMPEG (dummy for MPEG compressor) (www.darvision.com) - DVSL IEC Standard DV compressed in SD (SDL) - DVAN ?DVAN? - DVE2 InSoft DVE-2 Videoconferencing - dvsd IEC 61834 and SMPTE 314M DVC/DV Video - DVSD IEC 61834 and SMPTE 314M DVC/DV Video - DVX1 Lucent DVX1000SP Video Decoder - DVX2 Lucent DVX2000S Video Decoder - DVX3 Lucent DVX3000S Video Decoder - DX50 DivX v5 - DXT1 Microsoft DirectX Compressed Texture (DXT1) - DXT2 Microsoft DirectX Compressed Texture (DXT2) - DXT3 Microsoft DirectX Compressed Texture (DXT3) - DXT4 Microsoft DirectX Compressed Texture (DXT4) - DXT5 Microsoft DirectX Compressed Texture (DXT5) - DXTC Microsoft DirectX Compressed Texture (DXTC) - DXTn Microsoft DirectX Compressed Texture (DXTn) - EM2V Etymonix MPEG-2 I-frame (www.etymonix.com) - EKQ0 Elsa ?EKQ0? - ELK0 Elsa ?ELK0? - ESCP Eidos Escape - ETV1 eTreppid Video ETV1 - ETV2 eTreppid Video ETV2 - ETVC eTreppid Video ETVC - FLIC Autodesk FLI/FLC Animation - FRWT Darim Vision Forward Motion JPEG (www.darvision.com) - FRWU Darim Vision Forward Uncompressed (www.darvision.com) - FLJP D-Vision Field Encoded Motion JPEG - FRWA SoftLab-Nsk Forward Motion JPEG w/ alpha channel - FRWD SoftLab-Nsk Forward Motion JPEG - FVF1 Iterated Systems Fractal Video Frame - GLZW Motion LZW (gabest@freemail.hu) - GPEG Motion JPEG (gabest@freemail.hu) - GWLT Microsoft Greyscale WLT DIB - H260 Intel ITU H.260 Videoconferencing - H261 Intel ITU H.261 Videoconferencing - H262 Intel ITU H.262 Videoconferencing - H263 Intel ITU H.263 Videoconferencing - H264 Intel ITU H.264 Videoconferencing - H265 Intel ITU H.265 Videoconferencing - H266 Intel ITU H.266 Videoconferencing - H267 Intel ITU H.267 Videoconferencing - H268 Intel ITU H.268 Videoconferencing - H269 Intel ITU H.269 Videoconferencing - HFYU Huffman Lossless Codec - HMCR Rendition Motion Compensation Format (HMCR) - HMRR Rendition Motion Compensation Format (HMRR) - I263 FFmpeg I263 decoder - IF09 Indeo YVU9 ("YVU9 with additional delta-frame info after the U plane") - IUYV Interlaced version of UYVY (www.leadtools.com) - IY41 Interlaced version of Y41P (www.leadtools.com) - IYU1 12 bit format used in mode 2 of the IEEE 1394 Digital Camera 1.04 spec IEEE standard - IYU2 24 bit format used in mode 2 of the IEEE 1394 Digital Camera 1.04 spec IEEE standard - IYUV Planar YUV format (8-bpp Y plane, followed by 8-bpp 2×2 U and V planes) - i263 Intel ITU H.263 Videoconferencing (i263) - I420 Intel Indeo 4 - IAN Intel Indeo 4 (RDX) - ICLB InSoft CellB Videoconferencing - IGOR Power DVD - IJPG Intergraph JPEG - ILVC Intel Layered Video - ILVR ITU-T H.263+ - IPDV I-O Data Device Giga AVI DV Codec - IR21 Intel Indeo 2.1 - IRAW Intel YUV Uncompressed - IV30 Intel Indeo 3.0 - IV31 Intel Indeo 3.1 - IV32 Ligos Indeo 3.2 - IV33 Ligos Indeo 3.3 - IV34 Ligos Indeo 3.4 - IV35 Ligos Indeo 3.5 - IV36 Ligos Indeo 3.6 - IV37 Ligos Indeo 3.7 - IV38 Ligos Indeo 3.8 - IV39 Ligos Indeo 3.9 - IV40 Ligos Indeo Interactive 4.0 - IV41 Ligos Indeo Interactive 4.1 - IV42 Ligos Indeo Interactive 4.2 - IV43 Ligos Indeo Interactive 4.3 - IV44 Ligos Indeo Interactive 4.4 - IV45 Ligos Indeo Interactive 4.5 - IV46 Ligos Indeo Interactive 4.6 - IV47 Ligos Indeo Interactive 4.7 - IV48 Ligos Indeo Interactive 4.8 - IV49 Ligos Indeo Interactive 4.9 - IV50 Ligos Indeo Interactive 5.0 - JBYR Kensington ?JBYR? - JPEG Still Image JPEG DIB - JPGL Pegasus Lossless Motion JPEG - KMVC Team17 Software Karl Morton\'s Video Codec - LSVM Vianet Lighting Strike Vmail (Streaming) (www.vianet.com) - LEAD LEAD Video Codec - Ljpg LEAD MJPEG Codec - MDVD Alex MicroDVD Video (hacked MS MPEG-4) (www.tiasoft.de) - MJPA Morgan Motion JPEG (MJPA) (www.morgan-multimedia.com) - MJPB Morgan Motion JPEG (MJPB) (www.morgan-multimedia.com) - MMES Matrox MPEG-2 I-frame - MP2v Microsoft S-Mpeg 4 version 1 (MP2v) - MP42 Microsoft S-Mpeg 4 version 2 (MP42) - MP43 Microsoft S-Mpeg 4 version 3 (MP43) - MP4S Microsoft S-Mpeg 4 version 3 (MP4S) - MP4V FFmpeg MPEG-4 - MPG1 FFmpeg MPEG 1/2 - MPG2 FFmpeg MPEG 1/2 - MPG3 FFmpeg DivX ;-) (MS MPEG-4 v3) - MPG4 Microsoft MPEG-4 - MPGI Sigma Designs MPEG - MPNG PNG images decoder - MSS1 Microsoft Windows Screen Video - MSZH LCL (Lossless Codec Library) (www.geocities.co.jp/Playtown-Denei/2837/LRC.htm) - M261 Microsoft H.261 - M263 Microsoft H.263 - M4S2 Microsoft Fully Compliant MPEG-4 v2 simple profile (M4S2) - m4s2 Microsoft Fully Compliant MPEG-4 v2 simple profile (m4s2) - MC12 ATI Motion Compensation Format (MC12) - MCAM ATI Motion Compensation Format (MCAM) - MJ2C Morgan Multimedia Motion JPEG2000 - mJPG IBM Motion JPEG w/ Huffman Tables - MJPG Microsoft Motion JPEG DIB - MP42 Microsoft MPEG-4 (low-motion) - MP43 Microsoft MPEG-4 (fast-motion) - MP4S Microsoft MPEG-4 (MP4S) - mp4s Microsoft MPEG-4 (mp4s) - MPEG Chromatic Research MPEG-1 Video I-Frame - MPG4 Microsoft MPEG-4 Video High Speed Compressor - MPGI Sigma Designs MPEG - MRCA FAST Multimedia Martin Regen Codec - MRLE Microsoft Run Length Encoding - MSVC Microsoft Video 1 - MTX1 Matrox ?MTX1? - MTX2 Matrox ?MTX2? - MTX3 Matrox ?MTX3? - MTX4 Matrox ?MTX4? - MTX5 Matrox ?MTX5? - MTX6 Matrox ?MTX6? - MTX7 Matrox ?MTX7? - MTX8 Matrox ?MTX8? - MTX9 Matrox ?MTX9? - MV12 Motion Pixels Codec (old) - MWV1 Aware Motion Wavelets - nAVI SMR Codec (hack of Microsoft MPEG-4) (IRC #shadowrealm) - NT00 NewTek LightWave HDTV YUV w/ Alpha (www.newtek.com) - NUV1 NuppelVideo - NTN1 Nogatech Video Compression 1 - NVS0 nVidia GeForce Texture (NVS0) - NVS1 nVidia GeForce Texture (NVS1) - NVS2 nVidia GeForce Texture (NVS2) - NVS3 nVidia GeForce Texture (NVS3) - NVS4 nVidia GeForce Texture (NVS4) - NVS5 nVidia GeForce Texture (NVS5) - NVT0 nVidia GeForce Texture (NVT0) - NVT1 nVidia GeForce Texture (NVT1) - NVT2 nVidia GeForce Texture (NVT2) - NVT3 nVidia GeForce Texture (NVT3) - NVT4 nVidia GeForce Texture (NVT4) - NVT5 nVidia GeForce Texture (NVT5) - PIXL MiroXL, Pinnacle PCTV - PDVC I-O Data Device Digital Video Capture DV codec - PGVV Radius Video Vision - PHMO IBM Photomotion - PIM1 MPEG Realtime (Pinnacle Cards) - PIM2 Pegasus Imaging ?PIM2? - PIMJ Pegasus Imaging Lossless JPEG - PVEZ Horizons Technology PowerEZ - PVMM PacketVideo Corporation MPEG-4 - PVW2 Pegasus Imaging Wavelet Compression - Q1.0 Q-Team\'s QPEG 1.0 (www.q-team.de) - Q1.1 Q-Team\'s QPEG 1.1 (www.q-team.de) - QPEG Q-Team QPEG 1.0 - qpeq Q-Team QPEG 1.1 - RGB Raw BGR32 - RGBA Raw RGB w/ Alpha - RMP4 REALmagic MPEG-4 (unauthorized XVID copy) (www.sigmadesigns.com) - ROQV Id RoQ File Video Decoder - RPZA Quicktime Apple Video (RPZA) - RUD0 Rududu video codec (http://rududu.ifrance.com/rududu/) - RV10 RealVideo 1.0 (aka RealVideo 5.0) - RV13 RealVideo 1.0 (RV13) - RV20 RealVideo G2 - RV30 RealVideo 8 - RV40 RealVideo 9 - RGBT Raw RGB w/ Transparency - RLE Microsoft Run Length Encoder - RLE4 Run Length Encoded (4bpp, 16-color) - RLE8 Run Length Encoded (8bpp, 256-color) - RT21 Intel Indeo RealTime Video 2.1 - rv20 RealVideo G2 - rv30 RealVideo 8 - RVX Intel RDX (RVX ) - SMC Apple Graphics (SMC ) - SP54 Logitech Sunplus Sp54 Codec for Mustek GSmart Mini 2 - SPIG Radius Spigot - SVQ3 Sorenson Video 3 (Apple Quicktime 5) - s422 Tekram VideoCap C210 YUV 4:2:2 - SDCC Sun Communication Digital Camera Codec - SFMC CrystalNet Surface Fitting Method - SMSC Radius SMSC - SMSD Radius SMSD - smsv WorldConnect Wavelet Video - SPIG Radius Spigot - SPLC Splash Studios ACM Audio Codec (www.splashstudios.net) - SQZ2 Microsoft VXTreme Video Codec V2 - STVA ST Microelectronics CMOS Imager Data (Bayer) - STVB ST Microelectronics CMOS Imager Data (Nudged Bayer) - STVC ST Microelectronics CMOS Imager Data (Bunched) - STVX ST Microelectronics CMOS Imager Data (Extended CODEC Data Format) - STVY ST Microelectronics CMOS Imager Data (Extended CODEC Data Format with Correction Data) - SV10 Sorenson Video R1 - SVQ1 Sorenson Video - T420 Toshiba YUV 4:2:0 - TM2A Duck TrueMotion Archiver 2.0 (www.duck.com) - TVJP Pinnacle/Truevision Targa 2000 board (TVJP) - TVMJ Pinnacle/Truevision Targa 2000 board (TVMJ) - TY0N Tecomac Low-Bit Rate Codec (www.tecomac.com) - TY2C Trident Decompression Driver - TLMS TeraLogic Motion Intraframe Codec (TLMS) - TLST TeraLogic Motion Intraframe Codec (TLST) - TM20 Duck TrueMotion 2.0 - TM2X Duck TrueMotion 2X - TMIC TeraLogic Motion Intraframe Codec (TMIC) - TMOT Horizons Technology TrueMotion S - tmot Horizons TrueMotion Video Compression - TR20 Duck TrueMotion RealTime 2.0 - TSCC TechSmith Screen Capture Codec - TV10 Tecomac Low-Bit Rate Codec - TY2N Trident ?TY2N? - U263 UB Video H.263/H.263+/H.263++ Decoder - UMP4 UB Video MPEG 4 (www.ubvideo.com) - UYNV Nvidia UYVY packed 4:2:2 - UYVP Evans & Sutherland YCbCr 4:2:2 extended precision - UCOD eMajix.com ClearVideo - ULTI IBM Ultimotion - UYVY UYVY packed 4:2:2 - V261 Lucent VX2000S - VIFP VFAPI Reader Codec (www.yks.ne.jp/~hori/) - VIV1 FFmpeg H263+ decoder - VIV2 Vivo H.263 - VQC2 Vector-quantised codec 2 (research) http://eprints.ecs.soton.ac.uk/archive/00001310/01/VTC97-js.pdf) - VTLP Alaris VideoGramPiX - VYU9 ATI YUV (VYU9) - VYUY ATI YUV (VYUY) - V261 Lucent VX2000S - V422 Vitec Multimedia 24-bit YUV 4:2:2 Format - V655 Vitec Multimedia 16-bit YUV 4:2:2 Format - VCR1 ATI Video Codec 1 - VCR2 ATI Video Codec 2 - VCR3 ATI VCR 3.0 - VCR4 ATI VCR 4.0 - VCR5 ATI VCR 5.0 - VCR6 ATI VCR 6.0 - VCR7 ATI VCR 7.0 - VCR8 ATI VCR 8.0 - VCR9 ATI VCR 9.0 - VDCT Vitec Multimedia Video Maker Pro DIB - VDOM VDOnet VDOWave - VDOW VDOnet VDOLive (H.263) - VDTZ Darim Vison VideoTizer YUV - VGPX Alaris VideoGramPiX - VIDS Vitec Multimedia YUV 4:2:2 CCIR 601 for V422 - VIVO Vivo H.263 v2.00 - vivo Vivo H.263 - VIXL Miro/Pinnacle Video XL - VLV1 VideoLogic/PURE Digital Videologic Capture - VP30 On2 VP3.0 - VP31 On2 VP3.1 - VX1K Lucent VX1000S Video Codec - VX2K Lucent VX2000S Video Codec - VXSP Lucent VX1000SP Video Codec - WBVC Winbond W9960 - WHAM Microsoft Video 1 (WHAM) - WINX Winnov Software Compression - WJPG AverMedia Winbond JPEG - WMV1 Windows Media Video V7 - WMV2 Windows Media Video V8 - WMV3 Windows Media Video V9 - WNV1 Winnov Hardware Compression - XYZP Extended PAL format XYZ palette (www.riff.org) - x263 Xirlink H.263 - XLV0 NetXL Video Decoder - XMPG Xing MPEG (I-Frame only) - XVID XviD MPEG-4 (www.xvid.org) - XXAN ?XXAN? - YU92 Intel YUV (YU92) - YUNV Nvidia Uncompressed YUV 4:2:2 - YUVP Extended PAL format YUV palette (www.riff.org) - Y211 YUV 2:1:1 Packed - Y411 YUV 4:1:1 Packed - Y41B Weitek YUV 4:1:1 Planar - Y41P Brooktree PC1 YUV 4:1:1 Packed - Y41T Brooktree PC1 YUV 4:1:1 with transparency - Y42B Weitek YUV 4:2:2 Planar - Y42T Brooktree UYUV 4:2:2 with transparency - Y422 ADS Technologies Copy of UYVY used in Pyro WebCam firewire camera - Y800 Simple, single Y plane for monochrome images - Y8 Grayscale video - YC12 Intel YUV 12 codec - YUV8 Winnov Caviar YUV8 - YUV9 Intel YUV9 - YUY2 Uncompressed YUV 4:2:2 - YUYV Canopus YUV - YV12 YVU12 Planar - YVU9 Intel YVU9 Planar (8-bpp Y plane, followed by 8-bpp 4x4 U and V planes) - YVYU YVYU 4:2:2 Packed - ZLIB Lossless Codec Library zlib compression (www.geocities.co.jp/Playtown-Denei/2837/LRC.htm) - ZPEG Metheus Video Zipper - - */ - - return getid3_lib::EmbeddedLookup($fourcc, $begin, __LINE__, __FILE__, 'riff-fourcc'); - } - - - function EitherEndian2Int(&$ThisFileInfo, $byteword, $signed=false) { - if ($ThisFileInfo['fileformat'] == 'riff') { - return getid3_lib::LittleEndian2Int($byteword, $signed); - } - return getid3_lib::BigEndian2Int($byteword, false, $signed); - } - -} - -?>
\ No newline at end of file diff --git a/getid3/module.audio-video.swf.php b/getid3/module.audio-video.swf.php deleted file mode 100644 index c3dbb36..0000000 --- a/getid3/module.audio-video.swf.php +++ /dev/null @@ -1,149 +0,0 @@ -<?php -///////////////////////////////////////////////////////////////// -/// getID3() by James Heinrich <info@getid3.org> // -// available at http://getid3.sourceforge.net // -// or http://www.getid3.org // -///////////////////////////////////////////////////////////////// -// See readme.txt for more details // -///////////////////////////////////////////////////////////////// -// // -// module.audio-video.swf.php // -// module for analyzing Shockwave Flash files // -// dependencies: NONE // -// /// -///////////////////////////////////////////////////////////////// - - -class getid3_swf -{ - - function getid3_swf(&$fd, &$ThisFileInfo, $ReturnAllTagData=false) { -//$start_time = microtime(true); - $ThisFileInfo['fileformat'] = 'swf'; - $ThisFileInfo['video']['dataformat'] = 'swf'; - - // http://www.openswf.org/spec/SWFfileformat.html - - fseek($fd, $ThisFileInfo['avdataoffset'], SEEK_SET); - - $SWFfileData = fread($fd, $ThisFileInfo['avdataend'] - $ThisFileInfo['avdataoffset']); // 8 + 2 + 2 + max(9) bytes NOT including Frame_Size RECT data - - $ThisFileInfo['swf']['header']['signature'] = substr($SWFfileData, 0, 3); - switch ($ThisFileInfo['swf']['header']['signature']) { - case 'FWS': - $ThisFileInfo['swf']['header']['compressed'] = false; - break; - - case 'CWS': - $ThisFileInfo['swf']['header']['compressed'] = true; - break; - - default: - $ThisFileInfo['error'][] = 'Expecting "FWS" or "CWS" at offset '.$ThisFileInfo['avdataoffset'].', found "'.$ThisFileInfo['swf']['header']['signature'].'"'; - unset($ThisFileInfo['swf']); - unset($ThisFileInfo['fileformat']); - return false; - break; - } - $ThisFileInfo['swf']['header']['version'] = getid3_lib::LittleEndian2Int(substr($SWFfileData, 3, 1)); - $ThisFileInfo['swf']['header']['length'] = getid3_lib::LittleEndian2Int(substr($SWFfileData, 4, 4)); - -//echo __LINE__.'='.number_format(microtime(true) - $start_time, 3).'<br>'; - - if ($ThisFileInfo['swf']['header']['compressed']) { - - $SWFHead = substr($SWFfileData, 0, 8); - $SWFfileData = substr($SWFfileData, 8); - if ($decompressed = @gzuncompress($SWFfileData)) { - - $SWFfileData = $SWFHead.$decompressed; - - } else { - - $ThisFileInfo['error'][] = 'Error decompressing compressed SWF data ('.strlen($SWFfileData).' bytes compressed, should be '.($ThisFileInfo['swf']['header']['length'] - 8).' bytes uncompressed)'; - return false; - - } - - } -//echo __LINE__.'='.number_format(microtime(true) - $start_time, 3).'<br>'; - - $FrameSizeBitsPerValue = (ord(substr($SWFfileData, 8, 1)) & 0xF8) >> 3; - $FrameSizeDataLength = ceil((5 + (4 * $FrameSizeBitsPerValue)) / 8); - $FrameSizeDataString = str_pad(decbin(ord(substr($SWFfileData, 8, 1)) & 0x07), 3, '0', STR_PAD_LEFT); - for ($i = 1; $i < $FrameSizeDataLength; $i++) { - $FrameSizeDataString .= str_pad(decbin(ord(substr($SWFfileData, 8 + $i, 1))), 8, '0', STR_PAD_LEFT); - } - list($X1, $X2, $Y1, $Y2) = explode("\n", wordwrap($FrameSizeDataString, $FrameSizeBitsPerValue, "\n", 1)); - $ThisFileInfo['swf']['header']['frame_width'] = getid3_lib::Bin2Dec($X2); - $ThisFileInfo['swf']['header']['frame_height'] = getid3_lib::Bin2Dec($Y2); - - // http://www-lehre.informatik.uni-osnabrueck.de/~fbstark/diplom/docs/swf/Flash_Uncovered.htm - // Next in the header is the frame rate, which is kind of weird. - // It is supposed to be stored as a 16bit integer, but the first byte - // (or last depending on how you look at it) is completely ignored. - // Example: 0x000C -> 0x0C -> 12 So the frame rate is 12 fps. - - // Byte at (8 + $FrameSizeDataLength) is always zero and ignored - $ThisFileInfo['swf']['header']['frame_rate'] = getid3_lib::LittleEndian2Int(substr($SWFfileData, 9 + $FrameSizeDataLength, 1)); - $ThisFileInfo['swf']['header']['frame_count'] = getid3_lib::LittleEndian2Int(substr($SWFfileData, 10 + $FrameSizeDataLength, 2)); - - $ThisFileInfo['video']['frame_rate'] = $ThisFileInfo['swf']['header']['frame_rate']; - $ThisFileInfo['video']['resolution_x'] = intval(round($ThisFileInfo['swf']['header']['frame_width'] / 20)); - $ThisFileInfo['video']['resolution_y'] = intval(round($ThisFileInfo['swf']['header']['frame_height'] / 20)); - $ThisFileInfo['video']['pixel_aspect_ratio'] = (float) 1; - - if (($ThisFileInfo['swf']['header']['frame_count'] > 0) && ($ThisFileInfo['swf']['header']['frame_rate'] > 0)) { - $ThisFileInfo['playtime_seconds'] = $ThisFileInfo['swf']['header']['frame_count'] / $ThisFileInfo['swf']['header']['frame_rate']; - } -//echo __LINE__.'='.number_format(microtime(true) - $start_time, 3).'<br>'; - - - // SWF tags - - $CurrentOffset = 12 + $FrameSizeDataLength; - $SWFdataLength = strlen($SWFfileData); - - while ($CurrentOffset < $SWFdataLength) { -//echo __LINE__.'='.number_format(microtime(true) - $start_time, 3).'<br>'; - - $TagIDTagLength = getid3_lib::LittleEndian2Int(substr($SWFfileData, $CurrentOffset, 2)); - $TagID = ($TagIDTagLength & 0xFFFC) >> 6; - $TagLength = ($TagIDTagLength & 0x003F); - $CurrentOffset += 2; - if ($TagLength == 0x3F) { - $TagLength = getid3_lib::LittleEndian2Int(substr($SWFfileData, $CurrentOffset, 4)); - $CurrentOffset += 4; - } - - unset($TagData); - $TagData['offset'] = $CurrentOffset; - $TagData['size'] = $TagLength; - $TagData['id'] = $TagID; - $TagData['data'] = substr($SWFfileData, $CurrentOffset, $TagLength); - switch ($TagID) { - case 0: // end of movie - break 2; - - case 9: // Set background color - //$ThisFileInfo['swf']['tags'][] = $TagData; - $ThisFileInfo['swf']['bgcolor'] = strtoupper(str_pad(dechex(getid3_lib::BigEndian2Int($TagData['data'])), 6, '0', STR_PAD_LEFT)); - break; - - default: - if ($ReturnAllTagData) { - $ThisFileInfo['swf']['tags'][] = $TagData; - } - break; - } - - $CurrentOffset += $TagLength; - } - - return true; - } - -} - - -?>
\ No newline at end of file diff --git a/getid3/module.audio.aac.php b/getid3/module.audio.aac.php deleted file mode 100644 index 7ab3e99..0000000 --- a/getid3/module.audio.aac.php +++ /dev/null @@ -1,542 +0,0 @@ -<?php -///////////////////////////////////////////////////////////////// -/// getID3() by James Heinrich <info@getid3.org> // -// available at http://getid3.sourceforge.net // -// or http://www.getid3.org // -///////////////////////////////////////////////////////////////// -// See readme.txt for more details // -///////////////////////////////////////////////////////////////// -// // -// module.audio.aac.php // -// module for analyzing AAC Audio files // -// dependencies: NONE // -// /// -///////////////////////////////////////////////////////////////// - - -class getid3_aac -{ - - // new combined constructor - function getid3_aac(&$fd, &$ThisFileInfo, $option) { - - if ($option === 'adif') { - $this->getAACADIFheaderFilepointer($fd, $ThisFileInfo); - } - elseif ($option === 'adts') { - $this->getAACADTSheaderFilepointer($fd, $ThisFileInfo); - } - } - - - - function getAACADIFheaderFilepointer(&$fd, &$ThisFileInfo) { - $ThisFileInfo['fileformat'] = 'aac'; - $ThisFileInfo['audio']['dataformat'] = 'aac'; - $ThisFileInfo['audio']['lossless'] = false; - - fseek($fd, $ThisFileInfo['avdataoffset'], SEEK_SET); - $AACheader = fread($fd, 1024); - $offset = 0; - - if (substr($AACheader, 0, 4) == 'ADIF') { - - // http://faac.sourceforge.net/wiki/index.php?page=ADIF - - // http://libmpeg.org/mpeg4/doc/w2203tfs.pdf - // adif_header() { - // adif_id 32 - // copyright_id_present 1 - // if( copyright_id_present ) - // copyright_id 72 - // original_copy 1 - // home 1 - // bitstream_type 1 - // bitrate 23 - // num_program_config_elements 4 - // for (i = 0; i < num_program_config_elements + 1; i++ ) { - // if( bitstream_type == '0' ) - // adif_buffer_fullness 20 - // program_config_element() - // } - // } - - $AACheaderBitstream = getid3_lib::BigEndian2Bin($AACheader); - $bitoffset = 0; - - $ThisFileInfo['aac']['header_type'] = 'ADIF'; - $bitoffset += 32; - $ThisFileInfo['aac']['header']['mpeg_version'] = 4; - - $ThisFileInfo['aac']['header']['copyright'] = (bool) (substr($AACheaderBitstream, $bitoffset, 1) == '1'); - $bitoffset += 1; - if ($ThisFileInfo['aac']['header']['copyright']) { - $ThisFileInfo['aac']['header']['copyright_id'] = getid3_lib::Bin2String(substr($AACheaderBitstream, $bitoffset, 72)); - $bitoffset += 72; - } - $ThisFileInfo['aac']['header']['original_copy'] = (bool) (substr($AACheaderBitstream, $bitoffset, 1) == '1'); - $bitoffset += 1; - $ThisFileInfo['aac']['header']['home'] = (bool) (substr($AACheaderBitstream, $bitoffset, 1) == '1'); - $bitoffset += 1; - $ThisFileInfo['aac']['header']['is_vbr'] = (bool) (substr($AACheaderBitstream, $bitoffset, 1) == '1'); - $bitoffset += 1; - if ($ThisFileInfo['aac']['header']['is_vbr']) { - $ThisFileInfo['audio']['bitrate_mode'] = 'vbr'; - $ThisFileInfo['aac']['header']['bitrate_max'] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 23)); - $bitoffset += 23; - } else { - $ThisFileInfo['audio']['bitrate_mode'] = 'cbr'; - $ThisFileInfo['aac']['header']['bitrate'] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 23)); - $bitoffset += 23; - $ThisFileInfo['audio']['bitrate'] = $ThisFileInfo['aac']['header']['bitrate']; - } - if ($ThisFileInfo['audio']['bitrate'] == 0) { - $ThisFileInfo['error'][] = 'Corrupt AAC file: bitrate_audio == zero'; - return false; - } - $ThisFileInfo['aac']['header']['num_program_configs'] = 1 + getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 4)); - $bitoffset += 4; - - for ($i = 0; $i < $ThisFileInfo['aac']['header']['num_program_configs']; $i++) { - // http://www.audiocoding.com/wiki/index.php?page=program_config_element - - // buffer_fullness 20 - - // element_instance_tag 4 - // object_type 2 - // sampling_frequency_index 4 - // num_front_channel_elements 4 - // num_side_channel_elements 4 - // num_back_channel_elements 4 - // num_lfe_channel_elements 2 - // num_assoc_data_elements 3 - // num_valid_cc_elements 4 - // mono_mixdown_present 1 - // mono_mixdown_element_number 4 if mono_mixdown_present == 1 - // stereo_mixdown_present 1 - // stereo_mixdown_element_number 4 if stereo_mixdown_present == 1 - // matrix_mixdown_idx_present 1 - // matrix_mixdown_idx 2 if matrix_mixdown_idx_present == 1 - // pseudo_surround_enable 1 if matrix_mixdown_idx_present == 1 - // for (i = 0; i < num_front_channel_elements; i++) { - // front_element_is_cpe[i] 1 - // front_element_tag_select[i] 4 - // } - // for (i = 0; i < num_side_channel_elements; i++) { - // side_element_is_cpe[i] 1 - // side_element_tag_select[i] 4 - // } - // for (i = 0; i < num_back_channel_elements; i++) { - // back_element_is_cpe[i] 1 - // back_element_tag_select[i] 4 - // } - // for (i = 0; i < num_lfe_channel_elements; i++) { - // lfe_element_tag_select[i] 4 - // } - // for (i = 0; i < num_assoc_data_elements; i++) { - // assoc_data_element_tag_select[i] 4 - // } - // for (i = 0; i < num_valid_cc_elements; i++) { - // cc_element_is_ind_sw[i] 1 - // valid_cc_element_tag_select[i] 4 - // } - // byte_alignment() VAR - // comment_field_bytes 8 - // for (i = 0; i < comment_field_bytes; i++) { - // comment_field_data[i] 8 - // } - - if (!$ThisFileInfo['aac']['header']['is_vbr']) { - $ThisFileInfo['aac']['program_configs'][$i]['buffer_fullness'] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 20)); - $bitoffset += 20; - } - $ThisFileInfo['aac']['program_configs'][$i]['element_instance_tag'] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 4)); - $bitoffset += 4; - $ThisFileInfo['aac']['program_configs'][$i]['object_type'] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 2)); - $bitoffset += 2; - $ThisFileInfo['aac']['program_configs'][$i]['sampling_frequency_index'] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 4)); - $bitoffset += 4; - $ThisFileInfo['aac']['program_configs'][$i]['num_front_channel_elements'] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 4)); - $bitoffset += 4; - $ThisFileInfo['aac']['program_configs'][$i]['num_side_channel_elements'] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 4)); - $bitoffset += 4; - $ThisFileInfo['aac']['program_configs'][$i]['num_back_channel_elements'] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 4)); - $bitoffset += 4; - $ThisFileInfo['aac']['program_configs'][$i]['num_lfe_channel_elements'] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 2)); - $bitoffset += 2; - $ThisFileInfo['aac']['program_configs'][$i]['num_assoc_data_elements'] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 3)); - $bitoffset += 3; - $ThisFileInfo['aac']['program_configs'][$i]['num_valid_cc_elements'] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 4)); - $bitoffset += 4; - $ThisFileInfo['aac']['program_configs'][$i]['mono_mixdown_present'] = (bool) getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 1)); - $bitoffset += 1; - if ($ThisFileInfo['aac']['program_configs'][$i]['mono_mixdown_present']) { - $ThisFileInfo['aac']['program_configs'][$i]['mono_mixdown_element_number'] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 4)); - $bitoffset += 4; - } - $ThisFileInfo['aac']['program_configs'][$i]['stereo_mixdown_present'] = (bool) getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 1)); - $bitoffset += 1; - if ($ThisFileInfo['aac']['program_configs'][$i]['stereo_mixdown_present']) { - $ThisFileInfo['aac']['program_configs'][$i]['stereo_mixdown_element_number'] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 4)); - $bitoffset += 4; - } - $ThisFileInfo['aac']['program_configs'][$i]['matrix_mixdown_idx_present'] = (bool) getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 1)); - $bitoffset += 1; - if ($ThisFileInfo['aac']['program_configs'][$i]['matrix_mixdown_idx_present']) { - $ThisFileInfo['aac']['program_configs'][$i]['matrix_mixdown_idx'] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 2)); - $bitoffset += 2; - $ThisFileInfo['aac']['program_configs'][$i]['pseudo_surround_enable'] = (bool) getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 1)); - $bitoffset += 1; - } - for ($j = 0; $j < $ThisFileInfo['aac']['program_configs'][$i]['num_front_channel_elements']; $j++) { - $ThisFileInfo['aac']['program_configs'][$i]['front_element_is_cpe'][$j] = (bool) getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 1)); - $bitoffset += 1; - $ThisFileInfo['aac']['program_configs'][$i]['front_element_tag_select'][$j] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 4)); - $bitoffset += 4; - } - for ($j = 0; $j < $ThisFileInfo['aac']['program_configs'][$i]['num_side_channel_elements']; $j++) { - $ThisFileInfo['aac']['program_configs'][$i]['side_element_is_cpe'][$j] = (bool) getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 1)); - $bitoffset += 1; - $ThisFileInfo['aac']['program_configs'][$i]['side_element_tag_select'][$j] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 4)); - $bitoffset += 4; - } - for ($j = 0; $j < $ThisFileInfo['aac']['program_configs'][$i]['num_back_channel_elements']; $j++) { - $ThisFileInfo['aac']['program_configs'][$i]['back_element_is_cpe'][$j] = (bool) getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 1)); - $bitoffset += 1; - $ThisFileInfo['aac']['program_configs'][$i]['back_element_tag_select'][$j] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 4)); - $bitoffset += 4; - } - for ($j = 0; $j < $ThisFileInfo['aac']['program_configs'][$i]['num_lfe_channel_elements']; $j++) { - $ThisFileInfo['aac']['program_configs'][$i]['lfe_element_tag_select'][$j] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 4)); - $bitoffset += 4; - } - for ($j = 0; $j < $ThisFileInfo['aac']['program_configs'][$i]['num_assoc_data_elements']; $j++) { - $ThisFileInfo['aac']['program_configs'][$i]['assoc_data_element_tag_select'][$j] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 4)); - $bitoffset += 4; - } - for ($j = 0; $j < $ThisFileInfo['aac']['program_configs'][$i]['num_valid_cc_elements']; $j++) { - $ThisFileInfo['aac']['program_configs'][$i]['cc_element_is_ind_sw'][$j] = (bool) getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 1)); - $bitoffset += 1; - $ThisFileInfo['aac']['program_configs'][$i]['valid_cc_element_tag_select'][$j] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 4)); - $bitoffset += 4; - } - - $bitoffset = ceil($bitoffset / 8) * 8; - - $ThisFileInfo['aac']['program_configs'][$i]['comment_field_bytes'] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 8)); - $bitoffset += 8; - $ThisFileInfo['aac']['program_configs'][$i]['comment_field'] = getid3_lib::Bin2String(substr($AACheaderBitstream, $bitoffset, 8 * $ThisFileInfo['aac']['program_configs'][$i]['comment_field_bytes'])); - $bitoffset += 8 * $ThisFileInfo['aac']['program_configs'][$i]['comment_field_bytes']; - - - $ThisFileInfo['aac']['header']['profile_text'] = $this->AACprofileLookup($ThisFileInfo['aac']['program_configs'][$i]['object_type'], $ThisFileInfo['aac']['header']['mpeg_version']); - $ThisFileInfo['aac']['program_configs'][$i]['sampling_frequency'] = $this->AACsampleRateLookup($ThisFileInfo['aac']['program_configs'][$i]['sampling_frequency_index']); - $ThisFileInfo['audio']['sample_rate'] = $ThisFileInfo['aac']['program_configs'][$i]['sampling_frequency']; - $ThisFileInfo['audio']['channels'] = $this->AACchannelCountCalculate($ThisFileInfo['aac']['program_configs'][$i]); - if ($ThisFileInfo['aac']['program_configs'][$i]['comment_field']) { - $ThisFileInfo['aac']['comments'][] = $ThisFileInfo['aac']['program_configs'][$i]['comment_field']; - } - } - $ThisFileInfo['playtime_seconds'] = (($ThisFileInfo['avdataend'] - $ThisFileInfo['avdataoffset']) * 8) / $ThisFileInfo['audio']['bitrate']; - - $ThisFileInfo['audio']['encoder_options'] = $ThisFileInfo['aac']['header_type'].' '.$ThisFileInfo['aac']['header']['profile_text']; - - - - return true; - - } else { - - unset($ThisFileInfo['fileformat']); - unset($ThisFileInfo['aac']); - $ThisFileInfo['error'][] = 'AAC-ADIF synch not found at offset '.$ThisFileInfo['avdataoffset'].' (expected "ADIF", found "'.substr($AACheader, 0, 4).'" instead)'; - return false; - - } - - } - - - function getAACADTSheaderFilepointer(&$fd, &$ThisFileInfo, $MaxFramesToScan=1000000, $ReturnExtendedInfo=false) { - // based loosely on code from AACfile by Jurgen Faul <jfaulØgmx.de> - // http://jfaul.de/atl or http://j-faul.virtualave.net/atl/atl.html - - - // http://faac.sourceforge.net/wiki/index.php?page=ADTS - - // * ADTS Fixed Header: these don't change from frame to frame - // syncword 12 always: '111111111111' - // ID 1 0: MPEG-4, 1: MPEG-2 - // layer 2 always: '00' - // protection_absent 1 - // profile 2 - // sampling_frequency_index 4 - // private_bit 1 - // channel_configuration 3 - // original/copy 1 - // home 1 - // emphasis 2 only if ID == 0 (ie MPEG-4) - - // * ADTS Variable Header: these can change from frame to frame - // copyright_identification_bit 1 - // copyright_identification_start 1 - // aac_frame_length 13 length of the frame including header (in bytes) - // adts_buffer_fullness 11 0x7FF indicates VBR - // no_raw_data_blocks_in_frame 2 - - // * ADTS Error check - // crc_check 16 only if protection_absent == 0 - - $byteoffset = 0; - $framenumber = 0; - - // Init bit pattern array - static $decbin = array(); - - // Populate $bindec - for ($i = 0; $i < 256; $i++) { - $decbin[chr($i)] = str_pad(decbin($i), 8, '0', STR_PAD_LEFT); - } - - // used to calculate bitrate below - $BitrateCache = array(); - - - while (true) { - // breaks out when end-of-file encountered, or invalid data found, - // or MaxFramesToScan frames have been scanned - - if ($byteoffset >= pow(2, 31)) { - $ThisFileInfo['warning'][] = 'Unable to parse AAC file beyond '.ftell($fd).' (PHP does not support file operations beyond 2GB)'; - return false; - } - fseek($fd, $byteoffset, SEEK_SET); - - // First get substring - $substring = fread($fd, 10); - $substringlength = strlen($substring); - if ($substringlength != 10) { - $ThisFileInfo['error'][] = 'Failed to read 10 bytes at offset '.(ftell($fd) - $substringlength).' (only read '.$substringlength.' bytes)'; - return false; - } - - // Initialise $AACheaderBitstream - $AACheaderBitstream = ''; - - // Loop thru substring chars - for ($i = 0; $i < 10; $i++) { - $AACheaderBitstream .= $decbin[$substring{$i}]; - } - - $bitoffset = 0; - - $synctest = bindec(substr($AACheaderBitstream, $bitoffset, 12)); - - $bitoffset += 12; - if ($synctest != 0x0FFF) { - $ThisFileInfo['error'][] = 'Synch pattern (0x0FFF) not found at offset '.(ftell($fd) - 10).' (found 0x0'.strtoupper(dechex($synctest)).' instead)'; - if ($ThisFileInfo['fileformat'] == 'aac') { - return true; - } - return false; - } - - // Gather info for first frame only - this takes time to do 1000 times! - if ($framenumber > 0) { - - if (!$AACheaderBitstream[$bitoffset]) { - - // MPEG-4 - $bitoffset += 20; - - } else { - - // MPEG-2 - $bitoffset += 18; - - } - - } else { - - $ThisFileInfo['aac']['header_type'] = 'ADTS'; - $ThisFileInfo['aac']['header']['synch'] = $synctest; - $ThisFileInfo['fileformat'] = 'aac'; - $ThisFileInfo['audio']['dataformat'] = 'aac'; - - $ThisFileInfo['aac']['header']['mpeg_version'] = ((substr($AACheaderBitstream, $bitoffset, 1) == '0') ? 4 : 2); - $bitoffset += 1; - $ThisFileInfo['aac']['header']['layer'] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 2)); - $bitoffset += 2; - if ($ThisFileInfo['aac']['header']['layer'] != 0) { - $ThisFileInfo['error'][] = 'Layer error - expected 0x00, found 0x'.dechex($ThisFileInfo['aac']['header']['layer']).' instead'; - return false; - } - $ThisFileInfo['aac']['header']['crc_present'] = ((substr($AACheaderBitstream, $bitoffset, 1) == '0') ? true : false); - $bitoffset += 1; - $ThisFileInfo['aac']['header']['profile_id'] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 2)); - $bitoffset += 2; - $ThisFileInfo['aac']['header']['profile_text'] = $this->AACprofileLookup($ThisFileInfo['aac']['header']['profile_id'], $ThisFileInfo['aac']['header']['mpeg_version']); - - $ThisFileInfo['aac']['header']['sample_frequency_index'] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 4)); - $bitoffset += 4; - $ThisFileInfo['aac']['header']['sample_frequency'] = $this->AACsampleRateLookup($ThisFileInfo['aac']['header']['sample_frequency_index']); - if ($ThisFileInfo['aac']['header']['sample_frequency'] == 0) { - $ThisFileInfo['error'][] = 'Corrupt AAC file: sample_frequency == zero'; - return false; - } - $ThisFileInfo['audio']['sample_rate'] = $ThisFileInfo['aac']['header']['sample_frequency']; - - $ThisFileInfo['aac']['header']['private'] = (bool) getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 1)); - $bitoffset += 1; - $ThisFileInfo['aac']['header']['channel_configuration'] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 3)); - $bitoffset += 3; - $ThisFileInfo['audio']['channels'] = $ThisFileInfo['aac']['header']['channel_configuration']; - $ThisFileInfo['aac']['header']['original'] = (bool) getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 1)); - $bitoffset += 1; - $ThisFileInfo['aac']['header']['home'] = (bool) getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 1)); - $bitoffset += 1; - - if ($ThisFileInfo['aac']['header']['mpeg_version'] == 4) { - $ThisFileInfo['aac']['header']['emphasis'] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 2)); - $bitoffset += 2; - } - - if ($ReturnExtendedInfo) { - - $ThisFileInfo['aac'][$framenumber]['copyright_id_bit'] = (bool) getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 1)); - $bitoffset += 1; - $ThisFileInfo['aac'][$framenumber]['copyright_id_start'] = (bool) getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 1)); - $bitoffset += 1; - - } else { - - $bitoffset += 2; - - } - - } - - $FrameLength = bindec(substr($AACheaderBitstream, $bitoffset, 13)); - - if (!isset($BitrateCache[$FrameLength])) { - $BitrateCache[$FrameLength] = ($ThisFileInfo['aac']['header']['sample_frequency'] / 1024) * $FrameLength * 8; - } - @$ThisFileInfo['aac']['bitrate_distribution'][$BitrateCache[$FrameLength]]++; - - $ThisFileInfo['aac'][$framenumber]['aac_frame_length'] = $FrameLength; - $bitoffset += 13; - $ThisFileInfo['aac'][$framenumber]['adts_buffer_fullness'] = bindec(substr($AACheaderBitstream, $bitoffset, 11)); - $bitoffset += 11; - if ($ThisFileInfo['aac'][$framenumber]['adts_buffer_fullness'] == 0x07FF) { - $ThisFileInfo['audio']['bitrate_mode'] = 'vbr'; - } else { - $ThisFileInfo['audio']['bitrate_mode'] = 'cbr'; - } - $ThisFileInfo['aac'][$framenumber]['num_raw_data_blocks'] = bindec(substr($AACheaderBitstream, $bitoffset, 2)); - $bitoffset += 2; - - if ($ThisFileInfo['aac']['header']['crc_present']) { - //$ThisFileInfo['aac'][$framenumber]['crc'] = bindec(substr($AACheaderBitstream, $bitoffset, 16)); - $bitoffset += 16; - } - - if (!$ReturnExtendedInfo) { - unset($ThisFileInfo['aac'][$framenumber]); - } - - $byteoffset += $FrameLength; - if ((++$framenumber < $MaxFramesToScan) && (($byteoffset + 10) < $ThisFileInfo['avdataend'])) { - - // keep scanning - - } else { - - $ThisFileInfo['aac']['frames'] = $framenumber; - $ThisFileInfo['playtime_seconds'] = ($ThisFileInfo['avdataend'] / $byteoffset) * (($framenumber * 1024) / $ThisFileInfo['aac']['header']['sample_frequency']); // (1 / % of file scanned) * (samples / (samples/sec)) = seconds - if ($ThisFileInfo['playtime_seconds'] == 0) { - $ThisFileInfo['error'][] = 'Corrupt AAC file: playtime_seconds == zero'; - return false; - } - $ThisFileInfo['audio']['bitrate'] = (($ThisFileInfo['avdataend'] - $ThisFileInfo['avdataoffset']) * 8) / $ThisFileInfo['playtime_seconds']; - ksort($ThisFileInfo['aac']['bitrate_distribution']); - - $ThisFileInfo['audio']['encoder_options'] = $ThisFileInfo['aac']['header_type'].' '.$ThisFileInfo['aac']['header']['profile_text']; - - return true; - - } - } - // should never get here. - } - - function AACsampleRateLookup($samplerateid) { - static $AACsampleRateLookup = array(); - if (empty($AACsampleRateLookup)) { - $AACsampleRateLookup[0] = 96000; - $AACsampleRateLookup[1] = 88200; - $AACsampleRateLookup[2] = 64000; - $AACsampleRateLookup[3] = 48000; - $AACsampleRateLookup[4] = 44100; - $AACsampleRateLookup[5] = 32000; - $AACsampleRateLookup[6] = 24000; - $AACsampleRateLookup[7] = 22050; - $AACsampleRateLookup[8] = 16000; - $AACsampleRateLookup[9] = 12000; - $AACsampleRateLookup[10] = 11025; - $AACsampleRateLookup[11] = 8000; - $AACsampleRateLookup[12] = 0; - $AACsampleRateLookup[13] = 0; - $AACsampleRateLookup[14] = 0; - $AACsampleRateLookup[15] = 0; - } - return (isset($AACsampleRateLookup[$samplerateid]) ? $AACsampleRateLookup[$samplerateid] : 'invalid'); - } - - function AACprofileLookup($profileid, $mpegversion) { - static $AACprofileLookup = array(); - if (empty($AACprofileLookup)) { - $AACprofileLookup[2][0] = 'Main profile'; - $AACprofileLookup[2][1] = 'Low Complexity profile (LC)'; - $AACprofileLookup[2][2] = 'Scalable Sample Rate profile (SSR)'; - $AACprofileLookup[2][3] = '(reserved)'; - $AACprofileLookup[4][0] = 'AAC_MAIN'; - $AACprofileLookup[4][1] = 'AAC_LC'; - $AACprofileLookup[4][2] = 'AAC_SSR'; - $AACprofileLookup[4][3] = 'AAC_LTP'; - } - return (isset($AACprofileLookup[$mpegversion][$profileid]) ? $AACprofileLookup[$mpegversion][$profileid] : 'invalid'); - } - - function AACchannelCountCalculate($program_configs) { - $channels = 0; - for ($i = 0; $i < $program_configs['num_front_channel_elements']; $i++) { - $channels++; - if ($program_configs['front_element_is_cpe'][$i]) { - // each front element is channel pair (CPE = Channel Pair Element) - $channels++; - } - } - for ($i = 0; $i < $program_configs['num_side_channel_elements']; $i++) { - $channels++; - if ($program_configs['side_element_is_cpe'][$i]) { - // each side element is channel pair (CPE = Channel Pair Element) - $channels++; - } - } - for ($i = 0; $i < $program_configs['num_back_channel_elements']; $i++) { - $channels++; - if ($program_configs['back_element_is_cpe'][$i]) { - // each back element is channel pair (CPE = Channel Pair Element) - $channels++; - } - } - for ($i = 0; $i < $program_configs['num_lfe_channel_elements']; $i++) { - $channels++; - } - return $channels; - } - -} - - -?>
\ No newline at end of file diff --git a/getid3/module.audio.ac3.php b/getid3/module.audio.ac3.php deleted file mode 100644 index 9809a47..0000000 --- a/getid3/module.audio.ac3.php +++ /dev/null @@ -1,497 +0,0 @@ -<?php -///////////////////////////////////////////////////////////////// -/// getID3() by James Heinrich <info@getid3.org> // -// available at http://getid3.sourceforge.net // -// or http://www.getid3.org // -///////////////////////////////////////////////////////////////// -// See readme.txt for more details // -///////////////////////////////////////////////////////////////// -// // -// module.audio.ac3.php // -// module for analyzing AC-3 (aka Dolby Digital) audio files // -// dependencies: NONE // -// /// -///////////////////////////////////////////////////////////////// - - -class getid3_ac3 -{ - - function getid3_ac3(&$fd, &$ThisFileInfo) { - - ///AH - $ThisFileInfo['ac3']['raw']['bsi'] = array(); - $thisfile_ac3 = &$ThisFileInfo['ac3']; - $thisfile_ac3_raw = &$thisfile_ac3['raw']; - $thisfile_ac3_raw_bsi = &$thisfile_ac3_raw['bsi']; - - - // http://www.atsc.org/standards/a_52a.pdf - - $ThisFileInfo['fileformat'] = 'ac3'; - $ThisFileInfo['audio']['dataformat'] = 'ac3'; - $ThisFileInfo['audio']['bitrate_mode'] = 'cbr'; - $ThisFileInfo['audio']['lossless'] = false; - - // An AC-3 serial coded audio bit stream is made up of a sequence of synchronization frames - // Each synchronization frame contains 6 coded audio blocks (AB), each of which represent 256 - // new audio samples per channel. A synchronization information (SI) header at the beginning - // of each frame contains information needed to acquire and maintain synchronization. A - // bit stream information (BSI) header follows SI, and contains parameters describing the coded - // audio service. The coded audio blocks may be followed by an auxiliary data (Aux) field. At the - // end of each frame is an error check field that includes a CRC word for error detection. An - // additional CRC word is located in the SI header, the use of which, by a decoder, is optional. - // - // syncinfo() | bsi() | AB0 | AB1 | AB2 | AB3 | AB4 | AB5 | Aux | CRC - - fseek($fd, $ThisFileInfo['avdataoffset'], SEEK_SET); - $AC3header['syncinfo'] = fread($fd, 5); - $thisfile_ac3_raw['synchinfo']['synchword'] = substr($AC3header['syncinfo'], 0, 2); - - if ($thisfile_ac3_raw['synchinfo']['synchword'] != "\x0B\x77") { - - $ThisFileInfo['error'][] = 'Expecting "\x0B\x77" at offset '.$ThisFileInfo['avdataoffset'].', found \x'.strtoupper(dechex($AC3header['syncinfo']{0})).'\x'.strtoupper(dechex($AC3header['syncinfo']{1})).' instead'; - unset($thisfile_ac3); - return false; - - } else { - - // syncinfo() { - // syncword 16 - // crc1 16 - // fscod 2 - // frmsizecod 6 - // } /* end of syncinfo */ - - $thisfile_ac3_raw['synchinfo']['crc1'] = getid3_lib::LittleEndian2Int(substr($AC3header['syncinfo'], 2, 2)); - $ac3_synchinfo_fscod_frmsizecod = getid3_lib::LittleEndian2Int(substr($AC3header['syncinfo'], 4, 1)); - $thisfile_ac3_raw['synchinfo']['fscod'] = ($ac3_synchinfo_fscod_frmsizecod & 0xC0) >> 6; - $thisfile_ac3_raw['synchinfo']['frmsizecod'] = ($ac3_synchinfo_fscod_frmsizecod & 0x3F); - - $thisfile_ac3['sample_rate'] = $this->AC3sampleRateCodeLookup($thisfile_ac3_raw['synchinfo']['fscod']); - if ($thisfile_ac3_raw['synchinfo']['fscod'] <= 3) { - $ThisFileInfo['audio']['sample_rate'] = $thisfile_ac3['sample_rate']; - } - - $thisfile_ac3['frame_length'] = $this->AC3frameSizeLookup($thisfile_ac3_raw['synchinfo']['frmsizecod'], $thisfile_ac3_raw['synchinfo']['fscod']); - $thisfile_ac3['bitrate'] = $this->AC3bitrateLookup($thisfile_ac3_raw['synchinfo']['frmsizecod']); - $ThisFileInfo['audio']['bitrate'] = $thisfile_ac3['bitrate']; - - $AC3header['bsi'] = getid3_lib::BigEndian2Bin(fread($fd, 15)); - $ac3_bsi_offset = 0; - - $thisfile_ac3_raw_bsi['bsid'] = bindec(substr($AC3header['bsi'], $ac3_bsi_offset, 5)); - $ac3_bsi_offset += 5; - if ($thisfile_ac3_raw_bsi['bsid'] > 8) { - // Decoders which can decode version 8 will thus be able to decode version numbers less than 8. - // If this standard is extended by the addition of additional elements or features, a value of bsid greater than 8 will be used. - // Decoders built to this version of the standard will not be able to decode versions with bsid greater than 8. - $ThisFileInfo['error'][] = 'Bit stream identification is version '.$thisfile_ac3_raw_bsi['bsid'].', but getID3() only understands up to version 8'; - unset($thisfile_ac3); - return false; - } - - $thisfile_ac3_raw_bsi['bsmod'] = bindec(substr($AC3header['bsi'], $ac3_bsi_offset, 3)); - $ac3_bsi_offset += 3; - $thisfile_ac3_raw_bsi['acmod'] = bindec(substr($AC3header['bsi'], $ac3_bsi_offset, 3)); - $ac3_bsi_offset += 3; - - $thisfile_ac3['service_type'] = $this->AC3serviceTypeLookup($thisfile_ac3_raw_bsi['bsmod'], $thisfile_ac3_raw_bsi['acmod']); - $ac3_coding_mode = $this->AC3audioCodingModeLookup($thisfile_ac3_raw_bsi['acmod']); - foreach($ac3_coding_mode as $key => $value) { - $thisfile_ac3[$key] = $value; - } - switch ($thisfile_ac3_raw_bsi['acmod']) { - case 0: - case 1: - $ThisFileInfo['audio']['channelmode'] = 'mono'; - break; - case 3: - case 4: - $ThisFileInfo['audio']['channelmode'] = 'stereo'; - break; - default: - $ThisFileInfo['audio']['channelmode'] = 'surround'; - break; - } - $ThisFileInfo['audio']['channels'] = $thisfile_ac3['num_channels']; - - if ($thisfile_ac3_raw_bsi['acmod'] & 0x01) { - // If the lsb of acmod is a 1, center channel is in use and cmixlev follows in the bit stream. - $thisfile_ac3_raw_bsi['cmixlev'] = bindec(substr($AC3header['bsi'], $ac3_bsi_offset, 2)); - $ac3_bsi_offset += 2; - $thisfile_ac3['center_mix_level'] = $this->AC3centerMixLevelLookup($thisfile_ac3_raw_bsi['cmixlev']); - } - - if ($thisfile_ac3_raw_bsi['acmod'] & 0x04) { - // If the msb of acmod is a 1, surround channels are in use and surmixlev follows in the bit stream. - $thisfile_ac3_raw_bsi['surmixlev'] = bindec(substr($AC3header['bsi'], $ac3_bsi_offset, 2)); - $ac3_bsi_offset += 2; - $thisfile_ac3['surround_mix_level'] = $this->AC3surroundMixLevelLookup($thisfile_ac3_raw_bsi['surmixlev']); - } - - if ($thisfile_ac3_raw_bsi['acmod'] == 0x02) { - // When operating in the two channel mode, this 2-bit code indicates whether or not the program has been encoded in Dolby Surround. - $thisfile_ac3_raw_bsi['dsurmod'] = bindec(substr($AC3header['bsi'], $ac3_bsi_offset, 2)); - $ac3_bsi_offset += 2; - $thisfile_ac3['dolby_surround_mode'] = $this->AC3dolbySurroundModeLookup($thisfile_ac3_raw_bsi['dsurmod']); - } - - $thisfile_ac3_raw_bsi['lfeon'] = (bool) bindec(substr($AC3header['bsi'], $ac3_bsi_offset, 1)); - $ac3_bsi_offset += 1; - $thisfile_ac3['lfe_enabled'] = $thisfile_ac3_raw_bsi['lfeon']; - if ($thisfile_ac3_raw_bsi['lfeon']) { - //$ThisFileInfo['audio']['channels']++; - $ThisFileInfo['audio']['channels'] .= '.1'; - } - - $thisfile_ac3['channels_enabled'] = $this->AC3channelsEnabledLookup($thisfile_ac3_raw_bsi['acmod'], $thisfile_ac3_raw_bsi['lfeon']); - - // This indicates how far the average dialogue level is below digital 100 percent. Valid values are 1–31. - // The value of 0 is reserved. The values of 1 to 31 are interpreted as -1 dB to -31 dB with respect to digital 100 percent. - $thisfile_ac3_raw_bsi['dialnorm'] = bindec(substr($AC3header['bsi'], $ac3_bsi_offset, 5)); - $ac3_bsi_offset += 5; - $thisfile_ac3['dialogue_normalization'] = '-'.$thisfile_ac3_raw_bsi['dialnorm'].'dB'; - - $thisfile_ac3_raw_bsi['compre_flag'] = (bool) bindec(substr($AC3header['bsi'], $ac3_bsi_offset, 1)); - $ac3_bsi_offset += 1; - if ($thisfile_ac3_raw_bsi['compre_flag']) { - $thisfile_ac3_raw_bsi['compr'] = bindec(substr($AC3header['bsi'], $ac3_bsi_offset, 8)); - $ac3_bsi_offset += 8; - $thisfile_ac3['heavy_compression'] = $this->AC3heavyCompression($thisfile_ac3_raw_bsi['compr']); - } - - $thisfile_ac3_raw_bsi['langcode_flag'] = (bool) bindec(substr($AC3header['bsi'], $ac3_bsi_offset, 1)); - $ac3_bsi_offset += 1; - if ($thisfile_ac3_raw_bsi['langcode_flag']) { - $thisfile_ac3_raw_bsi['langcod'] = bindec(substr($AC3header['bsi'], $ac3_bsi_offset, 8)); - $ac3_bsi_offset += 8; - } - - $thisfile_ac3_raw_bsi['audprodie'] = (bool) bindec(substr($AC3header['bsi'], $ac3_bsi_offset, 1)); - $ac3_bsi_offset += 1; - if ($thisfile_ac3_raw_bsi['audprodie']) { - $thisfile_ac3_raw_bsi['mixlevel'] = bindec(substr($AC3header['bsi'], $ac3_bsi_offset, 5)); - $ac3_bsi_offset += 5; - $thisfile_ac3_raw_bsi['roomtyp'] = bindec(substr($AC3header['bsi'], $ac3_bsi_offset, 2)); - $ac3_bsi_offset += 2; - - $thisfile_ac3['mixing_level'] = (80 + $thisfile_ac3_raw_bsi['mixlevel']).'dB'; - $thisfile_ac3['room_type'] = $this->AC3roomTypeLookup($thisfile_ac3_raw_bsi['roomtyp']); - } - - if ($thisfile_ac3_raw_bsi['acmod'] == 0x00) { - // If acmod is 0, then two completely independent program channels (dual mono) - // are encoded into the bit stream, and are referenced as Ch1, Ch2. In this case, - // a number of additional items are present in BSI or audblk to fully describe Ch2. - - - // This indicates how far the average dialogue level is below digital 100 percent. Valid values are 1–31. - // The value of 0 is reserved. The values of 1 to 31 are interpreted as -1 dB to -31 dB with respect to digital 100 percent. - $thisfile_ac3_raw_bsi['dialnorm2'] = bindec(substr($AC3header['bsi'], $ac3_bsi_offset, 5)); - $ac3_bsi_offset += 5; - $thisfile_ac3['dialogue_normalization2'] = '-'.$thisfile_ac3_raw_bsi['dialnorm2'].'dB'; - - $thisfile_ac3_raw_bsi['compre_flag2'] = (bool) bindec(substr($AC3header['bsi'], $ac3_bsi_offset, 1)); - $ac3_bsi_offset += 1; - if ($thisfile_ac3_raw_bsi['compre_flag2']) { - $thisfile_ac3_raw_bsi['compr2'] = bindec(substr($AC3header['bsi'], $ac3_bsi_offset, 8)); - $ac3_bsi_offset += 8; - $thisfile_ac3['heavy_compression2'] = $this->AC3heavyCompression($thisfile_ac3_raw_bsi['compr2']); - } - - $thisfile_ac3_raw_bsi['langcode_flag2'] = (bool) bindec(substr($AC3header['bsi'], $ac3_bsi_offset, 1)); - $ac3_bsi_offset += 1; - if ($thisfile_ac3_raw_bsi['langcode_flag2']) { - $thisfile_ac3_raw_bsi['langcod2'] = bindec(substr($AC3header['bsi'], $ac3_bsi_offset, 8)); - $ac3_bsi_offset += 8; - } - - $thisfile_ac3_raw_bsi['audprodie2'] = (bool) bindec(substr($AC3header['bsi'], $ac3_bsi_offset, 1)); - $ac3_bsi_offset += 1; - if ($thisfile_ac3_raw_bsi['audprodie2']) { - $thisfile_ac3_raw_bsi['mixlevel2'] = bindec(substr($AC3header['bsi'], $ac3_bsi_offset, 5)); - $ac3_bsi_offset += 5; - $thisfile_ac3_raw_bsi['roomtyp2'] = bindec(substr($AC3header['bsi'], $ac3_bsi_offset, 2)); - $ac3_bsi_offset += 2; - - $thisfile_ac3['mixing_level2'] = (80 + $thisfile_ac3_raw_bsi['mixlevel2']).'dB'; - $thisfile_ac3['room_type2'] = $this->AC3roomTypeLookup($thisfile_ac3_raw_bsi['roomtyp2']); - } - - } - - $thisfile_ac3_raw_bsi['copyright'] = (bool) bindec(substr($AC3header['bsi'], $ac3_bsi_offset, 1)); - $ac3_bsi_offset += 1; - - $thisfile_ac3_raw_bsi['original'] = (bool) bindec(substr($AC3header['bsi'], $ac3_bsi_offset, 1)); - $ac3_bsi_offset += 1; - - $thisfile_ac3_raw_bsi['timecode1_flag'] = (bool) bindec(substr($AC3header['bsi'], $ac3_bsi_offset, 1)); - $ac3_bsi_offset += 1; - if ($thisfile_ac3_raw_bsi['timecode1_flag']) { - $thisfile_ac3_raw_bsi['timecode1'] = bindec(substr($AC3header['bsi'], $ac3_bsi_offset, 14)); - $ac3_bsi_offset += 14; - } - - $thisfile_ac3_raw_bsi['timecode2_flag'] = (bool) bindec(substr($AC3header['bsi'], $ac3_bsi_offset, 1)); - $ac3_bsi_offset += 1; - if ($thisfile_ac3_raw_bsi['timecode2_flag']) { - $thisfile_ac3_raw_bsi['timecode2'] = bindec(substr($AC3header['bsi'], $ac3_bsi_offset, 14)); - $ac3_bsi_offset += 14; - } - - $thisfile_ac3_raw_bsi['addbsi_flag'] = (bool) bindec(substr($AC3header['bsi'], $ac3_bsi_offset, 1)); - $ac3_bsi_offset += 1; - if ($thisfile_ac3_raw_bsi['addbsi_flag']) { - $thisfile_ac3_raw_bsi['addbsi_length'] = bindec(substr($AC3header['bsi'], $ac3_bsi_offset, 6)); - $ac3_bsi_offset += 6; - - $AC3header['bsi'] .= getid3_lib::BigEndian2Bin(fread($fd, $thisfile_ac3_raw_bsi['addbsi_length'])); - - $thisfile_ac3_raw_bsi['addbsi_data'] = substr($AC3header['bsi'], $ac3_bsi_offset, $thisfile_ac3_raw_bsi['addbsi_length'] * 8); - $ac3_bsi_offset += $thisfile_ac3_raw_bsi['addbsi_length'] * 8; - } - - } - - return true; - } - - - function AC3sampleRateCodeLookup($fscod) { - static $AC3sampleRateCodeLookup = array( - 0 => 48000, - 1 => 44100, - 2 => 32000, - 3 => 'reserved' // If the reserved code is indicated, the decoder should not attempt to decode audio and should mute. - ); - return (isset($AC3sampleRateCodeLookup[$fscod]) ? $AC3sampleRateCodeLookup[$fscod] : false); - } - - function AC3serviceTypeLookup($bsmod, $acmod) { - static $AC3serviceTypeLookup = array(); - if (empty($AC3serviceTypeLookup)) { - for ($i = 0; $i <= 7; $i++) { - $AC3serviceTypeLookup[0][$i] = 'main audio service: complete main (CM)'; - $AC3serviceTypeLookup[1][$i] = 'main audio service: music and effects (ME)'; - $AC3serviceTypeLookup[2][$i] = 'associated service: visually impaired (VI)'; - $AC3serviceTypeLookup[3][$i] = 'associated service: hearing impaired (HI)'; - $AC3serviceTypeLookup[4][$i] = 'associated service: dialogue (D)'; - $AC3serviceTypeLookup[5][$i] = 'associated service: commentary (C)'; - $AC3serviceTypeLookup[6][$i] = 'associated service: emergency (E)'; - } - - $AC3serviceTypeLookup[7][1] = 'associated service: voice over (VO)'; - for ($i = 2; $i <= 7; $i++) { - $AC3serviceTypeLookup[7][$i] = 'main audio service: karaoke'; - } - } - return (isset($AC3serviceTypeLookup[$bsmod][$acmod]) ? $AC3serviceTypeLookup[$bsmod][$acmod] : false); - } - - function AC3audioCodingModeLookup($acmod) { - static $AC3audioCodingModeLookup = array(); - if (empty($AC3audioCodingModeLookup)) { - // array(channel configuration, # channels (not incl LFE), channel order) - $AC3audioCodingModeLookup = array ( - 0 => array('channel_config'=>'1+1', 'num_channels'=>2, 'channel_order'=>'Ch1,Ch2'), - 1 => array('channel_config'=>'1/0', 'num_channels'=>1, 'channel_order'=>'C'), - 2 => array('channel_config'=>'2/0', 'num_channels'=>2, 'channel_order'=>'L,R'), - 3 => array('channel_config'=>'3/0', 'num_channels'=>3, 'channel_order'=>'L,C,R'), - 4 => array('channel_config'=>'2/1', 'num_channels'=>3, 'channel_order'=>'L,R,S'), - 5 => array('channel_config'=>'3/1', 'num_channels'=>4, 'channel_order'=>'L,C,R,S'), - 6 => array('channel_config'=>'2/2', 'num_channels'=>4, 'channel_order'=>'L,R,SL,SR'), - 7 => array('channel_config'=>'3/2', 'num_channels'=>5, 'channel_order'=>'L,C,R,SL,SR') - ); - } - return (isset($AC3audioCodingModeLookup[$acmod]) ? $AC3audioCodingModeLookup[$acmod] : false); - } - - function AC3centerMixLevelLookup($cmixlev) { - static $AC3centerMixLevelLookup; - if (empty($AC3centerMixLevelLookup)) { - $AC3centerMixLevelLookup = array( - 0 => pow(2, -3.0 / 6), // 0.707 (–3.0 dB) - 1 => pow(2, -4.5 / 6), // 0.595 (–4.5 dB) - 2 => pow(2, -6.0 / 6), // 0.500 (–6.0 dB) - 3 => 'reserved' - ); - } - return (isset($AC3centerMixLevelLookup[$cmixlev]) ? $AC3centerMixLevelLookup[$cmixlev] : false); - } - - function AC3surroundMixLevelLookup($surmixlev) { - static $AC3surroundMixLevelLookup; - if (empty($AC3surroundMixLevelLookup)) { - $AC3surroundMixLevelLookup = array( - 0 => pow(2, -3.0 / 6), - 1 => pow(2, -6.0 / 6), - 2 => 0, - 3 => 'reserved' - ); - } - return (isset($AC3surroundMixLevelLookup[$surmixlev]) ? $AC3surroundMixLevelLookup[$surmixlev] : false); - } - - function AC3dolbySurroundModeLookup($dsurmod) { - static $AC3dolbySurroundModeLookup = array( - 0 => 'not indicated', - 1 => 'Not Dolby Surround encoded', - 2 => 'Dolby Surround encoded', - 3 => 'reserved' - ); - return (isset($AC3dolbySurroundModeLookup[$dsurmod]) ? $AC3dolbySurroundModeLookup[$dsurmod] : false); - } - - function AC3channelsEnabledLookup($acmod, $lfeon) { - $AC3channelsEnabledLookup = array( - 'ch1'=>(bool) ($acmod == 0), - 'ch2'=>(bool) ($acmod == 0), - 'left'=>(bool) ($acmod > 1), - 'right'=>(bool) ($acmod > 1), - 'center'=>(bool) ($acmod & 0x01), - 'surround_mono'=>false, - 'surround_left'=>false, - 'surround_right'=>false, - 'lfe'=>$lfeon); - switch ($acmod) { - case 4: - case 5: - $AC3channelsEnabledLookup['surround_mono'] = true; - break; - case 6: - case 7: - $AC3channelsEnabledLookup['surround_left'] = true; - $AC3channelsEnabledLookup['surround_right'] = true; - break; - } - return $AC3channelsEnabledLookup; - } - - function AC3heavyCompression($compre) { - // The first four bits indicate gain changes in 6.02dB increments which can be - // implemented with an arithmetic shift operation. The following four bits - // indicate linear gain changes, and require a 5-bit multiply. - // We will represent the two 4-bit fields of compr as follows: - // X0 X1 X2 X3 . Y4 Y5 Y6 Y7 - // The meaning of the X values is most simply described by considering X to represent a 4-bit - // signed integer with values from –8 to +7. The gain indicated by X is then (X + 1) * 6.02 dB. The - // following table shows this in detail. - - // Meaning of 4 msb of compr - // 7 +48.16 dB - // 6 +42.14 dB - // 5 +36.12 dB - // 4 +30.10 dB - // 3 +24.08 dB - // 2 +18.06 dB - // 1 +12.04 dB - // 0 +6.02 dB - // -1 0 dB - // -2 –6.02 dB - // -3 –12.04 dB - // -4 –18.06 dB - // -5 –24.08 dB - // -6 –30.10 dB - // -7 –36.12 dB - // -8 –42.14 dB - - $fourbit = str_pad(decbin(($compre & 0xF0) >> 4), 4, '0', STR_PAD_LEFT); - if ($fourbit{0} == '1') { - $log_gain = -8 + bindec(substr($fourbit, 1)); - } else { - $log_gain = bindec(substr($fourbit, 1)); - } - $log_gain = ($log_gain + 1) * getid3_lib::RGADamplitude2dB(2); - - // The value of Y is a linear representation of a gain change of up to –6 dB. Y is considered to - // be an unsigned fractional integer, with a leading value of 1, or: 0.1 Y4 Y5 Y6 Y7 (base 2). Y can - // represent values between 0.111112 (or 31/32) and 0.100002 (or 1/2). Thus, Y can represent gain - // changes from –0.28 dB to –6.02 dB. - - $lin_gain = (16 + ($compre & 0x0F)) / 32; - - // The combination of X and Y values allows compr to indicate gain changes from - // 48.16 – 0.28 = +47.89 dB, to - // –42.14 – 6.02 = –48.16 dB. - - return $log_gain - $lin_gain; - } - - function AC3roomTypeLookup($roomtyp) { - static $AC3roomTypeLookup = array( - 0 => 'not indicated', - 1 => 'large room, X curve monitor', - 2 => 'small room, flat monitor', - 3 => 'reserved' - ); - return (isset($AC3roomTypeLookup[$roomtyp]) ? $AC3roomTypeLookup[$roomtyp] : false); - } - - function AC3frameSizeLookup($frmsizecod, $fscod) { - $padding = (bool) ($frmsizecod % 2); - $framesizeid = floor($frmsizecod / 2); - - static $AC3frameSizeLookup = array(); - if (empty($AC3frameSizeLookup)) { - $AC3frameSizeLookup = array ( - 0 => array(128, 138, 192), - 1 => array(40, 160, 174, 240), - 2 => array(48, 192, 208, 288), - 3 => array(56, 224, 242, 336), - 4 => array(64, 256, 278, 384), - 5 => array(80, 320, 348, 480), - 6 => array(96, 384, 416, 576), - 7 => array(112, 448, 486, 672), - 8 => array(128, 512, 556, 768), - 9 => array(160, 640, 696, 960), - 10 => array(192, 768, 834, 1152), - 11 => array(224, 896, 974, 1344), - 12 => array(256, 1024, 1114, 1536), - 13 => array(320, 1280, 1392, 1920), - 14 => array(384, 1536, 1670, 2304), - 15 => array(448, 1792, 1950, 2688), - 16 => array(512, 2048, 2228, 3072), - 17 => array(576, 2304, 2506, 3456), - 18 => array(640, 2560, 2786, 3840) - ); - } - if (($fscod == 1) && $padding) { - // frame lengths are padded by 1 word (16 bits) at 44100 - $AC3frameSizeLookup[$frmsizecod] += 2; - } - return (isset($AC3frameSizeLookup[$framesizeid][$fscod]) ? $AC3frameSizeLookup[$framesizeid][$fscod] : false); - } - - function AC3bitrateLookup($frmsizecod) { - $framesizeid = floor($frmsizecod / 2); - - static $AC3bitrateLookup = array( - 0 => 32000, - 1 => 40000, - 2 => 48000, - 3 => 56000, - 4 => 64000, - 5 => 80000, - 6 => 96000, - 7 => 112000, - 8 => 128000, - 9 => 160000, - 10 => 192000, - 11 => 224000, - 12 => 256000, - 13 => 320000, - 14 => 384000, - 15 => 448000, - 16 => 512000, - 17 => 576000, - 18 => 640000 - ); - return (isset($AC3bitrateLookup[$framesizeid]) ? $AC3bitrateLookup[$framesizeid] : false); - } - - -} - -?>
\ No newline at end of file diff --git a/getid3/module.audio.au.php b/getid3/module.audio.au.php deleted file mode 100644 index afbc75d..0000000 --- a/getid3/module.audio.au.php +++ /dev/null @@ -1,163 +0,0 @@ -<?php -///////////////////////////////////////////////////////////////// -/// getID3() by James Heinrich <info@getid3.org> // -// available at http://getid3.sourceforge.net // -// or http://www.getid3.org // -///////////////////////////////////////////////////////////////// -// See readme.txt for more details // -///////////////////////////////////////////////////////////////// -// // -// module.audio.au.php // -// module for analyzing AU files // -// dependencies: NONE // -// /// -///////////////////////////////////////////////////////////////// - - -class getid3_au -{ - - function getid3_au(&$fd, &$ThisFileInfo) { - - fseek($fd, $ThisFileInfo['avdataoffset'], SEEK_SET); - $AUheader = fread($fd, 8); - - if (substr($AUheader, 0, 4) != '.snd') { - $ThisFileInfo['error'][] = 'Expecting ".snd" at offset '.$ThisFileInfo['avdataoffset'].', found "'.substr($AUheader, 0, 4).'"'; - return false; - } - - // shortcut - $ThisFileInfo['au'] = array(); - $thisfile_au = &$ThisFileInfo['au']; - - $ThisFileInfo['fileformat'] = 'au'; - $ThisFileInfo['audio']['dataformat'] = 'au'; - $ThisFileInfo['audio']['bitrate_mode'] = 'cbr'; - $thisfile_au['encoding'] = 'ISO-8859-1'; - - $thisfile_au['header_length'] = getid3_lib::BigEndian2Int(substr($AUheader, 4, 4)); - $AUheader .= fread($fd, $thisfile_au['header_length'] - 8); - $ThisFileInfo['avdataoffset'] += $thisfile_au['header_length']; - - $thisfile_au['data_size'] = getid3_lib::BigEndian2Int(substr($AUheader, 8, 4)); - $thisfile_au['data_format_id'] = getid3_lib::BigEndian2Int(substr($AUheader, 12, 4)); - $thisfile_au['sample_rate'] = getid3_lib::BigEndian2Int(substr($AUheader, 16, 4)); - $thisfile_au['channels'] = getid3_lib::BigEndian2Int(substr($AUheader, 20, 4)); - $thisfile_au['comments']['comment'][] = trim(substr($AUheader, 24)); - - $thisfile_au['data_format'] = $this->AUdataFormatNameLookup($thisfile_au['data_format_id']); - $thisfile_au['used_bits_per_sample'] = $this->AUdataFormatUsedBitsPerSampleLookup($thisfile_au['data_format_id']); - if ($thisfile_au['bits_per_sample'] = $this->AUdataFormatBitsPerSampleLookup($thisfile_au['data_format_id'])) { - $ThisFileInfo['audio']['bits_per_sample'] = $thisfile_au['bits_per_sample']; - } else { - unset($thisfile_au['bits_per_sample']); - } - - $ThisFileInfo['audio']['sample_rate'] = $thisfile_au['sample_rate']; - $ThisFileInfo['audio']['channels'] = $thisfile_au['channels']; - - if (($ThisFileInfo['avdataoffset'] + $thisfile_au['data_size']) > $ThisFileInfo['avdataend']) { - $ThisFileInfo['warning'][] = 'Possible truncated file - expecting "'.$thisfile_au['data_size'].'" bytes of audio data, only found '.($ThisFileInfo['avdataend'] - $ThisFileInfo['avdataoffset']).' bytes"'; - } - - $ThisFileInfo['playtime_seconds'] = $thisfile_au['data_size'] / ($thisfile_au['sample_rate'] * $thisfile_au['channels'] * ($thisfile_au['used_bits_per_sample'] / 8)); - $ThisFileInfo['audio']['bitrate'] = ($thisfile_au['data_size'] * 8) / $ThisFileInfo['playtime_seconds']; - - return true; - } - - function AUdataFormatNameLookup($id) { - static $AUdataFormatNameLookup = array( - 0 => 'unspecified format', - 1 => '8-bit mu-law', - 2 => '8-bit linear', - 3 => '16-bit linear', - 4 => '24-bit linear', - 5 => '32-bit linear', - 6 => 'floating-point', - 7 => 'double-precision float', - 8 => 'fragmented sampled data', - 9 => 'SUN_FORMAT_NESTED', - 10 => 'DSP program', - 11 => '8-bit fixed-point', - 12 => '16-bit fixed-point', - 13 => '24-bit fixed-point', - 14 => '32-bit fixed-point', - - 16 => 'non-audio display data', - 17 => 'SND_FORMAT_MULAW_SQUELCH', - 18 => '16-bit linear with emphasis', - 19 => '16-bit linear with compression', - 20 => '16-bit linear with emphasis + compression', - 21 => 'Music Kit DSP commands', - 22 => 'SND_FORMAT_DSP_COMMANDS_SAMPLES', - 23 => 'CCITT g.721 4-bit ADPCM', - 24 => 'CCITT g.722 ADPCM', - 25 => 'CCITT g.723 3-bit ADPCM', - 26 => 'CCITT g.723 5-bit ADPCM', - 27 => 'A-Law 8-bit' - ); - return (isset($AUdataFormatNameLookup[$id]) ? $AUdataFormatNameLookup[$id] : false); - } - - function AUdataFormatBitsPerSampleLookup($id) { - static $AUdataFormatBitsPerSampleLookup = array( - 1 => 8, - 2 => 8, - 3 => 16, - 4 => 24, - 5 => 32, - 6 => 32, - 7 => 64, - - 11 => 8, - 12 => 16, - 13 => 24, - 14 => 32, - - 18 => 16, - 19 => 16, - 20 => 16, - - 23 => 16, - - 25 => 16, - 26 => 16, - 27 => 8 - ); - return (isset($AUdataFormatBitsPerSampleLookup[$id]) ? $AUdataFormatBitsPerSampleLookup[$id] : false); - } - - function AUdataFormatUsedBitsPerSampleLookup($id) { - static $AUdataFormatUsedBitsPerSampleLookup = array( - 1 => 8, - 2 => 8, - 3 => 16, - 4 => 24, - 5 => 32, - 6 => 32, - 7 => 64, - - 11 => 8, - 12 => 16, - 13 => 24, - 14 => 32, - - 18 => 16, - 19 => 16, - 20 => 16, - - 23 => 4, - - 25 => 3, - 26 => 5, - 27 => 8, - ); - return (isset($AUdataFormatUsedBitsPerSampleLookup[$id]) ? $AUdataFormatUsedBitsPerSampleLookup[$id] : false); - } - -} - - -?>
\ No newline at end of file diff --git a/getid3/module.audio.avr.php b/getid3/module.audio.avr.php deleted file mode 100644 index 6099439..0000000 --- a/getid3/module.audio.avr.php +++ /dev/null @@ -1,125 +0,0 @@ -<?php -///////////////////////////////////////////////////////////////// -/// getID3() by James Heinrich <info@getid3.org> // -// available at http://getid3.sourceforge.net // -// or http://www.getid3.org // -///////////////////////////////////////////////////////////////// -// See readme.txt for more details // -///////////////////////////////////////////////////////////////// -// // -// module.audio.avr.php // -// module for analyzing AVR Audio files // -// dependencies: NONE // -// /// -///////////////////////////////////////////////////////////////// - - -class getid3_avr -{ - - function getid3_avr(&$fd, &$ThisFileInfo) { - - // http://cui.unige.ch/OSG/info/AudioFormats/ap11.html - // http://www.btinternet.com/~AnthonyJ/Atari/programming/avr_format.html - // offset type length name comments - // --------------------------------------------------------------------- - // 0 char 4 ID format ID == "2BIT" - // 4 char 8 name sample name (unused space filled with 0) - // 12 short 1 mono/stereo 0=mono, -1 (0xFFFF)=stereo - // With stereo, samples are alternated, - // the first voice is the left : - // (LRLRLRLRLRLRLRLRLR...) - // 14 short 1 resolution 8, 12 or 16 (bits) - // 16 short 1 signed or not 0=unsigned, -1 (0xFFFF)=signed - // 18 short 1 loop or not 0=no loop, -1 (0xFFFF)=loop on - // 20 short 1 MIDI note 0xFFnn, where 0 <= nn <= 127 - // 0xFFFF means "no MIDI note defined" - // 22 byte 1 Replay speed Frequence in the Replay software - // 0=5.485 Khz, 1=8.084 Khz, 2=10.971 Khz, - // 3=16.168 Khz, 4=21.942 Khz, 5=32.336 Khz - // 6=43.885 Khz, 7=47.261 Khz - // -1 (0xFF)=no defined Frequence - // 23 byte 3 sample rate in Hertz - // 26 long 1 size in bytes (2 * bytes in stereo) - // 30 long 1 loop begin 0 for no loop - // 34 long 1 loop size equal to 'size' for no loop - // 38 short 2 Reserved, MIDI keyboard split */ - // 40 short 2 Reserved, sample compression */ - // 42 short 2 Reserved */ - // 44 char 20; Additional filename space, used if (name[7] != 0) - // 64 byte 64 user data - // 128 bytes ? sample data (12 bits samples are coded on 16 bits: - // 0000 xxxx xxxx xxxx) - // --------------------------------------------------------------------- - - // Note that all values are in motorola (big-endian) format, and that long is - // assumed to be 4 bytes, and short 2 bytes. - // When reading the samples, you should handle both signed and unsigned data, - // and be prepared to convert 16->8 bit, or mono->stereo if needed. To convert - // 8-bit data between signed/unsigned just add 127 to the sample values. - // Simularly for 16-bit data you should add 32769 - - $ThisFileInfo['fileformat'] = 'avr'; - - fseek($fd, $ThisFileInfo['avdataoffset'], SEEK_SET); - $AVRheader = fread($fd, 128); - - $ThisFileInfo['avr']['raw']['magic'] = substr($AVRheader, 0, 4); - if ($ThisFileInfo['avr']['raw']['magic'] != '2BIT') { - $ThisFileInfo['error'][] = 'Expecting "2BIT" at offset '.$ThisFileInfo['avdataoffset'].', found "'.$ThisFileInfo['avr']['raw']['magic'].'"'; - unset($ThisFileInfo['fileformat']); - unset($ThisFileInfo['avr']); - return false; - } - $ThisFileInfo['avdataoffset'] += 128; - - $ThisFileInfo['avr']['sample_name'] = rtrim(substr($AVRheader, 4, 8)); - $ThisFileInfo['avr']['raw']['mono'] = getid3_lib::BigEndian2Int(substr($AVRheader, 12, 2)); - $ThisFileInfo['avr']['bits_per_sample'] = getid3_lib::BigEndian2Int(substr($AVRheader, 14, 2)); - $ThisFileInfo['avr']['raw']['signed'] = getid3_lib::BigEndian2Int(substr($AVRheader, 16, 2)); - $ThisFileInfo['avr']['raw']['loop'] = getid3_lib::BigEndian2Int(substr($AVRheader, 18, 2)); - $ThisFileInfo['avr']['raw']['midi'] = getid3_lib::BigEndian2Int(substr($AVRheader, 20, 2)); - $ThisFileInfo['avr']['raw']['replay_freq'] = getid3_lib::BigEndian2Int(substr($AVRheader, 22, 1)); - $ThisFileInfo['avr']['sample_rate'] = getid3_lib::BigEndian2Int(substr($AVRheader, 23, 3)); - $ThisFileInfo['avr']['sample_length'] = getid3_lib::BigEndian2Int(substr($AVRheader, 26, 4)); - $ThisFileInfo['avr']['loop_start'] = getid3_lib::BigEndian2Int(substr($AVRheader, 30, 4)); - $ThisFileInfo['avr']['loop_end'] = getid3_lib::BigEndian2Int(substr($AVRheader, 34, 4)); - $ThisFileInfo['avr']['midi_split'] = getid3_lib::BigEndian2Int(substr($AVRheader, 38, 2)); - $ThisFileInfo['avr']['sample_compression'] = getid3_lib::BigEndian2Int(substr($AVRheader, 40, 2)); - $ThisFileInfo['avr']['reserved'] = getid3_lib::BigEndian2Int(substr($AVRheader, 42, 2)); - $ThisFileInfo['avr']['sample_name_extra'] = rtrim(substr($AVRheader, 44, 20)); - $ThisFileInfo['avr']['comment'] = rtrim(substr($AVRheader, 64, 64)); - - $ThisFileInfo['avr']['flags']['stereo'] = (($ThisFileInfo['avr']['raw']['mono'] == 0) ? false : true); - $ThisFileInfo['avr']['flags']['signed'] = (($ThisFileInfo['avr']['raw']['signed'] == 0) ? false : true); - $ThisFileInfo['avr']['flags']['loop'] = (($ThisFileInfo['avr']['raw']['loop'] == 0) ? false : true); - - $ThisFileInfo['avr']['midi_notes'] = array(); - if (($ThisFileInfo['avr']['raw']['midi'] & 0xFF00) != 0xFF00) { - $ThisFileInfo['avr']['midi_notes'][] = ($ThisFileInfo['avr']['raw']['midi'] & 0xFF00) >> 8; - } - if (($ThisFileInfo['avr']['raw']['midi'] & 0x00FF) != 0x00FF) { - $ThisFileInfo['avr']['midi_notes'][] = ($ThisFileInfo['avr']['raw']['midi'] & 0x00FF); - } - - if (($ThisFileInfo['avdataend'] - $ThisFileInfo['avdataoffset']) != ($ThisFileInfo['avr']['sample_length'] * (($ThisFileInfo['avr']['bits_per_sample'] == 8) ? 1 : 2))) { - $ThisFileInfo['warning'][] = 'Probable truncated file: expecting '.($ThisFileInfo['avr']['sample_length'] * (($ThisFileInfo['avr']['bits_per_sample'] == 8) ? 1 : 2)).' bytes of audio data, found '.($ThisFileInfo['avdataend'] - $ThisFileInfo['avdataoffset']); - } - - $ThisFileInfo['audio']['dataformat'] = 'avr'; - $ThisFileInfo['audio']['lossless'] = true; - $ThisFileInfo['audio']['bitrate_mode'] = 'cbr'; - $ThisFileInfo['audio']['bits_per_sample'] = $ThisFileInfo['avr']['bits_per_sample']; - $ThisFileInfo['audio']['sample_rate'] = $ThisFileInfo['avr']['sample_rate']; - $ThisFileInfo['audio']['channels'] = ($ThisFileInfo['avr']['flags']['stereo'] ? 2 : 1); - $ThisFileInfo['playtime_seconds'] = ($ThisFileInfo['avr']['sample_length'] / $ThisFileInfo['audio']['channels']) / $ThisFileInfo['avr']['sample_rate']; - $ThisFileInfo['audio']['bitrate'] = ($ThisFileInfo['avr']['sample_length'] * (($ThisFileInfo['avr']['bits_per_sample'] == 8) ? 8 : 16)) / $ThisFileInfo['playtime_seconds']; - - - return true; - } - -} - - -?>
\ No newline at end of file diff --git a/getid3/module.audio.bonk.php b/getid3/module.audio.bonk.php deleted file mode 100644 index fef9782..0000000 --- a/getid3/module.audio.bonk.php +++ /dev/null @@ -1,221 +0,0 @@ -<?php -///////////////////////////////////////////////////////////////// -/// getID3() by James Heinrich <info@getid3.org> // -// available at http://getid3.sourceforge.net // -// or http://www.getid3.org // -///////////////////////////////////////////////////////////////// -// See readme.txt for more details // -///////////////////////////////////////////////////////////////// -// // -// module.audio.la.php // -// module for analyzing BONK audio files // -// dependencies: module.tag.id3v2.php (optional) // -// /// -///////////////////////////////////////////////////////////////// - - -class getid3_bonk -{ - function getid3_bonk(&$fd, &$ThisFileInfo) { - - // shortcut - $ThisFileInfo['bonk'] = array(); - $thisfile_bonk = &$ThisFileInfo['bonk']; - - $thisfile_bonk['dataoffset'] = $ThisFileInfo['avdataoffset']; - $thisfile_bonk['dataend'] = $ThisFileInfo['avdataend']; - - if ($thisfile_bonk['dataend'] >= pow(2, 31)) { - - $ThisFileInfo['warning'][] = 'Unable to parse BONK file from end (v0.6+ preferred method) because PHP filesystem functions only support up to 2GB'; - - } else { - - // scan-from-end method, for v0.6 and higher - fseek($fd, $thisfile_bonk['dataend'] - 8, SEEK_SET); - $PossibleBonkTag = fread($fd, 8); - while ($this->BonkIsValidTagName(substr($PossibleBonkTag, 4, 4), true)) { - $BonkTagSize = getid3_lib::LittleEndian2Int(substr($PossibleBonkTag, 0, 4)); - fseek($fd, 0 - $BonkTagSize, SEEK_CUR); - $BonkTagOffset = ftell($fd); - $TagHeaderTest = fread($fd, 5); - if (($TagHeaderTest{0} != "\x00") || (substr($PossibleBonkTag, 4, 4) != strtolower(substr($PossibleBonkTag, 4, 4)))) { - $ThisFileInfo['error'][] = 'Expecting "Ø'.strtoupper(substr($PossibleBonkTag, 4, 4)).'" at offset '.$BonkTagOffset.', found "'.$TagHeaderTest.'"'; - return false; - } - $BonkTagName = substr($TagHeaderTest, 1, 4); - - $thisfile_bonk[$BonkTagName]['size'] = $BonkTagSize; - $thisfile_bonk[$BonkTagName]['offset'] = $BonkTagOffset; - $this->HandleBonkTags($fd, $BonkTagName, $ThisFileInfo); - $NextTagEndOffset = $BonkTagOffset - 8; - if ($NextTagEndOffset < $thisfile_bonk['dataoffset']) { - if (empty($ThisFileInfo['audio']['encoder'])) { - $ThisFileInfo['audio']['encoder'] = 'Extended BONK v0.9+'; - } - return true; - } - fseek($fd, $NextTagEndOffset, SEEK_SET); - $PossibleBonkTag = fread($fd, 8); - } - - } - - // seek-from-beginning method for v0.4 and v0.5 - if (empty($thisfile_bonk['BONK'])) { - fseek($fd, $thisfile_bonk['dataoffset'], SEEK_SET); - do { - $TagHeaderTest = fread($fd, 5); - switch ($TagHeaderTest) { - case "\x00".'BONK': - if (empty($ThisFileInfo['audio']['encoder'])) { - $ThisFileInfo['audio']['encoder'] = 'BONK v0.4'; - } - break; - - case "\x00".'INFO': - $ThisFileInfo['audio']['encoder'] = 'Extended BONK v0.5'; - break; - - default: - break 2; - } - $BonkTagName = substr($TagHeaderTest, 1, 4); - $thisfile_bonk[$BonkTagName]['size'] = $thisfile_bonk['dataend'] - $thisfile_bonk['dataoffset']; - $thisfile_bonk[$BonkTagName]['offset'] = $thisfile_bonk['dataoffset']; - $this->HandleBonkTags($fd, $BonkTagName, $ThisFileInfo); - - } while (true); - } - - // parse META block for v0.6 - v0.8 - if (empty($thisfile_bonk['INFO']) && isset($thisfile_bonk['META']['tags']['info'])) { - fseek($fd, $thisfile_bonk['META']['tags']['info'], SEEK_SET); - $TagHeaderTest = fread($fd, 5); - if ($TagHeaderTest == "\x00".'INFO') { - $ThisFileInfo['audio']['encoder'] = 'Extended BONK v0.6 - v0.8'; - - $BonkTagName = substr($TagHeaderTest, 1, 4); - $thisfile_bonk[$BonkTagName]['size'] = $thisfile_bonk['dataend'] - $thisfile_bonk['dataoffset']; - $thisfile_bonk[$BonkTagName]['offset'] = $thisfile_bonk['dataoffset']; - $this->HandleBonkTags($fd, $BonkTagName, $ThisFileInfo); - } - } - - if (empty($ThisFileInfo['audio']['encoder'])) { - $ThisFileInfo['audio']['encoder'] = 'Extended BONK v0.9+'; - } - if (empty($thisfile_bonk['BONK'])) { - unset($ThisFileInfo['bonk']); - } - return true; - - } - - function HandleBonkTags(&$fd, &$BonkTagName, &$ThisFileInfo) { - - switch ($BonkTagName) { - case 'BONK': - // shortcut - $thisfile_bonk_BONK = &$ThisFileInfo['bonk']['BONK']; - - $BonkData = "\x00".'BONK'.fread($fd, 17); - $thisfile_bonk_BONK['version'] = getid3_lib::LittleEndian2Int(substr($BonkData, 5, 1)); - $thisfile_bonk_BONK['number_samples'] = getid3_lib::LittleEndian2Int(substr($BonkData, 6, 4)); - $thisfile_bonk_BONK['sample_rate'] = getid3_lib::LittleEndian2Int(substr($BonkData, 10, 4)); - - $thisfile_bonk_BONK['channels'] = getid3_lib::LittleEndian2Int(substr($BonkData, 14, 1)); - $thisfile_bonk_BONK['lossless'] = (bool) getid3_lib::LittleEndian2Int(substr($BonkData, 15, 1)); - $thisfile_bonk_BONK['joint_stereo'] = (bool) getid3_lib::LittleEndian2Int(substr($BonkData, 16, 1)); - $thisfile_bonk_BONK['number_taps'] = getid3_lib::LittleEndian2Int(substr($BonkData, 17, 2)); - $thisfile_bonk_BONK['downsampling_ratio'] = getid3_lib::LittleEndian2Int(substr($BonkData, 19, 1)); - $thisfile_bonk_BONK['samples_per_packet'] = getid3_lib::LittleEndian2Int(substr($BonkData, 20, 2)); - - $ThisFileInfo['avdataoffset'] = $thisfile_bonk_BONK['offset'] + 5 + 17; - $ThisFileInfo['avdataend'] = $thisfile_bonk_BONK['offset'] + $thisfile_bonk_BONK['size']; - - $ThisFileInfo['fileformat'] = 'bonk'; - $ThisFileInfo['audio']['dataformat'] = 'bonk'; - $ThisFileInfo['audio']['bitrate_mode'] = 'vbr'; // assumed - $ThisFileInfo['audio']['channels'] = $thisfile_bonk_BONK['channels']; - $ThisFileInfo['audio']['sample_rate'] = $thisfile_bonk_BONK['sample_rate']; - $ThisFileInfo['audio']['channelmode'] = ($thisfile_bonk_BONK['joint_stereo'] ? 'joint stereo' : 'stereo'); - $ThisFileInfo['audio']['lossless'] = $thisfile_bonk_BONK['lossless']; - $ThisFileInfo['audio']['codec'] = 'bonk'; - - $ThisFileInfo['playtime_seconds'] = $thisfile_bonk_BONK['number_samples'] / ($thisfile_bonk_BONK['sample_rate'] * $thisfile_bonk_BONK['channels']); - if ($ThisFileInfo['playtime_seconds'] > 0) { - $ThisFileInfo['audio']['bitrate'] = (($ThisFileInfo['bonk']['dataend'] - $ThisFileInfo['bonk']['dataoffset']) * 8) / $ThisFileInfo['playtime_seconds']; - } - break; - - case 'INFO': - // shortcut - $thisfile_bonk_INFO = &$ThisFileInfo['bonk']['INFO']; - - $thisfile_bonk_INFO['version'] = getid3_lib::LittleEndian2Int(fread($fd, 1)); - $thisfile_bonk_INFO['entries_count'] = 0; - $NextInfoDataPair = fread($fd, 5); - if (!$this->BonkIsValidTagName(substr($NextInfoDataPair, 1, 4))) { - while (!feof($fd)) { - //$CurrentSeekInfo['offset'] = getid3_lib::LittleEndian2Int(substr($NextInfoDataPair, 0, 4)); - //$CurrentSeekInfo['nextbit'] = getid3_lib::LittleEndian2Int(substr($NextInfoDataPair, 4, 1)); - //$thisfile_bonk_INFO[] = $CurrentSeekInfo; - - $NextInfoDataPair = fread($fd, 5); - if ($this->BonkIsValidTagName(substr($NextInfoDataPair, 1, 4))) { - fseek($fd, -5, SEEK_CUR); - break; - } - $thisfile_bonk_INFO['entries_count']++; - } - } - break; - - case 'META': - $BonkData = "\x00".'META'.fread($fd, $ThisFileInfo['bonk']['META']['size'] - 5); - $ThisFileInfo['bonk']['META']['version'] = getid3_lib::LittleEndian2Int(substr($BonkData, 5, 1)); - - $MetaTagEntries = floor(((strlen($BonkData) - 8) - 6) / 8); // BonkData - xxxxmeta - ØMETA - $offset = 6; - for ($i = 0; $i < $MetaTagEntries; $i++) { - $MetaEntryTagName = substr($BonkData, $offset, 4); - $offset += 4; - $MetaEntryTagOffset = getid3_lib::LittleEndian2Int(substr($BonkData, $offset, 4)); - $offset += 4; - $ThisFileInfo['bonk']['META']['tags'][$MetaEntryTagName] = $MetaEntryTagOffset; - } - break; - - case ' ID3': - $ThisFileInfo['audio']['encoder'] = 'Extended BONK v0.9+'; - - // ID3v2 checking is optional - if (class_exists('getid3_id3v2')) { - $ThisFileInfo['bonk'][' ID3']['valid'] = new getid3_id3v2($fd, $ThisFileInfo, $ThisFileInfo['bonk'][' ID3']['offset'] + 2); - } - break; - - default: - $ThisFileInfo['warning'][] = 'Unexpected Bonk tag "'.$BonkTagName.'" at offset '.$ThisFileInfo['bonk'][$BonkTagName]['offset']; - break; - - } - } - - function BonkIsValidTagName($PossibleBonkTag, $ignorecase=false) { - static $BonkIsValidTagName = array('BONK', 'INFO', ' ID3', 'META'); - foreach ($BonkIsValidTagName as $validtagname) { - if ($validtagname == $PossibleBonkTag) { - return true; - } elseif ($ignorecase && (strtolower($validtagname) == strtolower($PossibleBonkTag))) { - return true; - } - } - return false; - } - -} - - -?>
\ No newline at end of file diff --git a/getid3/module.audio.dss.php b/getid3/module.audio.dss.php deleted file mode 100644 index b088739..0000000 --- a/getid3/module.audio.dss.php +++ /dev/null @@ -1,72 +0,0 @@ -<?php -///////////////////////////////////////////////////////////////// -/// getID3() by James Heinrich <info@getid3.org> // -// available at http://getid3.sourceforge.net // -// or http://www.getid3.org // -///////////////////////////////////////////////////////////////// -// See readme.txt for more details // -///////////////////////////////////////////////////////////////// -// // -// module.audio.au.php // -// module for analyzing Digital Speech Standard (DSS) files // -// dependencies: NONE // -// /// -///////////////////////////////////////////////////////////////// - - -class getid3_dss -{ - - function getid3_dss(&$fd, &$ThisFileInfo) { - - fseek($fd, $ThisFileInfo['avdataoffset'], SEEK_SET); - $DSSheader = fread($fd, 1256); - - if (substr($DSSheader, 0, 4) != "\x02".'dss') { - $ThisFileInfo['error'][] = 'Expecting "[x02]dss" at offset '.$ThisFileInfo['avdataoffset'].', found "'.substr($DSSheader, 0, 4).'"'; - return false; - } - - // some structure information taken from http://cpansearch.perl.org/src/RGIBSON/Audio-DSS-0.02/lib/Audio/DSS.pm - - // shortcut - $ThisFileInfo['dss'] = array(); - $thisfile_dss = &$ThisFileInfo['dss']; - - $ThisFileInfo['fileformat'] = 'dss'; - $ThisFileInfo['audio']['dataformat'] = 'dss'; - $ThisFileInfo['audio']['bitrate_mode'] = 'cbr'; - //$thisfile_dss['encoding'] = 'ISO-8859-1'; - - $thisfile_dss['date_create'] = $this->DSSdateStringToUnixDate(substr($DSSheader, 38, 12)); - $thisfile_dss['date_complete'] = $this->DSSdateStringToUnixDate(substr($DSSheader, 50, 12)); - $thisfile_dss['length'] = intval(substr($DSSheader, 62, 6)); - $thisfile_dss['priority'] = ord(substr($DSSheader, 793, 1)); - $thisfile_dss['comments'] = trim(substr($DSSheader, 798, 100)); - - - //$ThisFileInfo['audio']['bits_per_sample'] = ?; - //$ThisFileInfo['audio']['sample_rate'] = ?; - $ThisFileInfo['audio']['channels'] = 1; - - $ThisFileInfo['playtime_seconds'] = $thisfile_dss['length']; - $ThisFileInfo['audio']['bitrate'] = ($ThisFileInfo['filesize'] * 8) / $ThisFileInfo['playtime_seconds']; - - return true; - } - - function DSSdateStringToUnixDate($datestring) { - $y = substr($datestring, 0, 2); - $m = substr($datestring, 2, 2); - $d = substr($datestring, 4, 2); - $h = substr($datestring, 6, 2); - $i = substr($datestring, 8, 2); - $s = substr($datestring, 10, 2); - $y += (($y < 95) ? 2000 : 1900); - return mktime($h, $i, $s, $m, $d, $y); - } - -} - - -?>
\ No newline at end of file diff --git a/getid3/module.audio.dts.php b/getid3/module.audio.dts.php deleted file mode 100644 index 1af67fd..0000000 --- a/getid3/module.audio.dts.php +++ /dev/null @@ -1,239 +0,0 @@ -<?php -///////////////////////////////////////////////////////////////// -/// getID3() by James Heinrich <info@getid3.org> // -// available at http://getid3.sourceforge.net // -// or http://www.getid3.org // -///////////////////////////////////////////////////////////////// -// See readme.txt for more details // -///////////////////////////////////////////////////////////////// -// // -// module.audio.dts.php // -// module for analyzing DTS Audio files // -// dependencies: NONE // -// // -///////////////////////////////////////////////////////////////// - - -class getid3_dts -{ - - function getid3_dts(&$fd, &$ThisFileInfo) { - // Specs taken from "DTS Coherent Acoustics;Core and Extensions, ETSI TS 102 114 V1.2.1 (2002-12)" - // (http://pda.etsi.org/pda/queryform.asp) - // With thanks to Gambit <macteam@users.sourceforge.net> http://mac.sourceforge.net/atl/ - - $ThisFileInfo['fileformat'] = 'dts'; - - fseek($fd, $ThisFileInfo['avdataoffset'], SEEK_SET); - $DTSheader = fread($fd, 16); - - $ThisFileInfo['dts']['raw']['magic'] = getid3_lib::BigEndian2Int(substr($DTSheader, 0, 4)); - if ($ThisFileInfo['dts']['raw']['magic'] != 0x7FFE8001) { - $ThisFileInfo['error'][] = 'Expecting "0x7FFE8001" at offset '.$ThisFileInfo['avdataoffset'].', found "0x'.str_pad(strtoupper(dechex($ThisFileInfo['dts']['raw']['magic'])), 8, '0', STR_PAD_LEFT).'"'; - unset($ThisFileInfo['fileformat']); - unset($ThisFileInfo['dts']); - return false; - } - - $fhBS = getid3_lib::BigEndian2Bin(substr($DTSheader, 4, 12)); - $bsOffset = 0; - $ThisFileInfo['dts']['raw']['frame_type'] = bindec(substr($fhBS, $bsOffset, 1)); $bsOffset += 1; - $ThisFileInfo['dts']['raw']['deficit_samples'] = bindec(substr($fhBS, $bsOffset, 5)); $bsOffset += 5; - $ThisFileInfo['dts']['flags']['crc_present'] = (bool) bindec(substr($fhBS, $bsOffset, 1)); $bsOffset += 1; - $ThisFileInfo['dts']['raw']['pcm_sample_blocks'] = bindec(substr($fhBS, $bsOffset, 7)); $bsOffset += 7; - $ThisFileInfo['dts']['raw']['frame_byte_size'] = bindec(substr($fhBS, $bsOffset, 14)); $bsOffset += 14; - $ThisFileInfo['dts']['raw']['channel_arrangement'] = bindec(substr($fhBS, $bsOffset, 6)); $bsOffset += 6; - $ThisFileInfo['dts']['raw']['sample_frequency'] = bindec(substr($fhBS, $bsOffset, 4)); $bsOffset += 4; - $ThisFileInfo['dts']['raw']['bitrate'] = bindec(substr($fhBS, $bsOffset, 5)); $bsOffset += 5; - $ThisFileInfo['dts']['flags']['embedded_downmix'] = (bool) bindec(substr($fhBS, $bsOffset, 1)); $bsOffset += 1; - $ThisFileInfo['dts']['flags']['dynamicrange'] = (bool) bindec(substr($fhBS, $bsOffset, 1)); $bsOffset += 1; - $ThisFileInfo['dts']['flags']['timestamp'] = (bool) bindec(substr($fhBS, $bsOffset, 1)); $bsOffset += 1; - $ThisFileInfo['dts']['flags']['auxdata'] = (bool) bindec(substr($fhBS, $bsOffset, 1)); $bsOffset += 1; - $ThisFileInfo['dts']['flags']['hdcd'] = (bool) bindec(substr($fhBS, $bsOffset, 1)); $bsOffset += 1; - $ThisFileInfo['dts']['raw']['extension_audio'] = bindec(substr($fhBS, $bsOffset, 3)); $bsOffset += 3; - $ThisFileInfo['dts']['flags']['extended_coding'] = (bool) bindec(substr($fhBS, $bsOffset, 1)); $bsOffset += 1; - $ThisFileInfo['dts']['flags']['audio_sync_insertion'] = (bool) bindec(substr($fhBS, $bsOffset, 1)); $bsOffset += 1; - $ThisFileInfo['dts']['raw']['lfe_effects'] = bindec(substr($fhBS, $bsOffset, 2)); $bsOffset += 2; - $ThisFileInfo['dts']['flags']['predictor_history'] = (bool) bindec(substr($fhBS, $bsOffset, 1)); $bsOffset += 1; - if ($ThisFileInfo['dts']['flags']['crc_present']) { - $ThisFileInfo['dts']['raw']['crc16'] = bindec(substr($fhBS, $bsOffset, 16)); $bsOffset += 16; - } - $ThisFileInfo['dts']['flags']['mri_perfect_reconst'] = (bool) bindec(substr($fhBS, $bsOffset, 1)); $bsOffset += 1; - $ThisFileInfo['dts']['raw']['encoder_soft_version'] = bindec(substr($fhBS, $bsOffset, 4)); $bsOffset += 4; - $ThisFileInfo['dts']['raw']['copy_history'] = bindec(substr($fhBS, $bsOffset, 2)); $bsOffset += 2; - $ThisFileInfo['dts']['raw']['bits_per_sample'] = bindec(substr($fhBS, $bsOffset, 2)); $bsOffset += 2; - $ThisFileInfo['dts']['flags']['surround_es'] = (bool) bindec(substr($fhBS, $bsOffset, 1)); $bsOffset += 1; - $ThisFileInfo['dts']['flags']['front_sum_diff'] = (bool) bindec(substr($fhBS, $bsOffset, 1)); $bsOffset += 1; - $ThisFileInfo['dts']['flags']['surround_sum_diff'] = (bool) bindec(substr($fhBS, $bsOffset, 1)); $bsOffset += 1; - $ThisFileInfo['dts']['raw']['dialog_normalization'] = bindec(substr($fhBS, $bsOffset, 4)); $bsOffset += 4; - - - $ThisFileInfo['dts']['bitrate'] = $this->DTSbitrateLookup($ThisFileInfo['dts']['raw']['bitrate']); - $ThisFileInfo['dts']['bits_per_sample'] = $this->DTSbitPerSampleLookup($ThisFileInfo['dts']['raw']['bits_per_sample']); - $ThisFileInfo['dts']['sample_rate'] = $this->DTSsampleRateLookup($ThisFileInfo['dts']['raw']['sample_frequency']); - $ThisFileInfo['dts']['dialog_normalization'] = $this->DTSdialogNormalization($ThisFileInfo['dts']['raw']['dialog_normalization'], $ThisFileInfo['dts']['raw']['encoder_soft_version']); - $ThisFileInfo['dts']['flags']['lossless'] = (($ThisFileInfo['dts']['raw']['bitrate'] == 31) ? true : false); - $ThisFileInfo['dts']['bitrate_mode'] = (($ThisFileInfo['dts']['raw']['bitrate'] == 30) ? 'vbr' : 'cbr'); - $ThisFileInfo['dts']['channels'] = $this->DTSnumChannelsLookup($ThisFileInfo['dts']['raw']['channel_arrangement']); - $ThisFileInfo['dts']['channel_arrangement'] = $this->DTSchannelArrangementLookup($ThisFileInfo['dts']['raw']['channel_arrangement']); - - $ThisFileInfo['audio']['dataformat'] = 'dts'; - $ThisFileInfo['audio']['lossless'] = $ThisFileInfo['dts']['flags']['lossless']; - $ThisFileInfo['audio']['bitrate_mode'] = $ThisFileInfo['dts']['bitrate_mode']; - $ThisFileInfo['audio']['bits_per_sample'] = $ThisFileInfo['dts']['bits_per_sample']; - $ThisFileInfo['audio']['sample_rate'] = $ThisFileInfo['dts']['sample_rate']; - $ThisFileInfo['audio']['channels'] = $ThisFileInfo['dts']['channels']; - $ThisFileInfo['audio']['bitrate'] = $ThisFileInfo['dts']['bitrate']; - if (isset($ThisFileInfo['avdataend'])) { - $ThisFileInfo['playtime_seconds'] = ($ThisFileInfo['avdataend'] - $ThisFileInfo['avdataoffset']) / ($ThisFileInfo['dts']['bitrate'] / 8); - } - - return true; - } - - function DTSbitrateLookup($index) { - $DTSbitrateLookup = array( - 0 => 32000, - 1 => 56000, - 2 => 64000, - 3 => 96000, - 4 => 112000, - 5 => 128000, - 6 => 192000, - 7 => 224000, - 8 => 256000, - 9 => 320000, - 10 => 384000, - 11 => 448000, - 12 => 512000, - 13 => 576000, - 14 => 640000, - 15 => 768000, - 16 => 960000, - 17 => 1024000, - 18 => 1152000, - 19 => 1280000, - 20 => 1344000, - 21 => 1408000, - 22 => 1411200, - 23 => 1472000, - 24 => 1536000, - 25 => 1920000, - 26 => 2048000, - 27 => 3072000, - 28 => 3840000, - 29 => 'open', - 30 => 'variable', - 31 => 'lossless' - ); - return @$DTSbitrateLookup[$index]; - } - - function DTSsampleRateLookup($index) { - $DTSsampleRateLookup = array( - 0 => 'invalid', - 1 => 8000, - 2 => 16000, - 3 => 32000, - 4 => 'invalid', - 5 => 'invalid', - 6 => 11025, - 7 => 22050, - 8 => 44100, - 9 => 'invalid', - 10 => 'invalid', - 11 => 12000, - 12 => 24000, - 13 => 48000, - 14 => 'invalid', - 15 => 'invalid' - ); - return @$DTSsampleRateLookup[$index]; - } - - function DTSbitPerSampleLookup($index) { - $DTSbitPerSampleLookup = array( - 0 => 16, - 1 => 20, - 2 => 24, - 3 => 24, - ); - return @$DTSbitPerSampleLookup[$index]; - } - - function DTSnumChannelsLookup($index) { - switch ($index) { - case 0: - return 1; - break; - case 1: - case 2: - case 3: - case 4: - return 2; - break; - case 5: - case 6: - return 3; - break; - case 7: - case 8: - return 4; - break; - case 9: - return 5; - break; - case 10: - case 11: - case 12: - return 6; - break; - case 13: - return 7; - break; - case 14: - case 15: - return 8; - break; - } - return false; - } - - function DTSchannelArrangementLookup($index) { - $DTSchannelArrangementLookup = array( - 0 => 'A', - 1 => 'A + B (dual mono)', - 2 => 'L + R (stereo)', - 3 => '(L+R) + (L-R) (sum-difference)', - 4 => 'LT + RT (left and right total)', - 5 => 'C + L + R', - 6 => 'L + R + S', - 7 => 'C + L + R + S', - 8 => 'L + R + SL + SR', - 9 => 'C + L + R + SL + SR', - 10 => 'CL + CR + L + R + SL + SR', - 11 => 'C + L + R+ LR + RR + OV', - 12 => 'CF + CR + LF + RF + LR + RR', - 13 => 'CL + C + CR + L + R + SL + SR', - 14 => 'CL + CR + L + R + SL1 + SL2 + SR1 + SR2', - 15 => 'CL + C+ CR + L + R + SL + S + SR', - ); - return (@$DTSchannelArrangementLookup[$index] ? @$DTSchannelArrangementLookup[$index] : 'user-defined'); - } - - function DTSdialogNormalization($index, $version) { - switch ($version) { - case 7: - return 0 - $index; - break; - case 6: - return 0 - 16 - $index; - break; - } - return false; - } - -} - - -?>
\ No newline at end of file diff --git a/getid3/module.audio.flac.php b/getid3/module.audio.flac.php deleted file mode 100644 index 5ef431e..0000000 --- a/getid3/module.audio.flac.php +++ /dev/null @@ -1,397 +0,0 @@ -<?php -///////////////////////////////////////////////////////////////// -/// getID3() by James Heinrich <info@getid3.org> // -// available at http://getid3.sourceforge.net // -// or http://www.getid3.org // -///////////////////////////////////////////////////////////////// -// See readme.txt for more details // -///////////////////////////////////////////////////////////////// -// // -// module.audio.flac.php // -// module for analyzing FLAC and OggFLAC audio files // -// dependencies: module.audio.ogg.php // -// /// -///////////////////////////////////////////////////////////////// - - -getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio.ogg.php', __FILE__, true); - -class getid3_flac -{ - - function getid3_flac(&$fd, &$ThisFileInfo) { - // http://flac.sourceforge.net/format.html - - fseek($fd, $ThisFileInfo['avdataoffset'], SEEK_SET); - $StreamMarker = fread($fd, 4); - if ($StreamMarker != 'fLaC') { - $ThisFileInfo['error'][] = 'Expecting "fLaC" at offset '.$ThisFileInfo['avdataoffset'].', found "'.$StreamMarker.'"'; - return false; - } - $ThisFileInfo['fileformat'] = 'flac'; - $ThisFileInfo['audio']['dataformat'] = 'flac'; - $ThisFileInfo['audio']['bitrate_mode'] = 'vbr'; - $ThisFileInfo['audio']['lossless'] = true; - - return getid3_flac::FLACparseMETAdata($fd, $ThisFileInfo); - } - - - function FLACparseMETAdata(&$fd, &$ThisFileInfo) { - - do { - $METAdataBlockOffset = ftell($fd); - $METAdataBlockHeader = fread($fd, 4); - $METAdataLastBlockFlag = (bool) (getid3_lib::BigEndian2Int(substr($METAdataBlockHeader, 0, 1)) & 0x80); - $METAdataBlockType = getid3_lib::BigEndian2Int(substr($METAdataBlockHeader, 0, 1)) & 0x7F; - $METAdataBlockLength = getid3_lib::BigEndian2Int(substr($METAdataBlockHeader, 1, 3)); - $METAdataBlockTypeText = getid3_flac::FLACmetaBlockTypeLookup($METAdataBlockType); - - if ($METAdataBlockLength < 0) { - $ThisFileInfo['error'][] = 'corrupt or invalid METADATA_BLOCK_HEADER.BLOCK_TYPE ('.$METAdataBlockType.') at offset '.$METAdataBlockOffset; - break; - } - - $ThisFileInfo['flac'][$METAdataBlockTypeText]['raw'] = array(); - $ThisFileInfo_flac_METAdataBlockTypeText_raw = &$ThisFileInfo['flac'][$METAdataBlockTypeText]['raw']; - - $ThisFileInfo_flac_METAdataBlockTypeText_raw['offset'] = $METAdataBlockOffset; - $ThisFileInfo_flac_METAdataBlockTypeText_raw['last_meta_block'] = $METAdataLastBlockFlag; - $ThisFileInfo_flac_METAdataBlockTypeText_raw['block_type'] = $METAdataBlockType; - $ThisFileInfo_flac_METAdataBlockTypeText_raw['block_type_text'] = $METAdataBlockTypeText; - $ThisFileInfo_flac_METAdataBlockTypeText_raw['block_length'] = $METAdataBlockLength; - $ThisFileInfo_flac_METAdataBlockTypeText_raw['block_data'] = @fread($fd, $METAdataBlockLength); - $ThisFileInfo['avdataoffset'] = ftell($fd); - - switch ($METAdataBlockTypeText) { - - case 'STREAMINFO': - if (!getid3_flac::FLACparseSTREAMINFO($ThisFileInfo_flac_METAdataBlockTypeText_raw['block_data'], $ThisFileInfo)) { - return false; - } - break; - - case 'PADDING': - // ignore - break; - - case 'APPLICATION': - if (!getid3_flac::FLACparseAPPLICATION($ThisFileInfo_flac_METAdataBlockTypeText_raw['block_data'], $ThisFileInfo)) { - return false; - } - break; - - case 'SEEKTABLE': - if (!getid3_flac::FLACparseSEEKTABLE($ThisFileInfo_flac_METAdataBlockTypeText_raw['block_data'], $ThisFileInfo)) { - return false; - } - break; - - case 'VORBIS_COMMENT': - $OldOffset = ftell($fd); - fseek($fd, 0 - $METAdataBlockLength, SEEK_CUR); - getid3_ogg::ParseVorbisCommentsFilepointer($fd, $ThisFileInfo); - fseek($fd, $OldOffset, SEEK_SET); - break; - - case 'CUESHEET': - if (!getid3_flac::FLACparseCUESHEET($ThisFileInfo_flac_METAdataBlockTypeText_raw['block_data'], $ThisFileInfo)) { - return false; - } - break; - - case 'PICTURE': - if (!$this->FLACparsePICTURE($ThisFileInfo_flac_METAdataBlockTypeText_raw['block_data'], $ThisFileInfo)) { - return false; - } - break; - - default: - $ThisFileInfo['warning'][] = 'Unhandled METADATA_BLOCK_HEADER.BLOCK_TYPE ('.$METAdataBlockType.') at offset '.$METAdataBlockOffset; - break; - } - - } while ($METAdataLastBlockFlag === false); - - - if (isset($ThisFileInfo['flac']['STREAMINFO'])) { - $ThisFileInfo['flac']['compressed_audio_bytes'] = $ThisFileInfo['avdataend'] - $ThisFileInfo['avdataoffset']; - $ThisFileInfo['flac']['uncompressed_audio_bytes'] = $ThisFileInfo['flac']['STREAMINFO']['samples_stream'] * $ThisFileInfo['flac']['STREAMINFO']['channels'] * ($ThisFileInfo['flac']['STREAMINFO']['bits_per_sample'] / 8); - if ($ThisFileInfo['flac']['uncompressed_audio_bytes'] == 0) { - $ThisFileInfo['error'][] = 'Corrupt FLAC file: uncompressed_audio_bytes == zero'; - return false; - } - $ThisFileInfo['flac']['compression_ratio'] = $ThisFileInfo['flac']['compressed_audio_bytes'] / $ThisFileInfo['flac']['uncompressed_audio_bytes']; - } - - // set md5_data_source - built into flac 0.5+ - if (isset($ThisFileInfo['flac']['STREAMINFO']['audio_signature'])) { - - if ($ThisFileInfo['flac']['STREAMINFO']['audio_signature'] === str_repeat("\x00", 16)) { - - $ThisFileInfo['warning'][] = 'FLAC STREAMINFO.audio_signature is null (known issue with libOggFLAC)'; - - } else { - - $ThisFileInfo['md5_data_source'] = ''; - $md5 = $ThisFileInfo['flac']['STREAMINFO']['audio_signature']; - for ($i = 0; $i < strlen($md5); $i++) { - $ThisFileInfo['md5_data_source'] .= str_pad(dechex(ord($md5{$i})), 2, '00', STR_PAD_LEFT); - } - if (!preg_match('/^[0-9a-f]{32}$/', $ThisFileInfo['md5_data_source'])) { - unset($ThisFileInfo['md5_data_source']); - } - - } - - } - - $ThisFileInfo['audio']['bits_per_sample'] = $ThisFileInfo['flac']['STREAMINFO']['bits_per_sample']; - if ($ThisFileInfo['audio']['bits_per_sample'] == 8) { - // special case - // must invert sign bit on all data bytes before MD5'ing to match FLAC's calculated value - // MD5sum calculates on unsigned bytes, but FLAC calculated MD5 on 8-bit audio data as signed - $ThisFileInfo['warning'][] = 'FLAC calculates MD5 data strangely on 8-bit audio, so the stored md5_data_source value will not match the decoded WAV file'; - } - if (!empty($ThisFileInfo['ogg']['vendor'])) { - $ThisFileInfo['audio']['encoder'] = $ThisFileInfo['ogg']['vendor']; - } - - return true; - } - - function FLACmetaBlockTypeLookup($blocktype) { - static $FLACmetaBlockTypeLookup = array(); - if (empty($FLACmetaBlockTypeLookup)) { - $FLACmetaBlockTypeLookup[0] = 'STREAMINFO'; - $FLACmetaBlockTypeLookup[1] = 'PADDING'; - $FLACmetaBlockTypeLookup[2] = 'APPLICATION'; - $FLACmetaBlockTypeLookup[3] = 'SEEKTABLE'; - $FLACmetaBlockTypeLookup[4] = 'VORBIS_COMMENT'; - $FLACmetaBlockTypeLookup[5] = 'CUESHEET'; - $FLACmetaBlockTypeLookup[6] = 'PICTURE'; - } - return (isset($FLACmetaBlockTypeLookup[$blocktype]) ? $FLACmetaBlockTypeLookup[$blocktype] : 'reserved'); - } - - function FLACapplicationIDLookup($applicationid) { - static $FLACapplicationIDLookup = array(); - if (empty($FLACapplicationIDLookup)) { - // http://flac.sourceforge.net/id.html - $FLACapplicationIDLookup[0x46746F6C] = 'flac-tools'; // 'Ftol' - $FLACapplicationIDLookup[0x46746F6C] = 'Sound Font FLAC'; // 'SFFL' - } - return (isset($FLACapplicationIDLookup[$applicationid]) ? $FLACapplicationIDLookup[$applicationid] : 'reserved'); - } - - function FLACpictureTypeLookup($type_id) { - static $lookup = array ( - 0 => 'Other', - 1 => '32x32 pixels \'file icon\' (PNG only)', - 2 => 'Other file icon', - 3 => 'Cover (front)', - 4 => 'Cover (back)', - 5 => 'Leaflet page', - 6 => 'Media (e.g. label side of CD)', - 7 => 'Lead artist/lead performer/soloist', - 8 => 'Artist/performer', - 9 => 'Conductor', - 10 => 'Band/Orchestra', - 11 => 'Composer', - 12 => 'Lyricist/text writer', - 13 => 'Recording Location', - 14 => 'During recording', - 15 => 'During performance', - 16 => 'Movie/video screen capture', - 17 => 'A bright coloured fish', - 18 => 'Illustration', - 19 => 'Band/artist logotype', - 20 => 'Publisher/Studio logotype', - ); - return (isset($lookup[$type_id]) ? $lookup[$type_id] : 'reserved'); - } - - function FLACparseSTREAMINFO($METAdataBlockData, &$ThisFileInfo) { - $offset = 0; - $ThisFileInfo['flac']['STREAMINFO']['min_block_size'] = getid3_lib::BigEndian2Int(substr($METAdataBlockData, $offset, 2)); - $offset += 2; - $ThisFileInfo['flac']['STREAMINFO']['max_block_size'] = getid3_lib::BigEndian2Int(substr($METAdataBlockData, $offset, 2)); - $offset += 2; - $ThisFileInfo['flac']['STREAMINFO']['min_frame_size'] = getid3_lib::BigEndian2Int(substr($METAdataBlockData, $offset, 3)); - $offset += 3; - $ThisFileInfo['flac']['STREAMINFO']['max_frame_size'] = getid3_lib::BigEndian2Int(substr($METAdataBlockData, $offset, 3)); - $offset += 3; - - $SampleRateChannelsSampleBitsStreamSamples = getid3_lib::BigEndian2Bin(substr($METAdataBlockData, $offset, 8)); - $ThisFileInfo['flac']['STREAMINFO']['sample_rate'] = getid3_lib::Bin2Dec(substr($SampleRateChannelsSampleBitsStreamSamples, 0, 20)); - $ThisFileInfo['flac']['STREAMINFO']['channels'] = getid3_lib::Bin2Dec(substr($SampleRateChannelsSampleBitsStreamSamples, 20, 3)) + 1; - $ThisFileInfo['flac']['STREAMINFO']['bits_per_sample'] = getid3_lib::Bin2Dec(substr($SampleRateChannelsSampleBitsStreamSamples, 23, 5)) + 1; - $ThisFileInfo['flac']['STREAMINFO']['samples_stream'] = getid3_lib::Bin2Dec(substr($SampleRateChannelsSampleBitsStreamSamples, 28, 36)); - $offset += 8; - - $ThisFileInfo['flac']['STREAMINFO']['audio_signature'] = substr($METAdataBlockData, $offset, 16); - $offset += 16; - - if (!empty($ThisFileInfo['flac']['STREAMINFO']['sample_rate'])) { - - $ThisFileInfo['audio']['bitrate_mode'] = 'vbr'; - $ThisFileInfo['audio']['sample_rate'] = $ThisFileInfo['flac']['STREAMINFO']['sample_rate']; - $ThisFileInfo['audio']['channels'] = $ThisFileInfo['flac']['STREAMINFO']['channels']; - $ThisFileInfo['audio']['bits_per_sample'] = $ThisFileInfo['flac']['STREAMINFO']['bits_per_sample']; - $ThisFileInfo['playtime_seconds'] = $ThisFileInfo['flac']['STREAMINFO']['samples_stream'] / $ThisFileInfo['flac']['STREAMINFO']['sample_rate']; - $ThisFileInfo['audio']['bitrate'] = (($ThisFileInfo['avdataend'] - $ThisFileInfo['avdataoffset']) * 8) / $ThisFileInfo['playtime_seconds']; - - } else { - - $ThisFileInfo['error'][] = 'Corrupt METAdata block: STREAMINFO'; - return false; - - } - - unset($ThisFileInfo['flac']['STREAMINFO']['raw']); - - return true; - } - - - function FLACparseAPPLICATION($METAdataBlockData, &$ThisFileInfo) { - $offset = 0; - $ApplicationID = getid3_lib::BigEndian2Int(substr($METAdataBlockData, $offset, 4)); - $offset += 4; - $ThisFileInfo['flac']['APPLICATION'][$ApplicationID]['name'] = getid3_flac::FLACapplicationIDLookup($ApplicationID); - $ThisFileInfo['flac']['APPLICATION'][$ApplicationID]['data'] = substr($METAdataBlockData, $offset); - $offset = $METAdataBlockLength; - - unset($ThisFileInfo['flac']['APPLICATION']['raw']); - - return true; - } - - - function FLACparseSEEKTABLE($METAdataBlockData, &$ThisFileInfo) { - $offset = 0; - $METAdataBlockLength = strlen($METAdataBlockData); - $placeholderpattern = str_repeat("\xFF", 8); - while ($offset < $METAdataBlockLength) { - $SampleNumberString = substr($METAdataBlockData, $offset, 8); - $offset += 8; - if ($SampleNumberString == $placeholderpattern) { - - // placeholder point - @$ThisFileInfo['flac']['SEEKTABLE']['placeholders']++; - $offset += 10; - - } else { - - $SampleNumber = getid3_lib::BigEndian2Int($SampleNumberString); - $ThisFileInfo['flac']['SEEKTABLE'][$SampleNumber]['offset'] = getid3_lib::BigEndian2Int(substr($METAdataBlockData, $offset, 8)); - $offset += 8; - $ThisFileInfo['flac']['SEEKTABLE'][$SampleNumber]['samples'] = getid3_lib::BigEndian2Int(substr($METAdataBlockData, $offset, 2)); - $offset += 2; - - } - } - - unset($ThisFileInfo['flac']['SEEKTABLE']['raw']); - - return true; - } - - function FLACparseCUESHEET($METAdataBlockData, &$ThisFileInfo) { - $offset = 0; - $ThisFileInfo['flac']['CUESHEET']['media_catalog_number'] = trim(substr($METAdataBlockData, $offset, 128), "\0"); - $offset += 128; - $ThisFileInfo['flac']['CUESHEET']['lead_in_samples'] = getid3_lib::BigEndian2Int(substr($METAdataBlockData, $offset, 8)); - $offset += 8; - $ThisFileInfo['flac']['CUESHEET']['flags']['is_cd'] = (bool) (getid3_lib::BigEndian2Int(substr($METAdataBlockData, $offset, 1)) & 0x80); - $offset += 1; - - $offset += 258; // reserved - - $ThisFileInfo['flac']['CUESHEET']['number_tracks'] = getid3_lib::BigEndian2Int(substr($METAdataBlockData, $offset, 1)); - $offset += 1; - - for ($track = 0; $track < $ThisFileInfo['flac']['CUESHEET']['number_tracks']; $track++) { - $TrackSampleOffset = getid3_lib::BigEndian2Int(substr($METAdataBlockData, $offset, 8)); - $offset += 8; - $TrackNumber = getid3_lib::BigEndian2Int(substr($METAdataBlockData, $offset, 1)); - $offset += 1; - - $ThisFileInfo['flac']['CUESHEET']['tracks'][$TrackNumber]['sample_offset'] = $TrackSampleOffset; - - $ThisFileInfo['flac']['CUESHEET']['tracks'][$TrackNumber]['isrc'] = substr($METAdataBlockData, $offset, 12); - $offset += 12; - - $TrackFlagsRaw = getid3_lib::BigEndian2Int(substr($METAdataBlockData, $offset, 1)); - $offset += 1; - $ThisFileInfo['flac']['CUESHEET']['tracks'][$TrackNumber]['flags']['is_audio'] = (bool) ($TrackFlagsRaw & 0x80); - $ThisFileInfo['flac']['CUESHEET']['tracks'][$TrackNumber]['flags']['pre_emphasis'] = (bool) ($TrackFlagsRaw & 0x40); - - $offset += 13; // reserved - - $ThisFileInfo['flac']['CUESHEET']['tracks'][$TrackNumber]['index_points'] = getid3_lib::BigEndian2Int(substr($METAdataBlockData, $offset, 1)); - $offset += 1; - - for ($index = 0; $index < $ThisFileInfo['flac']['CUESHEET']['tracks'][$TrackNumber]['index_points']; $index++) { - $IndexSampleOffset = getid3_lib::BigEndian2Int(substr($METAdataBlockData, $offset, 8)); - $offset += 8; - $IndexNumber = getid3_lib::BigEndian2Int(substr($METAdataBlockData, $offset, 1)); - $offset += 1; - - $offset += 3; // reserved - - $ThisFileInfo['flac']['CUESHEET']['tracks'][$TrackNumber]['indexes'][$IndexNumber] = $IndexSampleOffset; - } - } - - unset($ThisFileInfo['flac']['CUESHEET']['raw']); - - return true; - } - - - function FLACparsePICTURE($meta_data_block_data, &$ThisFileInfo) { - $picture = &$ThisFileInfo['flac']['PICTURE'][sizeof($ThisFileInfo['flac']['PICTURE']) - 1]; - - $offset = 0; - - $picture['type'] = $this->FLACpictureTypeLookup(getid3_lib::BigEndian2Int(substr($meta_data_block_data, $offset, 4))); - $offset += 4; - - $length = getid3_lib::BigEndian2Int(substr($meta_data_block_data, $offset, 4)); - $offset += 4; - - $picture['mime_type'] = substr($meta_data_block_data, $offset, $length); - $offset += $length; - - $length = getid3_lib::BigEndian2Int(substr($meta_data_block_data, $offset, 4)); - $offset += 4; - - $picture['description'] = substr($meta_data_block_data, $offset, $length); - $offset += $length; - - $picture['width'] = getid3_lib::BigEndian2Int(substr($meta_data_block_data, $offset, 4)); - $offset += 4; - - $picture['height'] = getid3_lib::BigEndian2Int(substr($meta_data_block_data, $offset, 4)); - $offset += 4; - - $picture['color_depth'] = getid3_lib::BigEndian2Int(substr($meta_data_block_data, $offset, 4)); - $offset += 4; - - $picture['colors_indexed'] = getid3_lib::BigEndian2Int(substr($meta_data_block_data, $offset, 4)); - $offset += 4; - - $length = getid3_lib::BigEndian2Int(substr($meta_data_block_data, $offset, 4)); - $offset += 4; - - $picture['image_data'] = substr($meta_data_block_data, $offset, $length); - $offset += $length; - - unset($ThisFileInfo['flac']['PICTURE']['raw']); - - return true; - } -} - -?>
\ No newline at end of file diff --git a/getid3/module.audio.la.php b/getid3/module.audio.la.php deleted file mode 100644 index c1d4f52..0000000 --- a/getid3/module.audio.la.php +++ /dev/null @@ -1,228 +0,0 @@ -<?php -///////////////////////////////////////////////////////////////// -/// getID3() by James Heinrich <info@getid3.org> // -// available at http://getid3.sourceforge.net // -// or http://www.getid3.org // -///////////////////////////////////////////////////////////////// -// See readme.txt for more details // -///////////////////////////////////////////////////////////////// -// // -// module.audio.la.php // -// module for analyzing LA audio files // -// dependencies: module.audio.riff.php // -// /// -///////////////////////////////////////////////////////////////// - -getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio-video.riff.php', __FILE__, true); - -class getid3_la -{ - - function getid3_la(&$fd, &$ThisFileInfo) { - $offset = 0; - fseek($fd, $ThisFileInfo['avdataoffset'], SEEK_SET); - $rawdata = fread($fd, GETID3_FREAD_BUFFER_SIZE); - - switch (substr($rawdata, $offset, 4)) { - case 'LA02': - case 'LA03': - case 'LA04': - $ThisFileInfo['fileformat'] = 'la'; - $ThisFileInfo['audio']['dataformat'] = 'la'; - $ThisFileInfo['audio']['lossless'] = true; - - $ThisFileInfo['la']['version_major'] = (int) substr($rawdata, $offset + 2, 1); - $ThisFileInfo['la']['version_minor'] = (int) substr($rawdata, $offset + 3, 1); - $ThisFileInfo['la']['version'] = (float) $ThisFileInfo['la']['version_major'] + ($ThisFileInfo['la']['version_minor'] / 10); - $offset += 4; - - $ThisFileInfo['la']['uncompressed_size'] = getid3_lib::LittleEndian2Int(substr($rawdata, $offset, 4)); - $offset += 4; - if ($ThisFileInfo['la']['uncompressed_size'] == 0) { - $ThisFileInfo['error'][] = 'Corrupt LA file: uncompressed_size == zero'; - return false; - } - - $WAVEchunk = substr($rawdata, $offset, 4); - if ($WAVEchunk !== 'WAVE') { - $ThisFileInfo['error'][] = 'Expected "WAVE" ('.getid3_lib::PrintHexBytes('WAVE').') at offset '.$offset.', found "'.$WAVEchunk.'" ('.getid3_lib::PrintHexBytes($WAVEchunk).') instead.'; - return false; - } - $offset += 4; - - $ThisFileInfo['la']['fmt_size'] = 24; - if ($ThisFileInfo['la']['version'] >= 0.3) { - - $ThisFileInfo['la']['fmt_size'] = getid3_lib::LittleEndian2Int(substr($rawdata, $offset, 4)); - $ThisFileInfo['la']['header_size'] = 49 + $ThisFileInfo['la']['fmt_size'] - 24; - $offset += 4; - - } else { - - // version 0.2 didn't support additional data blocks - $ThisFileInfo['la']['header_size'] = 41; - - } - - $fmt_chunk = substr($rawdata, $offset, 4); - if ($fmt_chunk !== 'fmt ') { - $ThisFileInfo['error'][] = 'Expected "fmt " ('.getid3_lib::PrintHexBytes('fmt ').') at offset '.$offset.', found "'.$fmt_chunk.'" ('.getid3_lib::PrintHexBytes($fmt_chunk).') instead.'; - return false; - } - $offset += 4; - $fmt_size = getid3_lib::LittleEndian2Int(substr($rawdata, $offset, 4)); - $offset += 4; - - $ThisFileInfo['la']['raw']['format'] = getid3_lib::LittleEndian2Int(substr($rawdata, $offset, 2)); - $offset += 2; - - $ThisFileInfo['la']['channels'] = getid3_lib::LittleEndian2Int(substr($rawdata, $offset, 2)); - $offset += 2; - if ($ThisFileInfo['la']['channels'] == 0) { - $ThisFileInfo['error'][] = 'Corrupt LA file: channels == zero'; - return false; - } - - $ThisFileInfo['la']['sample_rate'] = getid3_lib::LittleEndian2Int(substr($rawdata, $offset, 4)); - $offset += 4; - if ($ThisFileInfo['la']['sample_rate'] == 0) { - $ThisFileInfo['error'][] = 'Corrupt LA file: sample_rate == zero'; - return false; - } - - $ThisFileInfo['la']['bytes_per_second'] = getid3_lib::LittleEndian2Int(substr($rawdata, $offset, 4)); - $offset += 4; - $ThisFileInfo['la']['bytes_per_sample'] = getid3_lib::LittleEndian2Int(substr($rawdata, $offset, 2)); - $offset += 2; - $ThisFileInfo['la']['bits_per_sample'] = getid3_lib::LittleEndian2Int(substr($rawdata, $offset, 2)); - $offset += 2; - - $ThisFileInfo['la']['samples'] = getid3_lib::LittleEndian2Int(substr($rawdata, $offset, 4)); - $offset += 4; - - $ThisFileInfo['la']['raw']['flags'] = getid3_lib::LittleEndian2Int(substr($rawdata, $offset, 1)); - $offset += 1; - $ThisFileInfo['la']['flags']['seekable'] = (bool) ($ThisFileInfo['la']['raw']['flags'] & 0x01); - if ($ThisFileInfo['la']['version'] >= 0.4) { - $ThisFileInfo['la']['flags']['high_compression'] = (bool) ($ThisFileInfo['la']['raw']['flags'] & 0x02); - } - - $ThisFileInfo['la']['original_crc'] = getid3_lib::LittleEndian2Int(substr($rawdata, $offset, 4)); - $offset += 4; - - // mikeØbevin*de - // Basically, the blocksize/seekevery are 61440/19 in La0.4 and 73728/16 - // in earlier versions. A seekpoint is added every blocksize * seekevery - // samples, so 4 * int(totalSamples / (blockSize * seekEvery)) should - // give the number of bytes used for the seekpoints. Of course, if seeking - // is disabled, there are no seekpoints stored. - if ($ThisFileInfo['la']['version'] >= 0.4) { - $ThisFileInfo['la']['blocksize'] = 61440; - $ThisFileInfo['la']['seekevery'] = 19; - } else { - $ThisFileInfo['la']['blocksize'] = 73728; - $ThisFileInfo['la']['seekevery'] = 16; - } - - $ThisFileInfo['la']['seekpoint_count'] = 0; - if ($ThisFileInfo['la']['flags']['seekable']) { - $ThisFileInfo['la']['seekpoint_count'] = floor($ThisFileInfo['la']['samples'] / ($ThisFileInfo['la']['blocksize'] * $ThisFileInfo['la']['seekevery'])); - - for ($i = 0; $i < $ThisFileInfo['la']['seekpoint_count']; $i++) { - $ThisFileInfo['la']['seekpoints'][] = getid3_lib::LittleEndian2Int(substr($rawdata, $offset, 4)); - $offset += 4; - } - } - - if ($ThisFileInfo['la']['version'] >= 0.3) { - - // Following the main header information, the program outputs all of the - // seekpoints. Following these is what I called the 'footer start', - // i.e. the position immediately after the La audio data is finished. - $ThisFileInfo['la']['footerstart'] = getid3_lib::LittleEndian2Int(substr($rawdata, $offset, 4)); - $offset += 4; - - if ($ThisFileInfo['la']['footerstart'] > $ThisFileInfo['filesize']) { - $ThisFileInfo['warning'][] = 'FooterStart value points to offset '.$ThisFileInfo['la']['footerstart'].' which is beyond end-of-file ('.$ThisFileInfo['filesize'].')'; - $ThisFileInfo['la']['footerstart'] = $ThisFileInfo['filesize']; - } - - } else { - - // La v0.2 didn't have FooterStart value - $ThisFileInfo['la']['footerstart'] = $ThisFileInfo['avdataend']; - - } - - if ($ThisFileInfo['la']['footerstart'] < $ThisFileInfo['avdataend']) { - if ($RIFFtempfilename = tempnam('*', 'id3')) { - if ($RIFF_fp = fopen($RIFFtempfilename, 'w+b')) { - $RIFFdata = 'WAVE'; - if ($ThisFileInfo['la']['version'] == 0.2) { - $RIFFdata .= substr($rawdata, 12, 24); - } else { - $RIFFdata .= substr($rawdata, 16, 24); - } - if ($ThisFileInfo['la']['footerstart'] < $ThisFileInfo['avdataend']) { - fseek($fd, $ThisFileInfo['la']['footerstart'], SEEK_SET); - $RIFFdata .= fread($fd, $ThisFileInfo['avdataend'] - $ThisFileInfo['la']['footerstart']); - } - $RIFFdata = 'RIFF'.getid3_lib::LittleEndian2String(strlen($RIFFdata), 4, false).$RIFFdata; - fwrite($RIFF_fp, $RIFFdata, strlen($RIFFdata)); - $dummy = $ThisFileInfo; - $dummy['filesize'] = strlen($RIFFdata); - $dummy['avdataoffset'] = 0; - $dummy['avdataend'] = $dummy['filesize']; - - $riff = new getid3_riff($RIFF_fp, $dummy); - if (empty($dummy['error'])) { - $ThisFileInfo['riff'] = $dummy['riff']; - } else { - $ThisFileInfo['warning'][] = 'Error parsing RIFF portion of La file: '.implode($dummy['error']); - } - unset($riff); - unset($dummy); - fclose($RIFF_fp); - } - unlink($RIFFtempfilename); - } - } - - // $ThisFileInfo['avdataoffset'] should be zero to begin with, but just in case it's not, include the addition anyway - $ThisFileInfo['avdataend'] = $ThisFileInfo['avdataoffset'] + $ThisFileInfo['la']['footerstart']; - $ThisFileInfo['avdataoffset'] = $ThisFileInfo['avdataoffset'] + $offset; - - //$ThisFileInfo['la']['codec'] = RIFFwFormatTagLookup($ThisFileInfo['la']['raw']['format']); - $ThisFileInfo['la']['compression_ratio'] = (float) (($ThisFileInfo['avdataend'] - $ThisFileInfo['avdataoffset']) / $ThisFileInfo['la']['uncompressed_size']); - $ThisFileInfo['playtime_seconds'] = (float) ($ThisFileInfo['la']['samples'] / $ThisFileInfo['la']['sample_rate']) / $ThisFileInfo['la']['channels']; - if ($ThisFileInfo['playtime_seconds'] == 0) { - $ThisFileInfo['error'][] = 'Corrupt LA file: playtime_seconds == zero'; - return false; - } - - $ThisFileInfo['audio']['bitrate'] = ($ThisFileInfo['avdataend'] - $ThisFileInfo['avdataoffset']) * 8 / $ThisFileInfo['playtime_seconds']; - //$ThisFileInfo['audio']['codec'] = $ThisFileInfo['la']['codec']; - $ThisFileInfo['audio']['bits_per_sample'] = $ThisFileInfo['la']['bits_per_sample']; - break; - - default: - if (substr($rawdata, $offset, 2) == 'LA') { - $ThisFileInfo['error'][] = 'This version of getID3() (v'.GETID3_VERSION.') doesn\'t support LA version '.substr($rawdata, $offset + 2, 1).'.'.substr($rawdata, $offset + 3, 1).' which this appears to be - check http://getid3.sourceforge.net for updates.'; - } else { - $ThisFileInfo['error'][] = 'Not a LA (Lossless-Audio) file'; - } - return false; - break; - } - - $ThisFileInfo['audio']['channels'] = $ThisFileInfo['la']['channels']; - $ThisFileInfo['audio']['sample_rate'] = (int) $ThisFileInfo['la']['sample_rate']; - $ThisFileInfo['audio']['encoder'] = 'LA v'.$ThisFileInfo['la']['version']; - - return true; - } - -} - - -?>
\ No newline at end of file diff --git a/getid3/module.audio.lpac.php b/getid3/module.audio.lpac.php deleted file mode 100644 index 3c04492..0000000 --- a/getid3/module.audio.lpac.php +++ /dev/null @@ -1,126 +0,0 @@ -<?php -///////////////////////////////////////////////////////////////// -/// getID3() by James Heinrich <info@getid3.org> // -// available at http://getid3.sourceforge.net // -// or http://www.getid3.org // -///////////////////////////////////////////////////////////////// -// See readme.txt for more details // -///////////////////////////////////////////////////////////////// -// // -// module.audio.lpac.php // -// module for analyzing LPAC Audio files // -// dependencies: module.audio-video.riff.php // -// /// -///////////////////////////////////////////////////////////////// - -getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio-video.riff.php', __FILE__, true); - -class getid3_lpac -{ - - function getid3_lpac(&$fd, &$ThisFileInfo) { - - fseek($fd, $ThisFileInfo['avdataoffset'], SEEK_SET); - $LPACheader = fread($fd, 14); - if (substr($LPACheader, 0, 4) != 'LPAC') { - $ThisFileInfo['error'][] = 'Expected "LPAC" at offset '.$ThisFileInfo['avdataoffset'].', found "'.$StreamMarker.'"'; - return false; - } - $ThisFileInfo['avdataoffset'] += 14; - - $ThisFileInfo['fileformat'] = 'lpac'; - $ThisFileInfo['audio']['dataformat'] = 'lpac'; - $ThisFileInfo['audio']['lossless'] = true; - $ThisFileInfo['audio']['bitrate_mode'] = 'vbr'; - - $ThisFileInfo['lpac']['file_version'] = getid3_lib::BigEndian2Int(substr($LPACheader, 4, 1)); - $flags['audio_type'] = getid3_lib::BigEndian2Int(substr($LPACheader, 5, 1)); - $ThisFileInfo['lpac']['total_samples']= getid3_lib::BigEndian2Int(substr($LPACheader, 6, 4)); - $flags['parameters'] = getid3_lib::BigEndian2Int(substr($LPACheader, 10, 4)); - - $ThisFileInfo['lpac']['flags']['is_wave'] = (bool) ($flags['audio_type'] & 0x40); - $ThisFileInfo['lpac']['flags']['stereo'] = (bool) ($flags['audio_type'] & 0x04); - $ThisFileInfo['lpac']['flags']['24_bit'] = (bool) ($flags['audio_type'] & 0x02); - $ThisFileInfo['lpac']['flags']['16_bit'] = (bool) ($flags['audio_type'] & 0x01); - - if ($ThisFileInfo['lpac']['flags']['24_bit'] && $ThisFileInfo['lpac']['flags']['16_bit']) { - $ThisFileInfo['warning'][] = '24-bit and 16-bit flags cannot both be set'; - } - - $ThisFileInfo['lpac']['flags']['fast_compress'] = (bool) ($flags['parameters'] & 0x40000000); - $ThisFileInfo['lpac']['flags']['random_access'] = (bool) ($flags['parameters'] & 0x08000000); - $ThisFileInfo['lpac']['block_length'] = pow(2, (($flags['parameters'] & 0x07000000) >> 24)) * 256; - $ThisFileInfo['lpac']['flags']['adaptive_prediction_order'] = (bool) ($flags['parameters'] & 0x00800000); - $ThisFileInfo['lpac']['flags']['adaptive_quantization'] = (bool) ($flags['parameters'] & 0x00400000); - $ThisFileInfo['lpac']['flags']['joint_stereo'] = (bool) ($flags['parameters'] & 0x00040000); - $ThisFileInfo['lpac']['quantization'] = ($flags['parameters'] & 0x00001F00) >> 8; - $ThisFileInfo['lpac']['max_prediction_order'] = ($flags['parameters'] & 0x0000003F); - - if ($ThisFileInfo['lpac']['flags']['fast_compress'] && ($ThisFileInfo['lpac']['max_prediction_order'] != 3)) { - $ThisFileInfo['warning'][] = 'max_prediction_order expected to be "3" if fast_compress is true, actual value is "'.$ThisFileInfo['lpac']['max_prediction_order'].'"'; - } - switch ($ThisFileInfo['lpac']['file_version']) { - case 6: - if ($ThisFileInfo['lpac']['flags']['adaptive_quantization']) { - $ThisFileInfo['warning'][] = 'adaptive_quantization expected to be false in LPAC file stucture v6, actually true'; - } - if ($ThisFileInfo['lpac']['quantization'] != 20) { - $ThisFileInfo['warning'][] = 'Quantization expected to be 20 in LPAC file stucture v6, actually '.$ThisFileInfo['lpac']['flags']['Q']; - } - break; - - default: - //$ThisFileInfo['warning'][] = 'This version of getID3() only supports LPAC file format version 6, this file is version '.$ThisFileInfo['lpac']['file_version'].' - please report to info@getid3.org'; - break; - } - - $dummy = $ThisFileInfo; - $riff = new getid3_riff($fd, $dummy); - unset($riff); - $ThisFileInfo['avdataoffset'] = $dummy['avdataoffset']; - $ThisFileInfo['riff'] = $dummy['riff']; - $ThisFileInfo['error'] = $dummy['error']; - $ThisFileInfo['warning'] = $dummy['warning']; - $ThisFileInfo['lpac']['comments']['comment'] = $dummy['comments']; - $ThisFileInfo['audio']['sample_rate'] = $dummy['audio']['sample_rate']; - - $ThisFileInfo['audio']['channels'] = ($ThisFileInfo['lpac']['flags']['stereo'] ? 2 : 1); - - if ($ThisFileInfo['lpac']['flags']['24_bit']) { - $ThisFileInfo['audio']['bits_per_sample'] = $ThisFileInfo['riff']['audio'][0]['bits_per_sample']; - } elseif ($ThisFileInfo['lpac']['flags']['16_bit']) { - $ThisFileInfo['audio']['bits_per_sample'] = 16; - } else { - $ThisFileInfo['audio']['bits_per_sample'] = 8; - } - - if ($ThisFileInfo['lpac']['flags']['fast_compress']) { - // fast - $ThisFileInfo['audio']['encoder_options'] = '-1'; - } else { - switch ($ThisFileInfo['lpac']['max_prediction_order']) { - case 20: // simple - $ThisFileInfo['audio']['encoder_options'] = '-2'; - break; - case 30: // medium - $ThisFileInfo['audio']['encoder_options'] = '-3'; - break; - case 40: // high - $ThisFileInfo['audio']['encoder_options'] = '-4'; - break; - case 60: // extrahigh - $ThisFileInfo['audio']['encoder_options'] = '-5'; - break; - } - } - - $ThisFileInfo['playtime_seconds'] = $ThisFileInfo['lpac']['total_samples'] / $ThisFileInfo['audio']['sample_rate']; - $ThisFileInfo['audio']['bitrate'] = (($ThisFileInfo['avdataend'] - $ThisFileInfo['avdataoffset']) * 8) / $ThisFileInfo['playtime_seconds']; - - return true; - } - -} - - -?>
\ No newline at end of file diff --git a/getid3/module.audio.midi.php b/getid3/module.audio.midi.php deleted file mode 100644 index 0fd7c9b..0000000 --- a/getid3/module.audio.midi.php +++ /dev/null @@ -1,522 +0,0 @@ -<?php -///////////////////////////////////////////////////////////////// -/// getID3() by James Heinrich <info@getid3.org> // -// available at http://getid3.sourceforge.net // -// or http://www.getid3.org // -///////////////////////////////////////////////////////////////// -// See readme.txt for more details // -///////////////////////////////////////////////////////////////// -// // -// module.audio.midi.php // -// module for Midi Audio files // -// dependencies: NONE // -// /// -///////////////////////////////////////////////////////////////// - - -class getid3_midi -{ - - function getid3_midi(&$fd, &$ThisFileInfo, $scanwholefile=true) { - - // shortcut - $ThisFileInfo['midi']['raw'] = array(); - $thisfile_midi = &$ThisFileInfo['midi']; - $thisfile_midi_raw = &$thisfile_midi['raw']; - - $ThisFileInfo['fileformat'] = 'midi'; - $ThisFileInfo['audio']['dataformat'] = 'midi'; - - fseek($fd, $ThisFileInfo['avdataoffset'], SEEK_SET); - $MIDIdata = fread($fd, GETID3_FREAD_BUFFER_SIZE); - $offset = 0; - $MIDIheaderID = substr($MIDIdata, $offset, 4); // 'MThd' - if ($MIDIheaderID != 'MThd') { - $ThisFileInfo['error'][] = 'Expecting "MThd" at offset '.$ThisFileInfo['avdataoffset'].', found "'.$MIDIheaderID.'"'; - unset($ThisFileInfo['fileformat']); - return false; - } - $offset += 4; - $thisfile_midi_raw['headersize'] = getid3_lib::BigEndian2Int(substr($MIDIdata, $offset, 4)); - $offset += 4; - $thisfile_midi_raw['fileformat'] = getid3_lib::BigEndian2Int(substr($MIDIdata, $offset, 2)); - $offset += 2; - $thisfile_midi_raw['tracks'] = getid3_lib::BigEndian2Int(substr($MIDIdata, $offset, 2)); - $offset += 2; - $thisfile_midi_raw['ticksperqnote'] = getid3_lib::BigEndian2Int(substr($MIDIdata, $offset, 2)); - $offset += 2; - - for ($i = 0; $i < $thisfile_midi_raw['tracks']; $i++) { - if ((strlen($MIDIdata) - $offset) < 8) { - $MIDIdata .= fread($fd, GETID3_FREAD_BUFFER_SIZE); - } - $trackID = substr($MIDIdata, $offset, 4); - $offset += 4; - if ($trackID == 'MTrk') { - $tracksize = getid3_lib::BigEndian2Int(substr($MIDIdata, $offset, 4)); - $offset += 4; - // $thisfile_midi['tracks'][$i]['size'] = $tracksize; - $trackdataarray[$i] = substr($MIDIdata, $offset, $tracksize); - $offset += $tracksize; - } else { - $ThisFileInfo['error'][] = 'Expecting "MTrk" at '.$offset.', found '.$trackID.' instead'; - return false; - } - } - - if (!isset($trackdataarray) || !is_array($trackdataarray)) { - $ThisFileInfo['error'][] = 'Cannot find MIDI track information'; - unset($thisfile_midi); - unset($ThisFileInfo['fileformat']); - return false; - } - - if ($scanwholefile) { // this can take quite a long time, so have the option to bypass it if speed is very important - $thisfile_midi['totalticks'] = 0; - $ThisFileInfo['playtime_seconds'] = 0; - $CurrentMicroSecondsPerBeat = 500000; // 120 beats per minute; 60,000,000 microseconds per minute -> 500,000 microseconds per beat - $CurrentBeatsPerMinute = 120; // 120 beats per minute; 60,000,000 microseconds per minute -> 500,000 microseconds per beat - $MicroSecondsPerQuarterNoteAfter = array (); - - foreach ($trackdataarray as $tracknumber => $trackdata) { - - $eventsoffset = 0; - $LastIssuedMIDIcommand = 0; - $LastIssuedMIDIchannel = 0; - $CumulativeDeltaTime = 0; - $TicksAtCurrentBPM = 0; - while ($eventsoffset < strlen($trackdata)) { - $eventid = 0; - if (isset($MIDIevents[$tracknumber]) && is_array($MIDIevents[$tracknumber])) { - $eventid = count($MIDIevents[$tracknumber]); - } - $deltatime = 0; - for ($i = 0; $i < 4; $i++) { - $deltatimebyte = ord(substr($trackdata, $eventsoffset++, 1)); - $deltatime = ($deltatime << 7) + ($deltatimebyte & 0x7F); - if ($deltatimebyte & 0x80) { - // another byte follows - } else { - break; - } - } - $CumulativeDeltaTime += $deltatime; - $TicksAtCurrentBPM += $deltatime; - $MIDIevents[$tracknumber][$eventid]['deltatime'] = $deltatime; - $MIDI_event_channel = ord(substr($trackdata, $eventsoffset++, 1)); - if ($MIDI_event_channel & 0x80) { - // OK, normal event - MIDI command has MSB set - $LastIssuedMIDIcommand = $MIDI_event_channel >> 4; - $LastIssuedMIDIchannel = $MIDI_event_channel & 0x0F; - } else { - // running event - assume last command - $eventsoffset--; - } - $MIDIevents[$tracknumber][$eventid]['eventid'] = $LastIssuedMIDIcommand; - $MIDIevents[$tracknumber][$eventid]['channel'] = $LastIssuedMIDIchannel; - if ($MIDIevents[$tracknumber][$eventid]['eventid'] == 0x08) { // Note off (key is released) - - $notenumber = ord(substr($trackdata, $eventsoffset++, 1)); - $velocity = ord(substr($trackdata, $eventsoffset++, 1)); - - } elseif ($MIDIevents[$tracknumber][$eventid]['eventid'] == 0x09) { // Note on (key is pressed) - - $notenumber = ord(substr($trackdata, $eventsoffset++, 1)); - $velocity = ord(substr($trackdata, $eventsoffset++, 1)); - - } elseif ($MIDIevents[$tracknumber][$eventid]['eventid'] == 0x0A) { // Key after-touch - - $notenumber = ord(substr($trackdata, $eventsoffset++, 1)); - $velocity = ord(substr($trackdata, $eventsoffset++, 1)); - - } elseif ($MIDIevents[$tracknumber][$eventid]['eventid'] == 0x0B) { // Control Change - - $controllernum = ord(substr($trackdata, $eventsoffset++, 1)); - $newvalue = ord(substr($trackdata, $eventsoffset++, 1)); - - } elseif ($MIDIevents[$tracknumber][$eventid]['eventid'] == 0x0C) { // Program (patch) change - - $newprogramnum = ord(substr($trackdata, $eventsoffset++, 1)); - - $thisfile_midi_raw['track'][$tracknumber]['instrumentid'] = $newprogramnum; - if ($tracknumber == 10) { - $thisfile_midi_raw['track'][$tracknumber]['instrument'] = $this->GeneralMIDIpercussionLookup($newprogramnum); - } else { - $thisfile_midi_raw['track'][$tracknumber]['instrument'] = $this->GeneralMIDIinstrumentLookup($newprogramnum); - } - - } elseif ($MIDIevents[$tracknumber][$eventid]['eventid'] == 0x0D) { // Channel after-touch - - $channelnumber = ord(substr($trackdata, $eventsoffset++, 1)); - - } elseif ($MIDIevents[$tracknumber][$eventid]['eventid'] == 0x0E) { // Pitch wheel change (2000H is normal or no change) - - $changeLSB = ord(substr($trackdata, $eventsoffset++, 1)); - $changeMSB = ord(substr($trackdata, $eventsoffset++, 1)); - $pitchwheelchange = (($changeMSB & 0x7F) << 7) & ($changeLSB & 0x7F); - - } elseif (($MIDIevents[$tracknumber][$eventid]['eventid'] == 0x0F) && ($MIDIevents[$tracknumber][$eventid]['channel'] == 0x0F)) { - - $METAeventCommand = ord(substr($trackdata, $eventsoffset++, 1)); - $METAeventLength = ord(substr($trackdata, $eventsoffset++, 1)); - $METAeventData = substr($trackdata, $eventsoffset, $METAeventLength); - $eventsoffset += $METAeventLength; - switch ($METAeventCommand) { - case 0x00: // Set track sequence number - $track_sequence_number = getid3_lib::BigEndian2Int(substr($METAeventData, 0, $METAeventLength)); - //$thisfile_midi_raw['events'][$tracknumber][$eventid]['seqno'] = $track_sequence_number; - break; - - case 0x01: // Text: generic - $text_generic = substr($METAeventData, 0, $METAeventLength); - //$thisfile_midi_raw['events'][$tracknumber][$eventid]['text'] = $text_generic; - $thisfile_midi['comments']['comment'][] = $text_generic; - break; - - case 0x02: // Text: copyright - $text_copyright = substr($METAeventData, 0, $METAeventLength); - //$thisfile_midi_raw['events'][$tracknumber][$eventid]['copyright'] = $text_copyright; - $thisfile_midi['comments']['copyright'][] = $text_copyright; - break; - - case 0x03: // Text: track name - $text_trackname = substr($METAeventData, 0, $METAeventLength); - $thisfile_midi_raw['track'][$tracknumber]['name'] = $text_trackname; - break; - - case 0x04: // Text: track instrument name - $text_instrument = substr($METAeventData, 0, $METAeventLength); - //$thisfile_midi_raw['events'][$tracknumber][$eventid]['instrument'] = $text_instrument; - break; - - case 0x05: // Text: lyrics - $text_lyrics = substr($METAeventData, 0, $METAeventLength); - //$thisfile_midi_raw['events'][$tracknumber][$eventid]['lyrics'] = $text_lyrics; - if (!isset($thisfile_midi['lyrics'])) { - $thisfile_midi['lyrics'] = ''; - } - $thisfile_midi['lyrics'] .= $text_lyrics."\n"; - break; - - case 0x06: // Text: marker - $text_marker = substr($METAeventData, 0, $METAeventLength); - //$thisfile_midi_raw['events'][$tracknumber][$eventid]['marker'] = $text_marker; - break; - - case 0x07: // Text: cue point - $text_cuepoint = substr($METAeventData, 0, $METAeventLength); - //$thisfile_midi_raw['events'][$tracknumber][$eventid]['cuepoint'] = $text_cuepoint; - break; - - case 0x2F: // End Of Track - //$thisfile_midi_raw['events'][$tracknumber][$eventid]['EOT'] = $CumulativeDeltaTime; - break; - - case 0x51: // Tempo: microseconds / quarter note - $CurrentMicroSecondsPerBeat = getid3_lib::BigEndian2Int(substr($METAeventData, 0, $METAeventLength)); - if ($CurrentMicroSecondsPerBeat == 0) { - $ThisFileInfo['error'][] = 'Corrupt MIDI file: CurrentMicroSecondsPerBeat == zero'; - return false; - } - $thisfile_midi_raw['events'][$tracknumber][$CumulativeDeltaTime]['us_qnote'] = $CurrentMicroSecondsPerBeat; - $CurrentBeatsPerMinute = (1000000 / $CurrentMicroSecondsPerBeat) * 60; - $MicroSecondsPerQuarterNoteAfter[$CumulativeDeltaTime] = $CurrentMicroSecondsPerBeat; - $TicksAtCurrentBPM = 0; - break; - - case 0x58: // Time signature - $timesig_numerator = getid3_lib::BigEndian2Int($METAeventData{0}); - $timesig_denominator = pow(2, getid3_lib::BigEndian2Int($METAeventData{1})); // $02 -> x/4, $03 -> x/8, etc - $timesig_32inqnote = getid3_lib::BigEndian2Int($METAeventData{2}); // number of 32nd notes to the quarter note - //$thisfile_midi_raw['events'][$tracknumber][$eventid]['timesig_32inqnote'] = $timesig_32inqnote; - //$thisfile_midi_raw['events'][$tracknumber][$eventid]['timesig_numerator'] = $timesig_numerator; - //$thisfile_midi_raw['events'][$tracknumber][$eventid]['timesig_denominator'] = $timesig_denominator; - //$thisfile_midi_raw['events'][$tracknumber][$eventid]['timesig_text'] = $timesig_numerator.'/'.$timesig_denominator; - $thisfile_midi['timesignature'][] = $timesig_numerator.'/'.$timesig_denominator; - break; - - case 0x59: // Keysignature - $keysig_sharpsflats = getid3_lib::BigEndian2Int($METAeventData{0}); - if ($keysig_sharpsflats & 0x80) { - // (-7 -> 7 flats, 0 ->key of C, 7 -> 7 sharps) - $keysig_sharpsflats -= 256; - } - - $keysig_majorminor = getid3_lib::BigEndian2Int($METAeventData{1}); // 0 -> major, 1 -> minor - $keysigs = array(-7=>'Cb', -6=>'Gb', -5=>'Db', -4=>'Ab', -3=>'Eb', -2=>'Bb', -1=>'F', 0=>'C', 1=>'G', 2=>'D', 3=>'A', 4=>'E', 5=>'B', 6=>'F#', 7=>'C#'); - //$thisfile_midi_raw['events'][$tracknumber][$eventid]['keysig_sharps'] = (($keysig_sharpsflats > 0) ? abs($keysig_sharpsflats) : 0); - //$thisfile_midi_raw['events'][$tracknumber][$eventid]['keysig_flats'] = (($keysig_sharpsflats < 0) ? abs($keysig_sharpsflats) : 0); - //$thisfile_midi_raw['events'][$tracknumber][$eventid]['keysig_minor'] = (bool) $keysig_majorminor; - //$thisfile_midi_raw['events'][$tracknumber][$eventid]['keysig_text'] = $keysigs[$keysig_sharpsflats].' '.($thisfile_midi_raw['events'][$tracknumber][$eventid]['keysig_minor'] ? 'minor' : 'major'); - - // $keysigs[$keysig_sharpsflats] gets an int key (correct) - $keysigs["$keysig_sharpsflats"] gets a string key (incorrect) - $thisfile_midi['keysignature'][] = $keysigs[$keysig_sharpsflats].' '.((bool) $keysig_majorminor ? 'minor' : 'major'); - break; - - case 0x7F: // Sequencer specific information - $custom_data = substr($METAeventData, 0, $METAeventLength); - break; - - default: - $ThisFileInfo['warning'][] = 'Unhandled META Event Command: '.$METAeventCommand; - break; - } - - } else { - - $ThisFileInfo['warning'][] = 'Unhandled MIDI Event ID: '.$MIDIevents[$tracknumber][$eventid]['eventid'].' + Channel ID: '.$MIDIevents[$tracknumber][$eventid]['channel']; - - } - } - if (($tracknumber > 0) || (count($trackdataarray) == 1)) { - $thisfile_midi['totalticks'] = max($thisfile_midi['totalticks'], $CumulativeDeltaTime); - } - } - $previoustickoffset = null; - - ksort($MicroSecondsPerQuarterNoteAfter); - foreach ($MicroSecondsPerQuarterNoteAfter as $tickoffset => $microsecondsperbeat) { - if (is_null($previoustickoffset)) { - $prevmicrosecondsperbeat = $microsecondsperbeat; - $previoustickoffset = $tickoffset; - continue; - } - if ($thisfile_midi['totalticks'] > $tickoffset) { - - if ($thisfile_midi_raw['ticksperqnote'] == 0) { - $ThisFileInfo['error'][] = 'Corrupt MIDI file: ticksperqnote == zero'; - return false; - } - - $ThisFileInfo['playtime_seconds'] += (($tickoffset - $previoustickoffset) / $thisfile_midi_raw['ticksperqnote']) * ($prevmicrosecondsperbeat / 1000000); - - $prevmicrosecondsperbeat = $microsecondsperbeat; - $previoustickoffset = $tickoffset; - } - } - if ($thisfile_midi['totalticks'] > $previoustickoffset) { - - if ($thisfile_midi_raw['ticksperqnote'] == 0) { - $ThisFileInfo['error'][] = 'Corrupt MIDI file: ticksperqnote == zero'; - return false; - } - - $ThisFileInfo['playtime_seconds'] += (($thisfile_midi['totalticks'] - $previoustickoffset) / $thisfile_midi_raw['ticksperqnote']) * ($microsecondsperbeat / 1000000); - - } - } - - - if (@$ThisFileInfo['playtime_seconds'] > 0) { - $ThisFileInfo['bitrate'] = (($ThisFileInfo['avdataend'] - $ThisFileInfo['avdataoffset']) * 8) / $ThisFileInfo['playtime_seconds']; - } - - if (!empty($thisfile_midi['lyrics'])) { - $thisfile_midi['comments']['lyrics'][] = $thisfile_midi['lyrics']; - } - - return true; - } - - function GeneralMIDIinstrumentLookup($instrumentid) { - - $begin = __LINE__; - - /** This is not a comment! - - 0 Acoustic Grand - 1 Bright Acoustic - 2 Electric Grand - 3 Honky-Tonk - 4 Electric Piano 1 - 5 Electric Piano 2 - 6 Harpsichord - 7 Clavier - 8 Celesta - 9 Glockenspiel - 10 Music Box - 11 Vibraphone - 12 Marimba - 13 Xylophone - 14 Tubular Bells - 15 Dulcimer - 16 Drawbar Organ - 17 Percussive Organ - 18 Rock Organ - 19 Church Organ - 20 Reed Organ - 21 Accordian - 22 Harmonica - 23 Tango Accordian - 24 Acoustic Guitar (nylon) - 25 Acoustic Guitar (steel) - 26 Electric Guitar (jazz) - 27 Electric Guitar (clean) - 28 Electric Guitar (muted) - 29 Overdriven Guitar - 30 Distortion Guitar - 31 Guitar Harmonics - 32 Acoustic Bass - 33 Electric Bass (finger) - 34 Electric Bass (pick) - 35 Fretless Bass - 36 Slap Bass 1 - 37 Slap Bass 2 - 38 Synth Bass 1 - 39 Synth Bass 2 - 40 Violin - 41 Viola - 42 Cello - 43 Contrabass - 44 Tremolo Strings - 45 Pizzicato Strings - 46 Orchestral Strings - 47 Timpani - 48 String Ensemble 1 - 49 String Ensemble 2 - 50 SynthStrings 1 - 51 SynthStrings 2 - 52 Choir Aahs - 53 Voice Oohs - 54 Synth Voice - 55 Orchestra Hit - 56 Trumpet - 57 Trombone - 58 Tuba - 59 Muted Trumpet - 60 French Horn - 61 Brass Section - 62 SynthBrass 1 - 63 SynthBrass 2 - 64 Soprano Sax - 65 Alto Sax - 66 Tenor Sax - 67 Baritone Sax - 68 Oboe - 69 English Horn - 70 Bassoon - 71 Clarinet - 72 Piccolo - 73 Flute - 74 Recorder - 75 Pan Flute - 76 Blown Bottle - 77 Shakuhachi - 78 Whistle - 79 Ocarina - 80 Lead 1 (square) - 81 Lead 2 (sawtooth) - 82 Lead 3 (calliope) - 83 Lead 4 (chiff) - 84 Lead 5 (charang) - 85 Lead 6 (voice) - 86 Lead 7 (fifths) - 87 Lead 8 (bass + lead) - 88 Pad 1 (new age) - 89 Pad 2 (warm) - 90 Pad 3 (polysynth) - 91 Pad 4 (choir) - 92 Pad 5 (bowed) - 93 Pad 6 (metallic) - 94 Pad 7 (halo) - 95 Pad 8 (sweep) - 96 FX 1 (rain) - 97 FX 2 (soundtrack) - 98 FX 3 (crystal) - 99 FX 4 (atmosphere) - 100 FX 5 (brightness) - 101 FX 6 (goblins) - 102 FX 7 (echoes) - 103 FX 8 (sci-fi) - 104 Sitar - 105 Banjo - 106 Shamisen - 107 Koto - 108 Kalimba - 109 Bagpipe - 110 Fiddle - 111 Shanai - 112 Tinkle Bell - 113 Agogo - 114 Steel Drums - 115 Woodblock - 116 Taiko Drum - 117 Melodic Tom - 118 Synth Drum - 119 Reverse Cymbal - 120 Guitar Fret Noise - 121 Breath Noise - 122 Seashore - 123 Bird Tweet - 124 Telephone Ring - 125 Helicopter - 126 Applause - 127 Gunshot - - */ - - return getid3_lib::EmbeddedLookup($instrumentid, $begin, __LINE__, __FILE__, 'GeneralMIDIinstrument'); - } - - function GeneralMIDIpercussionLookup($instrumentid) { - - $begin = __LINE__; - - /** This is not a comment! - - 35 Acoustic Bass Drum - 36 Bass Drum 1 - 37 Side Stick - 38 Acoustic Snare - 39 Hand Clap - 40 Electric Snare - 41 Low Floor Tom - 42 Closed Hi-Hat - 43 High Floor Tom - 44 Pedal Hi-Hat - 45 Low Tom - 46 Open Hi-Hat - 47 Low-Mid Tom - 48 Hi-Mid Tom - 49 Crash Cymbal 1 - 50 High Tom - 51 Ride Cymbal 1 - 52 Chinese Cymbal - 53 Ride Bell - 54 Tambourine - 55 Splash Cymbal - 56 Cowbell - 57 Crash Cymbal 2 - 59 Ride Cymbal 2 - 60 Hi Bongo - 61 Low Bongo - 62 Mute Hi Conga - 63 Open Hi Conga - 64 Low Conga - 65 High Timbale - 66 Low Timbale - 67 High Agogo - 68 Low Agogo - 69 Cabasa - 70 Maracas - 71 Short Whistle - 72 Long Whistle - 73 Short Guiro - 74 Long Guiro - 75 Claves - 76 Hi Wood Block - 77 Low Wood Block - 78 Mute Cuica - 79 Open Cuica - 80 Mute Triangle - 81 Open Triangle - - */ - - return getid3_lib::EmbeddedLookup($instrumentid, $begin, __LINE__, __FILE__, 'GeneralMIDIpercussion'); - } - -} - - -?>
\ No newline at end of file diff --git a/getid3/module.audio.mod.php b/getid3/module.audio.mod.php deleted file mode 100644 index 7f81ff3..0000000 --- a/getid3/module.audio.mod.php +++ /dev/null @@ -1,101 +0,0 @@ -<?php -///////////////////////////////////////////////////////////////// -/// getID3() by James Heinrich <info@getid3.org> // -// available at http://getid3.sourceforge.net // -// or http://www.getid3.org // -///////////////////////////////////////////////////////////////// -// See readme.txt for more details // -///////////////////////////////////////////////////////////////// -// // -// module.audio.mod.php // -// module for analyzing MOD Audio files // -// dependencies: NONE // -// /// -///////////////////////////////////////////////////////////////// - - -class getid3_mod -{ - - // new combined constructor - function getid3_mod(&$fd, &$ThisFileInfo, $option) { - - if ($option === 'mod') { - $this->getMODheaderFilepointer($fd, $ThisFileInfo); - } - elseif ($option === 'xm') { - $this->getXMheaderFilepointer($fd, $ThisFileInfo); - } - elseif ($option === 'it') { - $this->getITheaderFilepointer($fd, $ThisFileInfo); - } - elseif ($option === 's3m') { - $this->getS3MheaderFilepointer($fd, $ThisFileInfo); - } - } - - - function getMODheaderFilepointer(&$fd, &$ThisFileInfo) { - - fseek($fd, $ThisFileInfo['avdataoffset'] + 1080); - $FormatID = fread($fd, 4); - if (!ereg('^(M.K.|[5-9]CHN|[1-3][0-9]CH)$', $FormatID)) { - $ThisFileInfo['error'][] = 'This is not a known type of MOD file'; - return false; - } - - $ThisFileInfo['fileformat'] = 'mod'; - - $ThisFileInfo['error'][] = 'MOD parsing not enabled in this version of getID3()'; - return false; - } - - function getXMheaderFilepointer(&$fd, &$ThisFileInfo) { - - fseek($fd, $ThisFileInfo['avdataoffset']); - $FormatID = fread($fd, 15); - if (!ereg('^Extended Module$', $FormatID)) { - $ThisFileInfo['error'][] = 'This is not a known type of XM-MOD file'; - return false; - } - - $ThisFileInfo['fileformat'] = 'xm'; - - $ThisFileInfo['error'][] = 'XM-MOD parsing not enabled in this version of getID3()'; - return false; - } - - function getS3MheaderFilepointer(&$fd, &$ThisFileInfo) { - - fseek($fd, $ThisFileInfo['avdataoffset'] + 44); - $FormatID = fread($fd, 4); - if (!ereg('^SCRM$', $FormatID)) { - $ThisFileInfo['error'][] = 'This is not a ScreamTracker MOD file'; - return false; - } - - $ThisFileInfo['fileformat'] = 's3m'; - - $ThisFileInfo['error'][] = 'ScreamTracker parsing not enabled in this version of getID3()'; - return false; - } - - function getITheaderFilepointer(&$fd, &$ThisFileInfo) { - - fseek($fd, $ThisFileInfo['avdataoffset']); - $FormatID = fread($fd, 4); - if (!ereg('^IMPM$', $FormatID)) { - $ThisFileInfo['error'][] = 'This is not an ImpulseTracker MOD file'; - return false; - } - - $ThisFileInfo['fileformat'] = 'it'; - - $ThisFileInfo['error'][] = 'ImpulseTracker parsing not enabled in this version of getID3()'; - return false; - } - -} - - -?>
\ No newline at end of file diff --git a/getid3/module.audio.monkey.php b/getid3/module.audio.monkey.php deleted file mode 100644 index 42382ad..0000000 --- a/getid3/module.audio.monkey.php +++ /dev/null @@ -1,202 +0,0 @@ -<?php -///////////////////////////////////////////////////////////////// -/// getID3() by James Heinrich <info@getid3.org> // -// available at http://getid3.sourceforge.net // -// or http://www.getid3.org // -///////////////////////////////////////////////////////////////// -// See readme.txt for more details // -///////////////////////////////////////////////////////////////// -// // -// module.audio.monkey.php // -// module for analyzing Monkey's Audio files // -// dependencies: NONE // -// /// -///////////////////////////////////////////////////////////////// - - -class getid3_monkey -{ - - function getid3_monkey(&$fd, &$ThisFileInfo) { - // based loosely on code from TMonkey by Jurgen Faul <jfaulØgmx*de> - // http://jfaul.de/atl or http://j-faul.virtualave.net/atl/atl.html - - $ThisFileInfo['fileformat'] = 'mac'; - $ThisFileInfo['audio']['dataformat'] = 'mac'; - $ThisFileInfo['audio']['bitrate_mode'] = 'vbr'; - $ThisFileInfo['audio']['lossless'] = true; - - $ThisFileInfo['monkeys_audio']['raw'] = array(); - $thisfile_monkeysaudio = &$ThisFileInfo['monkeys_audio']; - $thisfile_monkeysaudio_raw = &$thisfile_monkeysaudio['raw']; - - fseek($fd, $ThisFileInfo['avdataoffset'], SEEK_SET); - $MACheaderData = fread($fd, 74); - - $thisfile_monkeysaudio_raw['magic'] = substr($MACheaderData, 0, 4); - if ($thisfile_monkeysaudio_raw['magic'] != 'MAC ') { - $ThisFileInfo['error'][] = 'Expecting "MAC" at offset '.$ThisFileInfo['avdataoffset'].', found "'.$thisfile_monkeysaudio_raw['magic'].'"'; - unset($ThisFileInfo['fileformat']); - return false; - } - $thisfile_monkeysaudio_raw['nVersion'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, 4, 2)); // appears to be uint32 in 3.98+ - - if ($thisfile_monkeysaudio_raw['nVersion'] < 3980) { - $thisfile_monkeysaudio_raw['nCompressionLevel'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, 6, 2)); - $thisfile_monkeysaudio_raw['nFormatFlags'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, 8, 2)); - $thisfile_monkeysaudio_raw['nChannels'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, 10, 2)); - $thisfile_monkeysaudio_raw['nSampleRate'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, 12, 4)); - $thisfile_monkeysaudio_raw['nHeaderDataBytes'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, 16, 4)); - $thisfile_monkeysaudio_raw['nWAVTerminatingBytes'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, 20, 4)); - $thisfile_monkeysaudio_raw['nTotalFrames'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, 24, 4)); - $thisfile_monkeysaudio_raw['nFinalFrameSamples'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, 28, 4)); - $thisfile_monkeysaudio_raw['nPeakLevel'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, 32, 4)); - $thisfile_monkeysaudio_raw['nSeekElements'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, 38, 2)); - $offset = 8; - } else { - $offset = 8; - // APE_DESCRIPTOR - $thisfile_monkeysaudio_raw['nDescriptorBytes'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, $offset, 4)); - $offset += 4; - $thisfile_monkeysaudio_raw['nHeaderBytes'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, $offset, 4)); - $offset += 4; - $thisfile_monkeysaudio_raw['nSeekTableBytes'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, $offset, 4)); - $offset += 4; - $thisfile_monkeysaudio_raw['nHeaderDataBytes'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, $offset, 4)); - $offset += 4; - $thisfile_monkeysaudio_raw['nAPEFrameDataBytes'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, $offset, 4)); - $offset += 4; - $thisfile_monkeysaudio_raw['nAPEFrameDataBytesHigh'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, $offset, 4)); - $offset += 4; - $thisfile_monkeysaudio_raw['nTerminatingDataBytes'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, $offset, 4)); - $offset += 4; - $thisfile_monkeysaudio_raw['cFileMD5'] = substr($MACheaderData, $offset, 16); - $offset += 16; - - // APE_HEADER - $thisfile_monkeysaudio_raw['nCompressionLevel'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, $offset, 2)); - $offset += 2; - $thisfile_monkeysaudio_raw['nFormatFlags'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, $offset, 2)); - $offset += 2; - $thisfile_monkeysaudio_raw['nBlocksPerFrame'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, $offset, 4)); - $offset += 4; - $thisfile_monkeysaudio_raw['nFinalFrameBlocks'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, $offset, 4)); - $offset += 4; - $thisfile_monkeysaudio_raw['nTotalFrames'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, $offset, 4)); - $offset += 4; - $thisfile_monkeysaudio_raw['nBitsPerSample'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, $offset, 2)); - $offset += 2; - $thisfile_monkeysaudio_raw['nChannels'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, $offset, 2)); - $offset += 2; - $thisfile_monkeysaudio_raw['nSampleRate'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, $offset, 4)); - $offset += 4; - } - - $thisfile_monkeysaudio['flags']['8-bit'] = (bool) ($thisfile_monkeysaudio_raw['nFormatFlags'] & 0x0001); - $thisfile_monkeysaudio['flags']['crc-32'] = (bool) ($thisfile_monkeysaudio_raw['nFormatFlags'] & 0x0002); - $thisfile_monkeysaudio['flags']['peak_level'] = (bool) ($thisfile_monkeysaudio_raw['nFormatFlags'] & 0x0004); - $thisfile_monkeysaudio['flags']['24-bit'] = (bool) ($thisfile_monkeysaudio_raw['nFormatFlags'] & 0x0008); - $thisfile_monkeysaudio['flags']['seek_elements'] = (bool) ($thisfile_monkeysaudio_raw['nFormatFlags'] & 0x0010); - $thisfile_monkeysaudio['flags']['no_wav_header'] = (bool) ($thisfile_monkeysaudio_raw['nFormatFlags'] & 0x0020); - $thisfile_monkeysaudio['version'] = $thisfile_monkeysaudio_raw['nVersion'] / 1000; - $thisfile_monkeysaudio['compression'] = $this->MonkeyCompressionLevelNameLookup($thisfile_monkeysaudio_raw['nCompressionLevel']); - if ($thisfile_monkeysaudio_raw['nVersion'] < 3980) { - $thisfile_monkeysaudio['samples_per_frame'] = $this->MonkeySamplesPerFrame($thisfile_monkeysaudio_raw['nVersion'], $thisfile_monkeysaudio_raw['nCompressionLevel']); - } - $thisfile_monkeysaudio['bits_per_sample'] = ($thisfile_monkeysaudio['flags']['24-bit'] ? 24 : ($thisfile_monkeysaudio['flags']['8-bit'] ? 8 : 16)); - $thisfile_monkeysaudio['channels'] = $thisfile_monkeysaudio_raw['nChannels']; - $ThisFileInfo['audio']['channels'] = $thisfile_monkeysaudio['channels']; - $thisfile_monkeysaudio['sample_rate'] = $thisfile_monkeysaudio_raw['nSampleRate']; - if ($thisfile_monkeysaudio['sample_rate'] == 0) { - $ThisFileInfo['error'][] = 'Corrupt MAC file: frequency == zero'; - return false; - } - $ThisFileInfo['audio']['sample_rate'] = $thisfile_monkeysaudio['sample_rate']; - if ($thisfile_monkeysaudio['flags']['peak_level']) { - $thisfile_monkeysaudio['peak_level'] = $thisfile_monkeysaudio_raw['nPeakLevel']; - $thisfile_monkeysaudio['peak_ratio'] = $thisfile_monkeysaudio['peak_level'] / pow(2, $thisfile_monkeysaudio['bits_per_sample'] - 1); - } - if ($thisfile_monkeysaudio_raw['nVersion'] >= 3980) { - $thisfile_monkeysaudio['samples'] = (($thisfile_monkeysaudio_raw['nTotalFrames'] - 1) * $thisfile_monkeysaudio_raw['nBlocksPerFrame']) + $thisfile_monkeysaudio_raw['nFinalFrameBlocks']; - } else { - $thisfile_monkeysaudio['samples'] = (($thisfile_monkeysaudio_raw['nTotalFrames'] - 1) * $thisfile_monkeysaudio['samples_per_frame']) + $thisfile_monkeysaudio_raw['nFinalFrameSamples']; - } - $thisfile_monkeysaudio['playtime'] = $thisfile_monkeysaudio['samples'] / $thisfile_monkeysaudio['sample_rate']; - if ($thisfile_monkeysaudio['playtime'] == 0) { - $ThisFileInfo['error'][] = 'Corrupt MAC file: playtime == zero'; - return false; - } - $ThisFileInfo['playtime_seconds'] = $thisfile_monkeysaudio['playtime']; - $thisfile_monkeysaudio['compressed_size'] = $ThisFileInfo['avdataend'] - $ThisFileInfo['avdataoffset']; - $thisfile_monkeysaudio['uncompressed_size'] = $thisfile_monkeysaudio['samples'] * $thisfile_monkeysaudio['channels'] * ($thisfile_monkeysaudio['bits_per_sample'] / 8); - if ($thisfile_monkeysaudio['uncompressed_size'] == 0) { - $ThisFileInfo['error'][] = 'Corrupt MAC file: uncompressed_size == zero'; - return false; - } - $thisfile_monkeysaudio['compression_ratio'] = $thisfile_monkeysaudio['compressed_size'] / ($thisfile_monkeysaudio['uncompressed_size'] + $thisfile_monkeysaudio_raw['nHeaderDataBytes']); - $thisfile_monkeysaudio['bitrate'] = (($thisfile_monkeysaudio['samples'] * $thisfile_monkeysaudio['channels'] * $thisfile_monkeysaudio['bits_per_sample']) / $thisfile_monkeysaudio['playtime']) * $thisfile_monkeysaudio['compression_ratio']; - $ThisFileInfo['audio']['bitrate'] = $thisfile_monkeysaudio['bitrate']; - - // add size of MAC header to avdataoffset - if ($thisfile_monkeysaudio_raw['nVersion'] >= 3980) { - $ThisFileInfo['avdataoffset'] += $thisfile_monkeysaudio_raw['nDescriptorBytes']; - $ThisFileInfo['avdataoffset'] += $thisfile_monkeysaudio_raw['nHeaderBytes']; - $ThisFileInfo['avdataoffset'] += $thisfile_monkeysaudio_raw['nSeekTableBytes']; - $ThisFileInfo['avdataoffset'] += $thisfile_monkeysaudio_raw['nHeaderDataBytes']; - - $ThisFileInfo['avdataend'] -= $thisfile_monkeysaudio_raw['nTerminatingDataBytes']; - } else { - $ThisFileInfo['avdataoffset'] += $offset; - } - - if ($thisfile_monkeysaudio_raw['nVersion'] >= 3980) { - if ($thisfile_monkeysaudio_raw['cFileMD5'] === str_repeat("\x00", 16)) { - //$ThisFileInfo['warning'][] = 'cFileMD5 is null'; - } else { - $ThisFileInfo['md5_data_source'] = ''; - $md5 = $thisfile_monkeysaudio_raw['cFileMD5']; - for ($i = 0; $i < strlen($md5); $i++) { - $ThisFileInfo['md5_data_source'] .= str_pad(dechex(ord($md5{$i})), 2, '00', STR_PAD_LEFT); - } - if (!preg_match('/^[0-9a-f]{32}$/', $ThisFileInfo['md5_data_source'])) { - unset($ThisFileInfo['md5_data_source']); - } - } - } - - - - $ThisFileInfo['audio']['bits_per_sample'] = $thisfile_monkeysaudio['bits_per_sample']; - $ThisFileInfo['audio']['encoder'] = 'MAC v'.number_format($thisfile_monkeysaudio['version'], 2); - $ThisFileInfo['audio']['encoder_options'] = ucfirst($thisfile_monkeysaudio['compression']).' compression'; - - return true; - } - - function MonkeyCompressionLevelNameLookup($compressionlevel) { - static $MonkeyCompressionLevelNameLookup = array( - 0 => 'unknown', - 1000 => 'fast', - 2000 => 'normal', - 3000 => 'high', - 4000 => 'extra-high', - 5000 => 'insane' - ); - return (isset($MonkeyCompressionLevelNameLookup[$compressionlevel]) ? $MonkeyCompressionLevelNameLookup[$compressionlevel] : 'invalid'); - } - - function MonkeySamplesPerFrame($versionid, $compressionlevel) { - if ($versionid >= 3950) { - return 73728 * 4; - } elseif ($versionid >= 3900) { - return 73728; - } elseif (($versionid >= 3800) && ($compressionlevel == 4000)) { - return 73728; - } else { - return 9216; - } - } - -} - -?>
\ No newline at end of file diff --git a/getid3/module.audio.mp3.php b/getid3/module.audio.mp3.php deleted file mode 100644 index ac9a273..0000000 --- a/getid3/module.audio.mp3.php +++ /dev/null @@ -1,2022 +0,0 @@ -<?php -///////////////////////////////////////////////////////////////// -/// getID3() by James Heinrich <info@getid3.org> // -// available at http://getid3.sourceforge.net // -// or http://www.getid3.org // -///////////////////////////////////////////////////////////////// -// See readme.txt for more details // -///////////////////////////////////////////////////////////////// -// // -// module.audio.mp3.php // -// module for analyzing MP3 files // -// dependencies: NONE // -// /// -///////////////////////////////////////////////////////////////// - - -// number of frames to scan to determine if MPEG-audio sequence is valid -// Lower this number to 5-20 for faster scanning -// Increase this number to 50+ for most accurate detection of valid VBR/CBR -// mpeg-audio streams -define('GETID3_MP3_VALID_CHECK_FRAMES', 35); - - -class getid3_mp3 -{ - - var $allow_bruteforce = false; // forces getID3() to scan the file byte-by-byte and log all the valid audio frame headers - extremely slow, unrecommended, but may provide data from otherwise-unusuable files - - function getid3_mp3(&$fd, &$ThisFileInfo) { - - if (!$this->getOnlyMPEGaudioInfo($fd, $ThisFileInfo, $ThisFileInfo['avdataoffset'])) { - if ($this->allow_bruteforce) { - $ThisFileInfo['error'][] = 'Rescanning file in BruteForce mode'; - $this->getOnlyMPEGaudioInfoBruteForce($fd, $ThisFileInfo); - } - } - - - if (isset($ThisFileInfo['mpeg']['audio']['bitrate_mode'])) { - $ThisFileInfo['audio']['bitrate_mode'] = strtolower($ThisFileInfo['mpeg']['audio']['bitrate_mode']); - } - - if (((isset($ThisFileInfo['id3v2']['headerlength']) && ($ThisFileInfo['avdataoffset'] > $ThisFileInfo['id3v2']['headerlength'])) || (!isset($ThisFileInfo['id3v2']) && ($ThisFileInfo['avdataoffset'] > 0)))) { - - $synchoffsetwarning = 'Unknown data before synch '; - if (isset($ThisFileInfo['id3v2']['headerlength'])) { - $synchoffsetwarning .= '(ID3v2 header ends at '.$ThisFileInfo['id3v2']['headerlength'].', then '.($ThisFileInfo['avdataoffset'] - $ThisFileInfo['id3v2']['headerlength']).' bytes garbage, '; - } else { - $synchoffsetwarning .= '(should be at beginning of file, '; - } - $synchoffsetwarning .= 'synch detected at '.$ThisFileInfo['avdataoffset'].')'; - if (@$ThisFileInfo['audio']['bitrate_mode'] == 'cbr') { - - if (!empty($ThisFileInfo['id3v2']['headerlength']) && (($ThisFileInfo['avdataoffset'] - $ThisFileInfo['id3v2']['headerlength']) == $ThisFileInfo['mpeg']['audio']['framelength'])) { - - $synchoffsetwarning .= '. This is a known problem with some versions of LAME (3.90-3.92) DLL in CBR mode.'; - $ThisFileInfo['audio']['codec'] = 'LAME'; - $CurrentDataLAMEversionString = 'LAME3.'; - - } elseif (empty($ThisFileInfo['id3v2']['headerlength']) && ($ThisFileInfo['avdataoffset'] == $ThisFileInfo['mpeg']['audio']['framelength'])) { - - $synchoffsetwarning .= '. This is a known problem with some versions of LAME (3.90 - 3.92) DLL in CBR mode.'; - $ThisFileInfo['audio']['codec'] = 'LAME'; - $CurrentDataLAMEversionString = 'LAME3.'; - - } - - } - $ThisFileInfo['warning'][] = $synchoffsetwarning; - - } - - if (isset($ThisFileInfo['mpeg']['audio']['LAME'])) { - $ThisFileInfo['audio']['codec'] = 'LAME'; - if (!empty($ThisFileInfo['mpeg']['audio']['LAME']['long_version'])) { - $ThisFileInfo['audio']['encoder'] = rtrim($ThisFileInfo['mpeg']['audio']['LAME']['long_version'], "\x00"); - } elseif (!empty($ThisFileInfo['mpeg']['audio']['LAME']['short_version'])) { - $ThisFileInfo['audio']['encoder'] = rtrim($ThisFileInfo['mpeg']['audio']['LAME']['short_version'], "\x00"); - } - } - - $CurrentDataLAMEversionString = (!empty($CurrentDataLAMEversionString) ? $CurrentDataLAMEversionString : @$ThisFileInfo['audio']['encoder']); - if (!empty($CurrentDataLAMEversionString) && (substr($CurrentDataLAMEversionString, 0, 6) == 'LAME3.') && !preg_match('[0-9\)]', substr($CurrentDataLAMEversionString, -1))) { - // a version number of LAME that does not end with a number like "LAME3.92" - // or with a closing parenthesis like "LAME3.88 (alpha)" - // or a version of LAME with the LAMEtag-not-filled-in-DLL-mode bug (3.90-3.92) - - // not sure what the actual last frame length will be, but will be less than or equal to 1441 - $PossiblyLongerLAMEversion_FrameLength = 1441; - - // Not sure what version of LAME this is - look in padding of last frame for longer version string - $PossibleLAMEversionStringOffset = $ThisFileInfo['avdataend'] - $PossiblyLongerLAMEversion_FrameLength; - fseek($fd, $PossibleLAMEversionStringOffset); - $PossiblyLongerLAMEversion_Data = fread($fd, $PossiblyLongerLAMEversion_FrameLength); - switch (substr($CurrentDataLAMEversionString, -1)) { - case 'a': - case 'b': - // "LAME3.94a" will have a longer version string of "LAME3.94 (alpha)" for example - // need to trim off "a" to match longer string - $CurrentDataLAMEversionString = substr($CurrentDataLAMEversionString, 0, -1); - break; - } - if (($PossiblyLongerLAMEversion_String = strstr($PossiblyLongerLAMEversion_Data, $CurrentDataLAMEversionString)) !== false) { - if (substr($PossiblyLongerLAMEversion_String, 0, strlen($CurrentDataLAMEversionString)) == $CurrentDataLAMEversionString) { - $PossiblyLongerLAMEversion_NewString = substr($PossiblyLongerLAMEversion_String, 0, strspn($PossiblyLongerLAMEversion_String, 'LAME0123456789., (abcdefghijklmnopqrstuvwxyzJFSOND)')); //"LAME3.90.3" "LAME3.87 (beta 1, Sep 27 2000)" "LAME3.88 (beta)" - if (strlen($PossiblyLongerLAMEversion_NewString) > strlen(@$ThisFileInfo['audio']['encoder'])) { - $ThisFileInfo['audio']['encoder'] = $PossiblyLongerLAMEversion_NewString; - } - } - } - } - if (!empty($ThisFileInfo['audio']['encoder'])) { - $ThisFileInfo['audio']['encoder'] = rtrim($ThisFileInfo['audio']['encoder'], "\x00 "); - } - - switch (@$ThisFileInfo['mpeg']['audio']['layer']) { - case 1: - case 2: - $ThisFileInfo['audio']['dataformat'] = 'mp'.$ThisFileInfo['mpeg']['audio']['layer']; - break; - } - if (@$ThisFileInfo['fileformat'] == 'mp3') { - switch ($ThisFileInfo['audio']['dataformat']) { - case 'mp1': - case 'mp2': - case 'mp3': - $ThisFileInfo['fileformat'] = $ThisFileInfo['audio']['dataformat']; - break; - - default: - $ThisFileInfo['warning'][] = 'Expecting [audio][dataformat] to be mp1/mp2/mp3 when fileformat == mp3, [audio][dataformat] actually "'.$ThisFileInfo['audio']['dataformat'].'"'; - break; - } - } - - if (empty($ThisFileInfo['fileformat'])) { - unset($ThisFileInfo['fileformat']); - unset($ThisFileInfo['audio']['bitrate_mode']); - unset($ThisFileInfo['avdataoffset']); - unset($ThisFileInfo['avdataend']); - return false; - } - - $ThisFileInfo['mime_type'] = 'audio/mpeg'; - $ThisFileInfo['audio']['lossless'] = false; - - // Calculate playtime - if (!isset($ThisFileInfo['playtime_seconds']) && isset($ThisFileInfo['audio']['bitrate']) && ($ThisFileInfo['audio']['bitrate'] > 0)) { - $ThisFileInfo['playtime_seconds'] = ($ThisFileInfo['avdataend'] - $ThisFileInfo['avdataoffset']) * 8 / $ThisFileInfo['audio']['bitrate']; - } - - $ThisFileInfo['audio']['encoder_options'] = $this->GuessEncoderOptions($ThisFileInfo); - - return true; - } - - - function GuessEncoderOptions(&$ThisFileInfo) { - // shortcuts - if (!empty($ThisFileInfo['mpeg']['audio'])) { - $thisfile_mpeg_audio = &$ThisFileInfo['mpeg']['audio']; - if (!empty($thisfile_mpeg_audio['LAME'])) { - $thisfile_mpeg_audio_lame = &$thisfile_mpeg_audio['LAME']; - } - } - - $encoder_options = ''; - static $NamedPresetBitrates = array(16, 24, 40, 56, 112, 128, 160, 192, 256); - - if ((@$thisfile_mpeg_audio['VBR_method'] == 'Fraunhofer') && !empty($thisfile_mpeg_audio['VBR_quality'])) { - - $encoder_options = 'VBR q'.$thisfile_mpeg_audio['VBR_quality']; - - } elseif (!empty($thisfile_mpeg_audio_lame['preset_used']) && (!in_array($thisfile_mpeg_audio_lame['preset_used_id'], $NamedPresetBitrates))) { - - $encoder_options = $thisfile_mpeg_audio_lame['preset_used']; - - } elseif (!empty($thisfile_mpeg_audio_lame['vbr_quality'])) { - - static $KnownEncoderValues = array(); - if (empty($KnownEncoderValues)) { - - //$KnownEncoderValues[abrbitrate_minbitrate][vbr_quality][raw_vbr_method][raw_noise_shaping][raw_stereo_mode][ath_type][lowpass_frequency] = 'preset name'; - $KnownEncoderValues[0xFF][58][1][1][3][2][20500] = '--alt-preset insane'; // 3.90, 3.90.1, 3.92 - $KnownEncoderValues[0xFF][58][1][1][3][2][20600] = '--alt-preset insane'; // 3.90.2, 3.90.3, 3.91 - $KnownEncoderValues[0xFF][57][1][1][3][4][20500] = '--alt-preset insane'; // 3.94, 3.95 - $KnownEncoderValues['**'][78][3][2][3][2][19500] = '--alt-preset extreme'; // 3.90, 3.90.1, 3.92 - $KnownEncoderValues['**'][78][3][2][3][2][19600] = '--alt-preset extreme'; // 3.90.2, 3.91 - $KnownEncoderValues['**'][78][3][1][3][2][19600] = '--alt-preset extreme'; // 3.90.3 - $KnownEncoderValues['**'][78][4][2][3][2][19500] = '--alt-preset fast extreme'; // 3.90, 3.90.1, 3.92 - $KnownEncoderValues['**'][78][4][2][3][2][19600] = '--alt-preset fast extreme'; // 3.90.2, 3.90.3, 3.91 - $KnownEncoderValues['**'][78][3][2][3][4][19000] = '--alt-preset standard'; // 3.90, 3.90.1, 3.90.2, 3.91, 3.92 - $KnownEncoderValues['**'][78][3][1][3][4][19000] = '--alt-preset standard'; // 3.90.3 - $KnownEncoderValues['**'][78][4][2][3][4][19000] = '--alt-preset fast standard'; // 3.90, 3.90.1, 3.90.2, 3.91, 3.92 - $KnownEncoderValues['**'][78][4][1][3][4][19000] = '--alt-preset fast standard'; // 3.90.3 - $KnownEncoderValues['**'][88][4][1][3][3][19500] = '--r3mix'; // 3.90, 3.90.1, 3.92 - $KnownEncoderValues['**'][88][4][1][3][3][19600] = '--r3mix'; // 3.90.2, 3.90.3, 3.91 - $KnownEncoderValues['**'][67][4][1][3][4][18000] = '--r3mix'; // 3.94, 3.95 - $KnownEncoderValues['**'][68][3][2][3][4][18000] = '--alt-preset medium'; // 3.90.3 - $KnownEncoderValues['**'][68][4][2][3][4][18000] = '--alt-preset fast medium'; // 3.90.3 - - $KnownEncoderValues[0xFF][99][1][1][1][2][0] = '--preset studio'; // 3.90, 3.90.1, 3.90.2, 3.91, 3.92 - $KnownEncoderValues[0xFF][58][2][1][3][2][20600] = '--preset studio'; // 3.90.3, 3.93.1 - $KnownEncoderValues[0xFF][58][2][1][3][2][20500] = '--preset studio'; // 3.93 - $KnownEncoderValues[0xFF][57][2][1][3][4][20500] = '--preset studio'; // 3.94, 3.95 - $KnownEncoderValues[0xC0][88][1][1][1][2][0] = '--preset cd'; // 3.90, 3.90.1, 3.90.2, 3.91, 3.92 - $KnownEncoderValues[0xC0][58][2][2][3][2][19600] = '--preset cd'; // 3.90.3, 3.93.1 - $KnownEncoderValues[0xC0][58][2][2][3][2][19500] = '--preset cd'; // 3.93 - $KnownEncoderValues[0xC0][57][2][1][3][4][19500] = '--preset cd'; // 3.94, 3.95 - $KnownEncoderValues[0xA0][78][1][1][3][2][18000] = '--preset hifi'; // 3.90, 3.90.1, 3.90.2, 3.91, 3.92 - $KnownEncoderValues[0xA0][58][2][2][3][2][18000] = '--preset hifi'; // 3.90.3, 3.93, 3.93.1 - $KnownEncoderValues[0xA0][57][2][1][3][4][18000] = '--preset hifi'; // 3.94, 3.95 - $KnownEncoderValues[0x80][67][1][1][3][2][18000] = '--preset tape'; // 3.90, 3.90.1, 3.90.2, 3.91, 3.92 - $KnownEncoderValues[0x80][67][1][1][3][2][15000] = '--preset radio'; // 3.90, 3.90.1, 3.90.2, 3.91, 3.92 - $KnownEncoderValues[0x70][67][1][1][3][2][15000] = '--preset fm'; // 3.90, 3.90.1, 3.90.2, 3.91, 3.92 - $KnownEncoderValues[0x70][58][2][2][3][2][16000] = '--preset tape/radio/fm'; // 3.90.3, 3.93, 3.93.1 - $KnownEncoderValues[0x70][57][2][1][3][4][16000] = '--preset tape/radio/fm'; // 3.94, 3.95 - $KnownEncoderValues[0x38][58][2][2][0][2][10000] = '--preset voice'; // 3.90.3, 3.93, 3.93.1 - $KnownEncoderValues[0x38][57][2][1][0][4][15000] = '--preset voice'; // 3.94, 3.95 - $KnownEncoderValues[0x38][57][2][1][0][4][16000] = '--preset voice'; // 3.94a14 - $KnownEncoderValues[0x28][65][1][1][0][2][7500] = '--preset mw-us'; // 3.90, 3.90.1, 3.92 - $KnownEncoderValues[0x28][65][1][1][0][2][7600] = '--preset mw-us'; // 3.90.2, 3.91 - $KnownEncoderValues[0x28][58][2][2][0][2][7000] = '--preset mw-us'; // 3.90.3, 3.93, 3.93.1 - $KnownEncoderValues[0x28][57][2][1][0][4][10500] = '--preset mw-us'; // 3.94, 3.95 - $KnownEncoderValues[0x28][57][2][1][0][4][11200] = '--preset mw-us'; // 3.94a14 - $KnownEncoderValues[0x28][57][2][1][0][4][8800] = '--preset mw-us'; // 3.94a15 - $KnownEncoderValues[0x18][58][2][2][0][2][4000] = '--preset phon+/lw/mw-eu/sw'; // 3.90.3, 3.93.1 - $KnownEncoderValues[0x18][58][2][2][0][2][3900] = '--preset phon+/lw/mw-eu/sw'; // 3.93 - $KnownEncoderValues[0x18][57][2][1][0][4][5900] = '--preset phon+/lw/mw-eu/sw'; // 3.94, 3.95 - $KnownEncoderValues[0x18][57][2][1][0][4][6200] = '--preset phon+/lw/mw-eu/sw'; // 3.94a14 - $KnownEncoderValues[0x18][57][2][1][0][4][3200] = '--preset phon+/lw/mw-eu/sw'; // 3.94a15 - $KnownEncoderValues[0x10][58][2][2][0][2][3800] = '--preset phone'; // 3.90.3, 3.93.1 - $KnownEncoderValues[0x10][58][2][2][0][2][3700] = '--preset phone'; // 3.93 - $KnownEncoderValues[0x10][57][2][1][0][4][5600] = '--preset phone'; // 3.94, 3.95 - } - - if (isset($KnownEncoderValues[$thisfile_mpeg_audio_lame['raw']['abrbitrate_minbitrate']][$thisfile_mpeg_audio_lame['vbr_quality']][$thisfile_mpeg_audio_lame['raw']['vbr_method']][$thisfile_mpeg_audio_lame['raw']['noise_shaping']][$thisfile_mpeg_audio_lame['raw']['stereo_mode']][$thisfile_mpeg_audio_lame['ath_type']][$thisfile_mpeg_audio_lame['lowpass_frequency']])) { - - $encoder_options = $KnownEncoderValues[$thisfile_mpeg_audio_lame['raw']['abrbitrate_minbitrate']][$thisfile_mpeg_audio_lame['vbr_quality']][$thisfile_mpeg_audio_lame['raw']['vbr_method']][$thisfile_mpeg_audio_lame['raw']['noise_shaping']][$thisfile_mpeg_audio_lame['raw']['stereo_mode']][$thisfile_mpeg_audio_lame['ath_type']][$thisfile_mpeg_audio_lame['lowpass_frequency']]; - - } elseif (isset($KnownEncoderValues['**'][$thisfile_mpeg_audio_lame['vbr_quality']][$thisfile_mpeg_audio_lame['raw']['vbr_method']][$thisfile_mpeg_audio_lame['raw']['noise_shaping']][$thisfile_mpeg_audio_lame['raw']['stereo_mode']][$thisfile_mpeg_audio_lame['ath_type']][$thisfile_mpeg_audio_lame['lowpass_frequency']])) { - - $encoder_options = $KnownEncoderValues['**'][$thisfile_mpeg_audio_lame['vbr_quality']][$thisfile_mpeg_audio_lame['raw']['vbr_method']][$thisfile_mpeg_audio_lame['raw']['noise_shaping']][$thisfile_mpeg_audio_lame['raw']['stereo_mode']][$thisfile_mpeg_audio_lame['ath_type']][$thisfile_mpeg_audio_lame['lowpass_frequency']]; - - } elseif ($ThisFileInfo['audio']['bitrate_mode'] == 'vbr') { - - // http://gabriel.mp3-tech.org/mp3infotag.html - // int Quality = (100 - 10 * gfp->VBR_q - gfp->quality)h - - - $LAME_V_value = 10 - ceil($thisfile_mpeg_audio_lame['vbr_quality'] / 10); - $LAME_q_value = 100 - $thisfile_mpeg_audio_lame['vbr_quality'] - ($LAME_V_value * 10); - $encoder_options = '-V'.$LAME_V_value.' -q'.$LAME_q_value; - - } elseif ($ThisFileInfo['audio']['bitrate_mode'] == 'cbr') { - - $encoder_options = strtoupper($ThisFileInfo['audio']['bitrate_mode']).ceil($ThisFileInfo['audio']['bitrate'] / 1000); - - } else { - - $encoder_options = strtoupper($ThisFileInfo['audio']['bitrate_mode']); - - } - - } elseif (!empty($thisfile_mpeg_audio_lame['bitrate_abr'])) { - - $encoder_options = 'ABR'.$thisfile_mpeg_audio_lame['bitrate_abr']; - - } elseif (!empty($ThisFileInfo['audio']['bitrate'])) { - - if ($ThisFileInfo['audio']['bitrate_mode'] == 'cbr') { - $encoder_options = strtoupper($ThisFileInfo['audio']['bitrate_mode']).ceil($ThisFileInfo['audio']['bitrate'] / 1000); - } else { - $encoder_options = strtoupper($ThisFileInfo['audio']['bitrate_mode']); - } - - } - if (!empty($thisfile_mpeg_audio_lame['bitrate_min'])) { - $encoder_options .= ' -b'.$thisfile_mpeg_audio_lame['bitrate_min']; - } - - if (@$thisfile_mpeg_audio_lame['encoding_flags']['nogap_prev'] || @$thisfile_mpeg_audio_lame['encoding_flags']['nogap_next']) { - $encoder_options .= ' --nogap'; - } - - if (!empty($thisfile_mpeg_audio_lame['lowpass_frequency'])) { - $ExplodedOptions = explode(' ', $encoder_options, 4); - if ($ExplodedOptions[0] == '--r3mix') { - $ExplodedOptions[1] = 'r3mix'; - } - switch ($ExplodedOptions[0]) { - case '--preset': - case '--alt-preset': - case '--r3mix': - if ($ExplodedOptions[1] == 'fast') { - $ExplodedOptions[1] .= ' '.$ExplodedOptions[2]; - } - switch ($ExplodedOptions[1]) { - case 'portable': - case 'medium': - case 'standard': - case 'extreme': - case 'insane': - case 'fast portable': - case 'fast medium': - case 'fast standard': - case 'fast extreme': - case 'fast insane': - case 'r3mix': - static $ExpectedLowpass = array( - 'insane|20500' => 20500, - 'insane|20600' => 20600, // 3.90.2, 3.90.3, 3.91 - 'medium|18000' => 18000, - 'fast medium|18000' => 18000, - 'extreme|19500' => 19500, // 3.90, 3.90.1, 3.92, 3.95 - 'extreme|19600' => 19600, // 3.90.2, 3.90.3, 3.91, 3.93.1 - 'fast extreme|19500' => 19500, // 3.90, 3.90.1, 3.92, 3.95 - 'fast extreme|19600' => 19600, // 3.90.2, 3.90.3, 3.91, 3.93.1 - 'standard|19000' => 19000, - 'fast standard|19000' => 19000, - 'r3mix|19500' => 19500, // 3.90, 3.90.1, 3.92 - 'r3mix|19600' => 19600, // 3.90.2, 3.90.3, 3.91 - 'r3mix|18000' => 18000, // 3.94, 3.95 - ); - if (!isset($ExpectedLowpass[$ExplodedOptions[1].'|'.$thisfile_mpeg_audio_lame['lowpass_frequency']]) && ($thisfile_mpeg_audio_lame['lowpass_frequency'] < 22050) && (round($thisfile_mpeg_audio_lame['lowpass_frequency'] / 1000) < round($thisfile_mpeg_audio['sample_rate'] / 2000))) { - $encoder_options .= ' --lowpass '.$thisfile_mpeg_audio_lame['lowpass_frequency']; - } - break; - - default: - break; - } - break; - } - } - - if (isset($thisfile_mpeg_audio_lame['raw']['source_sample_freq'])) { - if (($thisfile_mpeg_audio['sample_rate'] == 44100) && ($thisfile_mpeg_audio_lame['raw']['source_sample_freq'] != 1)) { - $encoder_options .= ' --resample 44100'; - } elseif (($thisfile_mpeg_audio['sample_rate'] == 48000) && ($thisfile_mpeg_audio_lame['raw']['source_sample_freq'] != 2)) { - $encoder_options .= ' --resample 48000'; - } elseif ($thisfile_mpeg_audio['sample_rate'] < 44100) { - switch ($thisfile_mpeg_audio_lame['raw']['source_sample_freq']) { - case 0: // <= 32000 - // may or may not be same as source frequency - ignore - break; - case 1: // 44100 - case 2: // 48000 - case 3: // 48000+ - $ExplodedOptions = explode(' ', $encoder_options, 4); - switch ($ExplodedOptions[0]) { - case '--preset': - case '--alt-preset': - switch ($ExplodedOptions[1]) { - case 'fast': - case 'portable': - case 'medium': - case 'standard': - case 'extreme': - case 'insane': - $encoder_options .= ' --resample '.$thisfile_mpeg_audio['sample_rate']; - break; - - default: - static $ExpectedResampledRate = array( - 'phon+/lw/mw-eu/sw|16000' => 16000, - 'mw-us|24000' => 24000, // 3.95 - 'mw-us|32000' => 32000, // 3.93 - 'mw-us|16000' => 16000, // 3.92 - 'phone|16000' => 16000, - 'phone|11025' => 11025, // 3.94a15 - 'radio|32000' => 32000, // 3.94a15 - 'fm/radio|32000' => 32000, // 3.92 - 'fm|32000' => 32000, // 3.90 - 'voice|32000' => 32000); - if (!isset($ExpectedResampledRate[$ExplodedOptions[1].'|'.$thisfile_mpeg_audio['sample_rate']])) { - $encoder_options .= ' --resample '.$thisfile_mpeg_audio['sample_rate']; - } - break; - } - break; - - case '--r3mix': - default: - $encoder_options .= ' --resample '.$thisfile_mpeg_audio['sample_rate']; - break; - } - break; - } - } - } - if (empty($encoder_options) && !empty($ThisFileInfo['audio']['bitrate']) && !empty($ThisFileInfo['audio']['bitrate_mode'])) { - //$encoder_options = strtoupper($ThisFileInfo['audio']['bitrate_mode']).ceil($ThisFileInfo['audio']['bitrate'] / 1000); - $encoder_options = strtoupper($ThisFileInfo['audio']['bitrate_mode']); - } - - return $encoder_options; - } - - - function decodeMPEGaudioHeader($fd, $offset, &$ThisFileInfo, $recursivesearch=true, $ScanAsCBR=false, $FastMPEGheaderScan=false) { - - static $MPEGaudioVersionLookup; - static $MPEGaudioLayerLookup; - static $MPEGaudioBitrateLookup; - static $MPEGaudioFrequencyLookup; - static $MPEGaudioChannelModeLookup; - static $MPEGaudioModeExtensionLookup; - static $MPEGaudioEmphasisLookup; - if (empty($MPEGaudioVersionLookup)) { - $MPEGaudioVersionLookup = getid3_mp3::MPEGaudioVersionArray(); - $MPEGaudioLayerLookup = getid3_mp3::MPEGaudioLayerArray(); - $MPEGaudioBitrateLookup = getid3_mp3::MPEGaudioBitrateArray(); - $MPEGaudioFrequencyLookup = getid3_mp3::MPEGaudioFrequencyArray(); - $MPEGaudioChannelModeLookup = getid3_mp3::MPEGaudioChannelModeArray(); - $MPEGaudioModeExtensionLookup = getid3_mp3::MPEGaudioModeExtensionArray(); - $MPEGaudioEmphasisLookup = getid3_mp3::MPEGaudioEmphasisArray(); - } - - if ($offset >= $ThisFileInfo['avdataend']) { - $ThisFileInfo['error'][] = 'end of file encounter looking for MPEG synch'; - return false; - } - fseek($fd, $offset, SEEK_SET); - //$headerstring = fread($fd, 1441); // worst-case max length = 32kHz @ 320kbps layer 3 = 1441 bytes/frame - $headerstring = fread($fd, 226); // LAME header at offset 36 + 190 bytes of Xing/LAME data - - // MP3 audio frame structure: - // $aa $aa $aa $aa [$bb $bb] $cc... - // where $aa..$aa is the four-byte mpeg-audio header (below) - // $bb $bb is the optional 2-byte CRC - // and $cc... is the audio data - - $head4 = substr($headerstring, 0, 4); - - static $MPEGaudioHeaderDecodeCache = array(); - if (isset($MPEGaudioHeaderDecodeCache[$head4])) { - $MPEGheaderRawArray = $MPEGaudioHeaderDecodeCache[$head4]; - } else { - $MPEGheaderRawArray = getid3_mp3::MPEGaudioHeaderDecode($head4); - $MPEGaudioHeaderDecodeCache[$head4] = $MPEGheaderRawArray; - } - - static $MPEGaudioHeaderValidCache = array(); - - // Not in cache - if (!isset($MPEGaudioHeaderValidCache[$head4])) { - //$MPEGaudioHeaderValidCache[$head4] = getid3_mp3::MPEGaudioHeaderValid($MPEGheaderRawArray, false, true); // allow badly-formatted freeformat (from LAME 3.90 - 3.93.1) - $MPEGaudioHeaderValidCache[$head4] = getid3_mp3::MPEGaudioHeaderValid($MPEGheaderRawArray, false, false); - } - - // shortcut - if (!isset($ThisFileInfo['mpeg']['audio'])) { - $ThisFileInfo['mpeg']['audio'] = array(); - } - $thisfile_mpeg_audio = &$ThisFileInfo['mpeg']['audio']; - - - if ($MPEGaudioHeaderValidCache[$head4]) { - $thisfile_mpeg_audio['raw'] = $MPEGheaderRawArray; - } else { - $ThisFileInfo['error'][] = 'Invalid MPEG audio header at offset '.$offset; - return false; - } - - if (!$FastMPEGheaderScan) { - - $thisfile_mpeg_audio['version'] = $MPEGaudioVersionLookup[$thisfile_mpeg_audio['raw']['version']]; - $thisfile_mpeg_audio['layer'] = $MPEGaudioLayerLookup[$thisfile_mpeg_audio['raw']['layer']]; - - $thisfile_mpeg_audio['channelmode'] = $MPEGaudioChannelModeLookup[$thisfile_mpeg_audio['raw']['channelmode']]; - $thisfile_mpeg_audio['channels'] = (($thisfile_mpeg_audio['channelmode'] == 'mono') ? 1 : 2); - $thisfile_mpeg_audio['sample_rate'] = $MPEGaudioFrequencyLookup[$thisfile_mpeg_audio['version']][$thisfile_mpeg_audio['raw']['sample_rate']]; - $thisfile_mpeg_audio['protection'] = !$thisfile_mpeg_audio['raw']['protection']; - $thisfile_mpeg_audio['private'] = (bool) $thisfile_mpeg_audio['raw']['private']; - $thisfile_mpeg_audio['modeextension'] = $MPEGaudioModeExtensionLookup[$thisfile_mpeg_audio['layer']][$thisfile_mpeg_audio['raw']['modeextension']]; - $thisfile_mpeg_audio['copyright'] = (bool) $thisfile_mpeg_audio['raw']['copyright']; - $thisfile_mpeg_audio['original'] = (bool) $thisfile_mpeg_audio['raw']['original']; - $thisfile_mpeg_audio['emphasis'] = $MPEGaudioEmphasisLookup[$thisfile_mpeg_audio['raw']['emphasis']]; - - $ThisFileInfo['audio']['channels'] = $thisfile_mpeg_audio['channels']; - $ThisFileInfo['audio']['sample_rate'] = $thisfile_mpeg_audio['sample_rate']; - - if ($thisfile_mpeg_audio['protection']) { - $thisfile_mpeg_audio['crc'] = getid3_lib::BigEndian2Int(substr($headerstring, 4, 2)); - } - - } - - if ($thisfile_mpeg_audio['raw']['bitrate'] == 15) { - // http://www.hydrogenaudio.org/?act=ST&f=16&t=9682&st=0 - $ThisFileInfo['warning'][] = 'Invalid bitrate index (15), this is a known bug in free-format MP3s encoded by LAME v3.90 - 3.93.1'; - $thisfile_mpeg_audio['raw']['bitrate'] = 0; - } - $thisfile_mpeg_audio['padding'] = (bool) $thisfile_mpeg_audio['raw']['padding']; - $thisfile_mpeg_audio['bitrate'] = $MPEGaudioBitrateLookup[$thisfile_mpeg_audio['version']][$thisfile_mpeg_audio['layer']][$thisfile_mpeg_audio['raw']['bitrate']]; - - if (($thisfile_mpeg_audio['bitrate'] == 'free') && ($offset == $ThisFileInfo['avdataoffset'])) { - // only skip multiple frame check if free-format bitstream found at beginning of file - // otherwise is quite possibly simply corrupted data - $recursivesearch = false; - } - - // For Layer 2 there are some combinations of bitrate and mode which are not allowed. - if (!$FastMPEGheaderScan && ($thisfile_mpeg_audio['layer'] == '2')) { - - $ThisFileInfo['audio']['dataformat'] = 'mp2'; - switch ($thisfile_mpeg_audio['channelmode']) { - - case 'mono': - if (($thisfile_mpeg_audio['bitrate'] == 'free') || ($thisfile_mpeg_audio['bitrate'] <= 192000)) { - // these are ok - } else { - $ThisFileInfo['error'][] = $thisfile_mpeg_audio['bitrate'].'kbps not allowed in Layer 2, '.$thisfile_mpeg_audio['channelmode'].'.'; - return false; - } - break; - - case 'stereo': - case 'joint stereo': - case 'dual channel': - if (($thisfile_mpeg_audio['bitrate'] == 'free') || ($thisfile_mpeg_audio['bitrate'] == 64000) || ($thisfile_mpeg_audio['bitrate'] >= 96000)) { - // these are ok - } else { - $ThisFileInfo['error'][] = intval(round($thisfile_mpeg_audio['bitrate'] / 1000)).'kbps not allowed in Layer 2, '.$thisfile_mpeg_audio['channelmode'].'.'; - return false; - } - break; - - } - - } - - - if ($ThisFileInfo['audio']['sample_rate'] > 0) { - $thisfile_mpeg_audio['framelength'] = getid3_mp3::MPEGaudioFrameLength($thisfile_mpeg_audio['bitrate'], $thisfile_mpeg_audio['version'], $thisfile_mpeg_audio['layer'], (int) $thisfile_mpeg_audio['padding'], $ThisFileInfo['audio']['sample_rate']); - } - - $nextframetestoffset = $offset + 1; - if ($thisfile_mpeg_audio['bitrate'] != 'free') { - - $ThisFileInfo['audio']['bitrate'] = $thisfile_mpeg_audio['bitrate']; - - if (isset($thisfile_mpeg_audio['framelength'])) { - $nextframetestoffset = $offset + $thisfile_mpeg_audio['framelength']; - } else { - $ThisFileInfo['error'][] = 'Frame at offset('.$offset.') is has an invalid frame length.'; - return false; - } - - } - - $ExpectedNumberOfAudioBytes = 0; - - //////////////////////////////////////////////////////////////////////////////////// - // Variable-bitrate headers - - if (substr($headerstring, 4 + 32, 4) == 'VBRI') { - // Fraunhofer VBR header is hardcoded 'VBRI' at offset 0x24 (36) - // specs taken from http://minnie.tuhs.org/pipermail/mp3encoder/2001-January/001800.html - - $thisfile_mpeg_audio['bitrate_mode'] = 'vbr'; - $thisfile_mpeg_audio['VBR_method'] = 'Fraunhofer'; - $ThisFileInfo['audio']['codec'] = 'Fraunhofer'; - - $SideInfoData = substr($headerstring, 4 + 2, 32); - - $FraunhoferVBROffset = 36; - - $thisfile_mpeg_audio['VBR_encoder_version'] = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset + 4, 2)); // VbriVersion - $thisfile_mpeg_audio['VBR_encoder_delay'] = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset + 6, 2)); // VbriDelay - $thisfile_mpeg_audio['VBR_quality'] = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset + 8, 2)); // VbriQuality - $thisfile_mpeg_audio['VBR_bytes'] = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset + 10, 4)); // VbriStreamBytes - $thisfile_mpeg_audio['VBR_frames'] = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset + 14, 4)); // VbriStreamFrames - $thisfile_mpeg_audio['VBR_seek_offsets'] = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset + 18, 2)); // VbriTableSize - $thisfile_mpeg_audio['VBR_seek_scale'] = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset + 20, 2)); // VbriTableScale - $thisfile_mpeg_audio['VBR_entry_bytes'] = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset + 22, 2)); // VbriEntryBytes - $thisfile_mpeg_audio['VBR_entry_frames'] = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset + 24, 2)); // VbriEntryFrames - - $ExpectedNumberOfAudioBytes = $thisfile_mpeg_audio['VBR_bytes']; - - $previousbyteoffset = $offset; - for ($i = 0; $i < $thisfile_mpeg_audio['VBR_seek_offsets']; $i++) { - $Fraunhofer_OffsetN = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset, $thisfile_mpeg_audio['VBR_entry_bytes'])); - $FraunhoferVBROffset += $thisfile_mpeg_audio['VBR_entry_bytes']; - $thisfile_mpeg_audio['VBR_offsets_relative'][$i] = ($Fraunhofer_OffsetN * $thisfile_mpeg_audio['VBR_seek_scale']); - $thisfile_mpeg_audio['VBR_offsets_absolute'][$i] = ($Fraunhofer_OffsetN * $thisfile_mpeg_audio['VBR_seek_scale']) + $previousbyteoffset; - $previousbyteoffset += $Fraunhofer_OffsetN; - } - - - } else { - - // Xing VBR header is hardcoded 'Xing' at a offset 0x0D (13), 0x15 (21) or 0x24 (36) - // depending on MPEG layer and number of channels - - $VBRidOffset = getid3_mp3::XingVBRidOffset($thisfile_mpeg_audio['version'], $thisfile_mpeg_audio['channelmode']); - $SideInfoData = substr($headerstring, 4 + 2, $VBRidOffset - 4); - - if ((substr($headerstring, $VBRidOffset, strlen('Xing')) == 'Xing') || (substr($headerstring, $VBRidOffset, strlen('Info')) == 'Info')) { - // 'Xing' is traditional Xing VBR frame - // 'Info' is LAME-encoded CBR (This was done to avoid CBR files to be recognized as traditional Xing VBR files by some decoders.) - // 'Info' *can* legally be used to specify a VBR file as well, however. - - // http://www.multiweb.cz/twoinches/MP3inside.htm - //00..03 = "Xing" or "Info" - //04..07 = Flags: - // 0x01 Frames Flag set if value for number of frames in file is stored - // 0x02 Bytes Flag set if value for filesize in bytes is stored - // 0x04 TOC Flag set if values for TOC are stored - // 0x08 VBR Scale Flag set if values for VBR scale is stored - //08..11 Frames: Number of frames in file (including the first Xing/Info one) - //12..15 Bytes: File length in Bytes - //16..115 TOC (Table of Contents): - // Contains of 100 indexes (one Byte length) for easier lookup in file. Approximately solves problem with moving inside file. - // Each Byte has a value according this formula: - // (TOC[i] / 256) * fileLenInBytes - // So if song lasts eg. 240 sec. and you want to jump to 60. sec. (and file is 5 000 000 Bytes length) you can use: - // TOC[(60/240)*100] = TOC[25] - // and corresponding Byte in file is then approximately at: - // (TOC[25]/256) * 5000000 - //116..119 VBR Scale - - - // should be safe to leave this at 'vbr' and let it be overriden to 'cbr' if a CBR preset/mode is used by LAME -// if (substr($headerstring, $VBRidOffset, strlen('Info')) == 'Xing') { - $thisfile_mpeg_audio['bitrate_mode'] = 'vbr'; - $thisfile_mpeg_audio['VBR_method'] = 'Xing'; -// } else { -// $ScanAsCBR = true; -// $thisfile_mpeg_audio['bitrate_mode'] = 'cbr'; -// } - - $thisfile_mpeg_audio['xing_flags_raw'] = getid3_lib::BigEndian2Int(substr($headerstring, $VBRidOffset + 4, 4)); - - $thisfile_mpeg_audio['xing_flags']['frames'] = (bool) ($thisfile_mpeg_audio['xing_flags_raw'] & 0x00000001); - $thisfile_mpeg_audio['xing_flags']['bytes'] = (bool) ($thisfile_mpeg_audio['xing_flags_raw'] & 0x00000002); - $thisfile_mpeg_audio['xing_flags']['toc'] = (bool) ($thisfile_mpeg_audio['xing_flags_raw'] & 0x00000004); - $thisfile_mpeg_audio['xing_flags']['vbr_scale'] = (bool) ($thisfile_mpeg_audio['xing_flags_raw'] & 0x00000008); - - if ($thisfile_mpeg_audio['xing_flags']['frames']) { - $thisfile_mpeg_audio['VBR_frames'] = getid3_lib::BigEndian2Int(substr($headerstring, $VBRidOffset + 8, 4)); - //$thisfile_mpeg_audio['VBR_frames']--; // don't count header Xing/Info frame - } - if ($thisfile_mpeg_audio['xing_flags']['bytes']) { - $thisfile_mpeg_audio['VBR_bytes'] = getid3_lib::BigEndian2Int(substr($headerstring, $VBRidOffset + 12, 4)); - } - - //if (($thisfile_mpeg_audio['bitrate'] == 'free') && !empty($thisfile_mpeg_audio['VBR_frames']) && !empty($thisfile_mpeg_audio['VBR_bytes'])) { - if (!empty($thisfile_mpeg_audio['VBR_frames']) && !empty($thisfile_mpeg_audio['VBR_bytes'])) { - - $framelengthfloat = $thisfile_mpeg_audio['VBR_bytes'] / $thisfile_mpeg_audio['VBR_frames']; - - if ($thisfile_mpeg_audio['layer'] == '1') { - // BitRate = (((FrameLengthInBytes / 4) - Padding) * SampleRate) / 12 - //$ThisFileInfo['audio']['bitrate'] = ((($framelengthfloat / 4) - intval($thisfile_mpeg_audio['padding'])) * $thisfile_mpeg_audio['sample_rate']) / 12; - $ThisFileInfo['audio']['bitrate'] = ($framelengthfloat / 4) * $thisfile_mpeg_audio['sample_rate'] * (2 / $ThisFileInfo['audio']['channels']) / 12; - } else { - // Bitrate = ((FrameLengthInBytes - Padding) * SampleRate) / 144 - //$ThisFileInfo['audio']['bitrate'] = (($framelengthfloat - intval($thisfile_mpeg_audio['padding'])) * $thisfile_mpeg_audio['sample_rate']) / 144; - $ThisFileInfo['audio']['bitrate'] = $framelengthfloat * $thisfile_mpeg_audio['sample_rate'] * (2 / $ThisFileInfo['audio']['channels']) / 144; - } - $thisfile_mpeg_audio['framelength'] = floor($framelengthfloat); - } - - if ($thisfile_mpeg_audio['xing_flags']['toc']) { - $LAMEtocData = substr($headerstring, $VBRidOffset + 16, 100); - for ($i = 0; $i < 100; $i++) { - $thisfile_mpeg_audio['toc'][$i] = ord($LAMEtocData{$i}); - } - } - if ($thisfile_mpeg_audio['xing_flags']['vbr_scale']) { - $thisfile_mpeg_audio['VBR_scale'] = getid3_lib::BigEndian2Int(substr($headerstring, $VBRidOffset + 116, 4)); - } - - - // http://gabriel.mp3-tech.org/mp3infotag.html - if (substr($headerstring, $VBRidOffset + 120, 4) == 'LAME') { - - // shortcut - $thisfile_mpeg_audio['LAME'] = array(); - $thisfile_mpeg_audio_lame = &$thisfile_mpeg_audio['LAME']; - - - $thisfile_mpeg_audio_lame['long_version'] = substr($headerstring, $VBRidOffset + 120, 20); - $thisfile_mpeg_audio_lame['short_version'] = substr($thisfile_mpeg_audio_lame['long_version'], 0, 9); - - if ($thisfile_mpeg_audio_lame['short_version'] >= 'LAME3.90') { - - // extra 11 chars are not part of version string when LAMEtag present - unset($thisfile_mpeg_audio_lame['long_version']); - - // It the LAME tag was only introduced in LAME v3.90 - // http://www.hydrogenaudio.org/?act=ST&f=15&t=9933 - - // Offsets of various bytes in http://gabriel.mp3-tech.org/mp3infotag.html - // are assuming a 'Xing' identifier offset of 0x24, which is the case for - // MPEG-1 non-mono, but not for other combinations - $LAMEtagOffsetContant = $VBRidOffset - 0x24; - - // shortcuts - $thisfile_mpeg_audio_lame['RGAD'] = array('track'=>array(), 'album'=>array()); - $thisfile_mpeg_audio_lame_RGAD = &$thisfile_mpeg_audio_lame['RGAD']; - $thisfile_mpeg_audio_lame_RGAD_track = &$thisfile_mpeg_audio_lame_RGAD['track']; - $thisfile_mpeg_audio_lame_RGAD_album = &$thisfile_mpeg_audio_lame_RGAD['album']; - $thisfile_mpeg_audio_lame['raw'] = array(); - $thisfile_mpeg_audio_lame_raw = &$thisfile_mpeg_audio_lame['raw']; - - // byte $9B VBR Quality - // This field is there to indicate a quality level, although the scale was not precised in the original Xing specifications. - // Actually overwrites original Xing bytes - unset($thisfile_mpeg_audio['VBR_scale']); - $thisfile_mpeg_audio_lame['vbr_quality'] = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0x9B, 1)); - - // bytes $9C-$A4 Encoder short VersionString - $thisfile_mpeg_audio_lame['short_version'] = substr($headerstring, $LAMEtagOffsetContant + 0x9C, 9); - - // byte $A5 Info Tag revision + VBR method - $LAMEtagRevisionVBRmethod = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xA5, 1)); - - $thisfile_mpeg_audio_lame['tag_revision'] = ($LAMEtagRevisionVBRmethod & 0xF0) >> 4; - $thisfile_mpeg_audio_lame_raw['vbr_method'] = $LAMEtagRevisionVBRmethod & 0x0F; - $thisfile_mpeg_audio_lame['vbr_method'] = getid3_mp3::LAMEvbrMethodLookup($thisfile_mpeg_audio_lame_raw['vbr_method']); - $thisfile_mpeg_audio['bitrate_mode'] = substr($thisfile_mpeg_audio_lame['vbr_method'], 0, 3); // usually either 'cbr' or 'vbr', but truncates 'vbr-old / vbr-rh' to 'vbr' - - // byte $A6 Lowpass filter value - $thisfile_mpeg_audio_lame['lowpass_frequency'] = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xA6, 1)) * 100; - - // bytes $A7-$AE Replay Gain - // http://privatewww.essex.ac.uk/~djmrob/replaygain/rg_data_format.html - // bytes $A7-$AA : 32 bit floating point "Peak signal amplitude" - if ($thisfile_mpeg_audio_lame['short_version'] >= 'LAME3.94b') { - // LAME 3.94a16 and later - 9.23 fixed point - // ie 0x0059E2EE / (2^23) = 5890798 / 8388608 = 0.7022378444671630859375 - $thisfile_mpeg_audio_lame_RGAD['peak_amplitude'] = (float) ((getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xA7, 4))) / 8388608); - } else { - // LAME 3.94a15 and earlier - 32-bit floating point - // Actually 3.94a16 will fall in here too and be WRONG, but is hard to detect 3.94a16 vs 3.94a15 - $thisfile_mpeg_audio_lame_RGAD['peak_amplitude'] = getid3_lib::LittleEndian2Float(substr($headerstring, $LAMEtagOffsetContant + 0xA7, 4)); - } - if ($thisfile_mpeg_audio_lame_RGAD['peak_amplitude'] == 0) { - unset($thisfile_mpeg_audio_lame_RGAD['peak_amplitude']); - } else { - $thisfile_mpeg_audio_lame_RGAD['peak_db'] = getid3_lib::RGADamplitude2dB($thisfile_mpeg_audio_lame_RGAD['peak_amplitude']); - } - - $thisfile_mpeg_audio_lame_raw['RGAD_track'] = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xAB, 2)); - $thisfile_mpeg_audio_lame_raw['RGAD_album'] = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xAD, 2)); - - - if ($thisfile_mpeg_audio_lame_raw['RGAD_track'] != 0) { - - $thisfile_mpeg_audio_lame_RGAD_track['raw']['name'] = ($thisfile_mpeg_audio_lame_raw['RGAD_track'] & 0xE000) >> 13; - $thisfile_mpeg_audio_lame_RGAD_track['raw']['originator'] = ($thisfile_mpeg_audio_lame_raw['RGAD_track'] & 0x1C00) >> 10; - $thisfile_mpeg_audio_lame_RGAD_track['raw']['sign_bit'] = ($thisfile_mpeg_audio_lame_raw['RGAD_track'] & 0x0200) >> 9; - $thisfile_mpeg_audio_lame_RGAD_track['raw']['gain_adjust'] = $thisfile_mpeg_audio_lame_raw['RGAD_track'] & 0x01FF; - $thisfile_mpeg_audio_lame_RGAD_track['name'] = getid3_lib::RGADnameLookup($thisfile_mpeg_audio_lame_RGAD_track['raw']['name']); - $thisfile_mpeg_audio_lame_RGAD_track['originator'] = getid3_lib::RGADoriginatorLookup($thisfile_mpeg_audio_lame_RGAD_track['raw']['originator']); - $thisfile_mpeg_audio_lame_RGAD_track['gain_db'] = getid3_lib::RGADadjustmentLookup($thisfile_mpeg_audio_lame_RGAD_track['raw']['gain_adjust'], $thisfile_mpeg_audio_lame_RGAD_track['raw']['sign_bit']); - - if (!empty($thisfile_mpeg_audio_lame_RGAD['peak_amplitude'])) { - $ThisFileInfo['replay_gain']['track']['peak'] = $thisfile_mpeg_audio_lame_RGAD['peak_amplitude']; - } - $ThisFileInfo['replay_gain']['track']['originator'] = $thisfile_mpeg_audio_lame_RGAD_track['originator']; - $ThisFileInfo['replay_gain']['track']['adjustment'] = $thisfile_mpeg_audio_lame_RGAD_track['gain_db']; - } else { - unset($thisfile_mpeg_audio_lame_RGAD['track']); - } - if ($thisfile_mpeg_audio_lame_raw['RGAD_album'] != 0) { - - $thisfile_mpeg_audio_lame_RGAD_album['raw']['name'] = ($thisfile_mpeg_audio_lame_raw['RGAD_album'] & 0xE000) >> 13; - $thisfile_mpeg_audio_lame_RGAD_album['raw']['originator'] = ($thisfile_mpeg_audio_lame_raw['RGAD_album'] & 0x1C00) >> 10; - $thisfile_mpeg_audio_lame_RGAD_album['raw']['sign_bit'] = ($thisfile_mpeg_audio_lame_raw['RGAD_album'] & 0x0200) >> 9; - $thisfile_mpeg_audio_lame_RGAD_album['raw']['gain_adjust'] = $thisfile_mpeg_audio_lame_raw['RGAD_album'] & 0x01FF; - $thisfile_mpeg_audio_lame_RGAD_album['name'] = getid3_lib::RGADnameLookup($thisfile_mpeg_audio_lame_RGAD_album['raw']['name']); - $thisfile_mpeg_audio_lame_RGAD_album['originator'] = getid3_lib::RGADoriginatorLookup($thisfile_mpeg_audio_lame_RGAD_album['raw']['originator']); - $thisfile_mpeg_audio_lame_RGAD_album['gain_db'] = getid3_lib::RGADadjustmentLookup($thisfile_mpeg_audio_lame_RGAD_album['raw']['gain_adjust'], $thisfile_mpeg_audio_lame_RGAD_album['raw']['sign_bit']); - - if (!empty($thisfile_mpeg_audio_lame_RGAD['peak_amplitude'])) { - $ThisFileInfo['replay_gain']['album']['peak'] = $thisfile_mpeg_audio_lame_RGAD['peak_amplitude']; - } - $ThisFileInfo['replay_gain']['album']['originator'] = $thisfile_mpeg_audio_lame_RGAD_album['originator']; - $ThisFileInfo['replay_gain']['album']['adjustment'] = $thisfile_mpeg_audio_lame_RGAD_album['gain_db']; - } else { - unset($thisfile_mpeg_audio_lame_RGAD['album']); - } - if (empty($thisfile_mpeg_audio_lame_RGAD)) { - unset($thisfile_mpeg_audio_lame['RGAD']); - } - - - // byte $AF Encoding flags + ATH Type - $EncodingFlagsATHtype = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xAF, 1)); - $thisfile_mpeg_audio_lame['encoding_flags']['nspsytune'] = (bool) ($EncodingFlagsATHtype & 0x10); - $thisfile_mpeg_audio_lame['encoding_flags']['nssafejoint'] = (bool) ($EncodingFlagsATHtype & 0x20); - $thisfile_mpeg_audio_lame['encoding_flags']['nogap_next'] = (bool) ($EncodingFlagsATHtype & 0x40); - $thisfile_mpeg_audio_lame['encoding_flags']['nogap_prev'] = (bool) ($EncodingFlagsATHtype & 0x80); - $thisfile_mpeg_audio_lame['ath_type'] = $EncodingFlagsATHtype & 0x0F; - - // byte $B0 if ABR {specified bitrate} else {minimal bitrate} - $thisfile_mpeg_audio_lame['raw']['abrbitrate_minbitrate'] = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xB0, 1)); - if ($thisfile_mpeg_audio_lame_raw['vbr_method'] == 2) { // Average BitRate (ABR) - $thisfile_mpeg_audio_lame['bitrate_abr'] = $thisfile_mpeg_audio_lame['raw']['abrbitrate_minbitrate']; - } elseif ($thisfile_mpeg_audio_lame_raw['vbr_method'] == 1) { // Constant BitRate (CBR) - // ignore - } elseif ($thisfile_mpeg_audio_lame['raw']['abrbitrate_minbitrate'] > 0) { // Variable BitRate (VBR) - minimum bitrate - $thisfile_mpeg_audio_lame['bitrate_min'] = $thisfile_mpeg_audio_lame['raw']['abrbitrate_minbitrate']; - } - - // bytes $B1-$B3 Encoder delays - $EncoderDelays = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xB1, 3)); - $thisfile_mpeg_audio_lame['encoder_delay'] = ($EncoderDelays & 0xFFF000) >> 12; - $thisfile_mpeg_audio_lame['end_padding'] = $EncoderDelays & 0x000FFF; - - // byte $B4 Misc - $MiscByte = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xB4, 1)); - $thisfile_mpeg_audio_lame_raw['noise_shaping'] = ($MiscByte & 0x03); - $thisfile_mpeg_audio_lame_raw['stereo_mode'] = ($MiscByte & 0x1C) >> 2; - $thisfile_mpeg_audio_lame_raw['not_optimal_quality'] = ($MiscByte & 0x20) >> 5; - $thisfile_mpeg_audio_lame_raw['source_sample_freq'] = ($MiscByte & 0xC0) >> 6; - $thisfile_mpeg_audio_lame['noise_shaping'] = $thisfile_mpeg_audio_lame_raw['noise_shaping']; - $thisfile_mpeg_audio_lame['stereo_mode'] = getid3_mp3::LAMEmiscStereoModeLookup($thisfile_mpeg_audio_lame_raw['stereo_mode']); - $thisfile_mpeg_audio_lame['not_optimal_quality'] = (bool) $thisfile_mpeg_audio_lame_raw['not_optimal_quality']; - $thisfile_mpeg_audio_lame['source_sample_freq'] = getid3_mp3::LAMEmiscSourceSampleFrequencyLookup($thisfile_mpeg_audio_lame_raw['source_sample_freq']); - - // byte $B5 MP3 Gain - $thisfile_mpeg_audio_lame_raw['mp3_gain'] = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xB5, 1), false, true); - $thisfile_mpeg_audio_lame['mp3_gain_db'] = (getid3_lib::RGADamplitude2dB(2) / 4) * $thisfile_mpeg_audio_lame_raw['mp3_gain']; - $thisfile_mpeg_audio_lame['mp3_gain_factor'] = pow(2, ($thisfile_mpeg_audio_lame['mp3_gain_db'] / 6)); - - // bytes $B6-$B7 Preset and surround info - $PresetSurroundBytes = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xB6, 2)); - // Reserved = ($PresetSurroundBytes & 0xC000); - $thisfile_mpeg_audio_lame_raw['surround_info'] = ($PresetSurroundBytes & 0x3800); - $thisfile_mpeg_audio_lame['surround_info'] = getid3_mp3::LAMEsurroundInfoLookup($thisfile_mpeg_audio_lame_raw['surround_info']); - $thisfile_mpeg_audio_lame['preset_used_id'] = ($PresetSurroundBytes & 0x07FF); - $thisfile_mpeg_audio_lame['preset_used'] = getid3_mp3::LAMEpresetUsedLookup($thisfile_mpeg_audio_lame); - if (!empty($thisfile_mpeg_audio_lame['preset_used_id']) && empty($thisfile_mpeg_audio_lame['preset_used'])) { - $ThisFileInfo['warning'][] = 'Unknown LAME preset used ('.$thisfile_mpeg_audio_lame['preset_used_id'].') - please report to info@getid3.org'; - } - if (($thisfile_mpeg_audio_lame['short_version'] == 'LAME3.90.') && !empty($thisfile_mpeg_audio_lame['preset_used_id'])) { - // this may change if 3.90.4 ever comes out - $thisfile_mpeg_audio_lame['short_version'] = 'LAME3.90.3'; - } - - // bytes $B8-$BB MusicLength - $thisfile_mpeg_audio_lame['audio_bytes'] = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xB8, 4)); - $ExpectedNumberOfAudioBytes = (($thisfile_mpeg_audio_lame['audio_bytes'] > 0) ? $thisfile_mpeg_audio_lame['audio_bytes'] : $thisfile_mpeg_audio['VBR_bytes']); - - // bytes $BC-$BD MusicCRC - $thisfile_mpeg_audio_lame['music_crc'] = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xBC, 2)); - - // bytes $BE-$BF CRC-16 of Info Tag - $thisfile_mpeg_audio_lame['lame_tag_crc'] = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xBE, 2)); - - - // LAME CBR - if ($thisfile_mpeg_audio_lame_raw['vbr_method'] == 1) { - - $thisfile_mpeg_audio['bitrate_mode'] = 'cbr'; - $thisfile_mpeg_audio['bitrate'] = getid3_mp3::ClosestStandardMP3Bitrate($thisfile_mpeg_audio['bitrate']); - $ThisFileInfo['audio']['bitrate'] = $thisfile_mpeg_audio['bitrate']; - //if (empty($thisfile_mpeg_audio['bitrate']) || (!empty($thisfile_mpeg_audio_lame['bitrate_min']) && ($thisfile_mpeg_audio_lame['bitrate_min'] != 255))) { - // $thisfile_mpeg_audio['bitrate'] = $thisfile_mpeg_audio_lame['bitrate_min']; - //} - - } - - } - } - - } else { - - // not Fraunhofer or Xing VBR methods, most likely CBR (but could be VBR with no header) - $thisfile_mpeg_audio['bitrate_mode'] = 'cbr'; - if ($recursivesearch) { - $thisfile_mpeg_audio['bitrate_mode'] = 'vbr'; - if (getid3_mp3::RecursiveFrameScanning($fd, $ThisFileInfo, $offset, $nextframetestoffset, true)) { - $recursivesearch = false; - $thisfile_mpeg_audio['bitrate_mode'] = 'cbr'; - } - if ($thisfile_mpeg_audio['bitrate_mode'] == 'vbr') { - $ThisFileInfo['warning'][] = 'VBR file with no VBR header. Bitrate values calculated from actual frame bitrates.'; - } - } - - } - - } - - if (($ExpectedNumberOfAudioBytes > 0) && ($ExpectedNumberOfAudioBytes != ($ThisFileInfo['avdataend'] - $ThisFileInfo['avdataoffset']))) { - if ($ExpectedNumberOfAudioBytes > ($ThisFileInfo['avdataend'] - $ThisFileInfo['avdataoffset'])) { - if (@$ThisFileInfo['fileformat'] == 'riff') { - // ignore, audio data is broken into chunks so will always be data "missing" - } elseif (($ExpectedNumberOfAudioBytes - ($ThisFileInfo['avdataend'] - $ThisFileInfo['avdataoffset'])) == 1) { - $ThisFileInfo['warning'][] = 'Last byte of data truncated (this is a known bug in Meracl ID3 Tag Writer before v1.3.5)'; - } else { - $ThisFileInfo['warning'][] = 'Probable truncated file: expecting '.$ExpectedNumberOfAudioBytes.' bytes of audio data, only found '.($ThisFileInfo['avdataend'] - $ThisFileInfo['avdataoffset']).' (short by '.($ExpectedNumberOfAudioBytes - ($ThisFileInfo['avdataend'] - $ThisFileInfo['avdataoffset'])).' bytes)'; - } - } else { - if ((($ThisFileInfo['avdataend'] - $ThisFileInfo['avdataoffset']) - $ExpectedNumberOfAudioBytes) == 1) { - // $prenullbytefileoffset = ftell($fd); - // fseek($fd, $ThisFileInfo['avdataend'], SEEK_SET); - // $PossibleNullByte = fread($fd, 1); - // fseek($fd, $prenullbytefileoffset, SEEK_SET); - // if ($PossibleNullByte === "\x00") { - $ThisFileInfo['avdataend']--; - // $ThisFileInfo['warning'][] = 'Extra null byte at end of MP3 data assumed to be RIFF padding and therefore ignored'; - // } else { - // $ThisFileInfo['warning'][] = 'Too much data in file: expecting '.$ExpectedNumberOfAudioBytes.' bytes of audio data, found '.($ThisFileInfo['avdataend'] - $ThisFileInfo['avdataoffset']).' ('.(($ThisFileInfo['avdataend'] - $ThisFileInfo['avdataoffset']) - $ExpectedNumberOfAudioBytes).' bytes too many)'; - // } - } else { - $ThisFileInfo['warning'][] = 'Too much data in file: expecting '.$ExpectedNumberOfAudioBytes.' bytes of audio data, found '.($ThisFileInfo['avdataend'] - $ThisFileInfo['avdataoffset']).' ('.(($ThisFileInfo['avdataend'] - $ThisFileInfo['avdataoffset']) - $ExpectedNumberOfAudioBytes).' bytes too many)'; - } - } - } - - if (($thisfile_mpeg_audio['bitrate'] == 'free') && empty($ThisFileInfo['audio']['bitrate'])) { - if (($offset == $ThisFileInfo['avdataoffset']) && empty($thisfile_mpeg_audio['VBR_frames'])) { - $framebytelength = getid3_mp3::FreeFormatFrameLength($fd, $offset, $ThisFileInfo, true); - if ($framebytelength > 0) { - $thisfile_mpeg_audio['framelength'] = $framebytelength; - if ($thisfile_mpeg_audio['layer'] == '1') { - // BitRate = (((FrameLengthInBytes / 4) - Padding) * SampleRate) / 12 - $ThisFileInfo['audio']['bitrate'] = ((($framebytelength / 4) - intval($thisfile_mpeg_audio['padding'])) * $thisfile_mpeg_audio['sample_rate']) / 12; - } else { - // Bitrate = ((FrameLengthInBytes - Padding) * SampleRate) / 144 - $ThisFileInfo['audio']['bitrate'] = (($framebytelength - intval($thisfile_mpeg_audio['padding'])) * $thisfile_mpeg_audio['sample_rate']) / 144; - } - } else { - $ThisFileInfo['error'][] = 'Error calculating frame length of free-format MP3 without Xing/LAME header'; - } - } - } - - if (@$thisfile_mpeg_audio['VBR_frames']) { - switch ($thisfile_mpeg_audio['bitrate_mode']) { - case 'vbr': - case 'abr': - if (($thisfile_mpeg_audio['version'] == '1') && ($thisfile_mpeg_audio['layer'] == 1)) { - $thisfile_mpeg_audio['VBR_bitrate'] = ((@$thisfile_mpeg_audio['VBR_bytes'] / $thisfile_mpeg_audio['VBR_frames']) * 8) * ($ThisFileInfo['audio']['sample_rate'] / 384); - } elseif ((($thisfile_mpeg_audio['version'] == '2') || ($thisfile_mpeg_audio['version'] == '2.5')) && ($thisfile_mpeg_audio['layer'] == 3)) { - $thisfile_mpeg_audio['VBR_bitrate'] = ((@$thisfile_mpeg_audio['VBR_bytes'] / $thisfile_mpeg_audio['VBR_frames']) * 8) * ($ThisFileInfo['audio']['sample_rate'] / 576); - } else { - $thisfile_mpeg_audio['VBR_bitrate'] = ((@$thisfile_mpeg_audio['VBR_bytes'] / $thisfile_mpeg_audio['VBR_frames']) * 8) * ($ThisFileInfo['audio']['sample_rate'] / 1152); - } - if ($thisfile_mpeg_audio['VBR_bitrate'] > 0) { - $ThisFileInfo['audio']['bitrate'] = $thisfile_mpeg_audio['VBR_bitrate']; - $thisfile_mpeg_audio['bitrate'] = $thisfile_mpeg_audio['VBR_bitrate']; // to avoid confusion - } - break; - } - } - - // End variable-bitrate headers - //////////////////////////////////////////////////////////////////////////////////// - - if ($recursivesearch) { - - if (!getid3_mp3::RecursiveFrameScanning($fd, $ThisFileInfo, $offset, $nextframetestoffset, $ScanAsCBR)) { - return false; - } - - } - - - //if (false) { - // // experimental side info parsing section - not returning anything useful yet - // - // $SideInfoBitstream = getid3_lib::BigEndian2Bin($SideInfoData); - // $SideInfoOffset = 0; - // - // if ($thisfile_mpeg_audio['version'] == '1') { - // if ($thisfile_mpeg_audio['channelmode'] == 'mono') { - // // MPEG-1 (mono) - // $thisfile_mpeg_audio['side_info']['main_data_begin'] = substr($SideInfoBitstream, $SideInfoOffset, 9); - // $SideInfoOffset += 9; - // $SideInfoOffset += 5; - // } else { - // // MPEG-1 (stereo, joint-stereo, dual-channel) - // $thisfile_mpeg_audio['side_info']['main_data_begin'] = substr($SideInfoBitstream, $SideInfoOffset, 9); - // $SideInfoOffset += 9; - // $SideInfoOffset += 3; - // } - // } else { // 2 or 2.5 - // if ($thisfile_mpeg_audio['channelmode'] == 'mono') { - // // MPEG-2, MPEG-2.5 (mono) - // $thisfile_mpeg_audio['side_info']['main_data_begin'] = substr($SideInfoBitstream, $SideInfoOffset, 8); - // $SideInfoOffset += 8; - // $SideInfoOffset += 1; - // } else { - // // MPEG-2, MPEG-2.5 (stereo, joint-stereo, dual-channel) - // $thisfile_mpeg_audio['side_info']['main_data_begin'] = substr($SideInfoBitstream, $SideInfoOffset, 8); - // $SideInfoOffset += 8; - // $SideInfoOffset += 2; - // } - // } - // - // if ($thisfile_mpeg_audio['version'] == '1') { - // for ($channel = 0; $channel < $ThisFileInfo['audio']['channels']; $channel++) { - // for ($scfsi_band = 0; $scfsi_band < 4; $scfsi_band++) { - // $thisfile_mpeg_audio['scfsi'][$channel][$scfsi_band] = substr($SideInfoBitstream, $SideInfoOffset, 1); - // $SideInfoOffset += 2; - // } - // } - // } - // for ($granule = 0; $granule < (($thisfile_mpeg_audio['version'] == '1') ? 2 : 1); $granule++) { - // for ($channel = 0; $channel < $ThisFileInfo['audio']['channels']; $channel++) { - // $thisfile_mpeg_audio['part2_3_length'][$granule][$channel] = substr($SideInfoBitstream, $SideInfoOffset, 12); - // $SideInfoOffset += 12; - // $thisfile_mpeg_audio['big_values'][$granule][$channel] = substr($SideInfoBitstream, $SideInfoOffset, 9); - // $SideInfoOffset += 9; - // $thisfile_mpeg_audio['global_gain'][$granule][$channel] = substr($SideInfoBitstream, $SideInfoOffset, 8); - // $SideInfoOffset += 8; - // if ($thisfile_mpeg_audio['version'] == '1') { - // $thisfile_mpeg_audio['scalefac_compress'][$granule][$channel] = substr($SideInfoBitstream, $SideInfoOffset, 4); - // $SideInfoOffset += 4; - // } else { - // $thisfile_mpeg_audio['scalefac_compress'][$granule][$channel] = substr($SideInfoBitstream, $SideInfoOffset, 9); - // $SideInfoOffset += 9; - // } - // $thisfile_mpeg_audio['window_switching_flag'][$granule][$channel] = substr($SideInfoBitstream, $SideInfoOffset, 1); - // $SideInfoOffset += 1; - // - // if ($thisfile_mpeg_audio['window_switching_flag'][$granule][$channel] == '1') { - // - // $thisfile_mpeg_audio['block_type'][$granule][$channel] = substr($SideInfoBitstream, $SideInfoOffset, 2); - // $SideInfoOffset += 2; - // $thisfile_mpeg_audio['mixed_block_flag'][$granule][$channel] = substr($SideInfoBitstream, $SideInfoOffset, 1); - // $SideInfoOffset += 1; - // - // for ($region = 0; $region < 2; $region++) { - // $thisfile_mpeg_audio['table_select'][$granule][$channel][$region] = substr($SideInfoBitstream, $SideInfoOffset, 5); - // $SideInfoOffset += 5; - // } - // $thisfile_mpeg_audio['table_select'][$granule][$channel][2] = 0; - // - // for ($window = 0; $window < 3; $window++) { - // $thisfile_mpeg_audio['subblock_gain'][$granule][$channel][$window] = substr($SideInfoBitstream, $SideInfoOffset, 3); - // $SideInfoOffset += 3; - // } - // - // } else { - // - // for ($region = 0; $region < 3; $region++) { - // $thisfile_mpeg_audio['table_select'][$granule][$channel][$region] = substr($SideInfoBitstream, $SideInfoOffset, 5); - // $SideInfoOffset += 5; - // } - // - // $thisfile_mpeg_audio['region0_count'][$granule][$channel] = substr($SideInfoBitstream, $SideInfoOffset, 4); - // $SideInfoOffset += 4; - // $thisfile_mpeg_audio['region1_count'][$granule][$channel] = substr($SideInfoBitstream, $SideInfoOffset, 3); - // $SideInfoOffset += 3; - // $thisfile_mpeg_audio['block_type'][$granule][$channel] = 0; - // } - // - // if ($thisfile_mpeg_audio['version'] == '1') { - // $thisfile_mpeg_audio['preflag'][$granule][$channel] = substr($SideInfoBitstream, $SideInfoOffset, 1); - // $SideInfoOffset += 1; - // } - // $thisfile_mpeg_audio['scalefac_scale'][$granule][$channel] = substr($SideInfoBitstream, $SideInfoOffset, 1); - // $SideInfoOffset += 1; - // $thisfile_mpeg_audio['count1table_select'][$granule][$channel] = substr($SideInfoBitstream, $SideInfoOffset, 1); - // $SideInfoOffset += 1; - // } - // } - //} - - return true; - } - - function RecursiveFrameScanning(&$fd, &$ThisFileInfo, &$offset, &$nextframetestoffset, $ScanAsCBR) { - for ($i = 0; $i < GETID3_MP3_VALID_CHECK_FRAMES; $i++) { - // check next GETID3_MP3_VALID_CHECK_FRAMES frames for validity, to make sure we haven't run across a false synch - if (($nextframetestoffset + 4) >= $ThisFileInfo['avdataend']) { - // end of file - return true; - } - - $nextframetestarray = array('error'=>'', 'warning'=>'', 'avdataend'=>$ThisFileInfo['avdataend'], 'avdataoffset'=>$ThisFileInfo['avdataoffset']); - if (getid3_mp3::decodeMPEGaudioHeader($fd, $nextframetestoffset, $nextframetestarray, false)) { - if ($ScanAsCBR) { - // force CBR mode, used for trying to pick out invalid audio streams with - // valid(?) VBR headers, or VBR streams with no VBR header - if (!isset($nextframetestarray['mpeg']['audio']['bitrate']) || !isset($ThisFileInfo['mpeg']['audio']['bitrate']) || ($nextframetestarray['mpeg']['audio']['bitrate'] != $ThisFileInfo['mpeg']['audio']['bitrate'])) { - return false; - } - } - - - // next frame is OK, get ready to check the one after that - if (isset($nextframetestarray['mpeg']['audio']['framelength']) && ($nextframetestarray['mpeg']['audio']['framelength'] > 0)) { - $nextframetestoffset += $nextframetestarray['mpeg']['audio']['framelength']; - } else { - $ThisFileInfo['error'][] = 'Frame at offset ('.$offset.') is has an invalid frame length.'; - return false; - } - - } else { - - // next frame is not valid, note the error and fail, so scanning can contiue for a valid frame sequence - $ThisFileInfo['error'][] = 'Frame at offset ('.$offset.') is valid, but the next one at ('.$nextframetestoffset.') is not.'; - - return false; - } - } - return true; - } - - function FreeFormatFrameLength($fd, $offset, &$ThisFileInfo, $deepscan=false) { - fseek($fd, $offset, SEEK_SET); - $MPEGaudioData = fread($fd, 32768); - - $SyncPattern1 = substr($MPEGaudioData, 0, 4); - // may be different pattern due to padding - $SyncPattern2 = $SyncPattern1{0}.$SyncPattern1{1}.chr(ord($SyncPattern1{2}) | 0x02).$SyncPattern1{3}; - if ($SyncPattern2 === $SyncPattern1) { - $SyncPattern2 = $SyncPattern1{0}.$SyncPattern1{1}.chr(ord($SyncPattern1{2}) & 0xFD).$SyncPattern1{3}; - } - - $framelength = false; - $framelength1 = strpos($MPEGaudioData, $SyncPattern1, 4); - $framelength2 = strpos($MPEGaudioData, $SyncPattern2, 4); - if ($framelength1 > 4) { - $framelength = $framelength1; - } - if (($framelength2 > 4) && ($framelength2 < $framelength1)) { - $framelength = $framelength2; - } - if (!$framelength) { - - // LAME 3.88 has a different value for modeextension on the first frame vs the rest - $framelength1 = strpos($MPEGaudioData, substr($SyncPattern1, 0, 3), 4); - $framelength2 = strpos($MPEGaudioData, substr($SyncPattern2, 0, 3), 4); - - if ($framelength1 > 4) { - $framelength = $framelength1; - } - if (($framelength2 > 4) && ($framelength2 < $framelength1)) { - $framelength = $framelength2; - } - if (!$framelength) { - $ThisFileInfo['error'][] = 'Cannot find next free-format synch pattern ('.getid3_lib::PrintHexBytes($SyncPattern1).' or '.getid3_lib::PrintHexBytes($SyncPattern2).') after offset '.$offset; - return false; - } else { - $ThisFileInfo['warning'][] = 'ModeExtension varies between first frame and other frames (known free-format issue in LAME 3.88)'; - $ThisFileInfo['audio']['codec'] = 'LAME'; - $ThisFileInfo['audio']['encoder'] = 'LAME3.88'; - $SyncPattern1 = substr($SyncPattern1, 0, 3); - $SyncPattern2 = substr($SyncPattern2, 0, 3); - } - } - - if ($deepscan) { - - $ActualFrameLengthValues = array(); - $nextoffset = $offset + $framelength; - while ($nextoffset < ($ThisFileInfo['avdataend'] - 6)) { - fseek($fd, $nextoffset - 1, SEEK_SET); - $NextSyncPattern = fread($fd, 6); - if ((substr($NextSyncPattern, 1, strlen($SyncPattern1)) == $SyncPattern1) || (substr($NextSyncPattern, 1, strlen($SyncPattern2)) == $SyncPattern2)) { - // good - found where expected - $ActualFrameLengthValues[] = $framelength; - } elseif ((substr($NextSyncPattern, 0, strlen($SyncPattern1)) == $SyncPattern1) || (substr($NextSyncPattern, 0, strlen($SyncPattern2)) == $SyncPattern2)) { - // ok - found one byte earlier than expected (last frame wasn't padded, first frame was) - $ActualFrameLengthValues[] = ($framelength - 1); - $nextoffset--; - } elseif ((substr($NextSyncPattern, 2, strlen($SyncPattern1)) == $SyncPattern1) || (substr($NextSyncPattern, 2, strlen($SyncPattern2)) == $SyncPattern2)) { - // ok - found one byte later than expected (last frame was padded, first frame wasn't) - $ActualFrameLengthValues[] = ($framelength + 1); - $nextoffset++; - } else { - $ThisFileInfo['error'][] = 'Did not find expected free-format sync pattern at offset '.$nextoffset; - return false; - } - $nextoffset += $framelength; - } - if (count($ActualFrameLengthValues) > 0) { - $framelength = intval(round(array_sum($ActualFrameLengthValues) / count($ActualFrameLengthValues))); - } - } - return $framelength; - } - - function getOnlyMPEGaudioInfoBruteForce($fd, &$ThisFileInfo) { - - $MPEGaudioHeaderDecodeCache = array(); - $MPEGaudioHeaderValidCache = array(); - $MPEGaudioHeaderLengthCache = array(); - $MPEGaudioVersionLookup = getid3_mp3::MPEGaudioVersionArray(); - $MPEGaudioLayerLookup = getid3_mp3::MPEGaudioLayerArray(); - $MPEGaudioBitrateLookup = getid3_mp3::MPEGaudioBitrateArray(); - $MPEGaudioFrequencyLookup = getid3_mp3::MPEGaudioFrequencyArray(); - $MPEGaudioChannelModeLookup = getid3_mp3::MPEGaudioChannelModeArray(); - $MPEGaudioModeExtensionLookup = getid3_mp3::MPEGaudioModeExtensionArray(); - $MPEGaudioEmphasisLookup = getid3_mp3::MPEGaudioEmphasisArray(); - $LongMPEGversionLookup = array(); - $LongMPEGlayerLookup = array(); - $LongMPEGbitrateLookup = array(); - $LongMPEGpaddingLookup = array(); - $LongMPEGfrequencyLookup = array(); - - $Distribution['bitrate'] = array(); - $Distribution['frequency'] = array(); - $Distribution['layer'] = array(); - $Distribution['version'] = array(); - $Distribution['padding'] = array(); - - fseek($fd, $ThisFileInfo['avdataoffset'], SEEK_SET); - - $max_frames_scan = 5000; - $frames_scanned = 0; - - $previousvalidframe = $ThisFileInfo['avdataoffset']; - while (ftell($fd) < $ThisFileInfo['avdataend']) { - set_time_limit(30); - $head4 = fread($fd, 4); - if (strlen($head4) < 4) { - break; - } - if ($head4{0} != "\xFF") { - for ($i = 1; $i < 4; $i++) { - if ($head4{$i} == "\xFF") { - fseek($fd, $i - 4, SEEK_CUR); - continue 2; - } - } - continue; - } - if (!isset($MPEGaudioHeaderDecodeCache[$head4])) { - $MPEGaudioHeaderDecodeCache[$head4] = getid3_mp3::MPEGaudioHeaderDecode($head4); - } - if (!isset($MPEGaudioHeaderValidCache[$head4])) { - $MPEGaudioHeaderValidCache[$head4] = getid3_mp3::MPEGaudioHeaderValid($MPEGaudioHeaderDecodeCache[$head4], false, false); - } - if ($MPEGaudioHeaderValidCache[$head4]) { - - if (!isset($MPEGaudioHeaderLengthCache[$head4])) { - $LongMPEGversionLookup[$head4] = $MPEGaudioVersionLookup[$MPEGaudioHeaderDecodeCache[$head4]['version']]; - $LongMPEGlayerLookup[$head4] = $MPEGaudioLayerLookup[$MPEGaudioHeaderDecodeCache[$head4]['layer']]; - $LongMPEGbitrateLookup[$head4] = $MPEGaudioBitrateLookup[$LongMPEGversionLookup[$head4]][$LongMPEGlayerLookup[$head4]][$MPEGaudioHeaderDecodeCache[$head4]['bitrate']]; - $LongMPEGpaddingLookup[$head4] = (bool) $MPEGaudioHeaderDecodeCache[$head4]['padding']; - $LongMPEGfrequencyLookup[$head4] = $MPEGaudioFrequencyLookup[$LongMPEGversionLookup[$head4]][$MPEGaudioHeaderDecodeCache[$head4]['sample_rate']]; - $MPEGaudioHeaderLengthCache[$head4] = getid3_mp3::MPEGaudioFrameLength( - $LongMPEGbitrateLookup[$head4], - $LongMPEGversionLookup[$head4], - $LongMPEGlayerLookup[$head4], - $LongMPEGpaddingLookup[$head4], - $LongMPEGfrequencyLookup[$head4]); - } - if ($MPEGaudioHeaderLengthCache[$head4] > 4) { - $WhereWeWere = ftell($fd); - fseek($fd, $MPEGaudioHeaderLengthCache[$head4] - 4, SEEK_CUR); - $next4 = fread($fd, 4); - if ($next4{0} == "\xFF") { - if (!isset($MPEGaudioHeaderDecodeCache[$next4])) { - $MPEGaudioHeaderDecodeCache[$next4] = getid3_mp3::MPEGaudioHeaderDecode($next4); - } - if (!isset($MPEGaudioHeaderValidCache[$next4])) { - $MPEGaudioHeaderValidCache[$next4] = getid3_mp3::MPEGaudioHeaderValid($MPEGaudioHeaderDecodeCache[$next4], false, false); - } - if ($MPEGaudioHeaderValidCache[$next4]) { - fseek($fd, -4, SEEK_CUR); - - @$Distribution['bitrate'][$LongMPEGbitrateLookup[$head4]]++; - @$Distribution['layer'][$LongMPEGlayerLookup[$head4]]++; - @$Distribution['version'][$LongMPEGversionLookup[$head4]]++; - @$Distribution['padding'][intval($LongMPEGpaddingLookup[$head4])]++; - @$Distribution['frequency'][$LongMPEGfrequencyLookup[$head4]]++; - if ($max_frames_scan && (++$frames_scanned >= $max_frames_scan)) { - $pct_data_scanned = (ftell($fd) - $ThisFileInfo['avdataoffset']) / ($ThisFileInfo['avdataend'] - $ThisFileInfo['avdataoffset']); - $ThisFileInfo['warning'][] = 'too many MPEG audio frames to scan, only scanned first '.$max_frames_scan.' frames ('.number_format($pct_data_scanned * 100, 1).'% of file) and extrapolated distribution, playtime and bitrate may be incorrect.'; - foreach ($Distribution as $key1 => $value1) { - foreach ($value1 as $key2 => $value2) { - $Distribution[$key1][$key2] = round($value2 / $pct_data_scanned); - } - } - break; - } - continue; - } - } - unset($next4); - fseek($fd, $WhereWeWere - 3, SEEK_SET); - } - - } - } - foreach ($Distribution as $key => $value) { - ksort($Distribution[$key], SORT_NUMERIC); - } - ksort($Distribution['version'], SORT_STRING); - $ThisFileInfo['mpeg']['audio']['bitrate_distribution'] = $Distribution['bitrate']; - $ThisFileInfo['mpeg']['audio']['frequency_distribution'] = $Distribution['frequency']; - $ThisFileInfo['mpeg']['audio']['layer_distribution'] = $Distribution['layer']; - $ThisFileInfo['mpeg']['audio']['version_distribution'] = $Distribution['version']; - $ThisFileInfo['mpeg']['audio']['padding_distribution'] = $Distribution['padding']; - if (count($Distribution['version']) > 1) { - $ThisFileInfo['error'][] = 'Corrupt file - more than one MPEG version detected'; - } - if (count($Distribution['layer']) > 1) { - $ThisFileInfo['error'][] = 'Corrupt file - more than one MPEG layer detected'; - } - if (count($Distribution['frequency']) > 1) { - $ThisFileInfo['error'][] = 'Corrupt file - more than one MPEG sample rate detected'; - } - - - $bittotal = 0; - foreach ($Distribution['bitrate'] as $bitratevalue => $bitratecount) { - if ($bitratevalue != 'free') { - $bittotal += ($bitratevalue * $bitratecount); - } - } - $ThisFileInfo['mpeg']['audio']['frame_count'] = array_sum($Distribution['bitrate']); - if ($ThisFileInfo['mpeg']['audio']['frame_count'] == 0) { - $ThisFileInfo['error'][] = 'no MPEG audio frames found'; - return false; - } - $ThisFileInfo['mpeg']['audio']['bitrate'] = ($bittotal / $ThisFileInfo['mpeg']['audio']['frame_count']); - $ThisFileInfo['mpeg']['audio']['bitrate_mode'] = ((count($Distribution['bitrate']) > 0) ? 'vbr' : 'cbr'); - $ThisFileInfo['mpeg']['audio']['sample_rate'] = getid3_lib::array_max($Distribution['frequency'], true); - - $ThisFileInfo['audio']['bitrate'] = $ThisFileInfo['mpeg']['audio']['bitrate']; - $ThisFileInfo['audio']['bitrate_mode'] = $ThisFileInfo['mpeg']['audio']['bitrate_mode']; - $ThisFileInfo['audio']['sample_rate'] = $ThisFileInfo['mpeg']['audio']['sample_rate']; - $ThisFileInfo['audio']['dataformat'] = 'mp'.getid3_lib::array_max($Distribution['layer'], true); - $ThisFileInfo['fileformat'] = $ThisFileInfo['audio']['dataformat']; - - return true; - } - - - function getOnlyMPEGaudioInfo($fd, &$ThisFileInfo, $avdataoffset, $BitrateHistogram=false) { - - // looks for synch, decodes MPEG audio header - - static $MPEGaudioVersionLookup; - static $MPEGaudioLayerLookup; - static $MPEGaudioBitrateLookup; - if (empty($MPEGaudioVersionLookup)) { - $MPEGaudioVersionLookup = getid3_mp3::MPEGaudioVersionArray(); - $MPEGaudioLayerLookup = getid3_mp3::MPEGaudioLayerArray(); - $MPEGaudioBitrateLookup = getid3_mp3::MPEGaudioBitrateArray(); - - } - - fseek($fd, $avdataoffset, SEEK_SET); - $sync_seek_buffer_size = min(128 * 1024, $ThisFileInfo['avdataend'] - $avdataoffset); - if ($sync_seek_buffer_size <= 0) { - $ThisFileInfo['error'][] = 'Invalid $sync_seek_buffer_size at offset '.$avdataoffset; - return false; - } - $header = fread($fd, $sync_seek_buffer_size); - $sync_seek_buffer_size = strlen($header); - $SynchSeekOffset = 0; - while ($SynchSeekOffset < $sync_seek_buffer_size) { - - if ((($avdataoffset + $SynchSeekOffset) < $ThisFileInfo['avdataend']) && !feof($fd)) { - - if ($SynchSeekOffset > $sync_seek_buffer_size) { - // if a synch's not found within the first 128k bytes, then give up - $ThisFileInfo['error'][] = 'Could not find valid MPEG audio synch within the first '.round($sync_seek_buffer_size / 1024).'kB'; - if (isset($ThisFileInfo['audio']['bitrate'])) { - unset($ThisFileInfo['audio']['bitrate']); - } - if (isset($ThisFileInfo['mpeg']['audio'])) { - unset($ThisFileInfo['mpeg']['audio']); - } - if (empty($ThisFileInfo['mpeg'])) { - unset($ThisFileInfo['mpeg']); - } - return false; - - } elseif (feof($fd)) { - - $ThisFileInfo['error'][] = 'Could not find valid MPEG audio synch before end of file'; - if (isset($ThisFileInfo['audio']['bitrate'])) { - unset($ThisFileInfo['audio']['bitrate']); - } - if (isset($ThisFileInfo['mpeg']['audio'])) { - unset($ThisFileInfo['mpeg']['audio']); - } - if (isset($ThisFileInfo['mpeg']) && (!is_array($ThisFileInfo['mpeg']) || (count($ThisFileInfo['mpeg']) == 0))) { - unset($ThisFileInfo['mpeg']); - } - return false; - } - } - - if (($SynchSeekOffset + 1) >= strlen($header)) { - $ThisFileInfo['error'][] = 'Could not find valid MPEG synch before end of file'; - return false; - } - - if (($header{$SynchSeekOffset} == "\xFF") && ($header{($SynchSeekOffset + 1)} > "\xE0")) { // synch detected - - if (!isset($FirstFrameThisfileInfo) && !isset($ThisFileInfo['mpeg']['audio'])) { - $FirstFrameThisfileInfo = $ThisFileInfo; - $FirstFrameAVDataOffset = $avdataoffset + $SynchSeekOffset; - if (!getid3_mp3::decodeMPEGaudioHeader($fd, $avdataoffset + $SynchSeekOffset, $FirstFrameThisfileInfo, false)) { - // if this is the first valid MPEG-audio frame, save it in case it's a VBR header frame and there's - // garbage between this frame and a valid sequence of MPEG-audio frames, to be restored below - unset($FirstFrameThisfileInfo); - } - } - - $dummy = $ThisFileInfo; // only overwrite real data if valid header found - if (getid3_mp3::decodeMPEGaudioHeader($fd, $avdataoffset + $SynchSeekOffset, $dummy, true)) { - $ThisFileInfo = $dummy; - $ThisFileInfo['avdataoffset'] = $avdataoffset + $SynchSeekOffset; - switch (@$ThisFileInfo['fileformat']) { - case '': - case 'id3': - case 'ape': - case 'mp3': - $ThisFileInfo['fileformat'] = 'mp3'; - $ThisFileInfo['audio']['dataformat'] = 'mp3'; - break; - } - if (isset($FirstFrameThisfileInfo['mpeg']['audio']['bitrate_mode']) && ($FirstFrameThisfileInfo['mpeg']['audio']['bitrate_mode'] == 'vbr')) { - if (!(abs($ThisFileInfo['audio']['bitrate'] - $FirstFrameThisfileInfo['audio']['bitrate']) <= 1)) { - // If there is garbage data between a valid VBR header frame and a sequence - // of valid MPEG-audio frames the VBR data is no longer discarded. - $ThisFileInfo = $FirstFrameThisfileInfo; - $ThisFileInfo['avdataoffset'] = $FirstFrameAVDataOffset; - $ThisFileInfo['fileformat'] = 'mp3'; - $ThisFileInfo['audio']['dataformat'] = 'mp3'; - $dummy = $ThisFileInfo; - unset($dummy['mpeg']['audio']); - $GarbageOffsetStart = $FirstFrameAVDataOffset + $FirstFrameThisfileInfo['mpeg']['audio']['framelength']; - $GarbageOffsetEnd = $avdataoffset + $SynchSeekOffset; - if (getid3_mp3::decodeMPEGaudioHeader($fd, $GarbageOffsetEnd, $dummy, true, true)) { - - $ThisFileInfo = $dummy; - $ThisFileInfo['avdataoffset'] = $GarbageOffsetEnd; - $ThisFileInfo['warning'][] = 'apparently-valid VBR header not used because could not find '.GETID3_MP3_VALID_CHECK_FRAMES.' consecutive MPEG-audio frames immediately after VBR header (garbage data for '.($GarbageOffsetEnd - $GarbageOffsetStart).' bytes between '.$GarbageOffsetStart.' and '.$GarbageOffsetEnd.'), but did find valid CBR stream starting at '.$GarbageOffsetEnd; - - } else { - - $ThisFileInfo['warning'][] = 'using data from VBR header even though could not find '.GETID3_MP3_VALID_CHECK_FRAMES.' consecutive MPEG-audio frames immediately after VBR header (garbage data for '.($GarbageOffsetEnd - $GarbageOffsetStart).' bytes between '.$GarbageOffsetStart.' and '.$GarbageOffsetEnd.')'; - - } - } - } - if (isset($ThisFileInfo['mpeg']['audio']['bitrate_mode']) && ($ThisFileInfo['mpeg']['audio']['bitrate_mode'] == 'vbr') && !isset($ThisFileInfo['mpeg']['audio']['VBR_method'])) { - // VBR file with no VBR header - $BitrateHistogram = true; - } - - if ($BitrateHistogram) { - - $ThisFileInfo['mpeg']['audio']['stereo_distribution'] = array('stereo'=>0, 'joint stereo'=>0, 'dual channel'=>0, 'mono'=>0); - $ThisFileInfo['mpeg']['audio']['version_distribution'] = array('1'=>0, '2'=>0, '2.5'=>0); - - if ($ThisFileInfo['mpeg']['audio']['version'] == '1') { - if ($ThisFileInfo['mpeg']['audio']['layer'] == 3) { - $ThisFileInfo['mpeg']['audio']['bitrate_distribution'] = array('free'=>0, 32000=>0, 40000=>0, 48000=>0, 56000=>0, 64000=>0, 80000=>0, 96000=>0, 112000=>0, 128000=>0, 160000=>0, 192000=>0, 224000=>0, 256000=>0, 320000=>0); - } elseif ($ThisFileInfo['mpeg']['audio']['layer'] == 2) { - $ThisFileInfo['mpeg']['audio']['bitrate_distribution'] = array('free'=>0, 32000=>0, 48000=>0, 56000=>0, 64000=>0, 80000=>0, 96000=>0, 112000=>0, 128000=>0, 160000=>0, 192000=>0, 224000=>0, 256000=>0, 320000=>0, 384000=>0); - } elseif ($ThisFileInfo['mpeg']['audio']['layer'] == 1) { - $ThisFileInfo['mpeg']['audio']['bitrate_distribution'] = array('free'=>0, 32000=>0, 64000=>0, 96000=>0, 128000=>0, 160000=>0, 192000=>0, 224000=>0, 256000=>0, 288000=>0, 320000=>0, 352000=>0, 384000=>0, 416000=>0, 448000=>0); - } - } elseif ($ThisFileInfo['mpeg']['audio']['layer'] == 1) { - $ThisFileInfo['mpeg']['audio']['bitrate_distribution'] = array('free'=>0, 32000=>0, 48000=>0, 56000=>0, 64000=>0, 80000=>0, 96000=>0, 112000=>0, 128000=>0, 144000=>0, 160000=>0, 176000=>0, 192000=>0, 224000=>0, 256000=>0); - } else { - $ThisFileInfo['mpeg']['audio']['bitrate_distribution'] = array('free'=>0, 8000=>0, 16000=>0, 24000=>0, 32000=>0, 40000=>0, 48000=>0, 56000=>0, 64000=>0, 80000=>0, 96000=>0, 112000=>0, 128000=>0, 144000=>0, 160000=>0); - } - - $dummy = array('error'=>$ThisFileInfo['error'], 'warning'=>$ThisFileInfo['warning'], 'avdataend'=>$ThisFileInfo['avdataend'], 'avdataoffset'=>$ThisFileInfo['avdataoffset']); - $synchstartoffset = $ThisFileInfo['avdataoffset']; - fseek($fd, $ThisFileInfo['avdataoffset'], SEEK_SET); - - // you can play with these numbers: - $max_frames_scan = 50000; - $max_scan_segments = 10; - - // don't play with these numbers: - $FastMode = false; - $SynchErrorsFound = 0; - $frames_scanned = 0; - $this_scan_segment = 0; - $frames_scan_per_segment = ceil($max_frames_scan / $max_scan_segments); - $pct_data_scanned = 0; - for ($current_segment = 0; $current_segment < $max_scan_segments; $current_segment++) { -//echo 'was at '.ftell($fd).'<br>'; - $frames_scanned_this_segment = 0; - if (ftell($fd) >= $ThisFileInfo['avdataend']) { -//echo 'breaking because current position ('.ftell($fd).') is >= $ThisFileInfo[avdataend] ('.$ThisFileInfo['avdataend'].')<br>'; - break; - } - $scan_start_offset[$current_segment] = max(ftell($fd), $ThisFileInfo['avdataoffset'] + round($current_segment * (($ThisFileInfo['avdataend'] - $ThisFileInfo['avdataoffset']) / $max_scan_segments))); -//echo 'start at '.$scan_start_offset[$current_segment].'<br>'; - if ($current_segment > 0) { - fseek($fd, $scan_start_offset[$current_segment], SEEK_SET); - $buffer_4k = fread($fd, 4096); - for ($j = 0; $j < (strlen($buffer_4k) - 4); $j++) { - if (($buffer_4k{$j} == "\xFF") && ($buffer_4k{($j + 1)} > "\xE0")) { // synch detected - if (getid3_mp3::decodeMPEGaudioHeader($fd, $scan_start_offset[$current_segment] + $j, $dummy, false, false, $FastMode)) { - $calculated_next_offset = $scan_start_offset[$current_segment] + $j + $dummy['mpeg']['audio']['framelength']; - if (getid3_mp3::decodeMPEGaudioHeader($fd, $calculated_next_offset, $dummy, false, false, $FastMode)) { - $scan_start_offset[$current_segment] += $j; - break; - } else { -//echo 'header['.__LINE__.'] at '.($calculated_next_offset).' invalid<br>'; - } - } else { -//echo 'header['.__LINE__.'] at '.($scan_start_offset[$current_segment] + $j).' invalid<br>'; - } - } - } - } -//echo 'actually start at '.$scan_start_offset[$current_segment].'<br>'; - $synchstartoffset = $scan_start_offset[$current_segment]; - while (getid3_mp3::decodeMPEGaudioHeader($fd, $synchstartoffset, $dummy, false, false, $FastMode)) { - $FastMode = true; - $thisframebitrate = $MPEGaudioBitrateLookup[$MPEGaudioVersionLookup[$dummy['mpeg']['audio']['raw']['version']]][$MPEGaudioLayerLookup[$dummy['mpeg']['audio']['raw']['layer']]][$dummy['mpeg']['audio']['raw']['bitrate']]; - - if (empty($dummy['mpeg']['audio']['framelength'])) { - $SynchErrorsFound++; - $synchstartoffset++; -//echo ' [Ø] '; - } else { -//echo ' . '; - @$ThisFileInfo['mpeg']['audio']['bitrate_distribution'][$thisframebitrate]++; - @$ThisFileInfo['mpeg']['audio']['stereo_distribution'][$dummy['mpeg']['audio']['channelmode']]++; - @$ThisFileInfo['mpeg']['audio']['version_distribution'][$dummy['mpeg']['audio']['version']]++; - - $synchstartoffset += $dummy['mpeg']['audio']['framelength']; - } - $frames_scanned++; - if ($frames_scan_per_segment && (++$frames_scanned_this_segment >= $frames_scan_per_segment)) { - $this_pct_scanned = (ftell($fd) - $scan_start_offset[$current_segment]) / ($ThisFileInfo['avdataend'] - $ThisFileInfo['avdataoffset']); - if (($current_segment == 0) && (($this_pct_scanned * $max_scan_segments) >= 1)) { - // file likely contains < $max_frames_scan, just scan as one segment - $max_scan_segments = 1; - $frames_scan_per_segment = $max_frames_scan; - } else { - $pct_data_scanned += $this_pct_scanned; -//var_dump($pct_data_scanned); -//exit; - break; - } - } - } -//echo '<hr>'; - } - if ($pct_data_scanned > 0) { - $ThisFileInfo['warning'][] = 'too many MPEG audio frames to scan, only scanned '.$frames_scanned.' frames in '.$max_scan_segments.' segments ('.number_format($pct_data_scanned * 100, 1).'% of file) and extrapolated distribution, playtime and bitrate may be incorrect.'; - foreach ($ThisFileInfo['mpeg']['audio'] as $key1 => $value1) { - if (!eregi('_distribution$', $key1)) { - continue; - } - foreach ($value1 as $key2 => $value2) { - $ThisFileInfo['mpeg']['audio'][$key1][$key2] = round($value2 / $pct_data_scanned); - } - } - } - - if ($SynchErrorsFound > 0) { - $ThisFileInfo['warning'][] = 'Found '.$SynchErrorsFound.' synch errors in histogram analysis'; - //return false; - } - - $bittotal = 0; - $framecounter = 0; - foreach ($ThisFileInfo['mpeg']['audio']['bitrate_distribution'] as $bitratevalue => $bitratecount) { - $framecounter += $bitratecount; - if ($bitratevalue != 'free') { - $bittotal += ($bitratevalue * $bitratecount); - } - } - if ($framecounter == 0) { - $ThisFileInfo['error'][] = 'Corrupt MP3 file: framecounter == zero'; - return false; - } - $ThisFileInfo['mpeg']['audio']['frame_count'] = getid3_lib::CastAsInt($framecounter); - $ThisFileInfo['mpeg']['audio']['bitrate'] = ($bittotal / $framecounter); - - $ThisFileInfo['audio']['bitrate'] = $ThisFileInfo['mpeg']['audio']['bitrate']; - - - // Definitively set VBR vs CBR, even if the Xing/LAME/VBRI header says differently - $distinct_bitrates = 0; - foreach ($ThisFileInfo['mpeg']['audio']['bitrate_distribution'] as $bitrate_value => $bitrate_count) { - if ($bitrate_count > 0) { - $distinct_bitrates++; - } - } - if ($distinct_bitrates > 1) { - $ThisFileInfo['mpeg']['audio']['bitrate_mode'] = 'vbr'; - } else { - $ThisFileInfo['mpeg']['audio']['bitrate_mode'] = 'cbr'; - } - $ThisFileInfo['audio']['bitrate_mode'] = $ThisFileInfo['mpeg']['audio']['bitrate_mode']; - - } - - break; // exit while() - } - } - - $SynchSeekOffset++; - if (($avdataoffset + $SynchSeekOffset) >= $ThisFileInfo['avdataend']) { - // end of file/data - - if (empty($ThisFileInfo['mpeg']['audio'])) { - - $ThisFileInfo['error'][] = 'could not find valid MPEG synch before end of file'; - if (isset($ThisFileInfo['audio']['bitrate'])) { - unset($ThisFileInfo['audio']['bitrate']); - } - if (isset($ThisFileInfo['mpeg']['audio'])) { - unset($ThisFileInfo['mpeg']['audio']); - } - if (isset($ThisFileInfo['mpeg']) && (!is_array($ThisFileInfo['mpeg']) || empty($ThisFileInfo['mpeg']))) { - unset($ThisFileInfo['mpeg']); - } - return false; - - } - break; - } - - } - $ThisFileInfo['audio']['channels'] = $ThisFileInfo['mpeg']['audio']['channels']; - $ThisFileInfo['audio']['channelmode'] = $ThisFileInfo['mpeg']['audio']['channelmode']; - $ThisFileInfo['audio']['sample_rate'] = $ThisFileInfo['mpeg']['audio']['sample_rate']; - return true; - } - - - function MPEGaudioVersionArray() { - static $MPEGaudioVersion = array('2.5', false, '2', '1'); - return $MPEGaudioVersion; - } - - function MPEGaudioLayerArray() { - static $MPEGaudioLayer = array(false, 3, 2, 1); - return $MPEGaudioLayer; - } - - function MPEGaudioBitrateArray() { - static $MPEGaudioBitrate; - if (empty($MPEGaudioBitrate)) { - $MPEGaudioBitrate = array ( - '1' => array (1 => array('free', 32000, 64000, 96000, 128000, 160000, 192000, 224000, 256000, 288000, 320000, 352000, 384000, 416000, 448000), - 2 => array('free', 32000, 48000, 56000, 64000, 80000, 96000, 112000, 128000, 160000, 192000, 224000, 256000, 320000, 384000), - 3 => array('free', 32000, 40000, 48000, 56000, 64000, 80000, 96000, 112000, 128000, 160000, 192000, 224000, 256000, 320000) - ), - - '2' => array (1 => array('free', 32000, 48000, 56000, 64000, 80000, 96000, 112000, 128000, 144000, 160000, 176000, 192000, 224000, 256000), - 2 => array('free', 8000, 16000, 24000, 32000, 40000, 48000, 56000, 64000, 80000, 96000, 112000, 128000, 144000, 160000), - ) - ); - $MPEGaudioBitrate['2'][3] = $MPEGaudioBitrate['2'][2]; - $MPEGaudioBitrate['2.5'] = $MPEGaudioBitrate['2']; - } - return $MPEGaudioBitrate; - } - - function MPEGaudioFrequencyArray() { - static $MPEGaudioFrequency; - if (empty($MPEGaudioFrequency)) { - $MPEGaudioFrequency = array ( - '1' => array(44100, 48000, 32000), - '2' => array(22050, 24000, 16000), - '2.5' => array(11025, 12000, 8000) - ); - } - return $MPEGaudioFrequency; - } - - function MPEGaudioChannelModeArray() { - static $MPEGaudioChannelMode = array('stereo', 'joint stereo', 'dual channel', 'mono'); - return $MPEGaudioChannelMode; - } - - function MPEGaudioModeExtensionArray() { - static $MPEGaudioModeExtension; - if (empty($MPEGaudioModeExtension)) { - $MPEGaudioModeExtension = array ( - 1 => array('4-31', '8-31', '12-31', '16-31'), - 2 => array('4-31', '8-31', '12-31', '16-31'), - 3 => array('', 'IS', 'MS', 'IS+MS') - ); - } - return $MPEGaudioModeExtension; - } - - function MPEGaudioEmphasisArray() { - static $MPEGaudioEmphasis = array('none', '50/15ms', false, 'CCIT J.17'); - return $MPEGaudioEmphasis; - } - - function MPEGaudioHeaderBytesValid($head4, $allowBitrate15=false) { - return getid3_mp3::MPEGaudioHeaderValid(getid3_mp3::MPEGaudioHeaderDecode($head4), false, $allowBitrate15); - } - - function MPEGaudioHeaderValid($rawarray, $echoerrors=false, $allowBitrate15=false) { - if (($rawarray['synch'] & 0x0FFE) != 0x0FFE) { - return false; - } - - static $MPEGaudioVersionLookup; - static $MPEGaudioLayerLookup; - static $MPEGaudioBitrateLookup; - static $MPEGaudioFrequencyLookup; - static $MPEGaudioChannelModeLookup; - static $MPEGaudioModeExtensionLookup; - static $MPEGaudioEmphasisLookup; - if (empty($MPEGaudioVersionLookup)) { - $MPEGaudioVersionLookup = getid3_mp3::MPEGaudioVersionArray(); - $MPEGaudioLayerLookup = getid3_mp3::MPEGaudioLayerArray(); - $MPEGaudioBitrateLookup = getid3_mp3::MPEGaudioBitrateArray(); - $MPEGaudioFrequencyLookup = getid3_mp3::MPEGaudioFrequencyArray(); - $MPEGaudioChannelModeLookup = getid3_mp3::MPEGaudioChannelModeArray(); - $MPEGaudioModeExtensionLookup = getid3_mp3::MPEGaudioModeExtensionArray(); - $MPEGaudioEmphasisLookup = getid3_mp3::MPEGaudioEmphasisArray(); - } - - if (isset($MPEGaudioVersionLookup[$rawarray['version']])) { - $decodedVersion = $MPEGaudioVersionLookup[$rawarray['version']]; - } else { - echo ($echoerrors ? "\n".'invalid Version ('.$rawarray['version'].')' : ''); - return false; - } - if (isset($MPEGaudioLayerLookup[$rawarray['layer']])) { - $decodedLayer = $MPEGaudioLayerLookup[$rawarray['layer']]; - } else { - echo ($echoerrors ? "\n".'invalid Layer ('.$rawarray['layer'].')' : ''); - return false; - } - if (!isset($MPEGaudioBitrateLookup[$decodedVersion][$decodedLayer][$rawarray['bitrate']])) { - echo ($echoerrors ? "\n".'invalid Bitrate ('.$rawarray['bitrate'].')' : ''); - if ($rawarray['bitrate'] == 15) { - // known issue in LAME 3.90 - 3.93.1 where free-format has bitrate ID of 15 instead of 0 - // let it go through here otherwise file will not be identified - if (!$allowBitrate15) { - return false; - } - } else { - return false; - } - } - if (!isset($MPEGaudioFrequencyLookup[$decodedVersion][$rawarray['sample_rate']])) { - echo ($echoerrors ? "\n".'invalid Frequency ('.$rawarray['sample_rate'].')' : ''); - return false; - } - if (!isset($MPEGaudioChannelModeLookup[$rawarray['channelmode']])) { - echo ($echoerrors ? "\n".'invalid ChannelMode ('.$rawarray['channelmode'].')' : ''); - return false; - } - if (!isset($MPEGaudioModeExtensionLookup[$decodedLayer][$rawarray['modeextension']])) { - echo ($echoerrors ? "\n".'invalid Mode Extension ('.$rawarray['modeextension'].')' : ''); - return false; - } - if (!isset($MPEGaudioEmphasisLookup[$rawarray['emphasis']])) { - echo ($echoerrors ? "\n".'invalid Emphasis ('.$rawarray['emphasis'].')' : ''); - return false; - } - // These are just either set or not set, you can't mess that up :) - // $rawarray['protection']; - // $rawarray['padding']; - // $rawarray['private']; - // $rawarray['copyright']; - // $rawarray['original']; - - return true; - } - - function MPEGaudioHeaderDecode($Header4Bytes) { - // AAAA AAAA AAAB BCCD EEEE FFGH IIJJ KLMM - // A - Frame sync (all bits set) - // B - MPEG Audio version ID - // C - Layer description - // D - Protection bit - // E - Bitrate index - // F - Sampling rate frequency index - // G - Padding bit - // H - Private bit - // I - Channel Mode - // J - Mode extension (Only if Joint stereo) - // K - Copyright - // L - Original - // M - Emphasis - - if (strlen($Header4Bytes) != 4) { - return false; - } - - $MPEGrawHeader['synch'] = (getid3_lib::BigEndian2Int(substr($Header4Bytes, 0, 2)) & 0xFFE0) >> 4; - $MPEGrawHeader['version'] = (ord($Header4Bytes{1}) & 0x18) >> 3; // BB - $MPEGrawHeader['layer'] = (ord($Header4Bytes{1}) & 0x06) >> 1; // CC - $MPEGrawHeader['protection'] = (ord($Header4Bytes{1}) & 0x01); // D - $MPEGrawHeader['bitrate'] = (ord($Header4Bytes{2}) & 0xF0) >> 4; // EEEE - $MPEGrawHeader['sample_rate'] = (ord($Header4Bytes{2}) & 0x0C) >> 2; // FF - $MPEGrawHeader['padding'] = (ord($Header4Bytes{2}) & 0x02) >> 1; // G - $MPEGrawHeader['private'] = (ord($Header4Bytes{2}) & 0x01); // H - $MPEGrawHeader['channelmode'] = (ord($Header4Bytes{3}) & 0xC0) >> 6; // II - $MPEGrawHeader['modeextension'] = (ord($Header4Bytes{3}) & 0x30) >> 4; // JJ - $MPEGrawHeader['copyright'] = (ord($Header4Bytes{3}) & 0x08) >> 3; // K - $MPEGrawHeader['original'] = (ord($Header4Bytes{3}) & 0x04) >> 2; // L - $MPEGrawHeader['emphasis'] = (ord($Header4Bytes{3}) & 0x03); // MM - - return $MPEGrawHeader; - } - - function MPEGaudioFrameLength(&$bitrate, &$version, &$layer, $padding, &$samplerate) { - static $AudioFrameLengthCache = array(); - - if (!isset($AudioFrameLengthCache[$bitrate][$version][$layer][$padding][$samplerate])) { - $AudioFrameLengthCache[$bitrate][$version][$layer][$padding][$samplerate] = false; - if ($bitrate != 'free') { - - if ($version == '1') { - - if ($layer == '1') { - - // For Layer I slot is 32 bits long - $FrameLengthCoefficient = 48; - $SlotLength = 4; - - } else { // Layer 2 / 3 - - // for Layer 2 and Layer 3 slot is 8 bits long. - $FrameLengthCoefficient = 144; - $SlotLength = 1; - - } - - } else { // MPEG-2 / MPEG-2.5 - - if ($layer == '1') { - - // For Layer I slot is 32 bits long - $FrameLengthCoefficient = 24; - $SlotLength = 4; - - } elseif ($layer == '2') { - - // for Layer 2 and Layer 3 slot is 8 bits long. - $FrameLengthCoefficient = 144; - $SlotLength = 1; - - } else { // layer 3 - - // for Layer 2 and Layer 3 slot is 8 bits long. - $FrameLengthCoefficient = 72; - $SlotLength = 1; - - } - - } - - // FrameLengthInBytes = ((Coefficient * BitRate) / SampleRate) + Padding - if ($samplerate > 0) { - $NewFramelength = ($FrameLengthCoefficient * $bitrate) / $samplerate; - $NewFramelength = floor($NewFramelength / $SlotLength) * $SlotLength; // round to next-lower multiple of SlotLength (1 byte for Layer 2/3, 4 bytes for Layer I) - if ($padding) { - $NewFramelength += $SlotLength; - } - $AudioFrameLengthCache[$bitrate][$version][$layer][$padding][$samplerate] = (int) $NewFramelength; - } - } - } - return $AudioFrameLengthCache[$bitrate][$version][$layer][$padding][$samplerate]; - } - - function ClosestStandardMP3Bitrate($bitrate) { - static $StandardBitrates = array(320000, 256000, 224000, 192000, 160000, 128000, 112000, 96000, 80000, 64000, 56000, 48000, 40000, 32000, 24000, 16000, 8000); - static $BitrateTable = array(0=>'-'); - $roundbitrate = intval(round($bitrate, -3)); - if (!isset($BitrateTable[$roundbitrate])) { - if ($roundbitrate > 320000) { - $BitrateTable[$roundbitrate] = round($bitrate, -4); - } else { - $LastBitrate = 320000; - foreach ($StandardBitrates as $StandardBitrate) { - $BitrateTable[$roundbitrate] = $StandardBitrate; - if ($roundbitrate >= $StandardBitrate - (($LastBitrate - $StandardBitrate) / 2)) { - break; - } - $LastBitrate = $StandardBitrate; - } - } - } - return $BitrateTable[$roundbitrate]; - } - - function XingVBRidOffset($version, $channelmode) { - static $XingVBRidOffsetCache = array(); - if (empty($XingVBRidOffset)) { - $XingVBRidOffset = array ( - '1' => array ('mono' => 0x15, // 4 + 17 = 21 - 'stereo' => 0x24, // 4 + 32 = 36 - 'joint stereo' => 0x24, - 'dual channel' => 0x24 - ), - - '2' => array ('mono' => 0x0D, // 4 + 9 = 13 - 'stereo' => 0x15, // 4 + 17 = 21 - 'joint stereo' => 0x15, - 'dual channel' => 0x15 - ), - - '2.5' => array ('mono' => 0x15, - 'stereo' => 0x15, - 'joint stereo' => 0x15, - 'dual channel' => 0x15 - ) - ); - } - return $XingVBRidOffset[$version][$channelmode]; - } - - function LAMEvbrMethodLookup($VBRmethodID) { - static $LAMEvbrMethodLookup = array( - 0x00 => 'unknown', - 0x01 => 'cbr', - 0x02 => 'abr', - 0x03 => 'vbr-old / vbr-rh', - 0x04 => 'vbr-new / vbr-mtrh', - 0x05 => 'vbr-mt', - 0x06 => 'vbr (full vbr method 4)', - 0x08 => 'cbr (constant bitrate 2 pass)', - 0x09 => 'abr (2 pass)', - 0x0F => 'reserved' - ); - return (isset($LAMEvbrMethodLookup[$VBRmethodID]) ? $LAMEvbrMethodLookup[$VBRmethodID] : ''); - } - - function LAMEmiscStereoModeLookup($StereoModeID) { - static $LAMEmiscStereoModeLookup = array( - 0 => 'mono', - 1 => 'stereo', - 2 => 'dual mono', - 3 => 'joint stereo', - 4 => 'forced stereo', - 5 => 'auto', - 6 => 'intensity stereo', - 7 => 'other' - ); - return (isset($LAMEmiscStereoModeLookup[$StereoModeID]) ? $LAMEmiscStereoModeLookup[$StereoModeID] : ''); - } - - function LAMEmiscSourceSampleFrequencyLookup($SourceSampleFrequencyID) { - static $LAMEmiscSourceSampleFrequencyLookup = array( - 0 => '<= 32 kHz', - 1 => '44.1 kHz', - 2 => '48 kHz', - 3 => '> 48kHz' - ); - return (isset($LAMEmiscSourceSampleFrequencyLookup[$SourceSampleFrequencyID]) ? $LAMEmiscSourceSampleFrequencyLookup[$SourceSampleFrequencyID] : ''); - } - - function LAMEsurroundInfoLookup($SurroundInfoID) { - static $LAMEsurroundInfoLookup = array( - 0 => 'no surround info', - 1 => 'DPL encoding', - 2 => 'DPL2 encoding', - 3 => 'Ambisonic encoding' - ); - return (isset($LAMEsurroundInfoLookup[$SurroundInfoID]) ? $LAMEsurroundInfoLookup[$SurroundInfoID] : 'reserved'); - } - - function LAMEpresetUsedLookup($LAMEtag) { - - if ($LAMEtag['preset_used_id'] == 0) { - // no preset used (LAME >=3.93) - // no preset recorded (LAME <3.93) - return ''; - } - $LAMEpresetUsedLookup = array(); - - ///// THIS PART CANNOT BE STATIC . - for ($i = 8; $i <= 320; $i++) { - switch ($LAMEtag['vbr_method']) { - case 'cbr': - $LAMEpresetUsedLookup[$i] = '--alt-preset '.$LAMEtag['vbr_method'].' '.$i; - break; - case 'abr': - default: // other VBR modes shouldn't be here(?) - $LAMEpresetUsedLookup[$i] = '--alt-preset '.$i; - break; - } - } - - // named old-style presets (studio, phone, voice, etc) are handled in GuessEncoderOptions() - - // named alt-presets - $LAMEpresetUsedLookup[1000] = '--r3mix'; - $LAMEpresetUsedLookup[1001] = '--alt-preset standard'; - $LAMEpresetUsedLookup[1002] = '--alt-preset extreme'; - $LAMEpresetUsedLookup[1003] = '--alt-preset insane'; - $LAMEpresetUsedLookup[1004] = '--alt-preset fast standard'; - $LAMEpresetUsedLookup[1005] = '--alt-preset fast extreme'; - $LAMEpresetUsedLookup[1006] = '--alt-preset medium'; - $LAMEpresetUsedLookup[1007] = '--alt-preset fast medium'; - - // LAME 3.94 additions/changes - $LAMEpresetUsedLookup[1010] = '--preset portable'; // 3.94a15 Oct 21 2003 - $LAMEpresetUsedLookup[1015] = '--preset radio'; // 3.94a15 Oct 21 2003 - - $LAMEpresetUsedLookup[320] = '--preset insane'; // 3.94a15 Nov 12 2003 - $LAMEpresetUsedLookup[410] = '-V9'; - $LAMEpresetUsedLookup[420] = '-V8'; - $LAMEpresetUsedLookup[440] = '-V6'; - $LAMEpresetUsedLookup[430] = '--preset radio'; // 3.94a15 Nov 12 2003 - $LAMEpresetUsedLookup[450] = '--preset '.(($LAMEtag['raw']['vbr_method'] == 4) ? 'fast ' : '').'portable'; // 3.94a15 Nov 12 2003 - $LAMEpresetUsedLookup[460] = '--preset '.(($LAMEtag['raw']['vbr_method'] == 4) ? 'fast ' : '').'medium'; // 3.94a15 Nov 12 2003 - $LAMEpresetUsedLookup[470] = '--r3mix'; // 3.94b1 Dec 18 2003 - $LAMEpresetUsedLookup[480] = '--preset '.(($LAMEtag['raw']['vbr_method'] == 4) ? 'fast ' : '').'standard'; // 3.94a15 Nov 12 2003 - $LAMEpresetUsedLookup[490] = '-V1'; - $LAMEpresetUsedLookup[500] = '--preset '.(($LAMEtag['raw']['vbr_method'] == 4) ? 'fast ' : '').'extreme'; // 3.94a15 Nov 12 2003 - - return (isset($LAMEpresetUsedLookup[$LAMEtag['preset_used_id']]) ? $LAMEpresetUsedLookup[$LAMEtag['preset_used_id']] : 'new/unknown preset: '.$LAMEtag['preset_used_id'].' - report to info@getid3.org'); - } - -} - -?>
\ No newline at end of file diff --git a/getid3/module.audio.mpc.php b/getid3/module.audio.mpc.php deleted file mode 100644 index ffe3366..0000000 --- a/getid3/module.audio.mpc.php +++ /dev/null @@ -1,502 +0,0 @@ -<?php -///////////////////////////////////////////////////////////////// -/// getID3() by James Heinrich <info@getid3.org> // -// available at http://getid3.sourceforge.net // -// or http://www.getid3.org // -///////////////////////////////////////////////////////////////// -// See readme.txt for more details // -///////////////////////////////////////////////////////////////// -// // -// module.audio.mpc.php // -// module for analyzing Musepack/MPEG+ Audio files // -// dependencies: NONE // -// /// -///////////////////////////////////////////////////////////////// - - -class getid3_mpc -{ - - function getid3_mpc(&$fd, &$ThisFileInfo) { - $ThisFileInfo['mpc']['header'] = array(); - $thisfile_mpc_header = &$ThisFileInfo['mpc']['header']; - - $ThisFileInfo['fileformat'] = 'mpc'; - $ThisFileInfo['audio']['dataformat'] = 'mpc'; - $ThisFileInfo['audio']['bitrate_mode'] = 'vbr'; - $ThisFileInfo['audio']['channels'] = 2; // up to SV7 the format appears to have been hardcoded for stereo only - $ThisFileInfo['audio']['lossless'] = false; - - fseek($fd, $ThisFileInfo['avdataoffset'], SEEK_SET); - $MPCheaderData = fread($fd, 4); - $ThisFileInfo['mpc']['header']['preamble'] = substr($MPCheaderData, 0, 4); // should be 'MPCK' (SV8) or 'MP+' (SV7), otherwise possible stream data (SV4-SV6) - if (ereg('^MPCK', $ThisFileInfo['mpc']['header']['preamble'])) { - - // this is SV8 - return $this->ParseMPCsv8($fd, $ThisFileInfo); - - } elseif (ereg('^MP\+', $ThisFileInfo['mpc']['header']['preamble'])) { - - // this is SV7 - return $this->ParseMPCsv7($fd, $ThisFileInfo); - - } elseif (preg_match('/^[\x00\x01\x10\x11\x40\x41\x50\x51\x80\x81\x90\x91\xC0\xC1\xD0\xD1][\x20-37][\x00\x20\x40\x60\x80\xA0\xC0\xE0]/s', $MPCheaderData)) { - - // this is SV4 - SV6, handle seperately - return $this->ParseMPCsv6($fd, $ThisFileInfo); - - } else { - - $ThisFileInfo['error'][] = 'Expecting "MP+" or "MPCK" at offset '.$ThisFileInfo['avdataoffset'].', found "'.substr($MPCheaderData, 0, 4).'"'; - unset($ThisFileInfo['fileformat']); - unset($ThisFileInfo['mpc']); - return false; - - } - return false; - } - - - function ParseMPCsv8(&$fd, &$ThisFileInfo) { - // this is SV8 - // http://trac.musepack.net/trac/wiki/SV8Specification - - $thisfile_mpc_header = &$ThisFileInfo['mpc']['header']; - - $keyNameSize = 2; - $maxHandledPacketLength = 9; // specs say: "n*8; 0 < n < 10" - - $offset = ftell($fd); - while ($offset < $ThisFileInfo['avdataend']) { - $thisPacket = array(); - $thisPacket['offset'] = $offset; - $packet_offset = 0; - - // Size is a variable-size field, could be 1-4 bytes (possibly more?) - // read enough data in and figure out the exact size later - $MPCheaderData = fread($fd, $keyNameSize + $maxHandledPacketLength); - $packet_offset += $keyNameSize; - $thisPacket['key'] = substr($MPCheaderData, 0, $keyNameSize); - $thisPacket['key_name'] = $this->MPCsv8PacketName($thisPacket['key']); - if ($thisPacket['key'] == $thisPacket['key_name']) { - $ThisFileInfo['error'][] = 'Found unexpected key value "'.$thisPacket['key'].'" at offset '.$thisPacket['offset']; - return false; - } - $packetLength = 0; - $thisPacket['packet_size'] = $this->SV8variableLengthInteger(substr($MPCheaderData, $keyNameSize), $packetLength); // includes keyname and packet_size field - if ($thisPacket['packet_size'] === false) { - $ThisFileInfo['error'][] = 'Did not find expected packet length within '.$maxHandledPacketLength.' bytes at offset '.($thisPacket['offset'] + $keyNameSize); - return false; - } - $packet_offset += $packetLength; - $offset += $thisPacket['packet_size']; - - switch ($thisPacket['key']) { - case 'SH': // Stream Header - $moreBytesToRead = $thisPacket['packet_size'] - $keyNameSize - $maxHandledPacketLength; - if ($moreBytesToRead > 0) { - $MPCheaderData .= fread($fd, $moreBytesToRead); - } - $thisPacket['crc'] = getid3_lib::BigEndian2Int(substr($MPCheaderData, $packet_offset, 4)); - $packet_offset += 4; - $thisPacket['stream_version'] = getid3_lib::BigEndian2Int(substr($MPCheaderData, $packet_offset, 1)); - $packet_offset += 1; - - $packetLength = 0; - $thisPacket['sample_count'] = $this->SV8variableLengthInteger(substr($MPCheaderData, $packet_offset, $maxHandledPacketLength), $packetLength); - $packet_offset += $packetLength; - - $packetLength = 0; - $thisPacket['beginning_silence'] = $this->SV8variableLengthInteger(substr($MPCheaderData, $packet_offset, $maxHandledPacketLength), $packetLength); - $packet_offset += $packetLength; - - $otherUsefulData = getid3_lib::BigEndian2Int(substr($MPCheaderData, $packet_offset, 2)); - $packet_offset += 2; - $thisPacket['sample_frequency_raw'] = (($otherUsefulData & 0xE000) >> 13); - $thisPacket['max_bands_used'] = (($otherUsefulData & 0x1F00) >> 8); - $thisPacket['channels'] = (($otherUsefulData & 0x00F0) >> 4) + 1; - $thisPacket['ms_used'] = (bool) (($otherUsefulData & 0x0008) >> 3); - $thisPacket['audio_block_frames'] = (($otherUsefulData & 0x0007) >> 0); - $thisPacket['sample_frequency'] = $this->MPCfrequencyLookup($thisPacket['sample_frequency_raw']); - - $thisfile_mpc_header['mid_side_stereo'] = $thisPacket['ms_used']; - $thisfile_mpc_header['sample_rate'] = $thisPacket['sample_frequency']; - $thisfile_mpc_header['samples'] = $thisPacket['sample_count']; - $thisfile_mpc_header['stream_version_major'] = $thisPacket['stream_version']; - - $ThisFileInfo['audio']['channels'] = $thisPacket['channels']; - $ThisFileInfo['audio']['sample_rate'] = $thisPacket['sample_frequency']; - $ThisFileInfo['playtime_seconds'] = $thisPacket['sample_count'] / $thisPacket['sample_frequency']; - $ThisFileInfo['audio']['bitrate'] = (($ThisFileInfo['avdataend'] - $ThisFileInfo['avdataoffset']) * 8) / $ThisFileInfo['playtime_seconds']; - break; - - case 'RG': // Replay Gain - $moreBytesToRead = $thisPacket['packet_size'] - $keyNameSize - $maxHandledPacketLength; - if ($moreBytesToRead > 0) { - $MPCheaderData .= fread($fd, $moreBytesToRead); - } - $thisPacket['replaygain_version'] = getid3_lib::BigEndian2Int(substr($MPCheaderData, $packet_offset, 1)); - $packet_offset += 1; - $thisPacket['replaygain_title_gain'] = getid3_lib::BigEndian2Int(substr($MPCheaderData, $packet_offset, 2)); - $packet_offset += 2; - $thisPacket['replaygain_title_peak'] = getid3_lib::BigEndian2Int(substr($MPCheaderData, $packet_offset, 2)); - $packet_offset += 2; - $thisPacket['replaygain_album_gain'] = getid3_lib::BigEndian2Int(substr($MPCheaderData, $packet_offset, 2)); - $packet_offset += 2; - $thisPacket['replaygain_album_peak'] = getid3_lib::BigEndian2Int(substr($MPCheaderData, $packet_offset, 2)); - $packet_offset += 2; - - if ($thisPacket['replaygain_title_gain']) { $ThisFileInfo['replay_gain']['title']['gain'] = $thisPacket['replaygain_title_gain']; } - if ($thisPacket['replaygain_title_peak']) { $ThisFileInfo['replay_gain']['title']['peak'] = $thisPacket['replaygain_title_peak']; } - if ($thisPacket['replaygain_album_gain']) { $ThisFileInfo['replay_gain']['album']['gain'] = $thisPacket['replaygain_album_gain']; } - if ($thisPacket['replaygain_album_peak']) { $ThisFileInfo['replay_gain']['album']['peak'] = $thisPacket['replaygain_album_peak']; } - break; - - case 'EI': // Encoder Info - $moreBytesToRead = $thisPacket['packet_size'] - $keyNameSize - $maxHandledPacketLength; - if ($moreBytesToRead > 0) { - $MPCheaderData .= fread($fd, $moreBytesToRead); - } - $profile_pns = getid3_lib::BigEndian2Int(substr($MPCheaderData, $packet_offset, 1)); - $packet_offset += 1; - $quality_int = (($profile_pns & 0xF0) >> 4); - $quality_dec = (($profile_pns & 0x0E) >> 3); - $thisPacket['quality'] = (float) $quality_int + ($quality_dec / 8); - $thisPacket['pns_tool'] = (bool) (($profile_pns & 0x01) >> 0); - $thisPacket['version_major'] = getid3_lib::BigEndian2Int(substr($MPCheaderData, $packet_offset, 1)); - $packet_offset += 1; - $thisPacket['version_minor'] = getid3_lib::BigEndian2Int(substr($MPCheaderData, $packet_offset, 1)); - $packet_offset += 1; - $thisPacket['version_build'] = getid3_lib::BigEndian2Int(substr($MPCheaderData, $packet_offset, 1)); - $packet_offset += 1; - $thisPacket['version'] = $thisPacket['version_major'].'.'.$thisPacket['version_minor'].'.'.$thisPacket['version_build']; - - $ThisFileInfo['audio']['encoder'] = 'MPC v'.$thisPacket['version'].' ('.(($thisPacket['version_minor'] % 2) ? 'unstable' : 'stable').')'; - $thisfile_mpc_header['encoder_version'] = $ThisFileInfo['audio']['encoder']; - //$thisfile_mpc_header['quality'] = (float) ($thisPacket['quality'] / 1.5875); // values can range from 0.000 to 15.875, mapped to qualities of 0.0 to 10.0 - $thisfile_mpc_header['quality'] = (float) ($thisPacket['quality'] - 5); // values can range from 0.000 to 15.875, of which 0..4 are "reserved/experimental", and 5..15 are mapped to qualities of 0.0 to 10.0 - break; - - case 'SO': // Seek Table Offset - $packetLength = 0; - $thisPacket['seek_table_offset'] = $thisPacket['offset'] + $this->SV8variableLengthInteger(substr($MPCheaderData, $packet_offset, $maxHandledPacketLength), $packetLength); - $packet_offset += $packetLength; - break; - - case 'ST': // Seek Table - case 'SE': // Stream End - case 'AP': // Audio Data - // nothing useful here, just skip this packet - $thisPacket = array(); - break; - - default: - $ThisFileInfo['error'][] = 'Found unhandled key type "'.$thisPacket['key'].'" at offset '.$thisPacket['offset']; - return false; - break; - } - if (!empty($thisPacket)) { - $ThisFileInfo['mpc']['packets'][] = $thisPacket; - } - fseek($fd, $offset); - } - $thisfile_mpc_header['size'] = $offset; - return true; - } - - function ParseMPCsv7(&$fd, &$ThisFileInfo) { - // this is SV7 - // http://www.uni-jena.de/~pfk/mpp/sv8/header.html - $thisfile_mpc_header = &$ThisFileInfo['mpc']['header']; - $offset = 0; - - $thisfile_mpc_header['size'] = 28; - $MPCheaderData = $ThisFileInfo['mpc']['header']['preamble']; - $MPCheaderData .= fread($fd, $thisfile_mpc_header['size'] - strlen($ThisFileInfo['mpc']['header']['preamble'])); - $offset = strlen('MP+'); - - $StreamVersionByte = getid3_lib::LittleEndian2Int(substr($MPCheaderData, $offset, 1)); - $offset += 1; - $thisfile_mpc_header['stream_version_major'] = ($StreamVersionByte & 0x0F) >> 0; - $thisfile_mpc_header['stream_version_minor'] = ($StreamVersionByte & 0xF0) >> 4; // should always be 0, subversions no longer exist in SV8 - $thisfile_mpc_header['frame_count'] = getid3_lib::LittleEndian2Int(substr($MPCheaderData, $offset, 4)); - $offset += 4; - - if ($thisfile_mpc_header['stream_version_major'] != 7) { - $ThisFileInfo['error'][] = 'Only Musepack SV7 supported (this file claims to be v'.$thisfile_mpc_header['stream_version_major'].')'; - return false; - } - - $FlagsDWORD1 = getid3_lib::LittleEndian2Int(substr($MPCheaderData, $offset, 4)); - $offset += 4; - $thisfile_mpc_header['intensity_stereo'] = (bool) (($FlagsDWORD1 & 0x80000000) >> 31); - $thisfile_mpc_header['mid_side_stereo'] = (bool) (($FlagsDWORD1 & 0x40000000) >> 30); - $thisfile_mpc_header['max_subband'] = ($FlagsDWORD1 & 0x3F000000) >> 24; - $thisfile_mpc_header['raw']['profile'] = ($FlagsDWORD1 & 0x00F00000) >> 20; - $thisfile_mpc_header['begin_loud'] = (bool) (($FlagsDWORD1 & 0x00080000) >> 19); - $thisfile_mpc_header['end_loud'] = (bool) (($FlagsDWORD1 & 0x00040000) >> 18); - $thisfile_mpc_header['raw']['sample_rate'] = ($FlagsDWORD1 & 0x00030000) >> 16; - $thisfile_mpc_header['max_level'] = ($FlagsDWORD1 & 0x0000FFFF); - - $thisfile_mpc_header['raw']['title_peak'] = getid3_lib::LittleEndian2Int(substr($MPCheaderData, $offset, 2)); - $offset += 2; - $thisfile_mpc_header['raw']['title_gain'] = getid3_lib::LittleEndian2Int(substr($MPCheaderData, $offset, 2), true); - $offset += 2; - - $thisfile_mpc_header['raw']['album_peak'] = getid3_lib::LittleEndian2Int(substr($MPCheaderData, $offset, 2)); - $offset += 2; - $thisfile_mpc_header['raw']['album_gain'] = getid3_lib::LittleEndian2Int(substr($MPCheaderData, $offset, 2), true); - $offset += 2; - - $FlagsDWORD2 = getid3_lib::LittleEndian2Int(substr($MPCheaderData, $offset, 4)); - $offset += 4; - $thisfile_mpc_header['true_gapless'] = (bool) (($FlagsDWORD2 & 0x80000000) >> 31); - $thisfile_mpc_header['last_frame_length'] = ($FlagsDWORD2 & 0x7FF00000) >> 20; - - - $thisfile_mpc_header['raw']['not_sure_what'] = getid3_lib::LittleEndian2Int(substr($MPCheaderData, $offset, 3)); - $offset += 3; - $thisfile_mpc_header['raw']['encoder_version'] = getid3_lib::LittleEndian2Int(substr($MPCheaderData, $offset, 1)); - $offset += 1; - - $thisfile_mpc_header['profile'] = $this->MPCprofileNameLookup($thisfile_mpc_header['raw']['profile']); - $thisfile_mpc_header['sample_rate'] = $this->MPCfrequencyLookup($thisfile_mpc_header['raw']['sample_rate']); - if ($thisfile_mpc_header['sample_rate'] == 0) { - $ThisFileInfo['error'][] = 'Corrupt MPC file: frequency == zero'; - return false; - } - $ThisFileInfo['audio']['sample_rate'] = $thisfile_mpc_header['sample_rate']; - $thisfile_mpc_header['samples'] = ((($thisfile_mpc_header['frame_count'] - 1) * 1152) + $thisfile_mpc_header['last_frame_length']) * $ThisFileInfo['audio']['channels']; - - $ThisFileInfo['playtime_seconds'] = ($thisfile_mpc_header['samples'] / $ThisFileInfo['audio']['channels']) / $ThisFileInfo['audio']['sample_rate']; - if ($ThisFileInfo['playtime_seconds'] == 0) { - $ThisFileInfo['error'][] = 'Corrupt MPC file: playtime_seconds == zero'; - return false; - } - - // add size of file header to avdataoffset - calc bitrate correctly + MD5 data - $ThisFileInfo['avdataoffset'] += $thisfile_mpc_header['size']; - - $ThisFileInfo['audio']['bitrate'] = (($ThisFileInfo['avdataend'] - $ThisFileInfo['avdataoffset']) * 8) / $ThisFileInfo['playtime_seconds']; - - $thisfile_mpc_header['title_peak'] = $thisfile_mpc_header['raw']['title_peak']; - $thisfile_mpc_header['title_peak_db'] = $this->MPCpeakDBLookup($thisfile_mpc_header['title_peak']); - if ($thisfile_mpc_header['raw']['title_gain'] < 0) { - $thisfile_mpc_header['title_gain_db'] = (float) (32768 + $thisfile_mpc_header['raw']['title_gain']) / -100; - } else { - $thisfile_mpc_header['title_gain_db'] = (float) $thisfile_mpc_header['raw']['title_gain'] / 100; - } - - $thisfile_mpc_header['album_peak'] = $thisfile_mpc_header['raw']['album_peak']; - $thisfile_mpc_header['album_peak_db'] = $this->MPCpeakDBLookup($thisfile_mpc_header['album_peak']); - if ($thisfile_mpc_header['raw']['album_gain'] < 0) { - $thisfile_mpc_header['album_gain_db'] = (float) (32768 + $thisfile_mpc_header['raw']['album_gain']) / -100; - } else { - $thisfile_mpc_header['album_gain_db'] = (float) $thisfile_mpc_header['raw']['album_gain'] / 100;; - } - $thisfile_mpc_header['encoder_version'] = $this->MPCencoderVersionLookup($thisfile_mpc_header['raw']['encoder_version']); - - $ThisFileInfo['replay_gain']['track']['adjustment'] = $thisfile_mpc_header['title_gain_db']; - $ThisFileInfo['replay_gain']['album']['adjustment'] = $thisfile_mpc_header['album_gain_db']; - - if ($thisfile_mpc_header['title_peak'] > 0) { - $ThisFileInfo['replay_gain']['track']['peak'] = $thisfile_mpc_header['title_peak']; - } elseif (round($thisfile_mpc_header['max_level'] * 1.18) > 0) { - $ThisFileInfo['replay_gain']['track']['peak'] = getid3_lib::CastAsInt(round($thisfile_mpc_header['max_level'] * 1.18)); // why? I don't know - see mppdec.c - } - if ($thisfile_mpc_header['album_peak'] > 0) { - $ThisFileInfo['replay_gain']['album']['peak'] = $thisfile_mpc_header['album_peak']; - } - - //$ThisFileInfo['audio']['encoder'] = 'SV'.$thisfile_mpc_header['stream_version_major'].'.'.$thisfile_mpc_header['stream_version_minor'].', '.$thisfile_mpc_header['encoder_version']; - $ThisFileInfo['audio']['encoder'] = $thisfile_mpc_header['encoder_version']; - $ThisFileInfo['audio']['encoder_options'] = $thisfile_mpc_header['profile']; - $thisfile_mpc_header['quality'] = (float) ($thisfile_mpc_header['raw']['profile'] - 5); // values can range from 0 to 15, of which 0..4 are "reserved/experimental", and 5..15 are mapped to qualities of 0.0 to 10.0 - - return true; - } - - function ParseMPCsv6(&$fd, &$ThisFileInfo) { - // this is SV4 - SV6 - $thisfile_mpc_header = &$ThisFileInfo['mpc']['header']; - $offset = 0; - - $thisfile_mpc_header['size'] = 8; - fseek($fd, $ThisFileInfo['avdataoffset'], SEEK_SET); - $MPCheaderData = fread($fd, $thisfile_mpc_header['size']); - - // add size of file header to avdataoffset - calc bitrate correctly + MD5 data - $ThisFileInfo['avdataoffset'] += $thisfile_mpc_header['size']; - - // Most of this code adapted from Jurgen Faul's MPEGplus source code - thanks Jurgen! :) - $HeaderDWORD[0] = getid3_lib::LittleEndian2Int(substr($MPCheaderData, 0, 4)); - $HeaderDWORD[1] = getid3_lib::LittleEndian2Int(substr($MPCheaderData, 4, 4)); - - - // DDDD DDDD CCCC CCCC BBBB BBBB AAAA AAAA - // aaaa aaaa abcd dddd dddd deee eeff ffff - // - // a = bitrate = anything - // b = IS = anything - // c = MS = anything - // d = streamversion = 0000000004 or 0000000005 or 0000000006 - // e = maxband = anything - // f = blocksize = 000001 for SV5+, anything(?) for SV4 - - $thisfile_mpc_header['target_bitrate'] = (($HeaderDWORD[0] & 0xFF800000) >> 23); - $thisfile_mpc_header['intensity_stereo'] = (bool) (($HeaderDWORD[0] & 0x00400000) >> 22); - $thisfile_mpc_header['mid_side_stereo'] = (bool) (($HeaderDWORD[0] & 0x00200000) >> 21); - $thisfile_mpc_header['stream_version_major'] = ($HeaderDWORD[0] & 0x001FF800) >> 11; - $thisfile_mpc_header['stream_version_minor'] = 0; // no sub-version numbers before SV7 - $thisfile_mpc_header['max_band'] = ($HeaderDWORD[0] & 0x000007C0) >> 6; // related to lowpass frequency, not sure how it translates exactly - $thisfile_mpc_header['block_size'] = ($HeaderDWORD[0] & 0x0000003F); - - switch ($thisfile_mpc_header['stream_version_major']) { - case 4: - $thisfile_mpc_header['frame_count'] = ($HeaderDWORD[1] >> 16); - break; - - case 5: - case 6: - $thisfile_mpc_header['frame_count'] = $HeaderDWORD[1]; - break; - - default: - $ThisFileInfo['error'] = 'Expecting 4, 5 or 6 in version field, found '.$thisfile_mpc_header['stream_version_major'].' instead'; - unset($ThisFileInfo['mpc']); - return false; - break; - } - - if (($thisfile_mpc_header['stream_version_major'] > 4) && ($thisfile_mpc_header['block_size'] != 1)) { - $ThisFileInfo['warning'][] = 'Block size expected to be 1, actual value found: '.$thisfile_mpc_header['block_size']; - } - - $thisfile_mpc_header['sample_rate'] = 44100; // AB: used by all files up to SV7 - $ThisFileInfo['audio']['sample_rate'] = $thisfile_mpc_header['sample_rate']; - $thisfile_mpc_header['samples'] = $thisfile_mpc_header['frame_count'] * 1152 * $ThisFileInfo['audio']['channels']; - - if ($thisfile_mpc_header['target_bitrate'] == 0) { - $ThisFileInfo['audio']['bitrate_mode'] = 'vbr'; - } else { - $ThisFileInfo['audio']['bitrate_mode'] = 'cbr'; - } - - $ThisFileInfo['mpc']['bitrate'] = ($ThisFileInfo['avdataend'] - $ThisFileInfo['avdataoffset']) * 8 * 44100 / $thisfile_mpc_header['frame_count'] / 1152; - $ThisFileInfo['audio']['bitrate'] = $ThisFileInfo['mpc']['bitrate']; - $ThisFileInfo['audio']['encoder'] = 'SV'.$thisfile_mpc_header['stream_version_major']; - - return true; - } - - - function MPCprofileNameLookup($profileid) { - static $MPCprofileNameLookup = array( - 0 => 'no profile', - 1 => 'Experimental', - 2 => 'unused', - 3 => 'unused', - 4 => 'unused', - 5 => 'below Telephone (q = 0.0)', - 6 => 'below Telephone (q = 1.0)', - 7 => 'Telephone (q = 2.0)', - 8 => 'Thumb (q = 3.0)', - 9 => 'Radio (q = 4.0)', - 10 => 'Standard (q = 5.0)', - 11 => 'Extreme (q = 6.0)', - 12 => 'Insane (q = 7.0)', - 13 => 'BrainDead (q = 8.0)', - 14 => 'above BrainDead (q = 9.0)', - 15 => 'above BrainDead (q = 10.0)' - ); - return (isset($MPCprofileNameLookup[$profileid]) ? $MPCprofileNameLookup[$profileid] : 'invalid'); - } - - function MPCfrequencyLookup($frequencyid) { - static $MPCfrequencyLookup = array( - 0 => 44100, - 1 => 48000, - 2 => 37800, - 3 => 32000 - ); - return (isset($MPCfrequencyLookup[$frequencyid]) ? $MPCfrequencyLookup[$frequencyid] : 'invalid'); - } - - function MPCpeakDBLookup($intvalue) { - if ($intvalue > 0) { - return ((log10($intvalue) / log10(2)) - 15) * 6; - } - return false; - } - - function MPCencoderVersionLookup($encoderversion) { - //Encoder version * 100 (106 = 1.06) - //EncoderVersion % 10 == 0 Release (1.0) - //EncoderVersion % 2 == 0 Beta (1.06) - //EncoderVersion % 2 == 1 Alpha (1.05a...z) - - if ($encoderversion == 0) { - // very old version, not known exactly which - return 'Buschmann v1.7.0-v1.7.9 or Klemm v0.90-v1.05'; - } - - if (($encoderversion % 10) == 0) { - - // release version - return number_format($encoderversion / 100, 2); - - } elseif (($encoderversion % 2) == 0) { - - // beta version - return number_format($encoderversion / 100, 2).' beta'; - - } - - // alpha version - return number_format($encoderversion / 100, 2).' alpha'; - } - - function SV8variableLengthInteger($data, &$packetLength, $maxHandledPacketLength=9) { - $packet_size = 0; - for ($packetLength = 1; $packetLength <= $maxHandledPacketLength; $packetLength++) { - // variable-length size field: - // bits, big-endian
- // 0xxx xxxx - value 0 to 2^7-1
- // 1xxx xxxx 0xxx xxxx - value 0 to 2^14-1
- // 1xxx xxxx 1xxx xxxx 0xxx xxxx - value 0 to 2^21-1
- // 1xxx xxxx 1xxx xxxx 1xxx xxxx 0xxx xxxx - value 0 to 2^28-1
- // ...
- $thisbyte = ord(substr($data, ($packetLength - 1), 1)); - // look through bytes until find a byte with MSB==0 - $packet_size = ($packet_size << 7); - $packet_size = ($packet_size | ($thisbyte & 0x7F)); - if (($thisbyte & 0x80) === 0) { - break; - } - if ($packetLength >= $maxHandledPacketLength) { - return false; - } - } - return $packet_size; - } - - function MPCsv8PacketName($packetKey) { - static $MPCsv8PacketName = array(); - if (empty($MPCsv8PacketName)) { - $MPCsv8PacketName = array( - 'AP' => 'Audio Packet', - 'CT' => 'Chapter Tag', - 'EI' => 'Encoder Info', - 'RG' => 'Replay Gain', - 'SE' => 'Stream End', - 'SH' => 'Stream Header', - 'SO' => 'Seek Table Offset', - 'ST' => 'Seek Table', - ); - } - return (isset($MPCsv8PacketName[$packetKey]) ? $MPCsv8PacketName[$packetKey] : $packetKey); - } -} - - -?>
\ No newline at end of file diff --git a/getid3/module.audio.ogg.php b/getid3/module.audio.ogg.php deleted file mode 100644 index 1cc6366..0000000 --- a/getid3/module.audio.ogg.php +++ /dev/null @@ -1,556 +0,0 @@ -<?php -///////////////////////////////////////////////////////////////// -/// getID3() by James Heinrich <info@getid3.org> // -// available at http://getid3.sourceforge.net // -// or http://www.getid3.org // -///////////////////////////////////////////////////////////////// -// See readme.txt for more details // -///////////////////////////////////////////////////////////////// -// // -// module.audio.ogg.php // -// module for analyzing Ogg Vorbis, OggFLAC and Speex files // -// dependencies: module.audio.flac.php // -// /// -///////////////////////////////////////////////////////////////// - -getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio.flac.php', __FILE__, true); - -class getid3_ogg -{ - - function getid3_ogg(&$fd, &$ThisFileInfo) { - - $ThisFileInfo['fileformat'] = 'ogg'; - - // Warn about illegal tags - only vorbiscomments are allowed - if (isset($ThisFileInfo['id3v2'])) { - $ThisFileInfo['warning'][] = 'Illegal ID3v2 tag present.'; - } - if (isset($ThisFileInfo['id3v1'])) { - $ThisFileInfo['warning'][] = 'Illegal ID3v1 tag present.'; - } - if (isset($ThisFileInfo['ape'])) { - $ThisFileInfo['warning'][] = 'Illegal APE tag present.'; - } - - - // Page 1 - Stream Header - - fseek($fd, $ThisFileInfo['avdataoffset'], SEEK_SET); - - $oggpageinfo = getid3_ogg::ParseOggPageHeader($fd); - $ThisFileInfo['ogg']['pageheader'][$oggpageinfo['page_seqno']] = $oggpageinfo; - - if (ftell($fd) >= GETID3_FREAD_BUFFER_SIZE) { - $ThisFileInfo['error'][] = 'Could not find start of Ogg page in the first '.GETID3_FREAD_BUFFER_SIZE.' bytes (this might not be an Ogg-Vorbis file?)'; - unset($ThisFileInfo['fileformat']); - unset($ThisFileInfo['ogg']); - return false; - } - - $filedata = fread($fd, $oggpageinfo['page_length']); - $filedataoffset = 0; - - if (substr($filedata, 0, 4) == 'fLaC') { - - $ThisFileInfo['audio']['dataformat'] = 'flac'; - $ThisFileInfo['audio']['bitrate_mode'] = 'vbr'; - $ThisFileInfo['audio']['lossless'] = true; - - } elseif (substr($filedata, 1, 6) == 'vorbis') { - - $this->ParseVorbisPageHeader($filedata, $filedataoffset, $ThisFileInfo, $oggpageinfo); - - } elseif (substr($filedata, 0, 8) == 'Speex ') { - - // http://www.speex.org/manual/node10.html - - $ThisFileInfo['audio']['dataformat'] = 'speex'; - $ThisFileInfo['mime_type'] = 'audio/speex'; - $ThisFileInfo['audio']['bitrate_mode'] = 'abr'; - $ThisFileInfo['audio']['lossless'] = false; - - $ThisFileInfo['ogg']['pageheader'][$oggpageinfo['page_seqno']]['speex_string'] = substr($filedata, $filedataoffset, 8); // hard-coded to 'Speex ' - $filedataoffset += 8; - $ThisFileInfo['ogg']['pageheader'][$oggpageinfo['page_seqno']]['speex_version'] = substr($filedata, $filedataoffset, 20); - $filedataoffset += 20; - $ThisFileInfo['ogg']['pageheader'][$oggpageinfo['page_seqno']]['speex_version_id'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); - $filedataoffset += 4; - $ThisFileInfo['ogg']['pageheader'][$oggpageinfo['page_seqno']]['header_size'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); - $filedataoffset += 4; - $ThisFileInfo['ogg']['pageheader'][$oggpageinfo['page_seqno']]['rate'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); - $filedataoffset += 4; - $ThisFileInfo['ogg']['pageheader'][$oggpageinfo['page_seqno']]['mode'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); - $filedataoffset += 4; - $ThisFileInfo['ogg']['pageheader'][$oggpageinfo['page_seqno']]['mode_bitstream_version'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); - $filedataoffset += 4; - $ThisFileInfo['ogg']['pageheader'][$oggpageinfo['page_seqno']]['nb_channels'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); - $filedataoffset += 4; - $ThisFileInfo['ogg']['pageheader'][$oggpageinfo['page_seqno']]['bitrate'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); - $filedataoffset += 4; - $ThisFileInfo['ogg']['pageheader'][$oggpageinfo['page_seqno']]['framesize'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); - $filedataoffset += 4; - $ThisFileInfo['ogg']['pageheader'][$oggpageinfo['page_seqno']]['vbr'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); - $filedataoffset += 4; - $ThisFileInfo['ogg']['pageheader'][$oggpageinfo['page_seqno']]['frames_per_packet'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); - $filedataoffset += 4; - $ThisFileInfo['ogg']['pageheader'][$oggpageinfo['page_seqno']]['extra_headers'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); - $filedataoffset += 4; - $ThisFileInfo['ogg']['pageheader'][$oggpageinfo['page_seqno']]['reserved1'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); - $filedataoffset += 4; - $ThisFileInfo['ogg']['pageheader'][$oggpageinfo['page_seqno']]['reserved2'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); - $filedataoffset += 4; - - $ThisFileInfo['speex']['speex_version'] = trim($ThisFileInfo['ogg']['pageheader'][$oggpageinfo['page_seqno']]['speex_version']); - $ThisFileInfo['speex']['sample_rate'] = $ThisFileInfo['ogg']['pageheader'][$oggpageinfo['page_seqno']]['rate']; - $ThisFileInfo['speex']['channels'] = $ThisFileInfo['ogg']['pageheader'][$oggpageinfo['page_seqno']]['nb_channels']; - $ThisFileInfo['speex']['vbr'] = (bool) $ThisFileInfo['ogg']['pageheader'][$oggpageinfo['page_seqno']]['vbr']; - $ThisFileInfo['speex']['band_type'] = getid3_ogg::SpeexBandModeLookup($ThisFileInfo['ogg']['pageheader'][$oggpageinfo['page_seqno']]['mode']); - - $ThisFileInfo['audio']['sample_rate'] = $ThisFileInfo['speex']['sample_rate']; - $ThisFileInfo['audio']['channels'] = $ThisFileInfo['speex']['channels']; - if ($ThisFileInfo['speex']['vbr']) { - $ThisFileInfo['audio']['bitrate_mode'] = 'vbr'; - } - - } else { - - $ThisFileInfo['error'][] = 'Expecting either "Speex " or "vorbis" identifier strings, found neither'; - unset($ThisFileInfo['ogg']); - unset($ThisFileInfo['mime_type']); - return false; - - } - - - // Page 2 - Comment Header - - $oggpageinfo = getid3_ogg::ParseOggPageHeader($fd); - $ThisFileInfo['ogg']['pageheader'][$oggpageinfo['page_seqno']] = $oggpageinfo; - - switch ($ThisFileInfo['audio']['dataformat']) { - - case 'vorbis': - $filedata = fread($fd, $ThisFileInfo['ogg']['pageheader'][$oggpageinfo['page_seqno']]['page_length']); - $ThisFileInfo['ogg']['pageheader'][$oggpageinfo['page_seqno']]['packet_type'] = getid3_lib::LittleEndian2Int(substr($filedata, 0, 1)); - $ThisFileInfo['ogg']['pageheader'][$oggpageinfo['page_seqno']]['stream_type'] = substr($filedata, 1, 6); // hard-coded to 'vorbis' - - getid3_ogg::ParseVorbisCommentsFilepointer($fd, $ThisFileInfo); - break; - - case 'flac': - if (!getid3_flac::FLACparseMETAdata($fd, $ThisFileInfo)) { - $ThisFileInfo['error'][] = 'Failed to parse FLAC headers'; - return false; - } - break; - - case 'speex': - fseek($fd, $ThisFileInfo['ogg']['pageheader'][$oggpageinfo['page_seqno']]['page_length'], SEEK_CUR); - getid3_ogg::ParseVorbisCommentsFilepointer($fd, $ThisFileInfo); - break; - - } - - - - // Last Page - Number of Samples - - if ($ThisFileInfo['avdataend'] >= pow(2, 31)) { - - $ThisFileInfo['warning'][] = 'Unable to parse Ogg end chunk file (PHP does not support file operations beyond 2GB)'; - - } else { - - fseek($fd, max($ThisFileInfo['avdataend'] - GETID3_FREAD_BUFFER_SIZE, 0), SEEK_SET); - $LastChunkOfOgg = strrev(fread($fd, GETID3_FREAD_BUFFER_SIZE)); - if ($LastOggSpostion = strpos($LastChunkOfOgg, 'SggO')) { - fseek($fd, $ThisFileInfo['avdataend'] - ($LastOggSpostion + strlen('SggO')), SEEK_SET); - $ThisFileInfo['avdataend'] = ftell($fd); - $ThisFileInfo['ogg']['pageheader']['eos'] = getid3_ogg::ParseOggPageHeader($fd); - $ThisFileInfo['ogg']['samples'] = $ThisFileInfo['ogg']['pageheader']['eos']['pcm_abs_position']; - if ($ThisFileInfo['ogg']['samples'] == 0) { - $ThisFileInfo['error'][] = 'Corrupt Ogg file: eos.number of samples == zero'; - return false; - } - $ThisFileInfo['ogg']['bitrate_average'] = (($ThisFileInfo['avdataend'] - $ThisFileInfo['avdataoffset']) * 8) / ($ThisFileInfo['ogg']['samples'] / $ThisFileInfo['audio']['sample_rate']); - } - - } - - if (!empty($ThisFileInfo['ogg']['bitrate_average'])) { - $ThisFileInfo['audio']['bitrate'] = $ThisFileInfo['ogg']['bitrate_average']; - } elseif (!empty($ThisFileInfo['ogg']['bitrate_nominal'])) { - $ThisFileInfo['audio']['bitrate'] = $ThisFileInfo['ogg']['bitrate_nominal']; - } elseif (!empty($ThisFileInfo['ogg']['bitrate_min']) && !empty($ThisFileInfo['ogg']['bitrate_max'])) { - $ThisFileInfo['audio']['bitrate'] = ($ThisFileInfo['ogg']['bitrate_min'] + $ThisFileInfo['ogg']['bitrate_max']) / 2; - } - if (isset($ThisFileInfo['audio']['bitrate']) && !isset($ThisFileInfo['playtime_seconds'])) { - if ($ThisFileInfo['audio']['bitrate'] == 0) { - $ThisFileInfo['error'][] = 'Corrupt Ogg file: bitrate_audio == zero'; - return false; - } - $ThisFileInfo['playtime_seconds'] = (float) ((($ThisFileInfo['avdataend'] - $ThisFileInfo['avdataoffset']) * 8) / $ThisFileInfo['audio']['bitrate']); - } - - if (isset($ThisFileInfo['ogg']['vendor'])) { - $ThisFileInfo['audio']['encoder'] = preg_replace('/^Encoded with /', '', $ThisFileInfo['ogg']['vendor']); - - // Vorbis only - if ($ThisFileInfo['audio']['dataformat'] == 'vorbis') { - - // Vorbis 1.0 starts with Xiph.Org - if (preg_match('/^Xiph.Org/', $ThisFileInfo['audio']['encoder'])) { - - if ($ThisFileInfo['audio']['bitrate_mode'] == 'abr') { - - // Set -b 128 on abr files - $ThisFileInfo['audio']['encoder_options'] = '-b '.round($ThisFileInfo['ogg']['bitrate_nominal'] / 1000); - - } elseif (($ThisFileInfo['audio']['bitrate_mode'] == 'vbr') && ($ThisFileInfo['audio']['channels'] == 2) && ($ThisFileInfo['audio']['sample_rate'] >= 44100) && ($ThisFileInfo['audio']['sample_rate'] <= 48000)) { - // Set -q N on vbr files - $ThisFileInfo['audio']['encoder_options'] = '-q '.$this->get_quality_from_nominal_bitrate($ThisFileInfo['ogg']['bitrate_nominal']); - - } - } - - if (empty($ThisFileInfo['audio']['encoder_options']) && !empty($ThisFileInfo['ogg']['bitrate_nominal'])) { - $ThisFileInfo['audio']['encoder_options'] = 'Nominal bitrate: '.intval(round($ThisFileInfo['ogg']['bitrate_nominal'] / 1000)).'kbps'; - } - } - } - - return true; - } - - function ParseVorbisPageHeader(&$filedata, &$filedataoffset, &$ThisFileInfo, &$oggpageinfo) { - $ThisFileInfo['audio']['dataformat'] = 'vorbis'; - $ThisFileInfo['audio']['lossless'] = false; - - $ThisFileInfo['ogg']['pageheader'][$oggpageinfo['page_seqno']]['packet_type'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1)); - $filedataoffset += 1; - $ThisFileInfo['ogg']['pageheader'][$oggpageinfo['page_seqno']]['stream_type'] = substr($filedata, $filedataoffset, 6); // hard-coded to 'vorbis' - $filedataoffset += 6; - $ThisFileInfo['ogg']['bitstreamversion'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); - $filedataoffset += 4; - $ThisFileInfo['ogg']['numberofchannels'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1)); - $filedataoffset += 1; - $ThisFileInfo['audio']['channels'] = $ThisFileInfo['ogg']['numberofchannels']; - $ThisFileInfo['ogg']['samplerate'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); - $filedataoffset += 4; - if ($ThisFileInfo['ogg']['samplerate'] == 0) { - $ThisFileInfo['error'][] = 'Corrupt Ogg file: sample rate == zero'; - return false; - } - $ThisFileInfo['audio']['sample_rate'] = $ThisFileInfo['ogg']['samplerate']; - $ThisFileInfo['ogg']['samples'] = 0; // filled in later - $ThisFileInfo['ogg']['bitrate_average'] = 0; // filled in later - $ThisFileInfo['ogg']['bitrate_max'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); - $filedataoffset += 4; - $ThisFileInfo['ogg']['bitrate_nominal'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); - $filedataoffset += 4; - $ThisFileInfo['ogg']['bitrate_min'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); - $filedataoffset += 4; - $ThisFileInfo['ogg']['blocksize_small'] = pow(2, getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1)) & 0x0F); - $ThisFileInfo['ogg']['blocksize_large'] = pow(2, (getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1)) & 0xF0) >> 4); - $ThisFileInfo['ogg']['stop_bit'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1)); // must be 1, marks end of packet - - $ThisFileInfo['audio']['bitrate_mode'] = 'vbr'; // overridden if actually abr - if ($ThisFileInfo['ogg']['bitrate_max'] == 0xFFFFFFFF) { - unset($ThisFileInfo['ogg']['bitrate_max']); - $ThisFileInfo['audio']['bitrate_mode'] = 'abr'; - } - if ($ThisFileInfo['ogg']['bitrate_nominal'] == 0xFFFFFFFF) { - unset($ThisFileInfo['ogg']['bitrate_nominal']); - } - if ($ThisFileInfo['ogg']['bitrate_min'] == 0xFFFFFFFF) { - unset($ThisFileInfo['ogg']['bitrate_min']); - $ThisFileInfo['audio']['bitrate_mode'] = 'abr'; - } - return true; - } - - function ParseOggPageHeader(&$fd) { - // http://xiph.org/ogg/vorbis/doc/framing.html - $oggheader['page_start_offset'] = ftell($fd); // where we started from in the file - - $filedata = fread($fd, GETID3_FREAD_BUFFER_SIZE); - $filedataoffset = 0; - while ((substr($filedata, $filedataoffset++, 4) != 'OggS')) { - if ((ftell($fd) - $oggheader['page_start_offset']) >= GETID3_FREAD_BUFFER_SIZE) { - // should be found before here - return false; - } - if ((($filedataoffset + 28) > strlen($filedata)) || (strlen($filedata) < 28)) { - if (feof($fd) || (($filedata .= fread($fd, GETID3_FREAD_BUFFER_SIZE)) === false)) { - // get some more data, unless eof, in which case fail - return false; - } - } - } - $filedataoffset += strlen('OggS') - 1; // page, delimited by 'OggS' - - $oggheader['stream_structver'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1)); - $filedataoffset += 1; - $oggheader['flags_raw'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1)); - $filedataoffset += 1; - $oggheader['flags']['fresh'] = (bool) ($oggheader['flags_raw'] & 0x01); // fresh packet - $oggheader['flags']['bos'] = (bool) ($oggheader['flags_raw'] & 0x02); // first page of logical bitstream (bos) - $oggheader['flags']['eos'] = (bool) ($oggheader['flags_raw'] & 0x04); // last page of logical bitstream (eos) - - $oggheader['pcm_abs_position'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 8)); - $filedataoffset += 8; - $oggheader['stream_serialno'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); - $filedataoffset += 4; - $oggheader['page_seqno'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); - $filedataoffset += 4; - $oggheader['page_checksum'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); - $filedataoffset += 4; - $oggheader['page_segments'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1)); - $filedataoffset += 1; - $oggheader['page_length'] = 0; - for ($i = 0; $i < $oggheader['page_segments']; $i++) { - $oggheader['segment_table'][$i] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1)); - $filedataoffset += 1; - $oggheader['page_length'] += $oggheader['segment_table'][$i]; - } - $oggheader['header_end_offset'] = $oggheader['page_start_offset'] + $filedataoffset; - $oggheader['page_end_offset'] = $oggheader['header_end_offset'] + $oggheader['page_length']; - fseek($fd, $oggheader['header_end_offset'], SEEK_SET); - - return $oggheader; - } - - - function ParseVorbisCommentsFilepointer(&$fd, &$ThisFileInfo) { - - $OriginalOffset = ftell($fd); - $CommentStartOffset = $OriginalOffset; - $commentdataoffset = 0; - $VorbisCommentPage = 1; - - switch ($ThisFileInfo['audio']['dataformat']) { - case 'vorbis': - $CommentStartOffset = $ThisFileInfo['ogg']['pageheader'][$VorbisCommentPage]['page_start_offset']; // Second Ogg page, after header block - fseek($fd, $CommentStartOffset, SEEK_SET); - $commentdataoffset = 27 + $ThisFileInfo['ogg']['pageheader'][$VorbisCommentPage]['page_segments']; - $commentdata = fread($fd, getid3_ogg::OggPageSegmentLength($ThisFileInfo['ogg']['pageheader'][$VorbisCommentPage], 1) + $commentdataoffset); - - $commentdataoffset += (strlen('vorbis') + 1); - break; - - case 'flac': - fseek($fd, $ThisFileInfo['flac']['VORBIS_COMMENT']['raw']['offset'] + 4, SEEK_SET); - $commentdata = fread($fd, $ThisFileInfo['flac']['VORBIS_COMMENT']['raw']['block_length']); - break; - - case 'speex': - $CommentStartOffset = $ThisFileInfo['ogg']['pageheader'][$VorbisCommentPage]['page_start_offset']; // Second Ogg page, after header block - fseek($fd, $CommentStartOffset, SEEK_SET); - $commentdataoffset = 27 + $ThisFileInfo['ogg']['pageheader'][$VorbisCommentPage]['page_segments']; - $commentdata = fread($fd, getid3_ogg::OggPageSegmentLength($ThisFileInfo['ogg']['pageheader'][$VorbisCommentPage], 1) + $commentdataoffset); - break; - - default: - return false; - break; - } - - $VendorSize = getid3_lib::LittleEndian2Int(substr($commentdata, $commentdataoffset, 4)); - $commentdataoffset += 4; - - $ThisFileInfo['ogg']['vendor'] = substr($commentdata, $commentdataoffset, $VendorSize); - $commentdataoffset += $VendorSize; - - $CommentsCount = getid3_lib::LittleEndian2Int(substr($commentdata, $commentdataoffset, 4)); - $commentdataoffset += 4; - $ThisFileInfo['avdataoffset'] = $CommentStartOffset + $commentdataoffset; - - $basicfields = array('TITLE', 'ARTIST', 'ALBUM', 'TRACKNUMBER', 'GENRE', 'DATE', 'DESCRIPTION', 'COMMENT'); - for ($i = 0; $i < $CommentsCount; $i++) { - - $ThisFileInfo['ogg']['comments_raw'][$i]['dataoffset'] = $CommentStartOffset + $commentdataoffset; - - if (ftell($fd) < ($ThisFileInfo['ogg']['comments_raw'][$i]['dataoffset'] + 4)) { - $VorbisCommentPage++; - - $oggpageinfo = getid3_ogg::ParseOggPageHeader($fd); - $ThisFileInfo['ogg']['pageheader'][$oggpageinfo['page_seqno']] = $oggpageinfo; - - // First, save what we haven't read yet - $AsYetUnusedData = substr($commentdata, $commentdataoffset); - - // Then take that data off the end - $commentdata = substr($commentdata, 0, $commentdataoffset); - - // Add [headerlength] bytes of dummy data for the Ogg Page Header, just to keep absolute offsets correct - $commentdata .= str_repeat("\x00", 27 + $ThisFileInfo['ogg']['pageheader'][$oggpageinfo['page_seqno']]['page_segments']); - $commentdataoffset += (27 + $ThisFileInfo['ogg']['pageheader'][$oggpageinfo['page_seqno']]['page_segments']); - - // Finally, stick the unused data back on the end - $commentdata .= $AsYetUnusedData; - - //$commentdata .= fread($fd, $ThisFileInfo['ogg']['pageheader'][$oggpageinfo['page_seqno']]['page_length']); - $commentdata .= fread($fd, getid3_ogg::OggPageSegmentLength($ThisFileInfo['ogg']['pageheader'][$VorbisCommentPage], 1)); - - } - $ThisFileInfo['ogg']['comments_raw'][$i]['size'] = getid3_lib::LittleEndian2Int(substr($commentdata, $commentdataoffset, 4)); - - // replace avdataoffset with position just after the last vorbiscomment - $ThisFileInfo['avdataoffset'] = $ThisFileInfo['ogg']['comments_raw'][$i]['dataoffset'] + $ThisFileInfo['ogg']['comments_raw'][$i]['size'] + 4; - - $commentdataoffset += 4; - while ((strlen($commentdata) - $commentdataoffset) < $ThisFileInfo['ogg']['comments_raw'][$i]['size']) { - if (($ThisFileInfo['ogg']['comments_raw'][$i]['size'] > $ThisFileInfo['avdataend']) || ($ThisFileInfo['ogg']['comments_raw'][$i]['size'] < 0)) { - $ThisFileInfo['error'][] = 'Invalid Ogg comment size (comment #'.$i.', claims to be '.number_format($ThisFileInfo['ogg']['comments_raw'][$i]['size']).' bytes) - aborting reading comments'; - break 2; - } - - $VorbisCommentPage++; - - $oggpageinfo = getid3_ogg::ParseOggPageHeader($fd); - $ThisFileInfo['ogg']['pageheader'][$oggpageinfo['page_seqno']] = $oggpageinfo; - - // First, save what we haven't read yet - $AsYetUnusedData = substr($commentdata, $commentdataoffset); - - // Then take that data off the end - $commentdata = substr($commentdata, 0, $commentdataoffset); - - // Add [headerlength] bytes of dummy data for the Ogg Page Header, just to keep absolute offsets correct - $commentdata .= str_repeat("\x00", 27 + $ThisFileInfo['ogg']['pageheader'][$oggpageinfo['page_seqno']]['page_segments']); - $commentdataoffset += (27 + $ThisFileInfo['ogg']['pageheader'][$oggpageinfo['page_seqno']]['page_segments']); - - // Finally, stick the unused data back on the end - $commentdata .= $AsYetUnusedData; - - //$commentdata .= fread($fd, $ThisFileInfo['ogg']['pageheader'][$oggpageinfo['page_seqno']]['page_length']); - $commentdata .= fread($fd, getid3_ogg::OggPageSegmentLength($ThisFileInfo['ogg']['pageheader'][$VorbisCommentPage], 1)); - - //$filebaseoffset += $oggpageinfo['header_end_offset'] - $oggpageinfo['page_start_offset']; - } - $commentstring = substr($commentdata, $commentdataoffset, $ThisFileInfo['ogg']['comments_raw'][$i]['size']); - $commentdataoffset += $ThisFileInfo['ogg']['comments_raw'][$i]['size']; - - if (!$commentstring) { - - // no comment? - $ThisFileInfo['warning'][] = 'Blank Ogg comment ['.$i.']'; - - } elseif (strstr($commentstring, '=')) { - - $commentexploded = explode('=', $commentstring, 2); - $ThisFileInfo['ogg']['comments_raw'][$i]['key'] = strtoupper($commentexploded[0]); - $ThisFileInfo['ogg']['comments_raw'][$i]['value'] = @$commentexploded[1]; - $ThisFileInfo['ogg']['comments_raw'][$i]['data'] = base64_decode($ThisFileInfo['ogg']['comments_raw'][$i]['value']); - - $ThisFileInfo['ogg']['comments'][strtolower($ThisFileInfo['ogg']['comments_raw'][$i]['key'])][] = $ThisFileInfo['ogg']['comments_raw'][$i]['value']; - - $imageinfo = array(); - $imagechunkcheck = getid3_lib::GetDataImageSize($ThisFileInfo['ogg']['comments_raw'][$i]['data'], $imageinfo); - $ThisFileInfo['ogg']['comments_raw'][$i]['image_mime'] = getid3_lib::image_type_to_mime_type($imagechunkcheck[2]); - if (!$ThisFileInfo['ogg']['comments_raw'][$i]['image_mime'] || ($ThisFileInfo['ogg']['comments_raw'][$i]['image_mime'] == 'application/octet-stream')) { - unset($ThisFileInfo['ogg']['comments_raw'][$i]['image_mime']); - unset($ThisFileInfo['ogg']['comments_raw'][$i]['data']); - } - - } else { - - $ThisFileInfo['warning'][] = '[known problem with CDex >= v1.40, < v1.50b7] Invalid Ogg comment name/value pair ['.$i.']: '.$commentstring; - - } - } - - - // Replay Gain Adjustment - // http://privatewww.essex.ac.uk/~djmrob/replaygain/ - if (isset($ThisFileInfo['ogg']['comments']) && is_array($ThisFileInfo['ogg']['comments'])) { - foreach ($ThisFileInfo['ogg']['comments'] as $index => $commentvalue) { - switch ($index) { - case 'rg_audiophile': - case 'replaygain_album_gain': - $ThisFileInfo['replay_gain']['album']['adjustment'] = (double) $commentvalue[0]; - unset($ThisFileInfo['ogg']['comments'][$index]); - break; - - case 'rg_radio': - case 'replaygain_track_gain': - $ThisFileInfo['replay_gain']['track']['adjustment'] = (double) $commentvalue[0]; - unset($ThisFileInfo['ogg']['comments'][$index]); - break; - - case 'replaygain_album_peak': - $ThisFileInfo['replay_gain']['album']['peak'] = (double) $commentvalue[0]; - unset($ThisFileInfo['ogg']['comments'][$index]); - break; - - case 'rg_peak': - case 'replaygain_track_peak': - $ThisFileInfo['replay_gain']['track']['peak'] = (double) $commentvalue[0]; - unset($ThisFileInfo['ogg']['comments'][$index]); - break; - - - default: - // do nothing - break; - } - } - } - - fseek($fd, $OriginalOffset, SEEK_SET); - - return true; - } - - function SpeexBandModeLookup($mode) { - static $SpeexBandModeLookup = array(); - if (empty($SpeexBandModeLookup)) { - $SpeexBandModeLookup[0] = 'narrow'; - $SpeexBandModeLookup[1] = 'wide'; - $SpeexBandModeLookup[2] = 'ultra-wide'; - } - return (isset($SpeexBandModeLookup[$mode]) ? $SpeexBandModeLookup[$mode] : null); - } - - - function OggPageSegmentLength($OggInfoArray, $SegmentNumber=1) { - for ($i = 0; $i < $SegmentNumber; $i++) { - $segmentlength = 0; - foreach ($OggInfoArray['segment_table'] as $key => $value) { - $segmentlength += $value; - if ($value < 255) { - break; - } - } - } - return $segmentlength; - } - - - function get_quality_from_nominal_bitrate($nominal_bitrate) { - - // decrease precision - $nominal_bitrate = $nominal_bitrate / 1000; - - if ($nominal_bitrate < 128) { - // q-1 to q4 - $qval = ($nominal_bitrate - 64) / 16; - } elseif ($nominal_bitrate < 256) { - // q4 to q8 - $qval = $nominal_bitrate / 32; - } elseif ($nominal_bitrate < 320) { - // q8 to q9 - $qval = ($nominal_bitrate + 256) / 64; - } else { - // q9 to q10 - $qval = ($nominal_bitrate + 1300) / 180; - } - //return $qval; // 5.031324 - //return intval($qval); // 5 - return round($qval, 1); // 5 or 4.9 - } - -} - -?>
\ No newline at end of file diff --git a/getid3/module.audio.optimfrog.php b/getid3/module.audio.optimfrog.php deleted file mode 100644 index 3c2dfb0..0000000 --- a/getid3/module.audio.optimfrog.php +++ /dev/null @@ -1,408 +0,0 @@ -<?php -///////////////////////////////////////////////////////////////// -/// getID3() by James Heinrich <info@getid3.org> // -// available at http://getid3.sourceforge.net // -// or http://www.getid3.org // -///////////////////////////////////////////////////////////////// -// See readme.txt for more details // -///////////////////////////////////////////////////////////////// -// // -// module.audio.optimfrog.php // -// module for analyzing OptimFROG audio files // -// dependencies: module.audio.riff.php // -// /// -///////////////////////////////////////////////////////////////// - -getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio-video.riff.php', __FILE__, true); - -class getid3_optimfrog -{ - - function getid3_optimfrog(&$fd, &$ThisFileInfo) { - $ThisFileInfo['fileformat'] = 'ofr'; - $ThisFileInfo['audio']['dataformat'] = 'ofr'; - $ThisFileInfo['audio']['bitrate_mode'] = 'vbr'; - $ThisFileInfo['audio']['lossless'] = true; - - fseek($fd, $ThisFileInfo['avdataoffset'], SEEK_SET); - $OFRheader = fread($fd, 8); - if (substr($OFRheader, 0, 5) == '*RIFF') { - - return $this->ParseOptimFROGheader42($fd, $ThisFileInfo); - - } elseif (substr($OFRheader, 0, 3) == 'OFR') { - - return $this->ParseOptimFROGheader45($fd, $ThisFileInfo); - - } - - $ThisFileInfo['error'][] = 'Expecting "*RIFF" or "OFR " at offset '.$ThisFileInfo['avdataoffset'].', found "'.$OFRheader.'"'; - unset($ThisFileInfo['fileformat']); - return false; - } - - - function ParseOptimFROGheader42(&$fd, &$ThisFileInfo) { - // for fileformat of v4.21 and older - - fseek($fd, $ThisFileInfo['avdataoffset'], SEEK_SET); - $OptimFROGheaderData = fread($fd, 45); - $ThisFileInfo['avdataoffset'] = 45; - - $OptimFROGencoderVersion_raw = getid3_lib::LittleEndian2Int(substr($OptimFROGheaderData, 0, 1)); - $OptimFROGencoderVersion_major = floor($OptimFROGencoderVersion_raw / 10); - $OptimFROGencoderVersion_minor = $OptimFROGencoderVersion_raw - ($OptimFROGencoderVersion_major * 10); - $RIFFdata = substr($OptimFROGheaderData, 1, 44); - $OrignalRIFFheaderSize = getid3_lib::LittleEndian2Int(substr($RIFFdata, 4, 4)) + 8; - $OrignalRIFFdataSize = getid3_lib::LittleEndian2Int(substr($RIFFdata, 40, 4)) + 44; - - if ($OrignalRIFFheaderSize > $OrignalRIFFdataSize) { - $ThisFileInfo['avdataend'] -= ($OrignalRIFFheaderSize - $OrignalRIFFdataSize); - fseek($fd, $ThisFileInfo['avdataend'], SEEK_SET); - $RIFFdata .= fread($fd, $OrignalRIFFheaderSize - $OrignalRIFFdataSize); - } - - // move the data chunk after all other chunks (if any) - // so that the RIFF parser doesn't see EOF when trying - // to skip over the data chunk - $RIFFdata = substr($RIFFdata, 0, 36).substr($RIFFdata, 44).substr($RIFFdata, 36, 8); - getid3_riff::ParseRIFFdata($RIFFdata, $ThisFileInfo); - - $ThisFileInfo['audio']['encoder'] = 'OptimFROG '.$OptimFROGencoderVersion_major.'.'.$OptimFROGencoderVersion_minor; - $ThisFileInfo['audio']['channels'] = $ThisFileInfo['riff']['audio'][0]['channels']; - $ThisFileInfo['audio']['sample_rate'] = $ThisFileInfo['riff']['audio'][0]['sample_rate']; - $ThisFileInfo['audio']['bits_per_sample'] = $ThisFileInfo['riff']['audio'][0]['bits_per_sample']; - $ThisFileInfo['playtime_seconds'] = $OrignalRIFFdataSize / ($ThisFileInfo['audio']['channels'] * $ThisFileInfo['audio']['sample_rate'] * ($ThisFileInfo['audio']['bits_per_sample'] / 8)); - $ThisFileInfo['audio']['bitrate'] = (($ThisFileInfo['avdataend'] - $ThisFileInfo['avdataoffset']) * 8) / $ThisFileInfo['playtime_seconds']; - - return true; - } - - - function ParseOptimFROGheader45(&$fd, &$ThisFileInfo) { - // for fileformat of v4.50a and higher - - $RIFFdata = ''; - fseek($fd, $ThisFileInfo['avdataoffset'], SEEK_SET); - while (!feof($fd) && (ftell($fd) < $ThisFileInfo['avdataend'])) { - $BlockOffset = ftell($fd); - $BlockData = fread($fd, 8); - $offset = 8; - $BlockName = substr($BlockData, 0, 4); - $BlockSize = getid3_lib::LittleEndian2Int(substr($BlockData, 4, 4)); - - if ($BlockName == 'OFRX') { - $BlockName = 'OFR '; - } - if (!isset($ThisFileInfo['ofr'][$BlockName])) { - $ThisFileInfo['ofr'][$BlockName] = array(); - } - $thisfile_ofr_thisblock = &$ThisFileInfo['ofr'][$BlockName]; - - switch ($BlockName) { - case 'OFR ': - - // shortcut - $thisfile_ofr_thisblock['offset'] = $BlockOffset; - $thisfile_ofr_thisblock['size'] = $BlockSize; - - $ThisFileInfo['audio']['encoder'] = 'OptimFROG 4.50 alpha'; - switch ($BlockSize) { - case 12: - case 15: - // good - break; - - default: - $ThisFileInfo['warning'][] = '"'.$BlockName.'" contains more data than expected (expected 12 or 15 bytes, found '.$BlockSize.' bytes)'; - break; - } - $BlockData .= fread($fd, $BlockSize); - - $thisfile_ofr_thisblock['total_samples'] = getid3_lib::LittleEndian2Int(substr($BlockData, $offset, 6)); - $offset += 6; - $thisfile_ofr_thisblock['raw']['sample_type'] = getid3_lib::LittleEndian2Int(substr($BlockData, $offset, 1)); - $thisfile_ofr_thisblock['sample_type'] = $this->OptimFROGsampleTypeLookup($thisfile_ofr_thisblock['raw']['sample_type']); - $offset += 1; - $thisfile_ofr_thisblock['channel_config'] = getid3_lib::LittleEndian2Int(substr($BlockData, $offset, 1)); - $thisfile_ofr_thisblock['channels'] = $thisfile_ofr_thisblock['channel_config']; - $offset += 1; - $thisfile_ofr_thisblock['sample_rate'] = getid3_lib::LittleEndian2Int(substr($BlockData, $offset, 4)); - $offset += 4; - - if ($BlockSize > 12) { - - // OFR 4.504b or higher - $thisfile_ofr_thisblock['channels'] = $this->OptimFROGchannelConfigNumChannelsLookup($thisfile_ofr_thisblock['channel_config']); - $thisfile_ofr_thisblock['raw']['encoder_id'] = getid3_lib::LittleEndian2Int(substr($BlockData, $offset, 2)); - $thisfile_ofr_thisblock['encoder'] = $this->OptimFROGencoderNameLookup($thisfile_ofr_thisblock['raw']['encoder_id']); - $offset += 2; - $thisfile_ofr_thisblock['raw']['compression'] = getid3_lib::LittleEndian2Int(substr($BlockData, $offset, 1)); - $thisfile_ofr_thisblock['compression'] = $this->OptimFROGcompressionLookup($thisfile_ofr_thisblock['raw']['compression']); - $thisfile_ofr_thisblock['speedup'] = $this->OptimFROGspeedupLookup($thisfile_ofr_thisblock['raw']['compression']); - $offset += 1; - - $ThisFileInfo['audio']['encoder'] = 'OptimFROG '.$thisfile_ofr_thisblock['encoder']; - $ThisFileInfo['audio']['encoder_options'] = '--mode '.$thisfile_ofr_thisblock['compression']; - - if ((($thisfile_ofr_thisblock['raw']['encoder_id'] & 0xF0) >> 4) == 7) { // v4.507 - if (strtolower(getid3_lib::fileextension($ThisFileInfo['filename'])) == 'ofs') { - // OptimFROG DualStream format is lossy, but as of v4.507 there is no way to tell the difference - // between lossless and lossy other than the file extension. - $ThisFileInfo['audio']['dataformat'] = 'ofs'; - $ThisFileInfo['audio']['lossless'] = true; - } - } - - } - - $ThisFileInfo['audio']['channels'] = $thisfile_ofr_thisblock['channels']; - $ThisFileInfo['audio']['sample_rate'] = $thisfile_ofr_thisblock['sample_rate']; - $ThisFileInfo['audio']['bits_per_sample'] = $this->OptimFROGbitsPerSampleTypeLookup($thisfile_ofr_thisblock['raw']['sample_type']); - break; - - - case 'COMP': - // unlike other block types, there CAN be multiple COMP blocks - - $COMPdata['offset'] = $BlockOffset; - $COMPdata['size'] = $BlockSize; - - if ($ThisFileInfo['avdataoffset'] == 0) { - $ThisFileInfo['avdataoffset'] = $BlockOffset; - } - - // Only interested in first 14 bytes (only first 12 needed for v4.50 alpha), not actual audio data - $BlockData .= fread($fd, 14); - fseek($fd, $BlockSize - 14, SEEK_CUR); - - $COMPdata['crc_32'] = getid3_lib::LittleEndian2Int(substr($BlockData, $offset, 4)); - $offset += 4; - $COMPdata['sample_count'] = getid3_lib::LittleEndian2Int(substr($BlockData, $offset, 4)); - $offset += 4; - $COMPdata['raw']['sample_type'] = getid3_lib::LittleEndian2Int(substr($BlockData, $offset, 1)); - $COMPdata['sample_type'] = $this->OptimFROGsampleTypeLookup($COMPdata['raw']['sample_type']); - $offset += 1; - $COMPdata['raw']['channel_configuration'] = getid3_lib::LittleEndian2Int(substr($BlockData, $offset, 1)); - $COMPdata['channel_configuration'] = $this->OptimFROGchannelConfigurationLookup($COMPdata['raw']['channel_configuration']); - $offset += 1; - $COMPdata['raw']['algorithm_id'] = getid3_lib::LittleEndian2Int(substr($BlockData, $offset, 2)); - //$COMPdata['algorithm'] = OptimFROGalgorithmNameLookup($COMPdata['raw']['algorithm_id']); - $offset += 2; - - if ($ThisFileInfo['ofr']['OFR ']['size'] > 12) { - - // OFR 4.504b or higher - $COMPdata['raw']['encoder_id'] = getid3_lib::LittleEndian2Int(substr($BlockData, $offset, 2)); - $COMPdata['encoder'] = $this->OptimFROGencoderNameLookup($COMPdata['raw']['encoder_id']); - $offset += 2; - - } - - if ($COMPdata['crc_32'] == 0x454E4F4E) { - // ASCII value of 'NONE' - placeholder value in v4.50a - $COMPdata['crc_32'] = false; - } - - $thisfile_ofr_thisblock[] = $COMPdata; - break; - - case 'HEAD': - $thisfile_ofr_thisblock['offset'] = $BlockOffset; - $thisfile_ofr_thisblock['size'] = $BlockSize; - - $RIFFdata .= fread($fd, $BlockSize); - break; - - case 'TAIL': - $thisfile_ofr_thisblock['offset'] = $BlockOffset; - $thisfile_ofr_thisblock['size'] = $BlockSize; - - if ($BlockSize > 0) { - $RIFFdata .= fread($fd, $BlockSize); - } - break; - - case 'RECV': - // block contains no useful meta data - simply note and skip - - $thisfile_ofr_thisblock['offset'] = $BlockOffset; - $thisfile_ofr_thisblock['size'] = $BlockSize; - - fseek($fd, $BlockSize, SEEK_CUR); - break; - - - case 'APET': - // APEtag v2 - - $thisfile_ofr_thisblock['offset'] = $BlockOffset; - $thisfile_ofr_thisblock['size'] = $BlockSize; - $ThisFileInfo['warning'][] = 'APEtag processing inside OptimFROG not supported in this version ('.GETID3_VERSION.') of getID3()'; - - fseek($fd, $BlockSize, SEEK_CUR); - break; - - - case 'MD5 ': - // APEtag v2 - - $thisfile_ofr_thisblock['offset'] = $BlockOffset; - $thisfile_ofr_thisblock['size'] = $BlockSize; - - if ($BlockSize == 16) { - - $thisfile_ofr_thisblock['md5_binary'] = fread($fd, $BlockSize); - $thisfile_ofr_thisblock['md5_string'] = getid3_lib::PrintHexBytes($thisfile_ofr_thisblock['md5_binary'], true, false, false); - $ThisFileInfo['md5_data_source'] = $thisfile_ofr_thisblock['md5_string']; - - } else { - - $ThisFileInfo['warning'][] = 'Expecting block size of 16 in "MD5 " chunk, found '.$BlockSize.' instead'; - fseek($fd, $BlockSize, SEEK_CUR); - - } - break; - - - default: - $thisfile_ofr_thisblock['offset'] = $BlockOffset; - $thisfile_ofr_thisblock['size'] = $BlockSize; - - $ThisFileInfo['warning'][] = 'Unhandled OptimFROG block type "'.$BlockName.'" at offset '.$thisfile_ofr_thisblock['offset']; - fseek($fd, $BlockSize, SEEK_CUR); - break; - } - } - if (isset($ThisFileInfo['ofr']['TAIL']['offset'])) { - $ThisFileInfo['avdataend'] = $ThisFileInfo['ofr']['TAIL']['offset']; - } - - $ThisFileInfo['playtime_seconds'] = (float) $ThisFileInfo['ofr']['OFR ']['total_samples'] / ($ThisFileInfo['audio']['channels'] * $ThisFileInfo['audio']['sample_rate']); - $ThisFileInfo['audio']['bitrate'] = (($ThisFileInfo['avdataend'] - $ThisFileInfo['avdataoffset']) * 8) / $ThisFileInfo['playtime_seconds']; - - // move the data chunk after all other chunks (if any) - // so that the RIFF parser doesn't see EOF when trying - // to skip over the data chunk - $RIFFdata = substr($RIFFdata, 0, 36).substr($RIFFdata, 44).substr($RIFFdata, 36, 8); - getid3_riff::ParseRIFFdata($RIFFdata, $ThisFileInfo); - - return true; - } - - - function OptimFROGsampleTypeLookup($SampleType) { - static $OptimFROGsampleTypeLookup = array( - 0 => 'unsigned int (8-bit)', - 1 => 'signed int (8-bit)', - 2 => 'unsigned int (16-bit)', - 3 => 'signed int (16-bit)', - 4 => 'unsigned int (24-bit)', - 5 => 'signed int (24-bit)', - 6 => 'unsigned int (32-bit)', - 7 => 'signed int (32-bit)', - 8 => 'float 0.24 (32-bit)', - 9 => 'float 16.8 (32-bit)', - 10 => 'float 24.0 (32-bit)' - ); - return (isset($OptimFROGsampleTypeLookup[$SampleType]) ? $OptimFROGsampleTypeLookup[$SampleType] : false); - } - - function OptimFROGbitsPerSampleTypeLookup($SampleType) { - static $OptimFROGbitsPerSampleTypeLookup = array( - 0 => 8, - 1 => 8, - 2 => 16, - 3 => 16, - 4 => 24, - 5 => 24, - 6 => 32, - 7 => 32, - 8 => 32, - 9 => 32, - 10 => 32 - ); - return (isset($OptimFROGbitsPerSampleTypeLookup[$SampleType]) ? $OptimFROGbitsPerSampleTypeLookup[$SampleType] : false); - } - - function OptimFROGchannelConfigurationLookup($ChannelConfiguration) { - static $OptimFROGchannelConfigurationLookup = array( - 0 => 'mono', - 1 => 'stereo' - ); - return (isset($OptimFROGchannelConfigurationLookup[$ChannelConfiguration]) ? $OptimFROGchannelConfigurationLookup[$ChannelConfiguration] : false); - } - - function OptimFROGchannelConfigNumChannelsLookup($ChannelConfiguration) { - static $OptimFROGchannelConfigNumChannelsLookup = array( - 0 => 1, - 1 => 2 - ); - return (isset($OptimFROGchannelConfigNumChannelsLookup[$ChannelConfiguration]) ? $OptimFROGchannelConfigNumChannelsLookup[$ChannelConfiguration] : false); - } - - - - // function OptimFROGalgorithmNameLookup($AlgorithID) { - // static $OptimFROGalgorithmNameLookup = array(); - // return (isset($OptimFROGalgorithmNameLookup[$AlgorithID]) ? $OptimFROGalgorithmNameLookup[$AlgorithID] : false); - // } - - - function OptimFROGencoderNameLookup($EncoderID) { - // version = (encoderID >> 4) + 4500 - // system = encoderID & 0xF - - $EncoderVersion = number_format(((($EncoderID & 0xF0) >> 4) + 4500) / 1000, 3); - $EncoderSystemID = ($EncoderID & 0x0F); - - static $OptimFROGencoderSystemLookup = array( - 0x00 => 'Windows console', - 0x01 => 'Linux console', - 0x0F => 'unknown' - ); - return $EncoderVersion.' ('.(isset($OptimFROGencoderSystemLookup[$EncoderSystemID]) ? $OptimFROGencoderSystemLookup[$EncoderSystemID] : 'undefined encoder type (0x'.dechex($EncoderSystemID).')').')'; - } - - function OptimFROGcompressionLookup($CompressionID) { - // mode = compression >> 3 - // speedup = compression & 0x07 - - $CompressionModeID = ($CompressionID & 0xF8) >> 3; - //$CompressionSpeedupID = ($CompressionID & 0x07); - - static $OptimFROGencoderModeLookup = array( - 0x00 => 'fast', - 0x01 => 'normal', - 0x02 => 'high', - 0x03 => 'extra', // extranew (some versions) - 0x04 => 'best', // bestnew (some versions) - 0x05 => 'ultra', - 0x06 => 'insane', - 0x07 => 'highnew', - 0x08 => 'extranew', - 0x09 => 'bestnew' - ); - return (isset($OptimFROGencoderModeLookup[$CompressionModeID]) ? $OptimFROGencoderModeLookup[$CompressionModeID] : 'undefined mode (0x'.str_pad(dechex($CompressionModeID), 2, '0', STR_PAD_LEFT).')'); - } - - function OptimFROGspeedupLookup($CompressionID) { - // mode = compression >> 3 - // speedup = compression & 0x07 - - //$CompressionModeID = ($CompressionID & 0xF8) >> 3; - $CompressionSpeedupID = ($CompressionID & 0x07); - - static $OptimFROGencoderSpeedupLookup = array( - 0x00 => '1x', - 0x01 => '2x', - 0x02 => '4x' - ); - - return (isset($OptimFROGencoderSpeedupLookup[$CompressionSpeedupID]) ? $OptimFROGencoderSpeedupLookup[$CompressionSpeedupID] : 'undefined mode (0x'.dechex($CompressionSpeedupID)); - } - -} - - -?>
\ No newline at end of file diff --git a/getid3/module.audio.rkau.php b/getid3/module.audio.rkau.php deleted file mode 100644 index 0e344d4..0000000 --- a/getid3/module.audio.rkau.php +++ /dev/null @@ -1,92 +0,0 @@ -<?php -///////////////////////////////////////////////////////////////// -/// getID3() by James Heinrich <info@getid3.org> // -// available at http://getid3.sourceforge.net // -// or http://www.getid3.org // -///////////////////////////////////////////////////////////////// -// See readme.txt for more details // -///////////////////////////////////////////////////////////////// -// // -// module.audio.shorten.php // -// module for analyzing Shorten Audio files // -// dependencies: NONE // -// /// -///////////////////////////////////////////////////////////////// - - -class getid3_rkau -{ - - function getid3_rkau(&$fd, &$ThisFileInfo) { - - fseek($fd, $ThisFileInfo['avdataoffset'], SEEK_SET); - $RKAUHeader = fread($fd, 20); - if (substr($RKAUHeader, 0, 3) != 'RKA') { - $ThisFileInfo['error'][] = 'Expecting "RKA" at offset '.$ThisFileInfo['avdataoffset'].', found "'.substr($RKAUHeader, 0, 3).'"'; - return false; - } - - $ThisFileInfo['fileformat'] = 'rkau'; - $ThisFileInfo['audio']['dataformat'] = 'rkau'; - $ThisFileInfo['audio']['bitrate_mode'] = 'vbr'; - - $ThisFileInfo['rkau']['raw']['version'] = getid3_lib::LittleEndian2Int(substr($RKAUHeader, 3, 1)); - $ThisFileInfo['rkau']['version'] = '1.'.str_pad($ThisFileInfo['rkau']['raw']['version'] & 0x0F, 2, '0', STR_PAD_LEFT); - if (($ThisFileInfo['rkau']['version'] > 1.07) || ($ThisFileInfo['rkau']['version'] < 1.06)) { - $ThisFileInfo['error'][] = 'This version of getID3() can only parse RKAU files v1.06 and 1.07 (this file is v'.$ThisFileInfo['rkau']['version'].')'; - unset($ThisFileInfo['rkau']); - return false; - } - - $ThisFileInfo['rkau']['source_bytes'] = getid3_lib::LittleEndian2Int(substr($RKAUHeader, 4, 4)); - $ThisFileInfo['rkau']['sample_rate'] = getid3_lib::LittleEndian2Int(substr($RKAUHeader, 8, 4)); - $ThisFileInfo['rkau']['channels'] = getid3_lib::LittleEndian2Int(substr($RKAUHeader, 12, 1)); - $ThisFileInfo['rkau']['bits_per_sample'] = getid3_lib::LittleEndian2Int(substr($RKAUHeader, 13, 1)); - - $ThisFileInfo['rkau']['raw']['quality'] = getid3_lib::LittleEndian2Int(substr($RKAUHeader, 14, 1)); - $this->RKAUqualityLookup($ThisFileInfo['rkau']); - - $ThisFileInfo['rkau']['raw']['flags'] = getid3_lib::LittleEndian2Int(substr($RKAUHeader, 15, 1)); - $ThisFileInfo['rkau']['flags']['joint_stereo'] = (bool) (!($ThisFileInfo['rkau']['raw']['flags'] & 0x01)); - $ThisFileInfo['rkau']['flags']['streaming'] = (bool) ($ThisFileInfo['rkau']['raw']['flags'] & 0x02); - $ThisFileInfo['rkau']['flags']['vrq_lossy_mode'] = (bool) ($ThisFileInfo['rkau']['raw']['flags'] & 0x04); - - if ($ThisFileInfo['rkau']['flags']['streaming']) { - $ThisFileInfo['avdataoffset'] += 20; - $ThisFileInfo['rkau']['compressed_bytes'] = getid3_lib::LittleEndian2Int(substr($RKAUHeader, 16, 4)); - } else { - $ThisFileInfo['avdataoffset'] += 16; - $ThisFileInfo['rkau']['compressed_bytes'] = $ThisFileInfo['avdataend'] - $ThisFileInfo['avdataoffset'] - 1; - } - // Note: compressed_bytes does not always equal what appears to be the actual number of compressed bytes, - // sometimes it's more, sometimes less. No idea why(?) - - $ThisFileInfo['audio']['lossless'] = $ThisFileInfo['rkau']['lossless']; - $ThisFileInfo['audio']['channels'] = $ThisFileInfo['rkau']['channels']; - $ThisFileInfo['audio']['bits_per_sample'] = $ThisFileInfo['rkau']['bits_per_sample']; - $ThisFileInfo['audio']['sample_rate'] = $ThisFileInfo['rkau']['sample_rate']; - - $ThisFileInfo['playtime_seconds'] = $ThisFileInfo['rkau']['source_bytes'] / ($ThisFileInfo['rkau']['sample_rate'] * $ThisFileInfo['rkau']['channels'] * ($ThisFileInfo['rkau']['bits_per_sample'] / 8)); - $ThisFileInfo['audio']['bitrate'] = ($ThisFileInfo['rkau']['compressed_bytes'] * 8) / $ThisFileInfo['playtime_seconds']; - - return true; - - } - - - function RKAUqualityLookup(&$RKAUdata) { - $level = ($RKAUdata['raw']['quality'] & 0xF0) >> 4; - $quality = $RKAUdata['raw']['quality'] & 0x0F; - - $RKAUdata['lossless'] = (($quality == 0) ? true : false); - $RKAUdata['compression_level'] = $level + 1; - if (!$RKAUdata['lossless']) { - $RKAUdata['quality_setting'] = $quality; - } - - return true; - } - -} - -?>
\ No newline at end of file diff --git a/getid3/module.audio.shorten.php b/getid3/module.audio.shorten.php deleted file mode 100644 index a9eb1ab..0000000 --- a/getid3/module.audio.shorten.php +++ /dev/null @@ -1,180 +0,0 @@ -<?php -///////////////////////////////////////////////////////////////// -/// getID3() by James Heinrich <info@getid3.org> // -// available at http://getid3.sourceforge.net // -// or http://www.getid3.org // -///////////////////////////////////////////////////////////////// -// See readme.txt for more details // -///////////////////////////////////////////////////////////////// -// // -// module.audio.shorten.php // -// module for analyzing Shorten Audio files // -// dependencies: NONE // -// /// -///////////////////////////////////////////////////////////////// - - -class getid3_shorten -{ - - function getid3_shorten(&$fd, &$ThisFileInfo) { - - fseek($fd, $ThisFileInfo['avdataoffset'], SEEK_SET); - - $ShortenHeader = fread($fd, 8); - if (substr($ShortenHeader, 0, 4) != 'ajkg') { - $ThisFileInfo['error'][] = 'Expecting "ajkg" at offset '.$ThisFileInfo['avdataoffset'].', found "'.substr($ShortenHeader, 0, 4).'"'; - return false; - } - $ThisFileInfo['fileformat'] = 'shn'; - $ThisFileInfo['audio']['dataformat'] = 'shn'; - $ThisFileInfo['audio']['lossless'] = true; - $ThisFileInfo['audio']['bitrate_mode'] = 'vbr'; - - $ThisFileInfo['shn']['version'] = getid3_lib::LittleEndian2Int(substr($ShortenHeader, 4, 1)); - - fseek($fd, $ThisFileInfo['avdataend'] - 12, SEEK_SET); - $SeekTableSignatureTest = fread($fd, 12); - $ThisFileInfo['shn']['seektable']['present'] = (bool) (substr($SeekTableSignatureTest, 4, 8) == 'SHNAMPSK'); - if ($ThisFileInfo['shn']['seektable']['present']) { - $ThisFileInfo['shn']['seektable']['length'] = getid3_lib::LittleEndian2Int(substr($SeekTableSignatureTest, 0, 4)); - $ThisFileInfo['shn']['seektable']['offset'] = $ThisFileInfo['avdataend'] - $ThisFileInfo['shn']['seektable']['length']; - fseek($fd, $ThisFileInfo['shn']['seektable']['offset'], SEEK_SET); - $SeekTableMagic = fread($fd, 4); - if ($SeekTableMagic != 'SEEK') { - - $ThisFileInfo['error'][] = 'Expecting "SEEK" at offset '.$ThisFileInfo['shn']['seektable']['offset'].', found "'.$SeekTableMagic.'"'; - return false; - - } else { - - // typedef struct tag_TSeekEntry - // { - // unsigned long SampleNumber; - // unsigned long SHNFileByteOffset; - // unsigned long SHNLastBufferReadPosition; - // unsigned short SHNByteGet; - // unsigned short SHNBufferOffset; - // unsigned short SHNFileBitOffset; - // unsigned long SHNGBuffer; - // unsigned short SHNBitShift; - // long CBuf0[3]; - // long CBuf1[3]; - // long Offset0[4]; - // long Offset1[4]; - // }TSeekEntry; - - $SeekTableData = fread($fd, $ThisFileInfo['shn']['seektable']['length'] - 16); - $ThisFileInfo['shn']['seektable']['entry_count'] = floor(strlen($SeekTableData) / 80); - //$ThisFileInfo['shn']['seektable']['entries'] = array(); - //$SeekTableOffset = 0; - //for ($i = 0; $i < $ThisFileInfo['shn']['seektable']['entry_count']; $i++) { - // $SeekTableEntry['sample_number'] = getid3_lib::LittleEndian2Int(substr($SeekTableData, $SeekTableOffset, 4)); - // $SeekTableOffset += 4; - // $SeekTableEntry['shn_file_byte_offset'] = getid3_lib::LittleEndian2Int(substr($SeekTableData, $SeekTableOffset, 4)); - // $SeekTableOffset += 4; - // $SeekTableEntry['shn_last_buffer_read_position'] = getid3_lib::LittleEndian2Int(substr($SeekTableData, $SeekTableOffset, 4)); - // $SeekTableOffset += 4; - // $SeekTableEntry['shn_byte_get'] = getid3_lib::LittleEndian2Int(substr($SeekTableData, $SeekTableOffset, 2)); - // $SeekTableOffset += 2; - // $SeekTableEntry['shn_buffer_offset'] = getid3_lib::LittleEndian2Int(substr($SeekTableData, $SeekTableOffset, 2)); - // $SeekTableOffset += 2; - // $SeekTableEntry['shn_file_bit_offset'] = getid3_lib::LittleEndian2Int(substr($SeekTableData, $SeekTableOffset, 2)); - // $SeekTableOffset += 2; - // $SeekTableEntry['shn_gbuffer'] = getid3_lib::LittleEndian2Int(substr($SeekTableData, $SeekTableOffset, 4)); - // $SeekTableOffset += 4; - // $SeekTableEntry['shn_bit_shift'] = getid3_lib::LittleEndian2Int(substr($SeekTableData, $SeekTableOffset, 2)); - // $SeekTableOffset += 2; - // for ($j = 0; $j < 3; $j++) { - // $SeekTableEntry['cbuf0'][$j] = getid3_lib::LittleEndian2Int(substr($SeekTableData, $SeekTableOffset, 4)); - // $SeekTableOffset += 4; - // } - // for ($j = 0; $j < 3; $j++) { - // $SeekTableEntry['cbuf1'][$j] = getid3_lib::LittleEndian2Int(substr($SeekTableData, $SeekTableOffset, 4)); - // $SeekTableOffset += 4; - // } - // for ($j = 0; $j < 4; $j++) { - // $SeekTableEntry['offset0'][$j] = getid3_lib::LittleEndian2Int(substr($SeekTableData, $SeekTableOffset, 4)); - // $SeekTableOffset += 4; - // } - // for ($j = 0; $j < 4; $j++) { - // $SeekTableEntry['offset1'][$j] = getid3_lib::LittleEndian2Int(substr($SeekTableData, $SeekTableOffset, 4)); - // $SeekTableOffset += 4; - // } - // - // $ThisFileInfo['shn']['seektable']['entries'][] = $SeekTableEntry; - //} - - } - - } - - if ((bool) ini_get('safe_mode')) { - $ThisFileInfo['error'][] = 'PHP running in Safe Mode - backtick operator not available, cannot run shntool to analyze Shorten files'; - return false; - } - - if (GETID3_OS_ISWINDOWS) { - - $RequiredFiles = array('shorten.exe', 'cygwin1.dll', 'head.exe'); - foreach ($RequiredFiles as $required_file) { - if (!is_readable(GETID3_HELPERAPPSDIR.$required_file)) { - $ThisFileInfo['error'][] = GETID3_HELPERAPPSDIR.$required_file.' does not exist'; - return false; - } - } - $commandline = GETID3_HELPERAPPSDIR.'shorten.exe -x "'.$ThisFileInfo['filenamepath'].'" - | '.GETID3_HELPERAPPSDIR.'head.exe -c 64'; - $commandline = str_replace('/', '\\', $commandline); - - } else { - - static $shorten_present; - if (!isset($shorten_present)) { - $shorten_present = file_exists('/usr/local/bin/shorten') || `which shorten`; - } - if (!$shorten_present) { - $ThisFileInfo['error'][] = 'shorten binary was not found in path or /usr/local/bin'; - return false; - } - $commandline = (file_exists('/usr/local/bin/shorten') ? '/usr/local/bin/' : '' ) . 'shorten -x '.escapeshellarg($ThisFileInfo['filenamepath']).' - | head -c 64'; - - } - - $output = `$commandline`; - - if (!empty($output) && (substr($output, 12, 4) == 'fmt ')) { - - getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio-video.riff.php', __FILE__, true); - - $fmt_size = getid3_lib::LittleEndian2Int(substr($output, 16, 4)); - $DecodedWAVFORMATEX = getid3_riff::RIFFparseWAVEFORMATex(substr($output, 20, $fmt_size)); - $ThisFileInfo['audio']['channels'] = $DecodedWAVFORMATEX['channels']; - $ThisFileInfo['audio']['bits_per_sample'] = $DecodedWAVFORMATEX['bits_per_sample']; - $ThisFileInfo['audio']['sample_rate'] = $DecodedWAVFORMATEX['sample_rate']; - - if (substr($output, 20 + $fmt_size, 4) == 'data') { - - $ThisFileInfo['playtime_seconds'] = getid3_lib::LittleEndian2Int(substr($output, 20 + 4 + $fmt_size, 4)) / $DecodedWAVFORMATEX['raw']['nAvgBytesPerSec']; - - } else { - - $ThisFileInfo['error'][] = 'shorten failed to decode DATA chunk to expected location, cannot determine playtime'; - return false; - - } - - $ThisFileInfo['audio']['bitrate'] = (($ThisFileInfo['avdataend'] - $ThisFileInfo['avdataoffset']) / $ThisFileInfo['playtime_seconds']) * 8; - - } else { - - $ThisFileInfo['error'][] = 'shorten failed to decode file to WAV for parsing'; - return false; - - } - - return true; - } - -} - -?>
\ No newline at end of file diff --git a/getid3/module.audio.tta.php b/getid3/module.audio.tta.php deleted file mode 100644 index 903de6b..0000000 --- a/getid3/module.audio.tta.php +++ /dev/null @@ -1,107 +0,0 @@ -<?php -///////////////////////////////////////////////////////////////// -/// getID3() by James Heinrich <info@getid3.org> // -// available at http://getid3.sourceforge.net // -// or http://www.getid3.org // -///////////////////////////////////////////////////////////////// -// See readme.txt for more details // -///////////////////////////////////////////////////////////////// -// // -// module.audio.tta.php // -// module for analyzing TTA Audio files // -// dependencies: NONE // -// /// -///////////////////////////////////////////////////////////////// - - -class getid3_tta -{ - - function getid3_tta(&$fd, &$ThisFileInfo) { - - $ThisFileInfo['fileformat'] = 'tta'; - $ThisFileInfo['audio']['dataformat'] = 'tta'; - $ThisFileInfo['audio']['lossless'] = true; - $ThisFileInfo['audio']['bitrate_mode'] = 'vbr'; - - fseek($fd, $ThisFileInfo['avdataoffset'], SEEK_SET); - $ttaheader = fread($fd, 26); - - $ThisFileInfo['tta']['magic'] = substr($ttaheader, 0, 3); - if ($ThisFileInfo['tta']['magic'] != 'TTA') { - $ThisFileInfo['error'][] = 'Expecting "TTA" at offset '.$ThisFileInfo['avdataoffset'].', found "'.$ThisFileInfo['tta']['magic'].'"'; - unset($ThisFileInfo['fileformat']); - unset($ThisFileInfo['audio']); - unset($ThisFileInfo['tta']); - return false; - } - - switch ($ttaheader{3}) { - case "\x01": // TTA v1.x - case "\x02": // TTA v1.x - case "\x03": // TTA v1.x - // "It was the demo-version of the TTA encoder. There is no released format with such header. TTA encoder v1 is not supported about a year." - $ThisFileInfo['tta']['major_version'] = 1; - $ThisFileInfo['avdataoffset'] += 16; - - $ThisFileInfo['tta']['compression_level'] = ord($ttaheader{3}); - $ThisFileInfo['tta']['channels'] = getid3_lib::LittleEndian2Int(substr($ttaheader, 4, 2)); - $ThisFileInfo['tta']['bits_per_sample'] = getid3_lib::LittleEndian2Int(substr($ttaheader, 6, 2)); - $ThisFileInfo['tta']['sample_rate'] = getid3_lib::LittleEndian2Int(substr($ttaheader, 8, 4)); - $ThisFileInfo['tta']['samples_per_channel'] = getid3_lib::LittleEndian2Int(substr($ttaheader, 12, 4)); - - $ThisFileInfo['audio']['encoder_options'] = '-e'.$ThisFileInfo['tta']['compression_level']; - $ThisFileInfo['playtime_seconds'] = $ThisFileInfo['tta']['samples_per_channel'] / $ThisFileInfo['tta']['sample_rate']; - break; - - case '2': // TTA v2.x - // "I have hurried to release the TTA 2.0 encoder. Format documentation is removed from our site. This format still in development. Please wait the TTA2 format, encoder v4." - $ThisFileInfo['tta']['major_version'] = 2; - $ThisFileInfo['avdataoffset'] += 20; - - $ThisFileInfo['tta']['compression_level'] = getid3_lib::LittleEndian2Int(substr($ttaheader, 4, 2)); - $ThisFileInfo['tta']['audio_format'] = getid3_lib::LittleEndian2Int(substr($ttaheader, 6, 2)); - $ThisFileInfo['tta']['channels'] = getid3_lib::LittleEndian2Int(substr($ttaheader, 8, 2)); - $ThisFileInfo['tta']['bits_per_sample'] = getid3_lib::LittleEndian2Int(substr($ttaheader, 10, 2)); - $ThisFileInfo['tta']['sample_rate'] = getid3_lib::LittleEndian2Int(substr($ttaheader, 12, 4)); - $ThisFileInfo['tta']['data_length'] = getid3_lib::LittleEndian2Int(substr($ttaheader, 16, 4)); - - $ThisFileInfo['audio']['encoder_options'] = '-e'.$ThisFileInfo['tta']['compression_level']; - $ThisFileInfo['playtime_seconds'] = $ThisFileInfo['tta']['data_length'] / $ThisFileInfo['tta']['sample_rate']; - break; - - case '1': // TTA v3.x - // "This is a first stable release of the TTA format. It will be supported by the encoders v3 or higher." - $ThisFileInfo['tta']['major_version'] = 3; - $ThisFileInfo['avdataoffset'] += 26; - - $ThisFileInfo['tta']['audio_format'] = getid3_lib::LittleEndian2Int(substr($ttaheader, 4, 2)); // getid3_riff::RIFFwFormatTagLookup() - $ThisFileInfo['tta']['channels'] = getid3_lib::LittleEndian2Int(substr($ttaheader, 6, 2)); - $ThisFileInfo['tta']['bits_per_sample'] = getid3_lib::LittleEndian2Int(substr($ttaheader, 8, 2)); - $ThisFileInfo['tta']['sample_rate'] = getid3_lib::LittleEndian2Int(substr($ttaheader, 10, 4)); - $ThisFileInfo['tta']['data_length'] = getid3_lib::LittleEndian2Int(substr($ttaheader, 14, 4)); - $ThisFileInfo['tta']['crc32_footer'] = substr($ttaheader, 18, 4); - $ThisFileInfo['tta']['seek_point'] = getid3_lib::LittleEndian2Int(substr($ttaheader, 22, 4)); - - $ThisFileInfo['playtime_seconds'] = $ThisFileInfo['tta']['data_length'] / $ThisFileInfo['tta']['sample_rate']; - break; - - default: - $ThisFileInfo['error'][] = 'This version of getID3() only knows how to handle TTA v1 and v2 - it may not work correctly with this file which appears to be TTA v'.$ttaheader{3}; - return false; - break; - } - - $ThisFileInfo['audio']['encoder'] = 'TTA v'.$ThisFileInfo['tta']['major_version']; - $ThisFileInfo['audio']['bits_per_sample'] = $ThisFileInfo['tta']['bits_per_sample']; - $ThisFileInfo['audio']['sample_rate'] = $ThisFileInfo['tta']['sample_rate']; - $ThisFileInfo['audio']['channels'] = $ThisFileInfo['tta']['channels']; - $ThisFileInfo['audio']['bitrate'] = (($ThisFileInfo['avdataend'] - $ThisFileInfo['avdataoffset']) * 8) / $ThisFileInfo['playtime_seconds']; - - return true; - } - -} - - -?>
\ No newline at end of file diff --git a/getid3/module.audio.voc.php b/getid3/module.audio.voc.php deleted file mode 100644 index e93b44f..0000000 --- a/getid3/module.audio.voc.php +++ /dev/null @@ -1,205 +0,0 @@ -<?php -///////////////////////////////////////////////////////////////// -/// getID3() by James Heinrich <info@getid3.org> // -// available at http://getid3.sourceforge.net // -// or http://www.getid3.org // -///////////////////////////////////////////////////////////////// -// See readme.txt for more details // -///////////////////////////////////////////////////////////////// -// // -// module.audio.voc.php // -// module for analyzing Creative VOC Audio files // -// dependencies: NONE // -// /// -///////////////////////////////////////////////////////////////// - - -class getid3_voc -{ - - function getid3_voc(&$fd, &$ThisFileInfo) { - - $OriginalAVdataOffset = $ThisFileInfo['avdataoffset']; - fseek($fd, $ThisFileInfo['avdataoffset'], SEEK_SET); - $VOCheader = fread($fd, 26); - - if (substr($VOCheader, 0, 19) != 'Creative Voice File') { - $ThisFileInfo['error'][] = 'Expecting "Creative Voice File" at offset '.$ThisFileInfo['avdataoffset'].', found "'.substr($VOCheader, 0, 19).'"'; - return false; - } - - // shortcuts - $thisfile_audio = &$ThisFileInfo['audio']; - $ThisFileInfo['voc'] = array(); - $thisfile_voc = &$ThisFileInfo['voc']; - - $ThisFileInfo['fileformat'] = 'voc'; - $thisfile_audio['dataformat'] = 'voc'; - $thisfile_audio['bitrate_mode'] = 'cbr'; - $thisfile_audio['lossless'] = true; - $thisfile_audio['channels'] = 1; // might be overriden below - $thisfile_audio['bits_per_sample'] = 8; // might be overriden below - - // byte # Description - // ------ ------------------------------------------ - // 00-12 'Creative Voice File' - // 13 1A (eof to abort printing of file) - // 14-15 Offset of first datablock in .voc file (std 1A 00 in Intel Notation) - // 16-17 Version number (minor,major) (VOC-HDR puts 0A 01) - // 18-19 2's Comp of Ver. # + 1234h (VOC-HDR puts 29 11) - - $thisfile_voc['header']['datablock_offset'] = getid3_lib::LittleEndian2Int(substr($VOCheader, 20, 2)); - $thisfile_voc['header']['minor_version'] = getid3_lib::LittleEndian2Int(substr($VOCheader, 22, 1)); - $thisfile_voc['header']['major_version'] = getid3_lib::LittleEndian2Int(substr($VOCheader, 23, 1)); - - do { - - $BlockOffset = ftell($fd); - $BlockData = fread($fd, 4); - $BlockType = ord($BlockData{0}); - $BlockSize = getid3_lib::LittleEndian2Int(substr($BlockData, 1, 3)); - $ThisBlock = array(); - - @$thisfile_voc['blocktypes'][$BlockType]++; - switch ($BlockType) { - case 0: // Terminator - // do nothing, we'll break out of the loop down below - break; - - case 1: // Sound data - $BlockData .= fread($fd, 2); - if ($ThisFileInfo['avdataoffset'] <= $OriginalAVdataOffset) { - $ThisFileInfo['avdataoffset'] = ftell($fd); - } - fseek($fd, $BlockSize - 2, SEEK_CUR); - - $ThisBlock['sample_rate_id'] = getid3_lib::LittleEndian2Int(substr($BlockData, 4, 1)); - $ThisBlock['compression_type'] = getid3_lib::LittleEndian2Int(substr($BlockData, 5, 1)); - - $ThisBlock['compression_name'] = $this->VOCcompressionTypeLookup($ThisBlock['compression_type']); - if ($ThisBlock['compression_type'] <= 3) { - $thisfile_voc['compressed_bits_per_sample'] = getid3_lib::CastAsInt(str_replace('-bit', '', $ThisBlock['compression_name'])); - } - - // Less accurate sample_rate calculation than the Extended block (#8) data (but better than nothing if Extended Block is not available) - if (empty($thisfile_audio['sample_rate'])) { - // SR byte = 256 - (1000000 / sample_rate) - $thisfile_audio['sample_rate'] = getid3_lib::trunc((1000000 / (256 - $ThisBlock['sample_rate_id'])) / $thisfile_audio['channels']); - } - break; - - case 2: // Sound continue - case 3: // Silence - case 4: // Marker - case 6: // Repeat - case 7: // End repeat - // nothing useful, just skip - fseek($fd, $BlockSize, SEEK_CUR); - break; - - case 8: // Extended - $BlockData .= fread($fd, 4); - - //00-01 Time Constant: - // Mono: 65536 - (256000000 / sample_rate) - // Stereo: 65536 - (256000000 / (sample_rate * 2)) - $ThisBlock['time_constant'] = getid3_lib::LittleEndian2Int(substr($BlockData, 4, 2)); - $ThisBlock['pack_method'] = getid3_lib::LittleEndian2Int(substr($BlockData, 6, 1)); - $ThisBlock['stereo'] = (bool) getid3_lib::LittleEndian2Int(substr($BlockData, 7, 1)); - - $thisfile_audio['channels'] = ($ThisBlock['stereo'] ? 2 : 1); - $thisfile_audio['sample_rate'] = getid3_lib::trunc((256000000 / (65536 - $ThisBlock['time_constant'])) / $thisfile_audio['channels']); - break; - - case 9: // data block that supersedes blocks 1 and 8. Used for stereo, 16 bit - $BlockData .= fread($fd, 12); - if ($ThisFileInfo['avdataoffset'] <= $OriginalAVdataOffset) { - $ThisFileInfo['avdataoffset'] = ftell($fd); - } - fseek($fd, $BlockSize - 12, SEEK_CUR); - - $ThisBlock['sample_rate'] = getid3_lib::LittleEndian2Int(substr($BlockData, 4, 4)); - $ThisBlock['bits_per_sample'] = getid3_lib::LittleEndian2Int(substr($BlockData, 8, 1)); - $ThisBlock['channels'] = getid3_lib::LittleEndian2Int(substr($BlockData, 9, 1)); - $ThisBlock['wFormat'] = getid3_lib::LittleEndian2Int(substr($BlockData, 10, 2)); - - $ThisBlock['compression_name'] = $this->VOCwFormatLookup($ThisBlock['wFormat']); - if ($this->VOCwFormatActualBitsPerSampleLookup($ThisBlock['wFormat'])) { - $thisfile_voc['compressed_bits_per_sample'] = $this->VOCwFormatActualBitsPerSampleLookup($ThisBlock['wFormat']); - } - - $thisfile_audio['sample_rate'] = $ThisBlock['sample_rate']; - $thisfile_audio['bits_per_sample'] = $ThisBlock['bits_per_sample']; - $thisfile_audio['channels'] = $ThisBlock['channels']; - break; - - default: - $ThisFileInfo['warning'][] = 'Unhandled block type "'.$BlockType.'" at offset '.$BlockOffset; - fseek($fd, $BlockSize, SEEK_CUR); - break; - } - - if (!empty($ThisBlock)) { - $ThisBlock['block_offset'] = $BlockOffset; - $ThisBlock['block_size'] = $BlockSize; - $ThisBlock['block_type_id'] = $BlockType; - $thisfile_voc['blocks'][] = $ThisBlock; - } - - } while (!feof($fd) && ($BlockType != 0)); - - // Terminator block doesn't have size field, so seek back 3 spaces - fseek($fd, -3, SEEK_CUR); - - ksort($thisfile_voc['blocktypes']); - - if (!empty($thisfile_voc['compressed_bits_per_sample'])) { - $ThisFileInfo['playtime_seconds'] = (($ThisFileInfo['avdataend'] - $ThisFileInfo['avdataoffset']) * 8) / ($thisfile_voc['compressed_bits_per_sample'] * $thisfile_audio['channels'] * $thisfile_audio['sample_rate']); - $thisfile_audio['bitrate'] = (($ThisFileInfo['avdataend'] - $ThisFileInfo['avdataoffset']) * 8) / $ThisFileInfo['playtime_seconds']; - } - - return true; - } - - function VOCcompressionTypeLookup($index) { - static $VOCcompressionTypeLookup = array( - 0 => '8-bit', - 1 => '4-bit', - 2 => '2.6-bit', - 3 => '2-bit' - ); - return (isset($VOCcompressionTypeLookup[$index]) ? $VOCcompressionTypeLookup[$index] : 'Multi DAC ('.($index - 3).') channels'); - } - - function VOCwFormatLookup($index) { - static $VOCwFormatLookup = array( - 0x0000 => '8-bit unsigned PCM', - 0x0001 => 'Creative 8-bit to 4-bit ADPCM', - 0x0002 => 'Creative 8-bit to 3-bit ADPCM', - 0x0003 => 'Creative 8-bit to 2-bit ADPCM', - 0x0004 => '16-bit signed PCM', - 0x0006 => 'CCITT a-Law', - 0x0007 => 'CCITT u-Law', - 0x2000 => 'Creative 16-bit to 4-bit ADPCM' - ); - return (isset($VOCwFormatLookup[$index]) ? $VOCwFormatLookup[$index] : false); - } - - function VOCwFormatActualBitsPerSampleLookup($index) { - static $VOCwFormatLookup = array( - 0x0000 => 8, - 0x0001 => 4, - 0x0002 => 3, - 0x0003 => 2, - 0x0004 => 16, - 0x0006 => 8, - 0x0007 => 8, - 0x2000 => 4 - ); - return (isset($VOCwFormatLookup[$index]) ? $VOCwFormatLookup[$index] : false); - } - -} - - -?>
\ No newline at end of file diff --git a/getid3/module.audio.vqf.php b/getid3/module.audio.vqf.php deleted file mode 100644 index 49d4e85..0000000 --- a/getid3/module.audio.vqf.php +++ /dev/null @@ -1,159 +0,0 @@ -<?php -///////////////////////////////////////////////////////////////// -/// getID3() by James Heinrich <info@getid3.org> // -// available at http://getid3.sourceforge.net // -// or http://www.getid3.org // -///////////////////////////////////////////////////////////////// -// See readme.txt for more details // -///////////////////////////////////////////////////////////////// -// // -// module.audio.vqf.php // -// module for analyzing VQF audio files // -// dependencies: NONE // -// /// -///////////////////////////////////////////////////////////////// - - -class getid3_vqf -{ - function getid3_vqf(&$fd, &$ThisFileInfo) { - // based loosely on code from TTwinVQ by Jurgen Faul <jfaulØgmx*de> - // http://jfaul.de/atl or http://j-faul.virtualave.net/atl/atl.html - - $ThisFileInfo['fileformat'] = 'vqf'; - $ThisFileInfo['audio']['dataformat'] = 'vqf'; - $ThisFileInfo['audio']['bitrate_mode'] = 'cbr'; - $ThisFileInfo['audio']['lossless'] = false; - - // shortcut - $ThisFileInfo['vqf']['raw'] = array(); - $thisfile_vqf = &$ThisFileInfo['vqf']; - $thisfile_vqf_raw = &$thisfile_vqf['raw']; - - fseek($fd, $ThisFileInfo['avdataoffset'], SEEK_SET); - $VQFheaderData = fread($fd, 16); - - $offset = 0; - $thisfile_vqf_raw['header_tag'] = substr($VQFheaderData, $offset, 4); - if ($thisfile_vqf_raw['header_tag'] != 'TWIN') { - $ThisFileInfo['error'][] = 'Expecting "TWIN" at offset '.$ThisFileInfo['avdataoffset'].', found "'.$thisfile_vqf_raw['header_tag'].'"'; - unset($ThisFileInfo['vqf']); - unset($ThisFileInfo['fileformat']); - return false; - } - $offset += 4; - $thisfile_vqf_raw['version'] = substr($VQFheaderData, $offset, 8); - $offset += 8; - $thisfile_vqf_raw['size'] = getid3_lib::BigEndian2Int(substr($VQFheaderData, $offset, 4)); - $offset += 4; - - while (ftell($fd) < $ThisFileInfo['avdataend']) { - - $ChunkBaseOffset = ftell($fd); - $chunkoffset = 0; - $ChunkData = fread($fd, 8); - $ChunkName = substr($ChunkData, $chunkoffset, 4); - if ($ChunkName == 'DATA') { - $ThisFileInfo['avdataoffset'] = $ChunkBaseOffset; - break; - } - $chunkoffset += 4; - $ChunkSize = getid3_lib::BigEndian2Int(substr($ChunkData, $chunkoffset, 4)); - $chunkoffset += 4; - if ($ChunkSize > ($ThisFileInfo['avdataend'] - ftell($fd))) { - $ThisFileInfo['error'][] = 'Invalid chunk size ('.$ChunkSize.') for chunk "'.$ChunkName.'" at offset '.$ChunkBaseOffset; - break; - } - if ($ChunkSize > 0) { - $ChunkData .= fread($fd, $ChunkSize); - } - - switch ($ChunkName) { - case 'COMM': - // shortcut - $thisfile_vqf['COMM'] = array(); - $thisfile_vqf_COMM = &$thisfile_vqf['COMM']; - - $thisfile_vqf_COMM['channel_mode'] = getid3_lib::BigEndian2Int(substr($ChunkData, $chunkoffset, 4)); - $chunkoffset += 4; - $thisfile_vqf_COMM['bitrate'] = getid3_lib::BigEndian2Int(substr($ChunkData, $chunkoffset, 4)); - $chunkoffset += 4; - $thisfile_vqf_COMM['sample_rate'] = getid3_lib::BigEndian2Int(substr($ChunkData, $chunkoffset, 4)); - $chunkoffset += 4; - $thisfile_vqf_COMM['security_level'] = getid3_lib::BigEndian2Int(substr($ChunkData, $chunkoffset, 4)); - $chunkoffset += 4; - - $ThisFileInfo['audio']['channels'] = $thisfile_vqf_COMM['channel_mode'] + 1; - $ThisFileInfo['audio']['sample_rate'] = $this->VQFchannelFrequencyLookup($thisfile_vqf_COMM['sample_rate']); - $ThisFileInfo['audio']['bitrate'] = $thisfile_vqf_COMM['bitrate'] * 1000; - $ThisFileInfo['audio']['encoder_options'] = 'CBR' . ceil($ThisFileInfo['audio']['bitrate']/1000); - - if ($ThisFileInfo['audio']['bitrate'] == 0) { - $ThisFileInfo['error'][] = 'Corrupt VQF file: bitrate_audio == zero'; - return false; - } - break; - - case 'NAME': - case 'AUTH': - case '(c) ': - case 'FILE': - case 'COMT': - case 'ALBM': - $thisfile_vqf['comments'][$this->VQFcommentNiceNameLookup($ChunkName)][] = trim(substr($ChunkData, 8)); - break; - - case 'DSIZ': - $thisfile_vqf['DSIZ'] = getid3_lib::BigEndian2Int(substr($ChunkData, 8, 4)); - break; - - default: - $ThisFileInfo['warning'][] = 'Unhandled chunk type "'.$ChunkName.'" at offset '.$ChunkBaseOffset; - break; - } - } - - $ThisFileInfo['playtime_seconds'] = (($ThisFileInfo['avdataend'] - $ThisFileInfo['avdataoffset']) * 8) / $ThisFileInfo['audio']['bitrate']; - - if (isset($thisfile_vqf['DSIZ']) && (($thisfile_vqf['DSIZ'] != ($ThisFileInfo['avdataend'] - $ThisFileInfo['avdataoffset'] - strlen('DATA'))))) { - switch ($thisfile_vqf['DSIZ']) { - case 0: - case 1: - $ThisFileInfo['warning'][] = 'Invalid DSIZ value "'.$thisfile_vqf['DSIZ'].'". This is known to happen with VQF files encoded by Ahead Nero, and seems to be its way of saying this is TwinVQF v'.($thisfile_vqf['DSIZ'] + 1).'.0'; - $ThisFileInfo['audio']['encoder'] = 'Ahead Nero'; - break; - - default: - $ThisFileInfo['warning'][] = 'Probable corrupted file - should be '.$thisfile_vqf['DSIZ'].' bytes, actually '.($ThisFileInfo['avdataend'] - $ThisFileInfo['avdataoffset'] - strlen('DATA')); - break; - } - } - - return true; - } - - function VQFchannelFrequencyLookup($frequencyid) { - static $VQFchannelFrequencyLookup = array( - 11 => 11025, - 22 => 22050, - 44 => 44100 - ); - return (isset($VQFchannelFrequencyLookup[$frequencyid]) ? $VQFchannelFrequencyLookup[$frequencyid] : $frequencyid * 1000); - } - - function VQFcommentNiceNameLookup($shortname) { - static $VQFcommentNiceNameLookup = array( - 'NAME' => 'title', - 'AUTH' => 'artist', - '(c) ' => 'copyright', - 'FILE' => 'filename', - 'COMT' => 'comment', - 'ALBM' => 'album' - ); - return (isset($VQFcommentNiceNameLookup[$shortname]) ? $VQFcommentNiceNameLookup[$shortname] : $shortname); - } - -} - - -?>
\ No newline at end of file diff --git a/getid3/module.audio.wavpack.php b/getid3/module.audio.wavpack.php deleted file mode 100644 index 0435f08..0000000 --- a/getid3/module.audio.wavpack.php +++ /dev/null @@ -1,372 +0,0 @@ -<?php -///////////////////////////////////////////////////////////////// -/// getID3() by James Heinrich <info@getid3.org> // -// available at http://getid3.sourceforge.net // -// or http://www.getid3.org // -///////////////////////////////////////////////////////////////// -// See readme.txt for more details // -///////////////////////////////////////////////////////////////// -// // -// module.audio.wavpack.php // -// module for analyzing WavPack v4.0+ Audio files // -// dependencies: NONE // -// /// -///////////////////////////////////////////////////////////////// - - -class getid3_wavpack -{ - - function getid3_wavpack(&$fd, &$ThisFileInfo) { - - fseek($fd, $ThisFileInfo['avdataoffset'], SEEK_SET); - - while (true) { - - $wavpackheader = fread($fd, 32); - - if (ftell($fd) >= $ThisFileInfo['avdataend']) { - break; - } elseif (feof($fd)) { - break; - } elseif ( - (@$ThisFileInfo['wavpack']['blockheader']['total_samples'] > 0) && - (@$ThisFileInfo['wavpack']['blockheader']['block_samples'] > 0) && - (!isset($ThisFileInfo['wavpack']['riff_trailer_size']) || ($ThisFileInfo['wavpack']['riff_trailer_size'] <= 0)) && - ((@$ThisFileInfo['wavpack']['config_flags']['md5_checksum'] === false) || !empty($ThisFileInfo['md5_data_source']))) { - break; - } - - $blockheader_offset = ftell($fd) - 32; - $blockheader_magic = substr($wavpackheader, 0, 4); - $blockheader_size = getid3_lib::LittleEndian2Int(substr($wavpackheader, 4, 4)); - - if ($blockheader_magic != 'wvpk') { - $ThisFileInfo['error'][] = 'Expecting "wvpk" at offset '.$blockheader_offset.', found "'.$blockheader_magic.'"'; - if ((@$ThisFileInfo['audio']['dataformat'] != 'wavpack') && (@$ThisFileInfo['audio']['dataformat'] != 'wvc')) { - unset($ThisFileInfo['fileformat']); - unset($ThisFileInfo['audio']); - unset($ThisFileInfo['wavpack']); - } - return false; - } - - - if ((@$ThisFileInfo['wavpack']['blockheader']['block_samples'] <= 0) || - (@$ThisFileInfo['wavpack']['blockheader']['total_samples'] <= 0)) { - // Also, it is possible that the first block might not have - // any samples (block_samples == 0) and in this case you should skip blocks - // until you find one with samples because the other information (like - // total_samples) are not guaranteed to be correct until (block_samples > 0) - - // Finally, I have defined a format for files in which the length is not known
- // (for example when raw files are created using pipes). In these cases
- // total_samples will be -1 and you must seek to the final block to determine
- // the total number of samples.
- - - $ThisFileInfo['audio']['dataformat'] = 'wavpack'; - $ThisFileInfo['fileformat'] = 'wavpack'; - $ThisFileInfo['audio']['lossless'] = true; - $ThisFileInfo['audio']['bitrate_mode'] = 'vbr'; - - $ThisFileInfo['wavpack']['blockheader']['offset'] = $blockheader_offset; - $ThisFileInfo['wavpack']['blockheader']['magic'] = $blockheader_magic; - $ThisFileInfo['wavpack']['blockheader']['size'] = $blockheader_size; - - if ($ThisFileInfo['wavpack']['blockheader']['size'] >= 0x100000) { - $ThisFileInfo['error'][] = 'Expecting WavPack block size less than "0x100000", found "'.$ThisFileInfo['wavpack']['blockheader']['size'].'" at offset '.$ThisFileInfo['wavpack']['blockheader']['offset']; - if ((@$ThisFileInfo['audio']['dataformat'] != 'wavpack') && (@$ThisFileInfo['audio']['dataformat'] != 'wvc')) { - unset($ThisFileInfo['fileformat']); - unset($ThisFileInfo['audio']); - unset($ThisFileInfo['wavpack']); - } - return false; - } - - $ThisFileInfo['wavpack']['blockheader']['minor_version'] = ord($wavpackheader{8}); - $ThisFileInfo['wavpack']['blockheader']['major_version'] = ord($wavpackheader{9}); - - if (($ThisFileInfo['wavpack']['blockheader']['major_version'] != 4) || - (($ThisFileInfo['wavpack']['blockheader']['minor_version'] < 4) && - ($ThisFileInfo['wavpack']['blockheader']['minor_version'] > 16))) { - $ThisFileInfo['error'][] = 'Expecting WavPack version between "4.2" and "4.16", found version "'.$ThisFileInfo['wavpack']['blockheader']['major_version'].'.'.$ThisFileInfo['wavpack']['blockheader']['minor_version'].'" at offset '.$ThisFileInfo['wavpack']['blockheader']['offset']; - if ((@$ThisFileInfo['audio']['dataformat'] != 'wavpack') && (@$ThisFileInfo['audio']['dataformat'] != 'wvc')) { - unset($ThisFileInfo['fileformat']); - unset($ThisFileInfo['audio']); - unset($ThisFileInfo['wavpack']); - } - return false; - } - - $ThisFileInfo['wavpack']['blockheader']['track_number'] = ord($wavpackheader{10}); // unused - $ThisFileInfo['wavpack']['blockheader']['index_number'] = ord($wavpackheader{11}); // unused - $ThisFileInfo['wavpack']['blockheader']['total_samples'] = getid3_lib::LittleEndian2Int(substr($wavpackheader, 12, 4)); - $ThisFileInfo['wavpack']['blockheader']['block_index'] = getid3_lib::LittleEndian2Int(substr($wavpackheader, 16, 4)); - $ThisFileInfo['wavpack']['blockheader']['block_samples'] = getid3_lib::LittleEndian2Int(substr($wavpackheader, 20, 4)); - $ThisFileInfo['wavpack']['blockheader']['flags_raw'] = getid3_lib::LittleEndian2Int(substr($wavpackheader, 24, 4)); - $ThisFileInfo['wavpack']['blockheader']['crc'] = getid3_lib::LittleEndian2Int(substr($wavpackheader, 28, 4)); - - $ThisFileInfo['wavpack']['blockheader']['flags']['bytes_per_sample'] = 1 + ($ThisFileInfo['wavpack']['blockheader']['flags_raw'] & 0x00000003); - $ThisFileInfo['wavpack']['blockheader']['flags']['mono'] = (bool) ($ThisFileInfo['wavpack']['blockheader']['flags_raw'] & 0x00000004); - $ThisFileInfo['wavpack']['blockheader']['flags']['hybrid'] = (bool) ($ThisFileInfo['wavpack']['blockheader']['flags_raw'] & 0x00000008); - $ThisFileInfo['wavpack']['blockheader']['flags']['joint_stereo'] = (bool) ($ThisFileInfo['wavpack']['blockheader']['flags_raw'] & 0x00000010); - $ThisFileInfo['wavpack']['blockheader']['flags']['cross_decorrelation'] = (bool) ($ThisFileInfo['wavpack']['blockheader']['flags_raw'] & 0x00000020); - $ThisFileInfo['wavpack']['blockheader']['flags']['hybrid_noiseshape'] = (bool) ($ThisFileInfo['wavpack']['blockheader']['flags_raw'] & 0x00000040); - $ThisFileInfo['wavpack']['blockheader']['flags']['ieee_32bit_float'] = (bool) ($ThisFileInfo['wavpack']['blockheader']['flags_raw'] & 0x00000080); - $ThisFileInfo['wavpack']['blockheader']['flags']['int_32bit'] = (bool) ($ThisFileInfo['wavpack']['blockheader']['flags_raw'] & 0x00000100); - $ThisFileInfo['wavpack']['blockheader']['flags']['hybrid_bitrate_noise'] = (bool) ($ThisFileInfo['wavpack']['blockheader']['flags_raw'] & 0x00000200); - $ThisFileInfo['wavpack']['blockheader']['flags']['hybrid_balance_noise'] = (bool) ($ThisFileInfo['wavpack']['blockheader']['flags_raw'] & 0x00000400); - $ThisFileInfo['wavpack']['blockheader']['flags']['multichannel_initial'] = (bool) ($ThisFileInfo['wavpack']['blockheader']['flags_raw'] & 0x00000800); - $ThisFileInfo['wavpack']['blockheader']['flags']['multichannel_final'] = (bool) ($ThisFileInfo['wavpack']['blockheader']['flags_raw'] & 0x00001000); - - $ThisFileInfo['audio']['lossless'] = !$ThisFileInfo['wavpack']['blockheader']['flags']['hybrid']; - } - - while (!feof($fd) && (ftell($fd) < ($blockheader_offset + $blockheader_size + 8))) { - - $metablock = array('offset'=>ftell($fd)); - $metablockheader = fread($fd, 2); - if (feof($fd)) { - break; - } - $metablock['id'] = ord($metablockheader{0}); - $metablock['function_id'] = ($metablock['id'] & 0x3F); - $metablock['function_name'] = $this->WavPackMetablockNameLookup($metablock['function_id']); - - // The 0x20 bit in the id of the meta subblocks (which is defined as - // ID_OPTIONAL_DATA) is a permanent part of the id. The idea is that - // if a decoder encounters an id that it does not know about, it uses - // that "ID_OPTIONAL_DATA" flag to determine what to do. If it is set - // then the decoder simply ignores the metadata, but if it is zero - // then the decoder should quit because it means that an understanding - // of the metadata is required to correctly decode the audio. - $metablock['non_decoder'] = (bool) ($metablock['id'] & 0x20); - - $metablock['padded_data'] = (bool) ($metablock['id'] & 0x40); - $metablock['large_block'] = (bool) ($metablock['id'] & 0x80); - if ($metablock['large_block']) { - $metablockheader .= fread($fd, 2); - } - $metablock['size'] = getid3_lib::LittleEndian2Int(substr($metablockheader, 1)) * 2; // size is stored in words - $metablock['data'] = null; - - if ($metablock['size'] > 0) { - - switch ($metablock['function_id']) { - case 0x21: // ID_RIFF_HEADER - case 0x22: // ID_RIFF_TRAILER - case 0x23: // ID_REPLAY_GAIN - case 0x24: // ID_CUESHEET - case 0x25: // ID_CONFIG_BLOCK - case 0x26: // ID_MD5_CHECKSUM - $metablock['data'] = fread($fd, $metablock['size']); - - if ($metablock['padded_data']) { - // padded to the nearest even byte - $metablock['size']--; - $metablock['data'] = substr($metablock['data'], 0, -1); - } - break; - - case 0x00: // ID_DUMMY - case 0x01: // ID_ENCODER_INFO - case 0x02: // ID_DECORR_TERMS - case 0x03: // ID_DECORR_WEIGHTS - case 0x04: // ID_DECORR_SAMPLES - case 0x05: // ID_ENTROPY_VARS - case 0x06: // ID_HYBRID_PROFILE - case 0x07: // ID_SHAPING_WEIGHTS - case 0x08: // ID_FLOAT_INFO - case 0x09: // ID_INT32_INFO - case 0x0A: // ID_WV_BITSTREAM - case 0x0B: // ID_WVC_BITSTREAM - case 0x0C: // ID_WVX_BITSTREAM - case 0x0D: // ID_CHANNEL_INFO - fseek($fd, $metablock['offset'] + ($metablock['large_block'] ? 4 : 2) + $metablock['size'], SEEK_SET); - break; - - default: - $ThisFileInfo['warning'][] = 'Unexpected metablock type "0x'.str_pad(dechex($metablock['function_id']), 2, '0', STR_PAD_LEFT).'" at offset '.$metablock['offset']; - fseek($fd, $metablock['offset'] + ($metablock['large_block'] ? 4 : 2) + $metablock['size'], SEEK_SET); - break; - } - - switch ($metablock['function_id']) { - case 0x21: // ID_RIFF_HEADER - getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio-video.riff.php', __FILE__, true); - $original_wav_filesize = getid3_lib::LittleEndian2Int(substr($metablock['data'], 4, 4)); - getid3_riff::ParseRIFFdata($metablock['data'], $ParsedRIFFheader); - $metablock['riff'] = $ParsedRIFFheader['riff']; - $metablock['riff']['original_filesize'] = $original_wav_filesize; - $ThisFileInfo['wavpack']['riff_trailer_size'] = $original_wav_filesize - $metablock['riff']['WAVE']['data'][0]['size'] - $metablock['riff']['header_size']; - - $ThisFileInfo['audio']['sample_rate'] = $ParsedRIFFheader['riff']['raw']['fmt ']['nSamplesPerSec']; - $ThisFileInfo['playtime_seconds'] = $ThisFileInfo['wavpack']['blockheader']['total_samples'] / $ThisFileInfo['audio']['sample_rate']; - - // Safe RIFF header in case there's a RIFF footer later - $metablockRIFFheader = $metablock['data']; - break; - - - case 0x22: // ID_RIFF_TRAILER - $metablockRIFFfooter = $metablockRIFFheader.$metablock['data']; - getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio-video.riff.php', __FILE__, true); - - $ftell_old = ftell($fd); - $startoffset = $metablock['offset'] + ($metablock['large_block'] ? 4 : 2); - $ParsedRIFFfooter = array('avdataend'=>$ThisFileInfo['avdataend'], 'fileformat'=>'riff', 'error'=>array(), 'warning'=>array()); - $metablock['riff'] = getid3_riff::ParseRIFF($fd, $startoffset, $startoffset + $metablock['size'], $ParsedRIFFfooter); - fseek($fd, $ftell_old, SEEK_SET); - - if (!empty($metablock['riff']['INFO'])) { - getid3_riff::RIFFcommentsParse($metablock['riff']['INFO'], $metablock['comments']); - $ThisFileInfo['tags']['riff'] = $metablock['comments']; - } - break; - - - case 0x23: // ID_REPLAY_GAIN - $ThisFileInfo['warning'][] = 'WavPack "Replay Gain" contents not yet handled by getID3() in metablock at offset '.$metablock['offset']; - break; - - - case 0x24: // ID_CUESHEET - $ThisFileInfo['warning'][] = 'WavPack "Cuesheet" contents not yet handled by getID3() in metablock at offset '.$metablock['offset']; - break; - - - case 0x25: // ID_CONFIG_BLOCK - $metablock['flags_raw'] = getid3_lib::LittleEndian2Int(substr($metablock['data'], 0, 3)); - - $metablock['flags']['adobe_mode'] = (bool) ($metablock['flags_raw'] & 0x000001); // "adobe" mode for 32-bit floats - $metablock['flags']['fast_flag'] = (bool) ($metablock['flags_raw'] & 0x000002); // fast mode - $metablock['flags']['very_fast_flag'] = (bool) ($metablock['flags_raw'] & 0x000004); // double fast - $metablock['flags']['high_flag'] = (bool) ($metablock['flags_raw'] & 0x000008); // high quality mode - $metablock['flags']['very_high_flag'] = (bool) ($metablock['flags_raw'] & 0x000010); // double high (not used yet) - $metablock['flags']['bitrate_kbps'] = (bool) ($metablock['flags_raw'] & 0x000020); // bitrate is kbps, not bits / sample - $metablock['flags']['auto_shaping'] = (bool) ($metablock['flags_raw'] & 0x000040); // automatic noise shaping - $metablock['flags']['shape_override'] = (bool) ($metablock['flags_raw'] & 0x000080); // shaping mode specified - $metablock['flags']['joint_override'] = (bool) ($metablock['flags_raw'] & 0x000100); // joint-stereo mode specified - $metablock['flags']['copy_time'] = (bool) ($metablock['flags_raw'] & 0x000200); // copy file-time from source - $metablock['flags']['create_exe'] = (bool) ($metablock['flags_raw'] & 0x000400); // create executable - $metablock['flags']['create_wvc'] = (bool) ($metablock['flags_raw'] & 0x000800); // create correction file - $metablock['flags']['optimize_wvc'] = (bool) ($metablock['flags_raw'] & 0x001000); // maximize bybrid compression - $metablock['flags']['quality_mode'] = (bool) ($metablock['flags_raw'] & 0x002000); // psychoacoustic quality mode - $metablock['flags']['raw_flag'] = (bool) ($metablock['flags_raw'] & 0x004000); // raw mode (not implemented yet) - $metablock['flags']['calc_noise'] = (bool) ($metablock['flags_raw'] & 0x008000); // calc noise in hybrid mode - $metablock['flags']['lossy_mode'] = (bool) ($metablock['flags_raw'] & 0x010000); // obsolete (for information) - $metablock['flags']['extra_mode'] = (bool) ($metablock['flags_raw'] & 0x020000); // extra processing mode - $metablock['flags']['skip_wvx'] = (bool) ($metablock['flags_raw'] & 0x040000); // no wvx stream w/ floats & big ints - $metablock['flags']['md5_checksum'] = (bool) ($metablock['flags_raw'] & 0x080000); // compute & store MD5 signature - $metablock['flags']['quiet_mode'] = (bool) ($metablock['flags_raw'] & 0x100000); // don't report progress % - - $ThisFileInfo['wavpack']['config_flags'] = $metablock['flags']; - - - if ($ThisFileInfo['wavpack']['blockheader']['flags']['hybrid']) { - @$ThisFileInfo['audio']['encoder_options'] .= ' -b???'; - } - @$ThisFileInfo['audio']['encoder_options'] .= ($metablock['flags']['adobe_mode'] ? ' -a' : ''); - @$ThisFileInfo['audio']['encoder_options'] .= ($metablock['flags']['optimize_wvc'] ? ' -cc' : ''); - @$ThisFileInfo['audio']['encoder_options'] .= ($metablock['flags']['create_exe'] ? ' -e' : ''); - @$ThisFileInfo['audio']['encoder_options'] .= ($metablock['flags']['fast_flag'] ? ' -f' : ''); - @$ThisFileInfo['audio']['encoder_options'] .= ($metablock['flags']['joint_override'] ? ' -j?' : ''); - @$ThisFileInfo['audio']['encoder_options'] .= ($metablock['flags']['high_flag'] ? ' -h' : ''); - @$ThisFileInfo['audio']['encoder_options'] .= ($metablock['flags']['md5_checksum'] ? ' -m' : ''); - @$ThisFileInfo['audio']['encoder_options'] .= ($metablock['flags']['calc_noise'] ? ' -n' : ''); - @$ThisFileInfo['audio']['encoder_options'] .= ($metablock['flags']['shape_override'] ? ' -s?' : ''); - @$ThisFileInfo['audio']['encoder_options'] .= ($metablock['flags']['extra_mode'] ? ' -x?' : ''); - if (@$ThisFileInfo['audio']['encoder_options']) { - $ThisFileInfo['audio']['encoder_options'] = trim(@$ThisFileInfo['audio']['encoder_options']); - } - elseif (isset($ThisFileInfo['audio']['encoder_options'])) { - unset($ThisFileInfo['audio']['encoder_options']); - } - break; - - - case 0x26: // ID_MD5_CHECKSUM - if (strlen($metablock['data']) == 16) { - $ThisFileInfo['md5_data_source'] = strtolower(getid3_lib::PrintHexBytes($metablock['data'], true, false, false)); - } else { - $ThisFileInfo['warning'][] = 'Expecting 16 bytes of WavPack "MD5 Checksum" in metablock at offset '.$metablock['offset'].', but found '.strlen($metablock['data']).' bytes'; - } - break; - - - case 0x00: // ID_DUMMY - case 0x01: // ID_ENCODER_INFO - case 0x02: // ID_DECORR_TERMS - case 0x03: // ID_DECORR_WEIGHTS - case 0x04: // ID_DECORR_SAMPLES - case 0x05: // ID_ENTROPY_VARS - case 0x06: // ID_HYBRID_PROFILE - case 0x07: // ID_SHAPING_WEIGHTS - case 0x08: // ID_FLOAT_INFO - case 0x09: // ID_INT32_INFO - case 0x0A: // ID_WV_BITSTREAM - case 0x0B: // ID_WVC_BITSTREAM - case 0x0C: // ID_WVX_BITSTREAM - case 0x0D: // ID_CHANNEL_INFO - unset($metablock); - break; - } - - } - if (!empty($metablock)) { - $ThisFileInfo['wavpack']['metablocks'][] = $metablock; - } - - } - - } - - $ThisFileInfo['audio']['encoder'] = 'WavPack v'.$ThisFileInfo['wavpack']['blockheader']['major_version'].'.'.str_pad($ThisFileInfo['wavpack']['blockheader']['minor_version'], 2, '0', STR_PAD_LEFT); - $ThisFileInfo['audio']['bits_per_sample'] = $ThisFileInfo['wavpack']['blockheader']['flags']['bytes_per_sample'] * 8; - $ThisFileInfo['audio']['channels'] = ($ThisFileInfo['wavpack']['blockheader']['flags']['mono'] ? 1 : 2); - - if (@$ThisFileInfo['playtime_seconds']) { - - $ThisFileInfo['audio']['bitrate'] = (($ThisFileInfo['avdataend'] - $ThisFileInfo['avdataoffset']) * 8) / $ThisFileInfo['playtime_seconds']; - - } else { - - $ThisFileInfo['audio']['dataformat'] = 'wvc'; - - } - - return true; - } - - - function WavPackMetablockNameLookup(&$id) { - static $WavPackMetablockNameLookup = array( - 0x00 => 'Dummy', - 0x01 => 'Encoder Info', - 0x02 => 'Decorrelation Terms', - 0x03 => 'Decorrelation Weights', - 0x04 => 'Decorrelation Samples', - 0x05 => 'Entropy Variables', - 0x06 => 'Hybrid Profile', - 0x07 => 'Shaping Weights', - 0x08 => 'Float Info', - 0x09 => 'Int32 Info', - 0x0A => 'WV Bitstream', - 0x0B => 'WVC Bitstream', - 0x0C => 'WVX Bitstream', - 0x0D => 'Channel Info', - 0x21 => 'RIFF header', - 0x22 => 'RIFF trailer', - 0x23 => 'Replay Gain', - 0x24 => 'Cuesheet', - 0x25 => 'Config Block', - 0x26 => 'MD5 Checksum', - ); - return (@$WavPackMetablockNameLookup[$id]); - } - -} - - -?>
\ No newline at end of file diff --git a/getid3/module.graphic.bmp.php b/getid3/module.graphic.bmp.php deleted file mode 100644 index fcdb95c..0000000 --- a/getid3/module.graphic.bmp.php +++ /dev/null @@ -1,685 +0,0 @@ -<?php -///////////////////////////////////////////////////////////////// -/// getID3() by James Heinrich <info@getid3.org> // -// available at http://getid3.sourceforge.net // -// or http://www.getid3.org // -///////////////////////////////////////////////////////////////// -// See readme.txt for more details // -///////////////////////////////////////////////////////////////// -// // -// module.graphic.bmp.php // -// module for analyzing BMP Image files // -// dependencies: NONE // -// /// -///////////////////////////////////////////////////////////////// - - -class getid3_bmp -{ - - function getid3_bmp(&$fd, &$ThisFileInfo, $ExtractPalette=false, $ExtractData=false) { - - // shortcuts - $ThisFileInfo['bmp']['header']['raw'] = array(); - $thisfile_bmp = &$ThisFileInfo['bmp']; - $thisfile_bmp_header = &$thisfile_bmp['header']; - $thisfile_bmp_header_raw = &$thisfile_bmp_header['raw']; - - // BITMAPFILEHEADER [14 bytes] - http://msdn.microsoft.com/library/en-us/gdi/bitmaps_62uq.asp - // all versions - // WORD bfType; - // DWORD bfSize; - // WORD bfReserved1; - // WORD bfReserved2; - // DWORD bfOffBits; - - fseek($fd, $ThisFileInfo['avdataoffset'], SEEK_SET); - $offset = 0; - $BMPheader = fread($fd, 14 + 40); - - $thisfile_bmp_header_raw['identifier'] = substr($BMPheader, $offset, 2); - $offset += 2; - - if ($thisfile_bmp_header_raw['identifier'] != 'BM') { - $ThisFileInfo['error'][] = 'Expecting "BM" at offset '.$ThisFileInfo['avdataoffset'].', found "'.$thisfile_bmp_header_raw['identifier'].'"'; - unset($ThisFileInfo['fileformat']); - unset($ThisFileInfo['bmp']); - return false; - } - - $thisfile_bmp_header_raw['filesize'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4)); - $offset += 4; - $thisfile_bmp_header_raw['reserved1'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 2)); - $offset += 2; - $thisfile_bmp_header_raw['reserved2'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 2)); - $offset += 2; - $thisfile_bmp_header_raw['data_offset'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4)); - $offset += 4; - $thisfile_bmp_header_raw['header_size'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4)); - $offset += 4; - - - // check if the hardcoded-to-1 "planes" is at offset 22 or 26 - $planes22 = getid3_lib::LittleEndian2Int(substr($BMPheader, 22, 2)); - $planes26 = getid3_lib::LittleEndian2Int(substr($BMPheader, 26, 2)); - if (($planes22 == 1) && ($planes26 != 1)) { - $thisfile_bmp['type_os'] = 'OS/2'; - $thisfile_bmp['type_version'] = 1; - } elseif (($planes26 == 1) && ($planes22 != 1)) { - $thisfile_bmp['type_os'] = 'Windows'; - $thisfile_bmp['type_version'] = 1; - } elseif ($thisfile_bmp_header_raw['header_size'] == 12) { - $thisfile_bmp['type_os'] = 'OS/2'; - $thisfile_bmp['type_version'] = 1; - } elseif ($thisfile_bmp_header_raw['header_size'] == 40) { - $thisfile_bmp['type_os'] = 'Windows'; - $thisfile_bmp['type_version'] = 1; - } elseif ($thisfile_bmp_header_raw['header_size'] == 84) { - $thisfile_bmp['type_os'] = 'Windows'; - $thisfile_bmp['type_version'] = 4; - } elseif ($thisfile_bmp_header_raw['header_size'] == 100) { - $thisfile_bmp['type_os'] = 'Windows'; - $thisfile_bmp['type_version'] = 5; - } else { - $ThisFileInfo['error'][] = 'Unknown BMP subtype (or not a BMP file)'; - unset($ThisFileInfo['fileformat']); - unset($ThisFileInfo['bmp']); - return false; - } - - $ThisFileInfo['fileformat'] = 'bmp'; - $ThisFileInfo['video']['dataformat'] = 'bmp'; - $ThisFileInfo['video']['lossless'] = true; - $ThisFileInfo['video']['pixel_aspect_ratio'] = (float) 1; - - if ($thisfile_bmp['type_os'] == 'OS/2') { - - // OS/2-format BMP - // http://netghost.narod.ru/gff/graphics/summary/os2bmp.htm - - // DWORD Size; /* Size of this structure in bytes */ - // DWORD Width; /* Bitmap width in pixels */ - // DWORD Height; /* Bitmap height in pixel */ - // WORD NumPlanes; /* Number of bit planes (color depth) */ - // WORD BitsPerPixel; /* Number of bits per pixel per plane */ - - $thisfile_bmp_header_raw['width'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 2)); - $offset += 2; - $thisfile_bmp_header_raw['height'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 2)); - $offset += 2; - $thisfile_bmp_header_raw['planes'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 2)); - $offset += 2; - $thisfile_bmp_header_raw['bits_per_pixel'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 2)); - $offset += 2; - - $ThisFileInfo['video']['resolution_x'] = $thisfile_bmp_header_raw['width']; - $ThisFileInfo['video']['resolution_y'] = $thisfile_bmp_header_raw['height']; - $ThisFileInfo['video']['codec'] = 'BI_RGB '.$thisfile_bmp_header_raw['bits_per_pixel'].'-bit'; - $ThisFileInfo['video']['bits_per_sample'] = $thisfile_bmp_header_raw['bits_per_pixel']; - - if ($thisfile_bmp['type_version'] >= 2) { - // DWORD Compression; /* Bitmap compression scheme */ - // DWORD ImageDataSize; /* Size of bitmap data in bytes */ - // DWORD XResolution; /* X resolution of display device */ - // DWORD YResolution; /* Y resolution of display device */ - // DWORD ColorsUsed; /* Number of color table indices used */ - // DWORD ColorsImportant; /* Number of important color indices */ - // WORD Units; /* Type of units used to measure resolution */ - // WORD Reserved; /* Pad structure to 4-byte boundary */ - // WORD Recording; /* Recording algorithm */ - // WORD Rendering; /* Halftoning algorithm used */ - // DWORD Size1; /* Reserved for halftoning algorithm use */ - // DWORD Size2; /* Reserved for halftoning algorithm use */ - // DWORD ColorEncoding; /* Color model used in bitmap */ - // DWORD Identifier; /* Reserved for application use */ - - $thisfile_bmp_header_raw['compression'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4)); - $offset += 4; - $thisfile_bmp_header_raw['bmp_data_size'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4)); - $offset += 4; - $thisfile_bmp_header_raw['resolution_h'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4)); - $offset += 4; - $thisfile_bmp_header_raw['resolution_v'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4)); - $offset += 4; - $thisfile_bmp_header_raw['colors_used'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4)); - $offset += 4; - $thisfile_bmp_header_raw['colors_important'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4)); - $offset += 4; - $thisfile_bmp_header_raw['resolution_units'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 2)); - $offset += 2; - $thisfile_bmp_header_raw['reserved1'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 2)); - $offset += 2; - $thisfile_bmp_header_raw['recording'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 2)); - $offset += 2; - $thisfile_bmp_header_raw['rendering'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 2)); - $offset += 2; - $thisfile_bmp_header_raw['size1'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4)); - $offset += 4; - $thisfile_bmp_header_raw['size2'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4)); - $offset += 4; - $thisfile_bmp_header_raw['color_encoding'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4)); - $offset += 4; - $thisfile_bmp_header_raw['identifier'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4)); - $offset += 4; - - $thisfile_bmp_header['compression'] = $this->BMPcompressionOS2Lookup($thisfile_bmp_header_raw['compression']); - - $ThisFileInfo['video']['codec'] = $thisfile_bmp_header['compression'].' '.$thisfile_bmp_header_raw['bits_per_pixel'].'-bit'; - } - - } elseif ($thisfile_bmp['type_os'] == 'Windows') { - - // Windows-format BMP - - // BITMAPINFOHEADER - [40 bytes] http://msdn.microsoft.com/library/en-us/gdi/bitmaps_1rw2.asp - // all versions - // DWORD biSize; - // LONG biWidth; - // LONG biHeight; - // WORD biPlanes; - // WORD biBitCount; - // DWORD biCompression; - // DWORD biSizeImage; - // LONG biXPelsPerMeter; - // LONG biYPelsPerMeter; - // DWORD biClrUsed; - // DWORD biClrImportant; - - // possibly integrate this section and module.audio-video.riff.php::ParseBITMAPINFOHEADER() ? - - $thisfile_bmp_header_raw['width'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4), true); - $offset += 4; - $thisfile_bmp_header_raw['height'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4), true); - $offset += 4; - $thisfile_bmp_header_raw['planes'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 2)); - $offset += 2; - $thisfile_bmp_header_raw['bits_per_pixel'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 2)); - $offset += 2; - $thisfile_bmp_header_raw['compression'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4)); - $offset += 4; - $thisfile_bmp_header_raw['bmp_data_size'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4)); - $offset += 4; - $thisfile_bmp_header_raw['resolution_h'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4), true); - $offset += 4; - $thisfile_bmp_header_raw['resolution_v'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4), true); - $offset += 4; - $thisfile_bmp_header_raw['colors_used'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4)); - $offset += 4; - $thisfile_bmp_header_raw['colors_important'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4)); - $offset += 4; - - $thisfile_bmp_header['compression'] = $this->BMPcompressionWindowsLookup($thisfile_bmp_header_raw['compression']); - $ThisFileInfo['video']['resolution_x'] = $thisfile_bmp_header_raw['width']; - $ThisFileInfo['video']['resolution_y'] = $thisfile_bmp_header_raw['height']; - $ThisFileInfo['video']['codec'] = $thisfile_bmp_header['compression'].' '.$thisfile_bmp_header_raw['bits_per_pixel'].'-bit'; - $ThisFileInfo['video']['bits_per_sample'] = $thisfile_bmp_header_raw['bits_per_pixel']; - - if (($thisfile_bmp['type_version'] >= 4) || ($thisfile_bmp_header_raw['compression'] == 3)) { - // should only be v4+, but BMPs with type_version==1 and BI_BITFIELDS compression have been seen - $BMPheader .= fread($fd, 44); - - // BITMAPV4HEADER - [44 bytes] - http://msdn.microsoft.com/library/en-us/gdi/bitmaps_2k1e.asp - // Win95+, WinNT4.0+ - // DWORD bV4RedMask; - // DWORD bV4GreenMask; - // DWORD bV4BlueMask; - // DWORD bV4AlphaMask; - // DWORD bV4CSType; - // CIEXYZTRIPLE bV4Endpoints; - // DWORD bV4GammaRed; - // DWORD bV4GammaGreen; - // DWORD bV4GammaBlue; - $thisfile_bmp_header_raw['red_mask'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4)); - $offset += 4; - $thisfile_bmp_header_raw['green_mask'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4)); - $offset += 4; - $thisfile_bmp_header_raw['blue_mask'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4)); - $offset += 4; - $thisfile_bmp_header_raw['alpha_mask'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4)); - $offset += 4; - $thisfile_bmp_header_raw['cs_type'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4)); - $offset += 4; - $thisfile_bmp_header_raw['ciexyz_red'] = substr($BMPheader, $offset, 4); - $offset += 4; - $thisfile_bmp_header_raw['ciexyz_green'] = substr($BMPheader, $offset, 4); - $offset += 4; - $thisfile_bmp_header_raw['ciexyz_blue'] = substr($BMPheader, $offset, 4); - $offset += 4; - $thisfile_bmp_header_raw['gamma_red'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4)); - $offset += 4; - $thisfile_bmp_header_raw['gamma_green'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4)); - $offset += 4; - $thisfile_bmp_header_raw['gamma_blue'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4)); - $offset += 4; - - $thisfile_bmp_header['ciexyz_red'] = getid3_lib::FixedPoint2_30(strrev($thisfile_bmp_header_raw['ciexyz_red'])); - $thisfile_bmp_header['ciexyz_green'] = getid3_lib::FixedPoint2_30(strrev($thisfile_bmp_header_raw['ciexyz_green'])); - $thisfile_bmp_header['ciexyz_blue'] = getid3_lib::FixedPoint2_30(strrev($thisfile_bmp_header_raw['ciexyz_blue'])); - } - - if ($thisfile_bmp['type_version'] >= 5) { - $BMPheader .= fread($fd, 16); - - // BITMAPV5HEADER - [16 bytes] - http://msdn.microsoft.com/library/en-us/gdi/bitmaps_7c36.asp - // Win98+, Win2000+ - // DWORD bV5Intent; - // DWORD bV5ProfileData; - // DWORD bV5ProfileSize; - // DWORD bV5Reserved; - $thisfile_bmp_header_raw['intent'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4)); - $offset += 4; - $thisfile_bmp_header_raw['profile_data_offset'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4)); - $offset += 4; - $thisfile_bmp_header_raw['profile_data_size'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4)); - $offset += 4; - $thisfile_bmp_header_raw['reserved3'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4)); - $offset += 4; - } - - } else { - - $ThisFileInfo['error'][] = 'Unknown BMP format in header.'; - return false; - - } - - - if ($ExtractPalette || $ExtractData) { - $PaletteEntries = 0; - if ($thisfile_bmp_header_raw['bits_per_pixel'] < 16) { - $PaletteEntries = pow(2, $thisfile_bmp_header_raw['bits_per_pixel']); - } elseif (isset($thisfile_bmp_header_raw['colors_used']) && ($thisfile_bmp_header_raw['colors_used'] > 0) && ($thisfile_bmp_header_raw['colors_used'] <= 256)) { - $PaletteEntries = $thisfile_bmp_header_raw['colors_used']; - } - if ($PaletteEntries > 0) { - $BMPpalette = fread($fd, 4 * $PaletteEntries); - $paletteoffset = 0; - for ($i = 0; $i < $PaletteEntries; $i++) { - // RGBQUAD - http://msdn.microsoft.com/library/en-us/gdi/bitmaps_5f8y.asp - // BYTE rgbBlue; - // BYTE rgbGreen; - // BYTE rgbRed; - // BYTE rgbReserved; - $blue = getid3_lib::LittleEndian2Int(substr($BMPpalette, $paletteoffset++, 1)); - $green = getid3_lib::LittleEndian2Int(substr($BMPpalette, $paletteoffset++, 1)); - $red = getid3_lib::LittleEndian2Int(substr($BMPpalette, $paletteoffset++, 1)); - if (($thisfile_bmp['type_os'] == 'OS/2') && ($thisfile_bmp['type_version'] == 1)) { - // no padding byte - } else { - $paletteoffset++; // padding byte - } - $thisfile_bmp['palette'][$i] = (($red << 16) | ($green << 8) | $blue); - } - } - } - - if ($ExtractData) { - fseek($fd, $thisfile_bmp_header_raw['data_offset'], SEEK_SET); - $RowByteLength = ceil(($thisfile_bmp_header_raw['width'] * ($thisfile_bmp_header_raw['bits_per_pixel'] / 8)) / 4) * 4; // round up to nearest DWORD boundry - $BMPpixelData = fread($fd, $thisfile_bmp_header_raw['height'] * $RowByteLength); - $pixeldataoffset = 0; - switch (@$thisfile_bmp_header_raw['compression']) { - - case 0: // BI_RGB - switch ($thisfile_bmp_header_raw['bits_per_pixel']) { - case 1: - for ($row = ($thisfile_bmp_header_raw['height'] - 1); $row >= 0; $row--) { - for ($col = 0; $col < $thisfile_bmp_header_raw['width']; $col = $col) { - $paletteindexbyte = ord($BMPpixelData{$pixeldataoffset++}); - for ($i = 7; $i >= 0; $i--) { - $paletteindex = ($paletteindexbyte & (0x01 << $i)) >> $i; - $thisfile_bmp['data'][$row][$col] = $thisfile_bmp['palette'][$paletteindex]; - $col++; - } - } - while (($pixeldataoffset % 4) != 0) { - // lines are padded to nearest DWORD - $pixeldataoffset++; - } - } - break; - - case 4: - for ($row = ($thisfile_bmp_header_raw['height'] - 1); $row >= 0; $row--) { - for ($col = 0; $col < $thisfile_bmp_header_raw['width']; $col = $col) { - $paletteindexbyte = ord($BMPpixelData{$pixeldataoffset++}); - for ($i = 1; $i >= 0; $i--) { - $paletteindex = ($paletteindexbyte & (0x0F << (4 * $i))) >> (4 * $i); - $thisfile_bmp['data'][$row][$col] = $thisfile_bmp['palette'][$paletteindex]; - $col++; - } - } - while (($pixeldataoffset % 4) != 0) { - // lines are padded to nearest DWORD - $pixeldataoffset++; - } - } - break; - - case 8: - for ($row = ($thisfile_bmp_header_raw['height'] - 1); $row >= 0; $row--) { - for ($col = 0; $col < $thisfile_bmp_header_raw['width']; $col++) { - $paletteindex = ord($BMPpixelData{$pixeldataoffset++}); - $thisfile_bmp['data'][$row][$col] = $thisfile_bmp['palette'][$paletteindex]; - } - while (($pixeldataoffset % 4) != 0) { - // lines are padded to nearest DWORD - $pixeldataoffset++; - } - } - break; - - case 24: - for ($row = ($thisfile_bmp_header_raw['height'] - 1); $row >= 0; $row--) { - for ($col = 0; $col < $thisfile_bmp_header_raw['width']; $col++) { - $thisfile_bmp['data'][$row][$col] = (ord($BMPpixelData{$pixeldataoffset+2}) << 16) | (ord($BMPpixelData{$pixeldataoffset+1}) << 8) | ord($BMPpixelData{$pixeldataoffset});
- $pixeldataoffset += 3;
- } - while (($pixeldataoffset % 4) != 0) { - // lines are padded to nearest DWORD - $pixeldataoffset++; - } - } - break; - - case 32: - for ($row = ($thisfile_bmp_header_raw['height'] - 1); $row >= 0; $row--) { - for ($col = 0; $col < $thisfile_bmp_header_raw['width']; $col++) { - $thisfile_bmp['data'][$row][$col] = (ord($BMPpixelData{$pixeldataoffset+3}) << 24) | (ord($BMPpixelData{$pixeldataoffset+2}) << 16) | (ord($BMPpixelData{$pixeldataoffset+1}) << 8) | ord($BMPpixelData{$pixeldataoffset});
- $pixeldataoffset += 4;
- } - while (($pixeldataoffset % 4) != 0) { - // lines are padded to nearest DWORD - $pixeldataoffset++; - } - } - break; - - case 16: - // ? - break; - - default: - $ThisFileInfo['error'][] = 'Unknown bits-per-pixel value ('.$thisfile_bmp_header_raw['bits_per_pixel'].') - cannot read pixel data'; - break; - } - break; - - - case 1: // BI_RLE8 - http://msdn.microsoft.com/library/en-us/gdi/bitmaps_6x0u.asp - switch ($thisfile_bmp_header_raw['bits_per_pixel']) { - case 8: - $pixelcounter = 0; - while ($pixeldataoffset < strlen($BMPpixelData)) { - $firstbyte = getid3_lib::LittleEndian2Int(substr($BMPpixelData, $pixeldataoffset++, 1)); - $secondbyte = getid3_lib::LittleEndian2Int(substr($BMPpixelData, $pixeldataoffset++, 1)); - if ($firstbyte == 0) { - - // escaped/absolute mode - the first byte of the pair can be set to zero to - // indicate an escape character that denotes the end of a line, the end of - // a bitmap, or a delta, depending on the value of the second byte. - switch ($secondbyte) { - case 0: - // end of line - // no need for special processing, just ignore - break; - - case 1: - // end of bitmap - $pixeldataoffset = strlen($BMPpixelData); // force to exit loop just in case - break; - - case 2: - // delta - The 2 bytes following the escape contain unsigned values - // indicating the horizontal and vertical offsets of the next pixel - // from the current position. - $colincrement = getid3_lib::LittleEndian2Int(substr($BMPpixelData, $pixeldataoffset++, 1)); - $rowincrement = getid3_lib::LittleEndian2Int(substr($BMPpixelData, $pixeldataoffset++, 1)); - $col = ($pixelcounter % $thisfile_bmp_header_raw['width']) + $colincrement; - $row = ($thisfile_bmp_header_raw['height'] - 1 - (($pixelcounter - $col) / $thisfile_bmp_header_raw['width'])) - $rowincrement; - $pixelcounter = ($row * $thisfile_bmp_header_raw['width']) + $col; - break; - - default: - // In absolute mode, the first byte is zero and the second byte is a - // value in the range 03H through FFH. The second byte represents the - // number of bytes that follow, each of which contains the color index - // of a single pixel. Each run must be aligned on a word boundary. - for ($i = 0; $i < $secondbyte; $i++) { - $paletteindex = getid3_lib::LittleEndian2Int(substr($BMPpixelData, $pixeldataoffset++, 1)); - $col = $pixelcounter % $thisfile_bmp_header_raw['width']; - $row = $thisfile_bmp_header_raw['height'] - 1 - (($pixelcounter - $col) / $thisfile_bmp_header_raw['width']); - $thisfile_bmp['data'][$row][$col] = $thisfile_bmp['palette'][$paletteindex]; - $pixelcounter++; - } - while (($pixeldataoffset % 2) != 0) { - // Each run must be aligned on a word boundary. - $pixeldataoffset++; - } - break; - } - - } else { - - // encoded mode - the first byte specifies the number of consecutive pixels - // to be drawn using the color index contained in the second byte. - for ($i = 0; $i < $firstbyte; $i++) { - $col = $pixelcounter % $thisfile_bmp_header_raw['width']; - $row = $thisfile_bmp_header_raw['height'] - 1 - (($pixelcounter - $col) / $thisfile_bmp_header_raw['width']); - $thisfile_bmp['data'][$row][$col] = $thisfile_bmp['palette'][$secondbyte]; - $pixelcounter++; - } - - } - } - break; - - default: - $ThisFileInfo['error'][] = 'Unknown bits-per-pixel value ('.$thisfile_bmp_header_raw['bits_per_pixel'].') - cannot read pixel data'; - break; - } - break; - - - - case 2: // BI_RLE4 - http://msdn.microsoft.com/library/en-us/gdi/bitmaps_6x0u.asp - switch ($thisfile_bmp_header_raw['bits_per_pixel']) { - case 4: - $pixelcounter = 0; - while ($pixeldataoffset < strlen($BMPpixelData)) { - $firstbyte = getid3_lib::LittleEndian2Int(substr($BMPpixelData, $pixeldataoffset++, 1)); - $secondbyte = getid3_lib::LittleEndian2Int(substr($BMPpixelData, $pixeldataoffset++, 1)); - if ($firstbyte == 0) { - - // escaped/absolute mode - the first byte of the pair can be set to zero to - // indicate an escape character that denotes the end of a line, the end of - // a bitmap, or a delta, depending on the value of the second byte. - switch ($secondbyte) { - case 0: - // end of line - // no need for special processing, just ignore - break; - - case 1: - // end of bitmap - $pixeldataoffset = strlen($BMPpixelData); // force to exit loop just in case - break; - - case 2: - // delta - The 2 bytes following the escape contain unsigned values - // indicating the horizontal and vertical offsets of the next pixel - // from the current position. - $colincrement = getid3_lib::LittleEndian2Int(substr($BMPpixelData, $pixeldataoffset++, 1)); - $rowincrement = getid3_lib::LittleEndian2Int(substr($BMPpixelData, $pixeldataoffset++, 1)); - $col = ($pixelcounter % $thisfile_bmp_header_raw['width']) + $colincrement; - $row = ($thisfile_bmp_header_raw['height'] - 1 - (($pixelcounter - $col) / $thisfile_bmp_header_raw['width'])) - $rowincrement; - $pixelcounter = ($row * $thisfile_bmp_header_raw['width']) + $col; - break; - - default: - // In absolute mode, the first byte is zero. The second byte contains the number - // of color indexes that follow. Subsequent bytes contain color indexes in their - // high- and low-order 4 bits, one color index for each pixel. In absolute mode, - // each run must be aligned on a word boundary. - unset($paletteindexes); - for ($i = 0; $i < ceil($secondbyte / 2); $i++) { - $paletteindexbyte = getid3_lib::LittleEndian2Int(substr($BMPpixelData, $pixeldataoffset++, 1)); - $paletteindexes[] = ($paletteindexbyte & 0xF0) >> 4; - $paletteindexes[] = ($paletteindexbyte & 0x0F); - } - while (($pixeldataoffset % 2) != 0) { - // Each run must be aligned on a word boundary. - $pixeldataoffset++; - } - - foreach ($paletteindexes as $paletteindex) { - $col = $pixelcounter % $thisfile_bmp_header_raw['width']; - $row = $thisfile_bmp_header_raw['height'] - 1 - (($pixelcounter - $col) / $thisfile_bmp_header_raw['width']); - $thisfile_bmp['data'][$row][$col] = $thisfile_bmp['palette'][$paletteindex]; - $pixelcounter++; - } - break; - } - - } else { - - // encoded mode - the first byte of the pair contains the number of pixels to be - // drawn using the color indexes in the second byte. The second byte contains two - // color indexes, one in its high-order 4 bits and one in its low-order 4 bits. - // The first of the pixels is drawn using the color specified by the high-order - // 4 bits, the second is drawn using the color in the low-order 4 bits, the third - // is drawn using the color in the high-order 4 bits, and so on, until all the - // pixels specified by the first byte have been drawn. - $paletteindexes[0] = ($secondbyte & 0xF0) >> 4; - $paletteindexes[1] = ($secondbyte & 0x0F); - for ($i = 0; $i < $firstbyte; $i++) { - $col = $pixelcounter % $thisfile_bmp_header_raw['width']; - $row = $thisfile_bmp_header_raw['height'] - 1 - (($pixelcounter - $col) / $thisfile_bmp_header_raw['width']); - $thisfile_bmp['data'][$row][$col] = $thisfile_bmp['palette'][$paletteindexes[($i % 2)]]; - $pixelcounter++; - } - - } - } - break; - - default: - $ThisFileInfo['error'][] = 'Unknown bits-per-pixel value ('.$thisfile_bmp_header_raw['bits_per_pixel'].') - cannot read pixel data'; - break; - } - break; - - - case 3: // BI_BITFIELDS - switch ($thisfile_bmp_header_raw['bits_per_pixel']) { - case 16: - case 32: - $redshift = 0; - $greenshift = 0; - $blueshift = 0; - while ((($thisfile_bmp_header_raw['red_mask'] >> $redshift) & 0x01) == 0) { - $redshift++; - } - while ((($thisfile_bmp_header_raw['green_mask'] >> $greenshift) & 0x01) == 0) { - $greenshift++; - } - while ((($thisfile_bmp_header_raw['blue_mask'] >> $blueshift) & 0x01) == 0) { - $blueshift++; - } - for ($row = ($thisfile_bmp_header_raw['height'] - 1); $row >= 0; $row--) { - for ($col = 0; $col < $thisfile_bmp_header_raw['width']; $col++) { - $pixelvalue = getid3_lib::LittleEndian2Int(substr($BMPpixelData, $pixeldataoffset, $thisfile_bmp_header_raw['bits_per_pixel'] / 8)); - $pixeldataoffset += $thisfile_bmp_header_raw['bits_per_pixel'] / 8; - - $red = intval(round(((($pixelvalue & $thisfile_bmp_header_raw['red_mask']) >> $redshift) / ($thisfile_bmp_header_raw['red_mask'] >> $redshift)) * 255)); - $green = intval(round(((($pixelvalue & $thisfile_bmp_header_raw['green_mask']) >> $greenshift) / ($thisfile_bmp_header_raw['green_mask'] >> $greenshift)) * 255)); - $blue = intval(round(((($pixelvalue & $thisfile_bmp_header_raw['blue_mask']) >> $blueshift) / ($thisfile_bmp_header_raw['blue_mask'] >> $blueshift)) * 255)); - $thisfile_bmp['data'][$row][$col] = (($red << 16) | ($green << 8) | ($blue)); - } - while (($pixeldataoffset % 4) != 0) { - // lines are padded to nearest DWORD - $pixeldataoffset++; - } - } - break; - - default: - $ThisFileInfo['error'][] = 'Unknown bits-per-pixel value ('.$thisfile_bmp_header_raw['bits_per_pixel'].') - cannot read pixel data'; - break; - } - break; - - - default: // unhandled compression type - $ThisFileInfo['error'][] = 'Unknown/unhandled compression type value ('.$thisfile_bmp_header_raw['compression'].') - cannot decompress pixel data'; - break; - } - } - - return true; - } - - - function PlotBMP(&$BMPinfo) { - $starttime = time(); - if (!isset($BMPinfo['bmp']['data']) || !is_array($BMPinfo['bmp']['data'])) { - echo 'ERROR: no pixel data<BR>'; - return false; - } - set_time_limit(intval(round($BMPinfo['resolution_x'] * $BMPinfo['resolution_y'] / 10000))); - if ($im = ImageCreateTrueColor($BMPinfo['resolution_x'], $BMPinfo['resolution_y'])) { - for ($row = 0; $row < $BMPinfo['resolution_y']; $row++) { - for ($col = 0; $col < $BMPinfo['resolution_x']; $col++) { - if (isset($BMPinfo['bmp']['data'][$row][$col])) { - $red = ($BMPinfo['bmp']['data'][$row][$col] & 0x00FF0000) >> 16; - $green = ($BMPinfo['bmp']['data'][$row][$col] & 0x0000FF00) >> 8; - $blue = ($BMPinfo['bmp']['data'][$row][$col] & 0x000000FF); - $pixelcolor = ImageColorAllocate($im, $red, $green, $blue); - ImageSetPixel($im, $col, $row, $pixelcolor); - } else { - //echo 'ERROR: no data for pixel '.$row.' x '.$col.'<BR>'; - //return false; - } - } - } - if (headers_sent()) { - echo 'plotted '.($BMPinfo['resolution_x'] * $BMPinfo['resolution_y']).' pixels in '.(time() - $starttime).' seconds<BR>'; - ImageDestroy($im); - exit; - } else { - header('Content-type: image/png'); - ImagePNG($im); - ImageDestroy($im); - return true; - } - } - return false; - } - - function BMPcompressionWindowsLookup($compressionid) { - static $BMPcompressionWindowsLookup = array( - 0 => 'BI_RGB', - 1 => 'BI_RLE8', - 2 => 'BI_RLE4', - 3 => 'BI_BITFIELDS', - 4 => 'BI_JPEG', - 5 => 'BI_PNG' - ); - return (isset($BMPcompressionWindowsLookup[$compressionid]) ? $BMPcompressionWindowsLookup[$compressionid] : 'invalid'); - } - - function BMPcompressionOS2Lookup($compressionid) { - static $BMPcompressionOS2Lookup = array( - 0 => 'BI_RGB', - 1 => 'BI_RLE8', - 2 => 'BI_RLE4', - 3 => 'Huffman 1D', - 4 => 'BI_RLE24', - ); - return (isset($BMPcompressionOS2Lookup[$compressionid]) ? $BMPcompressionOS2Lookup[$compressionid] : 'invalid'); - } - -} - - -?>
\ No newline at end of file diff --git a/getid3/module.graphic.gif.php b/getid3/module.graphic.gif.php deleted file mode 100644 index 986ada3..0000000 --- a/getid3/module.graphic.gif.php +++ /dev/null @@ -1,183 +0,0 @@ -<?php -///////////////////////////////////////////////////////////////// -/// getID3() by James Heinrich <info@getid3.org> // -// available at http://getid3.sourceforge.net // -// or http://www.getid3.org // -///////////////////////////////////////////////////////////////// -// See readme.txt for more details // -///////////////////////////////////////////////////////////////// -// // -// module.graphic.gif.php // -// module for analyzing GIF Image files // -// dependencies: NONE // -// /// -///////////////////////////////////////////////////////////////// - - -class getid3_gif -{ - - function getid3_gif(&$fd, &$ThisFileInfo) { - $ThisFileInfo['fileformat'] = 'gif'; - $ThisFileInfo['video']['dataformat'] = 'gif'; - $ThisFileInfo['video']['lossless'] = true; - $ThisFileInfo['video']['pixel_aspect_ratio'] = (float) 1; - - fseek($fd, $ThisFileInfo['avdataoffset'], SEEK_SET); - $GIFheader = fread($fd, 13); - $offset = 0; - - $ThisFileInfo['gif']['header']['raw']['identifier'] = substr($GIFheader, $offset, 3); - $offset += 3; - - if ($ThisFileInfo['gif']['header']['raw']['identifier'] != 'GIF') { - $ThisFileInfo['error'][] = 'Expecting "GIF" at offset '.$ThisFileInfo['avdataoffset'].', found "'.$ThisFileInfo['gif']['header']['raw']['identifier'].'"'; - unset($ThisFileInfo['fileformat']); - unset($ThisFileInfo['gif']); - return false; - } - - $ThisFileInfo['gif']['header']['raw']['version'] = substr($GIFheader, $offset, 3); - $offset += 3; - $ThisFileInfo['gif']['header']['raw']['width'] = getid3_lib::LittleEndian2Int(substr($GIFheader, $offset, 2)); - $offset += 2; - $ThisFileInfo['gif']['header']['raw']['height'] = getid3_lib::LittleEndian2Int(substr($GIFheader, $offset, 2)); - $offset += 2; - $ThisFileInfo['gif']['header']['raw']['flags'] = getid3_lib::LittleEndian2Int(substr($GIFheader, $offset, 1)); - $offset += 1; - $ThisFileInfo['gif']['header']['raw']['bg_color_index'] = getid3_lib::LittleEndian2Int(substr($GIFheader, $offset, 1)); - $offset += 1; - $ThisFileInfo['gif']['header']['raw']['aspect_ratio'] = getid3_lib::LittleEndian2Int(substr($GIFheader, $offset, 1)); - $offset += 1; - - $ThisFileInfo['video']['resolution_x'] = $ThisFileInfo['gif']['header']['raw']['width']; - $ThisFileInfo['video']['resolution_y'] = $ThisFileInfo['gif']['header']['raw']['height']; - $ThisFileInfo['gif']['version'] = $ThisFileInfo['gif']['header']['raw']['version']; - $ThisFileInfo['gif']['header']['flags']['global_color_table'] = (bool) ($ThisFileInfo['gif']['header']['raw']['flags'] & 0x80); - if ($ThisFileInfo['gif']['header']['raw']['flags'] & 0x80) { - // Number of bits per primary color available to the original image, minus 1 - $ThisFileInfo['gif']['header']['bits_per_pixel'] = 3 * ((($ThisFileInfo['gif']['header']['raw']['flags'] & 0x70) >> 4) + 1); - } else { - $ThisFileInfo['gif']['header']['bits_per_pixel'] = 0; - } - $ThisFileInfo['gif']['header']['flags']['global_color_sorted'] = (bool) ($ThisFileInfo['gif']['header']['raw']['flags'] & 0x40); - if ($ThisFileInfo['gif']['header']['flags']['global_color_table']) { - // the number of bytes contained in the Global Color Table. To determine that - // actual size of the color table, raise 2 to [the value of the field + 1] - $ThisFileInfo['gif']['header']['global_color_size'] = pow(2, ($ThisFileInfo['gif']['header']['raw']['flags'] & 0x07) + 1); - $ThisFileInfo['video']['bits_per_sample'] = ($ThisFileInfo['gif']['header']['raw']['flags'] & 0x07) + 1; - } else { - $ThisFileInfo['gif']['header']['global_color_size'] = 0; - } - if ($ThisFileInfo['gif']['header']['raw']['aspect_ratio'] != 0) { - // Aspect Ratio = (Pixel Aspect Ratio + 15) / 64 - $ThisFileInfo['gif']['header']['aspect_ratio'] = ($ThisFileInfo['gif']['header']['raw']['aspect_ratio'] + 15) / 64; - } - -// if ($ThisFileInfo['gif']['header']['flags']['global_color_table']) { -// $GIFcolorTable = fread($fd, 3 * $ThisFileInfo['gif']['header']['global_color_size']); -// $offset = 0; -// for ($i = 0; $i < $ThisFileInfo['gif']['header']['global_color_size']; $i++) { -// $red = getid3_lib::LittleEndian2Int(substr($GIFcolorTable, $offset++, 1)); -// $green = getid3_lib::LittleEndian2Int(substr($GIFcolorTable, $offset++, 1)); -// $blue = getid3_lib::LittleEndian2Int(substr($GIFcolorTable, $offset++, 1)); -// $ThisFileInfo['gif']['global_color_table'][$i] = (($red << 16) | ($green << 8) | ($blue)); -// } -// } -// -// // Image Descriptor -// while (!feof($fd)) { -// $NextBlockTest = fread($fd, 1); -// switch ($NextBlockTest) { -// -// case ',': // ',' - Image separator character -// -// $ImageDescriptorData = $NextBlockTest.fread($fd, 9); -// $ImageDescriptor = array(); -// $ImageDescriptor['image_left'] = getid3_lib::LittleEndian2Int(substr($ImageDescriptorData, 1, 2)); -// $ImageDescriptor['image_top'] = getid3_lib::LittleEndian2Int(substr($ImageDescriptorData, 3, 2)); -// $ImageDescriptor['image_width'] = getid3_lib::LittleEndian2Int(substr($ImageDescriptorData, 5, 2)); -// $ImageDescriptor['image_height'] = getid3_lib::LittleEndian2Int(substr($ImageDescriptorData, 7, 2)); -// $ImageDescriptor['flags_raw'] = getid3_lib::LittleEndian2Int(substr($ImageDescriptorData, 9, 1)); -// $ImageDescriptor['flags']['use_local_color_map'] = (bool) ($ImageDescriptor['flags_raw'] & 0x80); -// $ImageDescriptor['flags']['image_interlaced'] = (bool) ($ImageDescriptor['flags_raw'] & 0x40); -// $ThisFileInfo['gif']['image_descriptor'][] = $ImageDescriptor; -// -// if ($ImageDescriptor['flags']['use_local_color_map']) { -// -// $ThisFileInfo['warning'][] = 'This version of getID3() cannot parse local color maps for GIFs'; -// return true; -// -// } -//echo 'Start of raster data: '.ftell($fd).'<BR>'; -// $RasterData = array(); -// $RasterData['code_size'] = getid3_lib::LittleEndian2Int(fread($fd, 1)); -// $RasterData['block_byte_count'] = getid3_lib::LittleEndian2Int(fread($fd, 1)); -// $ThisFileInfo['gif']['raster_data'][count($ThisFileInfo['gif']['image_descriptor']) - 1] = $RasterData; -// -// $CurrentCodeSize = $RasterData['code_size'] + 1; -// for ($i = 0; $i < pow(2, $RasterData['code_size']); $i++) { -// $DefaultDataLookupTable[$i] = chr($i); -// } -// $DefaultDataLookupTable[pow(2, $RasterData['code_size']) + 0] = ''; // Clear Code -// $DefaultDataLookupTable[pow(2, $RasterData['code_size']) + 1] = ''; // End Of Image Code -// -// -// $NextValue = $this->GetLSBits($fd, $CurrentCodeSize); -// echo 'Clear Code: '.$NextValue.'<BR>'; -// -// $NextValue = $this->GetLSBits($fd, $CurrentCodeSize); -// echo 'First Color: '.$NextValue.'<BR>'; -// -// $Prefix = $NextValue; -//$i = 0; -// while ($i++ < 20) { -// $NextValue = $this->GetLSBits($fd, $CurrentCodeSize); -// echo $NextValue.'<BR>'; -// } -//return true; -// break; -// -// case '!': -// // GIF Extension Block -// $ExtensionBlockData = $NextBlockTest.fread($fd, 2); -// $ExtensionBlock = array(); -// $ExtensionBlock['function_code'] = getid3_lib::LittleEndian2Int(substr($ExtensionBlockData, 1, 1)); -// $ExtensionBlock['byte_length'] = getid3_lib::LittleEndian2Int(substr($ExtensionBlockData, 2, 1)); -// $ExtensionBlock['data'] = fread($fd, $ExtensionBlock['byte_length']); -// $ThisFileInfo['gif']['extension_blocks'][] = $ExtensionBlock; -// break; -// -// case ';': -// $ThisFileInfo['gif']['terminator_offset'] = ftell($fd) - 1; -// // GIF Terminator -// break; -// -// default: -// break; -// -// -// } -// } - - return true; - } - - - function GetLSBits($fd, $bits) { - static $bitbuffer = ''; - while (strlen($bitbuffer) < $bits) { -//echo 'Read another byte: '.ftell($fd).'<BR>'; - $bitbuffer = str_pad(decbin(ord(fread($fd, 1))), 8, '0', STR_PAD_LEFT).$bitbuffer; - } - - $value = bindec(substr($bitbuffer, 0 - $bits)); - $bitbuffer = substr($bitbuffer, 0, 0 - $bits); - - return $value; - } - -} - - -?>
\ No newline at end of file diff --git a/getid3/module.graphic.jpg.php b/getid3/module.graphic.jpg.php deleted file mode 100644 index cf249de..0000000 --- a/getid3/module.graphic.jpg.php +++ /dev/null @@ -1,249 +0,0 @@ -<?php -///////////////////////////////////////////////////////////////// -/// getID3() by James Heinrich <info@getid3.org> // -// available at http://getid3.sourceforge.net // -// or http://www.getid3.org // -///////////////////////////////////////////////////////////////// -// See readme.txt for more details // -///////////////////////////////////////////////////////////////// -// // -// module.graphic.jpg.php // -// module for analyzing JPEG Image files // -// dependencies: NONE // -// /// -///////////////////////////////////////////////////////////////// - - -class getid3_jpg -{ - - - function getid3_jpg(&$fd, &$ThisFileInfo) { - $ThisFileInfo['fileformat'] = 'jpg'; - $ThisFileInfo['video']['dataformat'] = 'jpg'; - $ThisFileInfo['video']['lossless'] = false; - $ThisFileInfo['video']['bits_per_sample'] = 24; - $ThisFileInfo['video']['pixel_aspect_ratio'] = (float) 1; - - fseek($fd, $ThisFileInfo['avdataoffset'], SEEK_SET); - - $imageinfo = array(); - list($width, $height, $type) = getid3_lib::GetDataImageSize(fread($fd, $ThisFileInfo['filesize']), $imageinfo); - - if (isset($imageinfo['APP13'])) { - // http://php.net/iptcparse - // http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/IPTC.html - $iptc_parsed = iptcparse($imageinfo['APP13']); - if (is_array($iptc_parsed)) { - foreach ($iptc_parsed as $iptc_key_raw => $iptc_values) { - list($iptc_record, $iptc_tagkey) = explode('#', $iptc_key_raw); - $iptc_tagkey = intval(ltrim($iptc_tagkey, '0')); - foreach ($iptc_values as $key => $value) { - @$ThisFileInfo['iptc'][$this->IPTCrecordName($iptc_record)][$this->IPTCrecordTagName($iptc_record, $iptc_tagkey)][] = $value; - } - } - }
-//echo '<pre>'.htmlentities(print_r($iptc_parsed, true)).'</pre>'; - } - - switch ($type) { - case 2: // JPEG - $ThisFileInfo['video']['resolution_x'] = $width; - $ThisFileInfo['video']['resolution_y'] = $height; - - if (version_compare(phpversion(), '4.2.0', '>=')) { - - if (function_exists('exif_read_data')) { - - ob_start(); - $ThisFileInfo['jpg']['exif'] = exif_read_data($ThisFileInfo['filenamepath'], '', true, false); - $errors = ob_get_contents(); - if ($errors) { - $ThisFileInfo['warning'][] = strip_tags($errors); - unset($ThisFileInfo['jpg']['exif']); - } - ob_end_clean(); - - } else { - - $ThisFileInfo['warning'][] = 'EXIF parsing only available when '.(GETID3_OS_ISWINDOWS ? 'php_exif.dll enabled' : 'compiled with --enable-exif'); - - } - - } else { - - $ThisFileInfo['warning'][] = 'EXIF parsing only available in PHP v4.2.0 and higher compiled with --enable-exif (or php_exif.dll enabled for Windows). You are using PHP v'.phpversion(); - - } - - return true; - break; - - default: - break; - } - - unset($ThisFileInfo['fileformat']); - return false; - } - - - function IPTCrecordName($iptc_record) { - // http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/IPTC.html - static $IPTCrecordName = array(); - if (empty($IPTCrecordName)) { - $IPTCrecordName = array( - 1 => 'IPTCEnvelope', - 2 => 'IPTCApplication', - 3 => 'IPTCNewsPhoto', - 7 => 'IPTCPreObjectData', - 8 => 'IPTCObjectData', - 9 => 'IPTCPostObjectData', - ); - } - return (isset($IPTCrecordName[$iptc_record]) ? $IPTCrecordName[$iptc_record] : ''); - } - - - function IPTCrecordTagName($iptc_record, $iptc_tagkey) { - // http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/IPTC.html - static $IPTCrecordTagName = array(); - if (empty($IPTCrecordTagName)) { - $IPTCrecordTagName = array( - 1 => array( // IPTC EnvelopeRecord Tags - 0 => 'EnvelopeRecordVersion', - 5 => 'Destination', - 20 => 'FileFormat', - 22 => 'FileVersion', - 30 => 'ServiceIdentifier', - 40 => 'EnvelopeNumber', - 50 => 'ProductID', - 60 => 'EnvelopePriority', - 70 => 'DateSent', - 80 => 'TimeSent', - 90 => 'CodedCharacterSet', - 100 => 'UniqueObjectName', - 120 => 'ARMIdentifier', - 122 => 'ARMVersion', - ), - 2 => array( // IPTC ApplicationRecord Tags - 0 => 'ApplicationRecordVersion', - 3 => 'ObjectTypeReference', - 4 => 'ObjectAttributeReference', - 5 => 'ObjectName', - 7 => 'EditStatus', - 8 => 'EditorialUpdate', - 10 => 'Urgency', - 12 => 'SubjectReference', - 15 => 'Category', - 20 => 'SupplementalCategories', - 22 => 'FixtureIdentifier', - 25 => 'Keywords', - 26 => 'ContentLocationCode', - 27 => 'ContentLocationName', - 30 => 'ReleaseDate', - 35 => 'ReleaseTime', - 37 => 'ExpirationDate', - 38 => 'ExpirationTime', - 40 => 'SpecialInstructions', - 42 => 'ActionAdvised', - 45 => 'ReferenceService', - 47 => 'ReferenceDate', - 50 => 'ReferenceNumber', - 55 => 'DateCreated', - 60 => 'TimeCreated', - 62 => 'DigitalCreationDate', - 63 => 'DigitalCreationTime', - 65 => 'OriginatingProgram', - 70 => 'ProgramVersion', - 75 => 'ObjectCycle', - 80 => 'By-line', - 85 => 'By-lineTitle', - 90 => 'City', - 92 => 'Sub-location', - 95 => 'Province-State', - 100 => 'Country-PrimaryLocationCode', - 101 => 'Country-PrimaryLocationName', - 103 => 'OriginalTransmissionReference', - 105 => 'Headline', - 110 => 'Credit', - 115 => 'Source', - 116 => 'CopyrightNotice', - 118 => 'Contact', - 120 => 'Caption-Abstract', - 121 => 'LocalCaption', - 122 => 'Writer-Editor', - 125 => 'RasterizedCaption', - 130 => 'ImageType', - 131 => 'ImageOrientation', - 135 => 'LanguageIdentifier', - 150 => 'AudioType', - 151 => 'AudioSamplingRate', - 152 => 'AudioSamplingResolution', - 153 => 'AudioDuration', - 154 => 'AudioOutcue', - 184 => 'JobID', - 185 => 'MasterDocumentID', - 186 => 'ShortDocumentID', - 187 => 'UniqueDocumentID', - 188 => 'OwnerID', - 200 => 'ObjectPreviewFileFormat', - 201 => 'ObjectPreviewFileVersion', - 202 => 'ObjectPreviewData', - 221 => 'Prefs', - 225 => 'ClassifyState', - 228 => 'SimilarityIndex', - 230 => 'DocumentNotes', - 231 => 'DocumentHistory', - 232 => 'ExifCameraInfo', - ), - 3 => array( // IPTC NewsPhoto Tags - 0 => 'NewsPhotoVersion', - 10 => 'IPTCPictureNumber', - 20 => 'IPTCImageWidth', - 30 => 'IPTCImageHeight', - 40 => 'IPTCPixelWidth', - 50 => 'IPTCPixelHeight', - 55 => 'SupplementalType', - 60 => 'ColorRepresentation', - 64 => 'InterchangeColorSpace', - 65 => 'ColorSequence', - 66 => 'ICC_Profile', - 70 => 'ColorCalibrationMatrix', - 80 => 'LookupTable', - 84 => 'NumIndexEntries', - 85 => 'ColorPalette', - 86 => 'IPTCBitsPerSample', - 90 => 'SampleStructure', - 100 => 'ScanningDirection', - 102 => 'IPTCImageRotation', - 110 => 'DataCompressionMethod', - 120 => 'QuantizationMethod', - 125 => 'EndPoints', - 130 => 'ExcursionTolerance', - 135 => 'BitsPerComponent', - 140 => 'MaximumDensityRange', - 145 => 'GammaCompensatedValue', - ), - 7 => array( // IPTC PreObjectData Tags - 10 => 'SizeMode', - 20 => 'MaxSubfileSize', - 90 => 'ObjectSizeAnnounced', - 95 => 'MaximumObjectSize', - ), - 8 => array( // IPTC ObjectData Tags - 10 => 'SubFile', - ), - 9 => array( // IPTC PostObjectData Tags - 10 => 'ConfirmedObjectSize', - ), - ); - - } - return (isset($IPTCrecordTagName[$iptc_record][$iptc_tagkey]) ? $IPTCrecordTagName[$iptc_record][$iptc_tagkey] : $iptc_tagkey); - } - -} - - -?>
\ No newline at end of file diff --git a/getid3/module.graphic.pcd.php b/getid3/module.graphic.pcd.php deleted file mode 100644 index 60efabd..0000000 --- a/getid3/module.graphic.pcd.php +++ /dev/null @@ -1,130 +0,0 @@ -<?php -///////////////////////////////////////////////////////////////// -/// getID3() by James Heinrich <info@getid3.org> // -// available at http://getid3.sourceforge.net // -// or http://www.getid3.org // -///////////////////////////////////////////////////////////////// -// See readme.txt for more details // -///////////////////////////////////////////////////////////////// -// // -// module.graphic.pcd.php // -// module for analyzing PhotoCD (PCD) Image files // -// dependencies: NONE // -// /// -///////////////////////////////////////////////////////////////// - - -class getid3_pcd -{ - function getid3_pcd(&$fd, &$ThisFileInfo, $ExtractData=0) { - $ThisFileInfo['fileformat'] = 'pcd'; - $ThisFileInfo['video']['dataformat'] = 'pcd'; - $ThisFileInfo['video']['lossless'] = false; - - - fseek($fd, $ThisFileInfo['avdataoffset'] + 72, SEEK_SET); - - $PCDflags = fread($fd, 1); - $PCDisVertical = ((ord($PCDflags) & 0x01) ? true : false); - - - if ($PCDisVertical) { - $ThisFileInfo['video']['resolution_x'] = 3072; - $ThisFileInfo['video']['resolution_y'] = 2048; - } else { - $ThisFileInfo['video']['resolution_x'] = 2048; - $ThisFileInfo['video']['resolution_y'] = 3072; - } - - - if ($ExtractData > 3) { - - $ThisFileInfo['error'][] = 'Cannot extract PSD image data for detail levels above BASE (3)'; - - } elseif ($ExtractData > 0) { - - $PCD_levels[1] = array( 192, 128, 0x02000); // BASE/16 - $PCD_levels[2] = array( 384, 256, 0x0B800); // BASE/4 - $PCD_levels[3] = array( 768, 512, 0x30000); // BASE - //$PCD_levels[4] = array(1536, 1024, ??); // BASE*4 - encrypted with Kodak-proprietary compression/encryption - //$PCD_levels[5] = array(3072, 2048, ??); // BASE*16 - encrypted with Kodak-proprietary compression/encryption - //$PCD_levels[6] = array(6144, 4096, ??); // BASE*64 - encrypted with Kodak-proprietary compression/encryption; PhotoCD-Pro only - - list($PCD_width, $PCD_height, $PCD_dataOffset) = $PCD_levels[3]; - - fseek($fd, $ThisFileInfo['avdataoffset'] + $PCD_dataOffset, SEEK_SET); - - for ($y = 0; $y < $PCD_height; $y += 2) { - // The image-data of these subtypes start at the respective offsets of 02000h, 0b800h and 30000h. - // To decode the YcbYr to the more usual RGB-code, three lines of data have to be read, each - // consisting of ‘w’ bytes, where ‘w’ is the width of the image-subtype. The first ‘w’ bytes and - // the first half of the third ‘w’ bytes contain data for the first RGB-line, the second ‘w’ bytes - // and the second half of the third ‘w’ bytes contain data for a second RGB-line. - - $PCD_data_Y1 = fread($fd, $PCD_width); - $PCD_data_Y2 = fread($fd, $PCD_width); - $PCD_data_Cb = fread($fd, intval(round($PCD_width / 2))); - $PCD_data_Cr = fread($fd, intval(round($PCD_width / 2))); - - for ($x = 0; $x < $PCD_width; $x++) { - if ($PCDisVertical) { - $ThisFileInfo['pcd']['data'][$PCD_width - $x][$y] = $this->YCbCr2RGB(ord($PCD_data_Y1{$x}), ord($PCD_data_Cb{floor($x / 2)}), ord($PCD_data_Cr{floor($x / 2)})); - $ThisFileInfo['pcd']['data'][$PCD_width - $x][$y + 1] = $this->YCbCr2RGB(ord($PCD_data_Y2{$x}), ord($PCD_data_Cb{floor($x / 2)}), ord($PCD_data_Cr{floor($x / 2)})); - } else { - $ThisFileInfo['pcd']['data'][$y][$x] = $this->YCbCr2RGB(ord($PCD_data_Y1{$x}), ord($PCD_data_Cb{floor($x / 2)}), ord($PCD_data_Cr{floor($x / 2)})); - $ThisFileInfo['pcd']['data'][$y + 1][$x] = $this->YCbCr2RGB(ord($PCD_data_Y2{$x}), ord($PCD_data_Cb{floor($x / 2)}), ord($PCD_data_Cr{floor($x / 2)})); - } - } - } - - // Example for plotting extracted data - //getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio.ac3.php', __FILE__, true); - //if ($PCDisVertical) { - // $BMPinfo['resolution_x'] = $PCD_height; - // $BMPinfo['resolution_y'] = $PCD_width; - //} else { - // $BMPinfo['resolution_x'] = $PCD_width; - // $BMPinfo['resolution_y'] = $PCD_height; - //} - //$BMPinfo['bmp']['data'] = $ThisFileInfo['pcd']['data']; - //getid3_bmp::PlotBMP($BMPinfo); - //exit; - - } - - } - - function YCbCr2RGB($Y, $Cb, $Cr) { - static $YCbCr_constants = array(); - if (empty($YCbCr_constants)) { - $YCbCr_constants['red']['Y'] = 0.0054980 * 256; - $YCbCr_constants['red']['Cb'] = 0.0000000 * 256; - $YCbCr_constants['red']['Cr'] = 0.0051681 * 256; - $YCbCr_constants['green']['Y'] = 0.0054980 * 256; - $YCbCr_constants['green']['Cb'] = -0.0015446 * 256; - $YCbCr_constants['green']['Cr'] = -0.0026325 * 256; - $YCbCr_constants['blue']['Y'] = 0.0054980 * 256; - $YCbCr_constants['blue']['Cb'] = 0.0079533 * 256; - $YCbCr_constants['blue']['Cr'] = 0.0000000 * 256; - } - - $RGBcolor = array('red'=>0, 'green'=>0, 'blue'=>0); - foreach ($RGBcolor as $rgbname => $dummy) { - $RGBcolor[$rgbname] = max(0, - min(255, - intval( - round( - ($YCbCr_constants[$rgbname]['Y'] * $Y) + - ($YCbCr_constants[$rgbname]['Cb'] * ($Cb - 156)) + - ($YCbCr_constants[$rgbname]['Cr'] * ($Cr - 137)) - ) - ) - ) - ); - } - return (($RGBcolor['red'] * 65536) + ($RGBcolor['green'] * 256) + $RGBcolor['blue']); - } - -} - -?>
\ No newline at end of file diff --git a/getid3/module.graphic.png.php b/getid3/module.graphic.png.php deleted file mode 100644 index b5b3d35..0000000 --- a/getid3/module.graphic.png.php +++ /dev/null @@ -1,519 +0,0 @@ -<?php -///////////////////////////////////////////////////////////////// -/// getID3() by James Heinrich <info@getid3.org> // -// available at http://getid3.sourceforge.net // -// or http://www.getid3.org // -///////////////////////////////////////////////////////////////// -// See readme.txt for more details // -///////////////////////////////////////////////////////////////// -// // -// module.graphic.png.php // -// module for analyzing PNG Image files // -// dependencies: NONE // -// /// -///////////////////////////////////////////////////////////////// - - -class getid3_png -{ - - function getid3_png(&$fd, &$ThisFileInfo) { - - // shortcut - $ThisFileInfo['png'] = array(); - $thisfile_png = &$ThisFileInfo['png']; - - $ThisFileInfo['fileformat'] = 'png'; - $ThisFileInfo['video']['dataformat'] = 'png'; - $ThisFileInfo['video']['lossless'] = false; - - fseek($fd, $ThisFileInfo['avdataoffset'], SEEK_SET); - $PNGfiledata = fread($fd, GETID3_FREAD_BUFFER_SIZE); - $offset = 0; - - $PNGidentifier = substr($PNGfiledata, $offset, 8); // $89 $50 $4E $47 $0D $0A $1A $0A - $offset += 8; - - if ($PNGidentifier != "\x89\x50\x4E\x47\x0D\x0A\x1A\x0A") { - $ThisFileInfo['error'][] = 'First 8 bytes of file ('.getid3_lib::PrintHexBytes($PNGidentifier).') did not match expected PNG identifier'; - unset($ThisFileInfo['fileformat']); - return false; - } - - while (((ftell($fd) - (strlen($PNGfiledata) - $offset)) < $ThisFileInfo['filesize'])) { - $chunk['data_length'] = getid3_lib::BigEndian2Int(substr($PNGfiledata, $offset, 4)); - $offset += 4; - while (((strlen($PNGfiledata) - $offset) < ($chunk['data_length'] + 4)) && (ftell($fd) < $ThisFileInfo['filesize'])) { - $PNGfiledata .= fread($fd, GETID3_FREAD_BUFFER_SIZE); - } - $chunk['type_text'] = substr($PNGfiledata, $offset, 4); - $offset += 4; - $chunk['type_raw'] = getid3_lib::BigEndian2Int($chunk['type_text']); - $chunk['data'] = substr($PNGfiledata, $offset, $chunk['data_length']); - $offset += $chunk['data_length']; - $chunk['crc'] = getid3_lib::BigEndian2Int(substr($PNGfiledata, $offset, 4)); - $offset += 4; - - $chunk['flags']['ancilliary'] = (bool) ($chunk['type_raw'] & 0x20000000); - $chunk['flags']['private'] = (bool) ($chunk['type_raw'] & 0x00200000); - $chunk['flags']['reserved'] = (bool) ($chunk['type_raw'] & 0x00002000); - $chunk['flags']['safe_to_copy'] = (bool) ($chunk['type_raw'] & 0x00000020); - - // shortcut - $thisfile_png[$chunk['type_text']] = array(); - $thisfile_png_chunk_type_text = &$thisfile_png[$chunk['type_text']]; - - switch ($chunk['type_text']) { - - case 'IHDR': // Image Header - $thisfile_png_chunk_type_text['header'] = $chunk; - $thisfile_png_chunk_type_text['width'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 0, 4)); - $thisfile_png_chunk_type_text['height'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 4, 4)); - $thisfile_png_chunk_type_text['raw']['bit_depth'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 8, 1)); - $thisfile_png_chunk_type_text['raw']['color_type'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 9, 1)); - $thisfile_png_chunk_type_text['raw']['compression_method'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 10, 1)); - $thisfile_png_chunk_type_text['raw']['filter_method'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 11, 1)); - $thisfile_png_chunk_type_text['raw']['interlace_method'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 12, 1)); - - $thisfile_png_chunk_type_text['compression_method_text'] = $this->PNGcompressionMethodLookup($thisfile_png_chunk_type_text['raw']['compression_method']); - $thisfile_png_chunk_type_text['color_type']['palette'] = (bool) ($thisfile_png_chunk_type_text['raw']['color_type'] & 0x01); - $thisfile_png_chunk_type_text['color_type']['true_color'] = (bool) ($thisfile_png_chunk_type_text['raw']['color_type'] & 0x02); - $thisfile_png_chunk_type_text['color_type']['alpha'] = (bool) ($thisfile_png_chunk_type_text['raw']['color_type'] & 0x04); - - $ThisFileInfo['video']['resolution_x'] = $thisfile_png_chunk_type_text['width']; - $ThisFileInfo['video']['resolution_y'] = $thisfile_png_chunk_type_text['height']; - - $ThisFileInfo['video']['bits_per_sample'] = $this->IHDRcalculateBitsPerSample($thisfile_png_chunk_type_text['raw']['color_type'], $thisfile_png_chunk_type_text['raw']['bit_depth']); - break; - - - case 'PLTE': // Palette - $thisfile_png_chunk_type_text['header'] = $chunk; - $paletteoffset = 0; - for ($i = 0; $i <= 255; $i++) { - //$thisfile_png_chunk_type_text['red'][$i] = getid3_lib::BigEndian2Int(substr($chunk['data'], $paletteoffset++, 1)); - //$thisfile_png_chunk_type_text['green'][$i] = getid3_lib::BigEndian2Int(substr($chunk['data'], $paletteoffset++, 1)); - //$thisfile_png_chunk_type_text['blue'][$i] = getid3_lib::BigEndian2Int(substr($chunk['data'], $paletteoffset++, 1)); - $red = getid3_lib::BigEndian2Int(substr($chunk['data'], $paletteoffset++, 1)); - $green = getid3_lib::BigEndian2Int(substr($chunk['data'], $paletteoffset++, 1)); - $blue = getid3_lib::BigEndian2Int(substr($chunk['data'], $paletteoffset++, 1)); - $thisfile_png_chunk_type_text[$i] = (($red << 16) | ($green << 8) | ($blue)); - } - break; - - - case 'tRNS': // Transparency - $thisfile_png_chunk_type_text['header'] = $chunk; - switch ($thisfile_png['IHDR']['raw']['color_type']) { - case 0: - $thisfile_png_chunk_type_text['transparent_color_gray'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 0, 2)); - break; - - case 2: - $thisfile_png_chunk_type_text['transparent_color_red'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 0, 2)); - $thisfile_png_chunk_type_text['transparent_color_green'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 2, 2)); - $thisfile_png_chunk_type_text['transparent_color_blue'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 4, 2)); - break; - - case 3: - for ($i = 0; $i < strlen($chunk['data']); $i++) { - $thisfile_png_chunk_type_text['palette_opacity'][$i] = getid3_lib::BigEndian2Int(substr($chunk['data'], $i, 1)); - } - break; - - case 4: - case 6: - $ThisFileInfo['error'][] = 'Invalid color_type in tRNS chunk: '.$thisfile_png['IHDR']['raw']['color_type']; - - default: - $ThisFileInfo['warning'][] = 'Unhandled color_type in tRNS chunk: '.$thisfile_png['IHDR']['raw']['color_type']; - break; - } - break; - - - case 'gAMA': // Image Gamma - $thisfile_png_chunk_type_text['header'] = $chunk; - $thisfile_png_chunk_type_text['gamma'] = getid3_lib::BigEndian2Int($chunk['data']) / 100000; - break; - - - case 'cHRM': // Primary Chromaticities - $thisfile_png_chunk_type_text['header'] = $chunk; - $thisfile_png_chunk_type_text['white_x'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 0, 4)) / 100000; - $thisfile_png_chunk_type_text['white_y'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 4, 4)) / 100000; - $thisfile_png_chunk_type_text['red_y'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 8, 4)) / 100000; - $thisfile_png_chunk_type_text['red_y'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 12, 4)) / 100000; - $thisfile_png_chunk_type_text['green_y'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 16, 4)) / 100000; - $thisfile_png_chunk_type_text['green_y'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 20, 4)) / 100000; - $thisfile_png_chunk_type_text['blue_y'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 24, 4)) / 100000; - $thisfile_png_chunk_type_text['blue_y'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 28, 4)) / 100000; - break; - - - case 'sRGB': // Standard RGB Color Space - $thisfile_png_chunk_type_text['header'] = $chunk; - $thisfile_png_chunk_type_text['reindering_intent'] = getid3_lib::BigEndian2Int($chunk['data']); - $thisfile_png_chunk_type_text['reindering_intent_text'] = $this->PNGsRGBintentLookup($thisfile_png_chunk_type_text['reindering_intent']); - break; - - - case 'iCCP': // Embedded ICC Profile - $thisfile_png_chunk_type_text['header'] = $chunk; - list($profilename, $compressiondata) = explode("\x00", $chunk['data'], 2); - $thisfile_png_chunk_type_text['profile_name'] = $profilename; - $thisfile_png_chunk_type_text['compression_method'] = getid3_lib::BigEndian2Int(substr($compressiondata, 0, 1)); - $thisfile_png_chunk_type_text['compression_profile'] = substr($compressiondata, 1); - - $thisfile_png_chunk_type_text['compression_method_text'] = $this->PNGcompressionMethodLookup($thisfile_png_chunk_type_text['compression_method']); - break; - - - case 'tEXt': // Textual Data - $thisfile_png_chunk_type_text['header'] = $chunk; - list($keyword, $text) = explode("\x00", $chunk['data'], 2); - $thisfile_png_chunk_type_text['keyword'] = $keyword; - $thisfile_png_chunk_type_text['text'] = $text; - - $thisfile_png['comments'][$thisfile_png_chunk_type_text['keyword']][] = $thisfile_png_chunk_type_text['text']; - break; - - - case 'zTXt': // Compressed Textual Data - $thisfile_png_chunk_type_text['header'] = $chunk; - list($keyword, $otherdata) = explode("\x00", $chunk['data'], 2); - $thisfile_png_chunk_type_text['keyword'] = $keyword; - $thisfile_png_chunk_type_text['compression_method'] = getid3_lib::BigEndian2Int(substr($otherdata, 0, 1)); - $thisfile_png_chunk_type_text['compressed_text'] = substr($otherdata, 1); - $thisfile_png_chunk_type_text['compression_method_text'] = $this->PNGcompressionMethodLookup($thisfile_png_chunk_type_text['compression_method']); - switch ($thisfile_png_chunk_type_text['compression_method']) { - case 0: - $thisfile_png_chunk_type_text['text'] = gzuncompress($thisfile_png_chunk_type_text['compressed_text']); - break; - - default: - // unknown compression method - break; - } - - if (isset($thisfile_png_chunk_type_text['text'])) { - $thisfile_png['comments'][$thisfile_png_chunk_type_text['keyword']][] = $thisfile_png_chunk_type_text['text']; - } - break; - - - case 'iTXt': // International Textual Data - $thisfile_png_chunk_type_text['header'] = $chunk; - list($keyword, $otherdata) = explode("\x00", $chunk['data'], 2); - $thisfile_png_chunk_type_text['keyword'] = $keyword; - $thisfile_png_chunk_type_text['compression'] = (bool) getid3_lib::BigEndian2Int(substr($otherdata, 0, 1)); - $thisfile_png_chunk_type_text['compression_method'] = getid3_lib::BigEndian2Int(substr($otherdata, 1, 1)); - $thisfile_png_chunk_type_text['compression_method_text'] = $this->PNGcompressionMethodLookup($thisfile_png_chunk_type_text['compression_method']); - list($languagetag, $translatedkeyword, $text) = explode("\x00", substr($otherdata, 2), 3); - $thisfile_png_chunk_type_text['language_tag'] = $languagetag; - $thisfile_png_chunk_type_text['translated_keyword'] = $translatedkeyword; - - if ($thisfile_png_chunk_type_text['compression']) { - - switch ($thisfile_png_chunk_type_text['compression_method']) { - case 0: - $thisfile_png_chunk_type_text['text'] = gzuncompress($text); - break; - - default: - // unknown compression method - break; - } - - } else { - - $thisfile_png_chunk_type_text['text'] = $text; - - } - - if (isset($thisfile_png_chunk_type_text['text'])) { - $thisfile_png['comments'][$thisfile_png_chunk_type_text['keyword']][] = $thisfile_png_chunk_type_text['text']; - } - break; - - - case 'bKGD': // Background Color - $thisfile_png_chunk_type_text['header'] = $chunk; - switch ($thisfile_png['IHDR']['raw']['color_type']) { - case 0: - case 4: - $thisfile_png_chunk_type_text['background_gray'] = getid3_lib::BigEndian2Int($chunk['data']); - break; - - case 2: - case 6: - $thisfile_png_chunk_type_text['background_red'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 0 * $thisfile_png['IHDR']['raw']['bit_depth'], $thisfile_png['IHDR']['raw']['bit_depth'])); - $thisfile_png_chunk_type_text['background_green'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 1 * $thisfile_png['IHDR']['raw']['bit_depth'], $thisfile_png['IHDR']['raw']['bit_depth'])); - $thisfile_png_chunk_type_text['background_blue'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 2 * $thisfile_png['IHDR']['raw']['bit_depth'], $thisfile_png['IHDR']['raw']['bit_depth'])); - break; - - case 3: - $thisfile_png_chunk_type_text['background_index'] = getid3_lib::BigEndian2Int($chunk['data']); - break; - - default: - break; - } - break; - - - case 'pHYs': // Physical Pixel Dimensions - $thisfile_png_chunk_type_text['header'] = $chunk; - $thisfile_png_chunk_type_text['pixels_per_unit_x'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 0, 4)); - $thisfile_png_chunk_type_text['pixels_per_unit_y'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 4, 4)); - $thisfile_png_chunk_type_text['unit_specifier'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 8, 1)); - $thisfile_png_chunk_type_text['unit'] = $this->PNGpHYsUnitLookup($thisfile_png_chunk_type_text['unit_specifier']); - break; - - - case 'sBIT': // Significant Bits - $thisfile_png_chunk_type_text['header'] = $chunk; - switch ($thisfile_png['IHDR']['raw']['color_type']) { - case 0: - $thisfile_png_chunk_type_text['significant_bits_gray'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 0, 1)); - break; - - case 2: - case 3: - $thisfile_png_chunk_type_text['significant_bits_red'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 0, 1)); - $thisfile_png_chunk_type_text['significant_bits_green'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 1, 1)); - $thisfile_png_chunk_type_text['significant_bits_blue'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 2, 1)); - break; - - case 4: - $thisfile_png_chunk_type_text['significant_bits_gray'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 0, 1)); - $thisfile_png_chunk_type_text['significant_bits_alpha'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 1, 1)); - break; - - case 6: - $thisfile_png_chunk_type_text['significant_bits_red'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 0, 1)); - $thisfile_png_chunk_type_text['significant_bits_green'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 1, 1)); - $thisfile_png_chunk_type_text['significant_bits_blue'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 2, 1)); - $thisfile_png_chunk_type_text['significant_bits_alpha'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 3, 1)); - break; - - default: - break; - } - break; - - - case 'sPLT': // Suggested Palette - $thisfile_png_chunk_type_text['header'] = $chunk; - list($palettename, $otherdata) = explode("\x00", $chunk['data'], 2); - $thisfile_png_chunk_type_text['palette_name'] = $palettename; - $sPLToffset = 0; - $thisfile_png_chunk_type_text['sample_depth_bits'] = getid3_lib::BigEndian2Int(substr($otherdata, $sPLToffset, 1)); - $sPLToffset += 1; - $thisfile_png_chunk_type_text['sample_depth_bytes'] = $thisfile_png_chunk_type_text['sample_depth_bits'] / 8; - $paletteCounter = 0; - while ($sPLToffset < strlen($otherdata)) { - $thisfile_png_chunk_type_text['red'][$paletteCounter] = getid3_lib::BigEndian2Int(substr($otherdata, $sPLToffset, $thisfile_png_chunk_type_text['sample_depth_bytes'])); - $sPLToffset += $thisfile_png_chunk_type_text['sample_depth_bytes']; - $thisfile_png_chunk_type_text['green'][$paletteCounter] = getid3_lib::BigEndian2Int(substr($otherdata, $sPLToffset, $thisfile_png_chunk_type_text['sample_depth_bytes'])); - $sPLToffset += $thisfile_png_chunk_type_text['sample_depth_bytes']; - $thisfile_png_chunk_type_text['blue'][$paletteCounter] = getid3_lib::BigEndian2Int(substr($otherdata, $sPLToffset, $thisfile_png_chunk_type_text['sample_depth_bytes'])); - $sPLToffset += $thisfile_png_chunk_type_text['sample_depth_bytes']; - $thisfile_png_chunk_type_text['alpha'][$paletteCounter] = getid3_lib::BigEndian2Int(substr($otherdata, $sPLToffset, $thisfile_png_chunk_type_text['sample_depth_bytes'])); - $sPLToffset += $thisfile_png_chunk_type_text['sample_depth_bytes']; - $thisfile_png_chunk_type_text['frequency'][$paletteCounter] = getid3_lib::BigEndian2Int(substr($otherdata, $sPLToffset, 2)); - $sPLToffset += 2; - $paletteCounter++; - } - break; - - - case 'hIST': // Palette Histogram - $thisfile_png_chunk_type_text['header'] = $chunk; - $hISTcounter = 0; - while ($hISTcounter < strlen($chunk['data'])) { - $thisfile_png_chunk_type_text[$hISTcounter] = getid3_lib::BigEndian2Int(substr($chunk['data'], $hISTcounter / 2, 2)); - $hISTcounter += 2; - } - break; - - - case 'tIME': // Image Last-Modification Time - $thisfile_png_chunk_type_text['header'] = $chunk; - $thisfile_png_chunk_type_text['year'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 0, 2)); - $thisfile_png_chunk_type_text['month'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 2, 1)); - $thisfile_png_chunk_type_text['day'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 3, 1)); - $thisfile_png_chunk_type_text['hour'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 4, 1)); - $thisfile_png_chunk_type_text['minute'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 5, 1)); - $thisfile_png_chunk_type_text['second'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 6, 1)); - $thisfile_png_chunk_type_text['unix'] = gmmktime($thisfile_png_chunk_type_text['hour'], $thisfile_png_chunk_type_text['minute'], $thisfile_png_chunk_type_text['second'], $thisfile_png_chunk_type_text['month'], $thisfile_png_chunk_type_text['day'], $thisfile_png_chunk_type_text['year']); - break; - - - case 'oFFs': // Image Offset - $thisfile_png_chunk_type_text['header'] = $chunk; - $thisfile_png_chunk_type_text['position_x'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 0, 4), false, true); - $thisfile_png_chunk_type_text['position_y'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 4, 4), false, true); - $thisfile_png_chunk_type_text['unit_specifier'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 8, 1)); - $thisfile_png_chunk_type_text['unit'] = $this->PNGoFFsUnitLookup($thisfile_png_chunk_type_text['unit_specifier']); - break; - - - case 'pCAL': // Calibration Of Pixel Values - $thisfile_png_chunk_type_text['header'] = $chunk; - list($calibrationname, $otherdata) = explode("\x00", $chunk['data'], 2); - $thisfile_png_chunk_type_text['calibration_name'] = $calibrationname; - $pCALoffset = 0; - $thisfile_png_chunk_type_text['original_zero'] = getid3_lib::BigEndian2Int(substr($chunk['data'], $pCALoffset, 4), false, true); - $pCALoffset += 4; - $thisfile_png_chunk_type_text['original_max'] = getid3_lib::BigEndian2Int(substr($chunk['data'], $pCALoffset, 4), false, true); - $pCALoffset += 4; - $thisfile_png_chunk_type_text['equation_type'] = getid3_lib::BigEndian2Int(substr($chunk['data'], $pCALoffset, 1)); - $pCALoffset += 1; - $thisfile_png_chunk_type_text['equation_type_text'] = $this->PNGpCALequationTypeLookup($thisfile_png_chunk_type_text['equation_type']); - $thisfile_png_chunk_type_text['parameter_count'] = getid3_lib::BigEndian2Int(substr($chunk['data'], $pCALoffset, 1)); - $pCALoffset += 1; - $thisfile_png_chunk_type_text['parameters'] = explode("\x00", substr($chunk['data'], $pCALoffset)); - break; - - - case 'sCAL': // Physical Scale Of Image Subject - $thisfile_png_chunk_type_text['header'] = $chunk; - $thisfile_png_chunk_type_text['unit_specifier'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 0, 1)); - $thisfile_png_chunk_type_text['unit'] = $this->PNGsCALUnitLookup($thisfile_png_chunk_type_text['unit_specifier']); - list($pixelwidth, $pixelheight) = explode("\x00", substr($chunk['data'], 1)); - $thisfile_png_chunk_type_text['pixel_width'] = $pixelwidth; - $thisfile_png_chunk_type_text['pixel_height'] = $pixelheight; - break; - - - case 'gIFg': // GIF Graphic Control Extension - $gIFgCounter = 0; - if (isset($thisfile_png_chunk_type_text) && is_array($thisfile_png_chunk_type_text)) { - $gIFgCounter = count($thisfile_png_chunk_type_text); - } - $thisfile_png_chunk_type_text[$gIFgCounter]['header'] = $chunk; - $thisfile_png_chunk_type_text[$gIFgCounter]['disposal_method'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 0, 1)); - $thisfile_png_chunk_type_text[$gIFgCounter]['user_input_flag'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 1, 1)); - $thisfile_png_chunk_type_text[$gIFgCounter]['delay_time'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 2, 2)); - break; - - - case 'gIFx': // GIF Application Extension - $gIFxCounter = 0; - if (isset($thisfile_png_chunk_type_text) && is_array($thisfile_png_chunk_type_text)) { - $gIFxCounter = count($thisfile_png_chunk_type_text); - } - $thisfile_png_chunk_type_text[$gIFxCounter]['header'] = $chunk; - $thisfile_png_chunk_type_text[$gIFxCounter]['application_identifier'] = substr($chunk['data'], 0, 8); - $thisfile_png_chunk_type_text[$gIFxCounter]['authentication_code'] = substr($chunk['data'], 8, 3); - $thisfile_png_chunk_type_text[$gIFxCounter]['application_data'] = substr($chunk['data'], 11); - break; - - - case 'IDAT': // Image Data - $idatinformationfieldindex = 0; - if (isset($thisfile_png['IDAT']) && is_array($thisfile_png['IDAT'])) { - $idatinformationfieldindex = count($thisfile_png['IDAT']); - } - unset($chunk['data']); - $thisfile_png_chunk_type_text[$idatinformationfieldindex]['header'] = $chunk; - break; - - - case 'IEND': // Image Trailer - $thisfile_png_chunk_type_text['header'] = $chunk; - break; - - - default: - //unset($chunk['data']); - $thisfile_png_chunk_type_text['header'] = $chunk; - $ThisFileInfo['warning'][] = 'Unhandled chunk type: '.$chunk['type_text']; - break; - } - } - - return true; - } - - function PNGsRGBintentLookup($sRGB) { - static $PNGsRGBintentLookup = array( - 0 => 'Perceptual', - 1 => 'Relative colorimetric', - 2 => 'Saturation', - 3 => 'Absolute colorimetric' - ); - return (isset($PNGsRGBintentLookup[$sRGB]) ? $PNGsRGBintentLookup[$sRGB] : 'invalid'); - } - - function PNGcompressionMethodLookup($compressionmethod) { - static $PNGcompressionMethodLookup = array( - 0 => 'deflate/inflate' - ); - return (isset($PNGcompressionMethodLookup[$compressionmethod]) ? $PNGcompressionMethodLookup[$compressionmethod] : 'invalid'); - } - - function PNGpHYsUnitLookup($unitid) { - static $PNGpHYsUnitLookup = array( - 0 => 'unknown', - 1 => 'meter' - ); - return (isset($PNGpHYsUnitLookup[$unitid]) ? $PNGpHYsUnitLookup[$unitid] : 'invalid'); - } - - function PNGoFFsUnitLookup($unitid) { - static $PNGoFFsUnitLookup = array( - 0 => 'pixel', - 1 => 'micrometer' - ); - return (isset($PNGoFFsUnitLookup[$unitid]) ? $PNGoFFsUnitLookup[$unitid] : 'invalid'); - } - - function PNGpCALequationTypeLookup($equationtype) { - static $PNGpCALequationTypeLookup = array( - 0 => 'Linear mapping', - 1 => 'Base-e exponential mapping', - 2 => 'Arbitrary-base exponential mapping', - 3 => 'Hyperbolic mapping' - ); - return (isset($PNGpCALequationTypeLookup[$equationtype]) ? $PNGpCALequationTypeLookup[$equationtype] : 'invalid'); - } - - function PNGsCALUnitLookup($unitid) { - static $PNGsCALUnitLookup = array( - 0 => 'meter', - 1 => 'radian' - ); - return (isset($PNGsCALUnitLookup[$unitid]) ? $PNGsCALUnitLookup[$unitid] : 'invalid'); - } - - function IHDRcalculateBitsPerSample($color_type, $bit_depth) { - switch ($color_type) { - case 0: // Each pixel is a grayscale sample. - return $bit_depth; - break; - - case 2: // Each pixel is an R,G,B triple - return 3 * $bit_depth; - break; - - case 3: // Each pixel is a palette index; a PLTE chunk must appear. - return $bit_depth; - break; - - case 4: // Each pixel is a grayscale sample, followed by an alpha sample. - return 2 * $bit_depth; - break; - - case 6: // Each pixel is an R,G,B triple, followed by an alpha sample. - return 4 * $bit_depth; - break; - } - return false; - } - -} - - -?>
\ No newline at end of file diff --git a/getid3/module.graphic.svg.php b/getid3/module.graphic.svg.php deleted file mode 100644 index e447145..0000000 --- a/getid3/module.graphic.svg.php +++ /dev/null @@ -1,52 +0,0 @@ -<?php -///////////////////////////////////////////////////////////////// -/// getID3() by James Heinrich <info@getid3.org> // -// available at http://getid3.sourceforge.net // -// or http://www.getid3.org // -///////////////////////////////////////////////////////////////// -// See readme.txt for more details // -///////////////////////////////////////////////////////////////// -// // -// module.graphic.svg.php // -// module for analyzing SVG Image files // -// dependencies: NONE // -// author: Bryce Harrington <bryceØbryceharrington*org> // -// /// -///////////////////////////////////////////////////////////////// - - -class getid3_svg -{ - - - function getid3_svg(&$fd, &$ThisFileInfo) { - fseek($fd, $ThisFileInfo['avdataoffset'], SEEK_SET); - - // I'm making this up, please modify as appropriate - $SVGheader = fread($fd, 32); - $ThisFileInfo['svg']['magic'] = substr($SVGheader, 0, 4); - if ($ThisFileInfo['svg']['magic'] == 'aBcD') { - - $ThisFileInfo['fileformat'] = 'svg'; - $ThisFileInfo['video']['dataformat'] = 'svg'; - $ThisFileInfo['video']['lossless'] = true; - $ThisFileInfo['video']['bits_per_sample'] = 24; - $ThisFileInfo['video']['pixel_aspect_ratio'] = (float) 1; - - $ThisFileInfo['svg']['width'] = getid3_lib::LittleEndian2Int(substr($fileData, 4, 4)); - $ThisFileInfo['svg']['height'] = getid3_lib::LittleEndian2Int(substr($fileData, 8, 4)); - - $ThisFileInfo['video']['resolution_x'] = $ThisFileInfo['svg']['width']; - $ThisFileInfo['video']['resolution_y'] = $ThisFileInfo['svg']['height']; - - return true; - } - $ThisFileInfo['error'][] = 'Did not find SVG magic bytes "aBcD" at '.$ThisFileInfo['avdataoffset']; - unset($ThisFileInfo['fileformat']); - return false; - } - -} - - -?>
\ No newline at end of file diff --git a/getid3/module.graphic.tiff.php b/getid3/module.graphic.tiff.php deleted file mode 100644 index ae57cd6..0000000 --- a/getid3/module.graphic.tiff.php +++ /dev/null @@ -1,221 +0,0 @@ -<?php -///////////////////////////////////////////////////////////////// -/// getID3() by James Heinrich <info@getid3.org> // -// available at http://getid3.sourceforge.net // -// or http://www.getid3.org // -///////////////////////////////////////////////////////////////// -// See readme.txt for more details // -///////////////////////////////////////////////////////////////// -// // -// module.archive.tiff.php // -// module for analyzing TIFF files // -// dependencies: NONE // -// /// -///////////////////////////////////////////////////////////////// - - -class getid3_tiff -{ - - function getid3_tiff(&$fd, &$ThisFileInfo) { - - fseek($fd, $ThisFileInfo['avdataoffset'], SEEK_SET); - $TIFFheader = fread($fd, 4); - - switch (substr($TIFFheader, 0, 2)) { - case 'II': - $ThisFileInfo['tiff']['byte_order'] = 'Intel'; - break; - case 'MM': - $ThisFileInfo['tiff']['byte_order'] = 'Motorola'; - break; - default: - $ThisFileInfo['error'][] = 'Invalid TIFF byte order identifier ('.substr($TIFFheader, 0, 2).') at offset '.$ThisFileInfo['avdataoffset']; - return false; - break; - } - - $ThisFileInfo['fileformat'] = 'tiff'; - $ThisFileInfo['video']['dataformat'] = 'tiff'; - $ThisFileInfo['video']['lossless'] = true; - $ThisFileInfo['tiff']['ifd'] = array(); - $CurrentIFD = array(); - - $FieldTypeByteLength = array(1=>1, 2=>1, 3=>2, 4=>4, 5=>8); - - $nextIFDoffset = $this->TIFFendian2Int(fread($fd, 4), $ThisFileInfo['tiff']['byte_order']); - - while ($nextIFDoffset > 0) { - - $CurrentIFD['offset'] = $nextIFDoffset; - - fseek($fd, $ThisFileInfo['avdataoffset'] + $nextIFDoffset, SEEK_SET); - $CurrentIFD['fieldcount'] = $this->TIFFendian2Int(fread($fd, 2), $ThisFileInfo['tiff']['byte_order']); - - for ($i = 0; $i < $CurrentIFD['fieldcount']; $i++) { - $CurrentIFD['fields'][$i]['raw']['tag'] = $this->TIFFendian2Int(fread($fd, 2), $ThisFileInfo['tiff']['byte_order']); - $CurrentIFD['fields'][$i]['raw']['type'] = $this->TIFFendian2Int(fread($fd, 2), $ThisFileInfo['tiff']['byte_order']); - $CurrentIFD['fields'][$i]['raw']['length'] = $this->TIFFendian2Int(fread($fd, 4), $ThisFileInfo['tiff']['byte_order']); - $CurrentIFD['fields'][$i]['raw']['offset'] = fread($fd, 4); - - switch ($CurrentIFD['fields'][$i]['raw']['type']) { - case 1: // BYTE An 8-bit unsigned integer. - if ($CurrentIFD['fields'][$i]['raw']['length'] <= 4) { - $CurrentIFD['fields'][$i]['value'] = $this->TIFFendian2Int(substr($CurrentIFD['fields'][$i]['raw']['offset'], 0, 1), $ThisFileInfo['tiff']['byte_order']); - } else { - $CurrentIFD['fields'][$i]['offset'] = $this->TIFFendian2Int($CurrentIFD['fields'][$i]['raw']['offset'], $ThisFileInfo['tiff']['byte_order']); - } - break; - - case 2: // ASCII 8-bit bytes that store ASCII codes; the last byte must be null. - if ($CurrentIFD['fields'][$i]['raw']['length'] <= 4) { - $CurrentIFD['fields'][$i]['value'] = substr($CurrentIFD['fields'][$i]['raw']['offset'], 3); - } else { - $CurrentIFD['fields'][$i]['offset'] = $this->TIFFendian2Int($CurrentIFD['fields'][$i]['raw']['offset'], $ThisFileInfo['tiff']['byte_order']); - } - break; - - case 3: // SHORT A 16-bit (2-byte) unsigned integer. - if ($CurrentIFD['fields'][$i]['raw']['length'] <= 2) { - $CurrentIFD['fields'][$i]['value'] = $this->TIFFendian2Int(substr($CurrentIFD['fields'][$i]['raw']['offset'], 0, 2), $ThisFileInfo['tiff']['byte_order']); - } else { - $CurrentIFD['fields'][$i]['offset'] = $this->TIFFendian2Int($CurrentIFD['fields'][$i]['raw']['offset'], $ThisFileInfo['tiff']['byte_order']); - } - break; - - case 4: // LONG A 32-bit (4-byte) unsigned integer. - if ($CurrentIFD['fields'][$i]['raw']['length'] <= 1) { - $CurrentIFD['fields'][$i]['value'] = $this->TIFFendian2Int($CurrentIFD['fields'][$i]['raw']['offset'], $ThisFileInfo['tiff']['byte_order']); - } else { - $CurrentIFD['fields'][$i]['offset'] = $this->TIFFendian2Int($CurrentIFD['fields'][$i]['raw']['offset'], $ThisFileInfo['tiff']['byte_order']); - } - break; - - case 5: // RATIONAL Two LONG_s: the first represents the numerator of a fraction, the second the denominator. - break; - } - } - - $ThisFileInfo['tiff']['ifd'][] = $CurrentIFD; - $CurrentIFD = array(); - $nextIFDoffset = $this->TIFFendian2Int(fread($fd, 4), $ThisFileInfo['tiff']['byte_order']); - - } - - foreach ($ThisFileInfo['tiff']['ifd'] as $IFDid => $IFDarray) { - foreach ($IFDarray['fields'] as $key => $fieldarray) { - switch ($fieldarray['raw']['tag']) { - case 256: // ImageWidth - case 257: // ImageLength - case 258: // BitsPerSample - case 259: // Compression - if (!isset($fieldarray['value'])) { - fseek($fd, $fieldarray['offset'], SEEK_SET); - $ThisFileInfo['tiff']['ifd'][$IFDid]['fields'][$key]['raw']['data'] = fread($fd, $fieldarray['raw']['length'] * $FieldTypeByteLength[$fieldarray['raw']['type']]); - - } - break; - - case 270: // ImageDescription - case 271: // Make - case 272: // Model - case 305: // Software - case 306: // DateTime - case 315: // Artist - case 316: // HostComputer - if (isset($fieldarray['value'])) { - $ThisFileInfo['tiff']['ifd'][$IFDid]['fields'][$key]['raw']['data'] = $fieldarray['value']; - } else { - fseek($fd, $fieldarray['offset'], SEEK_SET); - $ThisFileInfo['tiff']['ifd'][$IFDid]['fields'][$key]['raw']['data'] = fread($fd, $fieldarray['raw']['length'] * $FieldTypeByteLength[$fieldarray['raw']['type']]); - - } - break; - } - switch ($fieldarray['raw']['tag']) { - case 256: // ImageWidth - $ThisFileInfo['video']['resolution_x'] = $fieldarray['value']; - break; - - case 257: // ImageLength - $ThisFileInfo['video']['resolution_y'] = $fieldarray['value']; - break; - - case 258: // BitsPerSample - if (isset($fieldarray['value'])) { - $ThisFileInfo['video']['bits_per_sample'] = $fieldarray['value']; - } else { - $ThisFileInfo['video']['bits_per_sample'] = 0; - for ($i = 0; $i < $fieldarray['raw']['length']; $i++) { - $ThisFileInfo['video']['bits_per_sample'] += $this->TIFFendian2Int(substr($ThisFileInfo['tiff']['ifd'][$IFDid]['fields'][$key]['raw']['data'], $i * $FieldTypeByteLength[$fieldarray['raw']['type']], $FieldTypeByteLength[$fieldarray['raw']['type']]), $ThisFileInfo['tiff']['byte_order']); - } - } - break; - - case 259: // Compression - $ThisFileInfo['video']['codec'] = $this->TIFFcompressionMethod($fieldarray['value']); - break; - - case 270: // ImageDescription - case 271: // Make - case 272: // Model - case 305: // Software - case 306: // DateTime - case 315: // Artist - case 316: // HostComputer - @$ThisFileInfo['tiff']['comments'][$this->TIFFcommentName($fieldarray['raw']['tag'])][] = $ThisFileInfo['tiff']['ifd'][$IFDid]['fields'][$key]['raw']['data']; - break; - - default: - break; - } - } - } - - return true; - } - - - function TIFFendian2Int($bytestring, $byteorder) { - if ($byteorder == 'Intel') { - return getid3_lib::LittleEndian2Int($bytestring); - } elseif ($byteorder == 'Motorola') { - return getid3_lib::BigEndian2Int($bytestring); - } - return false; - } - - function TIFFcompressionMethod($id) { - static $TIFFcompressionMethod = array(); - if (empty($TIFFcompressionMethod)) { - $TIFFcompressionMethod = array( - 1 => 'Uncompressed', - 2 => 'Huffman', - 3 => 'Fax - CCITT 3', - 5 => 'LZW', - 32773 => 'PackBits', - ); - } - return (isset($TIFFcompressionMethod[$id]) ? $TIFFcompressionMethod[$id] : 'unknown/invalid ('.$id.')'); - } - - function TIFFcommentName($id) { - static $TIFFcommentName = array(); - if (empty($TIFFcommentName)) { - $TIFFcommentName = array( - 270 => 'imagedescription', - 271 => 'make', - 272 => 'model', - 305 => 'software', - 306 => 'datetime', - 315 => 'artist', - 316 => 'hostcomputer', - ); - } - return (isset($TIFFcommentName[$id]) ? $TIFFcommentName[$id] : 'unknown/invalid ('.$id.')'); - } - -} - - -?>
\ No newline at end of file diff --git a/getid3/module.misc.doc.php b/getid3/module.misc.doc.php deleted file mode 100644 index cb65abf..0000000 --- a/getid3/module.misc.doc.php +++ /dev/null @@ -1,32 +0,0 @@ -<?php -///////////////////////////////////////////////////////////////// -/// getID3() by James Heinrich <info@getid3.org> // -// available at http://getid3.sourceforge.net // -// or http://www.getid3.org // -///////////////////////////////////////////////////////////////// -// See readme.txt for more details // -///////////////////////////////////////////////////////////////// -// // -// module.archive.doc.php // -// module for analyzing MS Office (.doc, .xls, etc) files // -// dependencies: NONE // -// /// -///////////////////////////////////////////////////////////////// - - -class getid3_doc -{ - - function getid3_doc(&$fd, &$ThisFileInfo) { - - $ThisFileInfo['fileformat'] = 'doc'; - - $ThisFileInfo['error'][] = 'MS Office (.doc, .xls, etc) parsing not enabled in this version of getID3()'; - return false; - - } - -} - - -?>
\ No newline at end of file diff --git a/getid3/module.misc.exe.php b/getid3/module.misc.exe.php deleted file mode 100644 index 8c6bfcf..0000000 --- a/getid3/module.misc.exe.php +++ /dev/null @@ -1,59 +0,0 @@ -<?php -///////////////////////////////////////////////////////////////// -/// getID3() by James Heinrich <info@getid3.org> // -// available at http://getid3.sourceforge.net // -// or http://www.getid3.org // -///////////////////////////////////////////////////////////////// -// See readme.txt for more details // -///////////////////////////////////////////////////////////////// -// // -// module.misc.exe.php // -// module for analyzing EXE files // -// dependencies: NONE // -// /// -///////////////////////////////////////////////////////////////// - - -class getid3_exe -{ - - function getid3_exe(&$fd, &$ThisFileInfo) { - - fseek($fd, $ThisFileInfo['avdataoffset'], SEEK_SET); - $EXEheader = fread($fd, 28); - - if (substr($EXEheader, 0, 2) != 'MZ') { - $ThisFileInfo['error'][] = 'Expecting "MZ" at offset '.$ThisFileInfo['avdataoffset'].', found "'.substr($EXEheader, 0, 2).'" instead.'; - return false; - } - - $ThisFileInfo['fileformat'] = 'exe'; - $ThisFileInfo['exe']['mz']['magic'] = 'MZ'; - - $ThisFileInfo['exe']['mz']['raw']['last_page_size'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 2, 2)); - $ThisFileInfo['exe']['mz']['raw']['page_count'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 4, 2)); - $ThisFileInfo['exe']['mz']['raw']['relocation_count'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 6, 2)); - $ThisFileInfo['exe']['mz']['raw']['header_paragraphs'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 8, 2)); - $ThisFileInfo['exe']['mz']['raw']['min_memory_paragraphs'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 10, 2)); - $ThisFileInfo['exe']['mz']['raw']['max_memory_paragraphs'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 12, 2)); - $ThisFileInfo['exe']['mz']['raw']['initial_ss'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 14, 2)); - $ThisFileInfo['exe']['mz']['raw']['initial_sp'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 16, 2)); - $ThisFileInfo['exe']['mz']['raw']['checksum'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 18, 2)); - $ThisFileInfo['exe']['mz']['raw']['cs_ip'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 20, 4)); - $ThisFileInfo['exe']['mz']['raw']['relocation_table_offset'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 24, 2)); - $ThisFileInfo['exe']['mz']['raw']['overlay_number'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 26, 2)); - - $ThisFileInfo['exe']['mz']['byte_size'] = (($ThisFileInfo['exe']['mz']['raw']['page_count'] - 1)) * 512 + $ThisFileInfo['exe']['mz']['raw']['last_page_size']; - $ThisFileInfo['exe']['mz']['header_size'] = $ThisFileInfo['exe']['mz']['raw']['header_paragraphs'] * 16; - $ThisFileInfo['exe']['mz']['memory_minimum'] = $ThisFileInfo['exe']['mz']['raw']['min_memory_paragraphs'] * 16; - $ThisFileInfo['exe']['mz']['memory_recommended'] = $ThisFileInfo['exe']['mz']['raw']['max_memory_paragraphs'] * 16; - -$ThisFileInfo['error'][] = 'EXE parsing not enabled in this version of getID3()'; -return false; - - } - -} - - -?>
\ No newline at end of file diff --git a/getid3/module.misc.iso.php b/getid3/module.misc.iso.php deleted file mode 100644 index 94df929..0000000 --- a/getid3/module.misc.iso.php +++ /dev/null @@ -1,386 +0,0 @@ -<?php -///////////////////////////////////////////////////////////////// -/// getID3() by James Heinrich <info@getid3.org> // -// available at http://getid3.sourceforge.net // -// or http://www.getid3.org // -///////////////////////////////////////////////////////////////// -// See readme.txt for more details // -///////////////////////////////////////////////////////////////// -// // -// module.misc.iso.php // -// module for analyzing ISO files // -// dependencies: NONE // -// /// -///////////////////////////////////////////////////////////////// - - -class getid3_iso -{ - - function getid3_iso($fd, &$ThisFileInfo) { - $ThisFileInfo['fileformat'] = 'iso'; - - for ($i = 16; $i <= 19; $i++) { - fseek($fd, 2048 * $i, SEEK_SET); - $ISOheader = fread($fd, 2048); - if (substr($ISOheader, 1, 5) == 'CD001') { - switch (ord($ISOheader{0})) { - case 1: - $ThisFileInfo['iso']['primary_volume_descriptor']['offset'] = 2048 * $i; - $this->ParsePrimaryVolumeDescriptor($ISOheader, $ThisFileInfo); - break; - - case 2: - $ThisFileInfo['iso']['supplementary_volume_descriptor']['offset'] = 2048 * $i; - $this->ParseSupplementaryVolumeDescriptor($ISOheader, $ThisFileInfo); - break; - - default: - // skip - break; - } - } - } - - $this->ParsePathTable($fd, $ThisFileInfo); - - $ThisFileInfo['iso']['files'] = array(); - foreach ($ThisFileInfo['iso']['path_table']['directories'] as $directorynum => $directorydata) { - - $ThisFileInfo['iso']['directories'][$directorynum] = $this->ParseDirectoryRecord($fd, $directorydata, $ThisFileInfo); - - } - - return true; - - } - - - function ParsePrimaryVolumeDescriptor(&$ISOheader, &$ThisFileInfo) { - // ISO integer values are stored *BOTH* Little-Endian AND Big-Endian format!! - // ie 12345 == 0x3039 is stored as $39 $30 $30 $39 in a 4-byte field - - // shortcuts - $ThisFileInfo['iso']['primary_volume_descriptor']['raw'] = array(); - $thisfile_iso_primaryVD = &$ThisFileInfo['iso']['primary_volume_descriptor']; - $thisfile_iso_primaryVD_raw = &$thisfile_iso_primaryVD['raw']; - - $thisfile_iso_primaryVD_raw['volume_descriptor_type'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 0, 1)); - $thisfile_iso_primaryVD_raw['standard_identifier'] = substr($ISOheader, 1, 5); - if ($thisfile_iso_primaryVD_raw['standard_identifier'] != 'CD001') { - $ThisFileInfo['error'][] = 'Expected "CD001" at offset ('.($thisfile_iso_primaryVD['offset'] + 1).'), found "'.$thisfile_iso_primaryVD_raw['standard_identifier'].'" instead'; - unset($ThisFileInfo['fileformat']); - unset($ThisFileInfo['iso']); - return false; - } - - - $thisfile_iso_primaryVD_raw['volume_descriptor_version'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 6, 1)); - //$thisfile_iso_primaryVD_raw['unused_1'] = substr($ISOheader, 7, 1); - $thisfile_iso_primaryVD_raw['system_identifier'] = substr($ISOheader, 8, 32); - $thisfile_iso_primaryVD_raw['volume_identifier'] = substr($ISOheader, 40, 32); - //$thisfile_iso_primaryVD_raw['unused_2'] = substr($ISOheader, 72, 8); - $thisfile_iso_primaryVD_raw['volume_space_size'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 80, 4)); - //$thisfile_iso_primaryVD_raw['unused_3'] = substr($ISOheader, 88, 32); - $thisfile_iso_primaryVD_raw['volume_set_size'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 120, 2)); - $thisfile_iso_primaryVD_raw['volume_sequence_number'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 124, 2)); - $thisfile_iso_primaryVD_raw['logical_block_size'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 128, 2)); - $thisfile_iso_primaryVD_raw['path_table_size'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 132, 4)); - $thisfile_iso_primaryVD_raw['path_table_l_location'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 140, 2)); - $thisfile_iso_primaryVD_raw['path_table_l_opt_location'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 144, 2)); - $thisfile_iso_primaryVD_raw['path_table_m_location'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 148, 2)); - $thisfile_iso_primaryVD_raw['path_table_m_opt_location'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 152, 2)); - $thisfile_iso_primaryVD_raw['root_directory_record'] = substr($ISOheader, 156, 34); - $thisfile_iso_primaryVD_raw['volume_set_identifier'] = substr($ISOheader, 190, 128); - $thisfile_iso_primaryVD_raw['publisher_identifier'] = substr($ISOheader, 318, 128); - $thisfile_iso_primaryVD_raw['data_preparer_identifier'] = substr($ISOheader, 446, 128); - $thisfile_iso_primaryVD_raw['application_identifier'] = substr($ISOheader, 574, 128); - $thisfile_iso_primaryVD_raw['copyright_file_identifier'] = substr($ISOheader, 702, 37); - $thisfile_iso_primaryVD_raw['abstract_file_identifier'] = substr($ISOheader, 739, 37); - $thisfile_iso_primaryVD_raw['bibliographic_file_identifier'] = substr($ISOheader, 776, 37); - $thisfile_iso_primaryVD_raw['volume_creation_date_time'] = substr($ISOheader, 813, 17); - $thisfile_iso_primaryVD_raw['volume_modification_date_time'] = substr($ISOheader, 830, 17); - $thisfile_iso_primaryVD_raw['volume_expiration_date_time'] = substr($ISOheader, 847, 17); - $thisfile_iso_primaryVD_raw['volume_effective_date_time'] = substr($ISOheader, 864, 17); - $thisfile_iso_primaryVD_raw['file_structure_version'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 881, 1)); - //$thisfile_iso_primaryVD_raw['unused_4'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 882, 1)); - $thisfile_iso_primaryVD_raw['application_data'] = substr($ISOheader, 883, 512); - //$thisfile_iso_primaryVD_raw['unused_5'] = substr($ISOheader, 1395, 653); - - $thisfile_iso_primaryVD['system_identifier'] = trim($thisfile_iso_primaryVD_raw['system_identifier']); - $thisfile_iso_primaryVD['volume_identifier'] = trim($thisfile_iso_primaryVD_raw['volume_identifier']); - $thisfile_iso_primaryVD['volume_set_identifier'] = trim($thisfile_iso_primaryVD_raw['volume_set_identifier']); - $thisfile_iso_primaryVD['publisher_identifier'] = trim($thisfile_iso_primaryVD_raw['publisher_identifier']); - $thisfile_iso_primaryVD['data_preparer_identifier'] = trim($thisfile_iso_primaryVD_raw['data_preparer_identifier']); - $thisfile_iso_primaryVD['application_identifier'] = trim($thisfile_iso_primaryVD_raw['application_identifier']); - $thisfile_iso_primaryVD['copyright_file_identifier'] = trim($thisfile_iso_primaryVD_raw['copyright_file_identifier']); - $thisfile_iso_primaryVD['abstract_file_identifier'] = trim($thisfile_iso_primaryVD_raw['abstract_file_identifier']); - $thisfile_iso_primaryVD['bibliographic_file_identifier'] = trim($thisfile_iso_primaryVD_raw['bibliographic_file_identifier']); - $thisfile_iso_primaryVD['volume_creation_date_time'] = $this->ISOtimeText2UNIXtime($thisfile_iso_primaryVD_raw['volume_creation_date_time']); - $thisfile_iso_primaryVD['volume_modification_date_time'] = $this->ISOtimeText2UNIXtime($thisfile_iso_primaryVD_raw['volume_modification_date_time']); - $thisfile_iso_primaryVD['volume_expiration_date_time'] = $this->ISOtimeText2UNIXtime($thisfile_iso_primaryVD_raw['volume_expiration_date_time']); - $thisfile_iso_primaryVD['volume_effective_date_time'] = $this->ISOtimeText2UNIXtime($thisfile_iso_primaryVD_raw['volume_effective_date_time']); - - if (($thisfile_iso_primaryVD_raw['volume_space_size'] * 2048) > $ThisFileInfo['filesize']) { - $ThisFileInfo['error'][] = 'Volume Space Size ('.($thisfile_iso_primaryVD_raw['volume_space_size'] * 2048).' bytes) is larger than the file size ('.$ThisFileInfo['filesize'].' bytes) (truncated file?)'; - } - - return true; - } - - - function ParseSupplementaryVolumeDescriptor(&$ISOheader, &$ThisFileInfo) { - // ISO integer values are stored Both-Endian format!! - // ie 12345 == 0x3039 is stored as $39 $30 $30 $39 in a 4-byte field - - // shortcuts - $ThisFileInfo['iso']['supplementary_volume_descriptor']['raw'] = array(); - $thisfile_iso_supplementaryVD = &$ThisFileInfo['iso']['supplementary_volume_descriptor']; - $thisfile_iso_supplementaryVD_raw = &$thisfile_iso_supplementaryVD['raw']; - - $thisfile_iso_supplementaryVD_raw['volume_descriptor_type'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 0, 1)); - $thisfile_iso_supplementaryVD_raw['standard_identifier'] = substr($ISOheader, 1, 5); - if ($thisfile_iso_supplementaryVD_raw['standard_identifier'] != 'CD001') { - $ThisFileInfo['error'][] = 'Expected "CD001" at offset ('.($thisfile_iso_supplementaryVD['offset'] + 1).'), found "'.$thisfile_iso_supplementaryVD_raw['standard_identifier'].'" instead'; - unset($ThisFileInfo['fileformat']); - unset($ThisFileInfo['iso']); - return false; - } - - $thisfile_iso_supplementaryVD_raw['volume_descriptor_version'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 6, 1)); - //$thisfile_iso_supplementaryVD_raw['unused_1'] = substr($ISOheader, 7, 1); - $thisfile_iso_supplementaryVD_raw['system_identifier'] = substr($ISOheader, 8, 32); - $thisfile_iso_supplementaryVD_raw['volume_identifier'] = substr($ISOheader, 40, 32); - //$thisfile_iso_supplementaryVD_raw['unused_2'] = substr($ISOheader, 72, 8); - $thisfile_iso_supplementaryVD_raw['volume_space_size'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 80, 4)); - if ($thisfile_iso_supplementaryVD_raw['volume_space_size'] == 0) { - // Supplementary Volume Descriptor not used - //unset($thisfile_iso_supplementaryVD); - //return false; - } - - //$thisfile_iso_supplementaryVD_raw['unused_3'] = substr($ISOheader, 88, 32); - $thisfile_iso_supplementaryVD_raw['volume_set_size'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 120, 2)); - $thisfile_iso_supplementaryVD_raw['volume_sequence_number'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 124, 2)); - $thisfile_iso_supplementaryVD_raw['logical_block_size'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 128, 2)); - $thisfile_iso_supplementaryVD_raw['path_table_size'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 132, 4)); - $thisfile_iso_supplementaryVD_raw['path_table_l_location'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 140, 2)); - $thisfile_iso_supplementaryVD_raw['path_table_l_opt_location'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 144, 2)); - $thisfile_iso_supplementaryVD_raw['path_table_m_location'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 148, 2)); - $thisfile_iso_supplementaryVD_raw['path_table_m_opt_location'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 152, 2)); - $thisfile_iso_supplementaryVD_raw['root_directory_record'] = substr($ISOheader, 156, 34); - $thisfile_iso_supplementaryVD_raw['volume_set_identifier'] = substr($ISOheader, 190, 128); - $thisfile_iso_supplementaryVD_raw['publisher_identifier'] = substr($ISOheader, 318, 128); - $thisfile_iso_supplementaryVD_raw['data_preparer_identifier'] = substr($ISOheader, 446, 128); - $thisfile_iso_supplementaryVD_raw['application_identifier'] = substr($ISOheader, 574, 128); - $thisfile_iso_supplementaryVD_raw['copyright_file_identifier'] = substr($ISOheader, 702, 37); - $thisfile_iso_supplementaryVD_raw['abstract_file_identifier'] = substr($ISOheader, 739, 37); - $thisfile_iso_supplementaryVD_raw['bibliographic_file_identifier'] = substr($ISOheader, 776, 37); - $thisfile_iso_supplementaryVD_raw['volume_creation_date_time'] = substr($ISOheader, 813, 17); - $thisfile_iso_supplementaryVD_raw['volume_modification_date_time'] = substr($ISOheader, 830, 17); - $thisfile_iso_supplementaryVD_raw['volume_expiration_date_time'] = substr($ISOheader, 847, 17); - $thisfile_iso_supplementaryVD_raw['volume_effective_date_time'] = substr($ISOheader, 864, 17); - $thisfile_iso_supplementaryVD_raw['file_structure_version'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 881, 1)); - //$thisfile_iso_supplementaryVD_raw['unused_4'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 882, 1)); - $thisfile_iso_supplementaryVD_raw['application_data'] = substr($ISOheader, 883, 512); - //$thisfile_iso_supplementaryVD_raw['unused_5'] = substr($ISOheader, 1395, 653); - - $thisfile_iso_supplementaryVD['system_identifier'] = trim($thisfile_iso_supplementaryVD_raw['system_identifier']); - $thisfile_iso_supplementaryVD['volume_identifier'] = trim($thisfile_iso_supplementaryVD_raw['volume_identifier']); - $thisfile_iso_supplementaryVD['volume_set_identifier'] = trim($thisfile_iso_supplementaryVD_raw['volume_set_identifier']); - $thisfile_iso_supplementaryVD['publisher_identifier'] = trim($thisfile_iso_supplementaryVD_raw['publisher_identifier']); - $thisfile_iso_supplementaryVD['data_preparer_identifier'] = trim($thisfile_iso_supplementaryVD_raw['data_preparer_identifier']); - $thisfile_iso_supplementaryVD['application_identifier'] = trim($thisfile_iso_supplementaryVD_raw['application_identifier']); - $thisfile_iso_supplementaryVD['copyright_file_identifier'] = trim($thisfile_iso_supplementaryVD_raw['copyright_file_identifier']); - $thisfile_iso_supplementaryVD['abstract_file_identifier'] = trim($thisfile_iso_supplementaryVD_raw['abstract_file_identifier']); - $thisfile_iso_supplementaryVD['bibliographic_file_identifier'] = trim($thisfile_iso_supplementaryVD_raw['bibliographic_file_identifier']); - $thisfile_iso_supplementaryVD['volume_creation_date_time'] = $this->ISOtimeText2UNIXtime($thisfile_iso_supplementaryVD_raw['volume_creation_date_time']); - $thisfile_iso_supplementaryVD['volume_modification_date_time'] = $this->ISOtimeText2UNIXtime($thisfile_iso_supplementaryVD_raw['volume_modification_date_time']); - $thisfile_iso_supplementaryVD['volume_expiration_date_time'] = $this->ISOtimeText2UNIXtime($thisfile_iso_supplementaryVD_raw['volume_expiration_date_time']); - $thisfile_iso_supplementaryVD['volume_effective_date_time'] = $this->ISOtimeText2UNIXtime($thisfile_iso_supplementaryVD_raw['volume_effective_date_time']); - - if (($thisfile_iso_supplementaryVD_raw['volume_space_size'] * $thisfile_iso_supplementaryVD_raw['logical_block_size']) > $ThisFileInfo['filesize']) { - $ThisFileInfo['error'][] = 'Volume Space Size ('.($thisfile_iso_supplementaryVD_raw['volume_space_size'] * $thisfile_iso_supplementaryVD_raw['logical_block_size']).' bytes) is larger than the file size ('.$ThisFileInfo['filesize'].' bytes) (truncated file?)'; - } - - return true; - } - - - function ParsePathTable($fd, &$ThisFileInfo) { - if (!isset($ThisFileInfo['iso']['supplementary_volume_descriptor']['raw']['path_table_l_location']) && !isset($ThisFileInfo['iso']['primary_volume_descriptor']['raw']['path_table_l_location'])) { - return false; - } - if (isset($ThisFileInfo['iso']['supplementary_volume_descriptor']['raw']['path_table_l_location'])) { - $PathTableLocation = $ThisFileInfo['iso']['supplementary_volume_descriptor']['raw']['path_table_l_location']; - $PathTableSize = $ThisFileInfo['iso']['supplementary_volume_descriptor']['raw']['path_table_size']; - $TextEncoding = 'UTF-16BE'; // Big-Endian Unicode - } else { - $PathTableLocation = $ThisFileInfo['iso']['primary_volume_descriptor']['raw']['path_table_l_location']; - $PathTableSize = $ThisFileInfo['iso']['primary_volume_descriptor']['raw']['path_table_size']; - $TextEncoding = 'ISO-8859-1'; // Latin-1 - } - - if (($PathTableLocation * 2048) > $ThisFileInfo['filesize']) { - $ThisFileInfo['error'][] = 'Path Table Location specifies an offset ('.($PathTableLocation * 2048).') beyond the end-of-file ('.$ThisFileInfo['filesize'].')'; - return false; - } - - $ThisFileInfo['iso']['path_table']['offset'] = $PathTableLocation * 2048; - fseek($fd, $ThisFileInfo['iso']['path_table']['offset'], SEEK_SET); - $ThisFileInfo['iso']['path_table']['raw'] = fread($fd, $PathTableSize); - - $offset = 0; - $pathcounter = 1; - while ($offset < $PathTableSize) { - // shortcut - $ThisFileInfo['iso']['path_table']['directories'][$pathcounter] = array(); - $thisfile_iso_pathtable_directories_current = &$ThisFileInfo['iso']['path_table']['directories'][$pathcounter]; - - $thisfile_iso_pathtable_directories_current['length'] = getid3_lib::LittleEndian2Int(substr($ThisFileInfo['iso']['path_table']['raw'], $offset, 1)); - $offset += 1; - $thisfile_iso_pathtable_directories_current['extended_length'] = getid3_lib::LittleEndian2Int(substr($ThisFileInfo['iso']['path_table']['raw'], $offset, 1)); - $offset += 1; - $thisfile_iso_pathtable_directories_current['location_logical'] = getid3_lib::LittleEndian2Int(substr($ThisFileInfo['iso']['path_table']['raw'], $offset, 4)); - $offset += 4; - $thisfile_iso_pathtable_directories_current['parent_directory'] = getid3_lib::LittleEndian2Int(substr($ThisFileInfo['iso']['path_table']['raw'], $offset, 2)); - $offset += 2; - $thisfile_iso_pathtable_directories_current['name'] = substr($ThisFileInfo['iso']['path_table']['raw'], $offset, $thisfile_iso_pathtable_directories_current['length']); - $offset += $thisfile_iso_pathtable_directories_current['length'] + ($thisfile_iso_pathtable_directories_current['length'] % 2); - - $thisfile_iso_pathtable_directories_current['name_ascii'] = getid3_lib::iconv_fallback($TextEncoding, $ThisFileInfo['encoding'], $thisfile_iso_pathtable_directories_current['name']); - - $thisfile_iso_pathtable_directories_current['location_bytes'] = $thisfile_iso_pathtable_directories_current['location_logical'] * 2048; - if ($pathcounter == 1) { - $thisfile_iso_pathtable_directories_current['full_path'] = '/'; - } else { - $thisfile_iso_pathtable_directories_current['full_path'] = $ThisFileInfo['iso']['path_table']['directories'][$thisfile_iso_pathtable_directories_current['parent_directory']]['full_path'].$thisfile_iso_pathtable_directories_current['name_ascii'].'/'; - } - $FullPathArray[] = $thisfile_iso_pathtable_directories_current['full_path']; - - $pathcounter++; - } - - return true; - } - - - function ParseDirectoryRecord(&$fd, $directorydata, &$ThisFileInfo) { - if (isset($ThisFileInfo['iso']['supplementary_volume_descriptor'])) { - $TextEncoding = 'UTF-16BE'; // Big-Endian Unicode - } else { - $TextEncoding = 'ISO-8859-1'; // Latin-1 - } - - fseek($fd, $directorydata['location_bytes'], SEEK_SET); - $DirectoryRecordData = fread($fd, 1); - - while (ord($DirectoryRecordData{0}) > 33) { - - $DirectoryRecordData .= fread($fd, ord($DirectoryRecordData{0}) - 1); - - $ThisDirectoryRecord['raw']['length'] = getid3_lib::LittleEndian2Int(substr($DirectoryRecordData, 0, 1)); - $ThisDirectoryRecord['raw']['extended_attribute_length'] = getid3_lib::LittleEndian2Int(substr($DirectoryRecordData, 1, 1)); - $ThisDirectoryRecord['raw']['offset_logical'] = getid3_lib::LittleEndian2Int(substr($DirectoryRecordData, 2, 4)); - $ThisDirectoryRecord['raw']['filesize'] = getid3_lib::LittleEndian2Int(substr($DirectoryRecordData, 10, 4)); - $ThisDirectoryRecord['raw']['recording_date_time'] = substr($DirectoryRecordData, 18, 7); - $ThisDirectoryRecord['raw']['file_flags'] = getid3_lib::LittleEndian2Int(substr($DirectoryRecordData, 25, 1)); - $ThisDirectoryRecord['raw']['file_unit_size'] = getid3_lib::LittleEndian2Int(substr($DirectoryRecordData, 26, 1)); - $ThisDirectoryRecord['raw']['interleave_gap_size'] = getid3_lib::LittleEndian2Int(substr($DirectoryRecordData, 27, 1)); - $ThisDirectoryRecord['raw']['volume_sequence_number'] = getid3_lib::LittleEndian2Int(substr($DirectoryRecordData, 28, 2)); - $ThisDirectoryRecord['raw']['file_identifier_length'] = getid3_lib::LittleEndian2Int(substr($DirectoryRecordData, 32, 1)); - $ThisDirectoryRecord['raw']['file_identifier'] = substr($DirectoryRecordData, 33, $ThisDirectoryRecord['raw']['file_identifier_length']); - - $ThisDirectoryRecord['file_identifier_ascii'] = getid3_lib::iconv_fallback($TextEncoding, $ThisFileInfo['encoding'], $ThisDirectoryRecord['raw']['file_identifier']); - - $ThisDirectoryRecord['filesize'] = $ThisDirectoryRecord['raw']['filesize']; - $ThisDirectoryRecord['offset_bytes'] = $ThisDirectoryRecord['raw']['offset_logical'] * 2048; - $ThisDirectoryRecord['file_flags']['hidden'] = (bool) ($ThisDirectoryRecord['raw']['file_flags'] & 0x01); - $ThisDirectoryRecord['file_flags']['directory'] = (bool) ($ThisDirectoryRecord['raw']['file_flags'] & 0x02); - $ThisDirectoryRecord['file_flags']['associated'] = (bool) ($ThisDirectoryRecord['raw']['file_flags'] & 0x04); - $ThisDirectoryRecord['file_flags']['extended'] = (bool) ($ThisDirectoryRecord['raw']['file_flags'] & 0x08); - $ThisDirectoryRecord['file_flags']['permissions'] = (bool) ($ThisDirectoryRecord['raw']['file_flags'] & 0x10); - $ThisDirectoryRecord['file_flags']['multiple'] = (bool) ($ThisDirectoryRecord['raw']['file_flags'] & 0x80); - $ThisDirectoryRecord['recording_timestamp'] = $this->ISOtime2UNIXtime($ThisDirectoryRecord['raw']['recording_date_time']); - - if ($ThisDirectoryRecord['file_flags']['directory']) { - $ThisDirectoryRecord['filename'] = $directorydata['full_path']; - } else { - $ThisDirectoryRecord['filename'] = $directorydata['full_path'].$this->ISOstripFilenameVersion($ThisDirectoryRecord['file_identifier_ascii']); - $ThisFileInfo['iso']['files'] = getid3_lib::array_merge_clobber($ThisFileInfo['iso']['files'], getid3_lib::CreateDeepArray($ThisDirectoryRecord['filename'], '/', $ThisDirectoryRecord['filesize'])); - } - - $DirectoryRecord[] = $ThisDirectoryRecord; - $DirectoryRecordData = fread($fd, 1); - } - - return $DirectoryRecord; - } - - function ISOstripFilenameVersion($ISOfilename) { - // convert 'filename.ext;1' to 'filename.ext' - if (!strstr($ISOfilename, ';')) { - return $ISOfilename; - } else { - return substr($ISOfilename, 0, strpos($ISOfilename, ';')); - } - } - - function ISOtimeText2UNIXtime($ISOtime) { - - $UNIXyear = (int) substr($ISOtime, 0, 4); - $UNIXmonth = (int) substr($ISOtime, 4, 2); - $UNIXday = (int) substr($ISOtime, 6, 2); - $UNIXhour = (int) substr($ISOtime, 8, 2); - $UNIXminute = (int) substr($ISOtime, 10, 2); - $UNIXsecond = (int) substr($ISOtime, 12, 2); - - if (!$UNIXyear) { - return false; - } - return gmmktime($UNIXhour, $UNIXminute, $UNIXsecond, $UNIXmonth, $UNIXday, $UNIXyear); - } - - function ISOtime2UNIXtime($ISOtime) { - // Represented by seven bytes: - // 1: Number of years since 1900 - // 2: Month of the year from 1 to 12 - // 3: Day of the Month from 1 to 31 - // 4: Hour of the day from 0 to 23 - // 5: Minute of the hour from 0 to 59 - // 6: second of the minute from 0 to 59 - // 7: Offset from Greenwich Mean Time in number of 15 minute intervals from -48 (West) to +52 (East) - - $UNIXyear = ord($ISOtime{0}) + 1900; - $UNIXmonth = ord($ISOtime{1}); - $UNIXday = ord($ISOtime{2}); - $UNIXhour = ord($ISOtime{3}); - $UNIXminute = ord($ISOtime{4}); - $UNIXsecond = ord($ISOtime{5}); - $GMToffset = $this->TwosCompliment2Decimal(ord($ISOtime{5})); - - return gmmktime($UNIXhour, $UNIXminute, $UNIXsecond, $UNIXmonth, $UNIXday, $UNIXyear); - } - - function TwosCompliment2Decimal($BinaryValue) { - // http://sandbox.mc.edu/~bennet/cs110/tc/tctod.html - // First check if the number is negative or positive by looking at the sign bit. - // If it is positive, simply convert it to decimal. - // If it is negative, make it positive by inverting the bits and adding one. - // Then, convert the result to decimal. - // The negative of this number is the value of the original binary. - - if ($BinaryValue & 0x80) { - - // negative number - return (0 - ((~$BinaryValue & 0xFF) + 1)); - } else { - // positive number - return $BinaryValue; - } - } - - -} - -?>
\ No newline at end of file diff --git a/getid3/module.misc.msoffice.php b/getid3/module.misc.msoffice.php deleted file mode 100644 index cb65abf..0000000 --- a/getid3/module.misc.msoffice.php +++ /dev/null @@ -1,32 +0,0 @@ -<?php -///////////////////////////////////////////////////////////////// -/// getID3() by James Heinrich <info@getid3.org> // -// available at http://getid3.sourceforge.net // -// or http://www.getid3.org // -///////////////////////////////////////////////////////////////// -// See readme.txt for more details // -///////////////////////////////////////////////////////////////// -// // -// module.archive.doc.php // -// module for analyzing MS Office (.doc, .xls, etc) files // -// dependencies: NONE // -// /// -///////////////////////////////////////////////////////////////// - - -class getid3_doc -{ - - function getid3_doc(&$fd, &$ThisFileInfo) { - - $ThisFileInfo['fileformat'] = 'doc'; - - $ThisFileInfo['error'][] = 'MS Office (.doc, .xls, etc) parsing not enabled in this version of getID3()'; - return false; - - } - -} - - -?>
\ No newline at end of file diff --git a/getid3/module.misc.par2.php b/getid3/module.misc.par2.php deleted file mode 100644 index 9f0e221..0000000 --- a/getid3/module.misc.par2.php +++ /dev/null @@ -1,32 +0,0 @@ -<?php -///////////////////////////////////////////////////////////////// -/// getID3() by James Heinrich <info@getid3.org> // -// available at http://getid3.sourceforge.net // -// or http://www.getid3.org // -///////////////////////////////////////////////////////////////// -// See readme.txt for more details // -///////////////////////////////////////////////////////////////// -// // -// module.misc.par2.php // -// module for analyzing PAR2 files // -// dependencies: NONE // -// /// -///////////////////////////////////////////////////////////////// - - -class getid3_par2 -{ - - function getid3_par2(&$fd, &$ThisFileInfo) { - - $ThisFileInfo['fileformat'] = 'par2'; - - $ThisFileInfo['error'][] = 'PAR2 parsing not enabled in this version of getID3()'; - return false; - - } - -} - - -?>
\ No newline at end of file diff --git a/getid3/module.misc.pdf.php b/getid3/module.misc.pdf.php deleted file mode 100644 index c6e3294..0000000 --- a/getid3/module.misc.pdf.php +++ /dev/null @@ -1,32 +0,0 @@ -<?php -///////////////////////////////////////////////////////////////// -/// getID3() by James Heinrich <info@getid3.org> // -// available at http://getid3.sourceforge.net // -// or http://www.getid3.org // -///////////////////////////////////////////////////////////////// -// See readme.txt for more details // -///////////////////////////////////////////////////////////////// -// // -// module.misc.pdf.php // -// module for analyzing PDF files // -// dependencies: NONE // -// /// -///////////////////////////////////////////////////////////////// - - -class getid3_pdf -{ - - function getid3_pdf(&$fd, &$ThisFileInfo) { - - $ThisFileInfo['fileformat'] = 'pdf'; - - $ThisFileInfo['error'][] = 'PDF parsing not enabled in this version of getID3()'; - return false; - - } - -} - - -?>
\ No newline at end of file diff --git a/getid3/module.tag.apetag.php b/getid3/module.tag.apetag.php deleted file mode 100644 index 2b67e14..0000000 --- a/getid3/module.tag.apetag.php +++ /dev/null @@ -1,290 +0,0 @@ -<?php -///////////////////////////////////////////////////////////////// -/// getID3() by James Heinrich <info@getid3.org> // -// available at http://getid3.sourceforge.net // -// or http://www.getid3.org // -///////////////////////////////////////////////////////////////// -// See readme.txt for more details // -///////////////////////////////////////////////////////////////// -// // -// module.tag.apetag.php // -// module for analyzing APE tags // -// dependencies: NONE // -// /// -///////////////////////////////////////////////////////////////// - -class getid3_apetag -{ - - function getid3_apetag(&$fd, &$ThisFileInfo, $overrideendoffset=0) { - - if ($ThisFileInfo['filesize'] >= pow(2, 31)) { - $ThisFileInfo['warning'][] = 'Unable to check for APEtags because file is larger than 2GB'; - return false; - } - - $id3v1tagsize = 128; - $apetagheadersize = 32; - $lyrics3tagsize = 10; - - if ($overrideendoffset == 0) { - - fseek($fd, 0 - $id3v1tagsize - $apetagheadersize - $lyrics3tagsize, SEEK_END); - $APEfooterID3v1 = fread($fd, $id3v1tagsize + $apetagheadersize + $lyrics3tagsize); - - //if (preg_match('/APETAGEX.{24}TAG.{125}$/i', $APEfooterID3v1)) { - if (substr($APEfooterID3v1, strlen($APEfooterID3v1) - $id3v1tagsize - $apetagheadersize, 8) == 'APETAGEX') { - - // APE tag found before ID3v1 - $ThisFileInfo['ape']['tag_offset_end'] = $ThisFileInfo['filesize'] - $id3v1tagsize; - - //} elseif (preg_match('/APETAGEX.{24}$/i', $APEfooterID3v1)) { - } elseif (substr($APEfooterID3v1, strlen($APEfooterID3v1) - $apetagheadersize, 8) == 'APETAGEX') { - - // APE tag found, no ID3v1 - $ThisFileInfo['ape']['tag_offset_end'] = $ThisFileInfo['filesize']; - - } - - } else { - - fseek($fd, $overrideendoffset - $apetagheadersize, SEEK_SET); - if (fread($fd, 8) == 'APETAGEX') { - $ThisFileInfo['ape']['tag_offset_end'] = $overrideendoffset; - } - - } - if (!isset($ThisFileInfo['ape']['tag_offset_end'])) { - - // APE tag not found - unset($ThisFileInfo['ape']); - return false; - - } - - // shortcut - $thisfile_ape = &$ThisFileInfo['ape']; - - fseek($fd, $thisfile_ape['tag_offset_end'] - $apetagheadersize, SEEK_SET); - $APEfooterData = fread($fd, 32); - if (!($thisfile_ape['footer'] = $this->parseAPEheaderFooter($APEfooterData))) { - $ThisFileInfo['error'][] = 'Error parsing APE footer at offset '.$thisfile_ape['tag_offset_end']; - return false; - } - - if (isset($thisfile_ape['footer']['flags']['header']) && $thisfile_ape['footer']['flags']['header']) { - fseek($fd, $thisfile_ape['tag_offset_end'] - $thisfile_ape['footer']['raw']['tagsize'] - $apetagheadersize, SEEK_SET); - $thisfile_ape['tag_offset_start'] = ftell($fd); - $APEtagData = fread($fd, $thisfile_ape['footer']['raw']['tagsize'] + $apetagheadersize); - } else { - $thisfile_ape['tag_offset_start'] = $thisfile_ape['tag_offset_end'] - $thisfile_ape['footer']['raw']['tagsize']; - fseek($fd, $thisfile_ape['tag_offset_start'], SEEK_SET); - $APEtagData = fread($fd, $thisfile_ape['footer']['raw']['tagsize']); - } - $ThisFileInfo['avdataend'] = $thisfile_ape['tag_offset_start']; - - if (isset($ThisFileInfo['id3v1']['tag_offset_start']) && ($ThisFileInfo['id3v1']['tag_offset_start'] < $thisfile_ape['tag_offset_end'])) { - $ThisFileInfo['warning'][] = 'ID3v1 tag information ignored since it appears to be a false synch in APEtag data'; - unset($ThisFileInfo['id3v1']); - foreach ($ThisFileInfo['warning'] as $key => $value) { - if ($value == 'Some ID3v1 fields do not use NULL characters for padding') { - unset($ThisFileInfo['warning'][$key]); - sort($ThisFileInfo['warning']); - break; - } - } - } - - $offset = 0; - if (isset($thisfile_ape['footer']['flags']['header']) && $thisfile_ape['footer']['flags']['header']) { - if ($thisfile_ape['header'] = $this->parseAPEheaderFooter(substr($APEtagData, 0, $apetagheadersize))) { - $offset += $apetagheadersize; - } else { - $ThisFileInfo['error'][] = 'Error parsing APE header at offset '.$thisfile_ape['tag_offset_start']; - return false; - } - } - - // shortcut - $ThisFileInfo['replay_gain'] = array(); - $thisfile_replaygain = &$ThisFileInfo['replay_gain']; - - for ($i = 0; $i < $thisfile_ape['footer']['raw']['tag_items']; $i++) { - $value_size = getid3_lib::LittleEndian2Int(substr($APEtagData, $offset, 4)); - $offset += 4; - $item_flags = getid3_lib::LittleEndian2Int(substr($APEtagData, $offset, 4)); - $offset += 4; - if (strstr(substr($APEtagData, $offset), "\x00") === false) { - $ThisFileInfo['error'][] = 'Cannot find null-byte (0x00) seperator between ItemKey #'.$i.' and value. ItemKey starts '.$offset.' bytes into the APE tag, at file offset '.($thisfile_ape['tag_offset_start'] + $offset); - return false; - } - $ItemKeyLength = strpos($APEtagData, "\x00", $offset) - $offset; - $item_key = strtolower(substr($APEtagData, $offset, $ItemKeyLength)); - - // shortcut - $thisfile_ape['items'][$item_key] = array(); - $thisfile_ape_items_current = &$thisfile_ape['items'][$item_key]; - - $offset += ($ItemKeyLength + 1); // skip 0x00 terminator - $thisfile_ape_items_current['data'] = substr($APEtagData, $offset, $value_size); - $offset += $value_size; - - $thisfile_ape_items_current['flags'] = $this->parseAPEtagFlags($item_flags); - switch ($thisfile_ape_items_current['flags']['item_contents_raw']) { - case 0: // UTF-8 - case 3: // Locator (URL, filename, etc), UTF-8 encoded - $thisfile_ape_items_current['data'] = explode("\x00", trim($thisfile_ape_items_current['data'])); - break; - - default: // binary data - break; - } - - switch (strtolower($item_key)) { - case 'replaygain_track_gain': - $thisfile_replaygain['track']['adjustment'] = (float) str_replace(',', '.', $thisfile_ape_items_current['data'][0]); // float casting will see "0,95" as zero! - $thisfile_replaygain['track']['originator'] = 'unspecified'; - break; - - case 'replaygain_track_peak': - $thisfile_replaygain['track']['peak'] = (float) str_replace(',', '.', $thisfile_ape_items_current['data'][0]); // float casting will see "0,95" as zero! - $thisfile_replaygain['track']['originator'] = 'unspecified'; - if ($thisfile_replaygain['track']['peak'] <= 0) { - $ThisFileInfo['warning'][] = 'ReplayGain Track peak from APEtag appears invalid: '.$thisfile_replaygain['track']['peak'].' (original value = "'.$thisfile_ape_items_current['data'][0].'")'; - } - break; - - case 'replaygain_album_gain': - $thisfile_replaygain['album']['adjustment'] = (float) str_replace(',', '.', $thisfile_ape_items_current['data'][0]); // float casting will see "0,95" as zero! - $thisfile_replaygain['album']['originator'] = 'unspecified'; - break; - - case 'replaygain_album_peak': - $thisfile_replaygain['album']['peak'] = (float) str_replace(',', '.', $thisfile_ape_items_current['data'][0]); // float casting will see "0,95" as zero! - $thisfile_replaygain['album']['originator'] = 'unspecified'; - if ($thisfile_replaygain['album']['peak'] <= 0) { - $ThisFileInfo['warning'][] = 'ReplayGain Album peak from APEtag appears invalid: '.$thisfile_replaygain['album']['peak'].' (original value = "'.$thisfile_ape_items_current['data'][0].'")'; - } - break; - - case 'mp3gain_undo': - list($mp3gain_undo_left, $mp3gain_undo_right, $mp3gain_undo_wrap) = explode(',', $thisfile_ape_items_current['data'][0]); - $thisfile_replaygain['mp3gain']['undo_left'] = intval($mp3gain_undo_left); - $thisfile_replaygain['mp3gain']['undo_right'] = intval($mp3gain_undo_right); - $thisfile_replaygain['mp3gain']['undo_wrap'] = (($mp3gain_undo_wrap == 'Y') ? true : false); - break; - - case 'mp3gain_minmax': - list($mp3gain_globalgain_min, $mp3gain_globalgain_max) = explode(',', $thisfile_ape_items_current['data'][0]); - $thisfile_replaygain['mp3gain']['globalgain_track_min'] = intval($mp3gain_globalgain_min); - $thisfile_replaygain['mp3gain']['globalgain_track_max'] = intval($mp3gain_globalgain_max); - break; - - case 'mp3gain_album_minmax': - list($mp3gain_globalgain_album_min, $mp3gain_globalgain_album_max) = explode(',', $thisfile_ape_items_current['data'][0]); - $thisfile_replaygain['mp3gain']['globalgain_album_min'] = intval($mp3gain_globalgain_album_min); - $thisfile_replaygain['mp3gain']['globalgain_album_max'] = intval($mp3gain_globalgain_album_max); - break; - - case 'tracknumber': - foreach ($thisfile_ape_items_current['data'] as $comment) { - $thisfile_ape['comments']['track'][] = $comment; - } - break; - - default: - foreach ($thisfile_ape_items_current['data'] as $comment) { - $thisfile_ape['comments'][strtolower($item_key)][] = $comment; - } - break; - } - - } - if (empty($thisfile_replaygain)) { - unset($ThisFileInfo['replay_gain']); - } - - return true; - } - - function parseAPEheaderFooter($APEheaderFooterData) { - // http://www.uni-jena.de/~pfk/mpp/sv8/apeheader.html - - // shortcut - $headerfooterinfo['raw'] = array(); - $headerfooterinfo_raw = &$headerfooterinfo['raw']; - - $headerfooterinfo_raw['footer_tag'] = substr($APEheaderFooterData, 0, 8); - if ($headerfooterinfo_raw['footer_tag'] != 'APETAGEX') { - return false; - } - $headerfooterinfo_raw['version'] = getid3_lib::LittleEndian2Int(substr($APEheaderFooterData, 8, 4)); - $headerfooterinfo_raw['tagsize'] = getid3_lib::LittleEndian2Int(substr($APEheaderFooterData, 12, 4)); - $headerfooterinfo_raw['tag_items'] = getid3_lib::LittleEndian2Int(substr($APEheaderFooterData, 16, 4)); - $headerfooterinfo_raw['global_flags'] = getid3_lib::LittleEndian2Int(substr($APEheaderFooterData, 20, 4)); - $headerfooterinfo_raw['reserved'] = substr($APEheaderFooterData, 24, 8); - - $headerfooterinfo['tag_version'] = $headerfooterinfo_raw['version'] / 1000; - if ($headerfooterinfo['tag_version'] >= 2) { - $headerfooterinfo['flags'] = $this->parseAPEtagFlags($headerfooterinfo_raw['global_flags']); - } - return $headerfooterinfo; - } - - function parseAPEtagFlags($rawflagint) { - // "Note: APE Tags 1.0 do not use any of the APE Tag flags. - // All are set to zero on creation and ignored on reading." - // http://www.uni-jena.de/~pfk/mpp/sv8/apetagflags.html - $flags['header'] = (bool) ($rawflagint & 0x80000000); - $flags['footer'] = (bool) ($rawflagint & 0x40000000); - $flags['this_is_header'] = (bool) ($rawflagint & 0x20000000); - $flags['item_contents_raw'] = ($rawflagint & 0x00000006) >> 1; - $flags['read_only'] = (bool) ($rawflagint & 0x00000001); - - $flags['item_contents'] = $this->APEcontentTypeFlagLookup($flags['item_contents_raw']); - - return $flags; - } - - function APEcontentTypeFlagLookup($contenttypeid) { - static $APEcontentTypeFlagLookup = array( - 0 => 'utf-8', - 1 => 'binary', - 2 => 'external', - 3 => 'reserved' - ); - return (isset($APEcontentTypeFlagLookup[$contenttypeid]) ? $APEcontentTypeFlagLookup[$contenttypeid] : 'invalid'); - } - - function APEtagItemIsUTF8Lookup($itemkey) { - static $APEtagItemIsUTF8Lookup = array( - 'title', - 'subtitle', - 'artist', - 'album', - 'debut album', - 'publisher', - 'conductor', - 'track', - 'composer', - 'comment', - 'copyright', - 'publicationright', - 'file', - 'year', - 'record date', - 'record location', - 'genre', - 'media', - 'related', - 'isrc', - 'abstract', - 'language', - 'bibliography' - ); - return in_array(strtolower($itemkey), $APEtagItemIsUTF8Lookup); - } - -} - -?>
\ No newline at end of file diff --git a/getid3/module.tag.id3v1.php b/getid3/module.tag.id3v1.php deleted file mode 100644 index 6fd2dd8..0000000 --- a/getid3/module.tag.id3v1.php +++ /dev/null @@ -1,361 +0,0 @@ -<?php -///////////////////////////////////////////////////////////////// -/// getID3() by James Heinrich <info@getid3.org> // -// available at http://getid3.sourceforge.net // -// or http://www.getid3.org // -///////////////////////////////////////////////////////////////// -// See readme.txt for more details // -///////////////////////////////////////////////////////////////// -// // -// module.tag.id3v1.php // -// module for analyzing ID3v1 tags // -// dependencies: NONE // -// /// -///////////////////////////////////////////////////////////////// - - -class getid3_id3v1 -{ - - function getid3_id3v1(&$fd, &$ThisFileInfo) { - - if ($ThisFileInfo['filesize'] >= pow(2, 31)) { - $ThisFileInfo['warning'][] = 'Unable to check for ID3v1 because file is larger than 2GB'; - return false; - } - - fseek($fd, -256, SEEK_END); - $preid3v1 = fread($fd, 128); - $id3v1tag = fread($fd, 128); - - if (substr($id3v1tag, 0, 3) == 'TAG') { - - $ThisFileInfo['avdataend'] = $ThisFileInfo['filesize'] - 128; - - $ParsedID3v1['title'] = $this->cutfield(substr($id3v1tag, 3, 30)); - $ParsedID3v1['artist'] = $this->cutfield(substr($id3v1tag, 33, 30)); - $ParsedID3v1['album'] = $this->cutfield(substr($id3v1tag, 63, 30)); - $ParsedID3v1['year'] = $this->cutfield(substr($id3v1tag, 93, 4)); - $ParsedID3v1['comment'] = substr($id3v1tag, 97, 30); // can't remove nulls yet, track detection depends on them - $ParsedID3v1['genreid'] = ord(substr($id3v1tag, 127, 1)); - - // If second-last byte of comment field is null and last byte of comment field is non-null - // then this is ID3v1.1 and the comment field is 28 bytes long and the 30th byte is the track number - if (($id3v1tag{125} === "\x00") && ($id3v1tag{126} !== "\x00")) { - $ParsedID3v1['track'] = ord(substr($ParsedID3v1['comment'], 29, 1)); - $ParsedID3v1['comment'] = substr($ParsedID3v1['comment'], 0, 28); - } - $ParsedID3v1['comment'] = $this->cutfield($ParsedID3v1['comment']); - - $ParsedID3v1['genre'] = $this->LookupGenreName($ParsedID3v1['genreid']); - if (!empty($ParsedID3v1['genre'])) { - unset($ParsedID3v1['genreid']); - } - if (empty($ParsedID3v1['genre']) || (@$ParsedID3v1['genre'] == 'Unknown')) { - unset($ParsedID3v1['genre']); - } - - foreach ($ParsedID3v1 as $key => $value) { - $ParsedID3v1['comments'][$key][0] = $value; - } - - // ID3v1 data is supposed to be padded with NULL characters, but some taggers pad with spaces - $GoodFormatID3v1tag = $this->GenerateID3v1Tag( - $ParsedID3v1['title'], - $ParsedID3v1['artist'], - $ParsedID3v1['album'], - $ParsedID3v1['year'], - (isset($ParsedID3v1['genre']) ? $this->LookupGenreID($ParsedID3v1['genre']) : false), - $ParsedID3v1['comment'], - @$ParsedID3v1['track']); - $ParsedID3v1['padding_valid'] = true; - if ($id3v1tag !== $GoodFormatID3v1tag) { - $ParsedID3v1['padding_valid'] = false; - $ThisFileInfo['warning'][] = 'Some ID3v1 fields do not use NULL characters for padding'; - } - - $ParsedID3v1['tag_offset_end'] = $ThisFileInfo['filesize']; - $ParsedID3v1['tag_offset_start'] = $ParsedID3v1['tag_offset_end'] - 128; - - $ThisFileInfo['id3v1'] = $ParsedID3v1; - } - - if (substr($preid3v1, 0, 3) == 'TAG') { - // The way iTunes handles tags is, well, brain-damaged. - // It completely ignores v1 if ID3v2 is present. - // This goes as far as adding a new v1 tag *even if there already is one* - - // A suspected double-ID3v1 tag has been detected, but it could be that - // the "TAG" identifier is a legitimate part of an APE or Lyrics3 tag - if (substr($preid3v1, 96, 8) == 'APETAGEX') { - // an APE tag footer was found before the last ID3v1, assume false "TAG" synch - } elseif (substr($preid3v1, 119, 6) == 'LYRICS') { - // a Lyrics3 tag footer was found before the last ID3v1, assume false "TAG" synch - } else { - // APE and Lyrics3 footers not found - assume double ID3v1 - $ThisFileInfo['warning'][] = 'Duplicate ID3v1 tag detected - this has been known to happen with iTunes'; - $ThisFileInfo['avdataend'] -= 128; - } - } - - return true; - } - - function cutfield($str) { - return trim(substr($str, 0, strcspn($str, "\x00"))); - } - - function ArrayOfGenres($allowSCMPXextended=false) { - static $GenreLookup = array( - 0 => 'Blues', - 1 => 'Classic Rock', - 2 => 'Country', - 3 => 'Dance', - 4 => 'Disco', - 5 => 'Funk', - 6 => 'Grunge', - 7 => 'Hip-Hop', - 8 => 'Jazz', - 9 => 'Metal', - 10 => 'New Age', - 11 => 'Oldies', - 12 => 'Other', - 13 => 'Pop', - 14 => 'R&B', - 15 => 'Rap', - 16 => 'Reggae', - 17 => 'Rock', - 18 => 'Techno', - 19 => 'Industrial', - 20 => 'Alternative', - 21 => 'Ska', - 22 => 'Death Metal', - 23 => 'Pranks', - 24 => 'Soundtrack', - 25 => 'Euro-Techno', - 26 => 'Ambient', - 27 => 'Trip-Hop', - 28 => 'Vocal', - 29 => 'Jazz+Funk', - 30 => 'Fusion', - 31 => 'Trance', - 32 => 'Classical', - 33 => 'Instrumental', - 34 => 'Acid', - 35 => 'House', - 36 => 'Game', - 37 => 'Sound Clip', - 38 => 'Gospel', - 39 => 'Noise', - 40 => 'Alt. Rock', - 41 => 'Bass', - 42 => 'Soul', - 43 => 'Punk', - 44 => 'Space', - 45 => 'Meditative', - 46 => 'Instrumental Pop', - 47 => 'Instrumental Rock', - 48 => 'Ethnic', - 49 => 'Gothic', - 50 => 'Darkwave', - 51 => 'Techno-Industrial', - 52 => 'Electronic', - 53 => 'Pop-Folk', - 54 => 'Eurodance', - 55 => 'Dream', - 56 => 'Southern Rock', - 57 => 'Comedy', - 58 => 'Cult', - 59 => 'Gangsta Rap', - 60 => 'Top 40', - 61 => 'Christian Rap', - 62 => 'Pop/Funk', - 63 => 'Jungle', - 64 => 'Native American', - 65 => 'Cabaret', - 66 => 'New Wave', - 67 => 'Psychedelic', - 68 => 'Rave', - 69 => 'Showtunes', - 70 => 'Trailer', - 71 => 'Lo-Fi', - 72 => 'Tribal', - 73 => 'Acid Punk', - 74 => 'Acid Jazz', - 75 => 'Polka', - 76 => 'Retro', - 77 => 'Musical', - 78 => 'Rock & Roll', - 79 => 'Hard Rock', - 80 => 'Folk', - 81 => 'Folk/Rock', - 82 => 'National Folk', - 83 => 'Swing', - 84 => 'Fast-Fusion', - 85 => 'Bebob', - 86 => 'Latin', - 87 => 'Revival', - 88 => 'Celtic', - 89 => 'Bluegrass', - 90 => 'Avantgarde', - 91 => 'Gothic Rock', - 92 => 'Progressive Rock', - 93 => 'Psychedelic Rock', - 94 => 'Symphonic Rock', - 95 => 'Slow Rock', - 96 => 'Big Band', - 97 => 'Chorus', - 98 => 'Easy Listening', - 99 => 'Acoustic', - 100 => 'Humour', - 101 => 'Speech', - 102 => 'Chanson', - 103 => 'Opera', - 104 => 'Chamber Music', - 105 => 'Sonata', - 106 => 'Symphony', - 107 => 'Booty Bass', - 108 => 'Primus', - 109 => 'Porn Groove', - 110 => 'Satire', - 111 => 'Slow Jam', - 112 => 'Club', - 113 => 'Tango', - 114 => 'Samba', - 115 => 'Folklore', - 116 => 'Ballad', - 117 => 'Power Ballad', - 118 => 'Rhythmic Soul', - 119 => 'Freestyle', - 120 => 'Duet', - 121 => 'Punk Rock', - 122 => 'Drum Solo', - 123 => 'A Cappella', - 124 => 'Euro-House', - 125 => 'Dance Hall', - 126 => 'Goa', - 127 => 'Drum & Bass', - 128 => 'Club-House', - 129 => 'Hardcore', - 130 => 'Terror', - 131 => 'Indie', - 132 => 'BritPop', - 133 => 'Negerpunk', - 134 => 'Polsk Punk', - 135 => 'Beat', - 136 => 'Christian Gangsta Rap', - 137 => 'Heavy Metal', - 138 => 'Black Metal', - 139 => 'Crossover', - 140 => 'Contemporary Christian', - 141 => 'Christian Rock', - 142 => 'Merengue', - 143 => 'Salsa', - 144 => 'Trash Metal', - 145 => 'Anime', - 146 => 'JPop', - 147 => 'Synthpop', - - 255 => 'Unknown', - - 'CR' => 'Cover', - 'RX' => 'Remix' - ); - - static $GenreLookupSCMPX = array(); - if ($allowSCMPXextended && empty($GenreLookupSCMPX)) { - $GenreLookupSCMPX = $GenreLookup; - // http://www.geocities.co.jp/SiliconValley-Oakland/3664/alittle.html#GenreExtended - // Extended ID3v1 genres invented by SCMPX - // Note that 255 "Japanese Anime" conflicts with standard "Unknown" - $GenreLookupSCMPX[240] = 'Sacred'; - $GenreLookupSCMPX[241] = 'Northern Europe'; - $GenreLookupSCMPX[242] = 'Irish & Scottish'; - $GenreLookupSCMPX[243] = 'Scotland'; - $GenreLookupSCMPX[244] = 'Ethnic Europe'; - $GenreLookupSCMPX[245] = 'Enka'; - $GenreLookupSCMPX[246] = 'Children\'s Song'; - $GenreLookupSCMPX[247] = 'Japanese Sky'; - $GenreLookupSCMPX[248] = 'Japanese Heavy Rock'; - $GenreLookupSCMPX[249] = 'Japanese Doom Rock'; - $GenreLookupSCMPX[250] = 'Japanese J-POP'; - $GenreLookupSCMPX[251] = 'Japanese Seiyu'; - $GenreLookupSCMPX[252] = 'Japanese Ambient Techno'; - $GenreLookupSCMPX[253] = 'Japanese Moemoe'; - $GenreLookupSCMPX[254] = 'Japanese Tokusatsu'; - //$GenreLookupSCMPX[255] = 'Japanese Anime'; - } - - return ($allowSCMPXextended ? $GenreLookupSCMPX : $GenreLookup); - } - - function LookupGenreName($genreid, $allowSCMPXextended=true) { - switch ($genreid) { - case 'RX': - case 'CR': - break; - default: - $genreid = intval($genreid); // to handle 3 or '3' or '03' - break; - } - $GenreLookup = getid3_id3v1::ArrayOfGenres($allowSCMPXextended); - return (isset($GenreLookup[$genreid]) ? $GenreLookup[$genreid] : false); - } - - function LookupGenreID($genre, $allowSCMPXextended=false) { - $GenreLookup = getid3_id3v1::ArrayOfGenres($allowSCMPXextended); - $LowerCaseNoSpaceSearchTerm = strtolower(str_replace(' ', '', $genre)); - foreach ($GenreLookup as $key => $value) { - foreach ($GenreLookup as $key => $value) { - if (strtolower(str_replace(' ', '', $value)) == $LowerCaseNoSpaceSearchTerm) { - return $key; - } - } - return false; - } - return (isset($GenreLookup[$genreid]) ? $GenreLookup[$genreid] : false); - } - - function StandardiseID3v1GenreName($OriginalGenre) { - if (($GenreID = getid3_id3v1::LookupGenreID($OriginalGenre)) !== false) { - return getid3_id3v1::LookupGenreName($GenreID); - } - return $OriginalGenre; - } - - function GenerateID3v1Tag($title, $artist, $album, $year, $genreid, $comment, $track='') { - $ID3v1Tag = 'TAG'; - $ID3v1Tag .= str_pad(trim(substr($title, 0, 30)), 30, "\x00", STR_PAD_RIGHT); - $ID3v1Tag .= str_pad(trim(substr($artist, 0, 30)), 30, "\x00", STR_PAD_RIGHT); - $ID3v1Tag .= str_pad(trim(substr($album, 0, 30)), 30, "\x00", STR_PAD_RIGHT); - $ID3v1Tag .= str_pad(trim(substr($year, 0, 4)), 4, "\x00", STR_PAD_LEFT); - if (!empty($track) && ($track > 0) && ($track <= 255)) { - $ID3v1Tag .= str_pad(trim(substr($comment, 0, 28)), 28, "\x00", STR_PAD_RIGHT); - $ID3v1Tag .= "\x00"; - if (gettype($track) == 'string') { - $track = (int) $track; - } - $ID3v1Tag .= chr($track); - } else { - $ID3v1Tag .= str_pad(trim(substr($comment, 0, 30)), 30, "\x00", STR_PAD_RIGHT); - } - if (($genreid < 0) || ($genreid > 147)) { - $genreid = 255; // 'unknown' genre - } - switch (gettype($genreid)) { - case 'string': - case 'integer': - $ID3v1Tag .= chr(intval($genreid)); - break; - default: - $ID3v1Tag .= chr(255); // 'unknown' genre - break; - } - - return $ID3v1Tag; - } - -} - - -?>
\ No newline at end of file diff --git a/getid3/module.tag.id3v2.php b/getid3/module.tag.id3v2.php deleted file mode 100644 index 701d728..0000000 --- a/getid3/module.tag.id3v2.php +++ /dev/null @@ -1,3200 +0,0 @@ -<?php -///////////////////////////////////////////////////////////////// -/// getID3() by James Heinrich <info@getid3.org> // -// available at http://getid3.sourceforge.net // -// or http://www.getid3.org // -///////////////////////////////////////////////////////////////// -// See readme.txt for more details // -///////////////////////////////////////////////////////////////// -/// // -// module.tag.id3v2.php // -// module for analyzing ID3v2 tags // -// dependencies: module.tag.id3v1.php // -// /// -///////////////////////////////////////////////////////////////// - -getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.tag.id3v1.php', __FILE__, true); - -class getid3_id3v2 -{ - - function getid3_id3v2(&$fd, &$ThisFileInfo, $StartingOffset=0) { - // Overall tag structure: - // +-----------------------------+ - // | Header (10 bytes) | - // +-----------------------------+ - // | Extended Header | - // | (variable length, OPTIONAL) | - // +-----------------------------+ - // | Frames (variable length) | - // +-----------------------------+ - // | Padding | - // | (variable length, OPTIONAL) | - // +-----------------------------+ - // | Footer (10 bytes, OPTIONAL) | - // +-----------------------------+ - - // Header - // ID3v2/file identifier "ID3" - // ID3v2 version $04 00 - // ID3v2 flags (%ab000000 in v2.2, %abc00000 in v2.3, %abcd0000 in v2.4.x) - // ID3v2 size 4 * %0xxxxxxx - - - // shortcuts - $ThisFileInfo['id3v2']['header'] = true; - $thisfile_id3v2 = &$ThisFileInfo['id3v2']; - $thisfile_id3v2['flags'] = array(); - $thisfile_id3v2_flags = &$thisfile_id3v2['flags']; - - - fseek($fd, $StartingOffset, SEEK_SET); - $header = fread($fd, 10); - if (substr($header, 0, 3) == 'ID3' && strlen($header) == 10) { - - $thisfile_id3v2['majorversion'] = ord($header{3}); - $thisfile_id3v2['minorversion'] = ord($header{4}); - - // shortcut - $id3v2_majorversion = &$thisfile_id3v2['majorversion']; - - } else { - - unset($ThisFileInfo['id3v2']); - return false; - - } - - if ($id3v2_majorversion > 4) { // this script probably won't correctly parse ID3v2.5.x and above (if it ever exists) - - $ThisFileInfo['error'][] = 'this script only parses up to ID3v2.4.x - this tag is ID3v2.'.$id3v2_majorversion.'.'.$thisfile_id3v2['minorversion']; - return false; - - } - - $id3_flags = ord($header{5}); - switch ($id3v2_majorversion) { - case 2: - // %ab000000 in v2.2 - $thisfile_id3v2_flags['unsynch'] = (bool) ($id3_flags & 0x80); // a - Unsynchronisation - $thisfile_id3v2_flags['compression'] = (bool) ($id3_flags & 0x40); // b - Compression - break; - - case 3: - // %abc00000 in v2.3 - $thisfile_id3v2_flags['unsynch'] = (bool) ($id3_flags & 0x80); // a - Unsynchronisation - $thisfile_id3v2_flags['exthead'] = (bool) ($id3_flags & 0x40); // b - Extended header - $thisfile_id3v2_flags['experim'] = (bool) ($id3_flags & 0x20); // c - Experimental indicator - break; - - case 4: - // %abcd0000 in v2.4 - $thisfile_id3v2_flags['unsynch'] = (bool) ($id3_flags & 0x80); // a - Unsynchronisation - $thisfile_id3v2_flags['exthead'] = (bool) ($id3_flags & 0x40); // b - Extended header - $thisfile_id3v2_flags['experim'] = (bool) ($id3_flags & 0x20); // c - Experimental indicator - $thisfile_id3v2_flags['isfooter'] = (bool) ($id3_flags & 0x10); // d - Footer present - break; - } - - $thisfile_id3v2['headerlength'] = getid3_lib::BigEndian2Int(substr($header, 6, 4), 1) + 10; // length of ID3v2 tag in 10-byte header doesn't include 10-byte header length - - $thisfile_id3v2['tag_offset_start'] = $StartingOffset; - $thisfile_id3v2['tag_offset_end'] = $thisfile_id3v2['tag_offset_start'] + $thisfile_id3v2['headerlength']; - - - - // create 'encoding' key - used by getid3::HandleAllTags() - // in ID3v2 every field can have it's own encoding type - // so force everything to UTF-8 so it can be handled consistantly - $thisfile_id3v2['encoding'] = 'UTF-8'; - - - // Frames - - // All ID3v2 frames consists of one frame header followed by one or more - // fields containing the actual information. The header is always 10 - // bytes and laid out as follows: - // - // Frame ID $xx xx xx xx (four characters) - // Size 4 * %0xxxxxxx - // Flags $xx xx - - $sizeofframes = $thisfile_id3v2['headerlength'] - 10; // not including 10-byte initial header - if (@$thisfile_id3v2['exthead']['length']) { - $sizeofframes -= ($thisfile_id3v2['exthead']['length'] + 4); - } - if (@$thisfile_id3v2_flags['isfooter']) { - $sizeofframes -= 10; // footer takes last 10 bytes of ID3v2 header, after frame data, before audio - } - if ($sizeofframes > 0) { - - $framedata = fread($fd, $sizeofframes); // read all frames from file into $framedata variable - - // if entire frame data is unsynched, de-unsynch it now (ID3v2.3.x) - if (@$thisfile_id3v2_flags['unsynch'] && ($id3v2_majorversion <= 3)) { - $framedata = $this->DeUnsynchronise($framedata); - } - // [in ID3v2.4.0] Unsynchronisation [S:6.1] is done on frame level, instead - // of on tag level, making it easier to skip frames, increasing the streamability - // of the tag. The unsynchronisation flag in the header [S:3.1] indicates that - // there exists an unsynchronised frame, while the new unsynchronisation flag in - // the frame header [S:4.1.2] indicates unsynchronisation. - - - //$framedataoffset = 10 + (@$thisfile_id3v2['exthead']['length'] ? $thisfile_id3v2['exthead']['length'] + 4 : 0); // how many bytes into the stream - start from after the 10-byte header (and extended header length+4, if present) - $framedataoffset = 10; // how many bytes into the stream - start from after the 10-byte header - - - // Extended Header - if (@$thisfile_id3v2_flags['exthead']) { - $extended_header_offset = 0; - - if ($id3v2_majorversion == 3) { - - // v2.3 definition: - //Extended header size $xx xx xx xx // 32-bit integer - //Extended Flags $xx xx - // %x0000000 %00000000 // v2.3 - // x - CRC data present - //Size of padding $xx xx xx xx - - $thisfile_id3v2['exthead']['length'] = getid3_lib::BigEndian2Int(substr($framedata, $extended_header_offset, 4), 0); - $extended_header_offset += 4; - - $thisfile_id3v2['exthead']['flag_bytes'] = 2; - $thisfile_id3v2['exthead']['flag_raw'] = getid3_lib::BigEndian2Int(substr($framedata, $extended_header_offset, $thisfile_id3v2['exthead']['flag_bytes'])); - $extended_header_offset += $thisfile_id3v2['exthead']['flag_bytes']; - - $thisfile_id3v2['exthead']['flags']['crc'] = (bool) ($thisfile_id3v2['exthead']['flag_raw'] & 0x8000); - - $thisfile_id3v2['exthead']['padding_size'] = getid3_lib::BigEndian2Int(substr($framedata, $extended_header_offset, 4)); - $extended_header_offset += 4; - - if ($thisfile_id3v2['exthead']['flags']['crc']) { - $thisfile_id3v2['exthead']['flag_data']['crc'] = getid3_lib::BigEndian2Int(substr($framedata, $extended_header_offset, 4)); - $extended_header_offset += 4; - } - $extended_header_offset += $thisfile_id3v2['exthead']['padding_size']; - - } elseif ($id3v2_majorversion == 4) { - - // v2.4 definition: - //Extended header size 4 * %0xxxxxxx // 28-bit synchsafe integer - //Number of flag bytes $01 - //Extended Flags $xx - // %0bcd0000 // v2.4 - // b - Tag is an update - // Flag data length $00 - // c - CRC data present - // Flag data length $05 - // Total frame CRC 5 * %0xxxxxxx - // d - Tag restrictions - // Flag data length $01 - - $thisfile_id3v2['exthead']['length'] = getid3_lib::BigEndian2Int(substr($framedata, $extended_header_offset, 4), 1); - $extended_header_offset += 4; - - $thisfile_id3v2['exthead']['flag_bytes'] = 1; - $thisfile_id3v2['exthead']['flag_raw'] = getid3_lib::BigEndian2Int(substr($framedata, $extended_header_offset, $thisfile_id3v2['exthead']['flag_bytes'])); - $extended_header_offset += $thisfile_id3v2['exthead']['flag_bytes']; - - $thisfile_id3v2['exthead']['flags']['update'] = (bool) ($thisfile_id3v2['exthead']['flag_raw'] & 0x4000); - $thisfile_id3v2['exthead']['flags']['crc'] = (bool) ($thisfile_id3v2['exthead']['flag_raw'] & 0x2000); - $thisfile_id3v2['exthead']['flags']['restrictions'] = (bool) ($thisfile_id3v2['exthead']['flag_raw'] & 0x1000); - - if ($thisfile_id3v2['exthead']['flags']['crc']) { - $thisfile_id3v2['exthead']['flag_data']['crc'] = getid3_lib::BigEndian2Int(substr($framedata, $extended_header_offset, 5), 1); - $extended_header_offset += 5; - } - if ($thisfile_id3v2['exthead']['flags']['restrictions']) { - // %ppqrrstt - $restrictions_raw = getid3_lib::BigEndian2Int(substr($framedata, $extended_header_offset, 1)); - $extended_header_offset += 1; - $thisfile_id3v2['exthead']['flags']['restrictions']['tagsize'] = ($restrictions_raw && 0xC0) >> 6; // p - Tag size restrictions - $thisfile_id3v2['exthead']['flags']['restrictions']['textenc'] = ($restrictions_raw && 0x20) >> 5; // q - Text encoding restrictions - $thisfile_id3v2['exthead']['flags']['restrictions']['textsize'] = ($restrictions_raw && 0x18) >> 3; // r - Text fields size restrictions - $thisfile_id3v2['exthead']['flags']['restrictions']['imgenc'] = ($restrictions_raw && 0x04) >> 2; // s - Image encoding restrictions - $thisfile_id3v2['exthead']['flags']['restrictions']['imgsize'] = ($restrictions_raw && 0x03) >> 0; // t - Image size restrictions - } - - } - $framedataoffset += $extended_header_offset; - $framedata = substr($framedata, $extended_header_offset); - } // end extended header - - - while (isset($framedata) && (strlen($framedata) > 0)) { // cycle through until no more frame data is left to parse - if (strlen($framedata) <= $this->ID3v2HeaderLength($id3v2_majorversion)) { - // insufficient room left in ID3v2 header for actual data - must be padding - $thisfile_id3v2['padding']['start'] = $framedataoffset; - $thisfile_id3v2['padding']['length'] = strlen($framedata); - $thisfile_id3v2['padding']['valid'] = true; - for ($i = 0; $i < $thisfile_id3v2['padding']['length']; $i++) { - if ($framedata{$i} != "\x00") { - $thisfile_id3v2['padding']['valid'] = false; - $thisfile_id3v2['padding']['errorpos'] = $thisfile_id3v2['padding']['start'] + $i; - $ThisFileInfo['warning'][] = 'Invalid ID3v2 padding found at offset '.$thisfile_id3v2['padding']['errorpos'].' (the remaining '.($thisfile_id3v2['padding']['length'] - $i).' bytes are considered invalid)'; - break; - } - } - break; // skip rest of ID3v2 header - } - if ($id3v2_majorversion == 2) { - // Frame ID $xx xx xx (three characters) - // Size $xx xx xx (24-bit integer) - // Flags $xx xx - - $frame_header = substr($framedata, 0, 6); // take next 6 bytes for header - $framedata = substr($framedata, 6); // and leave the rest in $framedata - $frame_name = substr($frame_header, 0, 3); - $frame_size = getid3_lib::BigEndian2Int(substr($frame_header, 3, 3), 0); - $frame_flags = 0; // not used for anything in ID3v2.2, just set to avoid E_NOTICEs - - } elseif ($id3v2_majorversion > 2) { - - // Frame ID $xx xx xx xx (four characters) - // Size $xx xx xx xx (32-bit integer in v2.3, 28-bit synchsafe in v2.4+) - // Flags $xx xx - - $frame_header = substr($framedata, 0, 10); // take next 10 bytes for header - $framedata = substr($framedata, 10); // and leave the rest in $framedata - - $frame_name = substr($frame_header, 0, 4); - if ($id3v2_majorversion == 3) { - $frame_size = getid3_lib::BigEndian2Int(substr($frame_header, 4, 4), 0); // 32-bit integer - } else { // ID3v2.4+ - $frame_size = getid3_lib::BigEndian2Int(substr($frame_header, 4, 4), 1); // 32-bit synchsafe integer (28-bit value) - } - - if ($frame_size < (strlen($framedata) + 4)) { - $nextFrameID = substr($framedata, $frame_size, 4); - if ($this->IsValidID3v2FrameName($nextFrameID, $id3v2_majorversion)) { - // next frame is OK - } elseif (($frame_name == "\x00".'MP3') || ($frame_name == "\x00\x00".'MP') || ($frame_name == ' MP3') || ($frame_name == 'MP3e')) { - // MP3ext known broken frames - "ok" for the purposes of this test - } elseif (($id3v2_majorversion == 4) && ($this->IsValidID3v2FrameName(substr($framedata, getid3_lib::BigEndian2Int(substr($frame_header, 4, 4), 0), 4), 3))) { - $ThisFileInfo['warning'][] = 'ID3v2 tag written as ID3v2.4, but with non-synchsafe integers (ID3v2.3 style). Older versions of (Helium2; iTunes) are known culprits of this. Tag has been parsed as ID3v2.3'; - $id3v2_majorversion = 3; - $frame_size = getid3_lib::BigEndian2Int(substr($frame_header, 4, 4), 0); // 32-bit integer - } - } - - - $frame_flags = getid3_lib::BigEndian2Int(substr($frame_header, 8, 2)); - } - - if ((($id3v2_majorversion == 2) && ($frame_name == "\x00\x00\x00")) || ($frame_name == "\x00\x00\x00\x00")) { - // padding encountered - - $thisfile_id3v2['padding']['start'] = $framedataoffset; - $thisfile_id3v2['padding']['length'] = strlen($frame_header) + strlen($framedata); - $thisfile_id3v2['padding']['valid'] = true; - - $len = strlen($framedata); - for ($i = 0; $i < $len; $i++) { - if ($framedata{$i} != "\x00") { - $thisfile_id3v2['padding']['valid'] = false; - $thisfile_id3v2['padding']['errorpos'] = $thisfile_id3v2['padding']['start'] + $i; - $ThisFileInfo['warning'][] = 'Invalid ID3v2 padding found at offset '.$thisfile_id3v2['padding']['errorpos'].' (the remaining '.($thisfile_id3v2['padding']['length'] - $i).' bytes are considered invalid)'; - break; - } - } - break; // skip rest of ID3v2 header - } - - if ($frame_name == 'COM ') { - $ThisFileInfo['warning'][] = 'error parsing "'.$frame_name.'" ('.$framedataoffset.' bytes into the ID3v2.'.$id3v2_majorversion.' tag). (ERROR: IsValidID3v2FrameName("'.str_replace("\x00", ' ', $frame_name).'", '.$id3v2_majorversion.'))). [Note: this particular error has been known to happen with tags edited by iTunes (versions "X v2.0.3", "v3.0.1" are known-guilty, probably others too)]'; - $frame_name = 'COMM'; - } - if (($frame_size <= strlen($framedata)) && ($this->IsValidID3v2FrameName($frame_name, $id3v2_majorversion))) { - - unset($parsedFrame); - $parsedFrame['frame_name'] = $frame_name; - $parsedFrame['frame_flags_raw'] = $frame_flags; - $parsedFrame['data'] = substr($framedata, 0, $frame_size); - $parsedFrame['datalength'] = getid3_lib::CastAsInt($frame_size); - $parsedFrame['dataoffset'] = $framedataoffset; - - $this->ParseID3v2Frame($parsedFrame, $ThisFileInfo); - $thisfile_id3v2[$frame_name][] = $parsedFrame; - - $framedata = substr($framedata, $frame_size); - - } else { // invalid frame length or FrameID - - if ($frame_size <= strlen($framedata)) { - - if ($this->IsValidID3v2FrameName(substr($framedata, $frame_size, 4), $id3v2_majorversion)) { - - // next frame is valid, just skip the current frame - $framedata = substr($framedata, $frame_size); - $ThisFileInfo['warning'][] = 'Next ID3v2 frame is valid, skipping current frame.'; - - } else { - - // next frame is invalid too, abort processing - //unset($framedata); - $framedata = null; - $ThisFileInfo['error'][] = 'Next ID3v2 frame is also invalid, aborting processing.'; - - } - - } elseif ($frame_size == strlen($framedata)) { - - // this is the last frame, just skip - $ThisFileInfo['warning'][] = 'This was the last ID3v2 frame.'; - - } else { - - // next frame is invalid too, abort processing - //unset($framedata); - $framedata = null; - $ThisFileInfo['warning'][] = 'Invalid ID3v2 frame size, aborting.'; - - } - if (!$this->IsValidID3v2FrameName($frame_name, $id3v2_majorversion)) { - - switch ($frame_name) { - case "\x00\x00".'MP': - case "\x00".'MP3': - case ' MP3': - case 'MP3e': - case "\x00".'MP': - case ' MP': - case 'MP3': - $ThisFileInfo['warning'][] = 'error parsing "'.$frame_name.'" ('.$framedataoffset.' bytes into the ID3v2.'.$id3v2_majorversion.' tag). (ERROR: !IsValidID3v2FrameName("'.str_replace("\x00", ' ', $frame_name).'", '.$id3v2_majorversion.'))). [Note: this particular error has been known to happen with tags edited by "MP3ext (www.mutschler.de/mp3ext/)"]'; - break; - - default: - $ThisFileInfo['warning'][] = 'error parsing "'.$frame_name.'" ('.$framedataoffset.' bytes into the ID3v2.'.$id3v2_majorversion.' tag). (ERROR: !IsValidID3v2FrameName("'.str_replace("\x00", ' ', $frame_name).'", '.$id3v2_majorversion.'))).'; - break; - } - - } elseif ($frame_size > strlen(@$framedata)){ - - $ThisFileInfo['error'][] = 'error parsing "'.$frame_name.'" ('.$framedataoffset.' bytes into the ID3v2.'.$id3v2_majorversion.' tag). (ERROR: $frame_size ('.$frame_size.') > strlen($framedata) ('.strlen($framedata).')).'; - - } else { - - $ThisFileInfo['error'][] = 'error parsing "'.$frame_name.'" ('.$framedataoffset.' bytes into the ID3v2.'.$id3v2_majorversion.' tag).'; - - } - - } - $framedataoffset += ($frame_size + $this->ID3v2HeaderLength($id3v2_majorversion)); - - } - - } - - - // Footer - - // The footer is a copy of the header, but with a different identifier. - // ID3v2 identifier "3DI" - // ID3v2 version $04 00 - // ID3v2 flags %abcd0000 - // ID3v2 size 4 * %0xxxxxxx - - if (isset($thisfile_id3v2_flags['isfooter']) && $thisfile_id3v2_flags['isfooter']) { - $footer = fread($fd, 10); - if (substr($footer, 0, 3) == '3DI') { - $thisfile_id3v2['footer'] = true; - $thisfile_id3v2['majorversion_footer'] = ord($footer{3}); - $thisfile_id3v2['minorversion_footer'] = ord($footer{4}); - } - if ($thisfile_id3v2['majorversion_footer'] <= 4) { - $id3_flags = ord(substr($footer{5})); - $thisfile_id3v2_flags['unsynch_footer'] = (bool) ($id3_flags & 0x80); - $thisfile_id3v2_flags['extfoot_footer'] = (bool) ($id3_flags & 0x40); - $thisfile_id3v2_flags['experim_footer'] = (bool) ($id3_flags & 0x20); - $thisfile_id3v2_flags['isfooter_footer'] = (bool) ($id3_flags & 0x10); - - $thisfile_id3v2['footerlength'] = getid3_lib::BigEndian2Int(substr($footer, 6, 4), 1); - } - } // end footer - - if (isset($thisfile_id3v2['comments']['genre'])) { - foreach ($thisfile_id3v2['comments']['genre'] as $key => $value) { - unset($thisfile_id3v2['comments']['genre'][$key]); - $thisfile_id3v2['comments'] = getid3_lib::array_merge_noclobber($thisfile_id3v2['comments'], $this->ParseID3v2GenreString($value)); - } - } - - if (isset($thisfile_id3v2['comments']['track'])) { - foreach ($thisfile_id3v2['comments']['track'] as $key => $value) { - if (strstr($value, '/')) { - list($thisfile_id3v2['comments']['tracknum'][$key], $thisfile_id3v2['comments']['totaltracks'][$key]) = explode('/', $thisfile_id3v2['comments']['track'][$key]); - } - } - } - - if (!isset($thisfile_id3v2['comments']['year']) && ereg('^([0-9]{4})', trim(@$thisfile_id3v2['comments']['recording_time'][0]), $matches)) { - $thisfile_id3v2['comments']['year'] = array($matches[1]); - } - - - // Set avdataoffset - $ThisFileInfo['avdataoffset'] = $thisfile_id3v2['headerlength']; - if (isset($thisfile_id3v2['footer'])) { - $ThisFileInfo['avdataoffset'] += 10; - } - - return true; - } - - - function ParseID3v2GenreString($genrestring) { - // Parse genres into arrays of genreName and genreID - // ID3v2.2.x, ID3v2.3.x: '(21)' or '(4)Eurodisco' or '(51)(39)' or '(55)((I think...)' - // ID3v2.4.x: '21' $00 'Eurodisco' $00 - - $genrestring = trim($genrestring); - $returnarray = array(); - if (strpos($genrestring, "\x00") !== false) { - $unprocessed = trim($genrestring); // trailing nulls will cause an infinite loop. - $genrestring = ''; - while (strpos($unprocessed, "\x00") !== false) { - // convert null-seperated v2.4-format into v2.3 ()-seperated format - $endpos = strpos($unprocessed, "\x00"); - $genrestring .= '('.substr($unprocessed, 0, $endpos).')'; - $unprocessed = substr($unprocessed, $endpos + 1); - } - unset($unprocessed); - } elseif (eregi('^([0-9]+|CR|RX)$', $genrestring)) { - // some tagging program (including some that use TagLib) fail to include null byte after numeric genre - $genrestring = '('.$genrestring.')'; - } - if (getid3_id3v1::LookupGenreID($genrestring)) { - - $returnarray['genre'][] = $genrestring; - - } else { - - while (strpos($genrestring, '(') !== false) { - - $startpos = strpos($genrestring, '('); - $endpos = strpos($genrestring, ')'); - if (substr($genrestring, $startpos + 1, 1) == '(') { - $genrestring = substr($genrestring, 0, $startpos).substr($genrestring, $startpos + 1); - $endpos--; - } - $element = substr($genrestring, $startpos + 1, $endpos - ($startpos + 1)); - $genrestring = substr($genrestring, 0, $startpos).substr($genrestring, $endpos + 1); - if (getid3_id3v1::LookupGenreName($element)) { // $element is a valid genre id/abbreviation - - if (empty($returnarray['genre']) || !in_array(getid3_id3v1::LookupGenreName($element), $returnarray['genre'])) { // avoid duplicate entires - $returnarray['genre'][] = getid3_id3v1::LookupGenreName($element); - } - - } else { - - if (empty($returnarray['genre']) || !in_array($element, $returnarray['genre'])) { // avoid duplicate entires - $returnarray['genre'][] = $element; - } - - } - } - } - if ($genrestring) { - if (empty($returnarray['genre']) || !in_array($genrestring, $returnarray['genre'])) { // avoid duplicate entires - $returnarray['genre'][] = $genrestring; - } - } - - return $returnarray; - } - - - function ParseID3v2Frame(&$parsedFrame, &$ThisFileInfo) { - - // shortcuts - $id3v2_majorversion = $ThisFileInfo['id3v2']['majorversion']; - - $parsedFrame['framenamelong'] = $this->FrameNameLongLookup($parsedFrame['frame_name']); - if (empty($parsedFrame['framenamelong'])) { - unset($parsedFrame['framenamelong']); - } - $parsedFrame['framenameshort'] = $this->FrameNameShortLookup($parsedFrame['frame_name']); - if (empty($parsedFrame['framenameshort'])) { - unset($parsedFrame['framenameshort']); - } - - if ($id3v2_majorversion >= 3) { // frame flags are not part of the ID3v2.2 standard - if ($id3v2_majorversion == 3) { - // Frame Header Flags - // %abc00000 %ijk00000 - $parsedFrame['flags']['TagAlterPreservation'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x8000); // a - Tag alter preservation - $parsedFrame['flags']['FileAlterPreservation'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x4000); // b - File alter preservation - $parsedFrame['flags']['ReadOnly'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x2000); // c - Read only - $parsedFrame['flags']['compression'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x0080); // i - Compression - $parsedFrame['flags']['Encryption'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x0040); // j - Encryption - $parsedFrame['flags']['GroupingIdentity'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x0020); // k - Grouping identity - - } elseif ($id3v2_majorversion == 4) { - // Frame Header Flags - // %0abc0000 %0h00kmnp - $parsedFrame['flags']['TagAlterPreservation'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x4000); // a - Tag alter preservation - $parsedFrame['flags']['FileAlterPreservation'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x2000); // b - File alter preservation - $parsedFrame['flags']['ReadOnly'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x1000); // c - Read only - $parsedFrame['flags']['GroupingIdentity'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x0040); // h - Grouping identity - $parsedFrame['flags']['compression'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x0008); // k - Compression - $parsedFrame['flags']['Encryption'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x0004); // m - Encryption - $parsedFrame['flags']['Unsynchronisation'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x0002); // n - Unsynchronisation - $parsedFrame['flags']['DataLengthIndicator'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x0001); // p - Data length indicator - - // Frame-level de-unsynchronisation - ID3v2.4 - if ($parsedFrame['flags']['Unsynchronisation']) { - $parsedFrame['data'] = $this->DeUnsynchronise($parsedFrame['data']); - } - } - - // Frame-level de-compression - if ($parsedFrame['flags']['compression']) { - $parsedFrame['decompressed_size'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], 0, 4)); - if (!function_exists('gzuncompress')) { - $ThisFileInfo['warning'][] = 'gzuncompress() support required to decompress ID3v2 frame "'.$parsedFrame['frame_name'].'"'; - } elseif ($decompresseddata = @gzuncompress(substr($parsedFrame['data'], 4))) { - $parsedFrame['data'] = $decompresseddata; - } else { - $ThisFileInfo['warning'][] = 'gzuncompress() failed on compressed contents of ID3v2 frame "'.$parsedFrame['frame_name'].'"'; - } - } - } - - if (isset($parsedFrame['datalength']) && ($parsedFrame['datalength'] == 0)) { - - $warning = 'Frame "'.$parsedFrame['frame_name'].'" at offset '.$parsedFrame['dataoffset'].' has no data portion'; - switch ($parsedFrame['frame_name']) { - case 'WCOM': - $warning .= ' (this is known to happen with files tagged by RioPort)'; - break; - - default: - break; - } - $ThisFileInfo['warning'][] = $warning; - - } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'UFID')) || // 4.1 UFID Unique file identifier - (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'UFI'))) { // 4.1 UFI Unique file identifier - // There may be more than one 'UFID' frame in a tag, - // but only one with the same 'Owner identifier'. - // <Header for 'Unique file identifier', ID: 'UFID'> - // Owner identifier <text string> $00 - // Identifier <up to 64 bytes binary data> - - $frame_terminatorpos = strpos($parsedFrame['data'], "\x00"); - $frame_idstring = substr($parsedFrame['data'], 0, $frame_terminatorpos); - $parsedFrame['ownerid'] = $frame_idstring; - $parsedFrame['data'] = substr($parsedFrame['data'], $frame_terminatorpos + strlen("\x00")); - unset($parsedFrame['data']); - - - } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'TXXX')) || // 4.2.2 TXXX User defined text information frame - (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'TXX'))) { // 4.2.2 TXX User defined text information frame - // There may be more than one 'TXXX' frame in each tag, - // but only one with the same description. - // <Header for 'User defined text information frame', ID: 'TXXX'> - // Text encoding $xx - // Description <text string according to encoding> $00 (00) - // Value <text string according to encoding> - - $frame_offset = 0; - $frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1)); - - if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) { - $ThisFileInfo['warning'][] = 'Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding'; - } - $frame_terminatorpos = @strpos($parsedFrame['data'], $this->TextEncodingTerminatorLookup($frame_textencoding), $frame_offset); - if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)), 1)) === 0) { - $frame_terminatorpos++; // @strpos() fooled because 2nd byte of Unicode chars are often 0x00 - } - $frame_description = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); - if (ord($frame_description) === 0) { - $frame_description = ''; - } - $parsedFrame['encodingid'] = $frame_textencoding; - $parsedFrame['encoding'] = $this->TextEncodingNameLookup($frame_textencoding); - - $parsedFrame['description'] = $frame_description; - $parsedFrame['data'] = substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding))); - if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) { - $ThisFileInfo['id3v2']['comments'][$parsedFrame['framenameshort']][] = trim(getid3_lib::iconv_fallback($parsedFrame['encoding'], $ThisFileInfo['id3v2']['encoding'], $parsedFrame['data'])); - } - unset($parsedFrame['data']); - - - } elseif ($parsedFrame['frame_name']{0} == 'T') { // 4.2. T??[?] Text information frame - // There may only be one text information frame of its kind in an tag. - // <Header for 'Text information frame', ID: 'T000' - 'TZZZ', - // excluding 'TXXX' described in 4.2.6.> - // Text encoding $xx - // Information <text string(s) according to encoding> - - $frame_offset = 0; - $frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1)); - if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) { - $ThisFileInfo['warning'][] = 'Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding'; - } - - $parsedFrame['data'] = (string) substr($parsedFrame['data'], $frame_offset); - - $parsedFrame['encodingid'] = $frame_textencoding; - $parsedFrame['encoding'] = $this->TextEncodingNameLookup($frame_textencoding); - - if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) { - - // remove possible terminating \x00 (put by encoding id or software bug) - $string = getid3_lib::iconv_fallback($parsedFrame['encoding'], $ThisFileInfo['id3v2']['encoding'], $parsedFrame['data']); - if ($string[strlen($string) - 1] == "\x00") { - $string = substr($string, 0, strlen($string) - 1); - } - $ThisFileInfo['id3v2']['comments'][$parsedFrame['framenameshort']][] = $string; - unset($string); - } - - } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'WXXX')) || // 4.3.2 WXXX User defined URL link frame - (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'WXX'))) { // 4.3.2 WXX User defined URL link frame - // There may be more than one 'WXXX' frame in each tag, - // but only one with the same description - // <Header for 'User defined URL link frame', ID: 'WXXX'> - // Text encoding $xx - // Description <text string according to encoding> $00 (00) - // URL <text string> - - $frame_offset = 0; - $frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1)); - if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) { - $ThisFileInfo['warning'][] = 'Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding'; - } - $frame_terminatorpos = @strpos($parsedFrame['data'], $this->TextEncodingTerminatorLookup($frame_textencoding), $frame_offset); - if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)), 1)) === 0) { - $frame_terminatorpos++; // @strpos() fooled because 2nd byte of Unicode chars are often 0x00 - } - $frame_description = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); - - if (ord($frame_description) === 0) { - $frame_description = ''; - } - $parsedFrame['data'] = substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding))); - - $frame_terminatorpos = strpos($parsedFrame['data'], $this->TextEncodingTerminatorLookup($frame_textencoding)); - if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)), 1)) === 0) { - $frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00 - } - if ($frame_terminatorpos) { - // there are null bytes after the data - this is not according to spec - // only use data up to first null byte - $frame_urldata = (string) substr($parsedFrame['data'], 0, $frame_terminatorpos); - } else { - // no null bytes following data, just use all data - $frame_urldata = (string) $parsedFrame['data']; - } - - $parsedFrame['encodingid'] = $frame_textencoding; - $parsedFrame['encoding'] = $this->TextEncodingNameLookup($frame_textencoding); - - $parsedFrame['url'] = $frame_urldata; - $parsedFrame['description'] = $frame_description; - if (!empty($parsedFrame['framenameshort']) && $parsedFrame['url']) { - $ThisFileInfo['id3v2']['comments'][$parsedFrame['framenameshort']][] = getid3_lib::iconv_fallback($parsedFrame['encoding'], $ThisFileInfo['id3v2']['encoding'], $parsedFrame['url']); - } - unset($parsedFrame['data']); - - - } elseif ($parsedFrame['frame_name']{0} == 'W') { // 4.3. W??? URL link frames - // There may only be one URL link frame of its kind in a tag, - // except when stated otherwise in the frame description - // <Header for 'URL link frame', ID: 'W000' - 'WZZZ', excluding 'WXXX' - // described in 4.3.2.> - // URL <text string> - - $parsedFrame['url'] = trim($parsedFrame['data']); - if (!empty($parsedFrame['framenameshort']) && $parsedFrame['url']) { - $ThisFileInfo['id3v2']['comments'][$parsedFrame['framenameshort']][] = $parsedFrame['url']; - } - unset($parsedFrame['data']); - - - } elseif ((($id3v2_majorversion == 3) && ($parsedFrame['frame_name'] == 'IPLS')) || // 4.4 IPLS Involved people list (ID3v2.3 only) - (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'IPL'))) { // 4.4 IPL Involved people list (ID3v2.2 only) - // There may only be one 'IPL' frame in each tag - // <Header for 'User defined URL link frame', ID: 'IPL'> - // Text encoding $xx - // People list strings <textstrings> - - $frame_offset = 0; - $frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1)); - if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) { - $ThisFileInfo['warning'][] = 'Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding'; - } - $parsedFrame['encodingid'] = $frame_textencoding; - $parsedFrame['encoding'] = $this->TextEncodingNameLookup($parsedFrame['encodingid']); - - $parsedFrame['data'] = (string) substr($parsedFrame['data'], $frame_offset); - if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) { - $ThisFileInfo['id3v2']['comments'][$parsedFrame['framenameshort']][] = getid3_lib::iconv_fallback($parsedFrame['encoding'], $ThisFileInfo['id3v2']['encoding'], $parsedFrame['data']); - } - - - } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'MCDI')) || // 4.4 MCDI Music CD identifier - (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'MCI'))) { // 4.5 MCI Music CD identifier - // There may only be one 'MCDI' frame in each tag - // <Header for 'Music CD identifier', ID: 'MCDI'> - // CD TOC <binary data> - - if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) { - $ThisFileInfo['id3v2']['comments'][$parsedFrame['framenameshort']][] = $parsedFrame['data']; - } - - - } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'ETCO')) || // 4.5 ETCO Event timing codes - (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'ETC'))) { // 4.6 ETC Event timing codes - // There may only be one 'ETCO' frame in each tag - // <Header for 'Event timing codes', ID: 'ETCO'> - // Time stamp format $xx - // Where time stamp format is: - // $01 (32-bit value) MPEG frames from beginning of file - // $02 (32-bit value) milliseconds from beginning of file - // Followed by a list of key events in the following format: - // Type of event $xx - // Time stamp $xx (xx ...) - // The 'Time stamp' is set to zero if directly at the beginning of the sound - // or after the previous event. All events MUST be sorted in chronological order. - - $frame_offset = 0; - $parsedFrame['timestampformat'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); - - while ($frame_offset < strlen($parsedFrame['data'])) { - $parsedFrame['typeid'] = substr($parsedFrame['data'], $frame_offset++, 1); - $parsedFrame['type'] = $this->ETCOEventLookup($parsedFrame['typeid']); - $parsedFrame['timestamp'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4)); - $frame_offset += 4; - } - unset($parsedFrame['data']); - - - } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'MLLT')) || // 4.6 MLLT MPEG location lookup table - (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'MLL'))) { // 4.7 MLL MPEG location lookup table - // There may only be one 'MLLT' frame in each tag - // <Header for 'Location lookup table', ID: 'MLLT'> - // MPEG frames between reference $xx xx - // Bytes between reference $xx xx xx - // Milliseconds between reference $xx xx xx - // Bits for bytes deviation $xx - // Bits for milliseconds dev. $xx - // Then for every reference the following data is included; - // Deviation in bytes %xxx.... - // Deviation in milliseconds %xxx.... - - $frame_offset = 0; - $parsedFrame['framesbetweenreferences'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], 0, 2)); - $parsedFrame['bytesbetweenreferences'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], 2, 3)); - $parsedFrame['msbetweenreferences'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], 5, 3)); - $parsedFrame['bitsforbytesdeviation'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], 8, 1)); - $parsedFrame['bitsformsdeviation'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], 9, 1)); - $parsedFrame['data'] = substr($parsedFrame['data'], 10); - while ($frame_offset < strlen($parsedFrame['data'])) { - $deviationbitstream .= getid3_lib::BigEndian2Bin(substr($parsedFrame['data'], $frame_offset++, 1)); - } - $reference_counter = 0; - while (strlen($deviationbitstream) > 0) { - $parsedFrame[$reference_counter]['bytedeviation'] = bindec(substr($deviationbitstream, 0, $parsedFrame['bitsforbytesdeviation'])); - $parsedFrame[$reference_counter]['msdeviation'] = bindec(substr($deviationbitstream, $parsedFrame['bitsforbytesdeviation'], $parsedFrame['bitsformsdeviation'])); - $deviationbitstream = substr($deviationbitstream, $parsedFrame['bitsforbytesdeviation'] + $parsedFrame['bitsformsdeviation']); - $reference_counter++; - } - unset($parsedFrame['data']); - - - } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'SYTC')) || // 4.7 SYTC Synchronised tempo codes - (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'STC'))) { // 4.8 STC Synchronised tempo codes - // There may only be one 'SYTC' frame in each tag - // <Header for 'Synchronised tempo codes', ID: 'SYTC'> - // Time stamp format $xx - // Tempo data <binary data> - // Where time stamp format is: - // $01 (32-bit value) MPEG frames from beginning of file - // $02 (32-bit value) milliseconds from beginning of file - - $frame_offset = 0; - $parsedFrame['timestampformat'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); - $timestamp_counter = 0; - while ($frame_offset < strlen($parsedFrame['data'])) { - $parsedFrame[$timestamp_counter]['tempo'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); - if ($parsedFrame[$timestamp_counter]['tempo'] == 255) { - $parsedFrame[$timestamp_counter]['tempo'] += ord(substr($parsedFrame['data'], $frame_offset++, 1)); - } - $parsedFrame[$timestamp_counter]['timestamp'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4)); - $frame_offset += 4; - $timestamp_counter++; - } - unset($parsedFrame['data']); - - - } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'USLT')) || // 4.8 USLT Unsynchronised lyric/text transcription - (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'ULT'))) { // 4.9 ULT Unsynchronised lyric/text transcription - // There may be more than one 'Unsynchronised lyrics/text transcription' frame - // in each tag, but only one with the same language and content descriptor. - // <Header for 'Unsynchronised lyrics/text transcription', ID: 'USLT'> - // Text encoding $xx - // Language $xx xx xx - // Content descriptor <text string according to encoding> $00 (00) - // Lyrics/text <full text string according to encoding> - - $frame_offset = 0; - $frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1)); - if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) { - $ThisFileInfo['warning'][] = 'Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding'; - } - $frame_language = substr($parsedFrame['data'], $frame_offset, 3); - $frame_offset += 3; - $frame_terminatorpos = @strpos($parsedFrame['data'], $this->TextEncodingTerminatorLookup($frame_textencoding), $frame_offset); - if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)), 1)) === 0) { - $frame_terminatorpos++; // @strpos() fooled because 2nd byte of Unicode chars are often 0x00 - } - $frame_description = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); - if (ord($frame_description) === 0) { - $frame_description = ''; - } - $parsedFrame['data'] = substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding))); - - $parsedFrame['encodingid'] = $frame_textencoding; - $parsedFrame['encoding'] = $this->TextEncodingNameLookup($frame_textencoding); - - $parsedFrame['data'] = $parsedFrame['data']; - $parsedFrame['language'] = $frame_language; - $parsedFrame['languagename'] = $this->LanguageLookup($frame_language, false); - $parsedFrame['description'] = $frame_description; - if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) { - $ThisFileInfo['id3v2']['comments'][$parsedFrame['framenameshort']][] = getid3_lib::iconv_fallback($parsedFrame['encoding'], $ThisFileInfo['id3v2']['encoding'], $parsedFrame['data']); - } - unset($parsedFrame['data']); - - - } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'SYLT')) || // 4.9 SYLT Synchronised lyric/text - (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'SLT'))) { // 4.10 SLT Synchronised lyric/text - // There may be more than one 'SYLT' frame in each tag, - // but only one with the same language and content descriptor. - // <Header for 'Synchronised lyrics/text', ID: 'SYLT'> - // Text encoding $xx - // Language $xx xx xx - // Time stamp format $xx - // $01 (32-bit value) MPEG frames from beginning of file - // $02 (32-bit value) milliseconds from beginning of file - // Content type $xx - // Content descriptor <text string according to encoding> $00 (00) - // Terminated text to be synced (typically a syllable) - // Sync identifier (terminator to above string) $00 (00) - // Time stamp $xx (xx ...) - - $frame_offset = 0; - $frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1)); - if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) { - $ThisFileInfo['warning'][] = 'Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding'; - } - $frame_language = substr($parsedFrame['data'], $frame_offset, 3); - $frame_offset += 3; - $parsedFrame['timestampformat'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); - $parsedFrame['contenttypeid'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); - $parsedFrame['contenttype'] = $this->SYTLContentTypeLookup($parsedFrame['contenttypeid']); - $parsedFrame['encodingid'] = $frame_textencoding; - $parsedFrame['encoding'] = $this->TextEncodingNameLookup($frame_textencoding); - - $parsedFrame['language'] = $frame_language; - $parsedFrame['languagename'] = $this->LanguageLookup($frame_language, false); - - $timestampindex = 0; - $frame_remainingdata = substr($parsedFrame['data'], $frame_offset); - while (strlen($frame_remainingdata)) { - $frame_offset = 0; - $frame_terminatorpos = strpos($frame_remainingdata, $this->TextEncodingTerminatorLookup($frame_textencoding)); - if ($frame_terminatorpos === false) { - $frame_remainingdata = ''; - } else { - if (ord(substr($frame_remainingdata, $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)), 1)) === 0) { - $frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00 - } - $parsedFrame['lyrics'][$timestampindex]['data'] = substr($frame_remainingdata, $frame_offset, $frame_terminatorpos - $frame_offset); - - $frame_remainingdata = substr($frame_remainingdata, $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding))); - if (($timestampindex == 0) && (ord($frame_remainingdata{0}) != 0)) { - // timestamp probably omitted for first data item - } else { - $parsedFrame['lyrics'][$timestampindex]['timestamp'] = getid3_lib::BigEndian2Int(substr($frame_remainingdata, 0, 4)); - $frame_remainingdata = substr($frame_remainingdata, 4); - } - $timestampindex++; - } - } - unset($parsedFrame['data']); - - - } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'COMM')) || // 4.10 COMM Comments - (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'COM'))) { // 4.11 COM Comments - // There may be more than one comment frame in each tag, - // but only one with the same language and content descriptor. - // <Header for 'Comment', ID: 'COMM'> - // Text encoding $xx - // Language $xx xx xx - // Short content descrip. <text string according to encoding> $00 (00) - // The actual text <full text string according to encoding> - - if (strlen($parsedFrame['data']) < 5) { - - $ThisFileInfo['warning'][] = 'Invalid data (too short) for "'.$parsedFrame['frame_name'].'" frame at offset '.$parsedFrame['dataoffset']; - - } else { - - $frame_offset = 0; - $frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1)); - if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) { - $ThisFileInfo['warning'][] = 'Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding'; - } - $frame_language = substr($parsedFrame['data'], $frame_offset, 3); - $frame_offset += 3; - $frame_terminatorpos = @strpos($parsedFrame['data'], $this->TextEncodingTerminatorLookup($frame_textencoding), $frame_offset); - if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)), 1)) === 0) { - $frame_terminatorpos++; // @strpos() fooled because 2nd byte of Unicode chars are often 0x00 - } - $frame_description = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); - if (ord($frame_description) === 0) { - $frame_description = ''; - } - $frame_text = (string) substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding))); - - $parsedFrame['encodingid'] = $frame_textencoding; - $parsedFrame['encoding'] = $this->TextEncodingNameLookup($frame_textencoding); - - $parsedFrame['language'] = $frame_language; - $parsedFrame['languagename'] = $this->LanguageLookup($frame_language, false); - $parsedFrame['description'] = $frame_description; - $parsedFrame['data'] = $frame_text; - if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) { - $ThisFileInfo['id3v2']['comments'][$parsedFrame['framenameshort']][] = getid3_lib::iconv_fallback($parsedFrame['encoding'], $ThisFileInfo['id3v2']['encoding'], $parsedFrame['data']); - } - - } - - } elseif (($id3v2_majorversion >= 4) && ($parsedFrame['frame_name'] == 'RVA2')) { // 4.11 RVA2 Relative volume adjustment (2) (ID3v2.4+ only) - // There may be more than one 'RVA2' frame in each tag, - // but only one with the same identification string - // <Header for 'Relative volume adjustment (2)', ID: 'RVA2'> - // Identification <text string> $00 - // The 'identification' string is used to identify the situation and/or - // device where this adjustment should apply. The following is then - // repeated for every channel: - // Type of channel $xx - // Volume adjustment $xx xx - // Bits representing peak $xx - // Peak volume $xx (xx ...) - - $frame_terminatorpos = strpos($parsedFrame['data'], "\x00"); - $frame_idstring = substr($parsedFrame['data'], 0, $frame_terminatorpos); - if (ord($frame_idstring) === 0) { - $frame_idstring = ''; - } - $frame_remainingdata = substr($parsedFrame['data'], $frame_terminatorpos + strlen("\x00")); - $parsedFrame['description'] = $frame_idstring; - while (strlen($frame_remainingdata)) { - $frame_offset = 0; - $frame_channeltypeid = ord(substr($frame_remainingdata, $frame_offset++, 1)); - $parsedFrame[$frame_channeltypeid]['channeltypeid'] = $frame_channeltypeid; - $parsedFrame[$frame_channeltypeid]['channeltype'] = $this->RVA2ChannelTypeLookup($frame_channeltypeid); - $parsedFrame[$frame_channeltypeid]['volumeadjust'] = getid3_lib::BigEndian2Int(substr($frame_remainingdata, $frame_offset, 2), false, true); // 16-bit signed - $frame_offset += 2; - $parsedFrame[$frame_channeltypeid]['bitspeakvolume'] = ord(substr($frame_remainingdata, $frame_offset++, 1)); - $frame_bytespeakvolume = ceil($parsedFrame[$frame_channeltypeid]['bitspeakvolume'] / 8); - $parsedFrame[$frame_channeltypeid]['peakvolume'] = getid3_lib::BigEndian2Int(substr($frame_remainingdata, $frame_offset, $frame_bytespeakvolume)); - $frame_remainingdata = substr($frame_remainingdata, $frame_offset + $frame_bytespeakvolume); - } - unset($parsedFrame['data']); - - - } elseif ((($id3v2_majorversion == 3) && ($parsedFrame['frame_name'] == 'RVAD')) || // 4.12 RVAD Relative volume adjustment (ID3v2.3 only) - (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'RVA'))) { // 4.12 RVA Relative volume adjustment (ID3v2.2 only) - // There may only be one 'RVA' frame in each tag - // <Header for 'Relative volume adjustment', ID: 'RVA'> - // ID3v2.2 => Increment/decrement %000000ba - // ID3v2.3 => Increment/decrement %00fedcba - // Bits used for volume descr. $xx - // Relative volume change, right $xx xx (xx ...) // a - // Relative volume change, left $xx xx (xx ...) // b - // Peak volume right $xx xx (xx ...) - // Peak volume left $xx xx (xx ...) - // ID3v2.3 only, optional (not present in ID3v2.2): - // Relative volume change, right back $xx xx (xx ...) // c - // Relative volume change, left back $xx xx (xx ...) // d - // Peak volume right back $xx xx (xx ...) - // Peak volume left back $xx xx (xx ...) - // ID3v2.3 only, optional (not present in ID3v2.2): - // Relative volume change, center $xx xx (xx ...) // e - // Peak volume center $xx xx (xx ...) - // ID3v2.3 only, optional (not present in ID3v2.2): - // Relative volume change, bass $xx xx (xx ...) // f - // Peak volume bass $xx xx (xx ...) - - $frame_offset = 0; - $frame_incrdecrflags = getid3_lib::BigEndian2Bin(substr($parsedFrame['data'], $frame_offset++, 1)); - $parsedFrame['incdec']['right'] = (bool) substr($frame_incrdecrflags, 6, 1); - $parsedFrame['incdec']['left'] = (bool) substr($frame_incrdecrflags, 7, 1); - $parsedFrame['bitsvolume'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); - $frame_bytesvolume = ceil($parsedFrame['bitsvolume'] / 8); - $parsedFrame['volumechange']['right'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume)); - if ($parsedFrame['incdec']['right'] === false) { - $parsedFrame['volumechange']['right'] *= -1; - } - $frame_offset += $frame_bytesvolume; - $parsedFrame['volumechange']['left'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume)); - if ($parsedFrame['incdec']['left'] === false) { - $parsedFrame['volumechange']['left'] *= -1; - } - $frame_offset += $frame_bytesvolume; - $parsedFrame['peakvolume']['right'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume)); - $frame_offset += $frame_bytesvolume; - $parsedFrame['peakvolume']['left'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume)); - $frame_offset += $frame_bytesvolume; - if ($id3v2_majorversion == 3) { - $parsedFrame['data'] = substr($parsedFrame['data'], $frame_offset); - if (strlen($parsedFrame['data']) > 0) { - $parsedFrame['incdec']['rightrear'] = (bool) substr($frame_incrdecrflags, 4, 1); - $parsedFrame['incdec']['leftrear'] = (bool) substr($frame_incrdecrflags, 5, 1); - $parsedFrame['volumechange']['rightrear'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume)); - if ($parsedFrame['incdec']['rightrear'] === false) { - $parsedFrame['volumechange']['rightrear'] *= -1; - } - $frame_offset += $frame_bytesvolume; - $parsedFrame['volumechange']['leftrear'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume)); - if ($parsedFrame['incdec']['leftrear'] === false) { - $parsedFrame['volumechange']['leftrear'] *= -1; - } - $frame_offset += $frame_bytesvolume; - $parsedFrame['peakvolume']['rightrear'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume)); - $frame_offset += $frame_bytesvolume; - $parsedFrame['peakvolume']['leftrear'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume)); - $frame_offset += $frame_bytesvolume; - } - $parsedFrame['data'] = substr($parsedFrame['data'], $frame_offset); - if (strlen($parsedFrame['data']) > 0) { - $parsedFrame['incdec']['center'] = (bool) substr($frame_incrdecrflags, 3, 1); - $parsedFrame['volumechange']['center'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume)); - if ($parsedFrame['incdec']['center'] === false) { - $parsedFrame['volumechange']['center'] *= -1; - } - $frame_offset += $frame_bytesvolume; - $parsedFrame['peakvolume']['center'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume)); - $frame_offset += $frame_bytesvolume; - } - $parsedFrame['data'] = substr($parsedFrame['data'], $frame_offset); - if (strlen($parsedFrame['data']) > 0) { - $parsedFrame['incdec']['bass'] = (bool) substr($frame_incrdecrflags, 2, 1); - $parsedFrame['volumechange']['bass'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume)); - if ($parsedFrame['incdec']['bass'] === false) { - $parsedFrame['volumechange']['bass'] *= -1; - } - $frame_offset += $frame_bytesvolume; - $parsedFrame['peakvolume']['bass'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume)); - $frame_offset += $frame_bytesvolume; - } - } - unset($parsedFrame['data']); - - - } elseif (($id3v2_majorversion >= 4) && ($parsedFrame['frame_name'] == 'EQU2')) { // 4.12 EQU2 Equalisation (2) (ID3v2.4+ only) - // There may be more than one 'EQU2' frame in each tag, - // but only one with the same identification string - // <Header of 'Equalisation (2)', ID: 'EQU2'> - // Interpolation method $xx - // $00 Band - // $01 Linear - // Identification <text string> $00 - // The following is then repeated for every adjustment point - // Frequency $xx xx - // Volume adjustment $xx xx - - $frame_offset = 0; - $frame_interpolationmethod = ord(substr($parsedFrame['data'], $frame_offset++, 1)); - $frame_terminatorpos = @strpos($parsedFrame['data'], "\x00", $frame_offset); - $frame_idstring = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); - if (ord($frame_idstring) === 0) { - $frame_idstring = ''; - } - $parsedFrame['description'] = $frame_idstring; - $frame_remainingdata = substr($parsedFrame['data'], $frame_terminatorpos + strlen("\x00")); - while (strlen($frame_remainingdata)) { - $frame_frequency = getid3_lib::BigEndian2Int(substr($frame_remainingdata, 0, 2)) / 2; - $parsedFrame['data'][$frame_frequency] = getid3_lib::BigEndian2Int(substr($frame_remainingdata, 2, 2), false, true); - $frame_remainingdata = substr($frame_remainingdata, 4); - } - $parsedFrame['interpolationmethod'] = $frame_interpolationmethod; - unset($parsedFrame['data']); - - - } elseif ((($id3v2_majorversion == 3) && ($parsedFrame['frame_name'] == 'EQUA')) || // 4.12 EQUA Equalisation (ID3v2.3 only) - (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'EQU'))) { // 4.13 EQU Equalisation (ID3v2.2 only) - // There may only be one 'EQUA' frame in each tag - // <Header for 'Relative volume adjustment', ID: 'EQU'> - // Adjustment bits $xx - // This is followed by 2 bytes + ('adjustment bits' rounded up to the - // nearest byte) for every equalisation band in the following format, - // giving a frequency range of 0 - 32767Hz: - // Increment/decrement %x (MSB of the Frequency) - // Frequency (lower 15 bits) - // Adjustment $xx (xx ...) - - $frame_offset = 0; - $parsedFrame['adjustmentbits'] = substr($parsedFrame['data'], $frame_offset++, 1); - $frame_adjustmentbytes = ceil($parsedFrame['adjustmentbits'] / 8); - - $frame_remainingdata = (string) substr($parsedFrame['data'], $frame_offset); - while (strlen($frame_remainingdata) > 0) { - $frame_frequencystr = getid3_lib::BigEndian2Bin(substr($frame_remainingdata, 0, 2)); - $frame_incdec = (bool) substr($frame_frequencystr, 0, 1); - $frame_frequency = bindec(substr($frame_frequencystr, 1, 15)); - $parsedFrame[$frame_frequency]['incdec'] = $frame_incdec; - $parsedFrame[$frame_frequency]['adjustment'] = getid3_lib::BigEndian2Int(substr($frame_remainingdata, 2, $frame_adjustmentbytes)); - if ($parsedFrame[$frame_frequency]['incdec'] === false) { - $parsedFrame[$frame_frequency]['adjustment'] *= -1; - } - $frame_remainingdata = substr($frame_remainingdata, 2 + $frame_adjustmentbytes); - } - unset($parsedFrame['data']); - - - } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'RVRB')) || // 4.13 RVRB Reverb - (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'REV'))) { // 4.14 REV Reverb - // There may only be one 'RVRB' frame in each tag. - // <Header for 'Reverb', ID: 'RVRB'> - // Reverb left (ms) $xx xx - // Reverb right (ms) $xx xx - // Reverb bounces, left $xx - // Reverb bounces, right $xx - // Reverb feedback, left to left $xx - // Reverb feedback, left to right $xx - // Reverb feedback, right to right $xx - // Reverb feedback, right to left $xx - // Premix left to right $xx - // Premix right to left $xx - - $frame_offset = 0; - $parsedFrame['left'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 2)); - $frame_offset += 2; - $parsedFrame['right'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 2)); - $frame_offset += 2; - $parsedFrame['bouncesL'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); - $parsedFrame['bouncesR'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); - $parsedFrame['feedbackLL'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); - $parsedFrame['feedbackLR'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); - $parsedFrame['feedbackRR'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); - $parsedFrame['feedbackRL'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); - $parsedFrame['premixLR'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); - $parsedFrame['premixRL'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); - unset($parsedFrame['data']); - - - } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'APIC')) || // 4.14 APIC Attached picture - (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'PIC'))) { // 4.15 PIC Attached picture - // There may be several pictures attached to one file, - // each in their individual 'APIC' frame, but only one - // with the same content descriptor - // <Header for 'Attached picture', ID: 'APIC'> - // Text encoding $xx - // ID3v2.3+ => MIME type <text string> $00 - // ID3v2.2 => Image format $xx xx xx - // Picture type $xx - // Description <text string according to encoding> $00 (00) - // Picture data <binary data> - - $frame_offset = 0; - $frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1)); - if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) { - $ThisFileInfo['warning'][] = 'Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding'; - } - - if ($id3v2_majorversion == 2 && strlen($parsedFrame['data']) > $frame_offset) { - $frame_imagetype = substr($parsedFrame['data'], $frame_offset, 3); - if (strtolower($frame_imagetype) == 'ima') { - // complete hack for mp3Rage (www.chaoticsoftware.com) that puts ID3v2.3-formatted - // MIME type instead of 3-char ID3v2.2-format image type (thanks xbhoffØpacbell*net) - $frame_terminatorpos = @strpos($parsedFrame['data'], "\x00", $frame_offset); - $frame_mimetype = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); - if (ord($frame_mimetype) === 0) { - $frame_mimetype = ''; - } - $frame_imagetype = strtoupper(str_replace('image/', '', strtolower($frame_mimetype))); - if ($frame_imagetype == 'JPEG') { - $frame_imagetype = 'JPG'; - } - $frame_offset = $frame_terminatorpos + strlen("\x00"); - } else { - $frame_offset += 3; - } - } - if ($id3v2_majorversion > 2 && strlen($parsedFrame['data']) > $frame_offset) { - $frame_terminatorpos = @strpos($parsedFrame['data'], "\x00", $frame_offset); - $frame_mimetype = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); - if (ord($frame_mimetype) === 0) { - $frame_mimetype = ''; - } - $frame_offset = $frame_terminatorpos + strlen("\x00"); - } - - $frame_picturetype = ord(substr($parsedFrame['data'], $frame_offset++, 1)); - - $frame_terminatorpos = @strpos($parsedFrame['data'], $this->TextEncodingTerminatorLookup($frame_textencoding), $frame_offset); - if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)), 1)) === 0) { - $frame_terminatorpos++; // @strpos() fooled because 2nd byte of Unicode chars are often 0x00 - } - $frame_description = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); - if (ord($frame_description) === 0) { - $frame_description = ''; - } - $parsedFrame['encodingid'] = $frame_textencoding; - $parsedFrame['encoding'] = $this->TextEncodingNameLookup($frame_textencoding); - - if ($id3v2_majorversion == 2) { - $parsedFrame['imagetype'] = $frame_imagetype; - } else { - $parsedFrame['mime'] = $frame_mimetype; - } - $parsedFrame['picturetypeid'] = $frame_picturetype; - $parsedFrame['picturetype'] = $this->APICPictureTypeLookup($frame_picturetype); - $parsedFrame['description'] = $frame_description; - $parsedFrame['data'] = substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding))); - - $imageinfo = array(); - $imagechunkcheck = getid3_lib::GetDataImageSize($parsedFrame['data'], $imageinfo); - if (($imagechunkcheck[2] >= 1) && ($imagechunkcheck[2] <= 3)) { - $parsedFrame['image_mime'] = 'image/'.getid3_lib::ImageTypesLookup($imagechunkcheck[2]); - if ($imagechunkcheck[0]) { - $parsedFrame['image_width'] = $imagechunkcheck[0]; - } - if ($imagechunkcheck[1]) { - $parsedFrame['image_height'] = $imagechunkcheck[1]; - } - $parsedFrame['image_bytes'] = strlen($parsedFrame['data']); - } - - - } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'GEOB')) || // 4.15 GEOB General encapsulated object - (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'GEO'))) { // 4.16 GEO General encapsulated object - // There may be more than one 'GEOB' frame in each tag, - // but only one with the same content descriptor - // <Header for 'General encapsulated object', ID: 'GEOB'> - // Text encoding $xx - // MIME type <text string> $00 - // Filename <text string according to encoding> $00 (00) - // Content description <text string according to encoding> $00 (00) - // Encapsulated object <binary data> - - $frame_offset = 0; - $frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1)); - if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) { - $ThisFileInfo['warning'][] = 'Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding'; - } - $frame_terminatorpos = @strpos($parsedFrame['data'], "\x00", $frame_offset); - $frame_mimetype = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); - if (ord($frame_mimetype) === 0) { - $frame_mimetype = ''; - } - $frame_offset = $frame_terminatorpos + strlen("\x00"); - - $frame_terminatorpos = @strpos($parsedFrame['data'], $this->TextEncodingTerminatorLookup($frame_textencoding), $frame_offset); - if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)), 1)) === 0) { - $frame_terminatorpos++; // @strpos() fooled because 2nd byte of Unicode chars are often 0x00 - } - $frame_filename = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); - if (ord($frame_filename) === 0) { - $frame_filename = ''; - } - $frame_offset = $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)); - - $frame_terminatorpos = @strpos($parsedFrame['data'], $this->TextEncodingTerminatorLookup($frame_textencoding), $frame_offset); - if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)), 1)) === 0) { - $frame_terminatorpos++; // @strpos() fooled because 2nd byte of Unicode chars are often 0x00 - } - $frame_description = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); - if (ord($frame_description) === 0) { - $frame_description = ''; - } - $frame_offset = $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)); - - $parsedFrame['objectdata'] = (string) substr($parsedFrame['data'], $frame_offset); - $parsedFrame['encodingid'] = $frame_textencoding; - $parsedFrame['encoding'] = $this->TextEncodingNameLookup($frame_textencoding); - - $parsedFrame['mime'] = $frame_mimetype; - $parsedFrame['filename'] = $frame_filename; - $parsedFrame['description'] = $frame_description; - unset($parsedFrame['data']); - - - } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'PCNT')) || // 4.16 PCNT Play counter - (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'CNT'))) { // 4.17 CNT Play counter - // There may only be one 'PCNT' frame in each tag. - // When the counter reaches all one's, one byte is inserted in - // front of the counter thus making the counter eight bits bigger - // <Header for 'Play counter', ID: 'PCNT'> - // Counter $xx xx xx xx (xx ...) - - $parsedFrame['data'] = getid3_lib::BigEndian2Int($parsedFrame['data']); - - - } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'POPM')) || // 4.17 POPM Popularimeter - (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'POP'))) { // 4.18 POP Popularimeter - // There may be more than one 'POPM' frame in each tag, - // but only one with the same email address - // <Header for 'Popularimeter', ID: 'POPM'> - // Email to user <text string> $00 - // Rating $xx - // Counter $xx xx xx xx (xx ...) - - $frame_offset = 0; - $frame_terminatorpos = @strpos($parsedFrame['data'], "\x00", $frame_offset); - $frame_emailaddress = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); - if (ord($frame_emailaddress) === 0) { - $frame_emailaddress = ''; - } - $frame_offset = $frame_terminatorpos + strlen("\x00"); - $frame_rating = ord(substr($parsedFrame['data'], $frame_offset++, 1)); - $parsedFrame['data'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset)); - $parsedFrame['email'] = $frame_emailaddress; - $parsedFrame['rating'] = $frame_rating; - unset($parsedFrame['data']); - - - } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'RBUF')) || // 4.18 RBUF Recommended buffer size - (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'BUF'))) { // 4.19 BUF Recommended buffer size - // There may only be one 'RBUF' frame in each tag - // <Header for 'Recommended buffer size', ID: 'RBUF'> - // Buffer size $xx xx xx - // Embedded info flag %0000000x - // Offset to next tag $xx xx xx xx - - $frame_offset = 0; - $parsedFrame['buffersize'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 3)); - $frame_offset += 3; - - $frame_embeddedinfoflags = getid3_lib::BigEndian2Bin(substr($parsedFrame['data'], $frame_offset++, 1)); - $parsedFrame['flags']['embededinfo'] = (bool) substr($frame_embeddedinfoflags, 7, 1); - $parsedFrame['nexttagoffset'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4)); - unset($parsedFrame['data']); - - - } elseif (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'CRM')) { // 4.20 Encrypted meta frame (ID3v2.2 only) - // There may be more than one 'CRM' frame in a tag, - // but only one with the same 'owner identifier' - // <Header for 'Encrypted meta frame', ID: 'CRM'> - // Owner identifier <textstring> $00 (00) - // Content/explanation <textstring> $00 (00) - // Encrypted datablock <binary data> - - $frame_offset = 0; - $frame_terminatorpos = @strpos($parsedFrame['data'], "\x00", $frame_offset); - $frame_ownerid = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); - $frame_offset = $frame_terminatorpos + strlen("\x00"); - - $frame_terminatorpos = @strpos($parsedFrame['data'], "\x00", $frame_offset); - $frame_description = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); - if (ord($frame_description) === 0) { - $frame_description = ''; - } - $frame_offset = $frame_terminatorpos + strlen("\x00"); - - $parsedFrame['ownerid'] = $frame_ownerid; - $parsedFrame['data'] = (string) substr($parsedFrame['data'], $frame_offset); - $parsedFrame['description'] = $frame_description; - unset($parsedFrame['data']); - - - } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'AENC')) || // 4.19 AENC Audio encryption - (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'CRA'))) { // 4.21 CRA Audio encryption - // There may be more than one 'AENC' frames in a tag, - // but only one with the same 'Owner identifier' - // <Header for 'Audio encryption', ID: 'AENC'> - // Owner identifier <text string> $00 - // Preview start $xx xx - // Preview length $xx xx - // Encryption info <binary data> - - $frame_offset = 0; - $frame_terminatorpos = @strpos($parsedFrame['data'], "\x00", $frame_offset); - $frame_ownerid = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); - if (ord($frame_ownerid) === 0) { - $frame_ownerid == ''; - } - $frame_offset = $frame_terminatorpos + strlen("\x00"); - $parsedFrame['ownerid'] = $frame_ownerid; - $parsedFrame['previewstart'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 2)); - $frame_offset += 2; - $parsedFrame['previewlength'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 2)); - $frame_offset += 2; - $parsedFrame['encryptioninfo'] = (string) substr($parsedFrame['data'], $frame_offset); - unset($parsedFrame['data']); - - - } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'LINK')) || // 4.20 LINK Linked information - (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'LNK'))) { // 4.22 LNK Linked information - // There may be more than one 'LINK' frame in a tag, - // but only one with the same contents - // <Header for 'Linked information', ID: 'LINK'> - // ID3v2.3+ => Frame identifier $xx xx xx xx - // ID3v2.2 => Frame identifier $xx xx xx - // URL <text string> $00 - // ID and additional data <text string(s)> - - $frame_offset = 0; - if ($id3v2_majorversion == 2) { - $parsedFrame['frameid'] = substr($parsedFrame['data'], $frame_offset, 3); - $frame_offset += 3; - } else { - $parsedFrame['frameid'] = substr($parsedFrame['data'], $frame_offset, 4); - $frame_offset += 4; - } - - $frame_terminatorpos = @strpos($parsedFrame['data'], "\x00", $frame_offset); - $frame_url = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); - if (ord($frame_url) === 0) { - $frame_url = ''; - } - $frame_offset = $frame_terminatorpos + strlen("\x00"); - $parsedFrame['url'] = $frame_url; - - $parsedFrame['additionaldata'] = (string) substr($parsedFrame['data'], $frame_offset); - if (!empty($parsedFrame['framenameshort']) && $parsedFrame['url']) { - $ThisFileInfo['id3v2']['comments'][$parsedFrame['framenameshort']][] = utf8_encode($parsedFrame['url']); - } - unset($parsedFrame['data']); - - - } elseif (($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'POSS')) { // 4.21 POSS Position synchronisation frame (ID3v2.3+ only) - // There may only be one 'POSS' frame in each tag - // <Head for 'Position synchronisation', ID: 'POSS'> - // Time stamp format $xx - // Position $xx (xx ...) - - $frame_offset = 0; - $parsedFrame['timestampformat'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); - $parsedFrame['position'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset)); - unset($parsedFrame['data']); - - - } elseif (($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'USER')) { // 4.22 USER Terms of use (ID3v2.3+ only) - // There may be more than one 'Terms of use' frame in a tag, - // but only one with the same 'Language' - // <Header for 'Terms of use frame', ID: 'USER'> - // Text encoding $xx - // Language $xx xx xx - // The actual text <text string according to encoding> - - $frame_offset = 0; - $frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1)); - if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) { - $ThisFileInfo['warning'][] = 'Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding'; - } - $frame_language = substr($parsedFrame['data'], $frame_offset, 3); - $frame_offset += 3; - $parsedFrame['language'] = $frame_language; - $parsedFrame['languagename'] = $this->LanguageLookup($frame_language, false); - $parsedFrame['encodingid'] = $frame_textencoding; - $parsedFrame['encoding'] = $this->TextEncodingNameLookup($frame_textencoding); - - $parsedFrame['data'] = (string) substr($parsedFrame['data'], $frame_offset); - if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) { - $ThisFileInfo['id3v2']['comments'][$parsedFrame['framenameshort']][] = getid3_lib::iconv_fallback($parsedFrame['encoding'], $ThisFileInfo['id3v2']['encoding'], $parsedFrame['data']); - } - unset($parsedFrame['data']); - - - } elseif (($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'OWNE')) { // 4.23 OWNE Ownership frame (ID3v2.3+ only) - // There may only be one 'OWNE' frame in a tag - // <Header for 'Ownership frame', ID: 'OWNE'> - // Text encoding $xx - // Price paid <text string> $00 - // Date of purch. <text string> - // Seller <text string according to encoding> - - $frame_offset = 0; - $frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1)); - if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) { - $ThisFileInfo['warning'][] = 'Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding'; - } - $parsedFrame['encodingid'] = $frame_textencoding; - $parsedFrame['encoding'] = $this->TextEncodingNameLookup($frame_textencoding); - - $frame_terminatorpos = @strpos($parsedFrame['data'], "\x00", $frame_offset); - $frame_pricepaid = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); - $frame_offset = $frame_terminatorpos + strlen("\x00"); - - $parsedFrame['pricepaid']['currencyid'] = substr($frame_pricepaid, 0, 3); - $parsedFrame['pricepaid']['currency'] = $this->LookupCurrencyUnits($parsedFrame['pricepaid']['currencyid']); - $parsedFrame['pricepaid']['value'] = substr($frame_pricepaid, 3); - - $parsedFrame['purchasedate'] = substr($parsedFrame['data'], $frame_offset, 8); - if (!$this->IsValidDateStampString($parsedFrame['purchasedate'])) { - $parsedFrame['purchasedateunix'] = mktime (0, 0, 0, substr($parsedFrame['purchasedate'], 4, 2), substr($parsedFrame['purchasedate'], 6, 2), substr($parsedFrame['purchasedate'], 0, 4)); - } - $frame_offset += 8; - - $parsedFrame['seller'] = (string) substr($parsedFrame['data'], $frame_offset); - unset($parsedFrame['data']); - - - } elseif (($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'COMR')) { // 4.24 COMR Commercial frame (ID3v2.3+ only) - // There may be more than one 'commercial frame' in a tag, - // but no two may be identical - // <Header for 'Commercial frame', ID: 'COMR'> - // Text encoding $xx - // Price string <text string> $00 - // Valid until <text string> - // Contact URL <text string> $00 - // Received as $xx - // Name of seller <text string according to encoding> $00 (00) - // Description <text string according to encoding> $00 (00) - // Picture MIME type <string> $00 - // Seller logo <binary data> - - $frame_offset = 0; - $frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1)); - if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) { - $ThisFileInfo['warning'][] = 'Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding'; - } - - $frame_terminatorpos = @strpos($parsedFrame['data'], "\x00", $frame_offset); - $frame_pricestring = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); - $frame_offset = $frame_terminatorpos + strlen("\x00"); - $frame_rawpricearray = explode('/', $frame_pricestring); - foreach ($frame_rawpricearray as $key => $val) { - $frame_currencyid = substr($val, 0, 3); - $parsedFrame['price'][$frame_currencyid]['currency'] = $this->LookupCurrencyUnits($frame_currencyid); - $parsedFrame['price'][$frame_currencyid]['value'] = substr($val, 3); - } - - $frame_datestring = substr($parsedFrame['data'], $frame_offset, 8); - $frame_offset += 8; - - $frame_terminatorpos = @strpos($parsedFrame['data'], "\x00", $frame_offset); - $frame_contacturl = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); - $frame_offset = $frame_terminatorpos + strlen("\x00"); - - $frame_receivedasid = ord(substr($parsedFrame['data'], $frame_offset++, 1)); - - $frame_terminatorpos = @strpos($parsedFrame['data'], $this->TextEncodingTerminatorLookup($frame_textencoding), $frame_offset); - if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)), 1)) === 0) { - $frame_terminatorpos++; // @strpos() fooled because 2nd byte of Unicode chars are often 0x00 - } - $frame_sellername = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); - if (ord($frame_sellername) === 0) { - $frame_sellername = ''; - } - $frame_offset = $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)); - - $frame_terminatorpos = @strpos($parsedFrame['data'], $this->TextEncodingTerminatorLookup($frame_textencoding), $frame_offset); - if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)), 1)) === 0) { - $frame_terminatorpos++; // @strpos() fooled because 2nd byte of Unicode chars are often 0x00 - } - $frame_description = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); - if (ord($frame_description) === 0) { - $frame_description = ''; - } - $frame_offset = $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)); - - $frame_terminatorpos = @strpos($parsedFrame['data'], "\x00", $frame_offset); - $frame_mimetype = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); - $frame_offset = $frame_terminatorpos + strlen("\x00"); - - $frame_sellerlogo = substr($parsedFrame['data'], $frame_offset); - - $parsedFrame['encodingid'] = $frame_textencoding; - $parsedFrame['encoding'] = $this->TextEncodingNameLookup($frame_textencoding); - - $parsedFrame['pricevaliduntil'] = $frame_datestring; - $parsedFrame['contacturl'] = $frame_contacturl; - $parsedFrame['receivedasid'] = $frame_receivedasid; - $parsedFrame['receivedas'] = $this->COMRReceivedAsLookup($frame_receivedasid); - $parsedFrame['sellername'] = $frame_sellername; - $parsedFrame['description'] = $frame_description; - $parsedFrame['mime'] = $frame_mimetype; - $parsedFrame['logo'] = $frame_sellerlogo; - unset($parsedFrame['data']); - - - } elseif (($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'ENCR')) { // 4.25 ENCR Encryption method registration (ID3v2.3+ only) - // There may be several 'ENCR' frames in a tag, - // but only one containing the same symbol - // and only one containing the same owner identifier - // <Header for 'Encryption method registration', ID: 'ENCR'> - // Owner identifier <text string> $00 - // Method symbol $xx - // Encryption data <binary data> - - $frame_offset = 0; - $frame_terminatorpos = @strpos($parsedFrame['data'], "\x00", $frame_offset); - $frame_ownerid = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); - if (ord($frame_ownerid) === 0) { - $frame_ownerid = ''; - } - $frame_offset = $frame_terminatorpos + strlen("\x00"); - - $parsedFrame['ownerid'] = $frame_ownerid; - $parsedFrame['methodsymbol'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); - $parsedFrame['data'] = (string) substr($parsedFrame['data'], $frame_offset); - - - } elseif (($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'GRID')) { // 4.26 GRID Group identification registration (ID3v2.3+ only) - - // There may be several 'GRID' frames in a tag, - // but only one containing the same symbol - // and only one containing the same owner identifier - // <Header for 'Group ID registration', ID: 'GRID'> - // Owner identifier <text string> $00 - // Group symbol $xx - // Group dependent data <binary data> - - $frame_offset = 0; - $frame_terminatorpos = @strpos($parsedFrame['data'], "\x00", $frame_offset); - $frame_ownerid = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); - if (ord($frame_ownerid) === 0) { - $frame_ownerid = ''; - } - $frame_offset = $frame_terminatorpos + strlen("\x00"); - - $parsedFrame['ownerid'] = $frame_ownerid; - $parsedFrame['groupsymbol'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); - $parsedFrame['data'] = (string) substr($parsedFrame['data'], $frame_offset); - - - } elseif (($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'PRIV')) { // 4.27 PRIV Private frame (ID3v2.3+ only) - // The tag may contain more than one 'PRIV' frame - // but only with different contents - // <Header for 'Private frame', ID: 'PRIV'> - // Owner identifier <text string> $00 - // The private data <binary data> - - $frame_offset = 0; - $frame_terminatorpos = @strpos($parsedFrame['data'], "\x00", $frame_offset); - $frame_ownerid = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); - if (ord($frame_ownerid) === 0) { - $frame_ownerid = ''; - } - $frame_offset = $frame_terminatorpos + strlen("\x00"); - - $parsedFrame['ownerid'] = $frame_ownerid; - $parsedFrame['data'] = (string) substr($parsedFrame['data'], $frame_offset); - - - } elseif (($id3v2_majorversion >= 4) && ($parsedFrame['frame_name'] == 'SIGN')) { // 4.28 SIGN Signature frame (ID3v2.4+ only) - // There may be more than one 'signature frame' in a tag, - // but no two may be identical - // <Header for 'Signature frame', ID: 'SIGN'> - // Group symbol $xx - // Signature <binary data> - - $frame_offset = 0; - $parsedFrame['groupsymbol'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); - $parsedFrame['data'] = (string) substr($parsedFrame['data'], $frame_offset); - - - } elseif (($id3v2_majorversion >= 4) && ($parsedFrame['frame_name'] == 'SEEK')) { // 4.29 SEEK Seek frame (ID3v2.4+ only) - // There may only be one 'seek frame' in a tag - // <Header for 'Seek frame', ID: 'SEEK'> - // Minimum offset to next tag $xx xx xx xx - - $frame_offset = 0; - $parsedFrame['data'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4)); - - - } elseif (($id3v2_majorversion >= 4) && ($parsedFrame['frame_name'] == 'ASPI')) { // 4.30 ASPI Audio seek point index (ID3v2.4+ only) - // There may only be one 'audio seek point index' frame in a tag - // <Header for 'Seek Point Index', ID: 'ASPI'> - // Indexed data start (S) $xx xx xx xx - // Indexed data length (L) $xx xx xx xx - // Number of index points (N) $xx xx - // Bits per index point (b) $xx - // Then for every index point the following data is included: - // Fraction at index (Fi) $xx (xx) - - $frame_offset = 0; - $parsedFrame['datastart'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4)); - $frame_offset += 4; - $parsedFrame['indexeddatalength'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4)); - $frame_offset += 4; - $parsedFrame['indexpoints'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 2)); - $frame_offset += 2; - $parsedFrame['bitsperpoint'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); - $frame_bytesperpoint = ceil($parsedFrame['bitsperpoint'] / 8); - for ($i = 0; $i < $frame_indexpoints; $i++) { - $parsedFrame['indexes'][$i] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesperpoint)); - $frame_offset += $frame_bytesperpoint; - } - unset($parsedFrame['data']); - - } elseif (($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'RGAD')) { // Replay Gain Adjustment - // http://privatewww.essex.ac.uk/~djmrob/replaygain/file_format_id3v2.html - // There may only be one 'RGAD' frame in a tag - // <Header for 'Replay Gain Adjustment', ID: 'RGAD'> - // Peak Amplitude $xx $xx $xx $xx - // Radio Replay Gain Adjustment %aaabbbcd %dddddddd - // Audiophile Replay Gain Adjustment %aaabbbcd %dddddddd - // a - name code - // b - originator code - // c - sign bit - // d - replay gain adjustment - - $frame_offset = 0; - $parsedFrame['peakamplitude'] = getid3_lib::BigEndian2Float(substr($parsedFrame['data'], $frame_offset, 4)); - $frame_offset += 4; - $rg_track_adjustment = getid3_lib::Dec2Bin(substr($parsedFrame['data'], $frame_offset, 2)); - $frame_offset += 2; - $rg_album_adjustment = getid3_lib::Dec2Bin(substr($parsedFrame['data'], $frame_offset, 2)); - $frame_offset += 2; - $parsedFrame['raw']['track']['name'] = getid3_lib::Bin2Dec(substr($rg_track_adjustment, 0, 3)); - $parsedFrame['raw']['track']['originator'] = getid3_lib::Bin2Dec(substr($rg_track_adjustment, 3, 3)); - $parsedFrame['raw']['track']['signbit'] = getid3_lib::Bin2Dec(substr($rg_track_adjustment, 6, 1)); - $parsedFrame['raw']['track']['adjustment'] = getid3_lib::Bin2Dec(substr($rg_track_adjustment, 7, 9)); - $parsedFrame['raw']['album']['name'] = getid3_lib::Bin2Dec(substr($rg_album_adjustment, 0, 3)); - $parsedFrame['raw']['album']['originator'] = getid3_lib::Bin2Dec(substr($rg_album_adjustment, 3, 3)); - $parsedFrame['raw']['album']['signbit'] = getid3_lib::Bin2Dec(substr($rg_album_adjustment, 6, 1)); - $parsedFrame['raw']['album']['adjustment'] = getid3_lib::Bin2Dec(substr($rg_album_adjustment, 7, 9)); - $parsedFrame['track']['name'] = getid3_lib::RGADnameLookup($parsedFrame['raw']['track']['name']); - $parsedFrame['track']['originator'] = getid3_lib::RGADoriginatorLookup($parsedFrame['raw']['track']['originator']); - $parsedFrame['track']['adjustment'] = getid3_lib::RGADadjustmentLookup($parsedFrame['raw']['track']['adjustment'], $parsedFrame['raw']['track']['signbit']); - $parsedFrame['album']['name'] = getid3_lib::RGADnameLookup($parsedFrame['raw']['album']['name']); - $parsedFrame['album']['originator'] = getid3_lib::RGADoriginatorLookup($parsedFrame['raw']['album']['originator']); - $parsedFrame['album']['adjustment'] = getid3_lib::RGADadjustmentLookup($parsedFrame['raw']['album']['adjustment'], $parsedFrame['raw']['album']['signbit']); - - $ThisFileInfo['replay_gain']['track']['peak'] = $parsedFrame['peakamplitude']; - $ThisFileInfo['replay_gain']['track']['originator'] = $parsedFrame['track']['originator']; - $ThisFileInfo['replay_gain']['track']['adjustment'] = $parsedFrame['track']['adjustment']; - $ThisFileInfo['replay_gain']['album']['originator'] = $parsedFrame['album']['originator']; - $ThisFileInfo['replay_gain']['album']['adjustment'] = $parsedFrame['album']['adjustment']; - - unset($parsedFrame['data']); - - } - - return true; - } - - - function DeUnsynchronise($data) { - return str_replace("\xFF\x00", "\xFF", $data); - } - - function LookupCurrencyUnits($currencyid) { - - $begin = __LINE__; - - /** This is not a comment! - - - AED Dirhams - AFA Afghanis - ALL Leke - AMD Drams - ANG Guilders - AOA Kwanza - ARS Pesos - ATS Schillings - AUD Dollars - AWG Guilders - AZM Manats - BAM Convertible Marka - BBD Dollars - BDT Taka - BEF Francs - BGL Leva - BHD Dinars - BIF Francs - BMD Dollars - BND Dollars - BOB Bolivianos - BRL Brazil Real - BSD Dollars - BTN Ngultrum - BWP Pulas - BYR Rubles - BZD Dollars - CAD Dollars - CDF Congolese Francs - CHF Francs - CLP Pesos - CNY Yuan Renminbi - COP Pesos - CRC Colones - CUP Pesos - CVE Escudos - CYP Pounds - CZK Koruny - DEM Deutsche Marks - DJF Francs - DKK Kroner - DOP Pesos - DZD Algeria Dinars - EEK Krooni - EGP Pounds - ERN Nakfa - ESP Pesetas - ETB Birr - EUR Euro - FIM Markkaa - FJD Dollars - FKP Pounds - FRF Francs - GBP Pounds - GEL Lari - GGP Pounds - GHC Cedis - GIP Pounds - GMD Dalasi - GNF Francs - GRD Drachmae - GTQ Quetzales - GYD Dollars - HKD Dollars - HNL Lempiras - HRK Kuna - HTG Gourdes - HUF Forints - IDR Rupiahs - IEP Pounds - ILS New Shekels - IMP Pounds - INR Rupees - IQD Dinars - IRR Rials - ISK Kronur - ITL Lire - JEP Pounds - JMD Dollars - JOD Dinars - JPY Yen - KES Shillings - KGS Soms - KHR Riels - KMF Francs - KPW Won - KWD Dinars - KYD Dollars - KZT Tenge - LAK Kips - LBP Pounds - LKR Rupees - LRD Dollars - LSL Maloti - LTL Litai - LUF Francs - LVL Lati - LYD Dinars - MAD Dirhams - MDL Lei - MGF Malagasy Francs - MKD Denars - MMK Kyats - MNT Tugriks - MOP Patacas - MRO Ouguiyas - MTL Liri - MUR Rupees - MVR Rufiyaa - MWK Kwachas - MXN Pesos - MYR Ringgits - MZM Meticais - NAD Dollars - NGN Nairas - NIO Gold Cordobas - NLG Guilders - NOK Krone - NPR Nepal Rupees - NZD Dollars - OMR Rials - PAB Balboa - PEN Nuevos Soles - PGK Kina - PHP Pesos - PKR Rupees - PLN Zlotych - PTE Escudos - PYG Guarani - QAR Rials - ROL Lei - RUR Rubles - RWF Rwanda Francs - SAR Riyals - SBD Dollars - SCR Rupees - SDD Dinars - SEK Kronor - SGD Dollars - SHP Pounds - SIT Tolars - SKK Koruny - SLL Leones - SOS Shillings - SPL Luigini - SRG Guilders - STD Dobras - SVC Colones - SYP Pounds - SZL Emalangeni - THB Baht - TJR Rubles - TMM Manats - TND Dinars - TOP Pa'anga - TRL Liras - TTD Dollars - TVD Tuvalu Dollars - TWD New Dollars - TZS Shillings - UAH Hryvnia - UGX Shillings - USD Dollars - UYU Pesos - UZS Sums - VAL Lire - VEB Bolivares - VND Dong - VUV Vatu - WST Tala - XAF Francs - XAG Ounces - XAU Ounces - XCD Dollars - XDR Special Drawing Rights - XPD Ounces - XPF Francs - XPT Ounces - YER Rials - YUM New Dinars - ZAR Rand - ZMK Kwacha - ZWD Zimbabwe Dollars - - */ - - return getid3_lib::EmbeddedLookup($currencyid, $begin, __LINE__, __FILE__, 'id3v2-currency-units'); - } - - - function LookupCurrencyCountry($currencyid) { - - $begin = __LINE__; - - /** This is not a comment! - - AED United Arab Emirates - AFA Afghanistan - ALL Albania - AMD Armenia - ANG Netherlands Antilles - AOA Angola - ARS Argentina - ATS Austria - AUD Australia - AWG Aruba - AZM Azerbaijan - BAM Bosnia and Herzegovina - BBD Barbados - BDT Bangladesh - BEF Belgium - BGL Bulgaria - BHD Bahrain - BIF Burundi - BMD Bermuda - BND Brunei Darussalam - BOB Bolivia - BRL Brazil - BSD Bahamas - BTN Bhutan - BWP Botswana - BYR Belarus - BZD Belize - CAD Canada - CDF Congo/Kinshasa - CHF Switzerland - CLP Chile - CNY China - COP Colombia - CRC Costa Rica - CUP Cuba - CVE Cape Verde - CYP Cyprus - CZK Czech Republic - DEM Germany - DJF Djibouti - DKK Denmark - DOP Dominican Republic - DZD Algeria - EEK Estonia - EGP Egypt - ERN Eritrea - ESP Spain - ETB Ethiopia - EUR Euro Member Countries - FIM Finland - FJD Fiji - FKP Falkland Islands (Malvinas) - FRF France - GBP United Kingdom - GEL Georgia - GGP Guernsey - GHC Ghana - GIP Gibraltar - GMD Gambia - GNF Guinea - GRD Greece - GTQ Guatemala - GYD Guyana - HKD Hong Kong - HNL Honduras - HRK Croatia - HTG Haiti - HUF Hungary - IDR Indonesia - IEP Ireland (Eire) - ILS Israel - IMP Isle of Man - INR India - IQD Iraq - IRR Iran - ISK Iceland - ITL Italy - JEP Jersey - JMD Jamaica - JOD Jordan - JPY Japan - KES Kenya - KGS Kyrgyzstan - KHR Cambodia - KMF Comoros - KPW Korea - KWD Kuwait - KYD Cayman Islands - KZT Kazakstan - LAK Laos - LBP Lebanon - LKR Sri Lanka - LRD Liberia - LSL Lesotho - LTL Lithuania - LUF Luxembourg - LVL Latvia - LYD Libya - MAD Morocco - MDL Moldova - MGF Madagascar - MKD Macedonia - MMK Myanmar (Burma) - MNT Mongolia - MOP Macau - MRO Mauritania - MTL Malta - MUR Mauritius - MVR Maldives (Maldive Islands) - MWK Malawi - MXN Mexico - MYR Malaysia - MZM Mozambique - NAD Namibia - NGN Nigeria - NIO Nicaragua - NLG Netherlands (Holland) - NOK Norway - NPR Nepal - NZD New Zealand - OMR Oman - PAB Panama - PEN Peru - PGK Papua New Guinea - PHP Philippines - PKR Pakistan - PLN Poland - PTE Portugal - PYG Paraguay - QAR Qatar - ROL Romania - RUR Russia - RWF Rwanda - SAR Saudi Arabia - SBD Solomon Islands - SCR Seychelles - SDD Sudan - SEK Sweden - SGD Singapore - SHP Saint Helena - SIT Slovenia - SKK Slovakia - SLL Sierra Leone - SOS Somalia - SPL Seborga - SRG Suriname - STD São Tome and Principe - SVC El Salvador - SYP Syria - SZL Swaziland - THB Thailand - TJR Tajikistan - TMM Turkmenistan - TND Tunisia - TOP Tonga - TRL Turkey - TTD Trinidad and Tobago - TVD Tuvalu - TWD Taiwan - TZS Tanzania - UAH Ukraine - UGX Uganda - USD United States of America - UYU Uruguay - UZS Uzbekistan - VAL Vatican City - VEB Venezuela - VND Viet Nam - VUV Vanuatu - WST Samoa - XAF Communauté Financière Africaine - XAG Silver - XAU Gold - XCD East Caribbean - XDR International Monetary Fund - XPD Palladium - XPF Comptoirs Français du Pacifique - XPT Platinum - YER Yemen - YUM Yugoslavia - ZAR South Africa - ZMK Zambia - ZWD Zimbabwe - - */ - - return getid3_lib::EmbeddedLookup($currencyid, $begin, __LINE__, __FILE__, 'id3v2-currency-country'); - } - - - - function LanguageLookup($languagecode, $casesensitive=false) { - - if (!$casesensitive) { - $languagecode = strtolower($languagecode); - } - - // http://www.id3.org/id3v2.4.0-structure.txt - // [4. ID3v2 frame overview] - // The three byte language field, present in several frames, is used to - // describe the language of the frame's content, according to ISO-639-2 - // [ISO-639-2]. The language should be represented in lower case. If the - // language is not known the string "XXX" should be used. - - - // ISO 639-2 - http://www.id3.org/iso639-2.html - - $begin = __LINE__; - - /** This is not a comment! - - XXX unknown - xxx unknown - aar Afar - abk Abkhazian - ace Achinese - ach Acoli - ada Adangme - afa Afro-Asiatic (Other) - afh Afrihili - afr Afrikaans - aka Akan - akk Akkadian - alb Albanian - ale Aleut - alg Algonquian Languages - amh Amharic - ang English, Old (ca. 450-1100) - apa Apache Languages - ara Arabic - arc Aramaic - arm Armenian - arn Araucanian - arp Arapaho - art Artificial (Other) - arw Arawak - asm Assamese - ath Athapascan Languages - ava Avaric - ave Avestan - awa Awadhi - aym Aymara - aze Azerbaijani - bad Banda - bai Bamileke Languages - bak Bashkir - bal Baluchi - bam Bambara - ban Balinese - baq Basque - bas Basa - bat Baltic (Other) - bej Beja - bel Byelorussian - bem Bemba - ben Bengali - ber Berber (Other) - bho Bhojpuri - bih Bihari - bik Bikol - bin Bini - bis Bislama - bla Siksika - bnt Bantu (Other) - bod Tibetan - bra Braj - bre Breton - bua Buriat - bug Buginese - bul Bulgarian - bur Burmese - cad Caddo - cai Central American Indian (Other) - car Carib - cat Catalan - cau Caucasian (Other) - ceb Cebuano - cel Celtic (Other) - ces Czech - cha Chamorro - chb Chibcha - che Chechen - chg Chagatai - chi Chinese - chm Mari - chn Chinook jargon - cho Choctaw - chr Cherokee - chu Church Slavic - chv Chuvash - chy Cheyenne - cop Coptic - cor Cornish - cos Corsican - cpe Creoles and Pidgins, English-based (Other) - cpf Creoles and Pidgins, French-based (Other) - cpp Creoles and Pidgins, Portuguese-based (Other) - cre Cree - crp Creoles and Pidgins (Other) - cus Cushitic (Other) - cym Welsh - cze Czech - dak Dakota - dan Danish - del Delaware - deu German - din Dinka - div Divehi - doi Dogri - dra Dravidian (Other) - dua Duala - dum Dutch, Middle (ca. 1050-1350) - dut Dutch - dyu Dyula - dzo Dzongkha - efi Efik - egy Egyptian (Ancient) - eka Ekajuk - ell Greek, Modern (1453-) - elx Elamite - eng English - enm English, Middle (ca. 1100-1500) - epo Esperanto - esk Eskimo (Other) - esl Spanish - est Estonian - eus Basque - ewe Ewe - ewo Ewondo - fan Fang - fao Faroese - fas Persian - fat Fanti - fij Fijian - fin Finnish - fiu Finno-Ugrian (Other) - fon Fon - fra French - fre French - frm French, Middle (ca. 1400-1600) - fro French, Old (842- ca. 1400) - fry Frisian - ful Fulah - gaa Ga - gae Gaelic (Scots) - gai Irish - gay Gayo - gdh Gaelic (Scots) - gem Germanic (Other) - geo Georgian - ger German - gez Geez - gil Gilbertese - glg Gallegan - gmh German, Middle High (ca. 1050-1500) - goh German, Old High (ca. 750-1050) - gon Gondi - got Gothic - grb Grebo - grc Greek, Ancient (to 1453) - gre Greek, Modern (1453-) - grn Guarani - guj Gujarati - hai Haida - hau Hausa - haw Hawaiian - heb Hebrew - her Herero - hil Hiligaynon - him Himachali - hin Hindi - hmo Hiri Motu - hun Hungarian - hup Hupa - hye Armenian - iba Iban - ibo Igbo - ice Icelandic - ijo Ijo - iku Inuktitut - ilo Iloko - ina Interlingua (International Auxiliary language Association) - inc Indic (Other) - ind Indonesian - ine Indo-European (Other) - ine Interlingue - ipk Inupiak - ira Iranian (Other) - iri Irish - iro Iroquoian uages - isl Icelandic - ita Italian - jav Javanese - jaw Javanese - jpn Japanese - jpr Judeo-Persian - jrb Judeo-Arabic - kaa Kara-Kalpak - kab Kabyle - kac Kachin - kal Greenlandic - kam Kamba - kan Kannada - kar Karen - kas Kashmiri - kat Georgian - kau Kanuri - kaw Kawi - kaz Kazakh - kha Khasi - khi Khoisan (Other) - khm Khmer - kho Khotanese - kik Kikuyu - kin Kinyarwanda - kir Kirghiz - kok Konkani - kom Komi - kon Kongo - kor Korean - kpe Kpelle - kro Kru - kru Kurukh - kua Kuanyama - kum Kumyk - kur Kurdish - kus Kusaie - kut Kutenai - lad Ladino - lah Lahnda - lam Lamba - lao Lao - lat Latin - lav Latvian - lez Lezghian - lin Lingala - lit Lithuanian - lol Mongo - loz Lozi - ltz Letzeburgesch - lub Luba-Katanga - lug Ganda - lui Luiseno - lun Lunda - luo Luo (Kenya and Tanzania) - mac Macedonian - mad Madurese - mag Magahi - mah Marshall - mai Maithili - mak Macedonian - mak Makasar - mal Malayalam - man Mandingo - mao Maori - map Austronesian (Other) - mar Marathi - mas Masai - max Manx - may Malay - men Mende - mga Irish, Middle (900 - 1200) - mic Micmac - min Minangkabau - mis Miscellaneous (Other) - mkh Mon-Kmer (Other) - mlg Malagasy - mlt Maltese - mni Manipuri - mno Manobo Languages - moh Mohawk - mol Moldavian - mon Mongolian - mos Mossi - mri Maori - msa Malay - mul Multiple Languages - mun Munda Languages - mus Creek - mwr Marwari - mya Burmese - myn Mayan Languages - nah Aztec - nai North American Indian (Other) - nau Nauru - nav Navajo - nbl Ndebele, South - nde Ndebele, North - ndo Ndongo - nep Nepali - new Newari - nic Niger-Kordofanian (Other) - niu Niuean - nla Dutch - nno Norwegian (Nynorsk) - non Norse, Old - nor Norwegian - nso Sotho, Northern - nub Nubian Languages - nya Nyanja - nym Nyamwezi - nyn Nyankole - nyo Nyoro - nzi Nzima - oci Langue d'Oc (post 1500) - oji Ojibwa - ori Oriya - orm Oromo - osa Osage - oss Ossetic - ota Turkish, Ottoman (1500 - 1928) - oto Otomian Languages - paa Papuan-Australian (Other) - pag Pangasinan - pal Pahlavi - pam Pampanga - pan Panjabi - pap Papiamento - pau Palauan - peo Persian, Old (ca 600 - 400 B.C.) - per Persian - phn Phoenician - pli Pali - pol Polish - pon Ponape - por Portuguese - pra Prakrit uages - pro Provencal, Old (to 1500) - pus Pushto - que Quechua - raj Rajasthani - rar Rarotongan - roa Romance (Other) - roh Rhaeto-Romance - rom Romany - ron Romanian - rum Romanian - run Rundi - rus Russian - sad Sandawe - sag Sango - sah Yakut - sai South American Indian (Other) - sal Salishan Languages - sam Samaritan Aramaic - san Sanskrit - sco Scots - scr Serbo-Croatian - sel Selkup - sem Semitic (Other) - sga Irish, Old (to 900) - shn Shan - sid Sidamo - sin Singhalese - sio Siouan Languages - sit Sino-Tibetan (Other) - sla Slavic (Other) - slk Slovak - slo Slovak - slv Slovenian - smi Sami Languages - smo Samoan - sna Shona - snd Sindhi - sog Sogdian - som Somali - son Songhai - sot Sotho, Southern - spa Spanish - sqi Albanian - srd Sardinian - srr Serer - ssa Nilo-Saharan (Other) - ssw Siswant - ssw Swazi - suk Sukuma - sun Sudanese - sus Susu - sux Sumerian - sve Swedish - swa Swahili - swe Swedish - syr Syriac - tah Tahitian - tam Tamil - tat Tatar - tel Telugu - tem Timne - ter Tereno - tgk Tajik - tgl Tagalog - tha Thai - tib Tibetan - tig Tigre - tir Tigrinya - tiv Tivi - tli Tlingit - tmh Tamashek - tog Tonga (Nyasa) - ton Tonga (Tonga Islands) - tru Truk - tsi Tsimshian - tsn Tswana - tso Tsonga - tuk Turkmen - tum Tumbuka - tur Turkish - tut Altaic (Other) - twi Twi - tyv Tuvinian - uga Ugaritic - uig Uighur - ukr Ukrainian - umb Umbundu - und Undetermined - urd Urdu - uzb Uzbek - vai Vai - ven Venda - vie Vietnamese - vol Volapük - vot Votic - wak Wakashan Languages - wal Walamo - war Waray - was Washo - wel Welsh - wen Sorbian Languages - wol Wolof - xho Xhosa - yao Yao - yap Yap - yid Yiddish - yor Yoruba - zap Zapotec - zen Zenaga - zha Zhuang - zho Chinese - zul Zulu - zun Zuni - - */ - - return getid3_lib::EmbeddedLookup($languagecode, $begin, __LINE__, __FILE__, 'id3v2-languagecode'); - } - - - function ETCOEventLookup($index) { - if (($index >= 0x17) && ($index <= 0xDF)) { - return 'reserved for future use'; - } - if (($index >= 0xE0) && ($index <= 0xEF)) { - return 'not predefined synch 0-F'; - } - if (($index >= 0xF0) && ($index <= 0xFC)) { - return 'reserved for future use'; - } - - static $EventLookup = array( - 0x00 => 'padding (has no meaning)', - 0x01 => 'end of initial silence', - 0x02 => 'intro start', - 0x03 => 'main part start', - 0x04 => 'outro start', - 0x05 => 'outro end', - 0x06 => 'verse start', - 0x07 => 'refrain start', - 0x08 => 'interlude start', - 0x09 => 'theme start', - 0x0A => 'variation start', - 0x0B => 'key change', - 0x0C => 'time change', - 0x0D => 'momentary unwanted noise (Snap, Crackle & Pop)', - 0x0E => 'sustained noise', - 0x0F => 'sustained noise end', - 0x10 => 'intro end', - 0x11 => 'main part end', - 0x12 => 'verse end', - 0x13 => 'refrain end', - 0x14 => 'theme end', - 0x15 => 'profanity', - 0x16 => 'profanity end', - 0xFD => 'audio end (start of silence)', - 0xFE => 'audio file ends', - 0xFF => 'one more byte of events follows' - ); - - return (isset($EventLookup[$index]) ? $EventLookup[$index] : ''); - } - - function SYTLContentTypeLookup($index) { - static $SYTLContentTypeLookup = array( - 0x00 => 'other', - 0x01 => 'lyrics', - 0x02 => 'text transcription', - 0x03 => 'movement/part name', // (e.g. 'Adagio') - 0x04 => 'events', // (e.g. 'Don Quijote enters the stage') - 0x05 => 'chord', // (e.g. 'Bb F Fsus') - 0x06 => 'trivia/\'pop up\' information', - 0x07 => 'URLs to webpages', - 0x08 => 'URLs to images' - ); - - return (isset($SYTLContentTypeLookup[$index]) ? $SYTLContentTypeLookup[$index] : ''); - } - - function APICPictureTypeLookup($index, $returnarray=false) { - static $APICPictureTypeLookup = array( - 0x00 => 'Other', - 0x01 => '32x32 pixels \'file icon\' (PNG only)', - 0x02 => 'Other file icon', - 0x03 => 'Cover (front)', - 0x04 => 'Cover (back)', - 0x05 => 'Leaflet page', - 0x06 => 'Media (e.g. label side of CD)', - 0x07 => 'Lead artist/lead performer/soloist', - 0x08 => 'Artist/performer', - 0x09 => 'Conductor', - 0x0A => 'Band/Orchestra', - 0x0B => 'Composer', - 0x0C => 'Lyricist/text writer', - 0x0D => 'Recording Location', - 0x0E => 'During recording', - 0x0F => 'During performance', - 0x10 => 'Movie/video screen capture', - 0x11 => 'A bright coloured fish', - 0x12 => 'Illustration', - 0x13 => 'Band/artist logotype', - 0x14 => 'Publisher/Studio logotype' - ); - if ($returnarray) { - return $APICPictureTypeLookup; - } - return (isset($APICPictureTypeLookup[$index]) ? $APICPictureTypeLookup[$index] : ''); - } - - function COMRReceivedAsLookup($index) { - static $COMRReceivedAsLookup = array( - 0x00 => 'Other', - 0x01 => 'Standard CD album with other songs', - 0x02 => 'Compressed audio on CD', - 0x03 => 'File over the Internet', - 0x04 => 'Stream over the Internet', - 0x05 => 'As note sheets', - 0x06 => 'As note sheets in a book with other sheets', - 0x07 => 'Music on other media', - 0x08 => 'Non-musical merchandise' - ); - - return (isset($COMRReceivedAsLookup[$index]) ? $COMRReceivedAsLookup[$index] : ''); - } - - function RVA2ChannelTypeLookup($index) { - static $RVA2ChannelTypeLookup = array( - 0x00 => 'Other', - 0x01 => 'Master volume', - 0x02 => 'Front right', - 0x03 => 'Front left', - 0x04 => 'Back right', - 0x05 => 'Back left', - 0x06 => 'Front centre', - 0x07 => 'Back centre', - 0x08 => 'Subwoofer' - ); - - return (isset($RVA2ChannelTypeLookup[$index]) ? $RVA2ChannelTypeLookup[$index] : ''); - } - - function FrameNameLongLookup($framename) { - - $begin = __LINE__; - - /** This is not a comment! - - AENC Audio encryption - APIC Attached picture - ASPI Audio seek point index - BUF Recommended buffer size - CNT Play counter - COM Comments - COMM Comments - COMR Commercial frame - CRA Audio encryption - CRM Encrypted meta frame - ENCR Encryption method registration - EQU Equalisation - EQU2 Equalisation (2) - EQUA Equalisation - ETC Event timing codes - ETCO Event timing codes - GEO General encapsulated object - GEOB General encapsulated object - GRID Group identification registration - IPL Involved people list - IPLS Involved people list - LINK Linked information - LNK Linked information - MCDI Music CD identifier - MCI Music CD Identifier - MLL MPEG location lookup table - MLLT MPEG location lookup table - OWNE Ownership frame - PCNT Play counter - PIC Attached picture - POP Popularimeter - POPM Popularimeter - POSS Position synchronisation frame - PRIV Private frame - RBUF Recommended buffer size - REV Reverb - RVA Relative volume adjustment - RVA2 Relative volume adjustment (2) - RVAD Relative volume adjustment - RVRB Reverb - SEEK Seek frame - SIGN Signature frame - SLT Synchronised lyric/text - STC Synced tempo codes - SYLT Synchronised lyric/text - SYTC Synchronised tempo codes - TAL Album/Movie/Show title - TALB Album/Movie/Show title - TBP BPM (Beats Per Minute) - TBPM BPM (beats per minute) - TCM Composer - TCMP Part of a compilation - TCO Content type - TCOM Composer - TCON Content type - TCOP Copyright message - TCP Part of a compilation - TCR Copyright message - TDA Date - TDAT Date - TDEN Encoding time - TDLY Playlist delay - TDOR Original release time - TDRC Recording time - TDRL Release time - TDTG Tagging time - TDY Playlist delay - TEN Encoded by - TENC Encoded by - TEXT Lyricist/Text writer - TFLT File type - TFT File type - TIM Time - TIME Time - TIPL Involved people list - TIT1 Content group description - TIT2 Title/songname/content description - TIT3 Subtitle/Description refinement - TKE Initial key - TKEY Initial key - TLA Language(s) - TLAN Language(s) - TLE Length - TLEN Length - TMCL Musician credits list - TMED Media type - TMOO Mood - TMT Media type - TOA Original artist(s)/performer(s) - TOAL Original album/movie/show title - TOF Original filename - TOFN Original filename - TOL Original Lyricist(s)/text writer(s) - TOLY Original lyricist(s)/text writer(s) - TOPE Original artist(s)/performer(s) - TOR Original release year - TORY Original release year - TOT Original album/Movie/Show title - TOWN File owner/licensee - TP1 Lead artist(s)/Lead performer(s)/Soloist(s)/Performing group - TP2 Band/Orchestra/Accompaniment - TP3 Conductor/Performer refinement - TP4 Interpreted, remixed, or otherwise modified by - TPA Part of a set - TPB Publisher - TPE1 Lead performer(s)/Soloist(s) - TPE2 Band/orchestra/accompaniment - TPE3 Conductor/performer refinement - TPE4 Interpreted, remixed, or otherwise modified by - TPOS Part of a set - TPRO Produced notice - TPUB Publisher - TRC ISRC (International Standard Recording Code) - TRCK Track number/Position in set - TRD Recording dates - TRDA Recording dates - TRK Track number/Position in set - TRSN Internet radio station name - TRSO Internet radio station owner - TS2 Album-Artist sort order - TSA Album sort order - TSC Composer sort order - TSI Size - TSIZ Size - TSO2 Album-Artist sort order - TSOA Album sort order - TSOC Composer sort order - TSOP Performer sort order - TSOT Title sort order - TSP Performer sort order - TSRC ISRC (international standard recording code) - TSS Software/hardware and settings used for encoding - TSSE Software/Hardware and settings used for encoding - TSST Set subtitle - TST Title sort order - TT1 Content group description - TT2 Title/Songname/Content description - TT3 Subtitle/Description refinement - TXT Lyricist/text writer - TXX User defined text information frame - TXXX User defined text information frame - TYE Year - TYER Year - UFI Unique file identifier - UFID Unique file identifier - ULT Unsychronised lyric/text transcription - USER Terms of use - USLT Unsynchronised lyric/text transcription - WAF Official audio file webpage - WAR Official artist/performer webpage - WAS Official audio source webpage - WCM Commercial information - WCOM Commercial information - WCOP Copyright/Legal information - WCP Copyright/Legal information - WOAF Official audio file webpage - WOAR Official artist/performer webpage - WOAS Official audio source webpage - WORS Official Internet radio station homepage - WPAY Payment - WPB Publishers official webpage - WPUB Publishers official webpage - WXX User defined URL link frame - WXXX User defined URL link frame - TFEA Featured Artist - TSTU Recording Studio - rgad Replay Gain Adjustment - - */ - - return getid3_lib::EmbeddedLookup($framename, $begin, __LINE__, __FILE__, 'id3v2-framename_long'); - - // Last three: - // from Helium2 [www.helium2.com] - // from http://privatewww.essex.ac.uk/~djmrob/replaygain/file_format_id3v2.html - } - - - function FrameNameShortLookup($framename) { - - $begin = __LINE__; - - /** This is not a comment! - - AENC audio_encryption - APIC attached_picture - ASPI audio_seek_point_index - BUF recommended_buffer_size - CNT play_counter - COM comments - COMM comments - COMR commercial_frame - CRA audio_encryption - CRM encrypted_meta_frame - ENCR encryption_method_registration - EQU equalisation - EQU2 equalisation - EQUA equalisation - ETC event_timing_codes - ETCO event_timing_codes - GEO general_encapsulated_object - GEOB general_encapsulated_object - GRID group_identification_registration - IPL involved_people_list - IPLS involved_people_list - LINK linked_information - LNK linked_information - MCDI music_cd_identifier - MCI music_cd_identifier - MLL mpeg_location_lookup_table - MLLT mpeg_location_lookup_table - OWNE ownership_frame - PCNT play_counter - PIC attached_picture - POP popularimeter - POPM popularimeter - POSS position_synchronisation_frame - PRIV private_frame - RBUF recommended_buffer_size - REV reverb - RVA relative_volume_adjustment - RVA2 relative_volume_adjustment - RVAD relative_volume_adjustment - RVRB reverb - SEEK seek_frame - SIGN signature_frame - SLT synchronised_lyric - STC synced_tempo_codes - SYLT synchronised_lyric - SYTC synchronised_tempo_codes - TAL album - TALB album - TBP bpm - TBPM bpm - TCM composer - TCMP part_of_a_compilation - TCO genre - TCOM composer - TCON genre - TCOP copyright_message - TCP part_of_a_compilation - TCR copyright_message - TDA date - TDAT date - TDEN encoding_time - TDLY playlist_delay - TDOR original_release_time - TDRC recording_time - TDRL release_time - TDTG tagging_time - TDY playlist_delay - TEN encoded_by - TENC encoded_by - TEXT lyricist - TFLT file_type - TFT file_type - TIM time - TIME time - TIPL involved_people_list - TIT1 content_group_description - TIT2 title - TIT3 subtitle - TKE initial_key - TKEY initial_key - TLA language - TLAN language - TLE length - TLEN length - TMCL musician_credits_list - TMED media_type - TMOO mood - TMT media_type - TOA original_artist - TOAL original_album - TOF original_filename - TOFN original_filename - TOL original_lyricist - TOLY original_lyricist - TOPE original_artist - TOR original_year - TORY original_year - TOT original_album - TOWN file_owner - TP1 artist - TP2 band - TP3 conductor - TP4 remixer - TPA part_of_a_set - TPB publisher - TPE1 artist - TPE2 band - TPE3 conductor - TPE4 remixer - TPOS part_of_a_set - TPRO produced_notice - TPUB publisher - TRC isrc - TRCK track_number - TRD recording_dates - TRDA recording_dates - TRK track_number - TRSN internet_radio_station_name - TRSO internet_radio_station_owner - TS2 album_artist_sort_order - TSA album_sort_order - TSC composer_sort_order - TSI size - TSIZ size - TSO2 album_artist_sort_order - TSOA album_sort_order - TSOC composer_sort_order - TSOP performer_sort_order - TSOT title_sort_order - TSP performer_sort_order - TSRC isrc - TSS encoder_settings - TSSE encoder_settings - TSST set_subtitle - TST title_sort_order - TT1 description - TT2 title - TT3 subtitle - TXT lyricist - TXX text - TXXX text - TYE year - TYER year - UFI unique_file_identifier - UFID unique_file_identifier - ULT unsychronised_lyric - USER terms_of_use - USLT unsynchronised_lyric - WAF url_file - WAR url_artist - WAS url_source - WCM commercial_information - WCOM commercial_information - WCOP copyright - WCP copyright - WOAF url_file - WOAR url_artist - WOAS url_source - WORS url_station - WPAY url_payment - WPB url_publisher - WPUB url_publisher - WXX url_user - WXXX url_user - TFEA featured_artist - TSTU recording_studio - rgad replay_gain_adjustment - - */ - - return getid3_lib::EmbeddedLookup($framename, $begin, __LINE__, __FILE__, 'id3v2-framename_short'); - } - - function TextEncodingTerminatorLookup($encoding) { - // http://www.id3.org/id3v2.4.0-structure.txt - // Frames that allow different types of text encoding contains a text encoding description byte. Possible encodings: - // $00 ISO-8859-1. Terminated with $00. - // $01 UTF-16 encoded Unicode with BOM. All strings in the same frame SHALL have the same byteorder. Terminated with $00 00. - // $02 UTF-16BE encoded Unicode without BOM. Terminated with $00 00. - // $03 UTF-8 encoded Unicode. Terminated with $00. - - static $TextEncodingTerminatorLookup = array(0=>"\x00", 1=>"\x00\x00", 2=>"\x00\x00", 3=>"\x00", 255=>"\x00\x00"); - - return @$TextEncodingTerminatorLookup[$encoding]; - } - - function TextEncodingNameLookup($encoding) { - // http://www.id3.org/id3v2.4.0-structure.txt - static $TextEncodingNameLookup = array(0=>'ISO-8859-1', 1=>'UTF-16', 2=>'UTF-16BE', 3=>'UTF-8', 255=>'UTF-16BE'); - return (isset($TextEncodingNameLookup[$encoding]) ? $TextEncodingNameLookup[$encoding] : 'ISO-8859-1'); - } - - function IsValidID3v2FrameName($framename, $id3v2majorversion) { - switch ($id3v2majorversion) { - case 2: - return ereg('[A-Z][A-Z0-9]{2}', $framename); - break; - - case 3: - case 4: - return ereg('[A-Z][A-Z0-9]{3}', $framename); - break; - } - return false; - } - - function IsANumber($numberstring, $allowdecimal=false, $allownegative=false) { - for ($i = 0; $i < strlen($numberstring); $i++) { - if ((chr($numberstring{$i}) < chr('0')) || (chr($numberstring{$i}) > chr('9'))) { - if (($numberstring{$i} == '.') && $allowdecimal) { - // allowed - } elseif (($numberstring{$i} == '-') && $allownegative && ($i == 0)) { - // allowed - } else { - return false; - } - } - } - return true; - } - - function IsValidDateStampString($datestamp) { - if (strlen($datestamp) != 8) { - return false; - } - if (!$this->IsANumber($datestamp, false)) { - return false; - } - $year = substr($datestamp, 0, 4); - $month = substr($datestamp, 4, 2); - $day = substr($datestamp, 6, 2); - if (($year == 0) || ($month == 0) || ($day == 0)) { - return false; - } - if ($month > 12) { - return false; - } - if ($day > 31) { - return false; - } - if (($day > 30) && (($month == 4) || ($month == 6) || ($month == 9) || ($month == 11))) { - return false; - } - if (($day > 29) && ($month == 2)) { - return false; - } - return true; - } - - function ID3v2HeaderLength($majorversion) { - return (($majorversion == 2) ? 6 : 10); - } - -} - -?> diff --git a/getid3/module.tag.lyrics3.php b/getid3/module.tag.lyrics3.php deleted file mode 100644 index 67dba43..0000000 --- a/getid3/module.tag.lyrics3.php +++ /dev/null @@ -1,282 +0,0 @@ -<?php -///////////////////////////////////////////////////////////////// -/// getID3() by James Heinrich <info@getid3.org> // -// available at http://getid3.sourceforge.net // -// or http://www.getid3.org // -///////////////////////////////////////////////////////////////// -// See readme.txt for more details // -///////////////////////////////////////////////////////////////// -/// // -// module.tag.lyrics3.php // -// module for analyzing Lyrics3 tags // -// dependencies: module.tag.apetag.php (optional) // -// /// -///////////////////////////////////////////////////////////////// - - -class getid3_lyrics3 -{ - - function getid3_lyrics3(&$fd, &$ThisFileInfo) { - // http://www.volweb.cz/str/tags.htm - - if ($ThisFileInfo['filesize'] >= pow(2, 31)) { - $ThisFileInfo['warning'][] = 'Unable to check for Lyrics3 because file is larger than 2GB'; - return false; - } - - fseek($fd, (0 - 128 - 9 - 6), SEEK_END); // end - ID3v1 - LYRICSEND - [Lyrics3size] - $lyrics3_id3v1 = fread($fd, 128 + 9 + 6); - $lyrics3lsz = substr($lyrics3_id3v1, 0, 6); // Lyrics3size - $lyrics3end = substr($lyrics3_id3v1, 6, 9); // LYRICSEND or LYRICS200 - $id3v1tag = substr($lyrics3_id3v1, 15, 128); // ID3v1 - - if ($lyrics3end == 'LYRICSEND') { - // Lyrics3v1, ID3v1, no APE - - $lyrics3size = 5100; - $lyrics3offset = $ThisFileInfo['filesize'] - 128 - $lyrics3size; - $lyrics3version = 1; - - } elseif ($lyrics3end == 'LYRICS200') { - // Lyrics3v2, ID3v1, no APE - - // LSZ = lyrics + 'LYRICSBEGIN'; add 6-byte size field; add 'LYRICS200' - $lyrics3size = $lyrics3lsz + 6 + strlen('LYRICS200'); - $lyrics3offset = $ThisFileInfo['filesize'] - 128 - $lyrics3size; - $lyrics3version = 2; - - } elseif (substr(strrev($lyrics3_id3v1), 0, 9) == strrev('LYRICSEND')) { - // Lyrics3v1, no ID3v1, no APE - - $lyrics3size = 5100; - $lyrics3offset = $ThisFileInfo['filesize'] - $lyrics3size; - $lyrics3version = 1; - $lyrics3offset = $ThisFileInfo['filesize'] - $lyrics3size; - - } elseif (substr(strrev($lyrics3_id3v1), 0, 9) == strrev('LYRICS200')) { - - // Lyrics3v2, no ID3v1, no APE - - $lyrics3size = strrev(substr(strrev($lyrics3_id3v1), 9, 6)) + 6 + strlen('LYRICS200'); // LSZ = lyrics + 'LYRICSBEGIN'; add 6-byte size field; add 'LYRICS200' - $lyrics3offset = $ThisFileInfo['filesize'] - $lyrics3size; - $lyrics3version = 2; - - } else { - - if (isset($ThisFileInfo['ape']['tag_offset_start']) && ($ThisFileInfo['ape']['tag_offset_start'] > 15)) { - - fseek($fd, $ThisFileInfo['ape']['tag_offset_start'] - 15, SEEK_SET); - $lyrics3lsz = fread($fd, 6); - $lyrics3end = fread($fd, 9); - - if ($lyrics3end == 'LYRICSEND') { - // Lyrics3v1, APE, maybe ID3v1 - - $lyrics3size = 5100; - $lyrics3offset = $ThisFileInfo['ape']['tag_offset_start'] - $lyrics3size; - $ThisFileInfo['avdataend'] = $lyrics3offset; - $lyrics3version = 1; - $ThisFileInfo['warning'][] = 'APE tag located after Lyrics3, will probably break Lyrics3 compatability'; - - } elseif ($lyrics3end == 'LYRICS200') { - // Lyrics3v2, APE, maybe ID3v1 - - $lyrics3size = $lyrics3lsz + 6 + strlen('LYRICS200'); // LSZ = lyrics + 'LYRICSBEGIN'; add 6-byte size field; add 'LYRICS200' - $lyrics3offset = $ThisFileInfo['ape']['tag_offset_start'] - $lyrics3size; - $lyrics3version = 2; - $ThisFileInfo['warning'][] = 'APE tag located after Lyrics3, will probably break Lyrics3 compatability'; - - } - - } - - } - - if (isset($lyrics3offset)) { - $ThisFileInfo['avdataend'] = $lyrics3offset; - $this->getLyrics3Data($ThisFileInfo, $fd, $lyrics3offset, $lyrics3version, $lyrics3size); - - if (!isset($ThisFileInfo['ape'])) { - $GETID3_ERRORARRAY = &$ThisFileInfo['warning']; - if (getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.tag.apetag.php', __FILE__, false)) { - $tag = new getid3_apetag($fd, $ThisFileInfo, $ThisFileInfo['lyrics3']['tag_offset_start']); - unset($tag); - } - } - - } - - return true; - } - - function getLyrics3Data(&$ThisFileInfo, &$fd, $endoffset, $version, $length) { - // http://www.volweb.cz/str/tags.htm - - if ($endoffset >= pow(2, 31)) { - $ThisFileInfo['warning'][] = 'Unable to check for Lyrics3 because file is larger than 2GB'; - return false; - } - - fseek($fd, $endoffset, SEEK_SET); - if ($length <= 0) { - return false; - } - $rawdata = fread($fd, $length); - - if (substr($rawdata, 0, 11) != 'LYRICSBEGIN') { - if (strpos($rawdata, 'LYRICSBEGIN') !== false) { - - $ThisFileInfo['warning'][] = '"LYRICSBEGIN" expected at '.$endoffset.' but actually found at '.($endoffset + strpos($rawdata, 'LYRICSBEGIN')).' - this is invalid for Lyrics3 v'.$version; - $ThisFileInfo['avdataend'] = $endoffset + strpos($rawdata, 'LYRICSBEGIN'); - $ParsedLyrics3['tag_offset_start'] = $ThisFileInfo['avdataend']; - $rawdata = substr($rawdata, strpos($rawdata, 'LYRICSBEGIN')); - $length = strlen($rawdata); - - } else { - - $ThisFileInfo['error'][] = '"LYRICSBEGIN" expected at '.$endoffset.' but found "'.substr($rawdata, 0, 11).'" instead'; - return false; - - } - - } - - $ParsedLyrics3['raw']['lyrics3version'] = $version; - $ParsedLyrics3['raw']['lyrics3tagsize'] = $length; - $ParsedLyrics3['tag_offset_start'] = $endoffset; - $ParsedLyrics3['tag_offset_end'] = $endoffset + $length; - - switch ($version) { - - case 1: - if (substr($rawdata, strlen($rawdata) - 9, 9) == 'LYRICSEND') { - $ParsedLyrics3['raw']['LYR'] = trim(substr($rawdata, 11, strlen($rawdata) - 11 - 9)); - $this->Lyrics3LyricsTimestampParse($ParsedLyrics3); - } else { - $ThisFileInfo['error'][] = '"LYRICSEND" expected at '.(ftell($fd) - 11 + $length - 9).' but found "'.substr($rawdata, strlen($rawdata) - 9, 9).'" instead'; - return false; - } - break; - - case 2: - if (substr($rawdata, strlen($rawdata) - 9, 9) == 'LYRICS200') { - $ParsedLyrics3['raw']['unparsed'] = substr($rawdata, 11, strlen($rawdata) - 11 - 9 - 6); // LYRICSBEGIN + LYRICS200 + LSZ - $rawdata = $ParsedLyrics3['raw']['unparsed']; - while (strlen($rawdata) > 0) { - $fieldname = substr($rawdata, 0, 3); - $fieldsize = (int) substr($rawdata, 3, 5); - $ParsedLyrics3['raw'][$fieldname] = substr($rawdata, 8, $fieldsize); - $rawdata = substr($rawdata, 3 + 5 + $fieldsize); - } - - if (isset($ParsedLyrics3['raw']['IND'])) { - $i = 0; - $flagnames = array('lyrics', 'timestamps', 'inhibitrandom'); - foreach ($flagnames as $flagname) { - if (strlen($ParsedLyrics3['raw']['IND']) > $i++) { - $ParsedLyrics3['flags'][$flagname] = $this->IntString2Bool(substr($ParsedLyrics3['raw']['IND'], $i, 1 - 1)); - } - } - } - - $fieldnametranslation = array('ETT'=>'title', 'EAR'=>'artist', 'EAL'=>'album', 'INF'=>'comment', 'AUT'=>'author'); - foreach ($fieldnametranslation as $key => $value) { - if (isset($ParsedLyrics3['raw'][$key])) { - $ParsedLyrics3['comments'][$value][] = trim($ParsedLyrics3['raw'][$key]); - } - } - - if (isset($ParsedLyrics3['raw']['IMG'])) { - $imagestrings = explode("\r\n", $ParsedLyrics3['raw']['IMG']); - foreach ($imagestrings as $key => $imagestring) { - if (strpos($imagestring, '||') !== false) { - $imagearray = explode('||', $imagestring); - $ParsedLyrics3['images'][$key]['filename'] = @$imagearray[0]; - $ParsedLyrics3['images'][$key]['description'] = @$imagearray[1]; - $ParsedLyrics3['images'][$key]['timestamp'] = $this->Lyrics3Timestamp2Seconds(@$imagearray[2]); - } - } - } - if (isset($ParsedLyrics3['raw']['LYR'])) { - $this->Lyrics3LyricsTimestampParse($ParsedLyrics3); - } - } else { - $ThisFileInfo['error'][] = '"LYRICS200" expected at '.(ftell($fd) - 11 + $length - 9).' but found "'.substr($rawdata, strlen($rawdata) - 9, 9).'" instead'; - return false; - } - break; - - default: - $ThisFileInfo['error'][] = 'Cannot process Lyrics3 version '.$version.' (only v1 and v2)'; - return false; - break; - } - - - if (isset($ThisFileInfo['id3v1']['tag_offset_start']) && ($ThisFileInfo['id3v1']['tag_offset_start'] < $ParsedLyrics3['tag_offset_end'])) { - $ThisFileInfo['warning'][] = 'ID3v1 tag information ignored since it appears to be a false synch in Lyrics3 tag data'; - unset($ThisFileInfo['id3v1']); - foreach ($ThisFileInfo['warning'] as $key => $value) { - if ($value == 'Some ID3v1 fields do not use NULL characters for padding') { - unset($ThisFileInfo['warning'][$key]); - sort($ThisFileInfo['warning']); - break; - } - } - } - - $ThisFileInfo['lyrics3'] = $ParsedLyrics3; - - return true; - } - - function Lyrics3Timestamp2Seconds($rawtimestamp) { - if (ereg('^\\[([0-9]{2}):([0-9]{2})\\]$', $rawtimestamp, $regs)) { - return (int) (($regs[1] * 60) + $regs[2]); - } - return false; - } - - function Lyrics3LyricsTimestampParse(&$Lyrics3data) { - $lyricsarray = explode("\r\n", $Lyrics3data['raw']['LYR']); - foreach ($lyricsarray as $key => $lyricline) { - $regs = array(); - unset($thislinetimestamps); - while (ereg('^(\\[[0-9]{2}:[0-9]{2}\\])', $lyricline, $regs)) { - $thislinetimestamps[] = $this->Lyrics3Timestamp2Seconds($regs[0]); - $lyricline = str_replace($regs[0], '', $lyricline); - } - $notimestamplyricsarray[$key] = $lyricline; - if (isset($thislinetimestamps) && is_array($thislinetimestamps)) { - sort($thislinetimestamps); - foreach ($thislinetimestamps as $timestampkey => $timestamp) { - if (isset($Lyrics3data['synchedlyrics'][$timestamp])) { - // timestamps only have a 1-second resolution, it's possible that multiple lines - // could have the same timestamp, if so, append - $Lyrics3data['synchedlyrics'][$timestamp] .= "\r\n".$lyricline; - } else { - $Lyrics3data['synchedlyrics'][$timestamp] = $lyricline; - } - } - } - } - $Lyrics3data['unsynchedlyrics'] = implode("\r\n", $notimestamplyricsarray); - if (isset($Lyrics3data['synchedlyrics']) && is_array($Lyrics3data['synchedlyrics'])) { - ksort($Lyrics3data['synchedlyrics']); - } - return true; - } - - function IntString2Bool($char) { - if ($char == '1') { - return true; - } elseif ($char == '0') { - return false; - } - return null; - } -} - - -?>
\ No newline at end of file diff --git a/getid3/write.apetag.php b/getid3/write.apetag.php deleted file mode 100644 index 189160a..0000000 --- a/getid3/write.apetag.php +++ /dev/null @@ -1,228 +0,0 @@ -<?php -///////////////////////////////////////////////////////////////// -/// getID3() by James Heinrich <info@getid3.org> // -// available at http://getid3.sourceforge.net // -// or http://www.getid3.org // -///////////////////////////////////////////////////////////////// -// See readme.txt for more details // -///////////////////////////////////////////////////////////////// -// // -// write.apetag.php // -// module for writing APE tags // -// dependencies: module.tag.apetag.php // -// /// -///////////////////////////////////////////////////////////////// - - -getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.tag.apetag.php', __FILE__, true); - -class getid3_write_apetag -{ - - var $filename; - var $tag_data; - var $always_preserve_replaygain = true; // ReplayGain / MP3gain tags will be copied from old tag even if not passed in data - var $warnings = array(); // any non-critical errors will be stored here - var $errors = array(); // any critical errors will be stored here - - function getid3_write_apetag() { - return true; - } - - function WriteAPEtag() { - // NOTE: All data passed to this function must be UTF-8 format - - $getID3 = new getID3; - $ThisFileInfo = $getID3->analyze($this->filename); - - if (isset($ThisFileInfo['ape']['tag_offset_start']) && isset($ThisFileInfo['lyrics3']['tag_offset_end'])) { - if ($ThisFileInfo['ape']['tag_offset_start'] >= $ThisFileInfo['lyrics3']['tag_offset_end']) { - // Current APE tag between Lyrics3 and ID3v1/EOF - // This break Lyrics3 functionality - if (!$this->DeleteAPEtag()) { - return false; - } - $ThisFileInfo = $getID3->analyze($this->filename); - } - } - - if ($this->always_preserve_replaygain) { - $ReplayGainTagsToPreserve = array('mp3gain_minmax', 'mp3gain_album_minmax', 'mp3gain_undo', 'replaygain_track_peak', 'replaygain_track_gain', 'replaygain_album_peak', 'replaygain_album_gain'); - foreach ($ReplayGainTagsToPreserve as $rg_key) { - if (isset($ThisFileInfo['ape']['items'][strtolower($rg_key)]['data'][0]) && !isset($this->tag_data[strtoupper($rg_key)][0])) { - $this->tag_data[strtoupper($rg_key)][0] = $ThisFileInfo['ape']['items'][strtolower($rg_key)]['data'][0]; - } - } - } - - if ($APEtag = $this->GenerateAPEtag()) { - if ($fp = @fopen($this->filename, 'a+b')) { - $oldignoreuserabort = ignore_user_abort(true); - flock($fp, LOCK_EX); - - $PostAPEdataOffset = $ThisFileInfo['avdataend']; - if (isset($ThisFileInfo['ape']['tag_offset_end'])) { - $PostAPEdataOffset = max($PostAPEdataOffset, $ThisFileInfo['ape']['tag_offset_end']); - } - if (isset($ThisFileInfo['lyrics3']['tag_offset_start'])) { - $PostAPEdataOffset = max($PostAPEdataOffset, $ThisFileInfo['lyrics3']['tag_offset_start']); - } - fseek($fp, $PostAPEdataOffset, SEEK_SET); - $PostAPEdata = ''; - if ($ThisFileInfo['filesize'] > $PostAPEdataOffset) { - $PostAPEdata = fread($fp, $ThisFileInfo['filesize'] - $PostAPEdataOffset); - } - - fseek($fp, $PostAPEdataOffset, SEEK_SET); - if (isset($ThisFileInfo['ape']['tag_offset_start'])) { - fseek($fp, $ThisFileInfo['ape']['tag_offset_start'], SEEK_SET); - } - ftruncate($fp, ftell($fp)); - fwrite($fp, $APEtag, strlen($APEtag)); - if (!empty($PostAPEdata)) { - fwrite($fp, $PostAPEdata, strlen($PostAPEdata)); - } - flock($fp, LOCK_UN); - fclose($fp); - ignore_user_abort($oldignoreuserabort); - return true; - - } - return false; - } - return false; - } - - function DeleteAPEtag() { - $getID3 = new getID3; - $ThisFileInfo = $getID3->analyze($this->filename); - if (isset($ThisFileInfo['ape']['tag_offset_start']) && isset($ThisFileInfo['ape']['tag_offset_end'])) { - if ($fp = @fopen($this->filename, 'a+b')) { - - flock($fp, LOCK_EX); - $oldignoreuserabort = ignore_user_abort(true); - - fseek($fp, $ThisFileInfo['ape']['tag_offset_end'], SEEK_SET); - $DataAfterAPE = ''; - if ($ThisFileInfo['filesize'] > $ThisFileInfo['ape']['tag_offset_end']) { - $DataAfterAPE = fread($fp, $ThisFileInfo['filesize'] - $ThisFileInfo['ape']['tag_offset_end']); - } - - ftruncate($fp, $ThisFileInfo['ape']['tag_offset_start']); - fseek($fp, $ThisFileInfo['ape']['tag_offset_start'], SEEK_SET); - - if (!empty($DataAfterAPE)) { - fwrite($fp, $DataAfterAPE, strlen($DataAfterAPE)); - } - - flock($fp, LOCK_UN); - fclose($fp); - ignore_user_abort($oldignoreuserabort); - - return true; - - } - return false; - } - return true; - } - - - function GenerateAPEtag() { - // NOTE: All data passed to this function must be UTF-8 format - - $items = array(); - if (!is_array($this->tag_data)) { - return false; - } - foreach ($this->tag_data as $key => $arrayofvalues) { - if (!is_array($arrayofvalues)) { - return false; - } - - $valuestring = ''; - foreach ($arrayofvalues as $value) { - $valuestring .= str_replace("\x00", '', $value)."\x00"; - } - $valuestring = rtrim($valuestring, "\x00"); - - // Length of the assigned value in bytes - $tagitem = getid3_lib::LittleEndian2String(strlen($valuestring), 4); - - //$tagitem .= $this->GenerateAPEtagFlags(true, true, false, 0, false); - $tagitem .= "\x00\x00\x00\x00"; - - $tagitem .= $this->CleanAPEtagItemKey($key)."\x00"; - $tagitem .= $valuestring; - - $items[] = $tagitem; - - } - - return $this->GenerateAPEtagHeaderFooter($items, true).implode('', $items).$this->GenerateAPEtagHeaderFooter($items, false); - } - - function GenerateAPEtagHeaderFooter(&$items, $isheader=false) { - $tagdatalength = 0; - foreach ($items as $itemdata) { - $tagdatalength += strlen($itemdata); - } - - $APEheader = 'APETAGEX'; - $APEheader .= getid3_lib::LittleEndian2String(2000, 4); - $APEheader .= getid3_lib::LittleEndian2String(32 + $tagdatalength, 4); - $APEheader .= getid3_lib::LittleEndian2String(count($items), 4); - $APEheader .= $this->GenerateAPEtagFlags(true, true, $isheader, 0, false); - $APEheader .= str_repeat("\x00", 8); - - return $APEheader; - } - - function GenerateAPEtagFlags($header=true, $footer=true, $isheader=false, $encodingid=0, $readonly=false) { - $APEtagFlags = array_fill(0, 4, 0); - if ($header) { - $APEtagFlags[0] |= 0x80; // Tag contains a header - } - if (!$footer) { - $APEtagFlags[0] |= 0x40; // Tag contains no footer - } - if ($isheader) { - $APEtagFlags[0] |= 0x20; // This is the header, not the footer - } - - // 0: Item contains text information coded in UTF-8 - // 1: Item contains binary information °) - // 2: Item is a locator of external stored information °°) - // 3: reserved - $APEtagFlags[3] |= ($encodingid << 1); - - if ($readonly) { - $APEtagFlags[3] |= 0x01; // Tag or Item is Read Only - } - - return chr($APEtagFlags[3]).chr($APEtagFlags[2]).chr($APEtagFlags[1]).chr($APEtagFlags[0]); - } - - function CleanAPEtagItemKey($itemkey) { - $itemkey = eregi_replace("[^\x20-\x7E]", '', $itemkey); - - // http://www.personal.uni-jena.de/~pfk/mpp/sv8/apekey.html - switch (strtoupper($itemkey)) { - case 'EAN/UPC': - case 'ISBN': - case 'LC': - case 'ISRC': - $itemkey = strtoupper($itemkey); - break; - - default: - $itemkey = ucwords($itemkey); - break; - } - return $itemkey; - - } - -} - -?>
\ No newline at end of file diff --git a/getid3/write.id3v1.php b/getid3/write.id3v1.php deleted file mode 100644 index 3c2b7a4..0000000 --- a/getid3/write.id3v1.php +++ /dev/null @@ -1,119 +0,0 @@ -<?php -///////////////////////////////////////////////////////////////// -/// getID3() by James Heinrich <info@getid3.org> // -// available at http://getid3.sourceforge.net // -// or http://www.getid3.org // -///////////////////////////////////////////////////////////////// -// See readme.txt for more details // -///////////////////////////////////////////////////////////////// -// // -// write.id3v1.php // -// module for writing ID3v1 tags // -// dependencies: module.tag.id3v1.php // -// /// -///////////////////////////////////////////////////////////////// - -getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.tag.id3v1.php', __FILE__, true); - -class getid3_write_id3v1 -{ - var $filename; - var $tag_data; - var $warnings = array(); // any non-critical errors will be stored here - var $errors = array(); // any critical errors will be stored here - - function getid3_write_id3v1() { - return true; - } - - function WriteID3v1() { - if ((filesize($this->filename) >= (pow(2, 31) - 128)) || (filesize($this->filename) < 0)) { - $this->errors[] = 'Unable to write ID3v1 because file is larger than 2GB'; - return false; - } - - // File MUST be writeable - CHMOD(646) at least - if (is_writeable($this->filename)) { - if ($fp_source = @fopen($this->filename, 'r+b')) { - - fseek($fp_source, -128, SEEK_END); - if (fread($fp_source, 3) == 'TAG') { - fseek($fp_source, -128, SEEK_END); // overwrite existing ID3v1 tag - } else { - fseek($fp_source, 0, SEEK_END); // append new ID3v1 tag - } - $this->tag_data['track'] = (isset($this->tag_data['track']) ? $this->tag_data['track'] : (isset($this->tag_data['track_number']) ? $this->tag_data['track_number'] : (isset($this->tag_data['tracknumber']) ? $this->tag_data['tracknumber'] : ''))); - - $new_id3v1_tag_data = getid3_id3v1::GenerateID3v1Tag( - @$this->tag_data['title'], - @$this->tag_data['artist'], - @$this->tag_data['album'], - @$this->tag_data['year'], - @$this->tag_data['genreid'], - @$this->tag_data['comment'], - @$this->tag_data['track']); - fwrite($fp_source, $new_id3v1_tag_data, 128); - fclose($fp_source); - return true; - - } else { - $this->errors[] = 'Could not open '.$this->filename.' mode "r+b"'; - return false; - } - } - $this->errors[] = 'File is not writeable: '.$this->filename; - return false; - } - - function FixID3v1Padding() { - // ID3v1 data is supposed to be padded with NULL characters, but some taggers incorrectly use spaces - // This function rewrites the ID3v1 tag with correct padding - - // Initialize getID3 engine - $getID3 = new getID3; - $ThisFileInfo = $getID3->analyze($this->filename); - if ($ThisFileInfo['filesize'] >= (pow(2, 31) - 128)) { - // cannot write tags on files > 2GB - return false; - } - if (isset($ThisFileInfo['tags']['id3v1'])) { - foreach ($ThisFileInfo['tags']['id3v1'] as $key => $value) { - $id3v1data[$key] = implode(',', $value); - } - $this->tag_data = $id3v1data; - return $this->WriteID3v1(); - } - return false; - } - - function RemoveID3v1() { - if ($ThisFileInfo['filesize'] >= pow(2, 31)) { - $this->errors[] = 'Unable to write ID3v1 because file is larger than 2GB'; - return false; - } - - // File MUST be writeable - CHMOD(646) at least - if (is_writeable($this->filename)) { - if ($fp_source = @fopen($this->filename, 'r+b')) { - - fseek($fp_source, -128, SEEK_END); - if (fread($fp_source, 3) == 'TAG') { - ftruncate($fp_source, filesize($this->filename) - 128); - } else { - // no ID3v1 tag to begin with - do nothing - } - fclose($fp_source); - return true; - - } else { - $this->errors[] = 'Could not open '.$this->filename.' mode "r+b"'; - } - } else { - $this->errors[] = $this->filename.' is not writeable'; - } - return false; - } - -} - -?>
\ No newline at end of file diff --git a/getid3/write.id3v2.php b/getid3/write.id3v2.php deleted file mode 100644 index 9447486..0000000 --- a/getid3/write.id3v2.php +++ /dev/null @@ -1,2054 +0,0 @@ -<?php -///////////////////////////////////////////////////////////////// -/// getID3() by James Heinrich <info@getid3.org> // -// available at http://getid3.sourceforge.net // -// or http://www.getid3.org // -///////////////////////////////////////////////////////////////// -// See readme.txt for more details // -///////////////////////////////////////////////////////////////// -/// // -// write.id3v2.php // -// module for writing ID3v2 tags // -// dependencies: module.tag.id3v2.php // -// /// -///////////////////////////////////////////////////////////////// - -getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.tag.id3v2.php', __FILE__, true); - -class getid3_write_id3v2 -{ - var $filename; - var $tag_data; - var $paddedlength = 4096; // minimum length of ID3v2 tag in bytes - var $majorversion = 3; // ID3v2 major version (2, 3 (recommended), 4) - var $minorversion = 0; // ID3v2 minor version - always 0 - var $merge_existing_data = false; // if true, merge new data with existing tags; if false, delete old tag data and only write new tags - var $id3v2_default_encodingid = 0; // default text encoding (ISO-8859-1) if not explicitly passed - var $id3v2_use_unsynchronisation = false; // the specs say it should be TRUE, but most other ID3v2-aware programs are broken if unsynchronization is used, so by default don't use it. - var $warnings = array(); // any non-critical errors will be stored here - var $errors = array(); // any critical errors will be stored here - - function getid3_write_id3v2() { - return true; - } - - function WriteID3v2() { - // File MUST be writeable - CHMOD(646) at least. It's best if the - // directory is also writeable, because that method is both faster and less susceptible to errors. - - if (is_writeable($this->filename) || (!file_exists($this->filename) && is_writeable(dirname($this->filename)))) { - // Initialize getID3 engine - $getID3 = new getID3; - $OldThisFileInfo = $getID3->analyze($this->filename); - if ($OldThisFileInfo['filesize'] >= pow(2, 31)) { - $this->errors[] = 'Unable to write ID3v2 because file is larger than 2GB'; - fclose($fp_source); - return false; - } - if ($this->merge_existing_data) { - // merge with existing data - if (!empty($OldThisFileInfo['id3v2'])) { - $this->tag_data = $this->array_join_merge($OldThisFileInfo['id3v2'], $this->tag_data); - } - } - $this->paddedlength = max(@$OldThisFileInfo['id3v2']['headerlength'], $this->paddedlength); - - if ($NewID3v2Tag = $this->GenerateID3v2Tag()) { - - if (file_exists($this->filename) && is_writeable($this->filename) && isset($OldThisFileInfo['id3v2']['headerlength']) && ($OldThisFileInfo['id3v2']['headerlength'] == strlen($NewID3v2Tag))) { - - // best and fastest method - insert-overwrite existing tag (padded to length of old tag if neccesary) - if (file_exists($this->filename)) { - - ob_start(); - if ($fp = fopen($this->filename, 'r+b')) { - rewind($fp); - fwrite($fp, $NewID3v2Tag, strlen($NewID3v2Tag)); - fclose($fp); - } else { - $this->errors[] = 'Could not open '.$this->filename.' mode "r+b" - '.strip_tags(ob_get_contents()); - } - ob_end_clean(); - - } else { - - ob_start(); - if ($fp = fopen($this->filename, 'wb')) { - rewind($fp); - fwrite($fp, $NewID3v2Tag, strlen($NewID3v2Tag)); - fclose($fp); - } else { - $this->errors[] = 'Could not open '.$this->filename.' mode "wb" - '.strip_tags(ob_get_contents()); - } - ob_end_clean(); - - } - - } else { - - if ($tempfilename = tempnam('*', 'getID3')) { - ob_start(); - if ($fp_source = fopen($this->filename, 'rb')) { - if ($fp_temp = fopen($tempfilename, 'wb')) { - - fwrite($fp_temp, $NewID3v2Tag, strlen($NewID3v2Tag)); - - rewind($fp_source); - if (!empty($OldThisFileInfo['avdataoffset'])) { - fseek($fp_source, $OldThisFileInfo['avdataoffset'], SEEK_SET); - } - - while ($buffer = fread($fp_source, GETID3_FREAD_BUFFER_SIZE)) { - fwrite($fp_temp, $buffer, strlen($buffer)); - } - - fclose($fp_temp); - fclose($fp_source); - copy($tempfilename, $this->filename); - unlink($tempfilename); - ob_end_clean(); - return true; - - } else { - - $this->errors[] = 'Could not open '.$tempfilename.' mode "wb" - '.strip_tags(ob_get_contents()); - - } - fclose($fp_source); - - } else { - - $this->errors[] = 'Could not open '.$this->filename.' mode "rb" - '.strip_tags(ob_get_contents()); - - } - ob_end_clean(); - } - return false; - - } - - } else { - - $this->errors[] = '$this->GenerateID3v2Tag() failed'; - - } - - if (!empty($this->errors)) { - return false; - } - return true; - } else { - $this->errors[] = '!is_writeable('.$this->filename.')'; - } - return false; - } - - function RemoveID3v2() { - // File MUST be writeable - CHMOD(646) at least. It's best if the - // directory is also writeable, because that method is both faster and less susceptible to errors. - if (is_writeable(dirname($this->filename))) { - - // preferred method - only one copying operation, minimal chance of corrupting - // original file if script is interrupted, but required directory to be writeable - if ($fp_source = @fopen($this->filename, 'rb')) { - // Initialize getID3 engine - $getID3 = new getID3; - $OldThisFileInfo = $getID3->analyze($this->filename); - if ($OldThisFileInfo['filesize'] >= pow(2, 31)) { - $this->errors[] = 'Unable to remove ID3v2 because file is larger than 2GB'; - fclose($fp_source); - return false; - } - rewind($fp_source); - if ($OldThisFileInfo['avdataoffset'] !== false) { - fseek($fp_source, $OldThisFileInfo['avdataoffset'], SEEK_SET); - } - if ($fp_temp = @fopen($this->filename.'getid3tmp', 'w+b')) { - while ($buffer = fread($fp_source, GETID3_FREAD_BUFFER_SIZE)) { - fwrite($fp_temp, $buffer, strlen($buffer)); - } - fclose($fp_temp); - } else { - $this->errors[] = 'Could not open '.$this->filename.'getid3tmp mode "w+b"'; - } - fclose($fp_source); - } else { - $this->errors[] = 'Could not open '.$this->filename.' mode "rb"'; - } - if (file_exists($this->filename)) { - unlink($this->filename); - } - rename($this->filename.'getid3tmp', $this->filename); - - } elseif (is_writable($this->filename)) { - - // less desirable alternate method - double-copies the file, overwrites original file - // and could corrupt source file if the script is interrupted or an error occurs. - if ($fp_source = @fopen($this->filename, 'rb')) { - // Initialize getID3 engine - $getID3 = new getID3; - $OldThisFileInfo = $getID3->analyze($this->filename); - if ($OldThisFileInfo['filesize'] >= pow(2, 31)) { - $this->errors[] = 'Unable to remove ID3v2 because file is larger than 2GB'; - fclose($fp_source); - return false; - } - rewind($fp_source); - if ($OldThisFileInfo['avdataoffset'] !== false) { - fseek($fp_source, $OldThisFileInfo['avdataoffset'], SEEK_SET); - } - if ($fp_temp = tmpfile()) { - while ($buffer = fread($fp_source, GETID3_FREAD_BUFFER_SIZE)) { - fwrite($fp_temp, $buffer, strlen($buffer)); - } - fclose($fp_source); - if ($fp_source = @fopen($this->filename, 'wb')) { - rewind($fp_temp); - while ($buffer = fread($fp_temp, GETID3_FREAD_BUFFER_SIZE)) { - fwrite($fp_source, $buffer, strlen($buffer)); - } - fseek($fp_temp, -128, SEEK_END); - fclose($fp_source); - } else { - $this->errors[] = 'Could not open '.$this->filename.' mode "wb"'; - } - fclose($fp_temp); - } else { - $this->errors[] = 'Could not create tmpfile()'; - } - } else { - $this->errors[] = 'Could not open '.$this->filename.' mode "rb"'; - } - - } else { - - $this->errors[] = 'Directory and file both not writeable'; - - } - - if (!empty($this->errors)) { - return false; - } - return true; - } - - - function GenerateID3v2TagFlags($flags) { - switch ($this->majorversion) { - case 4: - // %abcd0000 - $flag = (@$flags['unsynchronisation'] ? '1' : '0'); // a - Unsynchronisation - $flag .= (@$flags['extendedheader'] ? '1' : '0'); // b - Extended header - $flag .= (@$flags['experimental'] ? '1' : '0'); // c - Experimental indicator - $flag .= (@$flags['footer'] ? '1' : '0'); // d - Footer present - $flag .= '0000'; - break; - - case 3: - // %abc00000 - $flag = (@$flags['unsynchronisation'] ? '1' : '0'); // a - Unsynchronisation - $flag .= (@$flags['extendedheader'] ? '1' : '0'); // b - Extended header - $flag .= (@$flags['experimental'] ? '1' : '0'); // c - Experimental indicator - $flag .= '00000'; - break; - - case 2: - // %ab000000 - $flag = (@$flags['unsynchronisation'] ? '1' : '0'); // a - Unsynchronisation - $flag .= (@$flags['compression'] ? '1' : '0'); // b - Compression - $flag .= '000000'; - break; - - default: - return false; - break; - } - return chr(bindec($flag)); - } - - - function GenerateID3v2FrameFlags($TagAlter=false, $FileAlter=false, $ReadOnly=false, $Compression=false, $Encryption=false, $GroupingIdentity=false, $Unsynchronisation=false, $DataLengthIndicator=false) { - switch ($this->majorversion) { - case 4: - // %0abc0000 %0h00kmnp - $flag1 = '0'; - $flag1 .= $TagAlter ? '1' : '0'; // a - Tag alter preservation (true == discard) - $flag1 .= $FileAlter ? '1' : '0'; // b - File alter preservation (true == discard) - $flag1 .= $ReadOnly ? '1' : '0'; // c - Read only (true == read only) - $flag1 .= '0000'; - - $flag2 = '0'; - $flag2 .= $GroupingIdentity ? '1' : '0'; // h - Grouping identity (true == contains group information) - $flag2 .= '00'; - $flag2 .= $Compression ? '1' : '0'; // k - Compression (true == compressed) - $flag2 .= $Encryption ? '1' : '0'; // m - Encryption (true == encrypted) - $flag2 .= $Unsynchronisation ? '1' : '0'; // n - Unsynchronisation (true == unsynchronised) - $flag2 .= $DataLengthIndicator ? '1' : '0'; // p - Data length indicator (true == data length indicator added) - break; - - case 3: - // %abc00000 %ijk00000 - $flag1 = $TagAlter ? '1' : '0'; // a - Tag alter preservation (true == discard) - $flag1 .= $FileAlter ? '1' : '0'; // b - File alter preservation (true == discard) - $flag1 .= $ReadOnly ? '1' : '0'; // c - Read only (true == read only) - $flag1 .= '00000'; - - $flag2 = $Compression ? '1' : '0'; // i - Compression (true == compressed) - $flag2 .= $Encryption ? '1' : '0'; // j - Encryption (true == encrypted) - $flag2 .= $GroupingIdentity ? '1' : '0'; // k - Grouping identity (true == contains group information) - $flag2 .= '00000'; - break; - - default: - return false; - break; - - } - return chr(bindec($flag1)).chr(bindec($flag2)); - } - - function GenerateID3v2FrameData($frame_name, $source_data_array) { - if (!getid3_id3v2::IsValidID3v2FrameName($frame_name, $this->majorversion)) { - return false; - } - $framedata = ''; - - if (($this->majorversion < 3) || ($this->majorversion > 4)) { - - $this->errors[] = 'Only ID3v2.3 and ID3v2.4 are supported in GenerateID3v2FrameData()'; - - } else { // $this->majorversion 3 or 4 - - switch ($frame_name) { - case 'UFID': - // 4.1 UFID Unique file identifier - // Owner identifier <text string> $00 - // Identifier <up to 64 bytes binary data> - if (strlen($source_data_array['data']) > 64) { - $this->errors[] = 'Identifier not allowed to be longer than 64 bytes in '.$frame_name.' (supplied data was '.strlen($source_data_array['data']).' bytes long)'; - } else { - $framedata .= str_replace("\x00", '', $source_data_array['ownerid'])."\x00"; - $framedata .= substr($source_data_array['data'], 0, 64); // max 64 bytes - truncate anything longer - } - break; - - case 'TXXX': - // 4.2.2 TXXX User defined text information frame - // Text encoding $xx - // Description <text string according to encoding> $00 (00) - // Value <text string according to encoding> - $source_data_array['encodingid'] = (isset($source_data_array['encodingid']) ? $source_data_array['encodingid'] : $this->id3v2_default_encodingid); - if (!$this->ID3v2IsValidTextEncoding($source_data_array['encodingid'], $this->majorversion)) { - $this->errors[] = 'Invalid Text Encoding in '.$frame_name.' ('.$source_data_array['encodingid'].') for ID3v2.'.$this->majorversion; - } else { - $framedata .= chr($source_data_array['encodingid']); - $framedata .= $source_data_array['description'].getid3_id3v2::TextEncodingTerminatorLookup($source_data_array['encodingid']); - $framedata .= $source_data_array['data']; - } - break; - - case 'WXXX': - // 4.3.2 WXXX User defined URL link frame - // Text encoding $xx - // Description <text string according to encoding> $00 (00) - // URL <text string> - $source_data_array['encodingid'] = (isset($source_data_array['encodingid']) ? $source_data_array['encodingid'] : $this->id3v2_default_encodingid); - if (!$this->ID3v2IsValidTextEncoding($source_data_array['encodingid'], $this->majorversion)) { - $this->errors[] = 'Invalid Text Encoding in '.$frame_name.' ('.$source_data_array['encodingid'].') for ID3v2.'.$this->majorversion; - } elseif (!isset($source_data_array['data']) || !$this->IsValidURL($source_data_array['data'], false, false)) { - //$this->errors[] = 'Invalid URL in '.$frame_name.' ('.$source_data_array['data'].')'; - // probably should be an error, need to rewrite IsValidURL() to handle other encodings - $this->warnings[] = 'Invalid URL in '.$frame_name.' ('.$source_data_array['data'].')'; - } else { - $framedata .= chr($source_data_array['encodingid']); - $framedata .= $source_data_array['description'].getid3_id3v2::TextEncodingTerminatorLookup($source_data_array['encodingid']); - $framedata .= $source_data_array['data']; - } - break; - - case 'IPLS': - // 4.4 IPLS Involved people list (ID3v2.3 only) - // Text encoding $xx - // People list strings <textstrings> - $source_data_array['encodingid'] = (isset($source_data_array['encodingid']) ? $source_data_array['encodingid'] : $this->id3v2_default_encodingid); - if (!$this->ID3v2IsValidTextEncoding($source_data_array['encodingid'], $this->majorversion)) { - $this->errors[] = 'Invalid Text Encoding in '.$frame_name.' ('.$source_data_array['encodingid'].') for ID3v2.'.$this->majorversion; - } else { - $framedata .= chr($source_data_array['encodingid']); - $framedata .= $source_data_array['data']; - } - break; - - case 'MCDI': - // 4.4 MCDI Music CD identifier - // CD TOC <binary data> - $framedata .= $source_data_array['data']; - break; - - case 'ETCO': - // 4.5 ETCO Event timing codes - // Time stamp format $xx - // Where time stamp format is: - // $01 (32-bit value) MPEG frames from beginning of file - // $02 (32-bit value) milliseconds from beginning of file - // Followed by a list of key events in the following format: - // Type of event $xx - // Time stamp $xx (xx ...) - // The 'Time stamp' is set to zero if directly at the beginning of the sound - // or after the previous event. All events MUST be sorted in chronological order. - if (($source_data_array['timestampformat'] > 2) || ($source_data_array['timestampformat'] < 1)) { - $this->errors[] = 'Invalid Time Stamp Format byte in '.$frame_name.' ('.$source_data_array['timestampformat'].')'; - } else { - $framedata .= chr($source_data_array['timestampformat']); - foreach ($source_data_array as $key => $val) { - if (!$this->ID3v2IsValidETCOevent($val['typeid'])) { - $this->errors[] = 'Invalid Event Type byte in '.$frame_name.' ('.$val['typeid'].')'; - } elseif (($key != 'timestampformat') && ($key != 'flags')) { - if (($val['timestamp'] > 0) && ($previousETCOtimestamp >= $val['timestamp'])) { - // The 'Time stamp' is set to zero if directly at the beginning of the sound - // or after the previous event. All events MUST be sorted in chronological order. - $this->errors[] = 'Out-of-order timestamp in '.$frame_name.' ('.$val['timestamp'].') for Event Type ('.$val['typeid'].')'; - } else { - $framedata .= chr($val['typeid']); - $framedata .= getid3_lib::BigEndian2String($val['timestamp'], 4, false); - } - } - } - } - break; - - case 'MLLT': - // 4.6 MLLT MPEG location lookup table - // MPEG frames between reference $xx xx - // Bytes between reference $xx xx xx - // Milliseconds between reference $xx xx xx - // Bits for bytes deviation $xx - // Bits for milliseconds dev. $xx - // Then for every reference the following data is included; - // Deviation in bytes %xxx.... - // Deviation in milliseconds %xxx.... - if (($source_data_array['framesbetweenreferences'] > 0) && ($source_data_array['framesbetweenreferences'] <= 65535)) { - $framedata .= getid3_lib::BigEndian2String($source_data_array['framesbetweenreferences'], 2, false); - } else { - $this->errors[] = 'Invalid MPEG Frames Between References in '.$frame_name.' ('.$source_data_array['framesbetweenreferences'].')'; - } - if (($source_data_array['bytesbetweenreferences'] > 0) && ($source_data_array['bytesbetweenreferences'] <= 16777215)) { - $framedata .= getid3_lib::BigEndian2String($source_data_array['bytesbetweenreferences'], 3, false); - } else { - $this->errors[] = 'Invalid bytes Between References in '.$frame_name.' ('.$source_data_array['bytesbetweenreferences'].')'; - } - if (($source_data_array['msbetweenreferences'] > 0) && ($source_data_array['msbetweenreferences'] <= 16777215)) { - $framedata .= getid3_lib::BigEndian2String($source_data_array['msbetweenreferences'], 3, false); - } else { - $this->errors[] = 'Invalid Milliseconds Between References in '.$frame_name.' ('.$source_data_array['msbetweenreferences'].')'; - } - if (!$this->IsWithinBitRange($source_data_array['bitsforbytesdeviation'], 8, false)) { - if (($source_data_array['bitsforbytesdeviation'] % 4) == 0) { - $framedata .= chr($source_data_array['bitsforbytesdeviation']); - } else { - $this->errors[] = 'Bits For Bytes Deviation in '.$frame_name.' ('.$source_data_array['bitsforbytesdeviation'].') must be a multiple of 4.'; - } - } else { - $this->errors[] = 'Invalid Bits For Bytes Deviation in '.$frame_name.' ('.$source_data_array['bitsforbytesdeviation'].')'; - } - if (!$this->IsWithinBitRange($source_data_array['bitsformsdeviation'], 8, false)) { - if (($source_data_array['bitsformsdeviation'] % 4) == 0) { - $framedata .= chr($source_data_array['bitsformsdeviation']); - } else { - $this->errors[] = 'Bits For Milliseconds Deviation in '.$frame_name.' ('.$source_data_array['bitsforbytesdeviation'].') must be a multiple of 4.'; - } - } else { - $this->errors[] = 'Invalid Bits For Milliseconds Deviation in '.$frame_name.' ('.$source_data_array['bitsformsdeviation'].')'; - } - foreach ($source_data_array as $key => $val) { - if (($key != 'framesbetweenreferences') && ($key != 'bytesbetweenreferences') && ($key != 'msbetweenreferences') && ($key != 'bitsforbytesdeviation') && ($key != 'bitsformsdeviation') && ($key != 'flags')) { - $unwrittenbitstream .= str_pad(getid3_lib::Dec2Bin($val['bytedeviation']), $source_data_array['bitsforbytesdeviation'], '0', STR_PAD_LEFT); - $unwrittenbitstream .= str_pad(getid3_lib::Dec2Bin($val['msdeviation']), $source_data_array['bitsformsdeviation'], '0', STR_PAD_LEFT); - } - } - for ($i = 0; $i < strlen($unwrittenbitstream); $i += 8) { - $highnibble = bindec(substr($unwrittenbitstream, $i, 4)) << 4; - $lownibble = bindec(substr($unwrittenbitstream, $i + 4, 4)); - $framedata .= chr($highnibble & $lownibble); - } - break; - - case 'SYTC': - // 4.7 SYTC Synchronised tempo codes - // Time stamp format $xx - // Tempo data <binary data> - // Where time stamp format is: - // $01 (32-bit value) MPEG frames from beginning of file - // $02 (32-bit value) milliseconds from beginning of file - if (($source_data_array['timestampformat'] > 2) || ($source_data_array['timestampformat'] < 1)) { - $this->errors[] = 'Invalid Time Stamp Format byte in '.$frame_name.' ('.$source_data_array['timestampformat'].')'; - } else { - $framedata .= chr($source_data_array['timestampformat']); - foreach ($source_data_array as $key => $val) { - if (!$this->ID3v2IsValidETCOevent($val['typeid'])) { - $this->errors[] = 'Invalid Event Type byte in '.$frame_name.' ('.$val['typeid'].')'; - } elseif (($key != 'timestampformat') && ($key != 'flags')) { - if (($val['tempo'] < 0) || ($val['tempo'] > 510)) { - $this->errors[] = 'Invalid Tempo (max = 510) in '.$frame_name.' ('.$val['tempo'].') at timestamp ('.$val['timestamp'].')'; - } else { - if ($val['tempo'] > 255) { - $framedata .= chr(255); - $val['tempo'] -= 255; - } - $framedata .= chr($val['tempo']); - $framedata .= getid3_lib::BigEndian2String($val['timestamp'], 4, false); - } - } - } - } - break; - - case 'USLT': - // 4.8 USLT Unsynchronised lyric/text transcription - // Text encoding $xx - // Language $xx xx xx - // Content descriptor <text string according to encoding> $00 (00) - // Lyrics/text <full text string according to encoding> - $source_data_array['encodingid'] = (isset($source_data_array['encodingid']) ? $source_data_array['encodingid'] : $this->id3v2_default_encodingid); - if (!$this->ID3v2IsValidTextEncoding($source_data_array['encodingid'])) { - $this->errors[] = 'Invalid Text Encoding in '.$frame_name.' ('.$source_data_array['encodingid'].') for ID3v2.'.$this->majorversion; - } elseif (getid3_id3v2::LanguageLookup($source_data_array['language'], true) == '') { - $this->errors[] = 'Invalid Language in '.$frame_name.' ('.$source_data_array['language'].')'; - } else { - $framedata .= chr($source_data_array['encodingid']); - $framedata .= strtolower($source_data_array['language']); - $framedata .= $source_data_array['description'].getid3_id3v2::TextEncodingTerminatorLookup($source_data_array['encodingid']); - $framedata .= $source_data_array['data']; - } - break; - - case 'SYLT': - // 4.9 SYLT Synchronised lyric/text - // Text encoding $xx - // Language $xx xx xx - // Time stamp format $xx - // $01 (32-bit value) MPEG frames from beginning of file - // $02 (32-bit value) milliseconds from beginning of file - // Content type $xx - // Content descriptor <text string according to encoding> $00 (00) - // Terminated text to be synced (typically a syllable) - // Sync identifier (terminator to above string) $00 (00) - // Time stamp $xx (xx ...) - $source_data_array['encodingid'] = (isset($source_data_array['encodingid']) ? $source_data_array['encodingid'] : $this->id3v2_default_encodingid); - if (!$this->ID3v2IsValidTextEncoding($source_data_array['encodingid'])) { - $this->errors[] = 'Invalid Text Encoding in '.$frame_name.' ('.$source_data_array['encodingid'].') for ID3v2.'.$this->majorversion; - } elseif (getid3_id3v2::LanguageLookup($source_data_array['language'], true) == '') { - $this->errors[] = 'Invalid Language in '.$frame_name.' ('.$source_data_array['language'].')'; - } elseif (($source_data_array['timestampformat'] > 2) || ($source_data_array['timestampformat'] < 1)) { - $this->errors[] = 'Invalid Time Stamp Format byte in '.$frame_name.' ('.$source_data_array['timestampformat'].')'; - } elseif (!$this->ID3v2IsValidSYLTtype($source_data_array['contenttypeid'])) { - $this->errors[] = 'Invalid Content Type byte in '.$frame_name.' ('.$source_data_array['contenttypeid'].')'; - } elseif (!is_array($source_data_array['data'])) { - $this->errors[] = 'Invalid Lyric/Timestamp data in '.$frame_name.' (must be an array)'; - } else { - $framedata .= chr($source_data_array['encodingid']); - $framedata .= strtolower($source_data_array['language']); - $framedata .= chr($source_data_array['timestampformat']); - $framedata .= chr($source_data_array['contenttypeid']); - $framedata .= $source_data_array['description'].getid3_id3v2::TextEncodingTerminatorLookup($source_data_array['encodingid']); - ksort($source_data_array['data']); - foreach ($source_data_array['data'] as $key => $val) { - $framedata .= $val['data'].getid3_id3v2::TextEncodingTerminatorLookup($source_data_array['encodingid']); - $framedata .= getid3_lib::BigEndian2String($val['timestamp'], 4, false); - } - } - break; - - case 'COMM': - // 4.10 COMM Comments - // Text encoding $xx - // Language $xx xx xx - // Short content descrip. <text string according to encoding> $00 (00) - // The actual text <full text string according to encoding> - $source_data_array['encodingid'] = (isset($source_data_array['encodingid']) ? $source_data_array['encodingid'] : $this->id3v2_default_encodingid); - if (!$this->ID3v2IsValidTextEncoding($source_data_array['encodingid'])) { - $this->errors[] = 'Invalid Text Encoding in '.$frame_name.' ('.$source_data_array['encodingid'].') for ID3v2.'.$this->majorversion; - } elseif (getid3_id3v2::LanguageLookup($source_data_array['language'], true) == '') { - $this->errors[] = 'Invalid Language in '.$frame_name.' ('.$source_data_array['language'].')'; - } else { - $framedata .= chr($source_data_array['encodingid']); - $framedata .= strtolower($source_data_array['language']); - $framedata .= $source_data_array['description'].getid3_id3v2::TextEncodingTerminatorLookup($source_data_array['encodingid']); - $framedata .= $source_data_array['data']; - } - break; - - case 'RVA2': - // 4.11 RVA2 Relative volume adjustment (2) (ID3v2.4+ only) - // Identification <text string> $00 - // The 'identification' string is used to identify the situation and/or - // device where this adjustment should apply. The following is then - // repeated for every channel: - // Type of channel $xx - // Volume adjustment $xx xx - // Bits representing peak $xx - // Peak volume $xx (xx ...) - $framedata .= str_replace("\x00", '', $source_data_array['description'])."\x00"; - foreach ($source_data_array as $key => $val) { - if ($key != 'description') { - $framedata .= chr($val['channeltypeid']); - $framedata .= getid3_lib::BigEndian2String($val['volumeadjust'], 2, false, true); // signed 16-bit - if (!$this->IsWithinBitRange($source_data_array['bitspeakvolume'], 8, false)) { - $framedata .= chr($val['bitspeakvolume']); - if ($val['bitspeakvolume'] > 0) { - $framedata .= getid3_lib::BigEndian2String($val['peakvolume'], ceil($val['bitspeakvolume'] / 8), false, false); - } - } else { - $this->errors[] = 'Invalid Bits Representing Peak Volume in '.$frame_name.' ('.$val['bitspeakvolume'].') (range = 0 to 255)'; - } - } - } - break; - - case 'RVAD': - // 4.12 RVAD Relative volume adjustment (ID3v2.3 only) - // Increment/decrement %00fedcba - // Bits used for volume descr. $xx - // Relative volume change, right $xx xx (xx ...) // a - // Relative volume change, left $xx xx (xx ...) // b - // Peak volume right $xx xx (xx ...) - // Peak volume left $xx xx (xx ...) - // Relative volume change, right back $xx xx (xx ...) // c - // Relative volume change, left back $xx xx (xx ...) // d - // Peak volume right back $xx xx (xx ...) - // Peak volume left back $xx xx (xx ...) - // Relative volume change, center $xx xx (xx ...) // e - // Peak volume center $xx xx (xx ...) - // Relative volume change, bass $xx xx (xx ...) // f - // Peak volume bass $xx xx (xx ...) - if (!$this->IsWithinBitRange($source_data_array['bitsvolume'], 8, false)) { - $this->errors[] = 'Invalid Bits For Volume Description byte in '.$frame_name.' ('.$source_data_array['bitsvolume'].') (range = 1 to 255)'; - } else { - $incdecflag .= '00'; - $incdecflag .= $source_data_array['incdec']['right'] ? '1' : '0'; // a - Relative volume change, right - $incdecflag .= $source_data_array['incdec']['left'] ? '1' : '0'; // b - Relative volume change, left - $incdecflag .= $source_data_array['incdec']['rightrear'] ? '1' : '0'; // c - Relative volume change, right back - $incdecflag .= $source_data_array['incdec']['leftrear'] ? '1' : '0'; // d - Relative volume change, left back - $incdecflag .= $source_data_array['incdec']['center'] ? '1' : '0'; // e - Relative volume change, center - $incdecflag .= $source_data_array['incdec']['bass'] ? '1' : '0'; // f - Relative volume change, bass - $framedata .= chr(bindec($incdecflag)); - $framedata .= chr($source_data_array['bitsvolume']); - $framedata .= getid3_lib::BigEndian2String($source_data_array['volumechange']['right'], ceil($source_data_array['bitsvolume'] / 8), false); - $framedata .= getid3_lib::BigEndian2String($source_data_array['volumechange']['left'], ceil($source_data_array['bitsvolume'] / 8), false); - $framedata .= getid3_lib::BigEndian2String($source_data_array['peakvolume']['right'], ceil($source_data_array['bitsvolume'] / 8), false); - $framedata .= getid3_lib::BigEndian2String($source_data_array['peakvolume']['left'], ceil($source_data_array['bitsvolume'] / 8), false); - if ($source_data_array['volumechange']['rightrear'] || $source_data_array['volumechange']['leftrear'] || - $source_data_array['peakvolume']['rightrear'] || $source_data_array['peakvolume']['leftrear'] || - $source_data_array['volumechange']['center'] || $source_data_array['peakvolume']['center'] || - $source_data_array['volumechange']['bass'] || $source_data_array['peakvolume']['bass']) { - $framedata .= getid3_lib::BigEndian2String($source_data_array['volumechange']['rightrear'], ceil($source_data_array['bitsvolume']/8), false); - $framedata .= getid3_lib::BigEndian2String($source_data_array['volumechange']['leftrear'], ceil($source_data_array['bitsvolume']/8), false); - $framedata .= getid3_lib::BigEndian2String($source_data_array['peakvolume']['rightrear'], ceil($source_data_array['bitsvolume']/8), false); - $framedata .= getid3_lib::BigEndian2String($source_data_array['peakvolume']['leftrear'], ceil($source_data_array['bitsvolume']/8), false); - } - if ($source_data_array['volumechange']['center'] || $source_data_array['peakvolume']['center'] || - $source_data_array['volumechange']['bass'] || $source_data_array['peakvolume']['bass']) { - $framedata .= getid3_lib::BigEndian2String($source_data_array['volumechange']['center'], ceil($source_data_array['bitsvolume']/8), false); - $framedata .= getid3_lib::BigEndian2String($source_data_array['peakvolume']['center'], ceil($source_data_array['bitsvolume']/8), false); - } - if ($source_data_array['volumechange']['bass'] || $source_data_array['peakvolume']['bass']) { - $framedata .= getid3_lib::BigEndian2String($source_data_array['volumechange']['bass'], ceil($source_data_array['bitsvolume']/8), false); - $framedata .= getid3_lib::BigEndian2String($source_data_array['peakvolume']['bass'], ceil($source_data_array['bitsvolume']/8), false); - } - } - break; - - case 'EQU2': - // 4.12 EQU2 Equalisation (2) (ID3v2.4+ only) - // Interpolation method $xx - // $00 Band - // $01 Linear - // Identification <text string> $00 - // The following is then repeated for every adjustment point - // Frequency $xx xx - // Volume adjustment $xx xx - if (($source_data_array['interpolationmethod'] < 0) || ($source_data_array['interpolationmethod'] > 1)) { - $this->errors[] = 'Invalid Interpolation Method byte in '.$frame_name.' ('.$source_data_array['interpolationmethod'].') (valid = 0 or 1)'; - } else { - $framedata .= chr($source_data_array['interpolationmethod']); - $framedata .= str_replace("\x00", '', $source_data_array['description'])."\x00"; - foreach ($source_data_array['data'] as $key => $val) { - $framedata .= getid3_lib::BigEndian2String(intval(round($key * 2)), 2, false); - $framedata .= getid3_lib::BigEndian2String($val, 2, false, true); // signed 16-bit - } - } - break; - - case 'EQUA': - // 4.12 EQUA Equalisation (ID3v2.3 only) - // Adjustment bits $xx - // This is followed by 2 bytes + ('adjustment bits' rounded up to the - // nearest byte) for every equalisation band in the following format, - // giving a frequency range of 0 - 32767Hz: - // Increment/decrement %x (MSB of the Frequency) - // Frequency (lower 15 bits) - // Adjustment $xx (xx ...) - if (!$this->IsWithinBitRange($source_data_array['bitsvolume'], 8, false)) { - $this->errors[] = 'Invalid Adjustment Bits byte in '.$frame_name.' ('.$source_data_array['bitsvolume'].') (range = 1 to 255)'; - } else { - $framedata .= chr($source_data_array['adjustmentbits']); - foreach ($source_data_array as $key => $val) { - if ($key != 'bitsvolume') { - if (($key > 32767) || ($key < 0)) { - $this->errors[] = 'Invalid Frequency in '.$frame_name.' ('.$key.') (range = 0 to 32767)'; - } else { - if ($val >= 0) { - // put MSB of frequency to 1 if increment, 0 if decrement - $key |= 0x8000; - } - $framedata .= getid3_lib::BigEndian2String($key, 2, false); - $framedata .= getid3_lib::BigEndian2String($val, ceil($source_data_array['adjustmentbits'] / 8), false); - } - } - } - } - break; - - case 'RVRB': - // 4.13 RVRB Reverb - // Reverb left (ms) $xx xx - // Reverb right (ms) $xx xx - // Reverb bounces, left $xx - // Reverb bounces, right $xx - // Reverb feedback, left to left $xx - // Reverb feedback, left to right $xx - // Reverb feedback, right to right $xx - // Reverb feedback, right to left $xx - // Premix left to right $xx - // Premix right to left $xx - if (!$this->IsWithinBitRange($source_data_array['left'], 16, false)) { - $this->errors[] = 'Invalid Reverb Left in '.$frame_name.' ('.$source_data_array['left'].') (range = 0 to 65535)'; - } elseif (!$this->IsWithinBitRange($source_data_array['right'], 16, false)) { - $this->errors[] = 'Invalid Reverb Left in '.$frame_name.' ('.$source_data_array['right'].') (range = 0 to 65535)'; - } elseif (!$this->IsWithinBitRange($source_data_array['bouncesL'], 8, false)) { - $this->errors[] = 'Invalid Reverb Bounces, Left in '.$frame_name.' ('.$source_data_array['bouncesL'].') (range = 0 to 255)'; - } elseif (!$this->IsWithinBitRange($source_data_array['bouncesR'], 8, false)) { - $this->errors[] = 'Invalid Reverb Bounces, Right in '.$frame_name.' ('.$source_data_array['bouncesR'].') (range = 0 to 255)'; - } elseif (!$this->IsWithinBitRange($source_data_array['feedbackLL'], 8, false)) { - $this->errors[] = 'Invalid Reverb Feedback, Left-To-Left in '.$frame_name.' ('.$source_data_array['feedbackLL'].') (range = 0 to 255)'; - } elseif (!$this->IsWithinBitRange($source_data_array['feedbackLR'], 8, false)) { - $this->errors[] = 'Invalid Reverb Feedback, Left-To-Right in '.$frame_name.' ('.$source_data_array['feedbackLR'].') (range = 0 to 255)'; - } elseif (!$this->IsWithinBitRange($source_data_array['feedbackRR'], 8, false)) { - $this->errors[] = 'Invalid Reverb Feedback, Right-To-Right in '.$frame_name.' ('.$source_data_array['feedbackRR'].') (range = 0 to 255)'; - } elseif (!$this->IsWithinBitRange($source_data_array['feedbackRL'], 8, false)) { - $this->errors[] = 'Invalid Reverb Feedback, Right-To-Left in '.$frame_name.' ('.$source_data_array['feedbackRL'].') (range = 0 to 255)'; - } elseif (!$this->IsWithinBitRange($source_data_array['premixLR'], 8, false)) { - $this->errors[] = 'Invalid Premix, Left-To-Right in '.$frame_name.' ('.$source_data_array['premixLR'].') (range = 0 to 255)'; - } elseif (!$this->IsWithinBitRange($source_data_array['premixRL'], 8, false)) { - $this->errors[] = 'Invalid Premix, Right-To-Left in '.$frame_name.' ('.$source_data_array['premixRL'].') (range = 0 to 255)'; - } else { - $framedata .= getid3_lib::BigEndian2String($source_data_array['left'], 2, false); - $framedata .= getid3_lib::BigEndian2String($source_data_array['right'], 2, false); - $framedata .= chr($source_data_array['bouncesL']); - $framedata .= chr($source_data_array['bouncesR']); - $framedata .= chr($source_data_array['feedbackLL']); - $framedata .= chr($source_data_array['feedbackLR']); - $framedata .= chr($source_data_array['feedbackRR']); - $framedata .= chr($source_data_array['feedbackRL']); - $framedata .= chr($source_data_array['premixLR']); - $framedata .= chr($source_data_array['premixRL']); - } - break; - - case 'APIC': - // 4.14 APIC Attached picture - // Text encoding $xx - // MIME type <text string> $00 - // Picture type $xx - // Description <text string according to encoding> $00 (00) - // Picture data <binary data> - $source_data_array['encodingid'] = (isset($source_data_array['encodingid']) ? $source_data_array['encodingid'] : $this->id3v2_default_encodingid); - if (!$this->ID3v2IsValidTextEncoding($source_data_array['encodingid'])) { - $this->errors[] = 'Invalid Text Encoding in '.$frame_name.' ('.$source_data_array['encodingid'].') for ID3v2.'.$this->majorversion; - } elseif (!$this->ID3v2IsValidAPICpicturetype($source_data_array['picturetypeid'])) { - $this->errors[] = 'Invalid Picture Type byte in '.$frame_name.' ('.$source_data_array['picturetypeid'].') for ID3v2.'.$this->majorversion; - } elseif (($this->majorversion >= 3) && (!$this->ID3v2IsValidAPICimageformat($source_data_array['mime']))) { - $this->errors[] = 'Invalid MIME Type in '.$frame_name.' ('.$source_data_array['mime'].') for ID3v2.'.$this->majorversion; - } elseif (($source_data_array['mime'] == '-->') && (!$this->IsValidURL($source_data_array['data'], false, false))) { - //$this->errors[] = 'Invalid URL in '.$frame_name.' ('.$source_data_array['data'].')'; - // probably should be an error, need to rewrite IsValidURL() to handle other encodings - $this->warnings[] = 'Invalid URL in '.$frame_name.' ('.$source_data_array['data'].')'; - } else { - $framedata .= chr($source_data_array['encodingid']); - $framedata .= str_replace("\x00", '', $source_data_array['mime'])."\x00"; - $framedata .= chr($source_data_array['picturetypeid']); - $framedata .= @$source_data_array['description'].getid3_id3v2::TextEncodingTerminatorLookup($source_data_array['encodingid']); - $framedata .= $source_data_array['data']; - } - break; - - case 'GEOB': - // 4.15 GEOB General encapsulated object - // Text encoding $xx - // MIME type <text string> $00 - // Filename <text string according to encoding> $00 (00) - // Content description <text string according to encoding> $00 (00) - // Encapsulated object <binary data> - $source_data_array['encodingid'] = (isset($source_data_array['encodingid']) ? $source_data_array['encodingid'] : $this->id3v2_default_encodingid); - if (!$this->ID3v2IsValidTextEncoding($source_data_array['encodingid'])) { - $this->errors[] = 'Invalid Text Encoding in '.$frame_name.' ('.$source_data_array['encodingid'].') for ID3v2.'.$this->majorversion; - } elseif (!$this->IsValidMIMEstring($source_data_array['mime'])) { - $this->errors[] = 'Invalid MIME Type in '.$frame_name.' ('.$source_data_array['mime'].')'; - } elseif (!$source_data_array['description']) { - $this->errors[] = 'Missing Description in '.$frame_name; - } else { - $framedata .= chr($source_data_array['encodingid']); - $framedata .= str_replace("\x00", '', $source_data_array['mime'])."\x00"; - $framedata .= $source_data_array['filename'].getid3_id3v2::TextEncodingTerminatorLookup($source_data_array['encodingid']); - $framedata .= $source_data_array['description'].getid3_id3v2::TextEncodingTerminatorLookup($source_data_array['encodingid']); - $framedata .= $source_data_array['data']; - } - break; - - case 'PCNT': - // 4.16 PCNT Play counter - // When the counter reaches all one's, one byte is inserted in - // front of the counter thus making the counter eight bits bigger - // Counter $xx xx xx xx (xx ...) - $framedata .= getid3_lib::BigEndian2String($source_data_array['data'], 4, false); - break; - - case 'POPM': - // 4.17 POPM Popularimeter - // When the counter reaches all one's, one byte is inserted in - // front of the counter thus making the counter eight bits bigger - // Email to user <text string> $00 - // Rating $xx - // Counter $xx xx xx xx (xx ...) - if (!$this->IsWithinBitRange($source_data_array['rating'], 8, false)) { - $this->errors[] = 'Invalid Rating byte in '.$frame_name.' ('.$source_data_array['rating'].') (range = 0 to 255)'; - } elseif (!IsValidEmail($source_data_array['email'])) { - $this->errors[] = 'Invalid Email in '.$frame_name.' ('.$source_data_array['email'].')'; - } else { - $framedata .= str_replace("\x00", '', $source_data_array['email'])."\x00"; - $framedata .= chr($source_data_array['rating']); - $framedata .= getid3_lib::BigEndian2String($source_data_array['data'], 4, false); - } - break; - - case 'RBUF': - // 4.18 RBUF Recommended buffer size - // Buffer size $xx xx xx - // Embedded info flag %0000000x - // Offset to next tag $xx xx xx xx - if (!$this->IsWithinBitRange($source_data_array['buffersize'], 24, false)) { - $this->errors[] = 'Invalid Buffer Size in '.$frame_name; - } elseif (!$this->IsWithinBitRange($source_data_array['nexttagoffset'], 32, false)) { - $this->errors[] = 'Invalid Offset To Next Tag in '.$frame_name; - } else { - $framedata .= getid3_lib::BigEndian2String($source_data_array['buffersize'], 3, false); - $flag .= '0000000'; - $flag .= $source_data_array['flags']['embededinfo'] ? '1' : '0'; - $framedata .= chr(bindec($flag)); - $framedata .= getid3_lib::BigEndian2String($source_data_array['nexttagoffset'], 4, false); - } - break; - - case 'AENC': - // 4.19 AENC Audio encryption - // Owner identifier <text string> $00 - // Preview start $xx xx - // Preview length $xx xx - // Encryption info <binary data> - if (!$this->IsWithinBitRange($source_data_array['previewstart'], 16, false)) { - $this->errors[] = 'Invalid Preview Start in '.$frame_name.' ('.$source_data_array['previewstart'].')'; - } elseif (!$this->IsWithinBitRange($source_data_array['previewlength'], 16, false)) { - $this->errors[] = 'Invalid Preview Length in '.$frame_name.' ('.$source_data_array['previewlength'].')'; - } else { - $framedata .= str_replace("\x00", '', $source_data_array['ownerid'])."\x00"; - $framedata .= getid3_lib::BigEndian2String($source_data_array['previewstart'], 2, false); - $framedata .= getid3_lib::BigEndian2String($source_data_array['previewlength'], 2, false); - $framedata .= $source_data_array['encryptioninfo']; - } - break; - - case 'LINK': - // 4.20 LINK Linked information - // Frame identifier $xx xx xx xx - // URL <text string> $00 - // ID and additional data <text string(s)> - if (!getid3_id3v2::IsValidID3v2FrameName($source_data_array['frameid'], $this->majorversion)) { - $this->errors[] = 'Invalid Frame Identifier in '.$frame_name.' ('.$source_data_array['frameid'].')'; - } elseif (!$this->IsValidURL($source_data_array['data'], true, false)) { - //$this->errors[] = 'Invalid URL in '.$frame_name.' ('.$source_data_array['data'].')'; - // probably should be an error, need to rewrite IsValidURL() to handle other encodings - $this->warnings[] = 'Invalid URL in '.$frame_name.' ('.$source_data_array['data'].')'; - } elseif ((($source_data_array['frameid'] == 'AENC') || ($source_data_array['frameid'] == 'APIC') || ($source_data_array['frameid'] == 'GEOB') || ($source_data_array['frameid'] == 'TXXX')) && ($source_data_array['additionaldata'] == '')) { - $this->errors[] = 'Content Descriptor must be specified as additional data for Frame Identifier of '.$source_data_array['frameid'].' in '.$frame_name; - } elseif (($source_data_array['frameid'] == 'USER') && (getid3_id3v2::LanguageLookup($source_data_array['additionaldata'], true) == '')) { - $this->errors[] = 'Language must be specified as additional data for Frame Identifier of '.$source_data_array['frameid'].' in '.$frame_name; - } elseif (($source_data_array['frameid'] == 'PRIV') && ($source_data_array['additionaldata'] == '')) { - $this->errors[] = 'Owner Identifier must be specified as additional data for Frame Identifier of '.$source_data_array['frameid'].' in '.$frame_name; - } elseif ((($source_data_array['frameid'] == 'COMM') || ($source_data_array['frameid'] == 'SYLT') || ($source_data_array['frameid'] == 'USLT')) && ((getid3_id3v2::LanguageLookup(substr($source_data_array['additionaldata'], 0, 3), true) == '') || (substr($source_data_array['additionaldata'], 3) == ''))) { - $this->errors[] = 'Language followed by Content Descriptor must be specified as additional data for Frame Identifier of '.$source_data_array['frameid'].' in '.$frame_name; - } else { - $framedata .= $source_data_array['frameid']; - $framedata .= str_replace("\x00", '', $source_data_array['data'])."\x00"; - switch ($source_data_array['frameid']) { - case 'COMM': - case 'SYLT': - case 'USLT': - case 'PRIV': - case 'USER': - case 'AENC': - case 'APIC': - case 'GEOB': - case 'TXXX': - $framedata .= $source_data_array['additionaldata']; - break; - case 'ASPI': - case 'ETCO': - case 'EQU2': - case 'MCID': - case 'MLLT': - case 'OWNE': - case 'RVA2': - case 'RVRB': - case 'SYTC': - case 'IPLS': - case 'RVAD': - case 'EQUA': - // no additional data required - break; - case 'RBUF': - if ($this->majorversion == 3) { - // no additional data required - } else { - $this->errors[] = $source_data_array['frameid'].' is not a valid Frame Identifier in '.$frame_name.' (in ID3v2.'.$this->majorversion.')'; - } - - default: - if ((substr($source_data_array['frameid'], 0, 1) == 'T') || (substr($source_data_array['frameid'], 0, 1) == 'W')) { - // no additional data required - } else { - $this->errors[] = $source_data_array['frameid'].' is not a valid Frame Identifier in '.$frame_name.' (in ID3v2.'.$this->majorversion.')'; - } - break; - } - } - break; - - case 'POSS': - // 4.21 POSS Position synchronisation frame (ID3v2.3+ only) - // Time stamp format $xx - // Position $xx (xx ...) - if (($source_data_array['timestampformat'] < 1) || ($source_data_array['timestampformat'] > 2)) { - $this->errors[] = 'Invalid Time Stamp Format in '.$frame_name.' ('.$source_data_array['timestampformat'].') (valid = 1 or 2)'; - } elseif (!$this->IsWithinBitRange($source_data_array['position'], 32, false)) { - $this->errors[] = 'Invalid Position in '.$frame_name.' ('.$source_data_array['position'].') (range = 0 to 4294967295)'; - } else { - $framedata .= chr($source_data_array['timestampformat']); - $framedata .= getid3_lib::BigEndian2String($source_data_array['position'], 4, false); - } - break; - - case 'USER': - // 4.22 USER Terms of use (ID3v2.3+ only) - // Text encoding $xx - // Language $xx xx xx - // The actual text <text string according to encoding> - $source_data_array['encodingid'] = (isset($source_data_array['encodingid']) ? $source_data_array['encodingid'] : $this->id3v2_default_encodingid); - if (!$this->ID3v2IsValidTextEncoding($source_data_array['encodingid'])) { - $this->errors[] = 'Invalid Text Encoding in '.$frame_name.' ('.$source_data_array['encodingid'].')'; - } elseif (getid3_id3v2::LanguageLookup($source_data_array['language'], true) == '') { - $this->errors[] = 'Invalid Language in '.$frame_name.' ('.$source_data_array['language'].')'; - } else { - $framedata .= chr($source_data_array['encodingid']); - $framedata .= strtolower($source_data_array['language']); - $framedata .= $source_data_array['data']; - } - break; - - case 'OWNE': - // 4.23 OWNE Ownership frame (ID3v2.3+ only) - // Text encoding $xx - // Price paid <text string> $00 - // Date of purch. <text string> - // Seller <text string according to encoding> - $source_data_array['encodingid'] = (isset($source_data_array['encodingid']) ? $source_data_array['encodingid'] : $this->id3v2_default_encodingid); - if (!$this->ID3v2IsValidTextEncoding($source_data_array['encodingid'])) { - $this->errors[] = 'Invalid Text Encoding in '.$frame_name.' ('.$source_data_array['encodingid'].')'; - } elseif (!$this->IsANumber($source_data_array['pricepaid']['value'], false)) { - $this->errors[] = 'Invalid Price Paid in '.$frame_name.' ('.$source_data_array['pricepaid']['value'].')'; - } elseif (!$this->IsValidDateStampString($source_data_array['purchasedate'])) { - $this->errors[] = 'Invalid Date Of Purchase in '.$frame_name.' ('.$source_data_array['purchasedate'].') (format = YYYYMMDD)'; - } else { - $framedata .= chr($source_data_array['encodingid']); - $framedata .= str_replace("\x00", '', $source_data_array['pricepaid']['value'])."\x00"; - $framedata .= $source_data_array['purchasedate']; - $framedata .= $source_data_array['seller']; - } - break; - - case 'COMR': - // 4.24 COMR Commercial frame (ID3v2.3+ only) - // Text encoding $xx - // Price string <text string> $00 - // Valid until <text string> - // Contact URL <text string> $00 - // Received as $xx - // Name of seller <text string according to encoding> $00 (00) - // Description <text string according to encoding> $00 (00) - // Picture MIME type <string> $00 - // Seller logo <binary data> - $source_data_array['encodingid'] = (isset($source_data_array['encodingid']) ? $source_data_array['encodingid'] : $this->id3v2_default_encodingid); - if (!$this->ID3v2IsValidTextEncoding($source_data_array['encodingid'])) { - $this->errors[] = 'Invalid Text Encoding in '.$frame_name.' ('.$source_data_array['encodingid'].')'; - } elseif (!$this->IsValidDateStampString($source_data_array['pricevaliduntil'])) { - $this->errors[] = 'Invalid Valid Until date in '.$frame_name.' ('.$source_data_array['pricevaliduntil'].') (format = YYYYMMDD)'; - } elseif (!$this->IsValidURL($source_data_array['contacturl'], false, true)) { - $this->errors[] = 'Invalid Contact URL in '.$frame_name.' ('.$source_data_array['contacturl'].') (allowed schemes: http, https, ftp, mailto)'; - } elseif (!$this->ID3v2IsValidCOMRreceivedAs($source_data_array['receivedasid'])) { - $this->errors[] = 'Invalid Received As byte in '.$frame_name.' ('.$source_data_array['contacturl'].') (range = 0 to 8)'; - } elseif (!$this->IsValidMIMEstring($source_data_array['mime'])) { - $this->errors[] = 'Invalid MIME Type in '.$frame_name.' ('.$source_data_array['mime'].')'; - } else { - $framedata .= chr($source_data_array['encodingid']); - unset($pricestring); - foreach ($source_data_array['price'] as $key => $val) { - if ($this->ID3v2IsValidPriceString($key.$val['value'])) { - $pricestrings[] = $key.$val['value']; - } else { - $this->errors[] = 'Invalid Price String in '.$frame_name.' ('.$key.$val['value'].')'; - } - } - $framedata .= implode('/', $pricestrings); - $framedata .= $source_data_array['pricevaliduntil']; - $framedata .= str_replace("\x00", '', $source_data_array['contacturl'])."\x00"; - $framedata .= chr($source_data_array['receivedasid']); - $framedata .= $source_data_array['sellername'].getid3_id3v2::TextEncodingTerminatorLookup($source_data_array['encodingid']); - $framedata .= $source_data_array['description'].getid3_id3v2::TextEncodingTerminatorLookup($source_data_array['encodingid']); - $framedata .= $source_data_array['mime']."\x00"; - $framedata .= $source_data_array['logo']; - } - break; - - case 'ENCR': - // 4.25 ENCR Encryption method registration (ID3v2.3+ only) - // Owner identifier <text string> $00 - // Method symbol $xx - // Encryption data <binary data> - if (!$this->IsWithinBitRange($source_data_array['methodsymbol'], 8, false)) { - $this->errors[] = 'Invalid Group Symbol in '.$frame_name.' ('.$source_data_array['methodsymbol'].') (range = 0 to 255)'; - } else { - $framedata .= str_replace("\x00", '', $source_data_array['ownerid'])."\x00"; - $framedata .= ord($source_data_array['methodsymbol']); - $framedata .= $source_data_array['data']; - } - break; - - case 'GRID': - // 4.26 GRID Group identification registration (ID3v2.3+ only) - // Owner identifier <text string> $00 - // Group symbol $xx - // Group dependent data <binary data> - if (!$this->IsWithinBitRange($source_data_array['groupsymbol'], 8, false)) { - $this->errors[] = 'Invalid Group Symbol in '.$frame_name.' ('.$source_data_array['groupsymbol'].') (range = 0 to 255)'; - } else { - $framedata .= str_replace("\x00", '', $source_data_array['ownerid'])."\x00"; - $framedata .= ord($source_data_array['groupsymbol']); - $framedata .= $source_data_array['data']; - } - break; - - case 'PRIV': - // 4.27 PRIV Private frame (ID3v2.3+ only) - // Owner identifier <text string> $00 - // The private data <binary data> - $framedata .= str_replace("\x00", '', $source_data_array['ownerid'])."\x00"; - $framedata .= $source_data_array['data']; - break; - - case 'SIGN': - // 4.28 SIGN Signature frame (ID3v2.4+ only) - // Group symbol $xx - // Signature <binary data> - if (!$this->IsWithinBitRange($source_data_array['groupsymbol'], 8, false)) { - $this->errors[] = 'Invalid Group Symbol in '.$frame_name.' ('.$source_data_array['groupsymbol'].') (range = 0 to 255)'; - } else { - $framedata .= ord($source_data_array['groupsymbol']); - $framedata .= $source_data_array['data']; - } - break; - - case 'SEEK': - // 4.29 SEEK Seek frame (ID3v2.4+ only) - // Minimum offset to next tag $xx xx xx xx - if (!$this->IsWithinBitRange($source_data_array['data'], 32, false)) { - $this->errors[] = 'Invalid Minimum Offset in '.$frame_name.' ('.$source_data_array['data'].') (range = 0 to 4294967295)'; - } else { - $framedata .= getid3_lib::BigEndian2String($source_data_array['data'], 4, false); - } - break; - - case 'ASPI': - // 4.30 ASPI Audio seek point index (ID3v2.4+ only) - // Indexed data start (S) $xx xx xx xx - // Indexed data length (L) $xx xx xx xx - // Number of index points (N) $xx xx - // Bits per index point (b) $xx - // Then for every index point the following data is included: - // Fraction at index (Fi) $xx (xx) - if (!$this->IsWithinBitRange($source_data_array['datastart'], 32, false)) { - $this->errors[] = 'Invalid Indexed Data Start in '.$frame_name.' ('.$source_data_array['datastart'].') (range = 0 to 4294967295)'; - } elseif (!$this->IsWithinBitRange($source_data_array['datalength'], 32, false)) { - $this->errors[] = 'Invalid Indexed Data Length in '.$frame_name.' ('.$source_data_array['datalength'].') (range = 0 to 4294967295)'; - } elseif (!$this->IsWithinBitRange($source_data_array['indexpoints'], 16, false)) { - $this->errors[] = 'Invalid Number Of Index Points in '.$frame_name.' ('.$source_data_array['indexpoints'].') (range = 0 to 65535)'; - } elseif (!$this->IsWithinBitRange($source_data_array['bitsperpoint'], 8, false)) { - $this->errors[] = 'Invalid Bits Per Index Point in '.$frame_name.' ('.$source_data_array['bitsperpoint'].') (range = 0 to 255)'; - } elseif ($source_data_array['indexpoints'] != count($source_data_array['indexes'])) { - $this->errors[] = 'Number Of Index Points does not match actual supplied data in '.$frame_name; - } else { - $framedata .= getid3_lib::BigEndian2String($source_data_array['datastart'], 4, false); - $framedata .= getid3_lib::BigEndian2String($source_data_array['datalength'], 4, false); - $framedata .= getid3_lib::BigEndian2String($source_data_array['indexpoints'], 2, false); - $framedata .= getid3_lib::BigEndian2String($source_data_array['bitsperpoint'], 1, false); - foreach ($source_data_array['indexes'] as $key => $val) { - $framedata .= getid3_lib::BigEndian2String($val, ceil($source_data_array['bitsperpoint'] / 8), false); - } - } - break; - - case 'RGAD': - // RGAD Replay Gain Adjustment - // http://privatewww.essex.ac.uk/~djmrob/replaygain/ - // Peak Amplitude $xx $xx $xx $xx - // Radio Replay Gain Adjustment %aaabbbcd %dddddddd - // Audiophile Replay Gain Adjustment %aaabbbcd %dddddddd - // a - name code - // b - originator code - // c - sign bit - // d - replay gain adjustment - - if (($source_data_array['track_adjustment'] > 51) || ($source_data_array['track_adjustment'] < -51)) { - $this->errors[] = 'Invalid Track Adjustment in '.$frame_name.' ('.$source_data_array['track_adjustment'].') (range = -51.0 to +51.0)'; - } elseif (($source_data_array['album_adjustment'] > 51) || ($source_data_array['album_adjustment'] < -51)) { - $this->errors[] = 'Invalid Album Adjustment in '.$frame_name.' ('.$source_data_array['album_adjustment'].') (range = -51.0 to +51.0)'; - } elseif (!$this->ID3v2IsValidRGADname($source_data_array['raw']['track_name'])) { - $this->errors[] = 'Invalid Track Name Code in '.$frame_name.' ('.$source_data_array['raw']['track_name'].') (range = 0 to 2)'; - } elseif (!$this->ID3v2IsValidRGADname($source_data_array['raw']['album_name'])) { - $this->errors[] = 'Invalid Album Name Code in '.$frame_name.' ('.$source_data_array['raw']['album_name'].') (range = 0 to 2)'; - } elseif (!$this->ID3v2IsValidRGADoriginator($source_data_array['raw']['track_originator'])) { - $this->errors[] = 'Invalid Track Originator Code in '.$frame_name.' ('.$source_data_array['raw']['track_originator'].') (range = 0 to 3)'; - } elseif (!$this->ID3v2IsValidRGADoriginator($source_data_array['raw']['album_originator'])) { - $this->errors[] = 'Invalid Album Originator Code in '.$frame_name.' ('.$source_data_array['raw']['album_originator'].') (range = 0 to 3)'; - } else { - $framedata .= getid3_lib::Float2String($source_data_array['peakamplitude'], 32); - $framedata .= getid3_lib::RGADgainString($source_data_array['raw']['track_name'], $source_data_array['raw']['track_originator'], $source_data_array['track_adjustment']); - $framedata .= getid3_lib::RGADgainString($source_data_array['raw']['album_name'], $source_data_array['raw']['album_originator'], $source_data_array['album_adjustment']); - } - break; - - default: - if ($frame_name{0} == 'T') { - // 4.2. T??? Text information frames - // Text encoding $xx - // Information <text string(s) according to encoding> - $source_data_array['encodingid'] = (isset($source_data_array['encodingid']) ? $source_data_array['encodingid'] : $this->id3v2_default_encodingid); - if (!$this->ID3v2IsValidTextEncoding($source_data_array['encodingid'])) { - $this->errors[] = 'Invalid Text Encoding in '.$frame_name.' ('.$source_data_array['encodingid'].') for ID3v2.'.$this->majorversion; - } else { - $framedata .= chr($source_data_array['encodingid']); - $framedata .= $source_data_array['data']; - } - } elseif ($frame_name{0} == 'W') { - // 4.3. W??? URL link frames - // URL <text string> - if (!$this->IsValidURL($source_data_array['data'], false, false)) { - //$this->errors[] = 'Invalid URL in '.$frame_name.' ('.$source_data_array['data'].')'; - // probably should be an error, need to rewrite IsValidURL() to handle other encodings - $this->warnings[] = 'Invalid URL in '.$frame_name.' ('.$source_data_array['data'].')'; - } else { - $framedata .= $source_data_array['data']; - } - } else { - $this->errors[] = $frame_name.' not yet supported in $this->GenerateID3v2FrameData()'; - } - break; - } - } - if (!empty($this->errors)) { - return false; - } - return $framedata; - } - - function ID3v2FrameIsAllowed($frame_name, $source_data_array) { - static $PreviousFrames = array(); - - if ($frame_name === null) { - // if the writing functions are called multiple times, the static array needs to be - // cleared - this can be done by calling $this->ID3v2FrameIsAllowed(null, '') - $PreviousFrames = array(); - return true; - } - - if ($this->majorversion == 4) { - switch ($frame_name) { - case 'UFID': - case 'AENC': - case 'ENCR': - case 'GRID': - if (!isset($source_data_array['ownerid'])) { - $this->errors[] = '[ownerid] not specified for '.$frame_name; - } elseif (in_array($frame_name.$source_data_array['ownerid'], $PreviousFrames)) { - $this->errors[] = 'Only one '.$frame_name.' tag allowed with the same OwnerID ('.$source_data_array['ownerid'].')'; - } else { - $PreviousFrames[] = $frame_name.$source_data_array['ownerid']; - } - break; - - case 'TXXX': - case 'WXXX': - case 'RVA2': - case 'EQU2': - case 'APIC': - case 'GEOB': - if (!isset($source_data_array['description'])) { - $this->errors[] = '[description] not specified for '.$frame_name; - } elseif (in_array($frame_name.$source_data_array['description'], $PreviousFrames)) { - $this->errors[] = 'Only one '.$frame_name.' tag allowed with the same Description ('.$source_data_array['description'].')'; - } else { - $PreviousFrames[] = $frame_name.$source_data_array['description']; - } - break; - - case 'USER': - if (!isset($source_data_array['language'])) { - $this->errors[] = '[language] not specified for '.$frame_name; - } elseif (in_array($frame_name.$source_data_array['language'], $PreviousFrames)) { - $this->errors[] = 'Only one '.$frame_name.' tag allowed with the same Language ('.$source_data_array['language'].')'; - } else { - $PreviousFrames[] = $frame_name.$source_data_array['language']; - } - break; - - case 'USLT': - case 'SYLT': - case 'COMM': - if (!isset($source_data_array['language'])) { - $this->errors[] = '[language] not specified for '.$frame_name; - } elseif (!isset($source_data_array['description'])) { - $this->errors[] = '[description] not specified for '.$frame_name; - } elseif (in_array($frame_name.$source_data_array['language'].$source_data_array['description'], $PreviousFrames)) { - $this->errors[] = 'Only one '.$frame_name.' tag allowed with the same Language + Description ('.$source_data_array['language'].' + '.$source_data_array['description'].')'; - } else { - $PreviousFrames[] = $frame_name.$source_data_array['language'].$source_data_array['description']; - } - break; - - case 'POPM': - if (!isset($source_data_array['email'])) { - $this->errors[] = '[email] not specified for '.$frame_name; - } elseif (in_array($frame_name.$source_data_array['email'], $PreviousFrames)) { - $this->errors[] = 'Only one '.$frame_name.' tag allowed with the same Email ('.$source_data_array['email'].')'; - } else { - $PreviousFrames[] = $frame_name.$source_data_array['email']; - } - break; - - case 'IPLS': - case 'MCDI': - case 'ETCO': - case 'MLLT': - case 'SYTC': - case 'RVRB': - case 'PCNT': - case 'RBUF': - case 'POSS': - case 'OWNE': - case 'SEEK': - case 'ASPI': - case 'RGAD': - if (in_array($frame_name, $PreviousFrames)) { - $this->errors[] = 'Only one '.$frame_name.' tag allowed'; - } else { - $PreviousFrames[] = $frame_name; - } - break; - - case 'LINK': - // this isn't implemented quite right (yet) - it should check the target frame data for compliance - // but right now it just allows one linked frame of each type, to be safe. - if (!isset($source_data_array['frameid'])) { - $this->errors[] = '[frameid] not specified for '.$frame_name; - } elseif (in_array($frame_name.$source_data_array['frameid'], $PreviousFrames)) { - $this->errors[] = 'Only one '.$frame_name.' tag allowed with the same FrameID ('.$source_data_array['frameid'].')'; - } elseif (in_array($source_data_array['frameid'], $PreviousFrames)) { - // no links to singleton tags - $this->errors[] = 'Cannot specify a '.$frame_name.' tag to a singleton tag that already exists ('.$source_data_array['frameid'].')'; - } else { - $PreviousFrames[] = $frame_name.$source_data_array['frameid']; // only one linked tag of this type - $PreviousFrames[] = $source_data_array['frameid']; // no non-linked singleton tags of this type - } - break; - - case 'COMR': - // There may be more than one 'commercial frame' in a tag, but no two may be identical - // Checking isn't implemented at all (yet) - just assumes that it's OK. - break; - - case 'PRIV': - case 'SIGN': - if (!isset($source_data_array['ownerid'])) { - $this->errors[] = '[ownerid] not specified for '.$frame_name; - } elseif (!isset($source_data_array['data'])) { - $this->errors[] = '[data] not specified for '.$frame_name; - } elseif (in_array($frame_name.$source_data_array['ownerid'].$source_data_array['data'], $PreviousFrames)) { - $this->errors[] = 'Only one '.$frame_name.' tag allowed with the same OwnerID + Data ('.$source_data_array['ownerid'].' + '.$source_data_array['data'].')'; - } else { - $PreviousFrames[] = $frame_name.$source_data_array['ownerid'].$source_data_array['data']; - } - break; - - default: - if (($frame_name{0} != 'T') && ($frame_name{0} != 'W')) { - $this->errors[] = 'Frame not allowed in ID3v2.'.$this->majorversion.': '.$frame_name; - } - break; - } - - } elseif ($this->majorversion == 3) { - - switch ($frame_name) { - case 'UFID': - case 'AENC': - case 'ENCR': - case 'GRID': - if (!isset($source_data_array['ownerid'])) { - $this->errors[] = '[ownerid] not specified for '.$frame_name; - } elseif (in_array($frame_name.$source_data_array['ownerid'], $PreviousFrames)) { - $this->errors[] = 'Only one '.$frame_name.' tag allowed with the same OwnerID ('.$source_data_array['ownerid'].')'; - } else { - $PreviousFrames[] = $frame_name.$source_data_array['ownerid']; - } - break; - - case 'TXXX': - case 'WXXX': - case 'APIC': - case 'GEOB': - if (!isset($source_data_array['description'])) { - $this->errors[] = '[description] not specified for '.$frame_name; - } elseif (in_array($frame_name.$source_data_array['description'], $PreviousFrames)) { - $this->errors[] = 'Only one '.$frame_name.' tag allowed with the same Description ('.$source_data_array['description'].')'; - } else { - $PreviousFrames[] = $frame_name.$source_data_array['description']; - } - break; - - case 'USER': - if (!isset($source_data_array['language'])) { - $this->errors[] = '[language] not specified for '.$frame_name; - } elseif (in_array($frame_name.$source_data_array['language'], $PreviousFrames)) { - $this->errors[] = 'Only one '.$frame_name.' tag allowed with the same Language ('.$source_data_array['language'].')'; - } else { - $PreviousFrames[] = $frame_name.$source_data_array['language']; - } - break; - - case 'USLT': - case 'SYLT': - case 'COMM': - if (!isset($source_data_array['language'])) { - $this->errors[] = '[language] not specified for '.$frame_name; - } elseif (!isset($source_data_array['description'])) { - $this->errors[] = '[description] not specified for '.$frame_name; - } elseif (in_array($frame_name.$source_data_array['language'].$source_data_array['description'], $PreviousFrames)) { - $this->errors[] = 'Only one '.$frame_name.' tag allowed with the same Language + Description ('.$source_data_array['language'].' + '.$source_data_array['description'].')'; - } else { - $PreviousFrames[] = $frame_name.$source_data_array['language'].$source_data_array['description']; - } - break; - - case 'POPM': - if (!isset($source_data_array['email'])) { - $this->errors[] = '[email] not specified for '.$frame_name; - } elseif (in_array($frame_name.$source_data_array['email'], $PreviousFrames)) { - $this->errors[] = 'Only one '.$frame_name.' tag allowed with the same Email ('.$source_data_array['email'].')'; - } else { - $PreviousFrames[] = $frame_name.$source_data_array['email']; - } - break; - - case 'IPLS': - case 'MCDI': - case 'ETCO': - case 'MLLT': - case 'SYTC': - case 'RVAD': - case 'EQUA': - case 'RVRB': - case 'PCNT': - case 'RBUF': - case 'POSS': - case 'OWNE': - case 'RGAD': - if (in_array($frame_name, $PreviousFrames)) { - $this->errors[] = 'Only one '.$frame_name.' tag allowed'; - } else { - $PreviousFrames[] = $frame_name; - } - break; - - case 'LINK': - // this isn't implemented quite right (yet) - it should check the target frame data for compliance - // but right now it just allows one linked frame of each type, to be safe. - if (!isset($source_data_array['frameid'])) { - $this->errors[] = '[frameid] not specified for '.$frame_name; - } elseif (in_array($frame_name.$source_data_array['frameid'], $PreviousFrames)) { - $this->errors[] = 'Only one '.$frame_name.' tag allowed with the same FrameID ('.$source_data_array['frameid'].')'; - } elseif (in_array($source_data_array['frameid'], $PreviousFrames)) { - // no links to singleton tags - $this->errors[] = 'Cannot specify a '.$frame_name.' tag to a singleton tag that already exists ('.$source_data_array['frameid'].')'; - } else { - $PreviousFrames[] = $frame_name.$source_data_array['frameid']; // only one linked tag of this type - $PreviousFrames[] = $source_data_array['frameid']; // no non-linked singleton tags of this type - } - break; - - case 'COMR': - // There may be more than one 'commercial frame' in a tag, but no two may be identical - // Checking isn't implemented at all (yet) - just assumes that it's OK. - break; - - case 'PRIV': - if (!isset($source_data_array['ownerid'])) { - $this->errors[] = '[ownerid] not specified for '.$frame_name; - } elseif (!isset($source_data_array['data'])) { - $this->errors[] = '[data] not specified for '.$frame_name; - } elseif (in_array($frame_name.$source_data_array['ownerid'].$source_data_array['data'], $PreviousFrames)) { - $this->errors[] = 'Only one '.$frame_name.' tag allowed with the same OwnerID + Data ('.$source_data_array['ownerid'].' + '.$source_data_array['data'].')'; - } else { - $PreviousFrames[] = $frame_name.$source_data_array['ownerid'].$source_data_array['data']; - } - break; - - default: - if (($frame_name{0} != 'T') && ($frame_name{0} != 'W')) { - $this->errors[] = 'Frame not allowed in ID3v2.'.$this->majorversion.': '.$frame_name; - } - break; - } - - } elseif ($this->majorversion == 2) { - - switch ($frame_name) { - case 'UFI': - case 'CRM': - case 'CRA': - if (!isset($source_data_array['ownerid'])) { - $this->errors[] = '[ownerid] not specified for '.$frame_name; - } elseif (in_array($frame_name.$source_data_array['ownerid'], $PreviousFrames)) { - $this->errors[] = 'Only one '.$frame_name.' tag allowed with the same OwnerID ('.$source_data_array['ownerid'].')'; - } else { - $PreviousFrames[] = $frame_name.$source_data_array['ownerid']; - } - break; - - case 'TXX': - case 'WXX': - case 'PIC': - case 'GEO': - if (!isset($source_data_array['description'])) { - $this->errors[] = '[description] not specified for '.$frame_name; - } elseif (in_array($frame_name.$source_data_array['description'], $PreviousFrames)) { - $this->errors[] = 'Only one '.$frame_name.' tag allowed with the same Description ('.$source_data_array['description'].')'; - } else { - $PreviousFrames[] = $frame_name.$source_data_array['description']; - } - break; - - case 'ULT': - case 'SLT': - case 'COM': - if (!isset($source_data_array['language'])) { - $this->errors[] = '[language] not specified for '.$frame_name; - } elseif (!isset($source_data_array['description'])) { - $this->errors[] = '[description] not specified for '.$frame_name; - } elseif (in_array($frame_name.$source_data_array['language'].$source_data_array['description'], $PreviousFrames)) { - $this->errors[] = 'Only one '.$frame_name.' tag allowed with the same Language + Description ('.$source_data_array['language'].' + '.$source_data_array['description'].')'; - } else { - $PreviousFrames[] = $frame_name.$source_data_array['language'].$source_data_array['description']; - } - break; - - case 'POP': - if (!isset($source_data_array['email'])) { - $this->errors[] = '[email] not specified for '.$frame_name; - } elseif (in_array($frame_name.$source_data_array['email'], $PreviousFrames)) { - $this->errors[] = 'Only one '.$frame_name.' tag allowed with the same Email ('.$source_data_array['email'].')'; - } else { - $PreviousFrames[] = $frame_name.$source_data_array['email']; - } - break; - - case 'IPL': - case 'MCI': - case 'ETC': - case 'MLL': - case 'STC': - case 'RVA': - case 'EQU': - case 'REV': - case 'CNT': - case 'BUF': - if (in_array($frame_name, $PreviousFrames)) { - $this->errors[] = 'Only one '.$frame_name.' tag allowed'; - } else { - $PreviousFrames[] = $frame_name; - } - break; - - case 'LNK': - // this isn't implemented quite right (yet) - it should check the target frame data for compliance - // but right now it just allows one linked frame of each type, to be safe. - if (!isset($source_data_array['frameid'])) { - $this->errors[] = '[frameid] not specified for '.$frame_name; - } elseif (in_array($frame_name.$source_data_array['frameid'], $PreviousFrames)) { - $this->errors[] = 'Only one '.$frame_name.' tag allowed with the same FrameID ('.$source_data_array['frameid'].')'; - } elseif (in_array($source_data_array['frameid'], $PreviousFrames)) { - // no links to singleton tags - $this->errors[] = 'Cannot specify a '.$frame_name.' tag to a singleton tag that already exists ('.$source_data_array['frameid'].')'; - } else { - $PreviousFrames[] = $frame_name.$source_data_array['frameid']; // only one linked tag of this type - $PreviousFrames[] = $source_data_array['frameid']; // no non-linked singleton tags of this type - } - break; - - default: - if (($frame_name{0} != 'T') && ($frame_name{0} != 'W')) { - $this->errors[] = 'Frame not allowed in ID3v2.'.$this->majorversion.': '.$frame_name; - } - break; - } - } - - if (!empty($this->errors)) { - return false; - } - return true; - } - - function GenerateID3v2Tag($noerrorsonly=true) { - $this->ID3v2FrameIsAllowed(null, ''); // clear static array in case this isn't the first call to $this->GenerateID3v2Tag() - - $tagstring = ''; - if (is_array($this->tag_data)) { - foreach ($this->tag_data as $frame_name => $frame_rawinputdata) { - foreach ($frame_rawinputdata as $irrelevantindex => $source_data_array) { - if (getid3_id3v2::IsValidID3v2FrameName($frame_name, $this->majorversion)) { - unset($frame_length); - unset($frame_flags); - $frame_data = false; - if ($this->ID3v2FrameIsAllowed($frame_name, $source_data_array)) { - if ($frame_data = $this->GenerateID3v2FrameData($frame_name, $source_data_array)) { - $FrameUnsynchronisation = false; - if ($this->majorversion >= 4) { - // frame-level unsynchronisation - $unsynchdata = $frame_data; - if ($this->id3v2_use_unsynchronisation) { - $unsynchdata = $this->Unsynchronise($frame_data); - } - if (strlen($unsynchdata) != strlen($frame_data)) { - // unsynchronisation needed - $FrameUnsynchronisation = true; - $frame_data = $unsynchdata; - if (isset($TagUnsynchronisation) && $TagUnsynchronisation === false) { - // only set to true if ALL frames are unsynchronised - } else { - $TagUnsynchronisation = true; - } - } else { - if (isset($TagUnsynchronisation)) { - $TagUnsynchronisation = false; - } - } - unset($unsynchdata); - - $frame_length = getid3_lib::BigEndian2String(strlen($frame_data), 4, true); - } else { - $frame_length = getid3_lib::BigEndian2String(strlen($frame_data), 4, false); - } - $frame_flags = $this->GenerateID3v2FrameFlags($this->ID3v2FrameFlagsLookupTagAlter($frame_name), $this->ID3v2FrameFlagsLookupFileAlter($frame_name), false, false, false, false, $FrameUnsynchronisation, false); - } - } else { - $this->errors[] = 'Frame "'.$frame_name.'" is NOT allowed'; - } - if ($frame_data === false) { - $this->errors[] = '$this->GenerateID3v2FrameData() failed for "'.$frame_name.'"'; - if ($noerrorsonly) { - return false; - } else { - unset($frame_name); - } - } - } else { - // ignore any invalid frame names, including 'title', 'header', etc - $this->warnings[] = 'Ignoring invalid ID3v2 frame type: "'.$frame_name.'"'; - unset($frame_name); - unset($frame_length); - unset($frame_flags); - unset($frame_data); - } - if (isset($frame_name) && isset($frame_length) && isset($frame_flags) && isset($frame_data)) { - $tagstring .= $frame_name.$frame_length.$frame_flags.$frame_data; - } - } - } - - if (!isset($TagUnsynchronisation)) { - $TagUnsynchronisation = false; - } - if (($this->majorversion <= 3) && $this->id3v2_use_unsynchronisation) { - // tag-level unsynchronisation - $unsynchdata = $this->Unsynchronise($tagstring); - if (strlen($unsynchdata) != strlen($tagstring)) { - // unsynchronisation needed - $TagUnsynchronisation = true; - $tagstring = $unsynchdata; - } - } - - while ($this->paddedlength < (strlen($tagstring) + getid3_id3v2::ID3v2HeaderLength($this->majorversion))) { - $this->paddedlength += 1024; - } - - $footer = false; // ID3v2 footers not yet supported in getID3() - if (!$footer && ($this->paddedlength > (strlen($tagstring) + getid3_id3v2::ID3v2HeaderLength($this->majorversion)))) { - // pad up to $paddedlength bytes if unpadded tag is shorter than $paddedlength - // "Furthermore it MUST NOT have any padding when a tag footer is added to the tag." - $tagstring .= @str_repeat("\x00", $this->paddedlength - strlen($tagstring) - getid3_id3v2::ID3v2HeaderLength($this->majorversion)); - } - if ($this->id3v2_use_unsynchronisation && (substr($tagstring, strlen($tagstring) - 1, 1) == "\xFF")) { - // special unsynchronisation case: - // if last byte == $FF then appended a $00 - $TagUnsynchronisation = true; - $tagstring .= "\x00"; - } - - $tagheader = 'ID3'; - $tagheader .= chr($this->majorversion); - $tagheader .= chr($this->minorversion); - $tagheader .= $this->GenerateID3v2TagFlags(array('unsynchronisation'=>$TagUnsynchronisation)); - $tagheader .= getid3_lib::BigEndian2String(strlen($tagstring), 4, true); - - return $tagheader.$tagstring; - } - $this->errors[] = 'tag_data is not an array in GenerateID3v2Tag()'; - return false; - } - - function ID3v2IsValidPriceString($pricestring) { - if (getid3_id3v2::LanguageLookup(substr($pricestring, 0, 3), true) == '') { - return false; - } elseif (!$this->IsANumber(substr($pricestring, 3), true)) { - return false; - } - return true; - } - - function ID3v2FrameFlagsLookupTagAlter($framename) { - // unfinished - switch ($framename) { - case 'RGAD': - $allow = true; - default: - $allow = false; - break; - } - return $allow; - } - - function ID3v2FrameFlagsLookupFileAlter($framename) { - // unfinished - switch ($framename) { - case 'RGAD': - return false; - break; - - default: - return false; - break; - } - } - - function ID3v2IsValidETCOevent($eventid) { - if (($eventid < 0) || ($eventid > 0xFF)) { - // outside range of 1 byte - return false; - } elseif (($eventid >= 0xF0) && ($eventid <= 0xFC)) { - // reserved for future use - return false; - } elseif (($eventid >= 0x17) && ($eventid <= 0xDF)) { - // reserved for future use - return false; - } elseif (($eventid >= 0x0E) && ($eventid <= 0x16) && ($this->majorversion == 2)) { - // not defined in ID3v2.2 - return false; - } elseif (($eventid >= 0x15) && ($eventid <= 0x16) && ($this->majorversion == 3)) { - // not defined in ID3v2.3 - return false; - } - return true; - } - - function ID3v2IsValidSYLTtype($contenttype) { - if (($contenttype >= 0) && ($contenttype <= 8) && ($this->majorversion == 4)) { - return true; - } elseif (($contenttype >= 0) && ($contenttype <= 6) && ($this->majorversion == 3)) { - return true; - } - return false; - } - - function ID3v2IsValidRVA2channeltype($channeltype) { - if (($channeltype >= 0) && ($channeltype <= 8) && ($this->majorversion == 4)) { - return true; - } - return false; - } - - function ID3v2IsValidAPICpicturetype($picturetype) { - if (($picturetype >= 0) && ($picturetype <= 0x14) && ($this->majorversion >= 2) && ($this->majorversion <= 4)) { - return true; - } - return false; - } - - function ID3v2IsValidAPICimageformat($imageformat) { - if ($imageformat == '-->') { - return true; - } elseif ($this->majorversion == 2) { - if ((strlen($imageformat) == 3) && ($imageformat == strtoupper($imageformat))) { - return true; - } - } elseif (($this->majorversion == 3) || ($this->majorversion == 4)) { - if ($this->IsValidMIMEstring($imageformat)) { - return true; - } - } - return false; - } - - function ID3v2IsValidCOMRreceivedAs($receivedas) { - if (($this->majorversion >= 3) && ($receivedas >= 0) && ($receivedas <= 8)) { - return true; - } - return false; - } - - function ID3v2IsValidRGADname($RGADname) { - if (($RGADname >= 0) && ($RGADname <= 2)) { - return true; - } - return false; - } - - function ID3v2IsValidRGADoriginator($RGADoriginator) { - if (($RGADoriginator >= 0) && ($RGADoriginator <= 3)) { - return true; - } - return false; - } - - function ID3v2IsValidTextEncoding($textencodingbyte) { - static $ID3v2IsValidTextEncoding_cache = array( - 2 => array(true, true), - 3 => array(true, true), - 4 => array(true, true, true, true)); - return isset($ID3v2IsValidTextEncoding_cache[$this->majorversion][$textencodingbyte]); - } - - function Unsynchronise($data) { - // Whenever a false synchronisation is found within the tag, one zeroed - // byte is inserted after the first false synchronisation byte. The - // format of a correct sync that should be altered by ID3 encoders is as - // follows: - // %11111111 111xxxxx - // And should be replaced with: - // %11111111 00000000 111xxxxx - // This has the side effect that all $FF 00 combinations have to be - // altered, so they won't be affected by the decoding process. Therefore - // all the $FF 00 combinations have to be replaced with the $FF 00 00 - // combination during the unsynchronisation. - - $data = str_replace("\xFF\x00", "\xFF\x00\x00", $data); - $unsyncheddata = ''; - $datalength = strlen($data); - for ($i = 0; $i < $datalength; $i++) { - $thischar = $data{$i}; - $unsyncheddata .= $thischar; - if ($thischar == "\xFF") { - $nextchar = ord($data{$i + 1}); - if (($nextchar & 0xE0) == 0xE0) { - // previous byte = 11111111, this byte = 111????? - $unsyncheddata .= "\x00"; - } - } - } - return $unsyncheddata; - } - - function is_hash($var) { - // written by dev-nullØchristophe*vg - // taken from http://www.php.net/manual/en/function.array-merge-recursive.php - if (is_array($var)) { - $keys = array_keys($var); - $all_num = true; - for ($i = 0; $i < count($keys); $i++) { - if (is_string($keys[$i])) { - return true; - } - } - } - return false; - } - - function array_join_merge($arr1, $arr2) { - // written by dev-nullØchristophe*vg - // taken from http://www.php.net/manual/en/function.array-merge-recursive.php - if (is_array($arr1) && is_array($arr2)) { - // the same -> merge - $new_array = array(); - - if ($this->is_hash($arr1) && $this->is_hash($arr2)) { - // hashes -> merge based on keys - $keys = array_merge(array_keys($arr1), array_keys($arr2)); - foreach ($keys as $key) { - $new_array[$key] = $this->array_join_merge(@$arr1[$key], @$arr2[$key]); - } - } else { - // two real arrays -> merge - $new_array = array_reverse(array_unique(array_reverse(array_merge($arr1, $arr2)))); - } - return $new_array; - } else { - // not the same ... take new one if defined, else the old one stays - return $arr2 ? $arr2 : $arr1; - } - } - - function IsValidMIMEstring($mimestring) { - if ((strlen($mimestring) >= 3) && (strpos($mimestring, '/') > 0) && (strpos($mimestring, '/') < (strlen($mimestring) - 1))) { - return true; - } - return false; - } - - function IsWithinBitRange($number, $maxbits, $signed=false) { - if ($signed) { - if (($number > (0 - pow(2, $maxbits - 1))) && ($number <= pow(2, $maxbits - 1))) { - return true; - } - } else { - if (($number >= 0) && ($number <= pow(2, $maxbits))) { - return true; - } - } - return false; - } - - function safe_parse_url($url) { - $parts = @parse_url($url); - $parts['scheme'] = (isset($parts['scheme']) ? $parts['scheme'] : ''); - $parts['host'] = (isset($parts['host']) ? $parts['host'] : ''); - $parts['user'] = (isset($parts['user']) ? $parts['user'] : ''); - $parts['pass'] = (isset($parts['pass']) ? $parts['pass'] : ''); - $parts['path'] = (isset($parts['path']) ? $parts['path'] : ''); - $parts['query'] = (isset($parts['query']) ? $parts['query'] : ''); - return $parts; - } - - function IsValidURL($url, $allowUserPass=false) { - if ($url == '') { - return false; - } - if ($allowUserPass !== true) { - if (strstr($url, '@')) { - // in the format http://user:pass@example.com or http://user@example.com - // but could easily be somebody incorrectly entering an email address in place of a URL - return false; - } - } - if ($parts = $this->safe_parse_url($url)) { - if (($parts['scheme'] != 'http') && ($parts['scheme'] != 'https') && ($parts['scheme'] != 'ftp') && ($parts['scheme'] != 'gopher')) { - return false; - } elseif (!eregi("^[[:alnum:]]([-.]?[0-9a-z])*\.[a-z]{2,3}$", $parts['host'], $regs) && !IsValidDottedIP($parts['host'])) { - return false; - } elseif (!eregi("^([[:alnum:]-]|[\_])*$", $parts['user'], $regs)) { - return false; - } elseif (!eregi("^([[:alnum:]-]|[\_])*$", $parts['pass'], $regs)) { - return false; - } elseif (!eregi("^[[:alnum:]/_\.@~-]*$", $parts['path'], $regs)) { - return false; - } elseif (!eregi("^[[:alnum:]?&=+:;_()%#/,\.-]*$", $parts['query'], $regs)) { - return false; - } else { - return true; - } - } - return false; - } - - function ID3v2ShortFrameNameLookup($majorversion, $long_description) { - $long_description = str_replace(' ', '_', strtolower(trim($long_description))); - static $ID3v2ShortFrameNameLookup = array(); - if (empty($ID3v2ShortFrameNameLookup)) { - - // The following are unique to ID3v2.2 - $ID3v2ShortFrameNameLookup[2]['comment'] = 'COM'; - $ID3v2ShortFrameNameLookup[2]['album'] = 'TAL'; - $ID3v2ShortFrameNameLookup[2]['beats_per_minute'] = 'TBP'; - $ID3v2ShortFrameNameLookup[2]['composer'] = 'TCM'; - $ID3v2ShortFrameNameLookup[2]['genre'] = 'TCO'; - $ID3v2ShortFrameNameLookup[2]['itunescompilation'] = 'TCP'; - $ID3v2ShortFrameNameLookup[2]['copyright'] = 'TCR'; - $ID3v2ShortFrameNameLookup[2]['encoded_by'] = 'TEN'; - $ID3v2ShortFrameNameLookup[2]['language'] = 'TLA'; - $ID3v2ShortFrameNameLookup[2]['length'] = 'TLE'; - $ID3v2ShortFrameNameLookup[2]['original_artist'] = 'TOA'; - $ID3v2ShortFrameNameLookup[2]['original_filename'] = 'TOF'; - $ID3v2ShortFrameNameLookup[2]['original_lyricist'] = 'TOL'; - $ID3v2ShortFrameNameLookup[2]['original_album_title'] = 'TOT'; - $ID3v2ShortFrameNameLookup[2]['artist'] = 'TP1'; - $ID3v2ShortFrameNameLookup[2]['band'] = 'TP2'; - $ID3v2ShortFrameNameLookup[2]['conductor'] = 'TP3'; - $ID3v2ShortFrameNameLookup[2]['remixer'] = 'TP4'; - $ID3v2ShortFrameNameLookup[2]['publisher'] = 'TPB'; - $ID3v2ShortFrameNameLookup[2]['isrc'] = 'TRC'; - $ID3v2ShortFrameNameLookup[2]['tracknumber'] = 'TRK'; - $ID3v2ShortFrameNameLookup[2]['size'] = 'TSI'; - $ID3v2ShortFrameNameLookup[2]['encoder_settings'] = 'TSS'; - $ID3v2ShortFrameNameLookup[2]['description'] = 'TT1'; - $ID3v2ShortFrameNameLookup[2]['title'] = 'TT2'; - $ID3v2ShortFrameNameLookup[2]['subtitle'] = 'TT3'; - $ID3v2ShortFrameNameLookup[2]['lyricist'] = 'TXT'; - $ID3v2ShortFrameNameLookup[2]['user_text'] = 'TXX'; - $ID3v2ShortFrameNameLookup[2]['year'] = 'TYE'; - $ID3v2ShortFrameNameLookup[2]['unique_file_identifier'] = 'UFI'; - $ID3v2ShortFrameNameLookup[2]['unsynchronised_lyrics'] = 'ULT'; - $ID3v2ShortFrameNameLookup[2]['url_file'] = 'WAF'; - $ID3v2ShortFrameNameLookup[2]['url_artist'] = 'WAR'; - $ID3v2ShortFrameNameLookup[2]['url_source'] = 'WAS'; - $ID3v2ShortFrameNameLookup[2]['copyright_information'] = 'WCP'; - $ID3v2ShortFrameNameLookup[2]['url_publisher'] = 'WPB'; - $ID3v2ShortFrameNameLookup[2]['url_user'] = 'WXX'; - - // The following are common to ID3v2.3 and ID3v2.4 - $ID3v2ShortFrameNameLookup[3]['audio_encryption'] = 'AENC'; - $ID3v2ShortFrameNameLookup[3]['attached_picture'] = 'APIC'; - $ID3v2ShortFrameNameLookup[3]['comment'] = 'COMM'; - $ID3v2ShortFrameNameLookup[3]['commercial'] = 'COMR'; - $ID3v2ShortFrameNameLookup[3]['encryption_method_registration'] = 'ENCR'; - $ID3v2ShortFrameNameLookup[3]['event_timing_codes'] = 'ETCO'; - $ID3v2ShortFrameNameLookup[3]['general_encapsulated_object'] = 'GEOB'; - $ID3v2ShortFrameNameLookup[3]['group_identification_registration'] = 'GRID'; - $ID3v2ShortFrameNameLookup[3]['linked_information'] = 'LINK'; - $ID3v2ShortFrameNameLookup[3]['music_cd_identifier'] = 'MCDI'; - $ID3v2ShortFrameNameLookup[3]['mpeg_location_lookup_table'] = 'MLLT'; - $ID3v2ShortFrameNameLookup[3]['ownership'] = 'OWNE'; - $ID3v2ShortFrameNameLookup[3]['play_counter'] = 'PCNT'; - $ID3v2ShortFrameNameLookup[3]['popularimeter'] = 'POPM'; - $ID3v2ShortFrameNameLookup[3]['position_synchronisation'] = 'POSS'; - $ID3v2ShortFrameNameLookup[3]['private'] = 'PRIV'; - $ID3v2ShortFrameNameLookup[3]['recommended_buffer_size'] = 'RBUF'; - $ID3v2ShortFrameNameLookup[3]['reverb'] = 'RVRB'; - $ID3v2ShortFrameNameLookup[3]['synchronised_lyrics'] = 'SYLT'; - $ID3v2ShortFrameNameLookup[3]['synchronised_tempo_codes'] = 'SYTC'; - $ID3v2ShortFrameNameLookup[3]['album'] = 'TALB'; - $ID3v2ShortFrameNameLookup[3]['beats_per_minute'] = 'TBPM'; - $ID3v2ShortFrameNameLookup[3]['itunescompilation'] = 'TCMP'; - $ID3v2ShortFrameNameLookup[3]['composer'] = 'TCOM'; - $ID3v2ShortFrameNameLookup[3]['genre'] = 'TCON'; - $ID3v2ShortFrameNameLookup[3]['copyright'] = 'TCOP'; - $ID3v2ShortFrameNameLookup[3]['playlist_delay'] = 'TDLY'; - $ID3v2ShortFrameNameLookup[3]['encoded_by'] = 'TENC'; - $ID3v2ShortFrameNameLookup[3]['lyricist'] = 'TEXT'; - $ID3v2ShortFrameNameLookup[3]['file_type'] = 'TFLT'; - $ID3v2ShortFrameNameLookup[3]['content_group_description'] = 'TIT1'; - $ID3v2ShortFrameNameLookup[3]['title'] = 'TIT2'; - $ID3v2ShortFrameNameLookup[3]['subtitle'] = 'TIT3'; - $ID3v2ShortFrameNameLookup[3]['initial_key'] = 'TKEY'; - $ID3v2ShortFrameNameLookup[3]['language'] = 'TLAN'; - $ID3v2ShortFrameNameLookup[3]['length'] = 'TLEN'; - $ID3v2ShortFrameNameLookup[3]['media_type'] = 'TMED'; - $ID3v2ShortFrameNameLookup[3]['original_album_title'] = 'TOAL'; - $ID3v2ShortFrameNameLookup[3]['original_filename'] = 'TOFN'; - $ID3v2ShortFrameNameLookup[3]['original_lyricist'] = 'TOLY'; - $ID3v2ShortFrameNameLookup[3]['original_artist'] = 'TOPE'; - $ID3v2ShortFrameNameLookup[3]['file_owner'] = 'TOWN'; - $ID3v2ShortFrameNameLookup[3]['artist'] = 'TPE1'; - $ID3v2ShortFrameNameLookup[3]['band'] = 'TPE2'; - $ID3v2ShortFrameNameLookup[3]['conductor'] = 'TPE3'; - $ID3v2ShortFrameNameLookup[3]['remixer'] = 'TPE4'; - $ID3v2ShortFrameNameLookup[3]['part_of_a_set'] = 'TPOS'; - $ID3v2ShortFrameNameLookup[3]['publisher'] = 'TPUB'; - $ID3v2ShortFrameNameLookup[3]['tracknumber'] = 'TRCK'; - $ID3v2ShortFrameNameLookup[3]['internet_radio_station_name'] = 'TRSN'; - $ID3v2ShortFrameNameLookup[3]['internet_radio_station_owner'] = 'TRSO'; - $ID3v2ShortFrameNameLookup[3]['isrc'] = 'TSRC'; - $ID3v2ShortFrameNameLookup[3]['encoder_settings'] = 'TSSE'; - $ID3v2ShortFrameNameLookup[3]['user_text'] = 'TXXX'; - $ID3v2ShortFrameNameLookup[3]['unique_file_identifier'] = 'UFID'; - $ID3v2ShortFrameNameLookup[3]['terms_of_use'] = 'USER'; - $ID3v2ShortFrameNameLookup[3]['unsynchronised_lyrics'] = 'USLT'; - $ID3v2ShortFrameNameLookup[3]['commercial'] = 'WCOM'; - $ID3v2ShortFrameNameLookup[3]['copyright_information'] = 'WCOP'; - $ID3v2ShortFrameNameLookup[3]['url_file'] = 'WOAF'; - $ID3v2ShortFrameNameLookup[3]['url_artist'] = 'WOAR'; - $ID3v2ShortFrameNameLookup[3]['url_source'] = 'WOAS'; - $ID3v2ShortFrameNameLookup[3]['url_station'] = 'WORS'; - $ID3v2ShortFrameNameLookup[3]['payment'] = 'WPAY'; - $ID3v2ShortFrameNameLookup[3]['url_publisher'] = 'WPUB'; - $ID3v2ShortFrameNameLookup[3]['url_user'] = 'WXXX'; - - // The above are common to ID3v2.3 and ID3v2.4 - // so copy them to ID3v2.4 before adding specifics for 2.3 and 2.4 - $ID3v2ShortFrameNameLookup[4] = $ID3v2ShortFrameNameLookup[3]; - - // The following are unique to ID3v2.3 - $ID3v2ShortFrameNameLookup[3]['equalisation'] = 'EQUA'; - $ID3v2ShortFrameNameLookup[3]['involved_people_list'] = 'IPLS'; - $ID3v2ShortFrameNameLookup[3]['relative_volume_adjustment'] = 'RVAD'; - $ID3v2ShortFrameNameLookup[3]['date'] = 'TDAT'; - $ID3v2ShortFrameNameLookup[3]['time'] = 'TIME'; - $ID3v2ShortFrameNameLookup[3]['original_release_year'] = 'TORY'; - $ID3v2ShortFrameNameLookup[3]['recording_dates'] = 'TRDA'; - $ID3v2ShortFrameNameLookup[3]['size'] = 'TSIZ'; - $ID3v2ShortFrameNameLookup[3]['year'] = 'TYER'; - - - // The following are unique to ID3v2.4 - $ID3v2ShortFrameNameLookup[4]['audio_seek_point_index'] = 'ASPI'; - $ID3v2ShortFrameNameLookup[4]['equalisation'] = 'EQU2'; - $ID3v2ShortFrameNameLookup[4]['relative_volume_adjustment'] = 'RVA2'; - $ID3v2ShortFrameNameLookup[4]['seek'] = 'SEEK'; - $ID3v2ShortFrameNameLookup[4]['signature'] = 'SIGN'; - $ID3v2ShortFrameNameLookup[4]['encoding_time'] = 'TDEN'; - $ID3v2ShortFrameNameLookup[4]['original_release_time'] = 'TDOR'; - $ID3v2ShortFrameNameLookup[4]['recording_time'] = 'TDRC'; - $ID3v2ShortFrameNameLookup[4]['release_time'] = 'TDRL'; - $ID3v2ShortFrameNameLookup[4]['tagging_time'] = 'TDTG'; - $ID3v2ShortFrameNameLookup[4]['involved_people_list'] = 'TIPL'; - $ID3v2ShortFrameNameLookup[4]['musician_credits_list'] = 'TMCL'; - $ID3v2ShortFrameNameLookup[4]['mood'] = 'TMOO'; - $ID3v2ShortFrameNameLookup[4]['produced_notice'] = 'TPRO'; - $ID3v2ShortFrameNameLookup[4]['album_sort_order'] = 'TSOA'; - $ID3v2ShortFrameNameLookup[4]['performer_sort_order'] = 'TSOP'; - $ID3v2ShortFrameNameLookup[4]['title_sort_order'] = 'TSOT'; - $ID3v2ShortFrameNameLookup[4]['set_subtitle'] = 'TSST'; - } - return @$ID3v2ShortFrameNameLookup[$majorversion][strtolower($long_description)]; - - } - -} - -?> diff --git a/getid3/write.lyrics3.php b/getid3/write.lyrics3.php deleted file mode 100644 index 6b8a47d..0000000 --- a/getid3/write.lyrics3.php +++ /dev/null @@ -1,78 +0,0 @@ -<?php -///////////////////////////////////////////////////////////////// -/// getID3() by James Heinrich <info@getid3.org> // -// available at http://getid3.sourceforge.net // -// or http://www.getid3.org // -///////////////////////////////////////////////////////////////// -// See readme.txt for more details // -///////////////////////////////////////////////////////////////// -// // -// write.lyrics3.php // -// module for writing Lyrics3 tags // -// dependencies: module.tag.lyrics3.php // -// /// -///////////////////////////////////////////////////////////////// - - -class getid3_write_lyrics3 -{ - var $filename; - var $tag_data; - //var $lyrics3_version = 2; // 1 or 2 - var $warnings = array(); // any non-critical errors will be stored here - var $errors = array(); // any critical errors will be stored here - - function getid3_write_lyrics3() { - return true; - } - - function WriteLyrics3() { - $this->errors[] = 'WriteLyrics3() not yet functional - cannot write Lyrics3'; - return false; - } - - function DeleteLyrics3() { - // Initialize getID3 engine - $getID3 = new getID3; - $ThisFileInfo = $getID3->analyze($this->filename); - if (isset($ThisFileInfo['lyrics3']['tag_offset_start']) && isset($ThisFileInfo['lyrics3']['tag_offset_end'])) { - if ($fp = @fopen($this->filename, 'a+b')) { - - flock($fp, LOCK_EX); - $oldignoreuserabort = ignore_user_abort(true); - - fseek($fp, $ThisFileInfo['lyrics3']['tag_offset_end'], SEEK_SET); - $DataAfterLyrics3 = ''; - if ($ThisFileInfo['filesize'] > $ThisFileInfo['lyrics3']['tag_offset_end']) { - $DataAfterLyrics3 = fread($fp, $ThisFileInfo['filesize'] - $ThisFileInfo['lyrics3']['tag_offset_end']); - } - - ftruncate($fp, $ThisFileInfo['lyrics3']['tag_offset_start']); - - if (!empty($DataAfterLyrics3)) { - fseek($fp, $ThisFileInfo['lyrics3']['tag_offset_start'], SEEK_SET); - fwrite($fp, $DataAfterLyrics3, strlen($DataAfterLyrics3)); - } - - flock($fp, LOCK_UN); - fclose($fp); - ignore_user_abort($oldignoreuserabort); - - return true; - - } else { - - $this->errors[] = 'Cannot open "'.$this->filename.'" in "a+b" mode'; - return false; - - } - } - // no Lyrics3 present - return true; - } - - - -} - -?>
\ No newline at end of file diff --git a/getid3/write.metaflac.php b/getid3/write.metaflac.php deleted file mode 100644 index c9521c8..0000000 --- a/getid3/write.metaflac.php +++ /dev/null @@ -1,167 +0,0 @@ -<?php -///////////////////////////////////////////////////////////////// -/// getID3() by James Heinrich <info@getid3.org> // -// available at http://getid3.sourceforge.net // -// or http://www.getid3.org // -///////////////////////////////////////////////////////////////// -// See readme.txt for more details // -///////////////////////////////////////////////////////////////// -// // -// write.metaflac.php // -// module for writing metaflac tags // -// dependencies: /helperapps/metaflac.exe // -// /// -///////////////////////////////////////////////////////////////// - - -class getid3_write_metaflac -{ - - var $filename; - var $tag_data; - var $warnings = array(); // any non-critical errors will be stored here - var $errors = array(); // any critical errors will be stored here - - function getid3_write_metaflac() { - return true; - } - - function WriteMetaFLAC() { - - if (!ini_get('safe_mode')) { - - // Create file with new comments - $tempcommentsfilename = tempnam('*', 'getID3'); - if ($fpcomments = @fopen($tempcommentsfilename, 'wb')) { - - foreach ($this->tag_data as $key => $value) { - foreach ($value as $commentdata) { - fwrite($fpcomments, $this->CleanmetaflacName($key).'='.$commentdata."\n"); - } - } - fclose($fpcomments); - - } else { - - $this->errors[] = 'failed to open temporary tags file "'.$tempcommentsfilename.'", tags not written'; - return false; - - } - - $oldignoreuserabort = ignore_user_abort(true); - if (GETID3_OS_ISWINDOWS) { - - if (file_exists(GETID3_HELPERAPPSDIR.'metaflac.exe')) { - //$commandline = '"'.GETID3_HELPERAPPSDIR.'metaflac.exe" --no-utf8-convert --remove-all-tags --import-tags-from="'.$tempcommentsfilename.'" "'.str_replace('/', '\\', $this->filename).'"'; - // metaflac works fine if you copy-paste the above commandline into a command prompt, - // but refuses to work with `backtick` if there are "doublequotes" present around BOTH - // the metaflac pathname and the target filename. For whatever reason...?? - // The solution is simply ensure that the metaflac pathname has no spaces, - // and therefore does not need to be quoted - - // On top of that, if error messages are not always captured properly under Windows - // To at least see if there was a problem, compare file modification timestamps before and after writing - clearstatcache(); - $timestampbeforewriting = filemtime($this->filename); - - $commandline = GETID3_HELPERAPPSDIR.'metaflac.exe --no-utf8-convert --remove-all-tags --import-tags-from="'.$tempcommentsfilename.'" "'.$this->filename.'" 2>&1'; - $metaflacError = `$commandline`; - - if (empty($metaflacError)) { - clearstatcache(); - if ($timestampbeforewriting == filemtime($this->filename)) { - $metaflacError = 'File modification timestamp has not changed - it looks like the tags were not written'; - } - } - } else { - $metaflacError = 'metaflac.exe not found in '.GETID3_HELPERAPPSDIR; - } - - } else { - - // It's simpler on *nix - $commandline = 'metaflac --no-utf8-convert --remove-all-tags --import-tags-from='.$tempcommentsfilename.' "'.$this->filename.'" 2>&1'; - $metaflacError = `$commandline`; - - } - - // Remove temporary comments file - unlink($tempcommentsfilename); - ignore_user_abort($oldignoreuserabort); - - if (!empty($metaflacError)) { - - $this->errors[] = 'System call to metaflac failed with this message returned: '."\n\n".$metaflacError; - return false; - - } - - return true; - } - - $this->errors[] = 'PHP running in Safe Mode (backtick operator not available) - cannot call metaflac, tags not written'; - return false; - } - - - function DeleteMetaFLAC() { - - if (!ini_get('safe_mode')) { - - $oldignoreuserabort = ignore_user_abort(true); - if (GETID3_OS_ISWINDOWS) { - - if (file_exists(GETID3_HELPERAPPSDIR.'metaflac.exe')) { - // To at least see if there was a problem, compare file modification timestamps before and after writing - clearstatcache(); - $timestampbeforewriting = filemtime($this->filename); - - $commandline = GETID3_HELPERAPPSDIR.'metaflac.exe --remove-all-tags "'.$this->filename.'" 2>&1'; - $metaflacError = `$commandline`; - - if (empty($metaflacError)) { - clearstatcache(); - if ($timestampbeforewriting == filemtime($this->filename)) { - $metaflacError = 'File modification timestamp has not changed - it looks like the tags were not deleted'; - } - } - } else { - $metaflacError = 'metaflac.exe not found in '.GETID3_HELPERAPPSDIR; - } - - } else { - - // It's simpler on *nix - $commandline = 'metaflac --remove-all-tags "'.$this->filename.'" 2>&1'; - $metaflacError = `$commandline`; - - } - - ignore_user_abort($oldignoreuserabort); - - if (!empty($metaflacError)) { - $this->errors[] = 'System call to metaflac failed with this message returned: '."\n\n".$metaflacError; - return false; - } - return true; - } - $this->errors[] = 'PHP running in Safe Mode (backtick operator not available) - cannot call metaflac, tags not deleted'; - return false; - } - - - function CleanmetaflacName($originalcommentname) { - // A case-insensitive field name that may consist of ASCII 0x20 through 0x7D, 0x3D ('=') excluded. - // ASCII 0x41 through 0x5A inclusive (A-Z) is to be considered equivalent to ASCII 0x61 through - // 0x7A inclusive (a-z). - - // replace invalid chars with a space, return uppercase text - // Thanks Chris Bolt <chris-getid3Øbolt*cx> for improving this function - // note: ereg_replace() replaces nulls with empty string (not space) - return strtoupper(ereg_replace('[^ -<>-}]', ' ', str_replace("\x00", ' ', $originalcommentname))); - - } - -} - -?>
\ No newline at end of file diff --git a/getid3/write.php b/getid3/write.php deleted file mode 100644 index 73e2610..0000000 --- a/getid3/write.php +++ /dev/null @@ -1,592 +0,0 @@ -<?php -///////////////////////////////////////////////////////////////// -/// getID3() by James Heinrich <info@getid3.org> // -// available at http://getid3.sourceforge.net // -// or http://www.getid3.org // -///////////////////////////////////////////////////////////////// -// See readme.txt for more details // -///////////////////////////////////////////////////////////////// -/// // -// write.php // -// module for writing tags (APEv2, ID3v1, ID3v2) // -// dependencies: getid3.lib.php // -// write.apetag.php (optional) // -// write.id3v1.php (optional) // -// write.id3v2.php (optional) // -// write.vorbiscomment.php (optional) // -// write.metaflac.php (optional) // -// write.lyrics3.php (optional) // -// /// -///////////////////////////////////////////////////////////////// - -if (!defined('GETID3_INCLUDEPATH')) { - die('getid3.php MUST be included before calling getid3_writetags'); -} -if (!include_once(GETID3_INCLUDEPATH.'getid3.lib.php')) { - die('write.php depends on getid3.lib.php, which is missing.'); -} - - -// NOTES: -// -// You should pass data here with standard field names as follows: -// * TITLE -// * ARTIST -// * ALBUM -// * TRACKNUMBER -// * COMMENT -// * GENRE -// * YEAR -// * ATTACHED_PICTURE (ID3v2 only) -// -// http://www.personal.uni-jena.de/~pfk/mpp/sv8/apekey.html -// The APEv2 Tag Items Keys definition says "TRACK" is correct but foobar2000 uses "TRACKNUMBER" instead -// Pass data here as "TRACKNUMBER" for compatability with all formats - - -class getid3_writetags -{ - // public - var $filename; // absolute filename of file to write tags to - var $tagformats = array(); // array of tag formats to write ('id3v1', 'id3v2.2', 'id2v2.3', 'id3v2.4', 'ape', 'vorbiscomment', 'metaflac', 'real') - var $tag_data = array(array()); // 2-dimensional array of tag data (ex: $data['ARTIST'][0] = 'Elvis') - var $tag_encoding = 'ISO-8859-1'; // text encoding used for tag data ('ISO-8859-1', 'UTF-8', 'UTF-16', 'UTF-16LE', 'UTF-16BE', ) - var $overwrite_tags = true; // if true will erase existing tag data and write only passed data; if false will merge passed data with existing tag data - var $remove_other_tags = false; // if true will erase remove all existing tags and only write those passed in $tagformats; if false will ignore any tags not mentioned in $tagformats - - var $id3v2_tag_language = 'eng'; // ISO-639-2 3-character language code needed for some ID3v2 frames (http://www.id3.org/iso639-2.html) - var $id3v2_paddedlength = 4096; // minimum length of ID3v2 tags (will be padded to this length if tag data is shorter) - - var $warnings = array(); // any non-critical errors will be stored here - var $errors = array(); // any critical errors will be stored here - - // private - var $ThisFileInfo; // analysis of file before writing - - function getid3_writetags() { - return true; - } - - - function WriteTags() { - - if (empty($this->filename)) { - $this->errors[] = 'filename is undefined in getid3_writetags'; - return false; - } elseif (!file_exists($this->filename)) { - $this->errors[] = 'filename set to non-existant file "'.$this->filename.'" in getid3_writetags'; - return false; - } - - if (!is_array($this->tagformats)) { - $this->errors[] = 'tagformats must be an array in getid3_writetags'; - return false; - } - - $TagFormatsToRemove = array(); - if (filesize($this->filename) == 0) { - - // empty file special case - allow any tag format, don't check existing format - // could be useful if you want to generate tag data for a non-existant file - $this->ThisFileInfo = array('fileformat'=>''); - $AllowedTagFormats = array('id3v1', 'id3v2.2', 'id3v2.3', 'id3v2.4', 'ape', 'lyrics3'); - - } else { - - $getID3 = new getID3; - $getID3->encoding = $this->tag_encoding; - $this->ThisFileInfo = $getID3->analyze($this->filename); - - // check for what file types are allowed on this fileformat - switch (@$this->ThisFileInfo['fileformat']) { - case 'mp3': - case 'mp2': - case 'mp1': - case 'riff': // maybe not officially, but people do it anyway - $AllowedTagFormats = array('id3v1', 'id3v2.2', 'id3v2.3', 'id3v2.4', 'ape', 'lyrics3'); - break; - - case 'mpc': - $AllowedTagFormats = array('ape'); - break; - - case 'flac': - $AllowedTagFormats = array('metaflac'); - break; - - case 'real': - $AllowedTagFormats = array('real'); - break; - - case 'ogg': - switch (@$this->ThisFileInfo['audio']['dataformat']) { - case 'flac': - //$AllowedTagFormats = array('metaflac'); - $this->errors[] = 'metaflac is not (yet) compatible with OggFLAC files'; - return false; - break; - case 'vorbis': - $AllowedTagFormats = array('vorbiscomment'); - break; - default: - $this->errors[] = 'metaflac is not (yet) compatible with Ogg files other than OggVorbis'; - return false; - break; - } - break; - - default: - $AllowedTagFormats = array(); - break; - } - foreach ($this->tagformats as $requested_tag_format) { - if (!in_array($requested_tag_format, $AllowedTagFormats)) { - $errormessage = 'Tag format "'.$requested_tag_format.'" is not allowed on "'.@$this->ThisFileInfo['fileformat']; - if (@$this->ThisFileInfo['fileformat'] != @$this->ThisFileInfo['audio']['dataformat']) { - $errormessage .= '.'.@$this->ThisFileInfo['audio']['dataformat']; - } - $errormessage .= '" files'; - $this->errors[] = $errormessage; - return false; - } - } - - // List of other tag formats, removed if requested - if ($this->remove_other_tags) { - foreach ($AllowedTagFormats as $AllowedTagFormat) { - switch ($AllowedTagFormat) { - case 'id3v2.2': - case 'id3v2.3': - case 'id3v2.4': - if (!in_array('id3v2', $TagFormatsToRemove) && !in_array('id3v2.2', $this->tagformats) && !in_array('id3v2.3', $this->tagformats) && !in_array('id3v2.4', $this->tagformats)) { - $TagFormatsToRemove[] = 'id3v2'; - } - break; - - default: - if (!in_array($AllowedTagFormat, $this->tagformats)) { - $TagFormatsToRemove[] = $AllowedTagFormat; - } - break; - } - } - } - } - - $WritingFilesToInclude = array_merge($this->tagformats, $TagFormatsToRemove); - - // Check for required include files and include them - foreach ($WritingFilesToInclude as $tagformat) { - switch ($tagformat) { - case 'ape': - $GETID3_ERRORARRAY = &$this->errors; - if (!getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'write.apetag.php', __FILE__, false)) { - return false; - } - break; - - case 'id3v1': - case 'lyrics3': - case 'vorbiscomment': - case 'metaflac': - case 'real': - $GETID3_ERRORARRAY = &$this->errors; - if (!getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'write.'.$tagformat.'.php', __FILE__, false)) { - return false; - } - break; - - case 'id3v2.2': - case 'id3v2.3': - case 'id3v2.4': - case 'id3v2': - $GETID3_ERRORARRAY = &$this->errors; - if (!getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'write.id3v2.php', __FILE__, false)) { - return false; - } - break; - - default: - $this->errors[] = 'unknown tag format "'.$tagformat.'" in $tagformats in WriteTags()'; - return false; - break; - } - - } - - // Validation of supplied data - if (!is_array($this->tag_data)) { - $this->errors[] = '$tag_data is not an array in WriteTags()'; - return false; - } - // convert supplied data array keys to upper case, if they're not already - foreach ($this->tag_data as $tag_key => $tag_array) { - if (strtoupper($tag_key) !== $tag_key) { - $this->tag_data[strtoupper($tag_key)] = $this->tag_data[$tag_key]; - unset($this->tag_data[$tag_key]); - } - } - // convert source data array keys to upper case, if they're not already - if (!empty($this->ThisFileInfo['tags'])) { - foreach ($this->ThisFileInfo['tags'] as $tag_format => $tag_data_array) { - foreach ($tag_data_array as $tag_key => $tag_array) { - if (strtoupper($tag_key) !== $tag_key) { - $this->ThisFileInfo['tags'][$tag_format][strtoupper($tag_key)] = $this->ThisFileInfo['tags'][$tag_format][$tag_key]; - unset($this->ThisFileInfo['tags'][$tag_format][$tag_key]); - } - } - } - } - - // Convert "TRACK" to "TRACKNUMBER" (if needed) for compatability with all formats - if (isset($this->tag_data['TRACK']) && !isset($this->tag_data['TRACKNUMBER'])) { - $this->tag_data['TRACKNUMBER'] = $this->tag_data['TRACK']; - unset($this->tag_data['TRACK']); - } - - // Remove all other tag formats, if requested - if ($this->remove_other_tags) { - $this->DeleteTags($TagFormatsToRemove); - } - - // Write data for each tag format - foreach ($this->tagformats as $tagformat) { - $success = false; // overridden if tag writing is successful - switch ($tagformat) { - case 'ape': - $ape_writer = new getid3_write_apetag; - if (($ape_writer->tag_data = $this->FormatDataForAPE()) !== false) { - $ape_writer->filename = $this->filename; - if (($success = $ape_writer->WriteAPEtag()) === false) { - $this->errors[] = 'WriteAPEtag() failed with message(s):<PRE><UL><LI>'.trim(implode('</LI><LI>', $ape_writer->errors)).'</LI></UL></PRE>'; - } - } else { - $this->errors[] = 'FormatDataForAPE() failed'; - } - break; - - case 'id3v1': - $id3v1_writer = new getid3_write_id3v1; - if (($id3v1_writer->tag_data = $this->FormatDataForID3v1()) !== false) { - $id3v1_writer->filename = $this->filename; - if (($success = $id3v1_writer->WriteID3v1()) === false) { - $this->errors[] = 'WriteID3v1() failed with message(s):<PRE><UL><LI>'.trim(implode('</LI><LI>', $id3v1_writer->errors)).'</LI></UL></PRE>'; - } - } else { - $this->errors[] = 'FormatDataForID3v1() failed'; - } - break; - - case 'id3v2.2': - case 'id3v2.3': - case 'id3v2.4': - $id3v2_writer = new getid3_write_id3v2; - $id3v2_writer->majorversion = intval(substr($tagformat, -1)); - $id3v2_writer->paddedlength = $this->id3v2_paddedlength; - if (($id3v2_writer->tag_data = $this->FormatDataForID3v2($id3v2_writer->majorversion)) !== false) { - $id3v2_writer->filename = $this->filename; - if (($success = $id3v2_writer->WriteID3v2()) === false) { - $this->errors[] = 'WriteID3v2() failed with message(s):<PRE><UL><LI>'.trim(implode('</LI><LI>', $id3v2_writer->errors)).'</LI></UL></PRE>'; - } - } else { - $this->errors[] = 'FormatDataForID3v2() failed'; - } - break; - - case 'vorbiscomment': - $vorbiscomment_writer = new getid3_write_vorbiscomment; - if (($vorbiscomment_writer->tag_data = $this->FormatDataForVorbisComment()) !== false) { - $vorbiscomment_writer->filename = $this->filename; - if (($success = $vorbiscomment_writer->WriteVorbisComment()) === false) { - $this->errors[] = 'WriteVorbisComment() failed with message(s):<PRE><UL><LI>'.trim(implode('</LI><LI>', $vorbiscomment_writer->errors)).'</LI></UL></PRE>'; - } - } else { - $this->errors[] = 'FormatDataForVorbisComment() failed'; - } - break; - - case 'metaflac': - $metaflac_writer = new getid3_write_metaflac; - if (($metaflac_writer->tag_data = $this->FormatDataForMetaFLAC()) !== false) { - $metaflac_writer->filename = $this->filename; - if (($success = $metaflac_writer->WriteMetaFLAC()) === false) { - $this->errors[] = 'WriteMetaFLAC() failed with message(s):<PRE><UL><LI>'.trim(implode('</LI><LI>', $metaflac_writer->errors)).'</LI></UL></PRE>'; - } - } else { - $this->errors[] = 'FormatDataForMetaFLAC() failed'; - } - break; - - case 'real': - $real_writer = new getid3_write_real; - if (($real_writer->tag_data = $this->FormatDataForReal()) !== false) { - $real_writer->filename = $this->filename; - if (($success = $real_writer->WriteReal()) === false) { - $this->errors[] = 'WriteReal() failed with message(s):<PRE><UL><LI>'.trim(implode('</LI><LI>', $real_writer->errors)).'</LI></UL></PRE>'; - } - } else { - $this->errors[] = 'FormatDataForReal() failed'; - } - break; - - default: - $this->errors[] = 'Invalid tag format to write: "'.$tagformat.'"'; - return false; - break; - } - if (!$success) { - return false; - } - } - return true; - - } - - - function DeleteTags($TagFormatsToDelete) { - foreach ($TagFormatsToDelete as $DeleteTagFormat) { - $success = false; // overridden if tag deletion is successful - switch ($DeleteTagFormat) { - case 'id3v1': - $id3v1_writer = new getid3_write_id3v1; - $id3v1_writer->filename = $this->filename; - if (($success = $id3v1_writer->RemoveID3v1()) === false) { - $this->errors[] = 'RemoveID3v1() failed with message(s):<PRE><UL><LI>'.trim(implode('</LI><LI>', $id3v1_writer->errors)).'</LI></UL></PRE>'; - } - break; - - case 'id3v2': - $id3v2_writer = new getid3_write_id3v2; - $id3v2_writer->filename = $this->filename; - if (($success = $id3v2_writer->RemoveID3v2()) === false) { - $this->errors[] = 'RemoveID3v2() failed with message(s):<PRE><UL><LI>'.trim(implode('</LI><LI>', $id3v2_writer->errors)).'</LI></UL></PRE>'; - } - break; - - case 'ape': - $ape_writer = new getid3_write_apetag; - $ape_writer->filename = $this->filename; - if (($success = $ape_writer->DeleteAPEtag()) === false) { - $this->errors[] = 'DeleteAPEtag() failed with message(s):<PRE><UL><LI>'.trim(implode('</LI><LI>', $ape_writer->errors)).'</LI></UL></PRE>'; - } - break; - - case 'vorbiscomment': - $vorbiscomment_writer = new getid3_write_vorbiscomment; - $vorbiscomment_writer->filename = $this->filename; - if (($success = $vorbiscomment_writer->DeleteVorbisComment()) === false) { - $this->errors[] = 'DeleteVorbisComment() failed with message(s):<PRE><UL><LI>'.trim(implode('</LI><LI>', $vorbiscomment_writer->errors)).'</LI></UL></PRE>'; - } - break; - - case 'metaflac': - $metaflac_writer = new getid3_write_metaflac; - $metaflac_writer->filename = $this->filename; - if (($success = $metaflac_writer->DeleteMetaFLAC()) === false) { - $this->errors[] = 'DeleteMetaFLAC() failed with message(s):<PRE><UL><LI>'.trim(implode('</LI><LI>', $metaflac_writer->errors)).'</LI></UL></PRE>'; - } - break; - - case 'lyrics3': - $lyrics3_writer = new getid3_write_lyrics3; - $lyrics3_writer->filename = $this->filename; - if (($success = $lyrics3_writer->DeleteLyrics3()) === false) { - $this->errors[] = 'DeleteLyrics3() failed with message(s):<PRE><UL><LI>'.trim(implode('</LI><LI>', $lyrics3_writer->errors)).'</LI></UL></PRE>'; - } - break; - - case 'real': - $real_writer = new getid3_write_real; - $real_writer->filename = $this->filename; - if (($success = $real_writer->RemoveReal()) === false) { - $this->errors[] = 'RemoveReal() failed with message(s):<PRE><UL><LI>'.trim(implode('</LI><LI>', $real_writer->errors)).'</LI></UL></PRE>'; - } - break; - - default: - $this->errors[] = 'Invalid tag format to delete: "'.$tagformat.'"'; - return false; - break; - } - if (!$success) { - return false; - } - } - return true; - } - - - function MergeExistingTagData($TagFormat, &$tag_data) { - // Merge supplied data with existing data, if requested - if ($this->overwrite_tags) { - // do nothing - ignore previous data - } else { - if (!isset($this->ThisFileInfo['tags'][$TagFormat])) { - return false; - } - $tag_data = array_merge_recursive($tag_data, $this->ThisFileInfo['tags'][$TagFormat]); - } - return true; - } - - function FormatDataForAPE() { - $ape_tag_data = array(); - foreach ($this->tag_data as $tag_key => $valuearray) { - switch ($tag_key) { - case 'ATTACHED_PICTURE': - // ATTACHED_PICTURE is ID3v2 only - ignore - $this->warnings[] = '$data['.$tag_key.'] is assumed to be ID3v2 APIC data - NOT written to APE tag'; - break; - - default: - foreach ($valuearray as $key => $value) { - if (is_string($value) || is_numeric($value)) { - $ape_tag_data[$tag_key][$key] = getid3_lib::iconv_fallback($this->tag_encoding, 'UTF-8', $value); - } else { - $this->warnings[] = '$data['.$tag_key.']['.$key.'] is not a string value - all of $data['.$tag_key.'] NOT written to APE tag'; - unset($ape_tag_data[$tag_key]); - break; - } - } - break; - } - } - $this->MergeExistingTagData('ape', $ape_tag_data); - return $ape_tag_data; - } - - - function FormatDataForID3v1() { - $tag_data_id3v1['genreid'] = 255; - if (!empty($this->tag_data['GENRE'])) { - foreach ($this->tag_data['GENRE'] as $key => $value) { - if (getid3_id3v1::LookupGenreID($value) !== false) { - $tag_data_id3v1['genreid'] = getid3_id3v1::LookupGenreID($value); - break; - } - } - } - - $tag_data_id3v1['title'] = getid3_lib::iconv_fallback($this->tag_encoding, 'ISO-8859-1', @implode(' ', @$this->tag_data['TITLE'])); - $tag_data_id3v1['artist'] = getid3_lib::iconv_fallback($this->tag_encoding, 'ISO-8859-1', @implode(' ', @$this->tag_data['ARTIST'])); - $tag_data_id3v1['album'] = getid3_lib::iconv_fallback($this->tag_encoding, 'ISO-8859-1', @implode(' ', @$this->tag_data['ALBUM'])); - $tag_data_id3v1['year'] = getid3_lib::iconv_fallback($this->tag_encoding, 'ISO-8859-1', @implode(' ', @$this->tag_data['YEAR'])); - $tag_data_id3v1['comment'] = getid3_lib::iconv_fallback($this->tag_encoding, 'ISO-8859-1', @implode(' ', @$this->tag_data['COMMENT'])); - - $tag_data_id3v1['track'] = intval(getid3_lib::iconv_fallback($this->tag_encoding, 'ISO-8859-1', @implode(' ', @$this->tag_data['TRACKNUMBER']))); - if ($tag_data_id3v1['track'] <= 0) { - $tag_data_id3v1['track'] = ''; - } - - $this->MergeExistingTagData('id3v1', $tag_data_id3v1); - return $tag_data_id3v1; - } - - function FormatDataForID3v2($id3v2_majorversion) { - $tag_data_id3v2 = array(); - - $ID3v2_text_encoding_lookup[2] = array('ISO-8859-1'=>0, 'UTF-16'=>1); - $ID3v2_text_encoding_lookup[3] = array('ISO-8859-1'=>0, 'UTF-16'=>1); - $ID3v2_text_encoding_lookup[4] = array('ISO-8859-1'=>0, 'UTF-16'=>1, 'UTF-16BE'=>2, 'UTF-8'=>3); - foreach ($this->tag_data as $tag_key => $valuearray) { - $ID3v2_framename = getid3_write_id3v2::ID3v2ShortFrameNameLookup($id3v2_majorversion, $tag_key); - switch ($ID3v2_framename) { - case 'APIC': - foreach ($valuearray as $key => $apic_data_array) { - if (isset($apic_data_array['data']) && - isset($apic_data_array['picturetypeid']) && - isset($apic_data_array['description']) && - isset($apic_data_array['mime'])) { - $tag_data_id3v2['APIC'][] = $apic_data_array; - } else { - $this->errors[] = 'ID3v2 APIC data is not properly structured'; - return false; - } - } - break; - - case '': - $this->errors[] = 'ID3v2: Skipping "'.$tag_key.'" because cannot match it to a known ID3v2 frame type'; - // some other data type, don't know how to handle it, ignore it - break; - - default: - // most other (text) frames can be copied over as-is - foreach ($valuearray as $key => $value) { - if (isset($ID3v2_text_encoding_lookup[$id3v2_majorversion][$this->tag_encoding])) { - // source encoding is valid in ID3v2 - use it with no conversion - $tag_data_id3v2[$ID3v2_framename][$key]['encodingid'] = $ID3v2_text_encoding_lookup[$id3v2_majorversion][$this->tag_encoding]; - $tag_data_id3v2[$ID3v2_framename][$key]['data'] = $value; - } else { - // source encoding is NOT valid in ID3v2 - convert it to an ID3v2-valid encoding first - if ($id3v2_majorversion < 4) { - // convert data from other encoding to UTF-16 - $tag_data_id3v2[$ID3v2_framename][$key]['encodingid'] = 1; - $tag_data_id3v2[$ID3v2_framename][$key]['data'] = getid3_lib::iconv_fallback($this->tag_encoding, 'UTF-16', $value); - - } else { - // convert data from other encoding to UTF-8 - $tag_data_id3v2[$ID3v2_framename][$key]['encodingid'] = 3; - $tag_data_id3v2[$ID3v2_framename][$key]['data'] = getid3_lib::iconv_fallback($this->tag_encoding, 'UTF-8', $value); - } - } - - // These values are not needed for all frame types, but if they're not used no matter - $tag_data_id3v2[$ID3v2_framename][$key]['description'] = ''; - $tag_data_id3v2[$ID3v2_framename][$key]['language'] = $this->id3v2_tag_language; - } - break; - } - } - $this->MergeExistingTagData('id3v2', $tag_data_id3v2); - return $tag_data_id3v2; - } - - function FormatDataForVorbisComment() { - $tag_data_vorbiscomment = $this->tag_data; - - // check for multi-line comment values - split out to multiple comments if neccesary - // and convert data to UTF-8 strings - foreach ($tag_data_vorbiscomment as $tag_key => $valuearray) { - foreach ($valuearray as $key => $value) { - str_replace("\r", "\n", $value); - if (strstr($value, "\n")) { - unset($tag_data_vorbiscomment[$tag_key][$key]); - $multilineexploded = explode("\n", $value); - foreach ($multilineexploded as $newcomment) { - if (strlen(trim($newcomment)) > 0) { - $tag_data_vorbiscomment[$tag_key][] = getid3_lib::iconv_fallback($this->tag_encoding, 'UTF-8', $newcomment); - } - } - } elseif (is_string($value) || is_numeric($value)) { - $tag_data_vorbiscomment[$tag_key][$key] = getid3_lib::iconv_fallback($this->tag_encoding, 'UTF-8', $value); - } else { - $this->warnings[] = '$data['.$tag_key.']['.$key.'] is not a string value - all of $data['.$tag_key.'] NOT written to VorbisComment tag'; - unset($tag_data_vorbiscomment[$tag_key]); - break; - } - } - } - $this->MergeExistingTagData('vorbiscomment', $tag_data_vorbiscomment); - return $tag_data_vorbiscomment; - } - - function FormatDataForMetaFLAC() { - // FLAC & OggFLAC use VorbisComments same as OggVorbis - // but require metaflac to do the writing rather than vorbiscomment - return $this->FormatDataForVorbisComment(); - } - - function FormatDataForReal() { - $tag_data_real['title'] = getid3_lib::iconv_fallback($this->tag_encoding, 'ISO-8859-1', @implode(' ', @$this->tag_data['TITLE'])); - $tag_data_real['artist'] = getid3_lib::iconv_fallback($this->tag_encoding, 'ISO-8859-1', @implode(' ', @$this->tag_data['ARTIST'])); - $tag_data_real['copyright'] = getid3_lib::iconv_fallback($this->tag_encoding, 'ISO-8859-1', @implode(' ', @$this->tag_data['COPYRIGHT'])); - $tag_data_real['comment'] = getid3_lib::iconv_fallback($this->tag_encoding, 'ISO-8859-1', @implode(' ', @$this->tag_data['COMMENT'])); - - $this->MergeExistingTagData('real', $tag_data_real); - return $tag_data_real; - } - -} - -?>
\ No newline at end of file diff --git a/getid3/write.real.php b/getid3/write.real.php deleted file mode 100644 index 1e0240c..0000000 --- a/getid3/write.real.php +++ /dev/null @@ -1,295 +0,0 @@ -<?php -///////////////////////////////////////////////////////////////// -/// getID3() by James Heinrich <info@getid3.org> // -// available at http://getid3.sourceforge.net // -// or http://www.getid3.org // -///////////////////////////////////////////////////////////////// -// See readme.txt for more details // -///////////////////////////////////////////////////////////////// -// // -// write.real.php // -// module for writing RealAudio/RealVideo tags // -// dependencies: module.tag.real.php // -// /// -///////////////////////////////////////////////////////////////// - -class getid3_write_real -{ - var $filename; - var $tag_data = array(); - var $warnings = array(); // any non-critical errors will be stored here - var $errors = array(); // any critical errors will be stored here - var $paddedlength = 512; // minimum length of CONT tag in bytes - - function getid3_write_real() { - return true; - } - - function WriteReal() { - // File MUST be writeable - CHMOD(646) at least - if (is_writeable($this->filename)) { - if ($fp_source = @fopen($this->filename, 'r+b')) { - - // Initialize getID3 engine - $getID3 = new getID3; - $OldThisFileInfo = $getID3->analyze($this->filename); - if (empty($OldThisFileInfo['real']['chunks']) && !empty($OldThisFileInfo['real']['old_ra_header'])) { - $this->errors[] = 'Cannot write Real tags on old-style file format'; - fclose($fp_source); - return false; - } - - if (empty($OldThisFileInfo['real']['chunks'])) { - $this->errors[] = 'Cannot write Real tags because cannot find DATA chunk in file'; - fclose($fp_source); - return false; - } - foreach ($OldThisFileInfo['real']['chunks'] as $chunknumber => $chunkarray) { - $oldChunkInfo[$chunkarray['name']] = $chunkarray; - } - if (!empty($oldChunkInfo['CONT']['length'])) { - $this->paddedlength = max($oldChunkInfo['CONT']['length'], $this->paddedlength); - } - - $new_CONT_tag_data = $this->GenerateCONTchunk(); - $new_PROP_tag_data = $this->GeneratePROPchunk($OldThisFileInfo['real']['chunks'], $new_CONT_tag_data); - $new__RMF_tag_data = $this->GenerateRMFchunk($OldThisFileInfo['real']['chunks']); - - if (@$oldChunkInfo['.RMF']['length'] == strlen($new__RMF_tag_data)) { - fseek($fp_source, $oldChunkInfo['.RMF']['offset'], SEEK_SET); - fwrite($fp_source, $new__RMF_tag_data); - } else { - $this->errors[] = 'new .RMF tag ('.strlen($new__RMF_tag_data).' bytes) different length than old .RMF tag ('.$oldChunkInfo['.RMF']['length'].' bytes)'; - fclose($fp_source); - return false; - } - - if (@$oldChunkInfo['PROP']['length'] == strlen($new_PROP_tag_data)) { - fseek($fp_source, $oldChunkInfo['PROP']['offset'], SEEK_SET); - fwrite($fp_source, $new_PROP_tag_data); - } else { - $this->errors[] = 'new PROP tag ('.strlen($new_PROP_tag_data).' bytes) different length than old PROP tag ('.$oldChunkInfo['PROP']['length'].' bytes)'; - fclose($fp_source); - return false; - } - - if (@$oldChunkInfo['CONT']['length'] == strlen($new_CONT_tag_data)) { - - // new data length is same as old data length - just overwrite - fseek($fp_source, $oldChunkInfo['CONT']['offset'], SEEK_SET); - fwrite($fp_source, $new_CONT_tag_data); - fclose($fp_source); - return true; - - } else { - - if (empty($oldChunkInfo['CONT'])) { - // no existing CONT chunk - $BeforeOffset = $oldChunkInfo['DATA']['offset']; - $AfterOffset = $oldChunkInfo['DATA']['offset']; - } else { - // new data is longer than old data - $BeforeOffset = $oldChunkInfo['CONT']['offset']; - $AfterOffset = $oldChunkInfo['CONT']['offset'] + $oldChunkInfo['CONT']['length']; - } - if ($tempfilename = tempnam('*', 'getID3')) { - ob_start(); - if ($fp_temp = fopen($tempfilename, 'wb')) { - - rewind($fp_source); - fwrite($fp_temp, fread($fp_source, $BeforeOffset)); - fwrite($fp_temp, $new_CONT_tag_data); - fseek($fp_source, $AfterOffset, SEEK_SET); - while ($buffer = fread($fp_source, GETID3_FREAD_BUFFER_SIZE)) { - fwrite($fp_temp, $buffer, strlen($buffer)); - } - fclose($fp_temp); - - if (copy($tempfilename, $this->filename)) { - unlink($tempfilename); - fclose($fp_source); - return true; - } - unlink($tempfilename); - $this->errors[] = 'FAILED: copy('.$tempfilename.', '.$this->filename.') - '.strip_tags(ob_get_contents()); - - } else { - - $this->errors[] = 'Could not open '.$tempfilename.' mode "wb" - '.strip_tags(ob_get_contents()); - - } - ob_end_clean(); - } - fclose($fp_source); - return false; - - } - - - } else { - $this->errors[] = 'Could not open '.$this->filename.' mode "r+b"'; - return false; - } - } - $this->errors[] = 'File is not writeable: '.$this->filename; - return false; - } - - function GenerateRMFchunk(&$chunks) { - $oldCONTexists = false; - foreach ($chunks as $key => $chunk) { - $chunkNameKeys[$chunk['name']] = $key; - if ($chunk['name'] == 'CONT') { - $oldCONTexists = true; - } - } - $newHeadersCount = $chunks[$chunkNameKeys['.RMF']]['headers_count'] + ($oldCONTexists ? 0 : 1); - - $RMFchunk = "\x00\x00"; // object version - $RMFchunk .= getid3_lib::BigEndian2String($chunks[$chunkNameKeys['.RMF']]['file_version'], 4); - $RMFchunk .= getid3_lib::BigEndian2String($newHeadersCount, 4); - - $RMFchunk = '.RMF'.getid3_lib::BigEndian2String(strlen($RMFchunk) + 8, 4).$RMFchunk; // .RMF chunk identifier + chunk length - return $RMFchunk; - } - - function GeneratePROPchunk(&$chunks, &$new_CONT_tag_data) { - $old_CONT_length = 0; - $old_DATA_offset = 0; - $old_INDX_offset = 0; - foreach ($chunks as $key => $chunk) { - $chunkNameKeys[$chunk['name']] = $key; - if ($chunk['name'] == 'CONT') { - $old_CONT_length = $chunk['length']; - } elseif ($chunk['name'] == 'DATA') { - if (!$old_DATA_offset) { - $old_DATA_offset = $chunk['offset']; - } - } elseif ($chunk['name'] == 'INDX') { - if (!$old_INDX_offset) { - $old_INDX_offset = $chunk['offset']; - } - } - } - $CONTdelta = strlen($new_CONT_tag_data) - $old_CONT_length; - - $PROPchunk = "\x00\x00"; // object version - $PROPchunk .= getid3_lib::BigEndian2String($chunks[$chunkNameKeys['PROP']]['max_bit_rate'], 4); - $PROPchunk .= getid3_lib::BigEndian2String($chunks[$chunkNameKeys['PROP']]['avg_bit_rate'], 4); - $PROPchunk .= getid3_lib::BigEndian2String($chunks[$chunkNameKeys['PROP']]['max_packet_size'], 4); - $PROPchunk .= getid3_lib::BigEndian2String($chunks[$chunkNameKeys['PROP']]['avg_packet_size'], 4); - $PROPchunk .= getid3_lib::BigEndian2String($chunks[$chunkNameKeys['PROP']]['num_packets'], 4); - $PROPchunk .= getid3_lib::BigEndian2String($chunks[$chunkNameKeys['PROP']]['duration'], 4); - $PROPchunk .= getid3_lib::BigEndian2String($chunks[$chunkNameKeys['PROP']]['preroll'], 4); - $PROPchunk .= getid3_lib::BigEndian2String(max(0, $old_INDX_offset + $CONTdelta), 4); - $PROPchunk .= getid3_lib::BigEndian2String(max(0, $old_DATA_offset + $CONTdelta), 4); - $PROPchunk .= getid3_lib::BigEndian2String($chunks[$chunkNameKeys['PROP']]['num_streams'], 2); - $PROPchunk .= getid3_lib::BigEndian2String($chunks[$chunkNameKeys['PROP']]['flags_raw'], 2); - - $PROPchunk = 'PROP'.getid3_lib::BigEndian2String(strlen($PROPchunk) + 8, 4).$PROPchunk; // PROP chunk identifier + chunk length - return $PROPchunk; - } - - function GenerateCONTchunk() { - foreach ($this->tag_data as $key => $value) { - // limit each value to 0xFFFF bytes - $this->tag_data[$key] = substr($value, 0, 65535); - } - - $CONTchunk = "\x00\x00"; // object version - - $CONTchunk .= getid3_lib::BigEndian2String(strlen(@$this->tag_data['title']), 2); - $CONTchunk .= @$this->tag_data['title']; - - $CONTchunk .= getid3_lib::BigEndian2String(strlen(@$this->tag_data['artist']), 2); - $CONTchunk .= @$this->tag_data['artist']; - - $CONTchunk .= getid3_lib::BigEndian2String(strlen(@$this->tag_data['copyright']), 2); - $CONTchunk .= @$this->tag_data['copyright']; - - $CONTchunk .= getid3_lib::BigEndian2String(strlen(@$this->tag_data['comment']), 2); - $CONTchunk .= @$this->tag_data['comment']; - - if ($this->paddedlength > (strlen($CONTchunk) + 8)) { - $CONTchunk .= str_repeat("\x00", $this->paddedlength - strlen($CONTchunk) - 8); - } - - $CONTchunk = 'CONT'.getid3_lib::BigEndian2String(strlen($CONTchunk) + 8, 4).$CONTchunk; // CONT chunk identifier + chunk length - - return $CONTchunk; - } - - function RemoveReal() { - // File MUST be writeable - CHMOD(646) at least - if (is_writeable($this->filename)) { - if ($fp_source = @fopen($this->filename, 'r+b')) { - - // Initialize getID3 engine - $getID3 = new getID3; - $OldThisFileInfo = $getID3->analyze($this->filename); - if (empty($OldThisFileInfo['real']['chunks']) && !empty($OldThisFileInfo['real']['old_ra_header'])) { - $this->errors[] = 'Cannot remove Real tags from old-style file format'; - fclose($fp_source); - return false; - } - - if (empty($OldThisFileInfo['real']['chunks'])) { - $this->errors[] = 'Cannot remove Real tags because cannot find DATA chunk in file'; - fclose($fp_source); - return false; - } - foreach ($OldThisFileInfo['real']['chunks'] as $chunknumber => $chunkarray) { - $oldChunkInfo[$chunkarray['name']] = $chunkarray; - } - - if (empty($oldChunkInfo['CONT'])) { - // no existing CONT chunk - fclose($fp_source); - return true; - } - - $BeforeOffset = $oldChunkInfo['CONT']['offset']; - $AfterOffset = $oldChunkInfo['CONT']['offset'] + $oldChunkInfo['CONT']['length']; - if ($tempfilename = tempnam('*', 'getID3')) { - ob_start(); - if ($fp_temp = fopen($tempfilename, 'wb')) { - - rewind($fp_source); - fwrite($fp_temp, fread($fp_source, $BeforeOffset)); - fseek($fp_source, $AfterOffset, SEEK_SET); - while ($buffer = fread($fp_source, GETID3_FREAD_BUFFER_SIZE)) { - fwrite($fp_temp, $buffer, strlen($buffer)); - } - fclose($fp_temp); - - if (copy($tempfilename, $this->filename)) { - unlink($tempfilename); - fclose($fp_source); - return true; - } - unlink($tempfilename); - $this->errors[] = 'FAILED: copy('.$tempfilename.', '.$this->filename.') - '.strip_tags(ob_get_contents()); - - } else { - - $this->errors[] = 'Could not open '.$tempfilename.' mode "wb" - '.strip_tags(ob_get_contents()); - - } - ob_end_clean(); - } - fclose($fp_source); - return false; - - - } else { - $this->errors[] = 'Could not open '.$this->filename.' mode "r+b"'; - return false; - } - } - $this->errors[] = 'File is not writeable: '.$this->filename; - return false; - } - -} - -?>
\ No newline at end of file diff --git a/getid3/write.vorbiscomment.php b/getid3/write.vorbiscomment.php deleted file mode 100644 index f93b1a1..0000000 --- a/getid3/write.vorbiscomment.php +++ /dev/null @@ -1,124 +0,0 @@ -<?php -///////////////////////////////////////////////////////////////// -/// getID3() by James Heinrich <info@getid3.org> // -// available at http://getid3.sourceforge.net // -// or http://www.getid3.org // -///////////////////////////////////////////////////////////////// -// See readme.txt for more details // -///////////////////////////////////////////////////////////////// -// // -// write.vorbiscomment.php // -// module for writing VorbisComment tags // -// dependencies: /helperapps/vorbiscomment.exe // -// /// -///////////////////////////////////////////////////////////////// - - -class getid3_write_vorbiscomment -{ - - var $filename; - var $tag_data; - var $warnings = array(); // any non-critical errors will be stored here - var $errors = array(); // any critical errors will be stored here - - function getid3_write_vorbiscomment() { - return true; - } - - function WriteVorbisComment() { - - if (!ini_get('safe_mode')) { - - // Create file with new comments - $tempcommentsfilename = tempnam('*', 'getID3'); - if ($fpcomments = @fopen($tempcommentsfilename, 'wb')) { - - foreach ($this->tag_data as $key => $value) { - foreach ($value as $commentdata) { - fwrite($fpcomments, $this->CleanVorbisCommentName($key).'='.$commentdata."\n"); - } - } - fclose($fpcomments); - - } else { - - $this->errors[] = 'failed to open temporary tags file "'.$tempcommentsfilename.'", tags not written'; - return false; - - } - - $oldignoreuserabort = ignore_user_abort(true); - if (GETID3_OS_ISWINDOWS) { - - if (file_exists(GETID3_HELPERAPPSDIR.'vorbiscomment.exe')) { - //$commandline = '"'.GETID3_HELPERAPPSDIR.'vorbiscomment.exe" -w --raw -c "'.$tempcommentsfilename.'" "'.str_replace('/', '\\', $this->filename).'"'; - // vorbiscomment works fine if you copy-paste the above commandline into a command prompt, - // but refuses to work with `backtick` if there are "doublequotes" present around BOTH - // the metaflac pathname and the target filename. For whatever reason...?? - // The solution is simply ensure that the metaflac pathname has no spaces, - // and therefore does not need to be quoted - - // On top of that, if error messages are not always captured properly under Windows - // To at least see if there was a problem, compare file modification timestamps before and after writing - clearstatcache(); - $timestampbeforewriting = filemtime($this->filename); - - $commandline = GETID3_HELPERAPPSDIR.'vorbiscomment.exe -w --raw -c "'.$tempcommentsfilename.'" "'.$this->filename.'" 2>&1'; - $VorbiscommentError = `$commandline`; - - if (empty($VorbiscommentError)) { - clearstatcache(); - if ($timestampbeforewriting == filemtime($this->filename)) { - $VorbiscommentError = 'File modification timestamp has not changed - it looks like the tags were not written'; - } - } - } else { - $VorbiscommentError = 'vorbiscomment.exe not found in '.GETID3_HELPERAPPSDIR; - } - - } else { - - $commandline = 'vorbiscomment -w --raw -c "'.$tempcommentsfilename.'" "'.$this->filename.'" 2>&1'; - $VorbiscommentError = `$commandline`; - - } - - // Remove temporary comments file - unlink($tempcommentsfilename); - ignore_user_abort($oldignoreuserabort); - - if (!empty($VorbiscommentError)) { - - $this->errors[] = 'system call to vorbiscomment failed with message: '."\n\n".$VorbiscommentError; - return false; - - } - - return true; - } - - $this->errors[] = 'PHP running in Safe Mode (backtick operator not available) - cannot call vorbiscomment, tags not written'; - return false; - } - - function DeleteVorbisComment() { - $this->tag_data = array(array()); - return $this->WriteVorbisComment(); - } - - function CleanVorbisCommentName($originalcommentname) { - // A case-insensitive field name that may consist of ASCII 0x20 through 0x7D, 0x3D ('=') excluded. - // ASCII 0x41 through 0x5A inclusive (A-Z) is to be considered equivalent to ASCII 0x61 through - // 0x7A inclusive (a-z). - - // replace invalid chars with a space, return uppercase text - // Thanks Chris Bolt <chris-getid3Øbolt*cx> for improving this function - // note: ereg_replace() replaces nulls with empty string (not space) - return strtoupper(ereg_replace('[^ -<>-}]', ' ', str_replace("\x00", ' ', $originalcommentname))); - - } - -} - -?>
\ No newline at end of file diff --git a/getstatus.php.bak b/getstatus.php.bak new file mode 100755 index 0000000..368991b --- /dev/null +++ b/getstatus.php.bak @@ -0,0 +1,30 @@ +<?php +header('Content-type: application/json'); +$oldtree = null; +$time = time(); +$i = 0; +while((time() - $time) < 29) +{ + $tree = file_get_contents("status.txt"); + + if ($tree !== $oldtree ) + { + $i+=1; + print $tree; + ob_flush(); + flush(); + } + $data = json_decode($tree); + if ($data->status == "ready") + { + break; + } else if ($data->status == "error") + { + break; + } + $oldtree = $tree; + usleep(1000); + +} + +?> diff --git a/images/0stars.png b/images/0stars.png Binary files differdeleted file mode 100755 index 81947f7..0000000 --- a/images/0stars.png +++ /dev/null diff --git a/images/0starsborder.png b/images/0starsborder.png Binary files differdeleted file mode 100755 index f4d2314..0000000 --- a/images/0starsborder.png +++ /dev/null diff --git a/images/1stars.png b/images/1stars.png Binary files differdeleted file mode 100755 index 12dd9c6..0000000 --- a/images/1stars.png +++ /dev/null diff --git a/images/1starsborder.png b/images/1starsborder.png Binary files differdeleted file mode 100755 index ad21998..0000000 --- a/images/1starsborder.png +++ /dev/null diff --git a/images/2stars.png b/images/2stars.png Binary files differdeleted file mode 100755 index fa7e2b9..0000000 --- a/images/2stars.png +++ /dev/null diff --git a/images/2starsborder.png b/images/2starsborder.png Binary files differdeleted file mode 100755 index 10a2b91..0000000 --- a/images/2starsborder.png +++ /dev/null diff --git a/images/3stars.png b/images/3stars.png Binary files differdeleted file mode 100755 index 7136c3f..0000000 --- a/images/3stars.png +++ /dev/null diff --git a/images/3starsborder.png b/images/3starsborder.png Binary files differdeleted file mode 100755 index 22c5a92..0000000 --- a/images/3starsborder.png +++ /dev/null diff --git a/images/4stars.png b/images/4stars.png Binary files differdeleted file mode 100755 index 0714156..0000000 --- a/images/4stars.png +++ /dev/null diff --git a/images/4starsborder.png b/images/4starsborder.png Binary files differdeleted file mode 100755 index 4a17cee..0000000 --- a/images/4starsborder.png +++ /dev/null diff --git a/images/5stars.png b/images/5stars.png Binary files differdeleted file mode 100755 index 370c60b..0000000 --- a/images/5stars.png +++ /dev/null diff --git a/images/arrow.png b/images/arrow.png Binary files differdeleted file mode 100755 index 9993a06..0000000 --- a/images/arrow.png +++ /dev/null diff --git a/images/background.png b/images/background.png Binary files differdeleted file mode 100755 index 8c4f527..0000000 --- a/images/background.png +++ /dev/null diff --git a/images/checkbox.png b/images/checkbox.png Binary files differdeleted file mode 100755 index 75f0ede..0000000 --- a/images/checkbox.png +++ /dev/null diff --git a/images/home.png b/images/home.png Binary files differdeleted file mode 100755 index 0fc49fc..0000000 --- a/images/home.png +++ /dev/null diff --git a/images/navbutton.png b/images/navbutton.png Binary files differdeleted file mode 100755 index c786de4..0000000 --- a/images/navbutton.png +++ /dev/null diff --git a/images/navbuttonblack.png b/images/navbuttonblack.png Binary files differdeleted file mode 100755 index b7a9bab..0000000 --- a/images/navbuttonblack.png +++ /dev/null diff --git a/images/navbuttonblue.png b/images/navbuttonblue.png Binary files differdeleted file mode 100755 index 97a2c98..0000000 --- a/images/navbuttonblue.png +++ /dev/null diff --git a/images/navleft.png b/images/navleft.png Binary files differdeleted file mode 100755 index a6c05dd..0000000 --- a/images/navleft.png +++ /dev/null diff --git a/images/navleftblack.png b/images/navleftblack.png Binary files differdeleted file mode 100755 index e1eb70f..0000000 --- a/images/navleftblack.png +++ /dev/null diff --git a/images/navlinkleft.png b/images/navlinkleft.png Binary files differdeleted file mode 100755 index 5e59302..0000000 --- a/images/navlinkleft.png +++ /dev/null diff --git a/images/navlinkleftblack.png b/images/navlinkleftblack.png Binary files differdeleted file mode 100755 index 82d1022..0000000 --- a/images/navlinkleftblack.png +++ /dev/null diff --git a/images/navlinkright.png b/images/navlinkright.png Binary files differdeleted file mode 100755 index df5131f..0000000 --- a/images/navlinkright.png +++ /dev/null diff --git a/images/navlinkrightblack.png b/images/navlinkrightblack.png Binary files differdeleted file mode 100755 index ef55084..0000000 --- a/images/navlinkrightblack.png +++ /dev/null diff --git a/images/navright.png b/images/navright.png Binary files differdeleted file mode 100755 index afa269d..0000000 --- a/images/navright.png +++ /dev/null diff --git a/images/navrightblack.png b/images/navrightblack.png Binary files differdeleted file mode 100755 index 80c5b83..0000000 --- a/images/navrightblack.png +++ /dev/null diff --git a/images/pictos/playlist.png b/images/pictos/playlist.png Binary files differdeleted file mode 100644 index 1e6b13d..0000000 --- a/images/pictos/playlist.png +++ /dev/null diff --git a/images/play.gif b/images/play.gif Binary files differdeleted file mode 100755 index 7447d05..0000000 --- a/images/play.gif +++ /dev/null diff --git a/images/radiobutton.png b/images/radiobutton.png Binary files differdeleted file mode 100755 index 45e68fd..0000000 --- a/images/radiobutton.png +++ /dev/null diff --git a/images/searchfield.png b/images/searchfield.png Binary files differdeleted file mode 100755 index 05eb98a..0000000 --- a/images/searchfield.png +++ /dev/null diff --git a/images/tributton.png b/images/tributton.png Binary files differdeleted file mode 100755 index f5c8f55..0000000 --- a/images/tributton.png +++ /dev/null diff --git a/images/pictos/audio.png b/img/audio.png Binary files differindex e0f14a3..e0f14a3 100644 --- a/images/pictos/audio.png +++ b/img/audio.png diff --git a/images/pictos/epg.png b/img/epg.png Binary files differindex 7c09685..7c09685 100644 --- a/images/pictos/epg.png +++ b/img/epg.png diff --git a/images/istreamdev.png b/img/istreamdev.png Binary files differindex f4153e4..f4153e4 100755..100644 --- a/images/istreamdev.png +++ b/img/istreamdev.png diff --git a/img/loading.gif b/img/loading.gif Binary files differnew file mode 100644 index 0000000..6ab75dd --- /dev/null +++ b/img/loading.gif diff --git a/img/mask-55.png b/img/mask-55.png Binary files differnew file mode 100644 index 0000000..182ea20 --- /dev/null +++ b/img/mask-55.png diff --git a/img/mask.png b/img/mask.png Binary files differnew file mode 100644 index 0000000..e35a3f8 --- /dev/null +++ b/img/mask.png diff --git a/images/pictos/media.png b/img/media.png Binary files differindex 647578f..647578f 100755..100644 --- a/images/pictos/media.png +++ b/img/media.png diff --git a/logos/nologoMEDIA.png b/img/nologoMEDIA.png Binary files differindex 6510dbe..6510dbe 100644 --- a/logos/nologoMEDIA.png +++ b/img/nologoMEDIA.png diff --git a/logos/nologoREC.png b/img/nologoREC.png Binary files differindex fd15428..fd15428 100644 --- a/logos/nologoREC.png +++ b/img/nologoREC.png diff --git a/logos/nologoTV.png b/img/nologoTV.png Binary files differindex 4f0a9da..4f0a9da 100644 --- a/logos/nologoTV.png +++ b/img/nologoTV.png diff --git a/img/rec.png b/img/rec.png Binary files differnew file mode 100644 index 0000000..d8744bd --- /dev/null +++ b/img/rec.png diff --git a/img/rec_clicked.png b/img/rec_clicked.png Binary files differnew file mode 100644 index 0000000..a54d5e2 --- /dev/null +++ b/img/rec_clicked.png diff --git a/images/pictos/record.png b/img/record.png Binary files differindex c0a1d79..c0a1d79 100755..100644 --- a/images/pictos/record.png +++ b/img/record.png diff --git a/images/startup.png b/img/startup.png Binary files differindex e095c82..e095c82 100755..100644 --- a/images/startup.png +++ b/img/startup.png diff --git a/img/stream.png b/img/stream.png Binary files differnew file mode 100644 index 0000000..16d66d2 --- /dev/null +++ b/img/stream.png diff --git a/img/stream_clicked.png b/img/stream_clicked.png Binary files differnew file mode 100644 index 0000000..c63595c --- /dev/null +++ b/img/stream_clicked.png diff --git a/images/sw-alpha.png b/img/sw-alpha.png Binary files differindex b80659a..b80659a 100755..100644 --- a/images/sw-alpha.png +++ b/img/sw-alpha.png diff --git a/images/sw-button-cancel.png b/img/sw-button-cancel.png Binary files differindex cea9e38..cea9e38 100755..100644 --- a/images/sw-button-cancel.png +++ b/img/sw-button-cancel.png diff --git a/images/sw-button-done.png b/img/sw-button-done.png Binary files differindex a1e8f32..a1e8f32 100755..100644 --- a/images/sw-button-done.png +++ b/img/sw-button-done.png diff --git a/images/sw-header.png b/img/sw-header.png Binary files differindex db4ec27..db4ec27 100755..100644 --- a/images/sw-header.png +++ b/img/sw-header.png diff --git a/images/sw-slot-border.png b/img/sw-slot-border.png Binary files differindex d9f6026..d9f6026 100755..100644 --- a/images/sw-slot-border.png +++ b/img/sw-slot-border.png diff --git a/images/pictos/timeroff.png b/img/timeroff.png Binary files differindex 1bf58dd..1bf58dd 100644 --- a/images/pictos/timeroff.png +++ b/img/timeroff.png diff --git a/images/pictos/timeron.png b/img/timeron.png Binary files differindex 25ee571..25ee571 100644 --- a/images/pictos/timeron.png +++ b/img/timeron.png diff --git a/images/pictos/timerrec.png b/img/timerrec.png Binary files differindex e4f5617..e4f5617 100644 --- a/images/pictos/timerrec.png +++ b/img/timerrec.png diff --git a/images/pictos/timers.png b/img/timers.png Binary files differindex d7f86e1..d7f86e1 100644 --- a/images/pictos/timers.png +++ b/img/timers.png diff --git a/images/pictos/tv.png b/img/tv.png Binary files differindex 74f9fdc..74f9fdc 100755..100644 --- a/images/pictos/tv.png +++ b/img/tv.png diff --git a/images/pictos/video.png b/img/video.png Binary files differindex 090114a..090114a 100644 --- a/images/pictos/video.png +++ b/img/video.png diff --git a/includes/inc_audio.php b/includes/inc_audio.php deleted file mode 100755 index 2960aa5..0000000 --- a/includes/inc_audio.php +++ /dev/null @@ -1,128 +0,0 @@ -<?php - -global $httppath; - -$mediapath = $_REQUEST['mediapath']; -$subdir = $_REQUEST['subdir']; - -/* Add last slash to dirs */ -if ($mediapath[strlen($mediapath)-1] != '/') - $mediapath = $mediapath .'/'; -if ($subdir[strlen($subdir)-1] != '/') - $subdir = $subdir .'/'; - -print "<body class=\"ipodlist\">\r\n"; -print "<div id=\"topbar\" class=\"transparent\">\r\n"; - -print "<div id=\"leftnav\">\r\n"; -if ($subdir == '/') - print " <a href=\"index.php\"><img alt=\"home\" src=\"images/home.png\" /></a></div>\r\n"; -else -{ - print " <a href=\"javascript:sendForm('getback')\">Back</a></div>\r\n"; - print "<div id=\"rightnav\">\r\n"; - print " <a href=\"index.php\"><img alt=\"home\" src=\"images/home.png\" /></a></div>\r\n"; -} - -print "<div id=\"title\">iStreamdev</div>\r\n"; -print "</div>\r\n"; -print "<div id=\"content\">\r\n"; -print " <ul>\r\n"; - -$dir_handle = @opendir($mediapath .$subdir); -if (!$dir_handle) - print "Unable to open $mediapath .$subdir"; -else while ($medianame = readdir($dir_handle)) -{ - // Add only mp3 files and dirs - if($medianame == "." || $medianame == ".." || $medianame == 'lost+found') - continue; - - $type = mediagettype($mediapath .$subdir .$medianame); - if (($type != 2) && ($type != 3)) - continue; - - $medianame_array[] = $medianame; -} - -if ($medianame_array[0]) -{ - // Alphabetical sorting - sort($medianame_array); - - $count = count($medianame_array); - - // Directories - for ($cnt=0; $cnt < $count; $cnt++) - { - if (mediagettype($mediapath .$subdir .$medianame_array[$cnt]) == 3) - { - $medianame2=addslashes($medianame_array[$cnt]); - - print " <li>\r\n"; - print " <a class=\"noeffect\" href=\"javascript:sendForm('dir_$medianame2');\">\r\n"; - print " <span class=\"name\">{$medianame_array[$cnt]}</span><span class=\"time\">></span>\r\n"; - print " </a>\r\n"; - print " </li>\r\n"; - print " <form name=\"dir_{$medianame_array[$cnt]}\" id=\"dir_{$medianame_array[$cnt]}\" method=\"post\" action=\"index.php\">\r\n"; - print " <input name=\"action\" type=\"hidden\" id=\"action\" value=\"audio\"/>\r\n"; - print " <input name=\"mediapath\" type=\"hidden\" id=\"mediapath\" value=\"{$mediapath}\" />\r\n"; - print " <input name=\"subdir\" type=\"hidden\" id=\"subdir\" value=\"{$subdir}{$medianame_array[$cnt]}\" />\r\n"; - print " </form>\r\n"; - } - } - - - // Music files - $idx = 1; - for ($cnt=0; $cnt < $count; $cnt++) - { - $medianame2=addslashes($medianame_array[$cnt]); - $mediapath2=addslashes($mediapath); - $subdir2=addslashes($subdir); - - // Audio - if (mediagettype($mediapath .$subdir .$medianame_array[$cnt]) == 2) - { - print " <li>\r\n"; - - unset($track); - - for ($cnt2=$cnt; $cnt2<$count; $cnt2++) - { - if (mediagettype($mediapath .$subdir .$medianame_array[$cnt2]) == 2) - $track[$cnt2-$cnt] = $httppath ."playlist/" .addslashes($medianame_array[$cnt2]); - - } - $jsarray = php2js($track); - - print " <a class=\"noeffect\" href=\"javascript:var myarray = new Array({$jsarray});addplayer('{$mediapath2}{$subdir2}','{$medianame2}',myarray);document.player.Play();\">\r\n"; - - // Get song info - list($name, $duration) = mediagetmusicinfo($mediapath .$subdir .$medianame_array[$cnt]); - - print " <span class=\"number\">$idx</span><span class=\"stop\"></span><span class=\"name\">{$name}</span><span class=\"time\">{$duration}</span>\r\n"; - print " </a>\r\n"; - print " </li>\r\n"; - - $idx++; - } - } -} - -print "</div>\r\n"; - -$upsubdir = dirname($subdir); - -print " <form name=\"getback\" id=\"getback\" method=\"post\" action=\"index.php\">\r\n"; -print " <input name=\"action\" type=\"hidden\" id=\"action\" value=\"audio\" />\r\n"; -print " <input name=\"mediapath\" type=\"hidden\" id=\"mediapath\" value=\"{$mediapath}\" />\r\n"; -print " <input name=\"subdir\" type=\"hidden\" id=\"subdir\" value=\"{$upsubdir}\" />\r\n"; -print " </form>\r\n"; - -print "<div style=\"position:absolute; left:0; top:0\" name=\"div_player\" id=\"div_player\">\r\n"; - -print("</div>"); - -?> - diff --git a/includes/inc_auth.php b/includes/inc_auth.php deleted file mode 100755 index 1545b7c..0000000 --- a/includes/inc_auth.php +++ /dev/null @@ -1,36 +0,0 @@ -<?php - -global $user, $pass; - -session_start(); - -if (isset($_COOKIE['istream'])) -{ - if(sha1($pass) == $_COOKIE['istream'] ) { - setcookie ("istream", sha1($pass), time()+60*60*24*30); - $authorized = true; - } else { - $authorised = false; - } -} - -# checkup login and password -if (isset($_SERVER['PHP_AUTH_USER']) && isset($_SERVER['PHP_AUTH_PW'])) -{ - if (($user == $_SERVER['PHP_AUTH_USER']) && ($pass == ($_SERVER['PHP_AUTH_PW'])) ) - { - setcookie ("istream", sha1($pass), time()+60*60*24*30); - $authorized = true; - } -} - -# login -if (!$authorized) -{ - header('WWW-Authenticate: Basic Realm="Login please"'); - header('HTTP/1.0 401 Unauthorized'); - echo "Login"; - exit; -} - -?> diff --git a/includes/inc_cat.php b/includes/inc_cat.php deleted file mode 100755 index 0b107d3..0000000 --- a/includes/inc_cat.php +++ /dev/null @@ -1,17 +0,0 @@ -<?php - -print "<body onorientationchange=\"updateOrientation();\" onload=\"updateOrientation();\">\r\n"; -print "<div id=\"topbar\" class=\"transparent\">\r\n"; -print "<div id=\"leftnav\">\r\n"; -print "<a href=\"index.php\"><img alt=\"home\" src=\"images/home.png\" /></a></div>\r\n"; -print "<div id=\"title\">iStreamdev</div>\r\n"; -print "</div>\r\n"; -print "<div id=\"content\">\r\n"; -print " <span class=\"graytitle\">Category</span>\r\n"; -print " <ul class=\"pageitem\">\r\n"; - -vdrlistcategories(); - -print " </ul>"; -print "</div>\r\n"; -?> diff --git a/includes/inc_chan.php b/includes/inc_chan.php deleted file mode 100755 index ff73df6..0000000 --- a/includes/inc_chan.php +++ /dev/null @@ -1,24 +0,0 @@ -<?php - -$cat = $_REQUEST['cat']; - -$_SESSION['currentcat'] = $cat; - -print "<body class=\"list\" onorientationchange=\"updateOrientation();\" onload=\"updateOrientation();\">\r\n"; -print "<div id=\"topbar\" class=\"transparent\">\r\n"; - -print "<div id=\"leftnav\">\r\n"; -print "<a href=\"javascript:sendForm('getback')\">Back</a></div>\r\n"; -print "<div id=\"rightnav\">\r\n"; -print "<a href=\"index.php\"><img alt=\"home\" src=\"images/home.png\" /></a></div>\r\n"; -print "<div id=\"title\">iStreamdev</div>\r\n"; -print "</div>\r\n"; -print "<div id=\"content\">\r\n"; -print " <ul><li class=\"title\">$cat</li>\r\n"; - -vdrlistchannels($cat); - -print " </ul>"; -print "</div>\r\n"; -print " <form name=\"getback\" id=\"getback\" method=\"post\" action=\"index.php\"><input name=\"action\" type=\"hidden\" id=\"action\" value=\"listcategory\" /></form>\r\n"; -?> diff --git a/includes/inc_edittimer.php b/includes/inc_edittimer.php deleted file mode 100755 index 8babf0c..0000000 --- a/includes/inc_edittimer.php +++ /dev/null @@ -1,158 +0,0 @@ -<?php - -print "<body onorientationchange=\"updateOrientation();\" onload=\"updateOrientation();\">\r\n"; -print "<div id=\"topbar\" class=\"transparent\">\r\n"; -print "<div id=\"leftnav\">\r\n"; -print "<a href=\"javascript:sendForm('getback')\">Back</a></div>\r\n"; -print "<div id=\"rightnav\">\r\n"; -print "<a href=\"index.php\"><img alt=\"home\" src=\"images/home.png\" /></a></div>\r\n"; -print "<div id=\"title\">iStream</div>\r\n"; -print "</div>\r\n"; -$timer = $_REQUEST['timer']; -if ($timer == -1) - print "<div id=\"content\"> <span class=\"graytitle\">New Timer</span>\r\n"; -else - print "<div id=\"content\"> <span class=\"graytitle\">Edit Timer</span>\r\n"; - -list($type, $channame, $date, $stime, $etime, $desc) = vdrgettimerinfo($timer); - -// Timer name -print "<form name=\"timer\" id=\"timer\" method=\"post\" action=\"index.php\" onsubmit='return checkform()'>\r\n"; -print " <ul class=\"pageitem\">\r\n"; -if ($type & 0x1) - print " <li class=\"checkbox\"><span class=\"name\">Active</span><input name=\"timer_active\" type=\"checkbox\" checked/></li>\r\n"; -else - print " <li class=\"checkbox\"><span class=\"name\">Active</span><input name=\"timer_active\" type=\"checkbox\"/></li>\r\n"; -print " </ul>\r\n"; -print " <ul class=\"pageitem\">\r\n"; -print " <li class=\"textbox\"><span class=\"header\">Recording name</span></li>\r\n"; -print " <li class=\"bigfield\">\r\n"; - -if ($timer==-1) -{ -print " <input type=\"text\" placeholder=\"Enter recording name\" name=\"timer_name\" value=\"\" />\r\n"; -} -else -{ -print " <input type=\"text\" placeholder=\"Enter recording name\" name=\"timer_name\" value=\"{$desc}\" />\r\n"; -} -print " </li>\r\n"; -print " </ul>\r\n"; -print " <ul class=\"pageitem\">\r\n"; -print " <li class=\"textbox\"><span class=\"header\">Channel</span></li>\r\n"; -print " <li class=\"select\">\r\n"; - -// Channel selection -print " <select name=\"timer_chan\">\r\n"; - -vdrlistchannelsdrop($channame); - -print " </select>\r\n"; -print " <span class=\"arrow\"></span>"; -print " </li>\r\n"; -print " </ul>\r\n"; - -// Date selection -print " <ul class=\"pageitem\">\r\n"; -print " <li class=\"textbox\"><span class=\"header\">Date</span></li>\r\n"; - -$datearray = explode("-", $date); - -print " <li class=\"menu\"><a class=\"noeffect\" href=\"javascript:openSelectDate({$datearray[0]},{$datearray[1]},{$datearray[2]})\">\r\n"; - -if ($timer == -1) -{ -print " <span class=\"name\" id=\"layer_date\">Select date</span><span class=\"arrow\"></span></a>"; -} -else -{ -print " <span class=\"name\" id=\"layer_date\">{$date}</span><span class=\"arrow\"></span></a>"; - -} - -print " </li>\r\n"; -print " </ul>\r\n"; - -// Start/End time selection -print " <ul class=\"pageitem\">\r\n"; -print " <li class=\"textbox\"><span class=\"header\">Start time</span></li>\r\n"; - -$smin = substr($stime, 0, 2); -$ssec = substr($stime, 2); - -print " <li class=\"menu\">"; -print " <a class=\"noeffect\" href=\"javascript:openSelectTime('layer_starttime',{$smin}, {$ssec})\">\r\n"; - -if ($timer == -1) -{ -print " <span class=\"name\" id=\"layer_starttime\">Select start time</span>"; -} -else -{ -print " <span class=\"name\" id=\"layer_starttime\">{$smin}h{$ssec}</span>"; -} -print " <span class=\"arrow\"></span>"; -print " </a>"; -print " </li>\r\n"; -print " </ul>\r\n"; -print " <ul class=\"pageitem\">\r\n"; -print " <li class=\"textbox\"><span class=\"header\">End time</span></li>\r\n"; - -$emin = substr($etime, 0, 2); -$esec = substr($etime, 2); - -print " <li class=\"menu\"><a class=\"noeffect\" href=\"javascript:openSelectTime('layer_endtime',{$emin},{$esec})\">\r\n"; -if ($timer == -1) -{ -print " <span class=\"name\" id=\"layer_endtime\">Select end time</span><span class=\"arrow\"></span></a></li>\r\n"; -} -else -{ -print " <span class=\"name\" id=\"layer_endtime\">{$emin}h{$esec}</span><span class=\"arrow\"></span></a></li>\r\n"; -} -print " </ul>\r\n"; -print "<input name=\"action\" type=\"hidden\" id=\"action\" value=\"addtimer\"/>\r\n"; - -if ($timer == -1) -{ -print "<input name=\"timer_date\" type=\"hidden\" id=\"timer_date\" value=\"\" />\r\n"; -print "<input name=\"timer_starttime\" type=\"hidden\" id=\"timer_starttime\" value=\"\" />\r\n"; -print "<input name=\"timer_endtime\" type=\"hidden\" id=\"timer_endtime\" value=\"\" />\r\n"; -} -else -{ -print "<input name=\"timer_date\" type=\"hidden\" id=\"timer_date\" value=\"{$date}\" />\r\n"; -print "<input name=\"timer_starttime\" type=\"hidden\" id=\"timer_starttime\" value=\"{$smin}{$ssec}\" />\r\n"; -print "<input name=\"timer_endtime\" type=\"hidden\" id=\"timer_endtime\" value=\"{$emin}{$esec}\" />\r\n"; -} - -print "<input name=\"prevtimer\" type=\"hidden\" id=\"prevtimer\" value=\"{$timer}\" />\r\n"; - -print "<ul class=\"pageitem\">\r\n"; -print "<li class=\"button\">\r\n"; -if ($timer == -1){ - print " <input name=\"Update\" type=\"Submit\" value=\"Create\" /></li>\r\n"; -} -else -{ - print " <input name=\"Update\" type=\"Submit\" value=\"Update\" /></li>\r\n"; -} -print "</ul>\r\n"; -print "</form>\r\n"; - -if ($timer != -1) -{ - print "<form name=\"deltimer\" id=\"deltimer\" method=\"post\" action=\"index.php\">\r\n"; - print " <input name=\"action\" type=\"hidden\" id=\"action\" value=\"deletetimer\" />\r\n"; - print " <input name=\"timer\" type=\"hidden\" id=\"timer\" value=\"{$timer}\" />\r\n"; - print " <ul class=\"pageitem\">\r\n"; - print " <li class=\"button\">\r\n"; - print " <input name=\"Submit\" type=\"submit\" value=\"Delete\" /></li>\r\n"; - print "</ul>\r\n"; - print "</form>\r\n"; -} - -print "</div>\r\n"; -print "<form name=\"getback\" id=\"getback\" method=\"post\" action=\"index.php\"><input name=\"action\" type=\"hidden\" id=\"action\" value=\"timers\" /></form>\r\n"; - -?> diff --git a/includes/inc_epg.php b/includes/inc_epg.php deleted file mode 100755 index 721cc9f..0000000 --- a/includes/inc_epg.php +++ /dev/null @@ -1,15 +0,0 @@ -<?php -print "<body onorientationchange=\"updateOrientation();\" onload=\"updateOrientation();\">\r\n"; -print "<div id=\"topbar\" class=\"transparent\">\r\n"; -print "<div id=\"leftnav\">\r\n"; -print "<a href=\"index.php\"><img alt=\"home\" src=\"images/home.png\" /></a></div>\r\n"; -print "<div id=\"title\">iStreamdev</div>\r\n"; -print "</div>\r\n"; -print "<div id=\"content\">\r\n"; -print " <span class=\"graytitle\">Program Guide</span>\r\n"; -print " <ul class=\"pageitem\">"; -print " <li class=\"textbox\"><span class=\"header\">Incoming feature</span"; -print " <p>To do...</p></li>"; -print "</div>\r\n"; -?> - diff --git a/includes/inc_files.php b/includes/inc_files.php deleted file mode 100755 index 60bc4f2..0000000 --- a/includes/inc_files.php +++ /dev/null @@ -1,172 +0,0 @@ -<?php - -$audiotypes='mp3 aac wav '; - -function mediagetinfostream($stream) -{ - // Get info - $getid3 = new getID3; - $fileinfo = $getid3->analyze($stream); - - $title = "Media:"; - $info = "Duration: <i>" .sec2hms($fileinfo['playtime_seconds']) ."</i><br>"; - if ($fileinfo['fileformat']) - $info .= "Format: <i>" .$fileinfo['fileformat'] ."</i><br>"; - if ($fileinfo['video']['codec']) - $info .= "Video: <i>" .$fileinfo['video']['codec'] ."</i><br>"; - if ($fileinfo['audio']['codec']) - $info .= "Audio: <i>" .$fileinfo['audio']['codec'] ."</i><br>"; - if ($fileinfo['video']['resolution_x']) - $info .= "Resolution: <i>" .$fileinfo['video']['resolution_x'] ."x" .$fileinfo['video']['resolution_y'] ."</i><br>"; - - return array($title, $info); -} - -function mediagentb($stream, $dest) -{ - global $ffmpegpath; - - // Get info - $getid3 = new getID3; - $fileinfo = $getid3->analyze($stream); - - exec("rm " .$dest); - $path = dirname($stream); - - if (file_exists(substr($stream, 0, -4) .".tbn")) - $file = substr($stream, 0, -4) .".tbn"; - else if (file_exists($path ."/poster.jpg")) - $file = $path ."/poster.jpg"; - else if (file_exists($path ."/folder.jpg")) - $file = $path ."/folder.jpg"; - else - $file = ""; - - $resx = 180; - $resy = 100; - - if ($file) - { - $getid3 = new getID3; - $fileinfo = $getid3->analyze($file); - } - - if ($fileinfo['video']['resolution_y'] && $fileinfo['video']['resolution_x']) - { - if ($fileinfo['video']['resolution_y'] < $fileinfo['video']['resolution_x']) - { - $resx = 180; - $resy = round(($fileinfo['video']['resolution_y'] * 180) / $fileinfo['video']['resolution_x']); - } - else - { - $resx = round (($fileinfo['video']['resolution_x'] * 100) / $fileinfo['video']['resolution_y']); - $resy = 100; - } - } - - if ($file) - exec("cp \"" .$file ."\" ram/stream-tb-tmp.jpg; " .$ffmpegpath ." -y -i ram/stream-tb-tmp.jpg -s " .$resx ."x" .$resy ." " .$dest ." ; rm ram/stream-tb-tmp.jpg"); - else - exec($ffmpegpath ." -y -i \"" .$stream ."\" -an -ss 00:00:05.00 -r 1 -vframes 1 -s " .$resx ."x" .$resy ." -f mjpeg " .$dest); - - if (!file_exists($dest)) - exec('cp logos/nologoMEDIA.png ' .$dest); -} - -function mediagetwidth($file) -{ - - $getid3 = new getID3; - $fileinfo = $getid3->analyze($file); - - return $fileinfo['video']['resolution_x']; -} - -function mediagettype($file) -{ - global $videotypes, $audiotypes; - - // Get file extension - $fileext = end(explode(".", $file)); - $file = str_replace("\\'", "'", $file); - - if (is_dir($file)) - return 3; - else if (preg_match("$/$", $fileext)) - return 0; - else if (preg_match("/" .$fileext ." /", $videotypes)) - return 1; - else if (preg_match("/" .$fileext ." /", $audiotypes)) - return 2; - else - return 0; -} - -function mediadirhasaudio($dir) -{ - global $audiotypes; - - $audioextarray = explode(' ', $audiotypes); - - foreach ($audioextarray as $num => $audioext) - { - if (glob($dir .'*.' .$audioext)) - return 1; - } - - return 0; -} - -function mediagetmusicinfo($file ="") -{ - // Get info - $getid3 = new getID3; - $fileinfo = $getid3->analyze($file); - - $name = $fileinfo['tags']['id3v2']['title'][0]; - if ($name == "") - { - $name = $fileinfo['tags']['id3v1']['title'][0]; - if ($name == "") - { - $name = $fileinfo['filename']; - if ($name == "") - $name = "unknown"; - } - } - - if (!is_utf8($name)) - $name = utf8_encode($name); - - $duration = $fileinfo['playtime_string']; - - return array ($name, $duration); -} - -function generatelogo($type, $name, $dest) -{ - switch ($type) - { - case 1: - $channoslash = preg_replace("$/$", " ", $name); - $logopath = "logos/" .$channoslash .".png"; - if (!file_exists($logopath)) - $logopath = "logos/nologoTV.png"; - exec("cp \"" .$logopath ."\" " .$dest); - break; - case 2: - $channoslash = preg_replace("$/$", " ", $name); - $logopath = "logos/" .$channoslash .".png"; - if (!file_exists($logopath)) - $logopath = "logos/nologoREC.png"; - exec("cp \"" .$logopath ."\" " .$dest); - break; - case 3: - // Generate TB - mediagentb($name, $dest); - break; - } -} - -?> diff --git a/includes/inc_home.php b/includes/inc_home.php deleted file mode 100755 index f38518c..0000000 --- a/includes/inc_home.php +++ /dev/null @@ -1,135 +0,0 @@ -<?php
-
-global $vdrenabled, $vdrrecpath, $mediasources;
-
-print "<body onorientationchange=\"updateOrientation();\" onload=\"updateOrientation();\">\r\n";
-print "<div id=\"topbar\" class=\"transparent\">\r\n";
-print "<div id=\"title\">iStreamdev</div>\r\n";
-print "</div>\r\n";
-print "<div id=\"content\">\r\n";
-
-$sessioncnt = 0;
-
-print " <span class=\"graytitle\">SESSIONS</span>\r\n";
-print " <ul class=\"pageitem\">\r\n";
-
-// Streaming in progress
-$dir_handle = @opendir('ram/');
-if ($dir_handle)
-{
- while ($session = readdir($dir_handle))
- {
- if($session == "." || $session == ".." || $session == 'lost+found')
- continue;
-
- if (!is_dir('ram/' .$session))
- continue;
-
- // Get info
- list($type, $realname, $title, $desc, $mode, $category, $url, $mediapath, $subdir) = readinfostream($session);
-
- switch ($type)
- {
- case 1:
- $sessionname = "Live: ";
- $picto = "tv";
- break;
- case 2:
- $sessionname = "Rec: ";
- $picto = "record";
- break;
- case 3:
- $sessionname = "Media: ";
- $picto = "media";
- break;
- default:
- continue;
- }
-
- // Check if encoding
- if (file_exists('ram/' .$session .'/segmenter.pid'))
- $sessionname = "*" .$sessionname;
-
- $sessioncnt++;
-
- $sessionname .= $realname;
-
- print " <li class=\"menu\">";
- print " <a href=\"javascript:sendForm('{$session}');\">";
- print " <img src=\"images/pictos/{$picto}.png\" />";
- print " <span class=\"name\">{$sessionname}</span><span class=\"arrow\"></span>";
- print " </a>";
- print " </li>\r\n";
- print " <form name=\"{$session}\" id=\"{$session}\" method=\"post\" action=\"index.php\">";
- print " <input name=\"action\" type=\"hidden\" id=\"action\" value=\"streaming\" />";
- print " <input name=\"session\" type=\"hidden\" id=\"session\" value=\"{$session}\" />";
- print " </form>\r\n";
- }
-
- closedir($dir_handle);
-}
-
-if (!$sessioncnt)
-{
- print " <li class=\"textbox\"><p>none</p></li>\r\n";
- print "</ul>\r\n";
-}
-else
-{
- print "</ul>\r\n";
- print "<form name=\"killall\" id=\"killall\" method=\"post\" action=\"index.php\">\r\n";
- print " <input name=\"action\" type=\"hidden\" id=\"action\" value=\"stopallstreamings\" />\r\n";
- print " <ul class=\"pageitem\">\r\n";
- print " <li class=\"button\">\r\n";
- print " <input name=\"Submit\" type=\"submit\" value=\"Delete all sessions\" /></li>\r\n";
- print "</ul>\r\n";
- print "</form>\r\n";
-}
-
-// VDR menus
-if ($vdrenabled)
-{
- print " <span class=\"graytitle\">VDR</span>\r\n";
- print " <ul class=\"pageitem\">\r\n";
- print " <li class=\"menu\"><a href=\"javascript:sendForm('channels');\"><img src=\"images/pictos/tv.png\" /><span class=\"name\">Channels</span><span class=\"arrow\"></span></a></li>\r\n";
- print " <form name=\"channels\" id=\"channels\" method=\"post\" action=\"index.php\"><input name=\"action\" type=\"hidden\" id=\"action\" value=\"listcategory\" /></form>\r\n";
- print " <li class=\"menu\"><a class=\"noeffect\" href=\"javascript:sendForm('recordings');\"><img src=\"images/pictos/record.png\" /><span class=\"name\">Recordings</span><span class=\"arrow\"></span></a></li>\r\n";
- print " <form name=\"recordings\" id=\"recordings\" method=\"post\" action=\"index.php\"><input name=\"action\" type=\"hidden\" id=\"action\" value=\"recordings\" /><input name=\"dir\" type=\"hidden\" id=\"dir\" value=\"{$vdrrecpath}\" /></form>\r\n";
- print " <li class=\"menu\"><a class=\"noeffect\" href=\"javascript:sendForm('epg');\"><img src=\"images/pictos/epg.png\" /><span class=\"name\">Program Guide</span><span class=\"arrow\"></span></a></li>\r\n";
- print " <form name=\"epg\" id=\"epg\" method=\"post\" action=\"index.php\"><input name=\"action\" type=\"hidden\" id=\"action\" value=\"epg\" /></form>\r\n";
- print " <li class=\"menu\"><a class=\"noeffect\" href=\"javascript:sendForm('timers');\"><img src=\"images/pictos/timers.png\" /><span class=\"name\">Timers</span><span class=\"arrow\"></span></a></li>\r\n";
- print " <form name=\"timers\" id=\"timers\" method=\"post\" action=\"index.php\"><input name=\"action\" type=\"hidden\" id=\"action\" value=\"timers\" /></form>\r\n";
- print " </ul>";
-}
-
-// Media menus
-print " <span class=\"graytitle\">MEDIA</span>\r\n";
-print " <ul class=\"pageitem\">\r\n";
-foreach($mediasources as $source)
-{
- $stype = $source[0];
- $sname = $source[1];
- $spath = $source[2];
-
- print " <li class=\"menu\">\r\n";
- print " <a class=\"noeffect\" href=\"javascript:sendForm('media {$sname} {$spath}');\">\r\n";
- if ($stype == 1)
- print " <img src=\"images/pictos/video.png\" />\r\n";
- else
- print " <img src=\"images/pictos/audio.png\" />\r\n";
- print " <span class=\"name\">{$sname}</span>\r\n";
- print " <span class=\"arrow\"></span>\r\n";
- print " </a>\r\n";
- print " </li>\r\n";
- print " <form name=\"media\" id=\"media {$sname} {$spath}\" method=\"post\" action=\"index.php\">\r\n";
- if ($stype == 1)
- print " <input name=\"action\" type=\"hidden\" id=\"action\" value=\"video\" />\r\n";
- else
- print " <input name=\"action\" type=\"hidden\" id=\"action\" value=\"audio\" />\r\n";
- print " <input name=\"mediapath\" type=\"hidden\" id=\"mediapath\" value=\"{$spath}\" />\r\n";
- print " <input name=\"subdir\" type=\"hidden\" id=\"subdir\" value=\"/\" />\r\n";
- print " </form>\r\n";
-}
-print " </ul>";
-print "</div>";
-?>
diff --git a/includes/inc_rec.php b/includes/inc_rec.php deleted file mode 100755 index 63b757e..0000000 --- a/includes/inc_rec.php +++ /dev/null @@ -1,87 +0,0 @@ -<?php - -global $vdrrecpath; - -$dir = $_REQUEST['dir']; -if ($dir == "") - $dir = $vdrrecpath; - -// Get current subdir -$subdir = preg_replace("'" .quotemeta($vdrrecpath) ."'", '', $dir); - -print "<body onorientationchange=\"updateOrientation();\" onload=\"updateOrientation();\">\r\n"; -print "<div id=\"topbar\" class=\"transparent\">\r\n"; -print "<div id=\"leftnav\">\r\n"; -if ($dir == $vdrrecpath) - print "<a href=\"index.php\"><img alt=\"home\" src=\"images/home.png\" /></a></div>\r\n"; -else - print "<a href=\"javascript:sendForm('getback')\">Back</a></div>\r\n"; -if ($dir != $vdrrecpath) -{ -print "<div id=\"rightnav\">\r\n"; -print "<a href=\"index.php\"><img alt=\"home\" src=\"images/home.png\" /></a></div>\r\n"; -} -print "<div id=\"title\">iStreamdev</div>\r\n"; -print "</div>\r\n"; -print "<div id=\"content\">\r\n"; -print " <span class=\"graytitle\">Recordings</span>\r\n"; -print "<br>"; -print " <span class=\"graytitle\">" . stripslashes($subdir) . "</span>\r\n"; -print " <ul class=\"pageitem\">"; - -$dir = stripslashes($dir); - -$dir_handle = @opendir($dir); -if (!$dir_handle) -{ - print "Unable to open $dir"; -} -else while ($recname = readdir($dir_handle)) -{ - if($recname == "." || $recname == ".." || $recname == "epg.data" || $recname == 'lost+found') - continue; - - $recname2 = addslashes($recname); - - $date = preg_replace('/-/', '/', substr($recname2, 0, 10)); - $time = preg_replace('/\./', 'h', substr($recname2, 11, 5)); - $recnice = $date .' at ' .$time; - - if (strstr($recname, ".rec") == ".rec") - { - - $date = preg_replace('/-/', '/', substr($recname, 0, 10)); - $time = preg_replace('/\./', 'h', substr($recname, 11, 5)); - $recnice = $date .' at ' .$time; - - print "<li class=\"menu\"><a class=\"noeffect\" href=\"javascript:sendForm('$recname2');\"><span class=\"name\">$recnice</span><span class=\"arrow\"></span></a></li>\r\n"; - print "<form name=\"$recname\" id=\"$recname\" method=\"post\" action=\"index.php\">"; - print " <input name=\"action\" type=\"hidden\" id=\"action\" value=\"stream\"/>"; - print " <input name=\"type\" type=\"hidden\" id=\"type\" value=2 />"; - print " <input name=\"name\" type=\"hidden\" id=\"name\" value=\"{$dir}/{$recname}\" />"; - print "</form>\r\n"; - } - else - { - $recnice = $recname; - if ($recnice[0] == '@') - $recnice = substr($recnice, 1); - $recnice = preg_replace('/\_/', ' ', $recnice); - - print "<li class=\"menu\"><a class=\"noeffect\" href=\"javascript:sendForm('$recname2');\"><span class=\"name\">$recnice</span><span class=\"arrow\"></span></a></li>\r\n"; - print "<form name=\"$recname\" id=\"$recname\" method=\"post\" action=\"index.php\">"; - print " <input name=\"action\" type=\"hidden\" id=\"action\" value=\"recordings\"/>"; - print " <input name=\"dir\" type=\"hidden\" id=\"dir\" value=\"{$dir}/{$recname}\" />"; - print "</form>\r\n"; - } -} - -$updir = dirname($dir); - -print "<form name=\"getback\" id=\"getback\" method=\"post\" action=\"index.php\"><input name=\"action\" type=\"hidden\" id=\"action\" value=\"recordings\"/><input name=\"dir\" type=\"hidden\" id=\"dir\" value=\"{$updir}/\" /></form>\r\n"; - -if ($dir_handle) - closedir($dir_handle); - -print "</ul></div>\r\n"; -?> diff --git a/includes/inc_session.php b/includes/inc_session.php deleted file mode 100755 index 2e10155..0000000 --- a/includes/inc_session.php +++ /dev/null @@ -1,88 +0,0 @@ -<?php - -function sessioncreate($type, $name, $title, $desc, $qname, $qparams, $category, $url, $mediapath, $subdir) -{ - global $httppath, $ffmpegpath, $segmenterpath; - - // Get a free session - $i=0; - for ($i=0; $i<1000; $i++) - { - $session = "session" .$i; - if (!file_exists('ram/' .$session)) - break; - } - - // Create session - exec('mkdir ram/' .$session); - $url = str_replace("\\'", "'", $url); - switch ($type) - { - case 1: - $cmd = "export SHELL=\"/bin/sh\";printf \"./istream.sh \\\"" .$url ."\\\" " .$qparams ." " .$httppath ." 2 " .$ffmpegpath ." " .$segmenterpath ." " .$session ." \" | at now"; - break; - case 2: - $cmd = "export SHELL=\"/bin/sh\";printf \"cat \\\"" .$url ."\\\"/0* | ./istream.sh - " .$qparams ." " .$httppath ." 1260 " .$ffmpegpath ." " .$segmenterpath ." " .$session ." \" | at now"; - break; - case 3: - $cmd = "export SHELL=\"/bin/sh\";printf \"./istream.sh \\\"" .$url ."\\\" " .$qparams ." " .$httppath ." 1260 " .$ffmpegpath ." " .$segmenterpath ." " .$session ." \" | at now"; - break; - default: - $cmd = ""; - } - - $cmd = str_replace('%', '%%', $cmd); - exec ($cmd); - - // Write streaminfo - writeinfostream($session, $type, $name, $title, $desc, $qname, $category, $url, $mediapath, $subdir); - - // Create logo - if ($type == 3) - generatelogo($type, $url, 'ram/' .$session .'/logo.png'); - else - generatelogo($type, $name, 'ram/' .$session .'/logo.png'); - - return $session; -} - -function sessiondelete($session) -{ - if ($session == 'all') - { - $dir_handle = @opendir('ram/'); - if ($dir_handle) - { - while ($session = readdir($dir_handle)) - { - if($session == "." || $session == ".." || $session == 'lost+found') - continue; - - if (!is_dir('ram/' .$session)) - continue; - - // Get info - list($type, $realname, $title, $desc, $mode, $category, $url, $mediapath, $subdir) = readinfostream($session); - - if ($type) - sessiondeletesingle($session); - } - } - } - else - return sessiondeletesingle($session); -} - -function sessiondeletesingle($session) -{ - $ram = "ram/" .$session ."/"; - - // Get segmenter PID if any - if (file_exists($ram ."segmenter.pid")) - $cmd = "kill `cat " .$ram ."segmenter.pid`; rm " .$ram ."segmenter.pid; "; - - $cmd .= "rm -rf " .$ram; - exec ($cmd); -} - -?> diff --git a/includes/inc_stream.php b/includes/inc_stream.php deleted file mode 100755 index 5837e22..0000000 --- a/includes/inc_stream.php +++ /dev/null @@ -1,139 +0,0 @@ -<?php - -global $vdrstreamdev, $quality; - -$category = $_SESSION['currentcat']; - -$type = $_REQUEST['type']; -$name = $_REQUEST['name']; -$name = stripslashes($name); -switch ($type) -{ - // Live TV - case 1: - list($title, $desc, $realname) = vdrgetinfostream($name, 1); - $channum = vdrgetchannum($realname); - break; - // Recording - case 2: - $realname = $name; - list($title, $desc, $realname) = vdrgetinfostream($name, 0); - break; - // Media - case 3: - list($title, $desc) = mediagetinfostream($name); - $realname = basename($name); - break; - default: - $realname = ""; - $title = ""; - $desc = ""; - $channame = ""; -} - -print "<body onorientationchange=\"updateOrientation();\" onload=\"updateOrientation();\">\r\n"; - -print "<div id=\"topbar\" class=\"transparent\">\r\n"; -print "<div id=\"leftnav\">\r\n"; - -print "<a href=\"javascript:sendForm('getback')\">Back</a></div>\r\n"; -print "<div id=\"rightnav\">\r\n"; -print "<a href=\"index.php\"><img alt=\"home\" src=\"images/home.png\" /></a></div>\r\n"; - -print "<div id=\"title\">iStreamdev</div>\r\n"; -print "</div>\r\n"; - -print "<div id=\"content\">\r\n"; - -print " <span class=\"graytitle\">Select stream mode</span>\r\n"; - -// Print the right logo -print " <ul class=\"pageitem\">\r\n"; - -// Get logo -if ($type == 2) - generatelogo($type, $realname, 'ram/tmp-logo.png'); -else - generatelogo($type, $name, 'ram/tmp-logo.png'); - -print " <center><img src=\"ram/tmp-logo.png\"></img></center>\r\n"; - -print " </ul>\r\n"; - -print " <div id=\"tributton\">\r\n"; -print " <div class=\"links\">\r\n"; - -foreach ($quality as $qname => $qparams) - print "<a href=\"javascript:sendForm('$qname')\">{$qname}</a>"; -print "\r\n"; - -print " </div></div>\r\n"; - -print " <ul class=\"pageitem\">\r\n"; -print " <li class=\"textbox\"><span class=\"header\">{$realname}</span><p><strong>{$title}</strong>\r\n"; -print " <br>{$desc}</p></li></ul>\r\n"; - -print " </div>\r\n"; - -foreach ($quality as $qname => $qparams) -{ - print " <form name=\"{$qname}\" id=\"{$qname}\" method=\"post\" action=\"index.php\">\r\n"; - print " <input name=\"action\" type=\"hidden\" id=\"action\" value=\"startstream\" />\r\n"; - print " <input name=\"type\" type=\"hidden\" id=\"type\" value={$type} />\r\n"; - print " <input name=\"name\" type=\"hidden\" id=\"name\" value=\"{$realname}\" />\r\n"; - print " <input name=\"title\" type=\"hidden\" id=\"title\" value=\"{$title}\" />\r\n"; - print " <input name=\"desc\" type=\"hidden\" id=\"desc\" value=\"{$desc}\" />\r\n"; - print " <input name=\"qname\" type=\"hidden\" id=\"qname\" value=\"{$qname}\" />\r\n"; - print " <input name=\"qparams\" type=\"hidden\" id=\"qparams\" value=\"{$qparams}\" />\r\n"; - print " <input name=\"category\" type=\"hidden\" id=\"category\" value=\"{$category}\" />\r\n"; - switch ($type) - { - case 1: - print " <input name=\"url\" type=\"hidden\" id=\"url\" value=\"{$vdrstreamdev}{$channum}\" />\r\n"; - break; - case 3: - $mediapath = $_REQUEST['mediapath']; - $subdir = $_REQUEST['subdir']; - $subdir = stripslashes($subdir); - print " <input name=\"mediapath\" type=\"hidden\" id=\"mediapath\" value=\"{$mediapath}\" />\r\n"; - print " <input name=\"subdir\" type=\"hidden\" id=\"subdir\" value=\"" .stripslashes($subdir) ."\" />\r\n"; - // NO BREAK - case 2: - print " <input name=\"url\" type=\"hidden\" id=\"url\" value=\"" .stripslashes($name) ."\" />\r\n"; - break; - } - print " </form>"; -} - -print " <form name=\"getback\" id=\"getback\" method=\"post\" action=\"index.php\">"; -switch ($type) -{ - case 1: - if ($category==null) - { - print " <input name=\"action\" type=\"hidden\" id=\"action\" value=\"listcategory\" />"; - } - else - { - print " <input name=\"action\" type=\"hidden\" id=\"action\" value=\"listchannels\" />"; - print " <input name=\"cat\"type=\"hidden\" id=\"cat\" value=\"{$category}\" />"; - } - break; - case 2: - $dir = dirname($name); - print " <input name=\"action\" type=\"hidden\" id=\"action\" value=\"recordings\" />"; - print " <input name=\"dir\"type=\"hidden\" id=\"dir\" value=\"" . stripslashes($dir) . "\" />"; - break; - case 3: - $mediapath = $_REQUEST['mediapath']; - $subdir = $_REQUEST['subdir']; - $subdir = stripslashes($subdir); - - print " <input name=\"action\" type=\"hidden\" id=\"action\" value=\"video\" />"; - print " <input name=\"mediapath\" type=\"hidden\" id=\"mediapath\" value=\"{$mediapath}\" />\r\n"; - print " <input name=\"subdir\" type=\"hidden\" id=\"subdir\" value=\"{$subdir}\" />\r\n"; - break; -} -print " </form>\r\n"; - -?> diff --git a/includes/inc_streaminfo.php b/includes/inc_streaminfo.php deleted file mode 100755 index 4124396..0000000 --- a/includes/inc_streaminfo.php +++ /dev/null @@ -1,69 +0,0 @@ -<?php - -/* - Types: - 0 : Not running - 1 : VDR live - 2 : VDR recording - 3 : Media -*/ - -function writeinfostream($session, $type=0, $name="", $title="", $desc="", $mode="", $category="", $url="", $mediapath="", $subdir="") -{ - $ram = "ram/" .$session ."/"; - - $infofile = fopen($ram ."streaminfo", 'w'); - - fwrite($infofile, "type=" .$type ."\n"); - fwrite($infofile, "name=" .$name ."\n"); - fwrite($infofile, "title=" .$title ."\n"); - fwrite($infofile, "desc=" .$desc ."\n"); - fwrite($infofile, "mode=" .$mode ."\n"); - fwrite($infofile, "category=" .$category ."\n"); - fwrite($infofile, "url=" .$url ."\n"); - fwrite($infofile, "mediapath=" .$mediapath ."\n"); - fwrite($infofile, "subdir=" .$subdir ."\n"); - - fclose($infofile); -} - - -function readinfostream($session) -{ - $ram = "ram/" .$session ."/"; - - if (!file_exists($ram ."streaminfo")) - return array(0, "", "", "", ""); - - $infofile = fopen($ram ."streaminfo", 'r'); - if (!$infofile) - return array(0, "", "", "", ""); - - while ($line = fgets($infofile, 1024)) - { - if (!strncmp($line, "type=", strlen("type="))) - $type = substr($line, strlen("type="), -1); - else if (!strncmp($line, "name=", strlen("name="))) - $name = substr($line, strlen("name="), -1); - else if (!strncmp($line, "title=", strlen("title="))) - $title = substr($line, strlen("title="), -1); - else if (!strncmp($line, "desc=", strlen("desc="))) - $desc = substr($line, strlen("desc="), -1); - else if (!strncmp($line, "mode=", strlen("mode="))) - $mode = substr($line, strlen("mode="), -1); - else if (!strncmp($line, "category=", strlen("category="))) - $category = substr($line, strlen("category="), -1); - else if (!strncmp($line, "url=", strlen("url="))) - $url = substr($line, strlen("url="), -1); - else if (!strncmp($line, "mediapath=", strlen("mediapath="))) - $mediapath = substr($line, strlen("mediapath="), -1); - else if (!strncmp($line, "subdir=", strlen("subdir="))) - $subdir = substr($line, strlen("subdir="), -1); - } - - fclose($infofile); - - return array($type, $name, $title, $desc, $mode, $category, $url, $mediapath, $subdir); -} - -?> diff --git a/includes/inc_streaming.php b/includes/inc_streaming.php deleted file mode 100755 index 913f28e..0000000 --- a/includes/inc_streaming.php +++ /dev/null @@ -1,68 +0,0 @@ -<?php - -global $vdrstreamdev, $quality; - -// Get $session if we are not directly included from startstream -if ($session == "") - $session = $_REQUEST['session']; - -$ram = "ram/" .$session ."/"; - -// Get current stream info -list($type, $realname, $title, $desc, $mode, $category, $url, $mediapath, $subdir) = readinfostream($session); - -print "<body onorientationchange=\"updateOrientation();\" onload=\"ajax('{$session}');\">\r\n"; - -print "<div id=\"topbar\" class=\"transparent\">\r\n"; -print "<div id=\"leftnav\">\r\n"; -print "<a href=\"javascript:sendForm('stopstream');\">Stop Stream</a></div>\r\n"; - -print "<div id=\"rightnav\">\r\n"; -print "<a href=\"index.php\"><img alt=\"home\" src=\"images/home.png\" /></a></div>\r\n"; - -print "<div id=\"title\">iStreamdev</div>\r\n"; -print "</div>\r\n"; - -print "<div id=\"content\">\r\n"; -print " <span class=\"graytitle\">Now streaming</span>\r\n"; - -// Print the right logo -print " <ul class=\"pageitem\">\r\n"; - -$logopath=$ram ."/logo.png"; -$logowidth = mediagetwidth($logopath); -print " <center><video id=\"videofeed\" width=\"{$logowidth}\" poster=\"{$logopath}\" ></video></center>\r\n"; - -print " </ul>\r\n"; - -print " <ul class=\"pageitem\">\r\n"; -print " <li class=\"textbox\"><span class=\"header\">{$realname}</span><p><strong>" .stripslashes($title). "</strong>\r\n"; -print " <br>{$desc}</p></li></ul>\r\n"; - -print " <ul class=\"pageitem\">\r\n"; -print " <li id=\"modetext\" class=\"textbox\"><span class=\"header\">Mode</span>\r\n"; -print " <p id='streamtitle'>{$mode}</p></li></ul>\r\n"; - -print " </div>\r\n"; - -print " <form name=\"stopstream\" id=\"stopstream\" method=\"post\" action=\"index.php\">"; -print " <input name=\"action\" type=\"hidden\" id=\"action\" value=\"stopstream\" />"; -print " <input name=\"session\" type=\"hidden\" id=\"session\" value=\"{$session}\" />"; -print " <input name=\"type\" type=\"hidden\" id=\"type\" value={$type} />"; -switch ($type) -{ - case 1: - print " <input name=\"name\" type=\"hidden\" id=\"name\" value=\"{$realname}\" />"; - break; - case 3: - print " <input name=\"mediapath\" type=\"hidden\" id=\"mediapath\" value=\"{$mediapath}\" />\r\n"; - print " <input name=\"subdir\" type=\"hidden\" id=\"subdir\" value=\"{$subdir}\" />\r\n"; - // NO BREAK - case 2: - print " <input name=\"name\" type=\"hidden\" id=\"name\" value=\"{$url}\" />"; - break; - -} - -print " </form>\r\n"; -?> diff --git a/includes/inc_svdrp.php b/includes/inc_svdrp.php deleted file mode 100755 index da83b49..0000000 --- a/includes/inc_svdrp.php +++ /dev/null @@ -1,446 +0,0 @@ -<?php - -// SVDRP is a class do communicate with a vdr via svdrp -class SVDRP -{ - var $cfgServer; - var $cfgPort; - var $cfgTimeOut; - - var $handle; - var $debug; - - function SVDRP($server = "localhost", $port=2001, $timeout = 30, $debug = 0) - { - $this->cfgServer = $server; - $this->cfgPort = $port; - $this->cfgTimeOut = $timeout; - $this->debug = $debug; - $this->handle = 0; - } - - function DebugMessage($msg) - { - if($this->debug) echo ($msg); - } - - function Connect() - { - if($this->handle) Disconnect(); - $errno = 0; - $errstr = ""; - $this->handle = fsockopen($this->cfgServer, $this->cfgPort, &$errno, &$errstr, $this->cfgTimeOut); - - if(!$this->handle) - { - $this->DebugMessage("error $errno: $errstr"); - return false; - } - - $this->DebugMessage("handle: $this->handle<br>\n"); - - - $input = fgets($this->handle,128); - - if(!preg_match("/^220 /", $input) || $input == "") - { - $this->DebugMessage("wrong welcome message: '$input'<br>\n"); - $this->Disconnect(); - return false; - } - - - $this->DebugMessage("Welcome message: $input<br><br>\n"); - - return true; - } - - function Command($cmd) - { - if(!$this->handle) return false; - - $ret = array(); - - $this->DebugMessage("Kommando $cmd<br><pr"."e>"); - fputs($this->handle, $cmd . "\n"); - $s = ""; - $nline = 0; - while($s .= fgets($this->handle,4096)) - { - $nline++; - - $this->DebugMessage($s); - if(!preg_match("/^(\\d{3})([ -])(.*)$/", $s, $data)) - { - continue; - } - - - - - $number = $data[1]; - // TODO: Fehlernummer bearbeiten - $ret[] = $data[3]; - if($data[2] != "-" && $nline == 1) $ret = $data[3] ; - if($data[2] != "-") break; - $s = ""; - - } - - $this->DebugMessage("</pr"."e>"); - return $ret; - } - - function ListChannels($numberorname="") - { - if(!$this->handle) return false; - $channels = array(); - $lines = $this->Command("LSTC$numberorname"); - if(!$lines) return false; - foreach($lines as $a => $l) - { - $a = split(":", $l); - $name = $a[0]; - $freq = $a[1]; - $b = split(";", $name); - $name = $b[0]; - if(!isset($b[1])) $b[1] = $name; - $group = $b[1]; - - - $c["name"] = $name; - $c["group"] = $group; - $c["frequency"] = $freq; - - $channels[] = $c; - - - } - return $channels; - } - - function Help() - { - return $this->Command("HELP"); - } - function Disconnect() - { - if(!$this->handle) return; - $this->Command("QUIT"); - - fclose($this->handle); - $this->handle = 0; - $this->DebugMessage("disconnected"); - } - function ClearEpg() - { - if(!$this->handle) return false; - $this->Command("CLRE"); - return true; - } - function SwitchUp() - { - if(!$this->handle) return false; - $this->Command("CHAN +"); - return true; - } - function SwitchDown() - { - if(!$this->handle) return false; - $this->Command("CHAN -"); - return true; - } - function SwitchChannel($channel) - { - if(!$this->handle) return false; - $this->Command("CHAN $channel"); - return true; - } - function DeleteChannel($id) - { - if(!$this->handle) return false; - $this->Command("DELC $id"); - return true; - } - function DeleteRecord($id) - { - if(!$this->handle) return false; - $this->Command("DELR $id"); - return true; - } - - function GrabImage($filename, $type="jpeg", $quality="", $width="", $height) - { - if(!$this->handle) return false; - $this->Command("GRAB $filename $type $quality $width $height"); - return true; - } - function HitKey($key) - { - if(!$this->handle) return false; - $this->Command("HITK $key"); - return true; - } - function PowerOff() - { - if(!$this->handle) return false; - $this->Command("HITK Power"); - return true; - - } - function GetKeys() - { - if(!$this->handle) return false; - - $lines = $this->Command("HITK"); - $keys = array(); - foreach($lines as $l) - { - if(!preg_match("/^ {4}(.*)$/", $l, $m)) continue; - $keys[] = $m[1]; - } - - return $keys; - } - function ListEPG($pStrChannel="", $pStrTime="") - { - if(!$this->handle) return false; - $lines = $this->Command("LSTE"); - - $epg = array (); - $channel = array(); - $event = array(); - - $channelname = ""; - foreach($lines as $l) - { - preg_match("/^(.)\\s*(.*)$/", $l, $m); - $type = $m[1]; - $text = $m[2]; - switch($type) - { - case 'C': // Channel - list( $channeldata, $channelname ) = explode( ' ', $text, 2 ); - - break; - case 'E': // new Event - sscanf($text, "%u %ld %d %X", $event["EventID"], $event["StartTime"], $event["Duration"], $event["TableID"]); - - break; - case 'T': // Title - $event["Title"] = $text; - break; - case 'S': // Short text - $event["Shottext"] = $text; - break; - case 'D': // Description - $event["Desc"] = $text; - break; - case 'V': // VPS - $event["VPS"] = $text; - break; - case 'e': // Event end - if ((trim($pStrTime) != '') && (( $event['StartTime'] > $pStrTime ) || ($event['StartTime'] + $event["Duration"] < $pStrTime))) - continue; - - $channel[] = $event; - $event = array(); - - break; - case 'c': // Channel end - if ((trim($pStrChannel) != '') && ($channelname != $pStrChannel)) - continue; - - $epg[$channelname] = $channel; - $channel = array(); - - break; - } - - } - if ((trim($pStrTime) == '') || (( $event['StartTime'] < $pStrTime ) && ($event['StartTime'] + $event["Duration"] > $pStrTime))) - $channel[] = $event; - - if ((trim($pStrChannel) != '') || ($channelname == $pStrChannel)) - $epg[$channelname] = $channel; - - return $epg; - } - - function Message($msg) - { - if(!$this->handle) return false; - $this->Command("MESG $msg"); - return true; - } - - - // Volume commands - function ToggleMute() - { - if(!$this->handle) return false; - $this->Command("VOLU mute"); - return true; - } - function VolumeUp() - { - if(!$this->handle) return false; - $this->Command("VOLU +"); - return true; - } - function VolumeDown() - { - if(!$this->handle) return false; - $this->Command("VOLU -"); - return true; - } - function SetVolume($v) - { - if(!$this->handle) return false; - $this->Command("VOLU $v"); - return true; - } - function GetVolume() - { - if(!$this->handle) return false; - $v = $this->Command("VOLU"); - if($v == "Audio is mute") return 0; - if(!preg_match("/Audio volume is (.*)/", $v, $m)) return false; - - return $m[1]; - } - function GetDiskStat() - { - if(!$this->handle) return false; - $stat = $this->Command("STAT DISK"); - sscanf($stat, "%dMB %dMB %d%%", $FreeMUsedMB, $FreeMB, $Percent); - $ret["FreeMB + UsedMB"] = $FreeMUsedMB; - $ret["FreeMB"] = $FreeMB; - $ret["UsedMB"] = $FreeMUsedMB - $FreeMB; - $ret["Percent"] = $Percent; - return $ret; - } - function StartScan() - { - if(!$this->handle) return false; - $this->Command("SCAN"); - return true; - } - function MoveChannel($number, $to) - { - if(!$this->handle) return false; - $this->Command("MOVC $number $to"); - return true; - - } - - function DeleteTimer($id) - { - if(!$this->handle) return false; - $this->Command("DELT $id"); - return true; - } - - function MoveTimer($number, $to) - { - if(!$this->handle) return false; - $this->Command("MOVT $number $to"); - return true; - } - - function TimerOnOff($n, $state = "on") - { - if(!$this->handle) return false; - //if($state == "1") $state = "on"; - //if($state == "0") $state = "off"; - //if($state == false) $state = "off"; - // if($state == true) $state = "on"; - switch($state) - { - case false: - case "off": - case "0": - $state = "off"; - break; - default: - $state = "on"; - break; - } - - return $this->Command("MODT $n $state"); - } - - function ListTimers() - { - - } - - function ShowMessage($msg = "") - { - if(!$this->handle) return false; - return $this->Command("MESG $msg"); - } - - function ListRecords() - { - if(!$this->handle) return false; - - $lines = $this->Command("LSTR"); - $records = array(); - foreach($lines as $l) - { - - if(!preg_match("/^(\\d)\s(\\d*)\\.(\\d*)\\.(\\d*) (\\d*)\\:(\\d*).\s(.*)$/", $l, $m)) continue; - $id = $m[1]; - $m["id"] = $m[1]; - $m["day"] = $m[2]; - $m["month"] = $m[3]; - $m["year"] = $m[4]; - $m["hour"] = $m[5]; - $m["minute"] = $m[6]; - $m["desc"] = $m[7]; - - $records[$id] = $m; - } - - return $records; - - } - - // TODO: perhaps better implementation - function ListRecord($n) - { - if(!$this->handle) return false; - $m = $this->Command("LSTR $n"); - return $m[0]; - } - - - - //TODO: Implement following commands: - /* - - - LSTT MODT NEWT UPDT - MODC NEWC - NEXT - PUTE - - */ -} - -// Small Example -/* -echo "<pr"."e>"; -$a = new SVDRP(); -$a->Connect(); -print_r($a->Help()); -print_r($a->ListChannels()); -$a->GetKeys(); -print_r($a->GetVolume()); -print_r($a->GetDiskStat()); -$a->Disconnect(); -*/ -?> - - diff --git a/includes/inc_timers.php b/includes/inc_timers.php deleted file mode 100755 index 5190494..0000000 --- a/includes/inc_timers.php +++ /dev/null @@ -1,44 +0,0 @@ -<?php -print "<body onorientationchange=\"updateOrientation();\" onload=\"updateOrientation();\">\r\n"; -print "<div id=\"topbar\" class=\"transparent\">\r\n"; -print "<div id=\"leftnav\">\r\n"; -print "<a href=\"index.php\"><img alt=\"home\" src=\"images/home.png\" /></a></div>\r\n"; -print "<div id=\"title\">iStreamdev</div>\r\n"; -print "</div>\r\n"; -print "<div id=\"content\">\r\n"; -print " <span class=\"graytitle\">Timers</span>\r\n"; - -// Status display -if ($message != "") -{ - print " <ul class=\"pageitem\">"; - print $message; - print " </ul>"; -} - -print " <ul class=\"pageitem\">"; -print " <li class=\"textbox\">"; -print " <span class=\"header\">Current timers</span>"; -print " </li>"; - -vdrlisttimers(); - -print "</ul>"; - -print "<ul class=\"pageitem\">"; -print " <li class=\"menu\">"; -print " <a href=\"javascript:sendForm('new_timer')\">"; -print " <span class=\"name\">New Timer</span>"; -print " <span class=\"arrow\"></span>"; -print " </a>"; -print " </li>"; -print " <form name=\"new_timer\" id=\"new_timer\" method=\"post\" action=\"index.php\">"; -print " <input name=\"action\" type=\"hidden\" id=\"action\" value=\"edittimer\"/>"; -print " <input name=\"timer\" type=\"hidden\" id=\"timer\" value=\"-1\" />"; -print " </form>"; -print "</ul>"; - -print "</div>\r\n"; -a -?> - diff --git a/includes/inc_utils.php b/includes/inc_utils.php deleted file mode 100755 index e748c64..0000000 --- a/includes/inc_utils.php +++ /dev/null @@ -1,95 +0,0 @@ -<?php -function is_utf8($str) -{ - $c=0; $b=0; - $bits=0; - $len=strlen($str); - for($i=0; $i<$len; $i++) - { - $c=ord($str[$i]); - if($c > 128) - { - if(($c >= 254)) return false; - elseif($c >= 252) $bits=6; - elseif($c >= 248) $bits=5; - elseif($c >= 240) $bits=4; - elseif($c >= 224) $bits=3; - elseif($c >= 192) $bits=2; - else return false; - if(($i+$bits) > $len) return false; - while($bits > 1) - { - $i++; - $b=ord($str[$i]); - if($b < 128 || $b > 191) return false; - $bits--; - } - } - } - return true; -} - -function php2js ($var) -{ - if (is_array($var)) - { - $array = array(); - - foreach ($var as $a_var) - $array[] = php2js($a_var); - - return str_replace("\"", "'", join(",", $array)); - - - } - - elseif (is_bool($var)) - return ($var ? "true" : "false"); - - elseif (is_int($var) || is_integer($var) || is_double($var) || is_float($var)) - return $var; - - elseif (is_string($var)) - return "\"" .$var . "\""; - - else - return false; -} - -function sec2hms ($sec, $padHours = false) -{ - - // holds formatted string - $hms = ""; - - // there are 3600 seconds in an hour, so if we - // divide total seconds by 3600 and throw away - // the remainder, we've got the number of hours - $hours = intval(intval($sec) / 3600); - - // add to $hms, with a leading 0 if asked for - $hms .= ($padHours) - ? str_pad($hours, 2, "0", STR_PAD_LEFT). ':' - : $hours. ':'; - - // dividing the total seconds by 60 will give us - // the number of minutes, but we're interested in - // minutes past the hour: to get that, we need to - // divide by 60 again and keep the remainder - $minutes = intval(($sec / 60) % 60); - - // then add to $hms (with a leading 0 if needed) - $hms .= str_pad($minutes, 2, "0", STR_PAD_LEFT). ':'; - - // seconds are simple - just divide the total - // seconds by 60 and keep the remainder - $seconds = intval($sec % 60); - - // add to $hms, again with a leading 0 if needed - $hms .= str_pad($seconds, 2, "0", STR_PAD_LEFT); - - // done! - return $hms; - -} -?> diff --git a/includes/inc_vdr.php b/includes/inc_vdr.php deleted file mode 100755 index 6dee5dc..0000000 --- a/includes/inc_vdr.php +++ /dev/null @@ -1,389 +0,0 @@ -<?php -include ('includes/inc_svdrp.php'); - -function vdrsendcommand($cmd) -{ - global $svdrpip, $svdrpport; - - $svdrp = new SVDRP($svdrpip, $svdrpport); - $svdrp->Connect(); - $ret = $svdrp->Command($cmd); - $svdrp->Disconnect(); - - return $ret; -} - -function vdrgetinfostream($stream = "NULL", $ischan = 1) -{ - global $allepg, $allepgfilled; - $stream=stripslashes($stream); - if ($ischan) - { - // Fill epg if not yet done - if ($allepgfilled == 0) - { - $allepg = vdrsendcommand("LSTE NOW"); - $allepgfilled = 1; - } - - $channame = $stream; - } - else - { - $infofile = $stream ."/info"; - if (file_exists($infofile)) - $info= file_get_contents($infofile); - else - { - $infofile = $stream ."/info.vdr"; - if (file_exists($infofile)) - $info= file_get_contents($infofile); - else - $info=""; - } - - $allepg = explode("\n", $info); - } - - if ($ischan) - $chanfound = 0; - else - $chanfound = 1; - $epgtitlefound = 0; - - $epgtitle=""; - $epgdesc=""; - - // For all epg - $count = count($allepg); - for ($i = 0; $i < $count; $i++) - { - // Find the right chan (take the first one) - if ($chanfound == 0) - { - $streamArray = explode(";",$stream); - if (strstr($allepg[$i], $streamArray[0]) == $streamArray[0]) - $chanfound = 1; - } - else - { - // Now find T or C - if(ereg("^C", $allepg[$i])) - { - // Check if it is our chan too, else search again - if ($ischan) - { - if(!ereg("$stream$", $allepg[$i])) - { - $chanfound = 0; - continue; - } - } - else - { - $channame = substr($allepg[$i], 2); - $channames = explode(" ", $channame); - $channame = substr($channame, strlen($channames[0])+1); - } - } - else if(ereg("^T", $allepg[$i])) - $epgtitle=substr($allepg[$i], 2); - else if(ereg("^D", $allepg[$i])) - $epgdesc=substr($allepg[$i], 2); - } - } - - // Convert if needed - if (!is_utf8($epgtitle)) - $epgtitle = utf8_encode($epgtitle); - if (!is_utf8($epgdesc)) - $epgdesc = utf8_encode($epgdesc); - - - return array($epgtitle, $epgdesc, $channame); -} - -function vdrgettimerinfo($timernum=-1) -{ - if ($timernum != -1) - { - $timer = vdrsendcommand("LSTT " .$timernum); - - $timerarray = explode(":", $timer); - - $typearray = explode(" ", $timerarray[0]); - $type = $typearray[1]; - $channel = $timerarray[1]; - $date = $timerarray[2]; - $stime = $timerarray[3]; - $etime = $timerarray[4]; - $desc = $timerarray[7]; - } - else - { - $type = 1; - $channel = 1; - $date = date('Y-m-d'); - $stime = date('Hi'); - $etime = date('Hi'); - $desc = "New timer"; - } - - $channame = vdrgetchanname($channel); - - return array($type, $channame, $date, $stime, $etime, $desc); -} - -function vdrgetchannum($chan = "NULL") -{ - $channels = vdrsendcommand("LSTC"); - - // Get channel number - $channels = preg_grep(quotemeta('"'.$chan.';|'.$chan.':"'), $channels); - reset($channels); - - $channels = explode(" ", $channels[key($channels)]); - $channum = $channels[0]; - - return $channum; -} - -function vdrgetchanname($channum = 0) -{ - $channel = vdrsendcommand("LSTC " .$channum); - - // Get channel name - $chanarray = explode(":", $channel); - $chanarray = explode(";", $chanarray[0]); - $channame = $chanarray[0]; - $channame = substr($channame, strlen($channum)+1); - - return $channame; -} - - -function vdrlistcategories() -{ - global $vdrchannels; - - // All chans - print "<li class=\"menu\"><a class=\"noeffect\" href=\"javascript:sendForm('All');\"><span class=\"name\">All channels</span><span class=\"arrow\"></span></a></li>\r\n"; - print "<form name=\"All channels\" id=\"All\" method=\"post\" action=\"index.php\"><input name=\"action\" type=\"hidden\" id=\"action\" value=\"listchannels\"/><input name=\"cat\" type=\"hidden\" id=\"cat\" value=\"All\" /></form>\r\n"; - - if (!file_exists($vdrchannels)) - { - print "Error: channels file not found"; - return; - } - - $fp = fopen ($vdrchannels,"r"); - if (!fp) - { - print "Unable to open channels file"; - return; - } - while ($line = fgets($fp, 1024)) - { - // Check if it is a categorie - if ($line[0] == ":") - { - // Remove : and @ - $cat = substr($line, 1, -1); - if($cat[0] == '@') - { - $cat_array = explode(' ', $cat); - $cat = substr($cat, strlen($cat_array[0])+1); - } - - $cat2 = addslashes($cat); - - print "<li class=\"menu\"><a class=\"noeffect\" href=\"javascript:sendForm('$cat2');\"><span class=\"name\">$cat</span><span class=\"arrow\"></span></a></li>\r\n"; - print "<form name=\"$cat\" id=\"$cat\" method=\"post\" action=\"index.php\"><input name=\"action\" type=\"hidden\" id=\"action\" value=\"listchannels\"/><input name=\"cat\" type=\"hidden\" id=\"cat\" value=\"$cat\" /></form>\r\n"; - } - } - fclose($fp); -} - -function vdrlistchannels($category = "NULL") -{ - global $epgtitle; - global $vdrchannels; - - if ($category == "All") - $cat_found=1; - else - $cat_found=0; - - if (!file_exists($vdrchannels)) - { - print "Error: channels file not found"; - return; - } - - $fp = fopen ($vdrchannels,"r"); - if (!fp) - { - print "Unable to open channels file"; - return; - } - while ($line = fgets($fp, 1024)) - { - if ($cat_found) - { - if ($line[0] == ":") - { - if ($category == "All") - continue; - else - break; - } - - $channels = explode(":", $line); - $channels = explode(";", $channels[0]); - $chan = $channels[0]; - - // Get EPG title - $epgtitle = NULL; - list($epgtitle, $epgdesc, $channame) = vdrgetinfostream($chan, 1); - print "<li class=\"withimage\">"; - $chan2=addslashes($chan); - print " <a class=\"noeffect\" href=\"javascript:sendForm('$chan2');\">\r\n"; - $channoslash = preg_replace("$/$", " ", $chan); - if (!file_exists('logos/'.$channoslash.'.png')) - print " <img src=\"logos/nologoTV.png\" />\r\n"; - else - print " <img src=\"logos/{$channoslash}.png\" />\r\n"; - print " <span class=\"name\">$chan</span>\r\n"; - print " <span class=\"comment\">$epgtitle</span><span class=\"arrow\"></span></a>\r\n</li>\r\n"; - print " <form name=\"$chan\" id=\"$chan\" method=\"post\" action=\"index.php\">"; - print " <input name=\"action\" type=\"hidden\" id=\"action\" value=\"stream\" />"; - print " <input name=\"type\" type=\"hidden\" id=\"type\" value=1 />"; - print " <input name=\"name\" type=\"hidden\" id=\"name\" value=\"$chan\" />"; - print " </form>\r\n"; - } - else - { - if ($line[0] == ":") - { - // Remove : and @ - $cat = substr($line, 1, -1); - if($cat[0] == '@') - { - $cat_array = explode(' ', $cat); - $cat = substr($cat, strlen($cat_array[0])+1); - } - - // Check category - if ("$cat" == "$category") - $cat_found = 1; - } - } - } - fclose($fp); -} - -function vdrlistchannelsdrop($chansel = "") -{ - global $vdrchannels; - - $chanselected = 0; - - if (!file_exists($vdrchannels)) - { - print "Error: channels file not found"; - return; - } - - $fp = fopen ($vdrchannels,"r"); - if (!fp) - { - print "Unable to open channels file"; - return; - } - while ($line = fgets($fp, 1024)) - { - if ($line[0] == ":") - continue; - - $channels = explode(":", $line); - $channels = explode(";", $channels[0]); - $chan = $channels[0]; - if (($chan == $chansel) && !$chanselected) - { - print "<option selected value=\"{$chan}\">{$chan}</option>"; - $chanselected = 1; - } - else - print "<option value=\"{$chan}\">{$chan}</option>"; - } -} - -function vdrlisttimers() -{ - $timers = vdrsendcommand("LSTT"); - - if (gettype($timers) == "string") - { - if (!is_numeric(substr($timers,0,1))) - { - print "<li class=\"textbox\"><p>none</p></li>\r\n"; - return; - } - else - $timersarray[] = $timers; - } - else - $timersarray = $timers; - - foreach($timersarray as $timer) - { - // Extract timer # - $timerarray = explode(" ", $timer); - $timernum = $timerarray[0]; - - list($type, $channame, $date, $starthour, $endhour, $desc) = vdrgettimerinfo($timernum); - - print "<li class=\"menu\">"; - print " <a href=\"javascript:sendForm('timer {$timernum}')\">\r\n"; - - if ($type & 0x8) - print " <img alt=\"list\" src=\"images/pictos/timerrec.png\" />\r\n"; - else if ($type & 0x1) - print " <img alt=\"list\" src=\"images/pictos/timeron.png\" />\r\n"; - else - print " <img alt=\"list\" src=\"images/pictos/timeroff.png\" />\r\n"; - - print " <span class=\"name\">{$date}: {$desc}</span><span class=\"arrow\"></span>\r\n"; - - print " </a>\r\n"; - print "</li>\r\n"; - - print "<form name=\"timer {$timernum}\" id=\"timer {$timernum}\" method=\"post\" action=\"index.php\">\r\n"; - print " <input name=\"action\" type=\"hidden\" id=\"action\" value=\"edittimer\"/>\r\n"; - print " <input name=\"timer\" type=\"hidden\" id=\"timer\" value=\"{$timernum}\" />\r\n"; - print "</form>\r\n"; - } -} - -function vdrdeltimer($timer=0) -{ - return vdrsendcommand("DELT " .$timer); -} - -function vdrsettimer($prevtimer, $channame, $date, $stime, $etime, $desc, $active) -{ - $channum = vdrgetchannum($channame); - if ($active) - $type = "1"; - else - $type = "0"; - - if ($prevtimer == -1) - $command = "NEWT " .$type .":" .$channum .":" .$date .":" .$stime .":" .$etime .":99:99:" .$desc; - else - $command = "MODT " .$prevtimer ." " .$type .":" .$channum .":" .$date .":" .$stime .":" .$etime .":99:99:" .$desc; - - return vdrsendcommand($command); -} - -?> diff --git a/includes/inc_video.php b/includes/inc_video.php deleted file mode 100755 index 8fc9208..0000000 --- a/includes/inc_video.php +++ /dev/null @@ -1,117 +0,0 @@ -<?php - -$mediapath = $_REQUEST['mediapath']; -$subdir = $_REQUEST['subdir']; -$mediapath = stripslashes($mediapath); -$subdir = stripslashes($subdir); - -/* Add last slash to dirs */ -if ($mediapath[strlen($mediapath)-1] != '/') - $mediapath = $mediapath .'/'; -if ($subdir[strlen($subdir)-1] != '/') - $subdir = $subdir .'/'; - -print "<body onorientationchange=\"updateOrientation();\" onload=\"updateOrientation();\">\r\n"; -print "<div id=\"topbar\" class=\"transparent\">\r\n"; - -print "<div id=\"leftnav\">\r\n"; - -if ($subdir == '/') - print "<a href=\"index.php\"><img alt=\"home\" src=\"images/home.png\" /></a></div>\r\n"; -else -{ - print "<a href=\"javascript:sendForm('getback')\">Back</a></div>\r\n"; - print "<div id=\"rightnav\">\r\n"; - print "<a href=\"index.php\"><img alt=\"home\" src=\"images/home.png\" /></a></div>\r\n"; -} - -print "<div id=\"title\">iStreamdev</div>\r\n"; -print "</div>\r\n"; - -print "<div id=\"content\">\r\n"; -print " <span class=\"graytitle\">Media</span>\r\n"; -print " <br>"; -print " <ul class=\"pageitem\">"; -print " <li class=\"textbox\"><span class=\"header\">Current path:</span><p>" . stripslashes($subdir) . "</p></li>"; - -$noslashdir = stripslashes($mediapath.$subdir); -$dir_handle = @opendir($noslashdir); - -if (!$dir_handle) -{ - print "Unable to open $mediapath .$subdir"; -} -else while ($medianame = readdir($dir_handle)) -{ - if($medianame == "." || $medianame == ".." || $medianame == 'lost+found') - continue; - - $medianame_array[] = $medianame; -} - -if ($medianame_array[0]) -{ - // Alphabetical sorting - sort($medianame_array); - - $audiocnt=0; - - foreach($medianame_array as $value) - { - $medianame2=addslashes($value); - - switch (mediagettype($mediapath .$subdir .$value)) - { - // Dir - case 3: - { - print "<li class=\"menu\">\r\n"; - print " <a class=\"noeffect\" href=\"javascript:sendForm('$medianame2');\">\r\n"; - print " <span class=\"name\">$value</span><span class=\"arrow\"></span>\r\n"; - print " </a>\r\n"; - print "</li>\r\n"; - print "<form name=\"$value\" id=\"$value\" method=\"post\" action=\"index.php\">"; - print " <input name=\"action\" type=\"hidden\" id=\"action\" value=\"video\"/>"; - print " <input name=\"mediapath\" type=\"hidden\" id=\"mediapath\" value=\"{$mediapath}\" />"; - print " <input name=\"subdir\" type=\"hidden\" id=\"subdir\" value=\"" .stripslashes($subdir) .stripslashes($value) ."\" />\r\n"; - print "</form>\r\n"; - break; - } - // Video - case 1: - { - print "<li class=\"menu\">\r\n"; - print " <a class=\"noeffect\" href=\"javascript:sendForm('$medianame2');\">\r\n"; - print " <img src=\"images/pictos/video.png\" />\r\n"; - print " <span class=\"name\">$value</span><span class=\"arrow\"></span>\r\n"; - print " </a>\r\n"; - print "</li>\r\n"; - print "<form name=\"$value\" id=\"$value\" method=\"post\" action=\"index.php\">"; - print " <input name=\"action\" type=\"hidden\" id=\"action\" value=\"stream\"/>"; - print " <input name=\"type\" type=\"hidden\" id=\"type\" value=3 />"; - print " <input name=\"mediapath\" type=\"hidden\" id=\"mediapath\" value=\"{$mediapath}\" />"; - print " <input name=\"subdir\" type=\"hidden\" id=\"subdir\" value=\"{$subdir}\" />\r\n"; - print " <input name=\"name\" type=\"hidden\" id=\"name\" value=\"{$mediapath}{$subdir}{$value}\" />"; - print "</form>\r\n"; - break; - } - // Rest of files - default: - continue; - } - } -} - -$upsubdir = dirname($subdir); - -print "<form name=\"getback\" id=\"getback\" method=\"post\" action=\"index.php\">\r\n"; -print " <input name=\"action\" type=\"hidden\" id=\"action\" value=\"video\"/>\r\n"; -print " <input name=\"mediapath\" type=\"hidden\" id=\"mediapath\" value=\"{$mediapath}\" />\r\n"; -print " <input name=\"subdir\" type=\"hidden\" id=\"subdir\" value=\"{$upsubdir}\" />\r\n"; -print "</form>\r\n"; - -if ($dir_handle) - closedir($dir_handle); - -print "</ul></div>\r\n"; -?> diff --git a/includes/include.php b/includes/include.php deleted file mode 100755 index de9cfa4..0000000 --- a/includes/include.php +++ /dev/null @@ -1,137 +0,0 @@ -<?php - -if (file_exists('config.php')) - include ('config.php'); -else - include ('config_default.php'); -include ('includes/inc_session.php'); -include ('includes/inc_utils.php'); -include ('includes/inc_auth.php'); -include ('includes/inc_vdr.php'); -include ('includes/inc_files.php'); -include ('includes/inc_streaminfo.php'); -include ('getid3/getid3.php'); - -function selectpage() -{ - global $maxencodingprocesses; - - // Sanity check - if (!file_exists('ram')) - die("Error: 'ram/' directory is missing, please create it!"); - - $action = $_REQUEST['action']; - - switch ($action) - { - case ("streaming"): - include('includes/inc_streaming.php'); - break; - case ("startstream"): - // Dont create a session if too much are running already - $nbencprocess = exec("find ram/ -name segmenter.pid | wc | awk '{ print $1 }'"); - if ($nbencprocess < $maxencodingprocesses) - { - $type = $_REQUEST['type']; - $name = $_REQUEST['name']; - $title = $_REQUEST['title']; - $desc = stripslashes ($_REQUEST['desc']); - $qname = $_REQUEST['qname']; - $qparams = $_REQUEST['qparams']; - $category = $_REQUEST['category']; - $url = $_REQUEST['url']; - $mediapath = $_REQUEST['mediapath']; - $subdir = $_REQUEST['subdir']; - $session = sessioncreate($type, $name, $title, $desc, $qname, $qparams, $category, $url, $mediapath, $subdir); - include('includes/inc_streaming.php'); - } - else - include('includes/inc_streaming.php'); - break; - case ("stopstream"): - sessiondelete($_REQUEST['session']); - // NO BREAK; - case ("stream"): - include('includes/inc_stream.php'); - break; - case ("stopallstreamings"): - sessiondelete('all'); - $_SESSION['currentcat'] = NULL; - include('includes/inc_home.php'); - break; - case ("listcategory"): - include('includes/inc_cat.php'); - break; - case ("listchannels"): - include('includes/inc_chan.php'); - break; - case ("recordings"): - include('includes/inc_rec.php'); - break; - case ("video"): - include('includes/inc_video.php'); - break; - case ("audio"): - include('includes/inc_audio.php'); - break; - case ("epg"): - include('includes/inc_epg.php'); - break; - case ("timers"): - include('includes/inc_timers.php'); - break; - case ("edittimer"): - include('includes/inc_edittimer.php'); - break; - case ("deletetimer"): - $timer = $_REQUEST['timer']; - delete_timer($timer); - include('includes/inc_timers.php'); - break; - case ("addtimer"): - $active = $_REQUEST['timer_active']; - $channame = $_REQUEST['timer_chan']; - $date = $_REQUEST['timer_date']; - $stime = $_REQUEST['timer_starttime']; - $etime = $_REQUEST['timer_endtime']; - $desc = $_REQUEST['timer_name']; - $prevtimer = $_REQUEST['prevtimer']; - set_timer($active, $channame, $date, $stime, $etime, $desc, $prevtimer); - include('includes/inc_timers.php'); - break; - case ("playdir"): - include('includes/inc_mp3.php'); - break; - default: - $_SESSION['currentcat'] = NULL; - include('includes/inc_home.php'); - break; - } -} - -function delete_timer($timer) -{ - $ret = vdrdeltimer($timer); - - $message = " <li class=\"textbox\"><p><font color='black'>Timer deleted successfully</font></p></li>"; - -} - -function set_timer($active, $channame, $date, $stime, $etime, $desc, $prevtimer) -{ - $ret = vdrsettimer($prevtimer, $channame, $date, $stime, $etime, $desc, $active); - - if ($prevtimer == -1) - $settype = "creat"; - else - $settype = "edit"; - - $retarray = explode(":", $ret); - - if (!is_numeric(substr($retarray[0], 0, 1))) - $message = " <li class=\"textbox\"><p><font color='red'>{$retarray[0]}</font></p></li>"; - else - $message = " <li class=\"textbox\"><p>Timer {$settype}ed successfully</p></li>"; -} - -?> diff --git a/index.html b/index.html new file mode 100644 index 0000000..66c8fa7 --- /dev/null +++ b/index.html @@ -0,0 +1,244 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" manifest="istreamdev.manifest"> + <head> + <meta charset="UTF-8" /> + <title>iStreamdev</title> + <style type="text/css" media="screen">@import "jqtouch/jqtouch.css";</style> + <style type="text/css" media="screen">@import "themes/jqt/theme.css";</style> + <style type="text/css" media="screen">@import "css/istreamdev.css";</style> + <script src="jqtouch/jquery.1.3.2.min.js" type="text/javascript" charset="utf-8"></script> + <script src="jqtouch/jqtouch.js" type="application/x-javascript" charset="utf-8"></script> + <script src="jqtouch/jqtouch.transitions.js" type="application/x-javascript" charset="utf-8"></script> + <script src="extensions/jquery.scrollTo-min.js" type="application/x-javascript" charset="utf-8"></script> + <script src="js/spinningwheel.js" type="application/x-javascript" charset="utf-8"></script> + <script src="js/functions.js" type="application/x-javascript" charset="utf-8"></script> + <script src="js/istreamdev.js" type="application/x-javascript" charset="utf-8"></script> + <style type="text/css" media="screen">@import "css/spinningwheel.css";</style> + </head> + <body> + <div id="loader"></div> + <div id="jqt"> + <!---------------------------------- HOME SCREEN (always present) ----------------------------------> + <div id="home" class="current"> + <div class="toolbar"> + <h1>HOME</h1> + </div> + <ul class="rounded"> + <li><span class="menutitle">VDR</span></li> + <li class="arrow"><a id="categories_but" href="#"><img class="menuicon" src="img/tv.png" /><span class="menuname">Watch TV</span></a></li> + <li class="arrow"><a id="recording_but" href="#"><img class="menuicon" src="img/record.png" /><span class="menuname">Recordings</span></a></li> + <li class="arrow"><a id="timers_but" href="#"><img class="menuicon" src="img/timers.png" /><span class="menuname">Timers</span></a></li> + <li class="arrow"><a id="epg_but" href="#"><img class="menuicon" src="img/epg.png" /><span class="menuname">Program Guide</span></a></li> + </ul> + <ul class="rounded"> + <li><span class="menutitle">FILES</span></li> + <li class="arrow"><a id="video_but" href="#browser"><img class="menuicon" src="img/video.png" /><span class="menuname">Video</span></a></li> + <li class="arrow"><a id="audio_but" class="cube" href="#audio"><img class="menuicon" src="img/audio.png" /><span class="menuname">Audio</span></a></li> + </ul> + </div> + <!----------------------------------/ HOME SCREEN ----------------------------------> + <!---------------------------------- CHAN CATEGORY SCREEN ----------------------------------> + <!----------------------------------categories------------------------------> + <div id="categories"> + <div class="toolbar"> + <a href="#" class="back">Home</a> + <h1><img class="menuicon" src="img/tv.png" /> CATEGORIES</h1> + </div> + <ul id="cat_menu" class="rounded"> + </ul> + </div> + <!----------------------------------channels------------------------------> + <div id="channels"> + <div class="toolbar"> + <a href="#" class="back">Back</a> + <a href="#home" id="home_but" class="button">Home</a> + <h1><img class="menuicon" src="img/tv.png" /> CHANNELS</h1> + </div> + <ul id="chan_menu" class="rounded"> + </ul> + </div> + <!---------------------------------- /CHAN CATEGORY SCREEN ----------------------------------> + <!---------------------------------- STREAM SCREEN ----------------------------------> + <!------------------------ tv start stream -----------------------------------------> + <div id="streamchannel"> + <div class="toolbar"> + <a href="#" class="back">Back</a> + <a href="#home" id="home_but" class="button">Home</a> + <h1><img class="menuicon" src="img/tv.png" />Channel</h1> + </div> + <center><ul class="thumb" style="width:90px"><img class="thumbnail" id="thumbnail" src="" /></ul></center> + <ul class="streaminfo"> + <li><span class="name_now"></span> + <span class="epgtime_now"></span> + <span class="desc_now"></span></li> + <li> + <span class="name_next"></span> + <span class="epgtime_next"></span></li> + </ul> + <center> + <br> + <span class="streamButton"><a id="edge" href="#">Edge</a></span><span class="streamButton"><a id="3g" href="#" class="cube"> 3G </a></span><span class="streamButton"><a id="wifi" href="#" class="cube">Wifi</a></span><span class="recButton"><a id="rec" href="#" class="cube">Rec.</a></span> + <br><br> + </center> + <div rel="dataholder" style="visibility:hidden"> + <span rel="type"></span> + <span rel="url"></span> + </div> + </div> + + <div id="streamrec"> + <div class="toolbar"> + <a href="#" class="back">Back</a> + <a href="#home" id="home_but" class="button">Home</a> + <h1>Recordings</h1> + </div> + <center><ul class="thumb" style="width:90px"><img class="thumbnail" id="thumbnail" src="" /></ul></center> + <ul class="streaminfo"> + <li> + <span class="name_now"></span> + <span class="epgtime_now"></span> + <span class="desc_now"></span> + </li> + </ul> + <center><br> + <span class="streamButton"><a id="edge" href="#">Edge</a></span><span class="streamButton"><a id="3g" href="#" class="cube"> 3G </a></span><span class="streamButton"><a id="wifi" href="#" class="cube">Wifi</a></span><span class="recButton"><a id="rec" href="#" class="cube">Rec.</a></span> + <br><br> + </center> + <div rel="dataholder" style="visibility:hidden"> + <span rel="type"></span> + <span rel="url"></span> + </div> + </div> + <div id="streamvid"> + <div class="toolbar"> + <a href="#" class="back">Back</a> + <a href="#home" id="home_but" class="button">Home</a> + <h1>Video</h1> + </div> + <center><ul class="thumb" style="width:190px;"><img class="thumbnail" id="thumbnail" src="" /></ul></center> + <ul class="streaminfo"> + <li> + <span class="name_now"></span> + <span class="epgtime_now"></span> + <span class="desc_now"></span> + </li> + </ul> + <center><br> + <span class="streamButton"><a id="edge" href="#">Edge</a></span><span class="streamButton"><a id="3g" href="#" class="cube"> 3G </a></span><span class="streamButton"><a id="wifi" href="#" class="cube">Wifi</a></span><span class="recButton"><a id="rec" href="#" class="cube">Rec.</a></span> + <br><br> + </center> + <div rel="dataholder" style="visibility:hidden"> + <span rel="type"></span> + <span rel="url"></span> + </div> + </div> + + <div id="streaming"> + <div class="toolbar"> + <a href="#" class="back">Back</a> + <a href="#home" id="home_but" class="button">Home</a> + <h1></h1> + </div> + <center><ul class="thumb" id="player"><img class="thumbnail" id="thumbnail" src="" /></ul></center> + <ul class="streamstatus"> + <span class="title">Status</span> + <span class="mode"></span> + </ul> + <ul class="streaminfo"> + </ul> + <center> + <span class="streamButton"><a rel="stopbroadcast" href="#">Stop stream</a></span> + <span class="recButton"><a rel="rec" href="#">Rec.</a></span> + <br><br> + </center> + <div rel="dataholder" style="visibility:hidden"> + <span rel="session"></span> + <span rel="name"></span> + <span rel="thumbwidth"></span> + <span rel="thumbheight"></span> + </div> + </div> + + <!---------------------------------- /STREAM SCREEN ----------------------------------> + <!---------------------------------- TIMERS SCREEN ----------------------------------> + + <div id="timers"> + <div class="toolbar"> + <a href="#" class="back">Home</a> + <h1><img class="menuicon" src="img/timers.png" /> TIMERS</h1> + </div> + <div class="info" id="timer_status"></div> + <ul class="rounded" rel="timers"> + </ul> + <ul class="rounded"> + <li class="arrow"><a href="#" rel="new"><span class="menuname">New Timer</span></a></li> + </ul> + </div> + + <div id="edittimer"> + <div class="toolbar"> + <a href="#" class="back">Back</a> + <a href="#home" id="home_but" class="button slideup">Home</a> + <h1></h1> + </div> + <form name="timer" id="timer" action=""> + <ul class="rounded"> + <li><span class="timertitle">Active</span><span class="toggle"><input id="timer_active" name="timer_active" type="checkbox" /></span></li> + </ul> + <ul class="rounded" rel="name"> + <li><span class="timertitle">Name</span></li> + <li class="formerror" id="timer_name_error"><span class="formerrormsg">Recording name is missing</span></li> + <li><input type="text" name="name" placeholder="Enter recording name" id="timer_name" style="color: #FFFFFF" /></li> + </ul> + <ul class="rounded" rel="channel"> + <li> + <span class="timertitle">Channel</span> + </li> + <li> + <select id="timer_chan"> + </select> + </li> + </ul> + <ul class="rounded" rel="date"> + <li><span class="timertitle">Date</span></li> + <li class="formerror" id="timer_date_error"><span class="formerrormsg">Date is missing</span></li> + <li class="arrow"><a id="a_date" class="abutton" href="#" onClick="$('#timer_date_error').hide();"><span class="menuname" id="layer_date">Select date</span></a></li> + + </ul> + <ul class="rounded" rel="stime"> + <li><span class="timertitle">Start time</span></li> + <li class="formerror" id="timer_starttime_error"><span class="formerrormsg">Starting time is missing</span></li> + <li class="arrow"><a id="a_starttime" class="abutton" href="#" onClick="$('#timer_starttime_error').hide();"><span class="menuname" id="layer_starttime">Select start time</span></a></li> + + </ul> + <ul class="rounded" rel="etime"> + <li><span class="timertitle">End time</span></li> + <li class="formerror" id="timer_endtime_error"><span class="formerrormsg">Ending time is missing</span></li> + <li class="arrow"><a id="a_endtime" class="abutton" href="#" onClick="$('#timer_endtime_error').hide();"><span class="menuname" id="layer_endtime">Select end time</span></a></li> + </ul> + <input name="timer_id" type="hidden" id="timer_id" value="" /> + <input name="timer_date" type="hidden" id="timer_date" value="" /> + <input name="timer_starttime" type="hidden" id="timer_starttime" value="" /> + <input name="timer_endtime" type="hidden" id="timer_endtime" value="" /> + </form> + </div> + <!---------------------------------- /TIMERS SCREEN ----------------------------------> + <!---------------------------------- AUDIO ----------------------------------------> + <div id="audio"> + <div class="toolbar"> + <a href="#" class="back">Home</a> + <h1><img class="menuicon" src="img/audio.png" /> Audio</h1> + </div> + <ul class="rounded"> + <li class="arrow"><a class="cube" href="#audio"><span class="menuname">Album1</span></a></li> + <li class="arrow"><a class="cube" href="#audio"><span class="menuname">Album2</span></a></li> + <li class="track"><div class="numberbox"><span class="number">1</span></div><a class="cube" href="#startstream"><span class="tracktitle">track1.mp3</span></a><div class="timebox"><span class="time">2:35</span></div></li> + <li class="track"><div class="numberbox"><span class="number">2</span></div><a class="cube" href="#startstream"><span class="tracktitle">track2.mp3</span></a><div class="timebox"><span class="time">1:12</span></div></li> + <li class="track"><div class="numberbox"><span class="number">3</span></div><a class="cube" href="#startstream"><span class="tracktitle">track3.mp3</span></a><div class="timebox"><span class="time">3:25</span></div></li> + <li class="track"><div class="numberbox"><span class="number">4</span></div><a class="cube" href="#startstream"><span class="tracktitle">track4.mp3</span></a><div class="timebox"><span class="time">4:02</span></div></li> + </ul> + </div> + <!---------------------------------- /AUDIO ----------------------------------------> + </div> + </body> +</html>
\ No newline at end of file diff --git a/index.php b/index.php deleted file mode 100755 index 3cdbec4..0000000 --- a/index.php +++ /dev/null @@ -1,35 +0,0 @@ -<?php -include('includes/include.php'); -?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" manifest="istreamdev.manifest"> - -<head> -<meta content="yes" name="apple-mobile-web-app-capable" /> -<meta http-equiv="content-type" content="text/html; charset=UTF-8"> -<meta content="minimum-scale=1.0, width=device-width, maximum-scale=0.6667, user-scalable=no" name="viewport" /> -<link href="css/style.css" rel="stylesheet" type="text/css" /> -<script src="javascript/spinningwheel-min.js" type="text/javascript"></script> -<script src="javascript/ajax.js" type="text/javascript"></script> -<script src="javascript/functions.js" type="text/javascript"></script> -<title>iStreamdev</title> -<link href="images/startup.png" rel="apple-touch-startup-image" /> -<link rel="apple-touch-icon" href="images/istreamdev.png"/> -<link rel="stylesheet" href="css/spinningwheel.css" type="text/css" media="all" /> -</head> - - -<?php - selectpage(); -?> - -<div id="footer"> - - iStreamdev version: <? print $isdversion; ?> -</div> - -</body> - -</html> - - diff --git a/indexfake.html b/indexfake.html new file mode 100644 index 0000000..222335b --- /dev/null +++ b/indexfake.html @@ -0,0 +1,551 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" manifest="istreamdev.manifest"> + <head> + <meta charset="UTF-8" /> + <title>iStreamdev</title> + <style type="text/css" media="screen">@import "jqtouch/jqtouch.css";</style> + <style type="text/css" media="screen">@import "themes/jqt/theme.css";</style> + <script src="jqtouch/jquery.1.3.2.min.js" type="text/javascript" charset="utf-8"></script> + <script src="jqtouch/jqtouch.js" type="application/x-javascript" charset="utf-8"></script> + <script src="jqtouch/jqtouch.transitions.js" type="application/x-javascript" charset="utf-8"></script> + <script src="js/spinningwheel.js" type="application/x-javascript" charset="utf-8"></script> + <script src="js/functions.js" type="application/x-javascript" charset="utf-8"></script> + <style type="text/css" media="screen">@import "css/spinningwheel.css";</style> + <script type="text/javascript" charset="utf-8"> + + $.jQTouch({ + icon: 'img/istreamdev.png', + addGlossToIcon: true, + useFastTouch: true, + startupScreen: 'img/startup.png', + statusBar: 'black', + iconIsGlossy: true, + fullscreen: true, + preloadImages: [ + 'themes/jqt/img/chevron.png', + 'themes/jqt/img/back_button.png', + 'themes/jqt/img/back_button_clicked.png', + 'themes/jqt/img/button_clicked.png', + 'themes/jqt/img/button.png', + 'theme/jqt/img/button_clicked.png', + 'theme/jqt/img/loading.gif', + 'theme/jqt/img/toolbar.png', + 'theme/jqt/img/on_off.png', + 'img/audio.png', + 'img/epg.png', + 'img/media.png', + 'img/record.png', + 'img/timers.png', + 'img/timeron.png', + 'img/timeroff.png', + 'img/timerrec.png', + 'img/tv.png', + 'img/video.png', + 'img/stream.png', + 'img/stream_clicked.png', + 'img/istreamdev.png', + 'img/mask.png', + 'img/nologoTV.png', + 'img/nologoREC.png', + 'img/nologoMEDIA.png', + 'img/rec.png', + 'img/rec_clicked.png', + 'img/sw-alpha.png', + 'img/sw-button-cancel.png', + 'img/sw-button-done.png', + 'img/sw-header.png', + 'img/sw-slot-border.png' + ] + }); + + $(document).ready(function(e){ + $('#streaming').bind('pageAnimationEnd', function(event, info){ + if (info.direction == 'in') { + $('#player').html('<video id="videofeed" width="80" height="80" poster="logos/TF1.png" ></video>'); + } + }) + $('#streaming').bind('pageAnimationStart', function(event, info){ + if (info.direction == 'out') { + $('#player').html('<img class="thumbnail" id="thumbnail" src="logos/TF1.png"></img>'); + } + }) + }); + + $('#home_but').tap(function(event) { + event.preventDefault(); + window.location = "#home"; + }); + + $(function() { + $('a[class="abutton"]').click(function() { + $(this).removeClass('active'); + }); + + }); + + $(function() { + $('.formerror').hide(); + $(".submit_form").click(function() { + $(this).removeClass('active'); + + $('.formerror').hide(); + var timer_name = $("input#timer_name").val(); + if (timer_name == "") { + $("li#timer_name_error").show(); + $("input#timer_name").focus(); + return false; + } + var timer_chan = $("input#timer_date").val(); + if (timer_chan == "") { + $("li#timer_date_error").show(); + $("a#a_date").focus(); + return false; + } + var timer_starttime = $("input#timer_starttime").val(); + if (timer_starttime == "") { + $("li#timer_starttime_error").show(); + $("a#a_starttime").focus(); + return false; + } + var timer_endtime = $("input#timer_endtime").val(); + if (timer_endtime == "") { + $("li#timer_endtime_error").show(); + $("a#a_endtime").focus(); + return false; + } + var timer_chan = $("select#timer_chan").val(); + var timer_active = $("input#timer_active").val(); + var dataString = 'action=edittimer&timer_name='+ timer_name + '&timer_chan=' + timer_chan + '&timer_date=' + timer_date + '&timer_starttime=' + timer_starttime + 'timer_endtime=' + timer_endtime + 'timer_active=' + timer_active; + $.ajax({ + type: "POST", + url: "bin/process.php", + data: dataString, + success: function() { + window.location = "#timers"; + $('#timer_status').html('New timer created successfully'); + $('#timer_status').show(); + return false; + } + + }); + window.location = "#timers"; + $('#timer_status').html('Error: Timer was not created'); + $('#timer_status').show(); + return false; + }); + }); + </script> + <style type="text/css"> + img.menuicon { + vertical-align: middle; + } + .menuname { + vertical-align: middle; + margin: 0 0 0 10px; + } + + li.forward > a > span, span.substring { + vertical-align: middle; + } + li.channellist { + height: 55px; + background-image: url(img/chevron.png), -webkit-gradient(linear, 0% 0%, 0% 100%, from(#4c4d4e), to(#404142)); + background-position: right center; + background-repeat: no-repeat; + } + + li.channellist img { + width: 55px; + height: 55px; + vertical-align: middle; + position: relative; + -webkit-mask-box-image: url(img/mask.png) 80 stretch; + top: 0px; + } + + li.channellist span.name { + margin: 10px 0 0 0px; + left: 90px; + text-overflow: ellipsis; + overflow: hidden; + max-width: 80%!important; + white-space: nowrap; + font-size: 17px; + line-height: normal; + position: absolute; + font-weight: bold; + + } + li.channellist span.comment { + margin: 28px 0 0 0px; + left: 90px; + max-width: 80%!important; + font-size: 14px; + line-height: normal; + position: absolute; + top: 15 px; + font-style: italic; + font-weight: normal; + } + ul.thumb { + -webkit-border-radius: 8px; + -webkit-box-shadow: rgba(0,0,0,.3) 1px 1px 3px; + } + + .thumbnail { + -webkit-mask-box-image: url(img/mask.png) 80 stretch; + vertical-align: middle; + margin: 5px 0 5px 0; + } + + span.streamButton a{ + margin: 5px 5px 5px 5px; + border-width: 0 12px; + padding: 8px; + text-align: center; + font-size: 14px; + font-weight: bold; + text-decoration: inherit; + color: inherit; + -webkit-border-image: url(img/stream.png) 0 12 0 12; + color: #FFFFFF; + } + span.streamButton a:active{ + color: #aaa; + -webkit-border-image: url(img/stream_clicked.png) 0 12 0 12; + } + span.recButton a{ + margin: 5px 5px 5px 5px; + border-width: 0 12px; + padding: 8px; + text-align: center; + font-size: 14px; + font-weight: bold; + text-decoration: inherit; + color: inherit; + -webkit-border-image: url(img/rec.png) 0 12 0 12; + color: #FFFFFF; + } + span.recButton a:active{ + color: #aaa; + -webkit-border-image: url(img/rec_clicked.png) 0 12 0 12; + } + + ul.streaminfo { + -webkit-border-radius: 8px; + -webkit-box-shadow: rgba(0,0,0,.3) 1px 1px 3px; + } + + ul.streaminfo span.name { + padding-top: 10px; + padding-right: 10px; + padding-left: 10px; + font-size: 17px; + font-weight: bold; + display: block; + color: white; + text-shadow: rgba(0,0,0,.8) 0 1px 0; + } + ul.streaminfo span.epgtime { + padding-top: 5px; + padding-right: 10px; + padding-left: 10px; + font-size: 14px; + font-weight: bold; + display: block; + text-shadow: rgba(0,0,0,.8) 0 1px 0; + } + ul.streaminfo span.desc { + position: relative; + padding-top: 10px; + padding-right: 10px; + padding-bottom: 10px; + padding-left: 10px; + display: block; + color: white; + font-size: 14px; + font-style: italic; + font-weight: normal; + line-height: normal; + + } + ul.streamstatus { + -webkit-border-radius: 8px; + -webkit-box-shadow: rgba(0,0,0,.3) 1px 1px 3px; + } + ul.streamstatus span.title { + padding-top: 10px; + padding-right: 10px; + padding-left: 10px; + font-size: 17px; + font-weight: bold; + display: block; + color: white; + text-shadow: rgba(0,0,0,.8) 0 1px 0; + } + + ul.streamstatus span.mode { + position: relative; + padding-top: 10px; + padding-right: 10px; + padding-bottom: 10px; + padding-left: 10px; + display: block; + color: white; + font-size: 14px; + font-style: italic; + font-weight: normal; + line-height: normal; + } + #jqt ul li select option{ + color: #000000; + } + #jqt ul li select optgroup{ + color: #999; + } + span.timertitle { + padding-right: 10px; + padding-left: 10px; + font-size: 14px; + font-weight: bold; + color: #999; + text-shadow: rgba(0,0,0,.8) 0 1px 0; + } + span.menutitle { + padding-right: 10px; + padding-left: 10px; + font-size: 17px; + font-weight: bold; + color: #999; + text-shadow: rgba(0,0,0,.8) 0 1px 0; + } + .formerrormsg { + padding-right: 10px; + padding-left: 10px; + font-size: 12px; + color: #FF8300; + + } + #timers .info { + display: none; + } + + </style> + </head> + <body> + <div id="jqt"> + <!---------------------------------- HOME SCREEN ----------------------------------> + <div id="home" class="current"> + <div class="toolbar"> + <h1>HOME</h1> + </div> + <ul class="rounded"> + <li><span class="menutitle">VDR</span></li> + <li class="arrow"><a class="cube" href="#categories"><img class="menuicon" src="img/tv.png" /><span class="menuname">Watch TV</span></a></li> + <li class="arrow"><a class="cube" href="#browser"><img class="menuicon" src="img/record.png" /><span class="menuname">Recordings</span></a></li> + <li class="arrow"><a class="cube" href="#timers"><img class="menuicon" src="img/timers.png" /><span class="menuname">Timers</span></a></li> + <li class="arrow"><a class="cube" href="#epg"><img class="menuicon" src="img/epg.png" /><span class="menuname">Program Guide</span></a></li> + </ul> + <ul class="rounded"> + <li><span class="menutitle">FILES</span></li> + <li class="arrow"><a class="cube" href="#browser"><img class="menuicon" src="img/video.png" /><span class="menuname">Video</span></a></li> + <li class="arrow"><a class="cube" href="#audio"><img class="menuicon" src="img/audio.png" /><span class="menuname">Audio</span></a></li> + </ul> + </div> + <!----------------------------------/ HOME SCREEN ----------------------------------> + + <!---------------------------------- CHAN CATEGORY SCREEN ----------------------------------> + <div id="categories"> + <div class="toolbar"> + <a href="#home" class="back">Home</a> + <h1>CATEGORIES</h1> + </div> + <ul class="rounded"> + <li class="arrow"><a class="cube" href="#channels" rel="Nationales & Tnt">NATIONALES & TNT</a><small class="counter">17</small></li> + <li class="arrow"><a class="cube" href="#channels" rel="Divertissements">DIVERTISSEMENTS</a><small class="counter">12</small></li> + </div> + <!---------------------------------- /CHAN CATEGORY SCREEN ----------------------------------> + <!---------------------------------- CHANNELS SCREEN ----------------------------------> + <div id="channels"> + <div class="toolbar"> + <a href="#" class="back">Back</a> + <a href="#home" id="home_but" class="button slideup">Home</a> + <h1>CHANNELS</h1> + </div> + <ul class="rounded"> + <li class="channellist"><a class="cube" href="#startstream" rel="TF1"><img src="logos/TF1.png"/><span class="name">TF1</span><span class="comment">Journal de 13h</span></a></li> + <li class="channellist"><a class="cube" href="#startstream" rel="FRANCE 2"><img src="logos/FRANCE 2.png"/><span class="name">FRANCE 2</span><span class="comment">Tournez Manège</span></a></li> + <li class="channellist"><a class="cube" href="#startstream" rel="FRANCE 3"><img src="logos/FRANCE 3.png"/><span class="name">FRANCE 3</span><span class="comment">Journal Régional</span></a></li> + <li class="channellist"><a class="cube" href="#startstream" rel="TF1"><img src="logos/TF1.png"/><span class="name">TF1</span><span class="comment">Journal de 13h</span></a></li> + <li class="channellist"><a class="cube" href="#startstream" rel="TF1"><img src="logos/TF1.png"/><span class="name">TF1</span><span class="comment">Journal de 13h</span></a></li> + <li class="channellist"><a class="cube" href="#startstream" rel="TF1"><img src="logos/TF1.png"/><span class="name">TF1</span><span class="comment">Journal de 13h</span></a></li> + <li class="channellist"><a class="cube" href="#startstream" rel="TF1"><img src="logos/TF1.png"/><span class="name">TF1</span><span class="comment">Journal de 13h</span></a></li> + <li class="channellist"><a class="cube" href="#startstream" rel="TF1"><img src="logos/TF1.png"/><span class="name">TF1</span><span class="comment">Journal de 13h</span></a></li> + <li class="channellist"><a class="cube" href="#startstream" rel="TF1"><img src="logos/TF1.png"/><span class="name">TF1</span><span class="comment">Journal de 13h</span></a></li> + <li class="channellist"><a class="cube" href="#startstream" rel="TF1"><img src="logos/TF1.png"/><span class="name">TF1</span><span class="comment">Journal de 13h</span></a></li> + + </ul> + </div> + <!---------------------------------- /CHANNELS SCREEN ----------------------------------> + <!---------------------------------- START STREAM ----------------------------------> + <div id="startstream"> + <div class="toolbar"> + <a href="#" class="back">Back</a> + <a href="#home" id="home_but" class="button slideup">Home</a> + <h1>TF1</h1> + </div> + <center><ul class="thumb" style="width:90px"><img class="thumbnail" id="thumbnail" src="logos/TF1.png" /></ul></center> + + <ul class="streaminfo"> + <span class="epgtime">Now: 19h00-19h45</span> + <span class="name">Tout le monde veut prendre sa place</span> + <span class="desc">Jeu présenté par Nagui. Six candidats s'affrontent lors d'un quiz pour prendre la place du champion et remporter des gains.</span> + <span class="epgtime">Next: 19h45-20h45</span> + <span class="name">Informations</span> + </ul> + <center> + <span class="streamButton"><a href="#streaming" class="cube">Edge</a></span><span class="streamButton"><a href="#streaming" class="cube"> 3G </a></span><span class="streamButton"><a href="#streaming" class="cube">Wifi</a></span><span class="recButton"><a href="#" class="cube">Rec.</a></span> + </center> + </div> + <!---------------------------------- /START STREAM ----------------------------------> + <!---------------------------------- STREAMING ----------------------------------> + <div id="streaming"> + <div class="toolbar"> + <a href="#" class="back">Back</a> + <a href="#home" id="home_but" class="button slideup">Home</a> + <h1>TF1</h1> + </div> + <center><ul class="thumb" id="player" style="width:90px"><img class="thumbnail" id="thumbnail" src="logos/TF1.png" /></ul></center> + + <ul class="streaminfo"> + <span class="epgtime">2010-03-02 19h00-19h45</span> + <span class="name">Tout le monde veut prendre sa place</span> + <span class="desc">Jeu présenté par Nagui. Six candidats s'affrontent lors d'un quiz pour prendre la place du champion et remporter des gains.</span> + </ul> + <ul class="streamstatus"> + <span class="title">Status</span> + <span class="mode">Now streaming in 3G mode</span> + </ul> + <center> + <span class="streamButton"><a href="#startstream" class="slide goback">Stop stream</a></span> + <span class="recButton"><a href="#" class="cube">Rec.</a></span> + <br><br> + </center> + </div> + <!---------------------------------- /STREAMING ----------------------------------> + <!---------------------------------- BROWSER ----------------------------------> + <div id="browser"> + <div class="toolbar"> + <a href="#" class="back">Home</a> + <h1>RECORDINGS</h1> + </div> + <ul class="rounded"> + <li class="arrow"><a class="cube" href="#browser2"><span class="menuname">Movies</span></a></li> + <li class="arrow"><a class="cube" href="#browser2"><span class="menuname">TV Shows</span></a></li> + <li><a class="cube" href="#startstream"><img class="menuicon" src="img/video.png" /><span class="menuname">Gran.Torino-Trailer.avi</span></a></li> + </ul> + </div> + + <!---------------------------------- /BROWSER ---------------------------------> + <!---------------------------------- BROWSER ----------------------------------> + <div id="browser2"> + <div class="toolbar"> + <a href="#" class="back">Back</a> + <a href="#home" id="home_but" class="button slideup">Home</a> + <h1>RECORDINGS</h1> + </div> + <ul class="rounded"> + <li><a class="cube" href="#startstream"><img class="menuicon" src="img/video.png" /><span class="menuname">Ghostbuster.avi</span></a></li> + <li><a class="cube" href="#startstream"><img class="menuicon" src="img/video.png" /><span class="menuname">Starwars-Ep.1.avi</span></a></li> + <li><a class="cube" href="#startstream"><img class="menuicon" src="img/video.png" /><span class="menuname">Starwars-Ep.2.avi</span></a></li> + </ul> + </div> + + <!---------------------------------- /BROWSER ---------------------------------> + <!---------------------------------- TIMERS ---------------------------------> + <div id="timers"> + <div class="toolbar"> + <a href="#" class="back">Home</a> + <h1>TIMERS</h1> + </div> + <div class="info" id="timer_status"></div> + <ul class="rounded"> + <li><span class="menutitle">Current timers</span></li> + <li class="arrow"><a class="cube" href="#edittimer"><img class="menuicon" src="img/timeron.png" /><span class="menuname">2010-03-08 La Ferme Célébrité</span></a></li> + <li class="arrow"><a class="cube" href="#edittimer"><img class="menuicon" src="img/timeroff.png" /><span class="menuname">2010-03-12 Football</span></a></li> + <li class="arrow"><a class="cube" href="#edittimer"><img class="menuicon" src="img/timerrec.png" /><span class="menuname">2010-03-05 Le Journal</span></a></li> + </ul> + <ul class="rounded"> + <li class="arrow"><a class="cube" href="#edittimer"><span class="menuname">New Timer</span></a></li> + </ul> + </div> + <!---------------------------------- /TIMERS ---------------------------------> + <!---------------------------------- EDIT TIMERS ---------------------------------> + <div id="edittimer"> + <div class="toolbar"> + <a href="#" class="back">Back</a> + <a href="#home" id="home_but" class="button slideup">Home</a> + <h1>EDIT TIMER</h1> + </div> + <form name="timer" id="timer" action=""> + <ul class="rounded"> + <li><span class="timertitle">Active</span><span class="toggle"><input id="timer_active" name="timer_active" type="checkbox" checked/></span></li> + </ul> + <ul class="rounded"> + <li><span class="timertitle">Name</span></li> + <li class="formerror" id="timer_name_error"><span class="formerrormsg">Recording name is missing</span></li> + <li><input type="text" name="name" placeholder="Enter recording name" id="timer_name" style="color: #FFFFFF"/></li> + </ul> + <ul class="rounded"> + <li><span class="timertitle">Channel</span></li> + <li><select id="timer_chan"> + <optgroup label="NATIONALES & TNT"> + <option value="1">TF1</option> + <option value="2">FRANCE 2</option> + <option value="3">FRANCE 3</option> + <option value="4">FRANCE 4</option> + <option value="5">TV5</option> + <option value="6">M6</option> + </optgroup> + <optgroup label="DIVERTISSEMENT"> + <option value="11">COMEDIE!</option> + <option value="12">13EME RUE</option> + <option value="13">FOX LIFE</option> + </optgroup> + </select> + </li> + </ul> + <ul class="rounded"> + <li><span class="timertitle">Date</span></li> + <li class="formerror" id="timer_date_error"><span class="formerrormsg">Date is missing</span></li> + <li class="arrow"><a id="a_date" class="abutton" href="javascript:openSelectDate(2010,03,05);" onClick="$('#timer_date_error').hide();"><span class="menuname" id="layer_date">Select date</span></a></li> + + </ul> + <ul class="rounded"> + <li><span class="timertitle">Start time</span></li> + <li class="formerror" id="timer_starttime_error"><span class="formerrormsg">Starting time is missing</span></li> + <li class="arrow"><a id="a_starttime" class="abutton" href="javascript:openSelectTime('layer_starttime','20','30')" onClick="$('#timer_starttime_error').hide();"><span class="menuname" id="layer_starttime">Select start time</span></a></li> + + </ul> + <ul class="rounded"> + <li><span class="timertitle">End time</span></li> + <li class="formerror" id="timer_endtime_error"><span class="formerrormsg">Ending time is missing</span></li> + <li class="arrow"><a id="a_endtime" class="abutton" href="javascript:openSelectTime('layer_endtime','20','30')" onClick="$('#timer_endtime_error').hide();"><span class="menuname" id="layer_endtime">Select end time</span></a></li> + </ul> + + <input name="timer_date" type="hidden" id="timer_date" value="" \> + <input name="timer_starttime" type="hidden" id="timer_starttime" value="" /> + <input name="timer_endtime" type="hidden" id="timer_endtime" value="" /> + <ul class="individual"> + <li><a class="submit_form" href="#">Edit</a></li> + <li><a class="abutton" href="javascript:deletetimer('montimer');">Delete</a></li> + </ul> + <ul class="rounded"> + <li><center><a class="submit_form" href="#">Create</a></center></li> + </ul> + </form> + </div> + <!---------------------------------- /EDIT TIMERS ---------------------------------> + </div> + </body> +</html>
\ No newline at end of file diff --git a/istream.sh b/istream.sh deleted file mode 100755 index 9e8fc97..0000000 --- a/istream.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash - -STREAM=$1 -VRATE=$2 -ARATE=$3 -ACHANNELS=$4 -XY=$5 -HTTP_PATH="$6ram/" - -SEGDUR=10 # Length of Segments produced (between 10 and 30) -SEGWIN=$7 # Amount of Segments to produce -FFPATH=$8 -SEGMENTERPATH=$9 -SESSION=${10} - -if [ $# -eq 0 ] -then -echo "Format is : ./istream.sh source video_rate audio_rate audio_channels 480x320 httppath segments_number ffmpeg_path segmenter_path" -exit 1 -fi - -############################################################# -# start dumping the TS via Streamdev into a pipe for ffmpeg -# and store baseline 3.0 mpegts to outputfile -# sending it to the segmenter via a PIPE -############################################################## - -cd ram/$SESSION - -2> /dev/null rm stream*.ts - -2> /dev/null $FFPATH -i "$STREAM" -deinterlace -f mpegts -acodec libmp3lame -ab $ARATE -ac $ACHANNELS -s $XY -vcodec libx264 -b $VRATE -flags +loop \ - -cmp \+chroma -partitions +parti4x4+partp8x8+partb8x8 -subq 5 -trellis 1 -refs 1 -coder 0 -me_range 16 -keyint_min 25 \ - -sc_threshold 40 -i_qfactor 0.71 -bt $VRATE -maxrate $VRATE -bufsize $VRATE -rc_eq 'blurCplx^(1-qComp)' -qcomp 0.6 \ - -qmin 10 -qmax 51 -qdiff 4 -level 30 -g 30 -async 2 -threads 4 - | \ -$SEGMENTERPATH - $SEGDUR stream stream.m3u8 $HTTP_PATH$SESSION/ $SEGWIN & diff --git a/istreamdev.manifest b/istreamdev.manifest index 1330719..b194aa5 100644 --- a/istreamdev.manifest +++ b/istreamdev.manifest @@ -1,5 +1,36 @@ CACHE MANIFEST - -images/* -logos/* - +themes/jqt/img/chevron.png +themes/jqt/img/back_button.png +themes/jqt/img/back_button_clicked.png +themes/jqt/img/button_clicked.png +themes/jqt/img/button.png +themes/jqt/img/button_clicked.png +themes/jqt/img/loading.gif +themes/jqt/img/toolbar.png +themes/jqt/img/on_off.png +img/loading.gif +img/audio.png +img/epg.png +img/media.png +img/record.png +img/timers.png +img/timeron.png +img/timeroff.png +img/timerrec.png +img/tv.png +img/video.png +img/stream.png +img/stream_clicked.png +img/istreamdev.png +img/mask.png +img/nologoTV.png +img/nologoREC.png +img/nologoMEDIA.png +img/rec.png +img/rec_clicked.png +img/sw-alpha.png +img/sw-button-cancel.png +img/sw-button-done.png +img/sw-header.png +img/sw-slot-border.png +logos/*
\ No newline at end of file diff --git a/javascript/ajax.js b/javascript/ajax.js deleted file mode 100755 index 9b5db5e..0000000 --- a/javascript/ajax.js +++ /dev/null @@ -1,61 +0,0 @@ -function ajax(session) -{ - var xhr=null; - - xhr = new XMLHttpRequest(); - //on définit l'appel de la fonction au retour serveur - xhr.onreadystatechange = function() { alert_ajax(xhr, session); }; - - xhr.open("GET", "streamstatus.php?session=" + session, true); - xhr.send(null); -} - -function alert_ajax(xhr, session) -{ - if (xhr.readyState==4) - { - var docXML= xhr.responseXML; - var streamstatus = null; - var items = docXML.getElementsByTagName("streamstatus"); - streamstatus = items.item(0).firstChild.data; - if ( streamstatus == 'error' ) { - var items2 = docXML.getElementsByTagName("message"); - var errmessage = items2.item(0).firstChild.data; - errorMsg(errmessage); - } - else - swapPic(session); - } -} - -function playmusic(path,name) -{ - var xhr=null; - - xhr = new XMLHttpRequest(); - //on définit l'appel de la fonction au retour serveur - xhr.onreadystatechange = function() { openpls(xhr); }; - encpath=escape(path); - encname=escape(name); - xhr.open("GET", "genplaylist.php?path=" + encpath + "&name=" + encname, false); - xhr.send(null); - -} - -function openpls(xhr) -{ - if (xhr.readyState==4) - { - var docXML= xhr.responseXML; - var streamstatus = null; - var items = docXML.getElementsByTagName("m3u") - - streamstatus = items.item(0).firstChild.data; - if ( streamstatus == 'error' ) { - this.location.href = 'error.php'; - } - - //this.location.href = 'playlist/playlist.m3u'; - //document.s1.Play(); - } -} diff --git a/jqtouch/.svn/all-wcprops b/jqtouch/.svn/all-wcprops new file mode 100644 index 0000000..67b37e1 --- /dev/null +++ b/jqtouch/.svn/all-wcprops @@ -0,0 +1,29 @@ +K 25
+svn:wc:ra_dav:version-url
+V 31
+/svn/!svn/ver/133/trunk/jqtouch
+END
+jqtouch.css
+K 25
+svn:wc:ra_dav:version-url
+V 43
+/svn/!svn/ver/133/trunk/jqtouch/jqtouch.css
+END
+jqtouch.transitions.js
+K 25
+svn:wc:ra_dav:version-url
+V 53
+/svn/!svn/ver/72/trunk/jqtouch/jqtouch.transitions.js
+END
+jqtouch.js
+K 25
+svn:wc:ra_dav:version-url
+V 42
+/svn/!svn/ver/133/trunk/jqtouch/jqtouch.js
+END
+jquery.1.3.2.min.js
+K 25
+svn:wc:ra_dav:version-url
+V 50
+/svn/!svn/ver/28/trunk/jqtouch/jquery.1.3.2.min.js
+END
diff --git a/jqtouch/.svn/entries b/jqtouch/.svn/entries new file mode 100644 index 0000000..d44e925 --- /dev/null +++ b/jqtouch/.svn/entries @@ -0,0 +1,164 @@ +10
+
+dir
+133
+http://jqtouch.googlecode.com/svn/trunk/jqtouch
+http://jqtouch.googlecode.com/svn
+
+
+
+2010-01-15T21:08:54.001495Z
+133
+RBoulanouar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+210952ee-217a-11de-8f7e-2b794b28c5cd
+
+jqtouch.css
+file
+
+
+
+
+2010-03-04T14:47:59.244073Z
+898ec31c8e5cf1d6252df62fd19ccbda
+2010-01-15T21:08:54.001495Z
+133
+RBoulanouar
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+7795
+
+jqtouch.transitions.js
+file
+
+
+
+
+2010-03-04T14:47:59.244073Z
+7bc05f2402439d5cbec9289f97e57c17
+2009-09-22T22:22:25.485736Z
+72
+davidcolbykaneda
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+2144
+
+jqtouch.js
+file
+
+
+
+
+2010-03-04T14:47:59.245073Z
+d8734e570dbe87ac837cda20c8b6f4d3
+2010-01-15T21:08:54.001495Z
+133
+RBoulanouar
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+23145
+
+jquery.1.3.2.min.js
+file
+
+
+
+
+2010-03-04T14:47:59.245073Z
+bb381e2d19d8eace86b34d20759491a5
+2009-07-28T15:50:29.885230Z
+28
+david@dyadcom.com
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+57254
+
diff --git a/jqtouch/.svn/prop-base/jqtouch.css.svn-base b/jqtouch/.svn/prop-base/jqtouch.css.svn-base new file mode 100644 index 0000000..be4ccab --- /dev/null +++ b/jqtouch/.svn/prop-base/jqtouch.css.svn-base @@ -0,0 +1,13 @@ +K 13 +svn:eol-style +V 6 +native +K 12 +svn:keywords +V 30 +LastChangedBy Date Revision Id +K 13 +svn:mime-type +V 8 +text/css +END diff --git a/jqtouch/.svn/prop-base/jqtouch.js.svn-base b/jqtouch/.svn/prop-base/jqtouch.js.svn-base new file mode 100644 index 0000000..2897092 --- /dev/null +++ b/jqtouch/.svn/prop-base/jqtouch.js.svn-base @@ -0,0 +1,13 @@ +K 13 +svn:eol-style +V 6 +native +K 12 +svn:keywords +V 30 +LastChangedBy Date Revision Id +K 13 +svn:mime-type +V 15 +text/javascript +END diff --git a/jqtouch/.svn/prop-base/jquery.1.3.2.min.js.svn-base b/jqtouch/.svn/prop-base/jquery.1.3.2.min.js.svn-base new file mode 100644 index 0000000..2897092 --- /dev/null +++ b/jqtouch/.svn/prop-base/jquery.1.3.2.min.js.svn-base @@ -0,0 +1,13 @@ +K 13 +svn:eol-style +V 6 +native +K 12 +svn:keywords +V 30 +LastChangedBy Date Revision Id +K 13 +svn:mime-type +V 15 +text/javascript +END diff --git a/jqtouch/.svn/text-base/jqtouch.css.svn-base b/jqtouch/.svn/text-base/jqtouch.css.svn-base new file mode 100644 index 0000000..5c3e736 --- /dev/null +++ b/jqtouch/.svn/text-base/jqtouch.css.svn-base @@ -0,0 +1,373 @@ +* { + margin: 0; + padding: 0; +} +a { + -webkit-tap-highlight-color: rgba(0,0,0,0); +} + +div#jqt { + /*overflow-x: hidden;*/ + -webkit-user-select: none; + -webkit-text-size-adjust: none; + font-family: "Helvetica Neue", Helvetica; + -webkit-perspective: 800; + -webkit-transform-style: preserve-3d; +} +#jqt .selectable, #jqt input, #jqt textarea { + -webkit-user-select: auto; +} +div#jqt > * { + -webkit-backface-visibility: hidden; + -webkit-box-sizing: border-box; + display: none; + position: absolute; + left: 0; + width: 100%; + -webkit-transform: translate3d(0,0,0) rotate(0) scale(1); + min-height: 420px !important; +} +#jqt.fullscreen > * { + min-height: 460px !important; +} +#jqt.fullscreen.black-translucent > * { + min-height: 480px !important; +} +#jqt.landscape > * { + min-height: 320px !important; +} +div#jqt > .current { + display: block !important; +} + +#jqt .in, #jqt .out { + -webkit-animation-timing-function: ease-in-out; + -webkit-animation-duration: 350ms; +} + +#jqt .slide.in { + -webkit-animation-name: slideinfromright; +} + +#jqt .slide.out { + -webkit-animation-name: slideouttoleft; +} + +#jqt .slide.in.reverse { + -webkit-animation-name: slideinfromleft; +} + +#jqt .slide.out.reverse { + -webkit-animation-name: slideouttoright; +} + +@-webkit-keyframes slideinfromright { + from { -webkit-transform: translateX(100%); } + to { -webkit-transform: translateX(0); } +} + +@-webkit-keyframes slideinfromleft { + from { -webkit-transform: translateX(-100%); } + to { -webkit-transform: translateX(0); } +} + +@-webkit-keyframes slideouttoleft { + from { -webkit-transform: translateX(0); } + to { -webkit-transform: translateX(-100%); } +} + +@-webkit-keyframes slideouttoright { + from { -webkit-transform: translateX(0); } + to { -webkit-transform: translateX(100%); } +} + +@-webkit-keyframes fadein { + from { opacity: 0; } + to { opacity: 1; } +} + +@-webkit-keyframes fadeout { + from { opacity: 1; } + to { opacity: 0; } +} + +#jqt .fade.in { + z-index: 10; + -webkit-animation-name: fadein; +} +#jqt .fade.out { + z-index: 0; +} + +#jqt .dissolve.in { + -webkit-animation-name: fadein; +} + +#jqt .dissolve.out { + -webkit-animation-name: fadeout; +} + + + +#jqt .flip { + -webkit-animation-duration: .65s; +} + +#jqt .flip.in { + -webkit-animation-name: flipinfromleft; +} + +#jqt .flip.out { + -webkit-animation-name: flipouttoleft; +} + +/* Shake it all about */ + +#jqt .flip.in.reverse { + -webkit-animation-name: flipinfromright; +} + +#jqt .flip.out.reverse { + -webkit-animation-name: flipouttoright; +} + +@-webkit-keyframes flipinfromright { + from { -webkit-transform: rotateY(-180deg) scale(.8); } + to { -webkit-transform: rotateY(0) scale(1); } +} + +@-webkit-keyframes flipinfromleft { + from { -webkit-transform: rotateY(180deg) scale(.8); } + to { -webkit-transform: rotateY(0) scale(1); } +} + +@-webkit-keyframes flipouttoleft { + from { -webkit-transform: rotateY(0) scale(1); } + to { -webkit-transform: rotateY(-180deg) scale(.8); } +} + +@-webkit-keyframes flipouttoright { + from { -webkit-transform: rotateY(0) scale(1); } + to { -webkit-transform: rotateY(180deg) scale(.8); } +} + +#jqt .slideup.in { + -webkit-animation-name: slideup; + z-index: 10; +} + +#jqt .slideup.out { + -webkit-animation-name: dontmove; + z-index: 0; +} + +#jqt .slideup.out.reverse { + z-index: 10; + -webkit-animation-name: slidedown; +} + +#jqt .slideup.in.reverse { + z-index: 0; + -webkit-animation-name: dontmove; +} + + +@-webkit-keyframes slideup { + from { -webkit-transform: translateY(100%); } + to { -webkit-transform: translateY(0); } +} + +@-webkit-keyframes slidedown { + from { -webkit-transform: translateY(0); } + to { -webkit-transform: translateY(100%); } +} + + + +/* Hackish, but reliable. */ + +@-webkit-keyframes dontmove { + from { opacity: 1; } + to { opacity: 1; } +} + +#jqt .swap { + -webkit-transform: perspective(800); + -webkit-animation-duration: .7s; +} +#jqt .swap.out { + -webkit-animation-name: swapouttoleft; +} +#jqt .swap.in { + -webkit-animation-name: swapinfromright; +} +#jqt .swap.out.reverse { + -webkit-animation-name: swapouttoright; +} +#jqt .swap.in.reverse { + -webkit-animation-name: swapinfromleft; +} + + +@-webkit-keyframes swapouttoright { + 0% { + -webkit-transform: translate3d(0px, 0px, 0px) rotateY(0deg); + -webkit-animation-timing-function: ease-in-out; + } + 50% { + -webkit-transform: translate3d(-180px, 0px, -400px) rotateY(20deg); + -webkit-animation-timing-function: ease-in; + } + 100% { + -webkit-transform: translate3d(0px, 0px, -800px) rotateY(70deg); + } +} + +@-webkit-keyframes swapouttoleft { + 0% { + -webkit-transform: translate3d(0px, 0px, 0px) rotateY(0deg); + -webkit-animation-timing-function: ease-in-out; + } + 50% { + -webkit-transform: translate3d(180px, 0px, -400px) rotateY(-20deg); + -webkit-animation-timing-function: ease-in; + } + 100% { + -webkit-transform: translate3d(0px, 0px, -800px) rotateY(-70deg); + } +} + +@-webkit-keyframes swapinfromright { + 0% { + -webkit-transform: translate3d(0px, 0px, -800px) rotateY(70deg); + -webkit-animation-timing-function: ease-out; + } + 50% { + -webkit-transform: translate3d(-180px, 0px, -400px) rotateY(20deg); + -webkit-animation-timing-function: ease-in-out; + } + 100% { + -webkit-transform: translate3d(0px, 0px, 0px) rotateY(0deg); + } +} + +@-webkit-keyframes swapinfromleft { + 0% { + -webkit-transform: translate3d(0px, 0px, -800px) rotateY(-70deg); + -webkit-animation-timing-function: ease-out; + } + 50% { + -webkit-transform: translate3d(180px, 0px, -400px) rotateY(-20deg); + -webkit-animation-timing-function: ease-in-out; + } + 100% { + -webkit-transform: translate3d(0px, 0px, 0px) rotateY(0deg); + } +} + +#jqt .cube { + -webkit-animation-duration: .55s; +} + +#jqt .cube.in { + -webkit-animation-name: cubeinfromright; + -webkit-transform-origin: 0% 50%; +} +#jqt .cube.out { + -webkit-animation-name: cubeouttoleft; + -webkit-transform-origin: 100% 50%; +} +#jqt .cube.in.reverse { + -webkit-animation-name: cubeinfromleft; + -webkit-transform-origin: 100% 50%; +} +#jqt .cube.out.reverse { + -webkit-animation-name: cubeouttoright; + -webkit-transform-origin: 0% 50%; + +} + +@-webkit-keyframes cubeinfromleft { + from { + -webkit-transform: rotateY(-90deg) translateZ(320px); + opacity: .5; + } + to { + -webkit-transform: rotateY(0deg) translateZ(0); + opacity: 1; + } +} +@-webkit-keyframes cubeouttoright { + from { + -webkit-transform: rotateY(0deg) translateX(0); + opacity: 1; + } + to { + -webkit-transform: rotateY(90deg) translateZ(320px); + opacity: .5; + } +} +@-webkit-keyframes cubeinfromright { + from { + -webkit-transform: rotateY(90deg) translateZ(320px); + opacity: .5; + } + to { + -webkit-transform: rotateY(0deg) translateZ(0); + opacity: 1; + } +} +@-webkit-keyframes cubeouttoleft { + from { + -webkit-transform: rotateY(0deg) translateZ(0); + opacity: 1; + } + to { + -webkit-transform: rotateY(-90deg) translateZ(320px); + opacity: .5; + } +} + + + + +#jqt .pop { + -webkit-transform-origin: 50% 50%; +} + +#jqt .pop.in { + -webkit-animation-name: popin; + z-index: 10; +} + +#jqt .pop.out.reverse { + -webkit-animation-name: popout; + z-index: 10; +} + +#jqt .pop.in.reverse { + z-index: 0; + -webkit-animation-name: dontmove; +} + +@-webkit-keyframes popin { + from { + -webkit-transform: scale(.2); + opacity: 0; + } + to { + -webkit-transform: scale(1); + opacity: 1; + } +} + +@-webkit-keyframes popout { + from { + -webkit-transform: scale(1); + opacity: 1; + } + to { + -webkit-transform: scale(.2); + opacity: 0; + } +}
\ No newline at end of file diff --git a/jqtouch/.svn/text-base/jqtouch.js.svn-base b/jqtouch/.svn/text-base/jqtouch.js.svn-base new file mode 100644 index 0000000..7641727 --- /dev/null +++ b/jqtouch/.svn/text-base/jqtouch.js.svn-base @@ -0,0 +1,624 @@ +/* + + _/ _/_/ _/_/_/_/_/ _/ + _/ _/ _/ _/_/ _/ _/ _/_/_/ _/_/_/ + _/ _/ _/_/ _/ _/ _/ _/ _/ _/ _/ _/ + _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ + _/ _/_/ _/ _/ _/_/ _/_/_/ _/_/_/ _/ _/ + _/ + _/ + + Created by David Kaneda <http://www.davidkaneda.com> + Documentation and issue tracking on Google Code <http://code.google.com/p/jqtouch/> + + Special thanks to Jonathan Stark <http://jonathanstark.com/> + and pinch/zoom <http://www.pinchzoom.com/> + + (c) 2009 by jQTouch project members. + See LICENSE.txt for license. + + $Revision$ + $Date$ + $LastChangedBy$ + +*/ + +(function($) { + $.jQTouch = function(options) { + + // Set support values + $.support.WebKitCSSMatrix = (typeof WebKitCSSMatrix == "object"); + $.support.touch = (typeof Touch == "object"); + $.support.WebKitAnimationEvent = (typeof WebKitTransitionEvent == "object"); + + // Initialize internal variables + var $body, + $head=$('head'), + hist=[], + newPageCount=0, + jQTSettings={}, + hashCheckInterval, + currentPage, + orientation, + isMobileWebKit = RegExp(" Mobile/").test(navigator.userAgent), + tapReady=true, + lastAnimationTime=0, + touchSelectors=[], + publicObj={}, + extensions=$.jQTouch.prototype.extensions, + defaultAnimations=['slide','flip','slideup','swap','cube','pop','dissolve','fade','back'], + animations=[], + hairextensions=''; + // Get the party started + init(options); + + function init(options) { + + var defaults = { + addGlossToIcon: true, + backSelector: '.back, .cancel, .goback', + cacheGetRequests: true, + cubeSelector: '.cube', + dissolveSelector: '.dissolve', + fadeSelector: '.fade', + fixedViewport: true, + flipSelector: '.flip', + formSelector: 'form', + fullScreen: true, + fullScreenClass: 'fullscreen', + icon: null, + touchSelector: 'a, .touch', + popSelector: '.pop', + preloadImages: false, + slideSelector: '#jqt > * > ul li a', + slideupSelector: '.slideup', + startupScreen: null, + statusBar: 'default', // other options: black-translucent, black + submitSelector: '.submit', + swapSelector: '.swap', + useAnimations: true, + useFastTouch: true // Experimental. + }; + jQTSettings = $.extend({}, defaults, options); + + // Preload images + if (jQTSettings.preloadImages) { + for (var i = jQTSettings.preloadImages.length - 1; i >= 0; i--) { + (new Image()).src = jQTSettings.preloadImages[i]; + }; + } + // Set icon + if (jQTSettings.icon) { + var precomposed = (jQTSettings.addGlossToIcon) ? '' : '-precomposed'; + hairextensions += '<link rel="apple-touch-icon' + precomposed + '" href="' + jQTSettings.icon + '" />'; + } + // Set startup screen + if (jQTSettings.startupScreen) { + hairextensions += '<link rel="apple-touch-startup-image" href="' + jQTSettings.startupScreen + '" />'; + } + // Set viewport + if (jQTSettings.fixedViewport) { + hairextensions += '<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;"/>'; + } + // Set full-screen + if (jQTSettings.fullScreen) { + hairextensions += '<meta name="apple-mobile-web-app-capable" content="yes" />'; + if (jQTSettings.statusBar) { + hairextensions += '<meta name="apple-mobile-web-app-status-bar-style" content="' + jQTSettings.statusBar + '" />'; + } + } + if (hairextensions) { + $head.prepend(hairextensions); + } + + // Initialize on document load: + $(document).ready(function() { + + // Add extensions + for (var i in extensions) { + var fn = extensions[i]; + if ($.isFunction(fn)) { + $.extend(publicObj, fn(publicObj)); + } + } + + // Add animations + for (var i in defaultAnimations) { + var name = defaultAnimations[i]; + var selector = jQTSettings[name + 'Selector']; + if (typeof(selector) == 'string') { + addAnimation({name:name, selector:selector}); + } + } + + touchSelectors.push('input'); + touchSelectors.push(jQTSettings.touchSelector); + touchSelectors.push(jQTSettings.backSelector); + touchSelectors.push(jQTSettings.submitSelector); + $(touchSelectors.join(', ')).css('-webkit-touch-callout', 'none'); + $(jQTSettings.backSelector).tap(liveTap); + $(jQTSettings.submitSelector).tap(submitParentForm); + + $body = $('#jqt'); + + if (jQTSettings.fullScreenClass && window.navigator.standalone == true) { + $body.addClass(jQTSettings.fullScreenClass + ' ' + jQTSettings.statusBar); + } + + // Create custom live events + $body + .bind('touchstart', handleTouch) + .bind('orientationchange', updateOrientation) + .trigger('orientationchange') + .submit(submitForm); + + if (jQTSettings.useFastTouch && $.support.touch) { + $body.click(function(e) { + var $el = $(e.target); + + if ($el.attr('nodeName')!=='A' && $el.attr('nodeName')!=='AREA' && $el.attr('nodeName')!=='INPUT') { + $el = $el.closest('a, area'); + } + + if ($el.isExternalLink()) { + return true; + } else { + return false; + } + }); + + // This additionally gets rid of form focusses + $body.mousedown(function(e) { + var timeDiff = (new Date()).getTime() - lastAnimationTime; + if (timeDiff < 200) { + return false; + } + }); + } + + // Make sure exactly one child of body has "current" class + if ($('#jqt > .current').length == 0) { + currentPage = $('#jqt > *:first'); + } else { + currentPage = $('#jqt > .current:first'); + $('#jqt > .current').removeClass('current'); + } + + // Go to the top of the "current" page + $(currentPage).addClass('current'); + location.hash = '#' + $(currentPage).attr('id'); + addPageToHistory(currentPage); + scrollTo(0, 0); + startHashCheck(); + }); + } + + // PUBLIC FUNCTIONS + function goBack(to) { + // Init the param + var numberOfPages = Math.min(parseInt(to || 1, 10), hist.length-1), + curPage = hist[0]; + + // Search through the history for an ID + if(isNaN(numberOfPages) && typeof(to) === "string" && to != '#' ) { + for( var i=1, length=hist.length; i < length; i++ ) { + if( '#' + hist[i].id === to ) { + numberOfPages = i; + break; + } + } + } + + // If still nothing, assume one + if(isNaN(numberOfPages) || numberOfPages < 1) { + numberOfPages = 1; + }; + + if (hist.length > 1) { + // Remove all pages in front of the target page + hist.splice(0, numberOfPages); + animatePages(curPage.page, hist[0].page, curPage.animation, curPage.reverse === false); + } else { + location.hash = '#' + curPage.id; + } + + return publicObj; + } + function goTo(toPage, animation, reverse) { + var fromPage = hist[0].page; + + if (typeof(toPage) === 'string') { + toPage = $(toPage); + } + if (typeof(animation) === 'string') { + for (var i = animations.length - 1; i >= 0; i--) { + if (animations[i].name === animation) { + animation = animations[i]; + break; + } + } + } + if (animatePages(fromPage, toPage, animation, reverse)) { + addPageToHistory(toPage, animation, reverse); + return publicObj; + } else { + console.error('Could not animate pages.'); + return false; + } + } + function getOrientation() { + return orientation; + } + + // PRIVATE FUNCTIONS + function liveTap(e){ + + // Grab the clicked element + var $el = $(e.target); + + if ($el.attr('nodeName')!=='A' && $el.attr('nodeName')!=='AREA') { + $el = $el.closest('a, area'); + } + + var target = $el.attr('target'), + hash = $el.attr('hash'), + animation=null; + + if (tapReady == false || !$el.length) { + console.warn('Not able to tap element.'); + return false; + } + + if ($el.isExternalLink()) { + $el.removeClass('active'); + return true; + } + + // Figure out the animation to use + for (var i = animations.length - 1; i >= 0; i--) { + if ($el.is(animations[i].selector)) { + animation = animations[i]; + break; + } + }; + + // User clicked an internal link, fullscreen mode + if (target == '_webapp') { + window.location = $el.attr('href'); + } + // User clicked a back button + else if ($el.is(jQTSettings.backSelector)) { + goBack(hash); + } + // Allow tap on item with no href + else if ($el.attr('href') == '#') { + $el.unselect(); + return true; + } + // Branch on internal or external href + else if (hash && hash!='#') { + $el.addClass('active'); + goTo($(hash).data('referrer', $el), animation, $(this).hasClass('reverse')); + } else { + $el.addClass('loading active'); + showPageByHref($el.attr('href'), { + animation: animation, + callback: function() { + $el.removeClass('loading'); setTimeout($.fn.unselect, 250, $el); + }, + $referrer: $el + }); + } + return false; + } + function addPageToHistory(page, animation, reverse) { + // Grab some info + var pageId = page.attr('id'); + // Prepend info to page history + hist.unshift({ + page: page, + animation: animation, + reverse: reverse || false, + id: pageId + }); + } + function animatePages(fromPage, toPage, animation, backwards) { + // Error check for target page + if (toPage.length === 0) { + $.fn.unselect(); + console.error('Target element is missing.'); + return false; + } + + // Error check for fromPage=toPage + if (toPage.hasClass('current')) { + $.fn.unselect(); + console.error('Target element is the current page.'); + return false; + } + + // Collapse the keyboard + $(':focus').blur(); + + // Make sure we are scrolled up to hide location bar + scrollTo(0, 0); + + // Define callback to run after animation completes + var callback = function animationEnd(event) { + if (animation) { + toPage.removeClass('in ' + animation.name); + fromPage.removeClass('current out ' + animation.name); + if (backwards) { + toPage.toggleClass('reverse'); + fromPage.toggleClass('reverse'); + } + } else { + fromPage.removeClass('current'); + } + + toPage.trigger('pageAnimationEnd', { direction: 'in' }); + fromPage.trigger('pageAnimationEnd', { direction: 'out' }); + + clearInterval(hashCheckInterval); + currentPage = toPage; + location.hash = '#' + currentPage.attr('id'); + startHashCheck(); + + var $originallink = toPage.data('referrer'); + if ($originallink) { + $originallink.unselect(); + } + lastAnimationTime = (new Date()).getTime(); + tapReady = true; + } + + fromPage.trigger('pageAnimationStart', { direction: 'out' }); + toPage.trigger('pageAnimationStart', { direction: 'in' }); + + if ($.support.WebKitAnimationEvent && animation && jQTSettings.useAnimations) { + toPage.one('webkitAnimationEnd', callback); + tapReady = false; + if (backwards) { + toPage.toggleClass('reverse'); + fromPage.toggleClass('reverse'); + } + toPage.addClass(animation.name + ' in current '); + fromPage.addClass(animation.name + ' out'); + + } else { + toPage.addClass('current'); + callback(); + } + + return true; + } + function hashCheck() { + var curid = currentPage.attr('id'); + if (location.hash == '') { + location.hash = '#' + curid; + } else if (location.hash != '#' + curid) { + clearInterval(hashCheckInterval); + goBack(location.hash); + } + } + function startHashCheck() { + hashCheckInterval = setInterval(hashCheck, 100); + } + function insertPages(nodes, animation) { + var targetPage = null; + $(nodes).each(function(index, node) { + var $node = $(this); + if (!$node.attr('id')) { + $node.attr('id', 'page-' + (++newPageCount)); + } + + $body.trigger('pageInserted', {page: $node.appendTo($body)}); + + if ($node.hasClass('current') || !targetPage) { + targetPage = $node; + } + }); + if (targetPage !== null) { + goTo(targetPage, animation); + return targetPage; + } else { + return false; + } + } + function showPageByHref(href, options) { + var defaults = { + data: null, + method: 'GET', + animation: null, + callback: null, + $referrer: null + }; + + var settings = $.extend({}, defaults, options); + + if (href != '#') { + $.ajax({ + url: href, + data: settings.data, + type: settings.method, + success: function (data, textStatus) { + var firstPage = insertPages(data, settings.animation); + if (firstPage) { + if (settings.method == 'GET' && jQTSettings.cacheGetRequests === true && settings.$referrer) { + settings.$referrer.attr('href', '#' + firstPage.attr('id')); + } + if (settings.callback) { + settings.callback(true); + } + } + }, + error: function (data) { + if (settings.$referrer) { + settings.$referrer.unselect(); + } + if (settings.callback) { + settings.callback(false); + } + } + }); + } + else if (settings.$referrer) { + settings.$referrer.unselect(); + } + } + function submitForm(e, callback) { + var $form = (typeof(e)==='string') ? $(e).eq(0) : (e.target ? $(e.target) : $(e)); + + if ($form.length && $form.is(jQTSettings.formSelector)) { + showPageByHref($form.attr('action'), { + data: $form.serialize(), + method: $form.attr('method') || "POST", + animation: animations[0] || null, + callback: callback + }); + return false; + } + return true; + } + function submitParentForm(e) { + var $form = $(this).closest('form'); + if ($form.length) { + evt = jQuery.Event("submit"); + evt.preventDefault(); + $form.trigger(evt); + return false; + } + return true; + } + function addAnimation(animation) { + if (typeof(animation.selector) == 'string' && typeof(animation.name) == 'string') { + animations.push(animation); + $(animation.selector).tap(liveTap); + touchSelectors.push(animation.selector); + } + } + function updateOrientation() { + orientation = window.innerWidth < window.innerHeight ? 'profile' : 'landscape'; + $body.removeClass('profile landscape').addClass(orientation).trigger('turn', {orientation: orientation}); + // scrollTo(0, 0); + } + function handleTouch(e) { + var $el = $(e.target); + + // Only handle touchSelectors + if (!$(e.target).is(touchSelectors.join(', '))) { + var $link = $(e.target).closest('a, area'); + + if ($link.length && $link.is(touchSelectors.join(', '))) { + $el = $link; + } else { + return; + } + } + + if (e) { + var hoverTimeout = null, + startX = event.changedTouches[0].clientX, + startY = event.changedTouches[0].clientY, + startTime = (new Date).getTime(), + deltaX = 0, + deltaY = 0, + deltaT = 0; + + // Let's bind these after the fact, so we can keep some internal values + $el.bind('touchmove', touchmove).bind('touchend', touchend); + + hoverTimeout = setTimeout(function() { + $el.makeActive(); + }, 100); + + } + + // Private touch functions (TODO: insert dirty joke) + function touchmove(e) { + + updateChanges(); + var absX = Math.abs(deltaX); + var absY = Math.abs(deltaY); + + // Check for swipe + if (absX > absY && (absX > 35) && deltaT < 1000) { + $el.trigger('swipe', {direction: (deltaX < 0) ? 'left' : 'right', deltaX: deltaX, deltaY: deltaY }).unbind('touchmove touchend'); + } else if (absY > 1) { + $el.removeClass('active'); + } + + clearTimeout(hoverTimeout); + } + + function touchend() { + updateChanges(); + + if (deltaY === 0 && deltaX === 0) { + $el.makeActive(); + $el.trigger('tap'); + } else { + $el.removeClass('active'); + } + $el.unbind('touchmove touchend'); + clearTimeout(hoverTimeout); + } + + function updateChanges() { + var first = event.changedTouches[0] || null; + deltaX = first.pageX - startX; + deltaY = first.pageY - startY; + deltaT = (new Date).getTime() - startTime; + } + + } // End touch handler + + // Public jQuery Fns + $.fn.unselect = function(obj) { + if (obj) { + obj.removeClass('active'); + } else { + $('.active').removeClass('active'); + } + } + $.fn.makeActive = function() { + return $(this).addClass('active'); + } + $.fn.swipe = function(fn) { + if ($.isFunction(fn)) { + return $(this).bind('swipe', fn); + } else { + return $(this).trigger('swipe'); + } + } + $.fn.tap = function(fn) { + if ($.isFunction(fn)) { + var tapEvent = (jQTSettings.useFastTouch && $.support.touch) ? 'tap' : 'click'; + return $(this).live(tapEvent, fn); + } else { + return $(this).trigger('tap'); + } + } + $.fn.isExternalLink = function() { + var $el = $(this); + return ($el.attr('target') == '_blank' || $el.attr('rel') == 'external' || $el.is('input[type="checkbox"], input[type="radio"], a[href^="http://maps.google.com:"], a[href^="mailto:"], a[href^="tel:"], a[href^="javascript:"], a[href*="youtube.com/v"], a[href*="youtube.com/watch"]')); + } + + publicObj = { + getOrientation: getOrientation, + goBack: goBack, + goTo: goTo, + addAnimation: addAnimation, + submitForm: submitForm + } + + return publicObj; + } + + // Extensions directly manipulate the jQTouch object, before it's initialized. + $.jQTouch.prototype.extensions = []; + $.jQTouch.addExtension = function(extension) { + $.jQTouch.prototype.extensions.push(extension); + } + +})(jQuery);
\ No newline at end of file diff --git a/jqtouch/.svn/text-base/jqtouch.transitions.js.svn-base b/jqtouch/.svn/text-base/jqtouch.transitions.js.svn-base new file mode 100644 index 0000000..9d8970f --- /dev/null +++ b/jqtouch/.svn/text-base/jqtouch.transitions.js.svn-base @@ -0,0 +1,60 @@ +/* + + _/ _/_/ _/_/_/_/_/ _/ + _/ _/ _/ _/_/ _/ _/ _/_/_/ _/_/_/ + _/ _/ _/_/ _/ _/ _/ _/ _/ _/ _/ _/ + _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ + _/ _/_/ _/ _/ _/_/ _/_/_/ _/_/_/ _/ _/ + _/ + _/ + + Created by David Kaneda <http://www.davidkaneda.com> + Documentation and issue tracking on Google Code <http://code.google.com/p/jqtouch/> + + Special thanks to Jonathan Stark <http://jonathanstark.com/> + and pinch/zoom <http://www.pinchzoom.com/> + + (c) 2009 by jQTouch project members. + See LICENSE.txt for license. + +*/ + +(function($) { + + $.fn.transition = function(css, options) { + return this.each(function(){ + var $el = $(this); + var defaults = { + speed : '300ms', + callback: null, + ease: 'ease-in-out' + }; + var settings = $.extend({}, defaults, options); + if(settings.speed === 0) { + $el.css(css); + window.setTimeout(settings.callback, 0); + } else { + if ($.browser.safari) + { + var s = []; + for(var i in css) { + s.push(i); + } + $el.css({ + webkitTransitionProperty: s.join(", "), + webkitTransitionDuration: settings.speed, + webkitTransitionTimingFunction: settings.ease + }); + if (settings.callback) { + $el.one('webkitTransitionEnd', settings.callback); + } + setTimeout(function(el){ el.css(css) }, 0, $el); + } + else + { + $el.animate(css, settings.speed, settings.callback); + } + } + }); + } +})(jQuery);
\ No newline at end of file diff --git a/jqtouch/.svn/text-base/jquery.1.3.2.min.js.svn-base b/jqtouch/.svn/text-base/jquery.1.3.2.min.js.svn-base new file mode 100644 index 0000000..b1ae21d --- /dev/null +++ b/jqtouch/.svn/text-base/jquery.1.3.2.min.js.svn-base @@ -0,0 +1,19 @@ +/* + * jQuery JavaScript Library v1.3.2 + * http://jquery.com/ + * + * Copyright (c) 2009 John Resig + * Dual licensed under the MIT and GPL licenses. + * http://docs.jquery.com/License + * + * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009) + * Revision: 6246 + */ +(function(){var l=this,g,y=l.jQuery,p=l.$,o=l.jQuery=l.$=function(E,F){return new o.fn.init(E,F)},D=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;o.fn=o.prototype={init:function(E,H){E=E||document;if(E.nodeType){this[0]=E;this.length=1;this.context=E;return this}if(typeof E==="string"){var G=D.exec(E);if(G&&(G[1]||!H)){if(G[1]){E=o.clean([G[1]],H)}else{var I=document.getElementById(G[3]);if(I&&I.id!=G[3]){return o().find(E)}var F=o(I||[]);F.context=document;F.selector=E;return F}}else{return o(H).find(E)}}else{if(o.isFunction(E)){return o(document).ready(E)}}if(E.selector&&E.context){this.selector=E.selector;this.context=E.context}return this.setArray(o.isArray(E)?E:o.makeArray(E))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(E){return E===g?Array.prototype.slice.call(this):this[E]},pushStack:function(F,H,E){var G=o(F);G.prevObject=this;G.context=this.context;if(H==="find"){G.selector=this.selector+(this.selector?" ":"")+E}else{if(H){G.selector=this.selector+"."+H+"("+E+")"}}return G},setArray:function(E){this.length=0;Array.prototype.push.apply(this,E);return this},each:function(F,E){return o.each(this,F,E)},index:function(E){return o.inArray(E&&E.jquery?E[0]:E,this)},attr:function(F,H,G){var E=F;if(typeof F==="string"){if(H===g){return this[0]&&o[G||"attr"](this[0],F)}else{E={};E[F]=H}}return this.each(function(I){for(F in E){o.attr(G?this.style:this,F,o.prop(this,E[F],G,I,F))}})},css:function(E,F){if((E=="width"||E=="height")&&parseFloat(F)<0){F=g}return this.attr(E,F,"curCSS")},text:function(F){if(typeof F!=="object"&&F!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(F))}var E="";o.each(F||this,function(){o.each(this.childNodes,function(){if(this.nodeType!=8){E+=this.nodeType!=1?this.nodeValue:o.fn.text([this])}})});return E},wrapAll:function(E){if(this[0]){var F=o(E,this[0].ownerDocument).clone();if(this[0].parentNode){F.insertBefore(this[0])}F.map(function(){var G=this;while(G.firstChild){G=G.firstChild}return G}).append(this)}return this},wrapInner:function(E){return this.each(function(){o(this).contents().wrapAll(E)})},wrap:function(E){return this.each(function(){o(this).wrapAll(E)})},append:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.appendChild(E)}})},prepend:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.insertBefore(E,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this)})},after:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this.nextSibling)})},end:function(){return this.prevObject||o([])},push:[].push,sort:[].sort,splice:[].splice,find:function(E){if(this.length===1){var F=this.pushStack([],"find",E);F.length=0;o.find(E,this[0],F);return F}else{return this.pushStack(o.unique(o.map(this,function(G){return o.find(E,G)})),"find",E)}},clone:function(G){var E=this.map(function(){if(!o.support.noCloneEvent&&!o.isXMLDoc(this)){var I=this.outerHTML;if(!I){var J=this.ownerDocument.createElement("div");J.appendChild(this.cloneNode(true));I=J.innerHTML}return o.clean([I.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else{return this.cloneNode(true)}});if(G===true){var H=this.find("*").andSelf(),F=0;E.find("*").andSelf().each(function(){if(this.nodeName!==H[F].nodeName){return}var I=o.data(H[F],"events");for(var K in I){for(var J in I[K]){o.event.add(this,K,I[K][J],I[K][J].data)}}F++})}return E},filter:function(E){return this.pushStack(o.isFunction(E)&&o.grep(this,function(G,F){return E.call(G,F)})||o.multiFilter(E,o.grep(this,function(F){return F.nodeType===1})),"filter",E)},closest:function(E){var G=o.expr.match.POS.test(E)?o(E):null,F=0;return this.map(function(){var H=this;while(H&&H.ownerDocument){if(G?G.index(H)>-1:o(H).is(E)){o.data(H,"closest",F);return H}H=H.parentNode;F++}})},not:function(E){if(typeof E==="string"){if(f.test(E)){return this.pushStack(o.multiFilter(E,this,true),"not",E)}else{E=o.multiFilter(E,this)}}var F=E.length&&E[E.length-1]!==g&&!E.nodeType;return this.filter(function(){return F?o.inArray(this,E)<0:this!=E})},add:function(E){return this.pushStack(o.unique(o.merge(this.get(),typeof E==="string"?o(E):o.makeArray(E))))},is:function(E){return !!E&&o.multiFilter(E,this).length>0},hasClass:function(E){return !!E&&this.is("."+E)},val:function(K){if(K===g){var E=this[0];if(E){if(o.nodeName(E,"option")){return(E.attributes.value||{}).specified?E.value:E.text}if(o.nodeName(E,"select")){var I=E.selectedIndex,L=[],M=E.options,H=E.type=="select-one";if(I<0){return null}for(var F=H?I:0,J=H?I+1:M.length;F<J;F++){var G=M[F];if(G.selected){K=o(G).val();if(H){return K}L.push(K)}}return L}return(E.value||"").replace(/\r/g,"")}return g}if(typeof K==="number"){K+=""}return this.each(function(){if(this.nodeType!=1){return}if(o.isArray(K)&&/radio|checkbox/.test(this.type)){this.checked=(o.inArray(this.value,K)>=0||o.inArray(this.name,K)>=0)}else{if(o.nodeName(this,"select")){var N=o.makeArray(K);o("option",this).each(function(){this.selected=(o.inArray(this.value,N)>=0||o.inArray(this.text,N)>=0)});if(!N.length){this.selectedIndex=-1}}else{this.value=K}}})},html:function(E){return E===g?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(E)},replaceWith:function(E){return this.after(E).remove()},eq:function(E){return this.slice(E,+E+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(E){return this.pushStack(o.map(this,function(G,F){return E.call(G,F,G)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(J,M,L){if(this[0]){var I=(this[0].ownerDocument||this[0]).createDocumentFragment(),F=o.clean(J,(this[0].ownerDocument||this[0]),I),H=I.firstChild;if(H){for(var G=0,E=this.length;G<E;G++){L.call(K(this[G],H),this.length>1||G>0?I.cloneNode(true):I)}}if(F){o.each(F,z)}}return this;function K(N,O){return M&&o.nodeName(N,"table")&&o.nodeName(O,"tr")?(N.getElementsByTagName("tbody")[0]||N.appendChild(N.ownerDocument.createElement("tbody"))):N}}};o.fn.init.prototype=o.fn;function z(E,F){if(F.src){o.ajax({url:F.src,async:false,dataType:"script"})}else{o.globalEval(F.text||F.textContent||F.innerHTML||"")}if(F.parentNode){F.parentNode.removeChild(F)}}function e(){return +new Date}o.extend=o.fn.extend=function(){var J=arguments[0]||{},H=1,I=arguments.length,E=false,G;if(typeof J==="boolean"){E=J;J=arguments[1]||{};H=2}if(typeof J!=="object"&&!o.isFunction(J)){J={}}if(I==H){J=this;--H}for(;H<I;H++){if((G=arguments[H])!=null){for(var F in G){var K=J[F],L=G[F];if(J===L){continue}if(E&&L&&typeof L==="object"&&!L.nodeType){J[F]=o.extend(E,K||(L.length!=null?[]:{}),L)}else{if(L!==g){J[F]=L}}}}}return J};var b=/z-?index|font-?weight|opacity|zoom|line-?height/i,q=document.defaultView||{},s=Object.prototype.toString;o.extend({noConflict:function(E){l.$=p;if(E){l.jQuery=y}return o},isFunction:function(E){return s.call(E)==="[object Function]"},isArray:function(E){return s.call(E)==="[object Array]"},isXMLDoc:function(E){return E.nodeType===9&&E.documentElement.nodeName!=="HTML"||!!E.ownerDocument&&o.isXMLDoc(E.ownerDocument)},globalEval:function(G){if(G&&/\S/.test(G)){var F=document.getElementsByTagName("head")[0]||document.documentElement,E=document.createElement("script");E.type="text/javascript";if(o.support.scriptEval){E.appendChild(document.createTextNode(G))}else{E.text=G}F.insertBefore(E,F.firstChild);F.removeChild(E)}},nodeName:function(F,E){return F.nodeName&&F.nodeName.toUpperCase()==E.toUpperCase()},each:function(G,K,F){var E,H=0,I=G.length;if(F){if(I===g){for(E in G){if(K.apply(G[E],F)===false){break}}}else{for(;H<I;){if(K.apply(G[H++],F)===false){break}}}}else{if(I===g){for(E in G){if(K.call(G[E],E,G[E])===false){break}}}else{for(var J=G[0];H<I&&K.call(J,H,J)!==false;J=G[++H]){}}}return G},prop:function(H,I,G,F,E){if(o.isFunction(I)){I=I.call(H,F)}return typeof I==="number"&&G=="curCSS"&&!b.test(E)?I+"px":I},className:{add:function(E,F){o.each((F||"").split(/\s+/),function(G,H){if(E.nodeType==1&&!o.className.has(E.className,H)){E.className+=(E.className?" ":"")+H}})},remove:function(E,F){if(E.nodeType==1){E.className=F!==g?o.grep(E.className.split(/\s+/),function(G){return !o.className.has(F,G)}).join(" "):""}},has:function(F,E){return F&&o.inArray(E,(F.className||F).toString().split(/\s+/))>-1}},swap:function(H,G,I){var E={};for(var F in G){E[F]=H.style[F];H.style[F]=G[F]}I.call(H);for(var F in G){H.style[F]=E[F]}},css:function(H,F,J,E){if(F=="width"||F=="height"){var L,G={position:"absolute",visibility:"hidden",display:"block"},K=F=="width"?["Left","Right"]:["Top","Bottom"];function I(){L=F=="width"?H.offsetWidth:H.offsetHeight;if(E==="border"){return}o.each(K,function(){if(!E){L-=parseFloat(o.curCSS(H,"padding"+this,true))||0}if(E==="margin"){L+=parseFloat(o.curCSS(H,"margin"+this,true))||0}else{L-=parseFloat(o.curCSS(H,"border"+this+"Width",true))||0}})}if(H.offsetWidth!==0){I()}else{o.swap(H,G,I)}return Math.max(0,Math.round(L))}return o.curCSS(H,F,J)},curCSS:function(I,F,G){var L,E=I.style;if(F=="opacity"&&!o.support.opacity){L=o.attr(E,"opacity");return L==""?"1":L}if(F.match(/float/i)){F=w}if(!G&&E&&E[F]){L=E[F]}else{if(q.getComputedStyle){if(F.match(/float/i)){F="float"}F=F.replace(/([A-Z])/g,"-$1").toLowerCase();var M=q.getComputedStyle(I,null);if(M){L=M.getPropertyValue(F)}if(F=="opacity"&&L==""){L="1"}}else{if(I.currentStyle){var J=F.replace(/\-(\w)/g,function(N,O){return O.toUpperCase()});L=I.currentStyle[F]||I.currentStyle[J];if(!/^\d+(px)?$/i.test(L)&&/^\d/.test(L)){var H=E.left,K=I.runtimeStyle.left;I.runtimeStyle.left=I.currentStyle.left;E.left=L||0;L=E.pixelLeft+"px";E.left=H;I.runtimeStyle.left=K}}}}return L},clean:function(F,K,I){K=K||document;if(typeof K.createElement==="undefined"){K=K.ownerDocument||K[0]&&K[0].ownerDocument||document}if(!I&&F.length===1&&typeof F[0]==="string"){var H=/^<(\w+)\s*\/?>$/.exec(F[0]);if(H){return[K.createElement(H[1])]}}var G=[],E=[],L=K.createElement("div");o.each(F,function(P,S){if(typeof S==="number"){S+=""}if(!S){return}if(typeof S==="string"){S=S.replace(/(<(\w+)[^>]*?)\/>/g,function(U,V,T){return T.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?U:V+"></"+T+">"});var O=S.replace(/^\s+/,"").substring(0,10).toLowerCase();var Q=!O.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!O.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||O.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!O.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!O.indexOf("<td")||!O.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!O.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||!o.support.htmlSerialize&&[1,"div<div>","</div>"]||[0,"",""];L.innerHTML=Q[1]+S+Q[2];while(Q[0]--){L=L.lastChild}if(!o.support.tbody){var R=/<tbody/i.test(S),N=!O.indexOf("<table")&&!R?L.firstChild&&L.firstChild.childNodes:Q[1]=="<table>"&&!R?L.childNodes:[];for(var M=N.length-1;M>=0;--M){if(o.nodeName(N[M],"tbody")&&!N[M].childNodes.length){N[M].parentNode.removeChild(N[M])}}}if(!o.support.leadingWhitespace&&/^\s/.test(S)){L.insertBefore(K.createTextNode(S.match(/^\s*/)[0]),L.firstChild)}S=o.makeArray(L.childNodes)}if(S.nodeType){G.push(S)}else{G=o.merge(G,S)}});if(I){for(var J=0;G[J];J++){if(o.nodeName(G[J],"script")&&(!G[J].type||G[J].type.toLowerCase()==="text/javascript")){E.push(G[J].parentNode?G[J].parentNode.removeChild(G[J]):G[J])}else{if(G[J].nodeType===1){G.splice.apply(G,[J+1,0].concat(o.makeArray(G[J].getElementsByTagName("script"))))}I.appendChild(G[J])}}return E}return G},attr:function(J,G,K){if(!J||J.nodeType==3||J.nodeType==8){return g}var H=!o.isXMLDoc(J),L=K!==g;G=H&&o.props[G]||G;if(J.tagName){var F=/href|src|style/.test(G);if(G=="selected"&&J.parentNode){J.parentNode.selectedIndex}if(G in J&&H&&!F){if(L){if(G=="type"&&o.nodeName(J,"input")&&J.parentNode){throw"type property can't be changed"}J[G]=K}if(o.nodeName(J,"form")&&J.getAttributeNode(G)){return J.getAttributeNode(G).nodeValue}if(G=="tabIndex"){var I=J.getAttributeNode("tabIndex");return I&&I.specified?I.value:J.nodeName.match(/(button|input|object|select|textarea)/i)?0:J.nodeName.match(/^(a|area)$/i)&&J.href?0:g}return J[G]}if(!o.support.style&&H&&G=="style"){return o.attr(J.style,"cssText",K)}if(L){J.setAttribute(G,""+K)}var E=!o.support.hrefNormalized&&H&&F?J.getAttribute(G,2):J.getAttribute(G);return E===null?g:E}if(!o.support.opacity&&G=="opacity"){if(L){J.zoom=1;J.filter=(J.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(K)+""=="NaN"?"":"alpha(opacity="+K*100+")")}return J.filter&&J.filter.indexOf("opacity=")>=0?(parseFloat(J.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}G=G.replace(/-([a-z])/ig,function(M,N){return N.toUpperCase()});if(L){J[G]=K}return J[G]},trim:function(E){return(E||"").replace(/^\s+|\s+$/g,"")},makeArray:function(G){var E=[];if(G!=null){var F=G.length;if(F==null||typeof G==="string"||o.isFunction(G)||G.setInterval){E[0]=G}else{while(F){E[--F]=G[F]}}}return E},inArray:function(G,H){for(var E=0,F=H.length;E<F;E++){if(H[E]===G){return E}}return -1},merge:function(H,E){var F=0,G,I=H.length;if(!o.support.getAll){while((G=E[F++])!=null){if(G.nodeType!=8){H[I++]=G}}}else{while((G=E[F++])!=null){H[I++]=G}}return H},unique:function(K){var F=[],E={};try{for(var G=0,H=K.length;G<H;G++){var J=o.data(K[G]);if(!E[J]){E[J]=true;F.push(K[G])}}}catch(I){F=K}return F},grep:function(F,J,E){var G=[];for(var H=0,I=F.length;H<I;H++){if(!E!=!J(F[H],H)){G.push(F[H])}}return G},map:function(E,J){var F=[];for(var G=0,H=E.length;G<H;G++){var I=J(E[G],G);if(I!=null){F[F.length]=I}}return F.concat.apply([],F)}});var C=navigator.userAgent.toLowerCase();o.browser={version:(C.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1],safari:/webkit/.test(C),opera:/opera/.test(C),msie:/msie/.test(C)&&!/opera/.test(C),mozilla:/mozilla/.test(C)&&!/(compatible|webkit)/.test(C)};o.each({parent:function(E){return E.parentNode},parents:function(E){return o.dir(E,"parentNode")},next:function(E){return o.nth(E,2,"nextSibling")},prev:function(E){return o.nth(E,2,"previousSibling")},nextAll:function(E){return o.dir(E,"nextSibling")},prevAll:function(E){return o.dir(E,"previousSibling")},siblings:function(E){return o.sibling(E.parentNode.firstChild,E)},children:function(E){return o.sibling(E.firstChild)},contents:function(E){return o.nodeName(E,"iframe")?E.contentDocument||E.contentWindow.document:o.makeArray(E.childNodes)}},function(E,F){o.fn[E]=function(G){var H=o.map(this,F);if(G&&typeof G=="string"){H=o.multiFilter(G,H)}return this.pushStack(o.unique(H),E,G)}});o.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(E,F){o.fn[E]=function(G){var J=[],L=o(G);for(var K=0,H=L.length;K<H;K++){var I=(K>0?this.clone(true):this).get();o.fn[F].apply(o(L[K]),I);J=J.concat(I)}return this.pushStack(J,E,G)}});o.each({removeAttr:function(E){o.attr(this,E,"");if(this.nodeType==1){this.removeAttribute(E)}},addClass:function(E){o.className.add(this,E)},removeClass:function(E){o.className.remove(this,E)},toggleClass:function(F,E){if(typeof E!=="boolean"){E=!o.className.has(this,F)}o.className[E?"add":"remove"](this,F)},remove:function(E){if(!E||o.filter(E,[this]).length){o("*",this).add([this]).each(function(){o.event.remove(this);o.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){o(this).children().remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(E,F){o.fn[E]=function(){return this.each(F,arguments)}});function j(E,F){return E[0]&&parseInt(o.curCSS(E[0],F,true),10)||0}var h="jQuery"+e(),v=0,A={};o.extend({cache:{},data:function(F,E,G){F=F==l?A:F;var H=F[h];if(!H){H=F[h]=++v}if(E&&!o.cache[H]){o.cache[H]={}}if(G!==g){o.cache[H][E]=G}return E?o.cache[H][E]:H},removeData:function(F,E){F=F==l?A:F;var H=F[h];if(E){if(o.cache[H]){delete o.cache[H][E];E="";for(E in o.cache[H]){break}if(!E){o.removeData(F)}}}else{try{delete F[h]}catch(G){if(F.removeAttribute){F.removeAttribute(h)}}delete o.cache[H]}},queue:function(F,E,H){if(F){E=(E||"fx")+"queue";var G=o.data(F,E);if(!G||o.isArray(H)){G=o.data(F,E,o.makeArray(H))}else{if(H){G.push(H)}}}return G},dequeue:function(H,G){var E=o.queue(H,G),F=E.shift();if(!G||G==="fx"){F=E[0]}if(F!==g){F.call(H)}}});o.fn.extend({data:function(E,G){var H=E.split(".");H[1]=H[1]?"."+H[1]:"";if(G===g){var F=this.triggerHandler("getData"+H[1]+"!",[H[0]]);if(F===g&&this.length){F=o.data(this[0],E)}return F===g&&H[1]?this.data(H[0]):F}else{return this.trigger("setData"+H[1]+"!",[H[0],G]).each(function(){o.data(this,E,G)})}},removeData:function(E){return this.each(function(){o.removeData(this,E)})},queue:function(E,F){if(typeof E!=="string"){F=E;E="fx"}if(F===g){return o.queue(this[0],E)}return this.each(function(){var G=o.queue(this,E,F);if(E=="fx"&&G.length==1){G[0].call(this)}})},dequeue:function(E){return this.each(function(){o.dequeue(this,E)})}}); +/* + * Sizzle CSS Selector Engine - v0.9.3 + * Copyright 2009, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * More information: http://sizzlejs.com/ + */ +(function(){var R=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,L=0,H=Object.prototype.toString;var F=function(Y,U,ab,ac){ab=ab||[];U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!Y||typeof Y!=="string"){return ab}var Z=[],W,af,ai,T,ad,V,X=true;R.lastIndex=0;while((W=R.exec(Y))!==null){Z.push(W[1]);if(W[2]){V=RegExp.rightContext;break}}if(Z.length>1&&M.exec(Y)){if(Z.length===2&&I.relative[Z[0]]){af=J(Z[0]+Z[1],U)}else{af=I.relative[Z[0]]?[U]:F(Z.shift(),U);while(Z.length){Y=Z.shift();if(I.relative[Y]){Y+=Z.shift()}af=J(Y,af)}}}else{var ae=ac?{expr:Z.pop(),set:E(ac)}:F.find(Z.pop(),Z.length===1&&U.parentNode?U.parentNode:U,Q(U));af=F.filter(ae.expr,ae.set);if(Z.length>0){ai=E(af)}else{X=false}while(Z.length){var ah=Z.pop(),ag=ah;if(!I.relative[ah]){ah=""}else{ag=Z.pop()}if(ag==null){ag=U}I.relative[ah](ai,ag,Q(U))}}if(!ai){ai=af}if(!ai){throw"Syntax error, unrecognized expression: "+(ah||Y)}if(H.call(ai)==="[object Array]"){if(!X){ab.push.apply(ab,ai)}else{if(U.nodeType===1){for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&(ai[aa]===true||ai[aa].nodeType===1&&K(U,ai[aa]))){ab.push(af[aa])}}}else{for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&ai[aa].nodeType===1){ab.push(af[aa])}}}}}else{E(ai,ab)}if(V){F(V,U,ab,ac);if(G){hasDuplicate=false;ab.sort(G);if(hasDuplicate){for(var aa=1;aa<ab.length;aa++){if(ab[aa]===ab[aa-1]){ab.splice(aa--,1)}}}}}return ab};F.matches=function(T,U){return F(T,null,null,U)};F.find=function(aa,T,ab){var Z,X;if(!aa){return[]}for(var W=0,V=I.order.length;W<V;W++){var Y=I.order[W],X;if((X=I.match[Y].exec(aa))){var U=RegExp.leftContext;if(U.substr(U.length-1)!=="\\"){X[1]=(X[1]||"").replace(/\\/g,"");Z=I.find[Y](X,T,ab);if(Z!=null){aa=aa.replace(I.match[Y],"");break}}}}if(!Z){Z=T.getElementsByTagName("*")}return{set:Z,expr:aa}};F.filter=function(ad,ac,ag,W){var V=ad,ai=[],aa=ac,Y,T,Z=ac&&ac[0]&&Q(ac[0]);while(ad&&ac.length){for(var ab in I.filter){if((Y=I.match[ab].exec(ad))!=null){var U=I.filter[ab],ah,af;T=false;if(aa==ai){ai=[]}if(I.preFilter[ab]){Y=I.preFilter[ab](Y,aa,ag,ai,W,Z);if(!Y){T=ah=true}else{if(Y===true){continue}}}if(Y){for(var X=0;(af=aa[X])!=null;X++){if(af){ah=U(af,Y,X,aa);var ae=W^!!ah;if(ag&&ah!=null){if(ae){T=true}else{aa[X]=false}}else{if(ae){ai.push(af);T=true}}}}}if(ah!==g){if(!ag){aa=ai}ad=ad.replace(I.match[ab],"");if(!T){return[]}break}}}if(ad==V){if(T==null){throw"Syntax error, unrecognized expression: "+ad}else{break}}V=ad}return aa};var I=F.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(T){return T.getAttribute("href")}},relative:{"+":function(aa,T,Z){var X=typeof T==="string",ab=X&&!/\W/.test(T),Y=X&&!ab;if(ab&&!Z){T=T.toUpperCase()}for(var W=0,V=aa.length,U;W<V;W++){if((U=aa[W])){while((U=U.previousSibling)&&U.nodeType!==1){}aa[W]=Y||U&&U.nodeName===T?U||false:U===T}}if(Y){F.filter(T,aa,true)}},">":function(Z,U,aa){var X=typeof U==="string";if(X&&!/\W/.test(U)){U=aa?U:U.toUpperCase();for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){var W=Y.parentNode;Z[V]=W.nodeName===U?W:false}}}else{for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){Z[V]=X?Y.parentNode:Y.parentNode===U}}if(X){F.filter(U,Z,true)}}},"":function(W,U,Y){var V=L++,T=S;if(!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("parentNode",U,V,W,X,Y)},"~":function(W,U,Y){var V=L++,T=S;if(typeof U==="string"&&!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("previousSibling",U,V,W,X,Y)}},find:{ID:function(U,V,W){if(typeof V.getElementById!=="undefined"&&!W){var T=V.getElementById(U[1]);return T?[T]:[]}},NAME:function(V,Y,Z){if(typeof Y.getElementsByName!=="undefined"){var U=[],X=Y.getElementsByName(V[1]);for(var W=0,T=X.length;W<T;W++){if(X[W].getAttribute("name")===V[1]){U.push(X[W])}}return U.length===0?null:U}},TAG:function(T,U){return U.getElementsByTagName(T[1])}},preFilter:{CLASS:function(W,U,V,T,Z,aa){W=" "+W[1].replace(/\\/g,"")+" ";if(aa){return W}for(var X=0,Y;(Y=U[X])!=null;X++){if(Y){if(Z^(Y.className&&(" "+Y.className+" ").indexOf(W)>=0)){if(!V){T.push(Y)}}else{if(V){U[X]=false}}}}return false},ID:function(T){return T[1].replace(/\\/g,"")},TAG:function(U,T){for(var V=0;T[V]===false;V++){}return T[V]&&Q(T[V])?U[1]:U[1].toUpperCase()},CHILD:function(T){if(T[1]=="nth"){var U=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(T[2]=="even"&&"2n"||T[2]=="odd"&&"2n+1"||!/\D/.test(T[2])&&"0n+"+T[2]||T[2]);T[2]=(U[1]+(U[2]||1))-0;T[3]=U[3]-0}T[0]=L++;return T},ATTR:function(X,U,V,T,Y,Z){var W=X[1].replace(/\\/g,"");if(!Z&&I.attrMap[W]){X[1]=I.attrMap[W]}if(X[2]==="~="){X[4]=" "+X[4]+" "}return X},PSEUDO:function(X,U,V,T,Y){if(X[1]==="not"){if(X[3].match(R).length>1||/^\w/.test(X[3])){X[3]=F(X[3],null,null,U)}else{var W=F.filter(X[3],U,V,true^Y);if(!V){T.push.apply(T,W)}return false}}else{if(I.match.POS.test(X[0])||I.match.CHILD.test(X[0])){return true}}return X},POS:function(T){T.unshift(true);return T}},filters:{enabled:function(T){return T.disabled===false&&T.type!=="hidden"},disabled:function(T){return T.disabled===true},checked:function(T){return T.checked===true},selected:function(T){T.parentNode.selectedIndex;return T.selected===true},parent:function(T){return !!T.firstChild},empty:function(T){return !T.firstChild},has:function(V,U,T){return !!F(T[3],V).length},header:function(T){return/h\d/i.test(T.nodeName)},text:function(T){return"text"===T.type},radio:function(T){return"radio"===T.type},checkbox:function(T){return"checkbox"===T.type},file:function(T){return"file"===T.type},password:function(T){return"password"===T.type},submit:function(T){return"submit"===T.type},image:function(T){return"image"===T.type},reset:function(T){return"reset"===T.type},button:function(T){return"button"===T.type||T.nodeName.toUpperCase()==="BUTTON"},input:function(T){return/input|select|textarea|button/i.test(T.nodeName)}},setFilters:{first:function(U,T){return T===0},last:function(V,U,T,W){return U===W.length-1},even:function(U,T){return T%2===0},odd:function(U,T){return T%2===1},lt:function(V,U,T){return U<T[3]-0},gt:function(V,U,T){return U>T[3]-0},nth:function(V,U,T){return T[3]-0==U},eq:function(V,U,T){return T[3]-0==U}},filter:{PSEUDO:function(Z,V,W,aa){var U=V[1],X=I.filters[U];if(X){return X(Z,W,V,aa)}else{if(U==="contains"){return(Z.textContent||Z.innerText||"").indexOf(V[3])>=0}else{if(U==="not"){var Y=V[3];for(var W=0,T=Y.length;W<T;W++){if(Y[W]===Z){return false}}return true}}}},CHILD:function(T,W){var Z=W[1],U=T;switch(Z){case"only":case"first":while(U=U.previousSibling){if(U.nodeType===1){return false}}if(Z=="first"){return true}U=T;case"last":while(U=U.nextSibling){if(U.nodeType===1){return false}}return true;case"nth":var V=W[2],ac=W[3];if(V==1&&ac==0){return true}var Y=W[0],ab=T.parentNode;if(ab&&(ab.sizcache!==Y||!T.nodeIndex)){var X=0;for(U=ab.firstChild;U;U=U.nextSibling){if(U.nodeType===1){U.nodeIndex=++X}}ab.sizcache=Y}var aa=T.nodeIndex-ac;if(V==0){return aa==0}else{return(aa%V==0&&aa/V>=0)}}},ID:function(U,T){return U.nodeType===1&&U.getAttribute("id")===T},TAG:function(U,T){return(T==="*"&&U.nodeType===1)||U.nodeName===T},CLASS:function(U,T){return(" "+(U.className||U.getAttribute("class"))+" ").indexOf(T)>-1},ATTR:function(Y,W){var V=W[1],T=I.attrHandle[V]?I.attrHandle[V](Y):Y[V]!=null?Y[V]:Y.getAttribute(V),Z=T+"",X=W[2],U=W[4];return T==null?X==="!=":X==="="?Z===U:X==="*="?Z.indexOf(U)>=0:X==="~="?(" "+Z+" ").indexOf(U)>=0:!U?Z&&T!==false:X==="!="?Z!=U:X==="^="?Z.indexOf(U)===0:X==="$="?Z.substr(Z.length-U.length)===U:X==="|="?Z===U||Z.substr(0,U.length+1)===U+"-":false},POS:function(X,U,V,Y){var T=U[2],W=I.setFilters[T];if(W){return W(X,V,U,Y)}}}};var M=I.match.POS;for(var O in I.match){I.match[O]=RegExp(I.match[O].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var E=function(U,T){U=Array.prototype.slice.call(U);if(T){T.push.apply(T,U);return T}return U};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(N){E=function(X,W){var U=W||[];if(H.call(X)==="[object Array]"){Array.prototype.push.apply(U,X)}else{if(typeof X.length==="number"){for(var V=0,T=X.length;V<T;V++){U.push(X[V])}}else{for(var V=0;X[V];V++){U.push(X[V])}}}return U}}var G;if(document.documentElement.compareDocumentPosition){G=function(U,T){var V=U.compareDocumentPosition(T)&4?-1:U===T?0:1;if(V===0){hasDuplicate=true}return V}}else{if("sourceIndex" in document.documentElement){G=function(U,T){var V=U.sourceIndex-T.sourceIndex;if(V===0){hasDuplicate=true}return V}}else{if(document.createRange){G=function(W,U){var V=W.ownerDocument.createRange(),T=U.ownerDocument.createRange();V.selectNode(W);V.collapse(true);T.selectNode(U);T.collapse(true);var X=V.compareBoundaryPoints(Range.START_TO_END,T);if(X===0){hasDuplicate=true}return X}}}}(function(){var U=document.createElement("form"),V="script"+(new Date).getTime();U.innerHTML="<input name='"+V+"'/>";var T=document.documentElement;T.insertBefore(U,T.firstChild);if(!!document.getElementById(V)){I.find.ID=function(X,Y,Z){if(typeof Y.getElementById!=="undefined"&&!Z){var W=Y.getElementById(X[1]);return W?W.id===X[1]||typeof W.getAttributeNode!=="undefined"&&W.getAttributeNode("id").nodeValue===X[1]?[W]:g:[]}};I.filter.ID=function(Y,W){var X=typeof Y.getAttributeNode!=="undefined"&&Y.getAttributeNode("id");return Y.nodeType===1&&X&&X.nodeValue===W}}T.removeChild(U)})();(function(){var T=document.createElement("div");T.appendChild(document.createComment(""));if(T.getElementsByTagName("*").length>0){I.find.TAG=function(U,Y){var X=Y.getElementsByTagName(U[1]);if(U[1]==="*"){var W=[];for(var V=0;X[V];V++){if(X[V].nodeType===1){W.push(X[V])}}X=W}return X}}T.innerHTML="<a href='#'></a>";if(T.firstChild&&typeof T.firstChild.getAttribute!=="undefined"&&T.firstChild.getAttribute("href")!=="#"){I.attrHandle.href=function(U){return U.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var T=F,U=document.createElement("div");U.innerHTML="<p class='TEST'></p>";if(U.querySelectorAll&&U.querySelectorAll(".TEST").length===0){return}F=function(Y,X,V,W){X=X||document;if(!W&&X.nodeType===9&&!Q(X)){try{return E(X.querySelectorAll(Y),V)}catch(Z){}}return T(Y,X,V,W)};F.find=T.find;F.filter=T.filter;F.selectors=T.selectors;F.matches=T.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var T=document.createElement("div");T.innerHTML="<div class='test e'></div><div class='test'></div>";if(T.getElementsByClassName("e").length===0){return}T.lastChild.className="e";if(T.getElementsByClassName("e").length===1){return}I.order.splice(1,0,"CLASS");I.find.CLASS=function(U,V,W){if(typeof V.getElementsByClassName!=="undefined"&&!W){return V.getElementsByClassName(U[1])}}})()}function P(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1&&!ac){T.sizcache=Y;T.sizset=W}if(T.nodeName===Z){X=T;break}T=T[U]}ad[W]=X}}}function S(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1){if(!ac){T.sizcache=Y;T.sizset=W}if(typeof Z!=="string"){if(T===Z){X=true;break}}else{if(F.filter(Z,[T]).length>0){X=T;break}}}T=T[U]}ad[W]=X}}}var K=document.compareDocumentPosition?function(U,T){return U.compareDocumentPosition(T)&16}:function(U,T){return U!==T&&(U.contains?U.contains(T):true)};var Q=function(T){return T.nodeType===9&&T.documentElement.nodeName!=="HTML"||!!T.ownerDocument&&Q(T.ownerDocument)};var J=function(T,aa){var W=[],X="",Y,V=aa.nodeType?[aa]:aa;while((Y=I.match.PSEUDO.exec(T))){X+=Y[0];T=T.replace(I.match.PSEUDO,"")}T=I.relative[T]?T+"*":T;for(var Z=0,U=V.length;Z<U;Z++){F(T,V[Z],W)}return F.filter(X,W)};o.find=F;o.filter=F.filter;o.expr=F.selectors;o.expr[":"]=o.expr.filters;F.selectors.filters.hidden=function(T){return T.offsetWidth===0||T.offsetHeight===0};F.selectors.filters.visible=function(T){return T.offsetWidth>0||T.offsetHeight>0};F.selectors.filters.animated=function(T){return o.grep(o.timers,function(U){return T===U.elem}).length};o.multiFilter=function(V,T,U){if(U){V=":not("+V+")"}return F.matches(V,T)};o.dir=function(V,U){var T=[],W=V[U];while(W&&W!=document){if(W.nodeType==1){T.push(W)}W=W[U]}return T};o.nth=function(X,T,V,W){T=T||1;var U=0;for(;X;X=X[V]){if(X.nodeType==1&&++U==T){break}}return X};o.sibling=function(V,U){var T=[];for(;V;V=V.nextSibling){if(V.nodeType==1&&V!=U){T.push(V)}}return T};return;l.Sizzle=F})();o.event={add:function(I,F,H,K){if(I.nodeType==3||I.nodeType==8){return}if(I.setInterval&&I!=l){I=l}if(!H.guid){H.guid=this.guid++}if(K!==g){var G=H;H=this.proxy(G);H.data=K}var E=o.data(I,"events")||o.data(I,"events",{}),J=o.data(I,"handle")||o.data(I,"handle",function(){return typeof o!=="undefined"&&!o.event.triggered?o.event.handle.apply(arguments.callee.elem,arguments):g});J.elem=I;o.each(F.split(/\s+/),function(M,N){var O=N.split(".");N=O.shift();H.type=O.slice().sort().join(".");var L=E[N];if(o.event.specialAll[N]){o.event.specialAll[N].setup.call(I,K,O)}if(!L){L=E[N]={};if(!o.event.special[N]||o.event.special[N].setup.call(I,K,O)===false){if(I.addEventListener){I.addEventListener(N,J,false)}else{if(I.attachEvent){I.attachEvent("on"+N,J)}}}}L[H.guid]=H;o.event.global[N]=true});I=null},guid:1,global:{},remove:function(K,H,J){if(K.nodeType==3||K.nodeType==8){return}var G=o.data(K,"events"),F,E;if(G){if(H===g||(typeof H==="string"&&H.charAt(0)==".")){for(var I in G){this.remove(K,I+(H||""))}}else{if(H.type){J=H.handler;H=H.type}o.each(H.split(/\s+/),function(M,O){var Q=O.split(".");O=Q.shift();var N=RegExp("(^|\\.)"+Q.slice().sort().join(".*\\.")+"(\\.|$)");if(G[O]){if(J){delete G[O][J.guid]}else{for(var P in G[O]){if(N.test(G[O][P].type)){delete G[O][P]}}}if(o.event.specialAll[O]){o.event.specialAll[O].teardown.call(K,Q)}for(F in G[O]){break}if(!F){if(!o.event.special[O]||o.event.special[O].teardown.call(K,Q)===false){if(K.removeEventListener){K.removeEventListener(O,o.data(K,"handle"),false)}else{if(K.detachEvent){K.detachEvent("on"+O,o.data(K,"handle"))}}}F=null;delete G[O]}}})}for(F in G){break}if(!F){var L=o.data(K,"handle");if(L){L.elem=null}o.removeData(K,"events");o.removeData(K,"handle")}}},trigger:function(I,K,H,E){var G=I.type||I;if(!E){I=typeof I==="object"?I[h]?I:o.extend(o.Event(G),I):o.Event(G);if(G.indexOf("!")>=0){I.type=G=G.slice(0,-1);I.exclusive=true}if(!H){I.stopPropagation();if(this.global[G]){o.each(o.cache,function(){if(this.events&&this.events[G]){o.event.trigger(I,K,this.handle.elem)}})}}if(!H||H.nodeType==3||H.nodeType==8){return g}I.result=g;I.target=H;K=o.makeArray(K);K.unshift(I)}I.currentTarget=H;var J=o.data(H,"handle");if(J){J.apply(H,K)}if((!H[G]||(o.nodeName(H,"a")&&G=="click"))&&H["on"+G]&&H["on"+G].apply(H,K)===false){I.result=false}if(!E&&H[G]&&!I.isDefaultPrevented()&&!(o.nodeName(H,"a")&&G=="click")){this.triggered=true;try{H[G]()}catch(L){}}this.triggered=false;if(!I.isPropagationStopped()){var F=H.parentNode||H.ownerDocument;if(F){o.event.trigger(I,K,F,true)}}},handle:function(K){var J,E;K=arguments[0]=o.event.fix(K||l.event);K.currentTarget=this;var L=K.type.split(".");K.type=L.shift();J=!L.length&&!K.exclusive;var I=RegExp("(^|\\.)"+L.slice().sort().join(".*\\.")+"(\\.|$)");E=(o.data(this,"events")||{})[K.type];for(var G in E){var H=E[G];if(J||I.test(H.type)){K.handler=H;K.data=H.data;var F=H.apply(this,arguments);if(F!==g){K.result=F;if(F===false){K.preventDefault();K.stopPropagation()}}if(K.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(H){if(H[h]){return H}var F=H;H=o.Event(F);for(var G=this.props.length,J;G;){J=this.props[--G];H[J]=F[J]}if(!H.target){H.target=H.srcElement||document}if(H.target.nodeType==3){H.target=H.target.parentNode}if(!H.relatedTarget&&H.fromElement){H.relatedTarget=H.fromElement==H.target?H.toElement:H.fromElement}if(H.pageX==null&&H.clientX!=null){var I=document.documentElement,E=document.body;H.pageX=H.clientX+(I&&I.scrollLeft||E&&E.scrollLeft||0)-(I.clientLeft||0);H.pageY=H.clientY+(I&&I.scrollTop||E&&E.scrollTop||0)-(I.clientTop||0)}if(!H.which&&((H.charCode||H.charCode===0)?H.charCode:H.keyCode)){H.which=H.charCode||H.keyCode}if(!H.metaKey&&H.ctrlKey){H.metaKey=H.ctrlKey}if(!H.which&&H.button){H.which=(H.button&1?1:(H.button&2?3:(H.button&4?2:0)))}return H},proxy:function(F,E){E=E||function(){return F.apply(this,arguments)};E.guid=F.guid=F.guid||E.guid||this.guid++;return E},special:{ready:{setup:B,teardown:function(){}}},specialAll:{live:{setup:function(E,F){o.event.add(this,F[0],c)},teardown:function(G){if(G.length){var E=0,F=RegExp("(^|\\.)"+G[0]+"(\\.|$)");o.each((o.data(this,"events").live||{}),function(){if(F.test(this.type)){E++}});if(E<1){o.event.remove(this,G[0],c)}}}}}};o.Event=function(E){if(!this.preventDefault){return new o.Event(E)}if(E&&E.type){this.originalEvent=E;this.type=E.type}else{this.type=E}this.timeStamp=e();this[h]=true};function k(){return false}function u(){return true}o.Event.prototype={preventDefault:function(){this.isDefaultPrevented=u;var E=this.originalEvent;if(!E){return}if(E.preventDefault){E.preventDefault()}E.returnValue=false},stopPropagation:function(){this.isPropagationStopped=u;var E=this.originalEvent;if(!E){return}if(E.stopPropagation){E.stopPropagation()}E.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=u;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(F){var E=F.relatedTarget;while(E&&E!=this){try{E=E.parentNode}catch(G){E=this}}if(E!=this){F.type=F.data;o.event.handle.apply(this,arguments)}};o.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(F,E){o.event.special[E]={setup:function(){o.event.add(this,F,a,E)},teardown:function(){o.event.remove(this,F,a)}}});o.fn.extend({bind:function(F,G,E){return F=="unload"?this.one(F,G,E):this.each(function(){o.event.add(this,F,E||G,E&&G)})},one:function(G,H,F){var E=o.event.proxy(F||H,function(I){o(this).unbind(I,E);return(F||H).apply(this,arguments)});return this.each(function(){o.event.add(this,G,E,F&&H)})},unbind:function(F,E){return this.each(function(){o.event.remove(this,F,E)})},trigger:function(E,F){return this.each(function(){o.event.trigger(E,F,this)})},triggerHandler:function(E,G){if(this[0]){var F=o.Event(E);F.preventDefault();F.stopPropagation();o.event.trigger(F,G,this[0]);return F.result}},toggle:function(G){var E=arguments,F=1;while(F<E.length){o.event.proxy(G,E[F++])}return this.click(o.event.proxy(G,function(H){this.lastToggle=(this.lastToggle||0)%F;H.preventDefault();return E[this.lastToggle++].apply(this,arguments)||false}))},hover:function(E,F){return this.mouseenter(E).mouseleave(F)},ready:function(E){B();if(o.isReady){E.call(document,o)}else{o.readyList.push(E)}return this},live:function(G,F){var E=o.event.proxy(F);E.guid+=this.selector+G;o(document).bind(i(G,this.selector),this.selector,E);return this},die:function(F,E){o(document).unbind(i(F,this.selector),E?{guid:E.guid+this.selector+F}:null);return this}});function c(H){var E=RegExp("(^|\\.)"+H.type+"(\\.|$)"),G=true,F=[];o.each(o.data(this,"events").live||[],function(I,J){if(E.test(J.type)){var K=o(H.target).closest(J.data)[0];if(K){F.push({elem:K,fn:J})}}});F.sort(function(J,I){return o.data(J.elem,"closest")-o.data(I.elem,"closest")});o.each(F,function(){if(this.fn.call(this.elem,H,this.fn.data)===false){return(G=false)}});return G}function i(F,E){return["live",F,E.replace(/\./g,"`").replace(/ /g,"|")].join(".")}o.extend({isReady:false,readyList:[],ready:function(){if(!o.isReady){o.isReady=true;if(o.readyList){o.each(o.readyList,function(){this.call(document,o)});o.readyList=null}o(document).triggerHandler("ready")}}});var x=false;function B(){if(x){return}x=true;if(document.addEventListener){document.addEventListener("DOMContentLoaded",function(){document.removeEventListener("DOMContentLoaded",arguments.callee,false);o.ready()},false)}else{if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);o.ready()}});if(document.documentElement.doScroll&&l==l.top){(function(){if(o.isReady){return}try{document.documentElement.doScroll("left")}catch(E){setTimeout(arguments.callee,0);return}o.ready()})()}}}o.event.add(l,"load",o.ready)}o.each(("blur,focus,load,resize,scroll,unload,click,dblclick,mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave,change,select,submit,keydown,keypress,keyup,error").split(","),function(F,E){o.fn[E]=function(G){return G?this.bind(E,G):this.trigger(E)}});o(l).bind("unload",function(){for(var E in o.cache){if(E!=1&&o.cache[E].handle){o.event.remove(o.cache[E].handle.elem)}}});(function(){o.support={};var F=document.documentElement,G=document.createElement("script"),K=document.createElement("div"),J="script"+(new Date).getTime();K.style.display="none";K.innerHTML=' <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param/></object>';var H=K.getElementsByTagName("*"),E=K.getElementsByTagName("a")[0];if(!H||!H.length||!E){return}o.support={leadingWhitespace:K.firstChild.nodeType==3,tbody:!K.getElementsByTagName("tbody").length,objectAll:!!K.getElementsByTagName("object")[0].getElementsByTagName("*").length,htmlSerialize:!!K.getElementsByTagName("link").length,style:/red/.test(E.getAttribute("style")),hrefNormalized:E.getAttribute("href")==="/a",opacity:E.style.opacity==="0.5",cssFloat:!!E.style.cssFloat,scriptEval:false,noCloneEvent:true,boxModel:null};G.type="text/javascript";try{G.appendChild(document.createTextNode("window."+J+"=1;"))}catch(I){}F.insertBefore(G,F.firstChild);if(l[J]){o.support.scriptEval=true;delete l[J]}F.removeChild(G);if(K.attachEvent&&K.fireEvent){K.attachEvent("onclick",function(){o.support.noCloneEvent=false;K.detachEvent("onclick",arguments.callee)});K.cloneNode(true).fireEvent("onclick")}o(function(){var L=document.createElement("div");L.style.width=L.style.paddingLeft="1px";document.body.appendChild(L);o.boxModel=o.support.boxModel=L.offsetWidth===2;document.body.removeChild(L).style.display="none"})})();var w=o.support.cssFloat?"cssFloat":"styleFloat";o.props={"for":"htmlFor","class":"className","float":w,cssFloat:w,styleFloat:w,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",tabindex:"tabIndex"};o.fn.extend({_load:o.fn.load,load:function(G,J,K){if(typeof G!=="string"){return this._load(G)}var I=G.indexOf(" ");if(I>=0){var E=G.slice(I,G.length);G=G.slice(0,I)}var H="GET";if(J){if(o.isFunction(J)){K=J;J=null}else{if(typeof J==="object"){J=o.param(J);H="POST"}}}var F=this;o.ajax({url:G,type:H,dataType:"html",data:J,complete:function(M,L){if(L=="success"||L=="notmodified"){F.html(E?o("<div/>").append(M.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(E):M.responseText)}if(K){F.each(K,[M.responseText,L,M])}}});return this},serialize:function(){return o.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?o.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type))}).map(function(E,F){var G=o(this).val();return G==null?null:o.isArray(G)?o.map(G,function(I,H){return{name:F.name,value:I}}):{name:F.name,value:G}}).get()}});o.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(E,F){o.fn[F]=function(G){return this.bind(F,G)}});var r=e();o.extend({get:function(E,G,H,F){if(o.isFunction(G)){H=G;G=null}return o.ajax({type:"GET",url:E,data:G,success:H,dataType:F})},getScript:function(E,F){return o.get(E,null,F,"script")},getJSON:function(E,F,G){return o.get(E,F,G,"json")},post:function(E,G,H,F){if(o.isFunction(G)){H=G;G={}}return o.ajax({type:"POST",url:E,data:G,success:H,dataType:F})},ajaxSetup:function(E){o.extend(o.ajaxSettings,E)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return l.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(M){M=o.extend(true,M,o.extend(true,{},o.ajaxSettings,M));var W,F=/=\?(&|$)/g,R,V,G=M.type.toUpperCase();if(M.data&&M.processData&&typeof M.data!=="string"){M.data=o.param(M.data)}if(M.dataType=="jsonp"){if(G=="GET"){if(!M.url.match(F)){M.url+=(M.url.match(/\?/)?"&":"?")+(M.jsonp||"callback")+"=?"}}else{if(!M.data||!M.data.match(F)){M.data=(M.data?M.data+"&":"")+(M.jsonp||"callback")+"=?"}}M.dataType="json"}if(M.dataType=="json"&&(M.data&&M.data.match(F)||M.url.match(F))){W="jsonp"+r++;if(M.data){M.data=(M.data+"").replace(F,"="+W+"$1")}M.url=M.url.replace(F,"="+W+"$1");M.dataType="script";l[W]=function(X){V=X;I();L();l[W]=g;try{delete l[W]}catch(Y){}if(H){H.removeChild(T)}}}if(M.dataType=="script"&&M.cache==null){M.cache=false}if(M.cache===false&&G=="GET"){var E=e();var U=M.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+E+"$2");M.url=U+((U==M.url)?(M.url.match(/\?/)?"&":"?")+"_="+E:"")}if(M.data&&G=="GET"){M.url+=(M.url.match(/\?/)?"&":"?")+M.data;M.data=null}if(M.global&&!o.active++){o.event.trigger("ajaxStart")}var Q=/^(\w+:)?\/\/([^\/?#]+)/.exec(M.url);if(M.dataType=="script"&&G=="GET"&&Q&&(Q[1]&&Q[1]!=location.protocol||Q[2]!=location.host)){var H=document.getElementsByTagName("head")[0];var T=document.createElement("script");T.src=M.url;if(M.scriptCharset){T.charset=M.scriptCharset}if(!W){var O=false;T.onload=T.onreadystatechange=function(){if(!O&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){O=true;I();L();T.onload=T.onreadystatechange=null;H.removeChild(T)}}}H.appendChild(T);return g}var K=false;var J=M.xhr();if(M.username){J.open(G,M.url,M.async,M.username,M.password)}else{J.open(G,M.url,M.async)}try{if(M.data){J.setRequestHeader("Content-Type",M.contentType)}if(M.ifModified){J.setRequestHeader("If-Modified-Since",o.lastModified[M.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}J.setRequestHeader("X-Requested-With","XMLHttpRequest");J.setRequestHeader("Accept",M.dataType&&M.accepts[M.dataType]?M.accepts[M.dataType]+", */*":M.accepts._default)}catch(S){}if(M.beforeSend&&M.beforeSend(J,M)===false){if(M.global&&!--o.active){o.event.trigger("ajaxStop")}J.abort();return false}if(M.global){o.event.trigger("ajaxSend",[J,M])}var N=function(X){if(J.readyState==0){if(P){clearInterval(P);P=null;if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}}else{if(!K&&J&&(J.readyState==4||X=="timeout")){K=true;if(P){clearInterval(P);P=null}R=X=="timeout"?"timeout":!o.httpSuccess(J)?"error":M.ifModified&&o.httpNotModified(J,M.url)?"notmodified":"success";if(R=="success"){try{V=o.httpData(J,M.dataType,M)}catch(Z){R="parsererror"}}if(R=="success"){var Y;try{Y=J.getResponseHeader("Last-Modified")}catch(Z){}if(M.ifModified&&Y){o.lastModified[M.url]=Y}if(!W){I()}}else{o.handleError(M,J,R)}L();if(X){J.abort()}if(M.async){J=null}}}};if(M.async){var P=setInterval(N,13);if(M.timeout>0){setTimeout(function(){if(J&&!K){N("timeout")}},M.timeout)}}try{J.send(M.data)}catch(S){o.handleError(M,J,null,S)}if(!M.async){N()}function I(){if(M.success){M.success(V,R)}if(M.global){o.event.trigger("ajaxSuccess",[J,M])}}function L(){if(M.complete){M.complete(J,R)}if(M.global){o.event.trigger("ajaxComplete",[J,M])}if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}return J},handleError:function(F,H,E,G){if(F.error){F.error(H,E,G)}if(F.global){o.event.trigger("ajaxError",[H,F,G])}},active:0,httpSuccess:function(F){try{return !F.status&&location.protocol=="file:"||(F.status>=200&&F.status<300)||F.status==304||F.status==1223}catch(E){}return false},httpNotModified:function(G,E){try{var H=G.getResponseHeader("Last-Modified");return G.status==304||H==o.lastModified[E]}catch(F){}return false},httpData:function(J,H,G){var F=J.getResponseHeader("content-type"),E=H=="xml"||!H&&F&&F.indexOf("xml")>=0,I=E?J.responseXML:J.responseText;if(E&&I.documentElement.tagName=="parsererror"){throw"parsererror"}if(G&&G.dataFilter){I=G.dataFilter(I,H)}if(typeof I==="string"){if(H=="script"){o.globalEval(I)}if(H=="json"){I=l["eval"]("("+I+")")}}return I},param:function(E){var G=[];function H(I,J){G[G.length]=encodeURIComponent(I)+"="+encodeURIComponent(J)}if(o.isArray(E)||E.jquery){o.each(E,function(){H(this.name,this.value)})}else{for(var F in E){if(o.isArray(E[F])){o.each(E[F],function(){H(F,this)})}else{H(F,o.isFunction(E[F])?E[F]():E[F])}}}return G.join("&").replace(/%20/g,"+")}});var m={},n,d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function t(F,E){var G={};o.each(d.concat.apply([],d.slice(0,E)),function(){G[this]=F});return G}o.fn.extend({show:function(J,L){if(J){return this.animate(t("show",3),J,L)}else{for(var H=0,F=this.length;H<F;H++){var E=o.data(this[H],"olddisplay");this[H].style.display=E||"";if(o.css(this[H],"display")==="none"){var G=this[H].tagName,K;if(m[G]){K=m[G]}else{var I=o("<"+G+" />").appendTo("body");K=I.css("display");if(K==="none"){K="block"}I.remove();m[G]=K}o.data(this[H],"olddisplay",K)}}for(var H=0,F=this.length;H<F;H++){this[H].style.display=o.data(this[H],"olddisplay")||""}return this}},hide:function(H,I){if(H){return this.animate(t("hide",3),H,I)}else{for(var G=0,F=this.length;G<F;G++){var E=o.data(this[G],"olddisplay");if(!E&&E!=="none"){o.data(this[G],"olddisplay",o.css(this[G],"display"))}}for(var G=0,F=this.length;G<F;G++){this[G].style.display="none"}return this}},_toggle:o.fn.toggle,toggle:function(G,F){var E=typeof G==="boolean";return o.isFunction(G)&&o.isFunction(F)?this._toggle.apply(this,arguments):G==null||E?this.each(function(){var H=E?G:o(this).is(":hidden");o(this)[H?"show":"hide"]()}):this.animate(t("toggle",3),G,F)},fadeTo:function(E,G,F){return this.animate({opacity:G},E,F)},animate:function(I,F,H,G){var E=o.speed(F,H,G);return this[E.queue===false?"each":"queue"](function(){var K=o.extend({},E),M,L=this.nodeType==1&&o(this).is(":hidden"),J=this;for(M in I){if(I[M]=="hide"&&L||I[M]=="show"&&!L){return K.complete.call(this)}if((M=="height"||M=="width")&&this.style){K.display=o.css(this,"display");K.overflow=this.style.overflow}}if(K.overflow!=null){this.style.overflow="hidden"}K.curAnim=o.extend({},I);o.each(I,function(O,S){var R=new o.fx(J,K,O);if(/toggle|show|hide/.test(S)){R[S=="toggle"?L?"show":"hide":S](I)}else{var Q=S.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),T=R.cur(true)||0;if(Q){var N=parseFloat(Q[2]),P=Q[3]||"px";if(P!="px"){J.style[O]=(N||1)+P;T=((N||1)/R.cur(true))*T;J.style[O]=T+P}if(Q[1]){N=((Q[1]=="-="?-1:1)*N)+T}R.custom(T,N,P)}else{R.custom(T,S,"")}}});return true})},stop:function(F,E){var G=o.timers;if(F){this.queue([])}this.each(function(){for(var H=G.length-1;H>=0;H--){if(G[H].elem==this){if(E){G[H](true)}G.splice(H,1)}}});if(!E){this.dequeue()}return this}});o.each({slideDown:t("show",1),slideUp:t("hide",1),slideToggle:t("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(E,F){o.fn[E]=function(G,H){return this.animate(F,G,H)}});o.extend({speed:function(G,H,F){var E=typeof G==="object"?G:{complete:F||!F&&H||o.isFunction(G)&&G,duration:G,easing:F&&H||H&&!o.isFunction(H)&&H};E.duration=o.fx.off?0:typeof E.duration==="number"?E.duration:o.fx.speeds[E.duration]||o.fx.speeds._default;E.old=E.complete;E.complete=function(){if(E.queue!==false){o(this).dequeue()}if(o.isFunction(E.old)){E.old.call(this)}};return E},easing:{linear:function(G,H,E,F){return E+F*G},swing:function(G,H,E,F){return((-Math.cos(G*Math.PI)/2)+0.5)*F+E}},timers:[],fx:function(F,E,G){this.options=E;this.elem=F;this.prop=G;if(!E.orig){E.orig={}}}});o.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(o.fx.step[this.prop]||o.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(F){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var E=parseFloat(o.css(this.elem,this.prop,F));return E&&E>-10000?E:parseFloat(o.curCSS(this.elem,this.prop))||0},custom:function(I,H,G){this.startTime=e();this.start=I;this.end=H;this.unit=G||this.unit||"px";this.now=this.start;this.pos=this.state=0;var E=this;function F(J){return E.step(J)}F.elem=this.elem;if(F()&&o.timers.push(F)&&!n){n=setInterval(function(){var K=o.timers;for(var J=0;J<K.length;J++){if(!K[J]()){K.splice(J--,1)}}if(!K.length){clearInterval(n);n=g}},13)}},show:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.show=true;this.custom(this.prop=="width"||this.prop=="height"?1:0,this.cur());o(this.elem).show()},hide:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(H){var G=e();if(H||G>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var E=true;for(var F in this.options.curAnim){if(this.options.curAnim[F]!==true){E=false}}if(E){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(o.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){o(this.elem).hide()}if(this.options.hide||this.options.show){for(var I in this.options.curAnim){o.attr(this.elem.style,I,this.options.orig[I])}}this.options.complete.call(this.elem)}return false}else{var J=G-this.startTime;this.state=J/this.options.duration;this.pos=o.easing[this.options.easing||(o.easing.swing?"swing":"linear")](this.state,J,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};o.extend(o.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(E){o.attr(E.elem.style,"opacity",E.now)},_default:function(E){if(E.elem.style&&E.elem.style[E.prop]!=null){E.elem.style[E.prop]=E.now+E.unit}else{E.elem[E.prop]=E.now}}}});if(document.documentElement.getBoundingClientRect){o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}var G=this[0].getBoundingClientRect(),J=this[0].ownerDocument,F=J.body,E=J.documentElement,L=E.clientTop||F.clientTop||0,K=E.clientLeft||F.clientLeft||0,I=G.top+(self.pageYOffset||o.boxModel&&E.scrollTop||F.scrollTop)-L,H=G.left+(self.pageXOffset||o.boxModel&&E.scrollLeft||F.scrollLeft)-K;return{top:I,left:H}}}else{o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}o.offset.initialized||o.offset.initialize();var J=this[0],G=J.offsetParent,F=J,O=J.ownerDocument,M,H=O.documentElement,K=O.body,L=O.defaultView,E=L.getComputedStyle(J,null),N=J.offsetTop,I=J.offsetLeft;while((J=J.parentNode)&&J!==K&&J!==H){M=L.getComputedStyle(J,null);N-=J.scrollTop,I-=J.scrollLeft;if(J===G){N+=J.offsetTop,I+=J.offsetLeft;if(o.offset.doesNotAddBorder&&!(o.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(J.tagName))){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}F=G,G=J.offsetParent}if(o.offset.subtractsBorderForOverflowNotVisible&&M.overflow!=="visible"){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}E=M}if(E.position==="relative"||E.position==="static"){N+=K.offsetTop,I+=K.offsetLeft}if(E.position==="fixed"){N+=Math.max(H.scrollTop,K.scrollTop),I+=Math.max(H.scrollLeft,K.scrollLeft)}return{top:N,left:I}}}o.offset={initialize:function(){if(this.initialized){return}var L=document.body,F=document.createElement("div"),H,G,N,I,M,E,J=L.style.marginTop,K='<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>';M={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(E in M){F.style[E]=M[E]}F.innerHTML=K;L.insertBefore(F,L.firstChild);H=F.firstChild,G=H.firstChild,I=H.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(G.offsetTop!==5);this.doesAddBorderForTableAndCells=(I.offsetTop===5);H.style.overflow="hidden",H.style.position="relative";this.subtractsBorderForOverflowNotVisible=(G.offsetTop===-5);L.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(L.offsetTop===0);L.style.marginTop=J;L.removeChild(F);this.initialized=true},bodyOffset:function(E){o.offset.initialized||o.offset.initialize();var G=E.offsetTop,F=E.offsetLeft;if(o.offset.doesNotIncludeMarginInBodyOffset){G+=parseInt(o.curCSS(E,"marginTop",true),10)||0,F+=parseInt(o.curCSS(E,"marginLeft",true),10)||0}return{top:G,left:F}}};o.fn.extend({position:function(){var I=0,H=0,F;if(this[0]){var G=this.offsetParent(),J=this.offset(),E=/^body|html$/i.test(G[0].tagName)?{top:0,left:0}:G.offset();J.top-=j(this,"marginTop");J.left-=j(this,"marginLeft");E.top+=j(G,"borderTopWidth");E.left+=j(G,"borderLeftWidth");F={top:J.top-E.top,left:J.left-E.left}}return F},offsetParent:function(){var E=this[0].offsetParent||document.body;while(E&&(!/^body|html$/i.test(E.tagName)&&o.css(E,"position")=="static")){E=E.offsetParent}return o(E)}});o.each(["Left","Top"],function(F,E){var G="scroll"+E;o.fn[G]=function(H){if(!this[0]){return null}return H!==g?this.each(function(){this==l||this==document?l.scrollTo(!F?H:o(l).scrollLeft(),F?H:o(l).scrollTop()):this[G]=H}):this[0]==l||this[0]==document?self[F?"pageYOffset":"pageXOffset"]||o.boxModel&&document.documentElement[G]||document.body[G]:this[0][G]}});o.each(["Height","Width"],function(I,G){var E=I?"Left":"Top",H=I?"Right":"Bottom",F=G.toLowerCase();o.fn["inner"+G]=function(){return this[0]?o.css(this[0],F,false,"padding"):null};o.fn["outer"+G]=function(K){return this[0]?o.css(this[0],F,false,K?"margin":"border"):null};var J=G.toLowerCase();o.fn[J]=function(K){return this[0]==l?document.compatMode=="CSS1Compat"&&document.documentElement["client"+G]||document.body["client"+G]:this[0]==document?Math.max(document.documentElement["client"+G],document.body["scroll"+G],document.documentElement["scroll"+G],document.body["offset"+G],document.documentElement["offset"+G]):K===g?(this.length?o.css(this[0],J):null):this.css(J,typeof K==="string"?K:K+"px")}})})();
\ No newline at end of file diff --git a/jqtouch/jqtouch.css b/jqtouch/jqtouch.css new file mode 100644 index 0000000..5c3e736 --- /dev/null +++ b/jqtouch/jqtouch.css @@ -0,0 +1,373 @@ +* { + margin: 0; + padding: 0; +} +a { + -webkit-tap-highlight-color: rgba(0,0,0,0); +} + +div#jqt { + /*overflow-x: hidden;*/ + -webkit-user-select: none; + -webkit-text-size-adjust: none; + font-family: "Helvetica Neue", Helvetica; + -webkit-perspective: 800; + -webkit-transform-style: preserve-3d; +} +#jqt .selectable, #jqt input, #jqt textarea { + -webkit-user-select: auto; +} +div#jqt > * { + -webkit-backface-visibility: hidden; + -webkit-box-sizing: border-box; + display: none; + position: absolute; + left: 0; + width: 100%; + -webkit-transform: translate3d(0,0,0) rotate(0) scale(1); + min-height: 420px !important; +} +#jqt.fullscreen > * { + min-height: 460px !important; +} +#jqt.fullscreen.black-translucent > * { + min-height: 480px !important; +} +#jqt.landscape > * { + min-height: 320px !important; +} +div#jqt > .current { + display: block !important; +} + +#jqt .in, #jqt .out { + -webkit-animation-timing-function: ease-in-out; + -webkit-animation-duration: 350ms; +} + +#jqt .slide.in { + -webkit-animation-name: slideinfromright; +} + +#jqt .slide.out { + -webkit-animation-name: slideouttoleft; +} + +#jqt .slide.in.reverse { + -webkit-animation-name: slideinfromleft; +} + +#jqt .slide.out.reverse { + -webkit-animation-name: slideouttoright; +} + +@-webkit-keyframes slideinfromright { + from { -webkit-transform: translateX(100%); } + to { -webkit-transform: translateX(0); } +} + +@-webkit-keyframes slideinfromleft { + from { -webkit-transform: translateX(-100%); } + to { -webkit-transform: translateX(0); } +} + +@-webkit-keyframes slideouttoleft { + from { -webkit-transform: translateX(0); } + to { -webkit-transform: translateX(-100%); } +} + +@-webkit-keyframes slideouttoright { + from { -webkit-transform: translateX(0); } + to { -webkit-transform: translateX(100%); } +} + +@-webkit-keyframes fadein { + from { opacity: 0; } + to { opacity: 1; } +} + +@-webkit-keyframes fadeout { + from { opacity: 1; } + to { opacity: 0; } +} + +#jqt .fade.in { + z-index: 10; + -webkit-animation-name: fadein; +} +#jqt .fade.out { + z-index: 0; +} + +#jqt .dissolve.in { + -webkit-animation-name: fadein; +} + +#jqt .dissolve.out { + -webkit-animation-name: fadeout; +} + + + +#jqt .flip { + -webkit-animation-duration: .65s; +} + +#jqt .flip.in { + -webkit-animation-name: flipinfromleft; +} + +#jqt .flip.out { + -webkit-animation-name: flipouttoleft; +} + +/* Shake it all about */ + +#jqt .flip.in.reverse { + -webkit-animation-name: flipinfromright; +} + +#jqt .flip.out.reverse { + -webkit-animation-name: flipouttoright; +} + +@-webkit-keyframes flipinfromright { + from { -webkit-transform: rotateY(-180deg) scale(.8); } + to { -webkit-transform: rotateY(0) scale(1); } +} + +@-webkit-keyframes flipinfromleft { + from { -webkit-transform: rotateY(180deg) scale(.8); } + to { -webkit-transform: rotateY(0) scale(1); } +} + +@-webkit-keyframes flipouttoleft { + from { -webkit-transform: rotateY(0) scale(1); } + to { -webkit-transform: rotateY(-180deg) scale(.8); } +} + +@-webkit-keyframes flipouttoright { + from { -webkit-transform: rotateY(0) scale(1); } + to { -webkit-transform: rotateY(180deg) scale(.8); } +} + +#jqt .slideup.in { + -webkit-animation-name: slideup; + z-index: 10; +} + +#jqt .slideup.out { + -webkit-animation-name: dontmove; + z-index: 0; +} + +#jqt .slideup.out.reverse { + z-index: 10; + -webkit-animation-name: slidedown; +} + +#jqt .slideup.in.reverse { + z-index: 0; + -webkit-animation-name: dontmove; +} + + +@-webkit-keyframes slideup { + from { -webkit-transform: translateY(100%); } + to { -webkit-transform: translateY(0); } +} + +@-webkit-keyframes slidedown { + from { -webkit-transform: translateY(0); } + to { -webkit-transform: translateY(100%); } +} + + + +/* Hackish, but reliable. */ + +@-webkit-keyframes dontmove { + from { opacity: 1; } + to { opacity: 1; } +} + +#jqt .swap { + -webkit-transform: perspective(800); + -webkit-animation-duration: .7s; +} +#jqt .swap.out { + -webkit-animation-name: swapouttoleft; +} +#jqt .swap.in { + -webkit-animation-name: swapinfromright; +} +#jqt .swap.out.reverse { + -webkit-animation-name: swapouttoright; +} +#jqt .swap.in.reverse { + -webkit-animation-name: swapinfromleft; +} + + +@-webkit-keyframes swapouttoright { + 0% { + -webkit-transform: translate3d(0px, 0px, 0px) rotateY(0deg); + -webkit-animation-timing-function: ease-in-out; + } + 50% { + -webkit-transform: translate3d(-180px, 0px, -400px) rotateY(20deg); + -webkit-animation-timing-function: ease-in; + } + 100% { + -webkit-transform: translate3d(0px, 0px, -800px) rotateY(70deg); + } +} + +@-webkit-keyframes swapouttoleft { + 0% { + -webkit-transform: translate3d(0px, 0px, 0px) rotateY(0deg); + -webkit-animation-timing-function: ease-in-out; + } + 50% { + -webkit-transform: translate3d(180px, 0px, -400px) rotateY(-20deg); + -webkit-animation-timing-function: ease-in; + } + 100% { + -webkit-transform: translate3d(0px, 0px, -800px) rotateY(-70deg); + } +} + +@-webkit-keyframes swapinfromright { + 0% { + -webkit-transform: translate3d(0px, 0px, -800px) rotateY(70deg); + -webkit-animation-timing-function: ease-out; + } + 50% { + -webkit-transform: translate3d(-180px, 0px, -400px) rotateY(20deg); + -webkit-animation-timing-function: ease-in-out; + } + 100% { + -webkit-transform: translate3d(0px, 0px, 0px) rotateY(0deg); + } +} + +@-webkit-keyframes swapinfromleft { + 0% { + -webkit-transform: translate3d(0px, 0px, -800px) rotateY(-70deg); + -webkit-animation-timing-function: ease-out; + } + 50% { + -webkit-transform: translate3d(180px, 0px, -400px) rotateY(-20deg); + -webkit-animation-timing-function: ease-in-out; + } + 100% { + -webkit-transform: translate3d(0px, 0px, 0px) rotateY(0deg); + } +} + +#jqt .cube { + -webkit-animation-duration: .55s; +} + +#jqt .cube.in { + -webkit-animation-name: cubeinfromright; + -webkit-transform-origin: 0% 50%; +} +#jqt .cube.out { + -webkit-animation-name: cubeouttoleft; + -webkit-transform-origin: 100% 50%; +} +#jqt .cube.in.reverse { + -webkit-animation-name: cubeinfromleft; + -webkit-transform-origin: 100% 50%; +} +#jqt .cube.out.reverse { + -webkit-animation-name: cubeouttoright; + -webkit-transform-origin: 0% 50%; + +} + +@-webkit-keyframes cubeinfromleft { + from { + -webkit-transform: rotateY(-90deg) translateZ(320px); + opacity: .5; + } + to { + -webkit-transform: rotateY(0deg) translateZ(0); + opacity: 1; + } +} +@-webkit-keyframes cubeouttoright { + from { + -webkit-transform: rotateY(0deg) translateX(0); + opacity: 1; + } + to { + -webkit-transform: rotateY(90deg) translateZ(320px); + opacity: .5; + } +} +@-webkit-keyframes cubeinfromright { + from { + -webkit-transform: rotateY(90deg) translateZ(320px); + opacity: .5; + } + to { + -webkit-transform: rotateY(0deg) translateZ(0); + opacity: 1; + } +} +@-webkit-keyframes cubeouttoleft { + from { + -webkit-transform: rotateY(0deg) translateZ(0); + opacity: 1; + } + to { + -webkit-transform: rotateY(-90deg) translateZ(320px); + opacity: .5; + } +} + + + + +#jqt .pop { + -webkit-transform-origin: 50% 50%; +} + +#jqt .pop.in { + -webkit-animation-name: popin; + z-index: 10; +} + +#jqt .pop.out.reverse { + -webkit-animation-name: popout; + z-index: 10; +} + +#jqt .pop.in.reverse { + z-index: 0; + -webkit-animation-name: dontmove; +} + +@-webkit-keyframes popin { + from { + -webkit-transform: scale(.2); + opacity: 0; + } + to { + -webkit-transform: scale(1); + opacity: 1; + } +} + +@-webkit-keyframes popout { + from { + -webkit-transform: scale(1); + opacity: 1; + } + to { + -webkit-transform: scale(.2); + opacity: 0; + } +}
\ No newline at end of file diff --git a/jqtouch/jqtouch.js b/jqtouch/jqtouch.js new file mode 100644 index 0000000..b5057eb --- /dev/null +++ b/jqtouch/jqtouch.js @@ -0,0 +1,624 @@ +/*
+
+ _/ _/_/ _/_/_/_/_/ _/
+ _/ _/ _/ _/_/ _/ _/ _/_/_/ _/_/_/
+ _/ _/ _/_/ _/ _/ _/ _/ _/ _/ _/ _/
+ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/
+ _/ _/_/ _/ _/ _/_/ _/_/_/ _/_/_/ _/ _/
+ _/
+ _/
+
+ Created by David Kaneda <http://www.davidkaneda.com>
+ Documentation and issue tracking on Google Code <http://code.google.com/p/jqtouch/>
+
+ Special thanks to Jonathan Stark <http://jonathanstark.com/>
+ and pinch/zoom <http://www.pinchzoom.com/>
+
+ (c) 2009 by jQTouch project members.
+ See LICENSE.txt for license.
+
+ $Revision: 133 $
+ $Date: 2010-01-15 22:08:54 +0100 (ven. 15 janv. 2010) $
+ $LastChangedBy: RBoulanouar $
+
+*/
+
+(function($) {
+ $.jQTouch = function(options) {
+
+ // Set support values
+ $.support.WebKitCSSMatrix = (typeof WebKitCSSMatrix == "object");
+ $.support.touch = (typeof Touch == "object");
+ $.support.WebKitAnimationEvent = (typeof WebKitTransitionEvent == "object");
+
+ // Initialize internal variables
+ var $body,
+ $head=$('head'),
+ hist=[],
+ newPageCount=0,
+ jQTSettings={},
+ hashCheckInterval,
+ currentPage,
+ orientation,
+ isMobileWebKit = RegExp(" Mobile/").test(navigator.userAgent),
+ tapReady=true,
+ lastAnimationTime=0,
+ touchSelectors=[],
+ publicObj={},
+ extensions=$.jQTouch.prototype.extensions,
+ defaultAnimations=['slide','flip','slideup','swap','cube','pop','dissolve','fade','back'],
+ animations=[],
+ hairextensions='';
+ // Get the party started
+ init(options);
+
+ function init(options) {
+
+ var defaults = {
+ addGlossToIcon: true,
+ backSelector: '.back, .cancel, .goback',
+ cacheGetRequests: true,
+ cubeSelector: '.cube',
+ dissolveSelector: '.dissolve',
+ fadeSelector: '.fade',
+ fixedViewport: true,
+ flipSelector: '.flip',
+ formSelector: 'form',
+ fullScreen: true,
+ fullScreenClass: 'fullscreen',
+ icon: null,
+ touchSelector: 'a, .touch',
+ popSelector: '.pop',
+ preloadImages: false,
+ slideSelector: '#jqt > * > ul li a',
+ slideupSelector: '.slideup',
+ startupScreen: null,
+ statusBar: 'default', // other options: black-translucent, black
+ submitSelector: '.submit',
+ swapSelector: '.swap',
+ useAnimations: true,
+ useFastTouch: true // Experimental.
+ };
+ jQTSettings = $.extend({}, defaults, options);
+
+ // Preload images
+ if (jQTSettings.preloadImages) {
+ for (var i = jQTSettings.preloadImages.length - 1; i >= 0; i--) {
+ (new Image()).src = jQTSettings.preloadImages[i];
+ };
+ }
+ // Set icon
+ if (jQTSettings.icon) {
+ var precomposed = (jQTSettings.addGlossToIcon) ? '' : '-precomposed';
+ hairextensions += '<link rel="apple-touch-icon' + precomposed + '" href="' + jQTSettings.icon + '" />';
+ }
+ // Set startup screen
+ if (jQTSettings.startupScreen) {
+ hairextensions += '<link rel="apple-touch-startup-image" href="' + jQTSettings.startupScreen + '" />';
+ }
+ // Set viewport
+ if (jQTSettings.fixedViewport) {
+ hairextensions += '<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;"/>';
+ }
+ // Set full-screen
+ if (jQTSettings.fullScreen) {
+ hairextensions += '<meta name="apple-mobile-web-app-capable" content="yes" />';
+ if (jQTSettings.statusBar) {
+ hairextensions += '<meta name="apple-mobile-web-app-status-bar-style" content="' + jQTSettings.statusBar + '" />';
+ }
+ }
+ if (hairextensions) {
+ $head.prepend(hairextensions);
+ }
+
+ // Initialize on document load:
+ $(document).ready(function() {
+
+ // Add extensions
+ for (var i in extensions) {
+ var fn = extensions[i];
+ if ($.isFunction(fn)) {
+ $.extend(publicObj, fn(publicObj));
+ }
+ }
+
+ // Add animations
+ for (var i in defaultAnimations) {
+ var name = defaultAnimations[i];
+ var selector = jQTSettings[name + 'Selector'];
+ if (typeof(selector) == 'string') {
+ addAnimation({name:name, selector:selector});
+ }
+ }
+
+ touchSelectors.push('input');
+ touchSelectors.push(jQTSettings.touchSelector);
+ touchSelectors.push(jQTSettings.backSelector);
+ touchSelectors.push(jQTSettings.submitSelector);
+ $(touchSelectors.join(', ')).css('-webkit-touch-callout', 'none');
+ $(jQTSettings.backSelector).tap(liveTap);
+ $(jQTSettings.submitSelector).tap(submitParentForm);
+
+ $body = $('#jqt');
+
+ if (jQTSettings.fullScreenClass && window.navigator.standalone == true) {
+ $body.addClass(jQTSettings.fullScreenClass + ' ' + jQTSettings.statusBar);
+ }
+
+ // Create custom live events
+ $body
+ .bind('touchstart', handleTouch)
+ .bind('orientationchange', updateOrientation)
+ .trigger('orientationchange')
+ .submit(submitForm);
+
+ if (jQTSettings.useFastTouch && $.support.touch) {
+ $body.click(function(e) {
+ var $el = $(e.target);
+
+ if ($el.attr('nodeName')!=='A' && $el.attr('nodeName')!=='AREA' && $el.attr('nodeName')!=='INPUT') {
+ $el = $el.closest('a, area');
+ }
+
+ if ($el.isExternalLink()) {
+ return true;
+ } else {
+ return false;
+ }
+ });
+
+ // This additionally gets rid of form focusses
+ $body.mousedown(function(e) {
+ var timeDiff = (new Date()).getTime() - lastAnimationTime;
+ if (timeDiff < 200) {
+ return false;
+ }
+ });
+ }
+
+ // Make sure exactly one child of body has "current" class
+ if ($('#jqt > .current').length == 0) {
+ currentPage = $('#jqt > *:first');
+ } else {
+ currentPage = $('#jqt > .current:first');
+ $('#jqt > .current').removeClass('current');
+ }
+
+ // Go to the top of the "current" page
+ $(currentPage).addClass('current');
+ location.hash = '#' + $(currentPage).attr('id');
+ addPageToHistory(currentPage);
+ scrollTo(0, 0);
+ startHashCheck();
+ });
+ }
+
+ // PUBLIC FUNCTIONS
+ function goBack(to) {
+ // Init the param
+ var numberOfPages = Math.min(parseInt(to || 1, 10), hist.length-1),
+ curPage = hist[0];
+
+ // Search through the history for an ID
+ if(isNaN(numberOfPages) && typeof(to) === "string" && to != '#' ) {
+ for( var i=1, length=hist.length; i < length; i++ ) {
+ if( '#' + hist[i].id === to ) {
+ numberOfPages = i;
+ break;
+ }
+ }
+ }
+
+ // If still nothing, assume one
+ if(isNaN(numberOfPages) || numberOfPages < 1) {
+ numberOfPages = 1;
+ };
+
+ if (hist.length > 1) {
+ // Remove all pages in front of the target page
+ hist.splice(0, numberOfPages);
+ animatePages(curPage.page, hist[0].page, curPage.animation, curPage.reverse === false);
+ } else {
+ location.hash = '#' + curPage.id;
+ }
+
+ return publicObj;
+ }
+ function goTo(toPage, animation, reverse) {
+ var fromPage = hist[0].page;
+
+ if (typeof(toPage) === 'string') {
+ toPage = $(toPage);
+ }
+ if (typeof(animation) === 'string') {
+ for (var i = animations.length - 1; i >= 0; i--) {
+ if (animations[i].name === animation) {
+ animation = animations[i];
+ break;
+ }
+ }
+ }
+ if (animatePages(fromPage, toPage, animation, reverse)) {
+ addPageToHistory(toPage, animation, reverse);
+ return publicObj;
+ } else {
+ console.error('Could not animate pages.');
+ return false;
+ }
+ }
+ function getOrientation() {
+ return orientation;
+ }
+
+ // PRIVATE FUNCTIONS
+ function liveTap(e){
+
+ // Grab the clicked element
+ var $el = $(e.target);
+
+ if ($el.attr('nodeName')!=='A' && $el.attr('nodeName')!=='AREA') {
+ $el = $el.closest('a, area');
+ }
+
+ var target = $el.attr('target'),
+ hash = $el.attr('hash'),
+ animation=null;
+
+ if (tapReady == false || !$el.length) {
+ console.warn('Not able to tap element.');
+ return false;
+ }
+
+ if ($el.isExternalLink()) {
+ $el.removeClass('active');
+ return true;
+ }
+
+ // Figure out the animation to use
+ for (var i = animations.length - 1; i >= 0; i--) {
+ if ($el.is(animations[i].selector)) {
+ animation = animations[i];
+ break;
+ }
+ };
+
+ // User clicked an internal link, fullscreen mode
+ if (target == '_webapp') {
+ window.location = $el.attr('href');
+ }
+ // User clicked a back button
+ else if ($el.is(jQTSettings.backSelector)) {
+ goBack(hash);
+ }
+ // Allow tap on item with no href
+ else if ($el.attr('href') == '#') {
+ $el.unselect();
+ return true;
+ }
+ // Branch on internal or external href
+ else if (hash && hash!='#') {
+ $el.addClass('active');
+ goTo($(hash).data('referrer', $el), animation, $(this).hasClass('reverse'));
+ } else {
+ $el.addClass('loading active');
+ showPageByHref($el.attr('href'), {
+ animation: animation,
+ callback: function() {
+ $el.removeClass('loading'); setTimeout($.fn.unselect, 250, $el);
+ },
+ $referrer: $el
+ });
+ }
+ return false;
+ }
+ function addPageToHistory(page, animation, reverse) {
+ // Grab some info
+ var pageId = page.attr('id');
+ // Prepend info to page history
+ hist.unshift({
+ page: page,
+ animation: animation,
+ reverse: reverse || false,
+ id: pageId
+ });
+ }
+ function animatePages(fromPage, toPage, animation, backwards) {
+ // Error check for target page
+ if (toPage.length === 0) {
+ $.fn.unselect();
+ console.error('Target element is missing.');
+ return false;
+ }
+
+ // Error check for fromPage=toPage
+ if (toPage.hasClass('current')) {
+ $.fn.unselect();
+ console.error('Target element is the current page.');
+ return false;
+ }
+
+ // Collapse the keyboard
+ $(':focus').blur();
+
+ // Make sure we are scrolled up to hide location bar
+ scrollTo(0, 0);
+
+ // Define callback to run after animation completes
+ var callback = function animationEnd(event) {
+ if (animation) {
+ toPage.removeClass('in ' + animation.name);
+ fromPage.removeClass('current out ' + animation.name);
+ if (backwards) {
+ toPage.toggleClass('reverse');
+ fromPage.toggleClass('reverse');
+ }
+ } else {
+ fromPage.removeClass('current');
+ }
+
+ toPage.trigger('pageAnimationEnd', { direction: 'in' });
+ fromPage.trigger('pageAnimationEnd', { direction: 'out' });
+
+ clearInterval(hashCheckInterval);
+ currentPage = toPage;
+ location.hash = '#' + currentPage.attr('id');
+ startHashCheck();
+
+ var $originallink = toPage.data('referrer');
+ if ($originallink) {
+ $originallink.unselect();
+ }
+ lastAnimationTime = (new Date()).getTime();
+ tapReady = true;
+ }
+
+ fromPage.trigger('pageAnimationStart', { direction: 'out' });
+ toPage.trigger('pageAnimationStart', { direction: 'in' });
+
+ if ($.support.WebKitAnimationEvent && animation && jQTSettings.useAnimations) {
+ toPage.one('webkitAnimationEnd', callback);
+ tapReady = false;
+ if (backwards) {
+ toPage.toggleClass('reverse');
+ fromPage.toggleClass('reverse');
+ }
+ toPage.addClass(animation.name + ' in current ');
+ fromPage.addClass(animation.name + ' out');
+
+ } else {
+ toPage.addClass('current');
+ callback();
+ }
+
+ return true;
+ }
+ function hashCheck() {
+ var curid = currentPage.attr('id');
+ if (location.hash == '') {
+ location.hash = '#' + curid;
+ } else if (location.hash != '#' + curid) {
+ clearInterval(hashCheckInterval);
+ goBack(location.hash);
+ }
+ }
+ function startHashCheck() {
+ hashCheckInterval = setInterval(hashCheck, 100);
+ }
+ function insertPages(nodes, animation) {
+ var targetPage = null;
+ $(nodes).each(function(index, node) {
+ var $node = $(this);
+ if (!$node.attr('id')) {
+ $node.attr('id', 'page-' + (++newPageCount));
+ }
+
+ $body.trigger('pageInserted', {page: $node.appendTo($body)});
+
+ if ($node.hasClass('current') || !targetPage) {
+ targetPage = $node;
+ }
+ });
+ if (targetPage !== null) {
+ goTo(targetPage, animation);
+ return targetPage;
+ } else {
+ return false;
+ }
+ }
+ function showPageByHref(href, options) {
+ var defaults = {
+ data: null,
+ method: 'GET',
+ animation: null,
+ callback: null,
+ $referrer: null
+ };
+
+ var settings = $.extend({}, defaults, options);
+
+ if (href != '#') {
+ $.ajax({
+ url: href,
+ data: settings.data,
+ type: settings.method,
+ success: function (data, textStatus) {
+ var firstPage = insertPages(data, settings.animation);
+ if (firstPage) {
+ if (settings.method == 'GET' && jQTSettings.cacheGetRequests === true && settings.$referrer) {
+ settings.$referrer.attr('href', '#' + firstPage.attr('id'));
+ }
+ if (settings.callback) {
+ settings.callback(true);
+ }
+ }
+ },
+ error: function (data) {
+ if (settings.$referrer) {
+ settings.$referrer.unselect();
+ }
+ if (settings.callback) {
+ settings.callback(false);
+ }
+ }
+ });
+ }
+ else if (settings.$referrer) {
+ settings.$referrer.unselect();
+ }
+ }
+ function submitForm(e, callback) {
+ var $form = (typeof(e)==='string') ? $(e).eq(0) : (e.target ? $(e.target) : $(e));
+
+ if ($form.length && $form.is(jQTSettings.formSelector)) {
+ showPageByHref($form.attr('action'), {
+ data: $form.serialize(),
+ method: $form.attr('method') || "POST",
+ animation: animations[0] || null,
+ callback: callback
+ });
+ return false;
+ }
+ return true;
+ }
+ function submitParentForm(e) {
+ var $form = $(this).closest('form');
+ if ($form.length) {
+ evt = jQuery.Event("submit");
+ evt.preventDefault();
+ $form.trigger(evt);
+ return false;
+ }
+ return true;
+ }
+ function addAnimation(animation) {
+ if (typeof(animation.selector) == 'string' && typeof(animation.name) == 'string') {
+ animations.push(animation);
+ $(animation.selector).tap(liveTap);
+ touchSelectors.push(animation.selector);
+ }
+ }
+ function updateOrientation() {
+ orientation = window.innerWidth < window.innerHeight ? 'profile' : 'landscape';
+ $body.removeClass('profile landscape').addClass(orientation).trigger('turn', {orientation: orientation});
+ // scrollTo(0, 0);
+ }
+ function handleTouch(e) {
+ var $el = $(e.target);
+
+ // Only handle touchSelectors
+ if (!$(e.target).is(touchSelectors.join(', '))) {
+ var $link = $(e.target).closest('a, area');
+
+ if ($link.length && $link.is(touchSelectors.join(', '))) {
+ $el = $link;
+ } else {
+ return;
+ }
+ }
+
+ if (e) {
+ var hoverTimeout = null,
+ startX = event.changedTouches[0].clientX,
+ startY = event.changedTouches[0].clientY,
+ startTime = (new Date).getTime(),
+ deltaX = 0,
+ deltaY = 0,
+ deltaT = 0;
+
+ // Let's bind these after the fact, so we can keep some internal values
+ $el.bind('touchmove', touchmove).bind('touchend', touchend);
+
+ hoverTimeout = setTimeout(function() {
+ $el.makeActive();
+ }, 100);
+
+ }
+
+ // Private touch functions (TODO: insert dirty joke)
+ function touchmove(e) {
+
+ updateChanges();
+ var absX = Math.abs(deltaX);
+ var absY = Math.abs(deltaY);
+
+ // Check for swipe
+ if (absX > absY && (absX > 35) && deltaT < 1000) {
+ $el.trigger('swipe', {direction: (deltaX < 0) ? 'left' : 'right', deltaX: deltaX, deltaY: deltaY }).unbind('touchmove touchend');
+ } else if (absY > 1) {
+ $el.removeClass('active');
+ }
+
+ clearTimeout(hoverTimeout);
+ }
+
+ function touchend() {
+ updateChanges();
+
+ if (deltaY === 0 && deltaX === 0) {
+ $el.makeActive();
+ $el.trigger('tap');
+ } else {
+ $el.removeClass('active');
+ }
+ $el.unbind('touchmove touchend');
+ clearTimeout(hoverTimeout);
+ }
+
+ function updateChanges() {
+ var first = event.changedTouches[0] || null;
+ deltaX = first.pageX - startX;
+ deltaY = first.pageY - startY;
+ deltaT = (new Date).getTime() - startTime;
+ }
+
+ } // End touch handler
+
+ // Public jQuery Fns
+ $.fn.unselect = function(obj) {
+ if (obj) {
+ obj.removeClass('active');
+ } else {
+ $('.active').removeClass('active');
+ }
+ }
+ $.fn.makeActive = function() {
+ return $(this).addClass('active');
+ }
+ $.fn.swipe = function(fn) {
+ if ($.isFunction(fn)) {
+ return $(this).bind('swipe', fn);
+ } else {
+ return $(this).trigger('swipe');
+ }
+ }
+ $.fn.tap = function(fn) {
+ if ($.isFunction(fn)) {
+ var tapEvent = (jQTSettings.useFastTouch && $.support.touch) ? 'tap' : 'click';
+ return $(this).live(tapEvent, fn);
+ } else {
+ return $(this).trigger('tap');
+ }
+ }
+ $.fn.isExternalLink = function() {
+ var $el = $(this);
+ return ($el.attr('target') == '_blank' || $el.attr('rel') == 'external' || $el.is('input[type="checkbox"], input[type="radio"], a[href^="http://maps.google.com:"], a[href^="mailto:"], a[href^="tel:"], a[href^="javascript:"], a[href*="youtube.com/v"], a[href*="youtube.com/watch"]'));
+ }
+
+ publicObj = {
+ getOrientation: getOrientation,
+ goBack: goBack,
+ goTo: goTo,
+ addAnimation: addAnimation,
+ submitForm: submitForm
+ }
+
+ return publicObj;
+ }
+
+ // Extensions directly manipulate the jQTouch object, before it's initialized.
+ $.jQTouch.prototype.extensions = [];
+ $.jQTouch.addExtension = function(extension) {
+ $.jQTouch.prototype.extensions.push(extension);
+ }
+
+})(jQuery);
\ No newline at end of file diff --git a/jqtouch/jqtouch.min.css b/jqtouch/jqtouch.min.css new file mode 100644 index 0000000..37ef6fe --- /dev/null +++ b/jqtouch/jqtouch.min.css @@ -0,0 +1 @@ +*{margin:0;padding:0;}a{-webkit-tap-highlight-color:rgba(0,0,0,0);}body{overflow-x:hidden;-webkit-user-select:none;-webkit-text-size-adjust:none;font-family:Helvetica;-webkit-perspective:800;-webkit-transform-style:preserve-3d;}.selectable,input,textarea{-webkit-user-select:auto;}body>*{-webkit-backface-visibility:hidden;-webkit-box-sizing:border-box;display:none;position:absolute;left:0;width:100%;-webkit-transform:translate3d(0,0,0) rotate(0) scale(1);min-height:420px!important;}body.fullscreen>*{min-height:460px!important;}body.fullscreen.black-translucent>*{min-height:480px!important;}body.landscape>*{min-height:320px;}body>.current{display:block!important;}.in,.out{-webkit-animation-timing-function:ease-in-out;-webkit-animation-duration:350ms;}.slide.in{-webkit-animation-name:slideinfromright;}.slide.out{-webkit-animation-name:slideouttoleft;}.slide.in.reverse{-webkit-animation-name:slideinfromleft;}.slide.out.reverse{-webkit-animation-name:slideouttoright;}@-webkit-keyframes slideinfromright{from{-webkit-transform:translateX(100%);}to{-webkit-transform:translateX(0);}}@-webkit-keyframes slideinfromleft{from{-webkit-transform:translateX(-100%);}to{-webkit-transform:translateX(0);}}@-webkit-keyframes slideouttoleft{from{-webkit-transform:translateX(0);}to{-webkit-transform:translateX(-100%);}}@-webkit-keyframes slideouttoright{from{-webkit-transform:translateX(0);}to{-webkit-transform:translateX(100%);}}@-webkit-keyframes fadein{from{opacity:0;}to{opacity:1;}}@-webkit-keyframes fadeout{from{opacity:1;}to{opacity:0;}}.fade.in{z-index:10;-webkit-animation-name:fadein;}.fade.out{z-index:0;}.dissolve.in{-webkit-animation-name:fadein;}.dissolve.out{-webkit-animation-name:fadeout;}.flip{-webkit-animation-duration:.65s;}.flip.in{-webkit-animation-name:flipinfromleft;}.flip.out{-webkit-animation-name:flipouttoleft;}.flip.in.reverse{-webkit-animation-name:flipinfromright;}.flip.out.reverse{-webkit-animation-name:flipouttoright;}@-webkit-keyframes flipinfromright{from{-webkit-transform:rotateY(-180deg) scale(.8);}to{-webkit-transform:rotateY(0) scale(1);}}@-webkit-keyframes flipinfromleft{from{-webkit-transform:rotateY(180deg) scale(.8);}to{-webkit-transform:rotateY(0) scale(1);}}@-webkit-keyframes flipouttoleft{from{-webkit-transform:rotateY(0) scale(1);}to{-webkit-transform:rotateY(-180deg) scale(.8);}}@-webkit-keyframes flipouttoright{from{-webkit-transform:rotateY(0) scale(1);}to{-webkit-transform:rotateY(180deg) scale(.8);}}.slideup.in{-webkit-animation-name:slideup;z-index:10;}.slideup.out{-webkit-animation-name:dontmove;z-index:0;}.slideup.out.reverse{z-index:10;-webkit-animation-name:slidedown;}.slideup.in.reverse{z-index:0;-webkit-animation-name:dontmove;}@-webkit-keyframes slideup{from{-webkit-transform:translateY(100%);}to{-webkit-transform:translateY(0);}}@-webkit-keyframes slidedown{from{-webkit-transform:translateY(0);}to{-webkit-transform:translateY(100%);}}@-webkit-keyframes dontmove{from{opacity:1;}to{opacity:1;}}.swap{-webkit-transform:perspective(800);-webkit-animation-duration:.7s;}.swap.out{-webkit-animation-name:swapouttoleft;}.swap.in{-webkit-animation-name:swapinfromright;}.swap.out.reverse{-webkit-animation-name:swapouttoright;}.swap.in.reverse{-webkit-animation-name:swapinfromleft;}@-webkit-keyframes swapouttoright{0%{-webkit-transform:translate3d(0px,0px,0px) rotateY(0deg);-webkit-animation-timing-function:ease-in-out;}50%{-webkit-transform:translate3d(-180px,0px,-400px) rotateY(20deg);-webkit-animation-timing-function:ease-in;}100%{-webkit-transform:translate3d(0px,0px,-800px) rotateY(70deg);}}@-webkit-keyframes swapouttoleft{0%{-webkit-transform:translate3d(0px,0px,0px) rotateY(0deg);-webkit-animation-timing-function:ease-in-out;}50%{-webkit-transform:translate3d(180px,0px,-400px) rotateY(-20deg);-webkit-animation-timing-function:ease-in;}100%{-webkit-transform:translate3d(0px,0px,-800px) rotateY(-70deg);}}@-webkit-keyframes swapinfromright{0%{-webkit-transform:translate3d(0px,0px,-800px) rotateY(70deg);-webkit-animation-timing-function:ease-out;}50%{-webkit-transform:translate3d(-180px,0px,-400px) rotateY(20deg);-webkit-animation-timing-function:ease-in-out;}100%{-webkit-transform:translate3d(0px,0px,0px) rotateY(0deg);}}@-webkit-keyframes swapinfromleft{0%{-webkit-transform:translate3d(0px,0px,-800px) rotateY(-70deg);-webkit-animation-timing-function:ease-out;}50%{-webkit-transform:translate3d(180px,0px,-400px) rotateY(-20deg);-webkit-animation-timing-function:ease-in-out;}100%{-webkit-transform:translate3d(0px,0px,0px) rotateY(0deg);}}.cube{-webkit-animation-duration:.55s;}.cube.in{-webkit-animation-name:cubeinfromright;-webkit-transform-origin:0 50%;}.cube.out{-webkit-animation-name:cubeouttoleft;-webkit-transform-origin:100% 50%;}.cube.in.reverse{-webkit-animation-name:cubeinfromleft;-webkit-transform-origin:100% 50%;}.cube.out.reverse{-webkit-animation-name:cubeouttoright;-webkit-transform-origin:0 50%;}@-webkit-keyframes cubeinfromleft{from{-webkit-transform:rotateY(-90deg) translateZ(320px);opacity:.5;}to{-webkit-transform:rotateY(0deg) translateZ(0);opacity:1;}}@-webkit-keyframes cubeouttoright{from{-webkit-transform:rotateY(0deg) translateX(0);opacity:1;}to{-webkit-transform:rotateY(90deg) translateZ(320px);opacity:.5;}}@-webkit-keyframes cubeinfromright{from{-webkit-transform:rotateY(90deg) translateZ(320px);opacity:.5;}to{-webkit-transform:rotateY(0deg) translateZ(0);opacity:1;}}@-webkit-keyframes cubeouttoleft{from{-webkit-transform:rotateY(0deg) translateZ(0);opacity:1;}to{-webkit-transform:rotateY(-90deg) translateZ(320px);opacity:.5;}}.pop{-webkit-transform-origin:50% 50%;}.pop.in{-webkit-animation-name:popin;z-index:10;}.pop.out.reverse{-webkit-animation-name:popout;z-index:10;}.pop.in.reverse{z-index:0;-webkit-animation-name:dontmove;}@-webkit-keyframes popin{from{-webkit-transform:scale(.2);opacity:0;}to{-webkit-transform:scale(1);opacity:1;}}@-webkit-keyframes popout{from{-webkit-transform:scale(1);opacity:1;}to{-webkit-transform:scale(.2);opacity:0;}}
\ No newline at end of file diff --git a/jqtouch/jqtouch.min.js b/jqtouch/jqtouch.min.js new file mode 100644 index 0000000..f43917e --- /dev/null +++ b/jqtouch/jqtouch.min.js @@ -0,0 +1 @@ +(function($){$.jQTouch=function(_2){$.support.WebKitCSSMatrix=(typeof WebKitCSSMatrix=="object");$.support.touch=(typeof Touch=="object");$.support.WebKitAnimationEvent=(typeof WebKitTransitionEvent=="object");var _3,$head=$("head"),hist=[],newPageCount=0,jQTSettings={},hashCheck,currentPage,orientation,isMobileWebKit=RegExp(" Mobile/").test(navigator.userAgent),tapReady=true,lastAnimationTime=0,touchSelectors=[],publicObj={},extensions=$.jQTouch.prototype.extensions,defaultAnimations=["slide","flip","slideup","swap","cube","pop","dissolve","fade","back"],animations=[],hairextensions="";init(_2);function init(_4){var _5={addGlossToIcon:true,backSelector:".back, .cancel, .goback",cacheGetRequests:true,cubeSelector:".cube",dissolveSelector:".dissolve",fadeSelector:".fade",fixedViewport:true,flipSelector:".flip",formSelector:"form",fullScreen:true,fullScreenClass:"fullscreen",icon:null,touchSelector:"a, .touch",popSelector:".pop",preloadImages:false,slideSelector:"body > * > ul li a",slideupSelector:".slideup",startupScreen:null,statusBar:"default",submitSelector:".submit",swapSelector:".swap",useAnimations:true,useFastTouch:true};jQTSettings=$.extend({},_5,_4);if(jQTSettings.preloadImages){for(var i=jQTSettings.preloadImages.length-1;i>=0;i--){(new Image()).src=jQTSettings.preloadImages[i];}}if(jQTSettings.icon){var _7=(jQTSettings.addGlossToIcon)?"":"-precomposed";hairextensions+="<link rel=\"apple-touch-icon"+_7+"\" href=\""+jQTSettings.icon+"\" />";}if(jQTSettings.startupScreen){hairextensions+="<link rel=\"apple-touch-startup-image\" href=\""+jQTSettings.startupScreen+"\" />";}if(jQTSettings.fixedViewport){hairextensions+="<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;\"/>";}if(jQTSettings.fullScreen){hairextensions+="<meta name=\"apple-mobile-web-app-capable\" content=\"yes\" />";if(jQTSettings.statusBar){hairextensions+="<meta name=\"apple-mobile-web-app-status-bar-style\" content=\""+jQTSettings.statusBar+"\" />";}}if(hairextensions){$head.append(hairextensions);}$(document).ready(function(){for(var i in extensions){var fn=extensions[i];if($.isFunction(fn)){$.extend(publicObj,fn(publicObj));}}for(var i in defaultAnimations){var _a=defaultAnimations[i];var _b=jQTSettings[_a+"Selector"];if(typeof (_b)=="string"){addAnimation({name:_a,selector:_b});}}touchSelectors.push("input");touchSelectors.push(jQTSettings.touchSelector);touchSelectors.push(jQTSettings.backSelector);touchSelectors.push(jQTSettings.submitSelector);$(touchSelectors.join(", ")).css("-webkit-touch-callout","none");$(jQTSettings.backSelector).tap(liveTap);$(jQTSettings.submitSelector).tap(submitParentForm);_3=$("body");if(jQTSettings.fullScreenClass&&window.navigator.standalone==true){_3.addClass(jQTSettings.fullScreenClass+" "+jQTSettings.statusBar);}_3.bind("touchstart",handleTouch).bind("orientationchange",updateOrientation).trigger("orientationchange").submit(submitForm);if(jQTSettings.useFastTouch&&$.support.touch){_3.click(function(e){var _d=$(e.target);if(_d.attr("target")=="_blank"||_d.attr("rel")=="external"||_d.is("input[type=\"checkbox\"]")){return true;}else{return false;}});_3.mousedown(function(e){var _f=(new Date()).getTime()-lastAnimationTime;if(_f<200){return false;}});}if($("body > .current").length==0){currentPage=$("body > *:first");}else{currentPage=$("body > .current:first");$("body > .current").removeClass("current");}$(currentPage).addClass("current");location.hash=$(currentPage).attr("id");addPageToHistory(currentPage);scrollTo(0,0);dumbLoopStart();});}function goBack(to){if(hist.length>1){var _11=Math.min(parseInt(to||1,10),hist.length-1);if(isNaN(_11)&&typeof (to)==="string"&&to!="#"){for(var i=1,length=hist.length;i<length;i++){if("#"+hist[i].id===to){_11=i;break;}}}if(isNaN(_11)||_11<1){_11=1;}var _13=hist[0].animation;var _14=hist[0].page;hist.splice(0,_11);var _15=hist[0].page;animatePages(_14,_15,_13,true);return publicObj;}else{console.error("No pages in history.");return false;}}function goTo(_16,_17){var _18=hist[0].page;if(typeof (_16)==="string"){_16=$(_16);}if(typeof (_17)==="string"){for(var i=animations.length-1;i>=0;i--){if(animations[i].name===_17){_17=animations[i];break;}}}if(animatePages(_18,_16,_17)){addPageToHistory(_16,_17);return publicObj;}else{console.error("Could not animate pages.");return false;}}function getOrientation(){return orientation;}function liveTap(e){var $el=$(e.target);if($el.attr("nodeName")!=="A"){$el=$el.parent("a");}var _1c=$el.attr("target"),hash=$el.attr("hash"),animation=null;if(tapReady==false||!$el.length){console.warn("Not able to tap element.");return false;}if($el.attr("target")=="_blank"||$el.attr("rel")=="external"){return true;}for(var i=animations.length-1;i>=0;i--){if($el.is(animations[i].selector)){animation=animations[i];break;}}if(_1c=="_webapp"){window.location=$el.attr("href");}else{if($el.is(jQTSettings.backSelector)){goBack(hash);}else{if(hash&&hash!="#"){$el.addClass("active");goTo($(hash).data("referrer",$el),animation);}else{$el.addClass("loading active");showPageByHref($el.attr("href"),{animation:animation,callback:function(){$el.removeClass("loading");setTimeout($.fn.unselect,250,$el);},$referrer:$el});}}}return false;}function addPageToHistory(_1e,_1f){var _20=_1e.attr("id");hist.unshift({page:_1e,animation:_1f,id:_20});}function animatePages(_21,_22,_23,_24){if(_22.length===0){$.fn.unselect();console.error("Target element is missing.");return false;}$(":focus").blur();scrollTo(0,0);var _25=function(_26){if(_23){_22.removeClass("in reverse "+_23.name);_21.removeClass("current out reverse "+_23.name);}else{_21.removeClass("current");}_22.trigger("pageAnimationEnd",{direction:"in"});_21.trigger("pageAnimationEnd",{direction:"out"});clearInterval(dumbLoop);currentPage=_22;location.hash=currentPage.attr("id");dumbLoopStart();var _27=_22.data("referrer");if(_27){_27.unselect();}lastAnimationTime=(new Date()).getTime();tapReady=true;};_21.trigger("pageAnimationStart",{direction:"out"});_22.trigger("pageAnimationStart",{direction:"in"});if($.support.WebKitAnimationEvent&&_23&&jQTSettings.useAnimations){_22.one("webkitAnimationEnd",_25);tapReady=false;_22.addClass(_23.name+" in current "+(_24?" reverse":""));_21.addClass(_23.name+" out"+(_24?" reverse":""));}else{_22.addClass("current");_25();}return true;}function dumbLoopStart(){dumbLoop=setInterval(function(){var _28=currentPage.attr("id");if(location.hash==""){location.hash="#"+_28;}else{if(location.hash!="#"+_28){try{goBack(location.hash);}catch(e){console.error("Unknown hash change.");}}}},100);}function insertPages(_29,_2a){var _2b=null;$(_29).each(function(_2c,_2d){var _2e=$(this);if(!_2e.attr("id")){_2e.attr("id","page-"+(++newPageCount));}_2e.appendTo(_3);if(_2e.hasClass("current")||!_2b){_2b=_2e;}});if(_2b!==null){goTo(_2b,_2a);return _2b;}else{return false;}}function showPageByHref(_2f,_30){var _31={data:null,method:"GET",animation:null,callback:null,$referrer:null};var _32=$.extend({},_31,_30);if(_2f!="#"){$.ajax({url:_2f,data:_32.data,type:_32.method,success:function(_33,_34){var _35=insertPages(_33,_32.animation);if(_35){if(_32.method=="GET"&&jQTSettings.cacheGetRequests&&_32.$referrer){_32.$referrer.attr("href","#"+_35.attr("id"));}if(_32.callback){_32.callback(true);}}},error:function(_36){if(_32.$referrer){_32.$referrer.unselect();}if(_32.callback){_32.callback(false);}}});}else{if($referrer){$referrer.unselect();}}}function submitForm(e,_38){var _39=(typeof (e)==="string")?$(e):$(e.target);if(_39.length&&_39.is(jQTSettings.formSelector)&&_39.attr("action")){showPageByHref(_39.attr("action"),{data:_39.serialize(),method:_39.attr("method")||"POST",animation:animations[0]||null,callback:_38});return false;}return true;}function submitParentForm(e){var _3b=$(this).closest("form");if(_3b.length){evt=jQuery.Event("submit");evt.preventDefault();_3b.trigger(evt);return false;}return true;}function addAnimation(_3c){if(typeof (_3c.selector)=="string"&&typeof (_3c.name)=="string"){animations.push(_3c);$(_3c.selector).tap(liveTap);touchSelectors.push(_3c.selector);}}function updateOrientation(){orientation=window.innerWidth<window.innerHeight?"profile":"landscape";_3.removeClass("profile landscape").addClass(orientation).trigger("turn",{orientation:orientation});}function handleTouch(e){var $el=$(e.target);if(!$(e.target).is(touchSelectors.join(", "))){var _3f=$(e.target).closest("a");if(_3f.length){$el=_3f;}else{return;}}if(event){var _40=null,startX=event.changedTouches[0].clientX,startY=event.changedTouches[0].clientY,startTime=(new Date).getTime(),deltaX=0,deltaY=0,deltaT=0;$el.bind("touchmove",touchmove).bind("touchend",touchend);_40=setTimeout(function(){$el.makeActive();},100);}function touchmove(e){updateChanges();var _42=Math.abs(deltaX);var _43=Math.abs(deltaY);if(_42>_43&&(_42>35)&&deltaT<1000){$el.trigger("swipe",{direction:(deltaX<0)?"left":"right"}).unbind("touchmove touchend");}else{if(_43>1){$el.removeClass("active");}}clearTimeout(_40);}function touchend(){updateChanges();if(deltaY===0&&deltaX===0){$el.makeActive();$el.trigger("tap");}else{$el.removeClass("active");}$el.unbind("touchmove touchend");clearTimeout(_40);}function updateChanges(){var _44=event.changedTouches[0]||null;deltaX=_44.pageX-startX;deltaY=_44.pageY-startY;deltaT=(new Date).getTime()-startTime;}}$.fn.unselect=function(obj){if(obj){obj.removeClass("active");}else{$(".active").removeClass("active");}};$.fn.makeActive=function(){return $(this).addClass("active");};$.fn.swipe=function(fn){if($.isFunction(fn)){return this.each(function(i,el){$(el).bind("swipe",fn);});}};$.fn.tap=function(fn){if($.isFunction(fn)){var _4a=(jQTSettings.useFastTouch&&$.support.touch)?"tap":"click";return $(this).live(_4a,fn);}else{$(this).trigger("tap");}};publicObj={getOrientation:getOrientation,goBack:goBack,goTo:goTo,addAnimation:addAnimation,submitForm:submitForm};return publicObj;};$.jQTouch.prototype.extensions=[];$.jQTouch.addExtension=function(_4b){$.jQTouch.prototype.extensions.push(_4b);};})(jQuery);
\ No newline at end of file diff --git a/jqtouch/jqtouch.transitions.js b/jqtouch/jqtouch.transitions.js new file mode 100644 index 0000000..3fcdc02 --- /dev/null +++ b/jqtouch/jqtouch.transitions.js @@ -0,0 +1,60 @@ +/*
+
+ _/ _/_/ _/_/_/_/_/ _/
+ _/ _/ _/ _/_/ _/ _/ _/_/_/ _/_/_/
+ _/ _/ _/_/ _/ _/ _/ _/ _/ _/ _/ _/
+ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/
+ _/ _/_/ _/ _/ _/_/ _/_/_/ _/_/_/ _/ _/
+ _/
+ _/
+
+ Created by David Kaneda <http://www.davidkaneda.com>
+ Documentation and issue tracking on Google Code <http://code.google.com/p/jqtouch/>
+
+ Special thanks to Jonathan Stark <http://jonathanstark.com/>
+ and pinch/zoom <http://www.pinchzoom.com/>
+
+ (c) 2009 by jQTouch project members.
+ See LICENSE.txt for license.
+
+*/
+
+(function($) {
+
+ $.fn.transition = function(css, options) {
+ return this.each(function(){
+ var $el = $(this);
+ var defaults = {
+ speed : '300ms',
+ callback: null,
+ ease: 'ease-in-out'
+ };
+ var settings = $.extend({}, defaults, options);
+ if(settings.speed === 0) {
+ $el.css(css);
+ window.setTimeout(settings.callback, 0);
+ } else {
+ if ($.browser.safari)
+ {
+ var s = [];
+ for(var i in css) {
+ s.push(i);
+ }
+ $el.css({
+ webkitTransitionProperty: s.join(", "),
+ webkitTransitionDuration: settings.speed,
+ webkitTransitionTimingFunction: settings.ease
+ });
+ if (settings.callback) {
+ $el.one('webkitTransitionEnd', settings.callback);
+ }
+ setTimeout(function(el){ el.css(css) }, 0, $el);
+ }
+ else
+ {
+ $el.animate(css, settings.speed, settings.callback);
+ }
+ }
+ });
+ }
+})(jQuery);
\ No newline at end of file diff --git a/jqtouch/jquery.1.3.2.min.js b/jqtouch/jquery.1.3.2.min.js new file mode 100644 index 0000000..55c2e6d --- /dev/null +++ b/jqtouch/jquery.1.3.2.min.js @@ -0,0 +1,19 @@ +/*
+ * jQuery JavaScript Library v1.3.2
+ * http://jquery.com/
+ *
+ * Copyright (c) 2009 John Resig
+ * Dual licensed under the MIT and GPL licenses.
+ * http://docs.jquery.com/License
+ *
+ * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009)
+ * Revision: 6246
+ */
+(function(){var l=this,g,y=l.jQuery,p=l.$,o=l.jQuery=l.$=function(E,F){return new o.fn.init(E,F)},D=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;o.fn=o.prototype={init:function(E,H){E=E||document;if(E.nodeType){this[0]=E;this.length=1;this.context=E;return this}if(typeof E==="string"){var G=D.exec(E);if(G&&(G[1]||!H)){if(G[1]){E=o.clean([G[1]],H)}else{var I=document.getElementById(G[3]);if(I&&I.id!=G[3]){return o().find(E)}var F=o(I||[]);F.context=document;F.selector=E;return F}}else{return o(H).find(E)}}else{if(o.isFunction(E)){return o(document).ready(E)}}if(E.selector&&E.context){this.selector=E.selector;this.context=E.context}return this.setArray(o.isArray(E)?E:o.makeArray(E))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(E){return E===g?Array.prototype.slice.call(this):this[E]},pushStack:function(F,H,E){var G=o(F);G.prevObject=this;G.context=this.context;if(H==="find"){G.selector=this.selector+(this.selector?" ":"")+E}else{if(H){G.selector=this.selector+"."+H+"("+E+")"}}return G},setArray:function(E){this.length=0;Array.prototype.push.apply(this,E);return this},each:function(F,E){return o.each(this,F,E)},index:function(E){return o.inArray(E&&E.jquery?E[0]:E,this)},attr:function(F,H,G){var E=F;if(typeof F==="string"){if(H===g){return this[0]&&o[G||"attr"](this[0],F)}else{E={};E[F]=H}}return this.each(function(I){for(F in E){o.attr(G?this.style:this,F,o.prop(this,E[F],G,I,F))}})},css:function(E,F){if((E=="width"||E=="height")&&parseFloat(F)<0){F=g}return this.attr(E,F,"curCSS")},text:function(F){if(typeof F!=="object"&&F!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(F))}var E="";o.each(F||this,function(){o.each(this.childNodes,function(){if(this.nodeType!=8){E+=this.nodeType!=1?this.nodeValue:o.fn.text([this])}})});return E},wrapAll:function(E){if(this[0]){var F=o(E,this[0].ownerDocument).clone();if(this[0].parentNode){F.insertBefore(this[0])}F.map(function(){var G=this;while(G.firstChild){G=G.firstChild}return G}).append(this)}return this},wrapInner:function(E){return this.each(function(){o(this).contents().wrapAll(E)})},wrap:function(E){return this.each(function(){o(this).wrapAll(E)})},append:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.appendChild(E)}})},prepend:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.insertBefore(E,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this)})},after:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this.nextSibling)})},end:function(){return this.prevObject||o([])},push:[].push,sort:[].sort,splice:[].splice,find:function(E){if(this.length===1){var F=this.pushStack([],"find",E);F.length=0;o.find(E,this[0],F);return F}else{return this.pushStack(o.unique(o.map(this,function(G){return o.find(E,G)})),"find",E)}},clone:function(G){var E=this.map(function(){if(!o.support.noCloneEvent&&!o.isXMLDoc(this)){var I=this.outerHTML;if(!I){var J=this.ownerDocument.createElement("div");J.appendChild(this.cloneNode(true));I=J.innerHTML}return o.clean([I.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else{return this.cloneNode(true)}});if(G===true){var H=this.find("*").andSelf(),F=0;E.find("*").andSelf().each(function(){if(this.nodeName!==H[F].nodeName){return}var I=o.data(H[F],"events");for(var K in I){for(var J in I[K]){o.event.add(this,K,I[K][J],I[K][J].data)}}F++})}return E},filter:function(E){return this.pushStack(o.isFunction(E)&&o.grep(this,function(G,F){return E.call(G,F)})||o.multiFilter(E,o.grep(this,function(F){return F.nodeType===1})),"filter",E)},closest:function(E){var G=o.expr.match.POS.test(E)?o(E):null,F=0;return this.map(function(){var H=this;while(H&&H.ownerDocument){if(G?G.index(H)>-1:o(H).is(E)){o.data(H,"closest",F);return H}H=H.parentNode;F++}})},not:function(E){if(typeof E==="string"){if(f.test(E)){return this.pushStack(o.multiFilter(E,this,true),"not",E)}else{E=o.multiFilter(E,this)}}var F=E.length&&E[E.length-1]!==g&&!E.nodeType;return this.filter(function(){return F?o.inArray(this,E)<0:this!=E})},add:function(E){return this.pushStack(o.unique(o.merge(this.get(),typeof E==="string"?o(E):o.makeArray(E))))},is:function(E){return !!E&&o.multiFilter(E,this).length>0},hasClass:function(E){return !!E&&this.is("."+E)},val:function(K){if(K===g){var E=this[0];if(E){if(o.nodeName(E,"option")){return(E.attributes.value||{}).specified?E.value:E.text}if(o.nodeName(E,"select")){var I=E.selectedIndex,L=[],M=E.options,H=E.type=="select-one";if(I<0){return null}for(var F=H?I:0,J=H?I+1:M.length;F<J;F++){var G=M[F];if(G.selected){K=o(G).val();if(H){return K}L.push(K)}}return L}return(E.value||"").replace(/\r/g,"")}return g}if(typeof K==="number"){K+=""}return this.each(function(){if(this.nodeType!=1){return}if(o.isArray(K)&&/radio|checkbox/.test(this.type)){this.checked=(o.inArray(this.value,K)>=0||o.inArray(this.name,K)>=0)}else{if(o.nodeName(this,"select")){var N=o.makeArray(K);o("option",this).each(function(){this.selected=(o.inArray(this.value,N)>=0||o.inArray(this.text,N)>=0)});if(!N.length){this.selectedIndex=-1}}else{this.value=K}}})},html:function(E){return E===g?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(E)},replaceWith:function(E){return this.after(E).remove()},eq:function(E){return this.slice(E,+E+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(E){return this.pushStack(o.map(this,function(G,F){return E.call(G,F,G)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(J,M,L){if(this[0]){var I=(this[0].ownerDocument||this[0]).createDocumentFragment(),F=o.clean(J,(this[0].ownerDocument||this[0]),I),H=I.firstChild;if(H){for(var G=0,E=this.length;G<E;G++){L.call(K(this[G],H),this.length>1||G>0?I.cloneNode(true):I)}}if(F){o.each(F,z)}}return this;function K(N,O){return M&&o.nodeName(N,"table")&&o.nodeName(O,"tr")?(N.getElementsByTagName("tbody")[0]||N.appendChild(N.ownerDocument.createElement("tbody"))):N}}};o.fn.init.prototype=o.fn;function z(E,F){if(F.src){o.ajax({url:F.src,async:false,dataType:"script"})}else{o.globalEval(F.text||F.textContent||F.innerHTML||"")}if(F.parentNode){F.parentNode.removeChild(F)}}function e(){return +new Date}o.extend=o.fn.extend=function(){var J=arguments[0]||{},H=1,I=arguments.length,E=false,G;if(typeof J==="boolean"){E=J;J=arguments[1]||{};H=2}if(typeof J!=="object"&&!o.isFunction(J)){J={}}if(I==H){J=this;--H}for(;H<I;H++){if((G=arguments[H])!=null){for(var F in G){var K=J[F],L=G[F];if(J===L){continue}if(E&&L&&typeof L==="object"&&!L.nodeType){J[F]=o.extend(E,K||(L.length!=null?[]:{}),L)}else{if(L!==g){J[F]=L}}}}}return J};var b=/z-?index|font-?weight|opacity|zoom|line-?height/i,q=document.defaultView||{},s=Object.prototype.toString;o.extend({noConflict:function(E){l.$=p;if(E){l.jQuery=y}return o},isFunction:function(E){return s.call(E)==="[object Function]"},isArray:function(E){return s.call(E)==="[object Array]"},isXMLDoc:function(E){return E.nodeType===9&&E.documentElement.nodeName!=="HTML"||!!E.ownerDocument&&o.isXMLDoc(E.ownerDocument)},globalEval:function(G){if(G&&/\S/.test(G)){var F=document.getElementsByTagName("head")[0]||document.documentElement,E=document.createElement("script");E.type="text/javascript";if(o.support.scriptEval){E.appendChild(document.createTextNode(G))}else{E.text=G}F.insertBefore(E,F.firstChild);F.removeChild(E)}},nodeName:function(F,E){return F.nodeName&&F.nodeName.toUpperCase()==E.toUpperCase()},each:function(G,K,F){var E,H=0,I=G.length;if(F){if(I===g){for(E in G){if(K.apply(G[E],F)===false){break}}}else{for(;H<I;){if(K.apply(G[H++],F)===false){break}}}}else{if(I===g){for(E in G){if(K.call(G[E],E,G[E])===false){break}}}else{for(var J=G[0];H<I&&K.call(J,H,J)!==false;J=G[++H]){}}}return G},prop:function(H,I,G,F,E){if(o.isFunction(I)){I=I.call(H,F)}return typeof I==="number"&&G=="curCSS"&&!b.test(E)?I+"px":I},className:{add:function(E,F){o.each((F||"").split(/\s+/),function(G,H){if(E.nodeType==1&&!o.className.has(E.className,H)){E.className+=(E.className?" ":"")+H}})},remove:function(E,F){if(E.nodeType==1){E.className=F!==g?o.grep(E.className.split(/\s+/),function(G){return !o.className.has(F,G)}).join(" "):""}},has:function(F,E){return F&&o.inArray(E,(F.className||F).toString().split(/\s+/))>-1}},swap:function(H,G,I){var E={};for(var F in G){E[F]=H.style[F];H.style[F]=G[F]}I.call(H);for(var F in G){H.style[F]=E[F]}},css:function(H,F,J,E){if(F=="width"||F=="height"){var L,G={position:"absolute",visibility:"hidden",display:"block"},K=F=="width"?["Left","Right"]:["Top","Bottom"];function I(){L=F=="width"?H.offsetWidth:H.offsetHeight;if(E==="border"){return}o.each(K,function(){if(!E){L-=parseFloat(o.curCSS(H,"padding"+this,true))||0}if(E==="margin"){L+=parseFloat(o.curCSS(H,"margin"+this,true))||0}else{L-=parseFloat(o.curCSS(H,"border"+this+"Width",true))||0}})}if(H.offsetWidth!==0){I()}else{o.swap(H,G,I)}return Math.max(0,Math.round(L))}return o.curCSS(H,F,J)},curCSS:function(I,F,G){var L,E=I.style;if(F=="opacity"&&!o.support.opacity){L=o.attr(E,"opacity");return L==""?"1":L}if(F.match(/float/i)){F=w}if(!G&&E&&E[F]){L=E[F]}else{if(q.getComputedStyle){if(F.match(/float/i)){F="float"}F=F.replace(/([A-Z])/g,"-$1").toLowerCase();var M=q.getComputedStyle(I,null);if(M){L=M.getPropertyValue(F)}if(F=="opacity"&&L==""){L="1"}}else{if(I.currentStyle){var J=F.replace(/\-(\w)/g,function(N,O){return O.toUpperCase()});L=I.currentStyle[F]||I.currentStyle[J];if(!/^\d+(px)?$/i.test(L)&&/^\d/.test(L)){var H=E.left,K=I.runtimeStyle.left;I.runtimeStyle.left=I.currentStyle.left;E.left=L||0;L=E.pixelLeft+"px";E.left=H;I.runtimeStyle.left=K}}}}return L},clean:function(F,K,I){K=K||document;if(typeof K.createElement==="undefined"){K=K.ownerDocument||K[0]&&K[0].ownerDocument||document}if(!I&&F.length===1&&typeof F[0]==="string"){var H=/^<(\w+)\s*\/?>$/.exec(F[0]);if(H){return[K.createElement(H[1])]}}var G=[],E=[],L=K.createElement("div");o.each(F,function(P,S){if(typeof S==="number"){S+=""}if(!S){return}if(typeof S==="string"){S=S.replace(/(<(\w+)[^>]*?)\/>/g,function(U,V,T){return T.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?U:V+"></"+T+">"});var O=S.replace(/^\s+/,"").substring(0,10).toLowerCase();var Q=!O.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!O.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||O.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!O.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!O.indexOf("<td")||!O.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!O.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||!o.support.htmlSerialize&&[1,"div<div>","</div>"]||[0,"",""];L.innerHTML=Q[1]+S+Q[2];while(Q[0]--){L=L.lastChild}if(!o.support.tbody){var R=/<tbody/i.test(S),N=!O.indexOf("<table")&&!R?L.firstChild&&L.firstChild.childNodes:Q[1]=="<table>"&&!R?L.childNodes:[];for(var M=N.length-1;M>=0;--M){if(o.nodeName(N[M],"tbody")&&!N[M].childNodes.length){N[M].parentNode.removeChild(N[M])}}}if(!o.support.leadingWhitespace&&/^\s/.test(S)){L.insertBefore(K.createTextNode(S.match(/^\s*/)[0]),L.firstChild)}S=o.makeArray(L.childNodes)}if(S.nodeType){G.push(S)}else{G=o.merge(G,S)}});if(I){for(var J=0;G[J];J++){if(o.nodeName(G[J],"script")&&(!G[J].type||G[J].type.toLowerCase()==="text/javascript")){E.push(G[J].parentNode?G[J].parentNode.removeChild(G[J]):G[J])}else{if(G[J].nodeType===1){G.splice.apply(G,[J+1,0].concat(o.makeArray(G[J].getElementsByTagName("script"))))}I.appendChild(G[J])}}return E}return G},attr:function(J,G,K){if(!J||J.nodeType==3||J.nodeType==8){return g}var H=!o.isXMLDoc(J),L=K!==g;G=H&&o.props[G]||G;if(J.tagName){var F=/href|src|style/.test(G);if(G=="selected"&&J.parentNode){J.parentNode.selectedIndex}if(G in J&&H&&!F){if(L){if(G=="type"&&o.nodeName(J,"input")&&J.parentNode){throw"type property can't be changed"}J[G]=K}if(o.nodeName(J,"form")&&J.getAttributeNode(G)){return J.getAttributeNode(G).nodeValue}if(G=="tabIndex"){var I=J.getAttributeNode("tabIndex");return I&&I.specified?I.value:J.nodeName.match(/(button|input|object|select|textarea)/i)?0:J.nodeName.match(/^(a|area)$/i)&&J.href?0:g}return J[G]}if(!o.support.style&&H&&G=="style"){return o.attr(J.style,"cssText",K)}if(L){J.setAttribute(G,""+K)}var E=!o.support.hrefNormalized&&H&&F?J.getAttribute(G,2):J.getAttribute(G);return E===null?g:E}if(!o.support.opacity&&G=="opacity"){if(L){J.zoom=1;J.filter=(J.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(K)+""=="NaN"?"":"alpha(opacity="+K*100+")")}return J.filter&&J.filter.indexOf("opacity=")>=0?(parseFloat(J.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}G=G.replace(/-([a-z])/ig,function(M,N){return N.toUpperCase()});if(L){J[G]=K}return J[G]},trim:function(E){return(E||"").replace(/^\s+|\s+$/g,"")},makeArray:function(G){var E=[];if(G!=null){var F=G.length;if(F==null||typeof G==="string"||o.isFunction(G)||G.setInterval){E[0]=G}else{while(F){E[--F]=G[F]}}}return E},inArray:function(G,H){for(var E=0,F=H.length;E<F;E++){if(H[E]===G){return E}}return -1},merge:function(H,E){var F=0,G,I=H.length;if(!o.support.getAll){while((G=E[F++])!=null){if(G.nodeType!=8){H[I++]=G}}}else{while((G=E[F++])!=null){H[I++]=G}}return H},unique:function(K){var F=[],E={};try{for(var G=0,H=K.length;G<H;G++){var J=o.data(K[G]);if(!E[J]){E[J]=true;F.push(K[G])}}}catch(I){F=K}return F},grep:function(F,J,E){var G=[];for(var H=0,I=F.length;H<I;H++){if(!E!=!J(F[H],H)){G.push(F[H])}}return G},map:function(E,J){var F=[];for(var G=0,H=E.length;G<H;G++){var I=J(E[G],G);if(I!=null){F[F.length]=I}}return F.concat.apply([],F)}});var C=navigator.userAgent.toLowerCase();o.browser={version:(C.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1],safari:/webkit/.test(C),opera:/opera/.test(C),msie:/msie/.test(C)&&!/opera/.test(C),mozilla:/mozilla/.test(C)&&!/(compatible|webkit)/.test(C)};o.each({parent:function(E){return E.parentNode},parents:function(E){return o.dir(E,"parentNode")},next:function(E){return o.nth(E,2,"nextSibling")},prev:function(E){return o.nth(E,2,"previousSibling")},nextAll:function(E){return o.dir(E,"nextSibling")},prevAll:function(E){return o.dir(E,"previousSibling")},siblings:function(E){return o.sibling(E.parentNode.firstChild,E)},children:function(E){return o.sibling(E.firstChild)},contents:function(E){return o.nodeName(E,"iframe")?E.contentDocument||E.contentWindow.document:o.makeArray(E.childNodes)}},function(E,F){o.fn[E]=function(G){var H=o.map(this,F);if(G&&typeof G=="string"){H=o.multiFilter(G,H)}return this.pushStack(o.unique(H),E,G)}});o.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(E,F){o.fn[E]=function(G){var J=[],L=o(G);for(var K=0,H=L.length;K<H;K++){var I=(K>0?this.clone(true):this).get();o.fn[F].apply(o(L[K]),I);J=J.concat(I)}return this.pushStack(J,E,G)}});o.each({removeAttr:function(E){o.attr(this,E,"");if(this.nodeType==1){this.removeAttribute(E)}},addClass:function(E){o.className.add(this,E)},removeClass:function(E){o.className.remove(this,E)},toggleClass:function(F,E){if(typeof E!=="boolean"){E=!o.className.has(this,F)}o.className[E?"add":"remove"](this,F)},remove:function(E){if(!E||o.filter(E,[this]).length){o("*",this).add([this]).each(function(){o.event.remove(this);o.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){o(this).children().remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(E,F){o.fn[E]=function(){return this.each(F,arguments)}});function j(E,F){return E[0]&&parseInt(o.curCSS(E[0],F,true),10)||0}var h="jQuery"+e(),v=0,A={};o.extend({cache:{},data:function(F,E,G){F=F==l?A:F;var H=F[h];if(!H){H=F[h]=++v}if(E&&!o.cache[H]){o.cache[H]={}}if(G!==g){o.cache[H][E]=G}return E?o.cache[H][E]:H},removeData:function(F,E){F=F==l?A:F;var H=F[h];if(E){if(o.cache[H]){delete o.cache[H][E];E="";for(E in o.cache[H]){break}if(!E){o.removeData(F)}}}else{try{delete F[h]}catch(G){if(F.removeAttribute){F.removeAttribute(h)}}delete o.cache[H]}},queue:function(F,E,H){if(F){E=(E||"fx")+"queue";var G=o.data(F,E);if(!G||o.isArray(H)){G=o.data(F,E,o.makeArray(H))}else{if(H){G.push(H)}}}return G},dequeue:function(H,G){var E=o.queue(H,G),F=E.shift();if(!G||G==="fx"){F=E[0]}if(F!==g){F.call(H)}}});o.fn.extend({data:function(E,G){var H=E.split(".");H[1]=H[1]?"."+H[1]:"";if(G===g){var F=this.triggerHandler("getData"+H[1]+"!",[H[0]]);if(F===g&&this.length){F=o.data(this[0],E)}return F===g&&H[1]?this.data(H[0]):F}else{return this.trigger("setData"+H[1]+"!",[H[0],G]).each(function(){o.data(this,E,G)})}},removeData:function(E){return this.each(function(){o.removeData(this,E)})},queue:function(E,F){if(typeof E!=="string"){F=E;E="fx"}if(F===g){return o.queue(this[0],E)}return this.each(function(){var G=o.queue(this,E,F);if(E=="fx"&&G.length==1){G[0].call(this)}})},dequeue:function(E){return this.each(function(){o.dequeue(this,E)})}});
+/*
+ * Sizzle CSS Selector Engine - v0.9.3
+ * Copyright 2009, The Dojo Foundation
+ * Released under the MIT, BSD, and GPL Licenses.
+ * More information: http://sizzlejs.com/
+ */
+(function(){var R=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,L=0,H=Object.prototype.toString;var F=function(Y,U,ab,ac){ab=ab||[];U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!Y||typeof Y!=="string"){return ab}var Z=[],W,af,ai,T,ad,V,X=true;R.lastIndex=0;while((W=R.exec(Y))!==null){Z.push(W[1]);if(W[2]){V=RegExp.rightContext;break}}if(Z.length>1&&M.exec(Y)){if(Z.length===2&&I.relative[Z[0]]){af=J(Z[0]+Z[1],U)}else{af=I.relative[Z[0]]?[U]:F(Z.shift(),U);while(Z.length){Y=Z.shift();if(I.relative[Y]){Y+=Z.shift()}af=J(Y,af)}}}else{var ae=ac?{expr:Z.pop(),set:E(ac)}:F.find(Z.pop(),Z.length===1&&U.parentNode?U.parentNode:U,Q(U));af=F.filter(ae.expr,ae.set);if(Z.length>0){ai=E(af)}else{X=false}while(Z.length){var ah=Z.pop(),ag=ah;if(!I.relative[ah]){ah=""}else{ag=Z.pop()}if(ag==null){ag=U}I.relative[ah](ai,ag,Q(U))}}if(!ai){ai=af}if(!ai){throw"Syntax error, unrecognized expression: "+(ah||Y)}if(H.call(ai)==="[object Array]"){if(!X){ab.push.apply(ab,ai)}else{if(U.nodeType===1){for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&(ai[aa]===true||ai[aa].nodeType===1&&K(U,ai[aa]))){ab.push(af[aa])}}}else{for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&ai[aa].nodeType===1){ab.push(af[aa])}}}}}else{E(ai,ab)}if(V){F(V,U,ab,ac);if(G){hasDuplicate=false;ab.sort(G);if(hasDuplicate){for(var aa=1;aa<ab.length;aa++){if(ab[aa]===ab[aa-1]){ab.splice(aa--,1)}}}}}return ab};F.matches=function(T,U){return F(T,null,null,U)};F.find=function(aa,T,ab){var Z,X;if(!aa){return[]}for(var W=0,V=I.order.length;W<V;W++){var Y=I.order[W],X;if((X=I.match[Y].exec(aa))){var U=RegExp.leftContext;if(U.substr(U.length-1)!=="\\"){X[1]=(X[1]||"").replace(/\\/g,"");Z=I.find[Y](X,T,ab);if(Z!=null){aa=aa.replace(I.match[Y],"");break}}}}if(!Z){Z=T.getElementsByTagName("*")}return{set:Z,expr:aa}};F.filter=function(ad,ac,ag,W){var V=ad,ai=[],aa=ac,Y,T,Z=ac&&ac[0]&&Q(ac[0]);while(ad&&ac.length){for(var ab in I.filter){if((Y=I.match[ab].exec(ad))!=null){var U=I.filter[ab],ah,af;T=false;if(aa==ai){ai=[]}if(I.preFilter[ab]){Y=I.preFilter[ab](Y,aa,ag,ai,W,Z);if(!Y){T=ah=true}else{if(Y===true){continue}}}if(Y){for(var X=0;(af=aa[X])!=null;X++){if(af){ah=U(af,Y,X,aa);var ae=W^!!ah;if(ag&&ah!=null){if(ae){T=true}else{aa[X]=false}}else{if(ae){ai.push(af);T=true}}}}}if(ah!==g){if(!ag){aa=ai}ad=ad.replace(I.match[ab],"");if(!T){return[]}break}}}if(ad==V){if(T==null){throw"Syntax error, unrecognized expression: "+ad}else{break}}V=ad}return aa};var I=F.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(T){return T.getAttribute("href")}},relative:{"+":function(aa,T,Z){var X=typeof T==="string",ab=X&&!/\W/.test(T),Y=X&&!ab;if(ab&&!Z){T=T.toUpperCase()}for(var W=0,V=aa.length,U;W<V;W++){if((U=aa[W])){while((U=U.previousSibling)&&U.nodeType!==1){}aa[W]=Y||U&&U.nodeName===T?U||false:U===T}}if(Y){F.filter(T,aa,true)}},">":function(Z,U,aa){var X=typeof U==="string";if(X&&!/\W/.test(U)){U=aa?U:U.toUpperCase();for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){var W=Y.parentNode;Z[V]=W.nodeName===U?W:false}}}else{for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){Z[V]=X?Y.parentNode:Y.parentNode===U}}if(X){F.filter(U,Z,true)}}},"":function(W,U,Y){var V=L++,T=S;if(!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("parentNode",U,V,W,X,Y)},"~":function(W,U,Y){var V=L++,T=S;if(typeof U==="string"&&!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("previousSibling",U,V,W,X,Y)}},find:{ID:function(U,V,W){if(typeof V.getElementById!=="undefined"&&!W){var T=V.getElementById(U[1]);return T?[T]:[]}},NAME:function(V,Y,Z){if(typeof Y.getElementsByName!=="undefined"){var U=[],X=Y.getElementsByName(V[1]);for(var W=0,T=X.length;W<T;W++){if(X[W].getAttribute("name")===V[1]){U.push(X[W])}}return U.length===0?null:U}},TAG:function(T,U){return U.getElementsByTagName(T[1])}},preFilter:{CLASS:function(W,U,V,T,Z,aa){W=" "+W[1].replace(/\\/g,"")+" ";if(aa){return W}for(var X=0,Y;(Y=U[X])!=null;X++){if(Y){if(Z^(Y.className&&(" "+Y.className+" ").indexOf(W)>=0)){if(!V){T.push(Y)}}else{if(V){U[X]=false}}}}return false},ID:function(T){return T[1].replace(/\\/g,"")},TAG:function(U,T){for(var V=0;T[V]===false;V++){}return T[V]&&Q(T[V])?U[1]:U[1].toUpperCase()},CHILD:function(T){if(T[1]=="nth"){var U=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(T[2]=="even"&&"2n"||T[2]=="odd"&&"2n+1"||!/\D/.test(T[2])&&"0n+"+T[2]||T[2]);T[2]=(U[1]+(U[2]||1))-0;T[3]=U[3]-0}T[0]=L++;return T},ATTR:function(X,U,V,T,Y,Z){var W=X[1].replace(/\\/g,"");if(!Z&&I.attrMap[W]){X[1]=I.attrMap[W]}if(X[2]==="~="){X[4]=" "+X[4]+" "}return X},PSEUDO:function(X,U,V,T,Y){if(X[1]==="not"){if(X[3].match(R).length>1||/^\w/.test(X[3])){X[3]=F(X[3],null,null,U)}else{var W=F.filter(X[3],U,V,true^Y);if(!V){T.push.apply(T,W)}return false}}else{if(I.match.POS.test(X[0])||I.match.CHILD.test(X[0])){return true}}return X},POS:function(T){T.unshift(true);return T}},filters:{enabled:function(T){return T.disabled===false&&T.type!=="hidden"},disabled:function(T){return T.disabled===true},checked:function(T){return T.checked===true},selected:function(T){T.parentNode.selectedIndex;return T.selected===true},parent:function(T){return !!T.firstChild},empty:function(T){return !T.firstChild},has:function(V,U,T){return !!F(T[3],V).length},header:function(T){return/h\d/i.test(T.nodeName)},text:function(T){return"text"===T.type},radio:function(T){return"radio"===T.type},checkbox:function(T){return"checkbox"===T.type},file:function(T){return"file"===T.type},password:function(T){return"password"===T.type},submit:function(T){return"submit"===T.type},image:function(T){return"image"===T.type},reset:function(T){return"reset"===T.type},button:function(T){return"button"===T.type||T.nodeName.toUpperCase()==="BUTTON"},input:function(T){return/input|select|textarea|button/i.test(T.nodeName)}},setFilters:{first:function(U,T){return T===0},last:function(V,U,T,W){return U===W.length-1},even:function(U,T){return T%2===0},odd:function(U,T){return T%2===1},lt:function(V,U,T){return U<T[3]-0},gt:function(V,U,T){return U>T[3]-0},nth:function(V,U,T){return T[3]-0==U},eq:function(V,U,T){return T[3]-0==U}},filter:{PSEUDO:function(Z,V,W,aa){var U=V[1],X=I.filters[U];if(X){return X(Z,W,V,aa)}else{if(U==="contains"){return(Z.textContent||Z.innerText||"").indexOf(V[3])>=0}else{if(U==="not"){var Y=V[3];for(var W=0,T=Y.length;W<T;W++){if(Y[W]===Z){return false}}return true}}}},CHILD:function(T,W){var Z=W[1],U=T;switch(Z){case"only":case"first":while(U=U.previousSibling){if(U.nodeType===1){return false}}if(Z=="first"){return true}U=T;case"last":while(U=U.nextSibling){if(U.nodeType===1){return false}}return true;case"nth":var V=W[2],ac=W[3];if(V==1&&ac==0){return true}var Y=W[0],ab=T.parentNode;if(ab&&(ab.sizcache!==Y||!T.nodeIndex)){var X=0;for(U=ab.firstChild;U;U=U.nextSibling){if(U.nodeType===1){U.nodeIndex=++X}}ab.sizcache=Y}var aa=T.nodeIndex-ac;if(V==0){return aa==0}else{return(aa%V==0&&aa/V>=0)}}},ID:function(U,T){return U.nodeType===1&&U.getAttribute("id")===T},TAG:function(U,T){return(T==="*"&&U.nodeType===1)||U.nodeName===T},CLASS:function(U,T){return(" "+(U.className||U.getAttribute("class"))+" ").indexOf(T)>-1},ATTR:function(Y,W){var V=W[1],T=I.attrHandle[V]?I.attrHandle[V](Y):Y[V]!=null?Y[V]:Y.getAttribute(V),Z=T+"",X=W[2],U=W[4];return T==null?X==="!=":X==="="?Z===U:X==="*="?Z.indexOf(U)>=0:X==="~="?(" "+Z+" ").indexOf(U)>=0:!U?Z&&T!==false:X==="!="?Z!=U:X==="^="?Z.indexOf(U)===0:X==="$="?Z.substr(Z.length-U.length)===U:X==="|="?Z===U||Z.substr(0,U.length+1)===U+"-":false},POS:function(X,U,V,Y){var T=U[2],W=I.setFilters[T];if(W){return W(X,V,U,Y)}}}};var M=I.match.POS;for(var O in I.match){I.match[O]=RegExp(I.match[O].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var E=function(U,T){U=Array.prototype.slice.call(U);if(T){T.push.apply(T,U);return T}return U};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(N){E=function(X,W){var U=W||[];if(H.call(X)==="[object Array]"){Array.prototype.push.apply(U,X)}else{if(typeof X.length==="number"){for(var V=0,T=X.length;V<T;V++){U.push(X[V])}}else{for(var V=0;X[V];V++){U.push(X[V])}}}return U}}var G;if(document.documentElement.compareDocumentPosition){G=function(U,T){var V=U.compareDocumentPosition(T)&4?-1:U===T?0:1;if(V===0){hasDuplicate=true}return V}}else{if("sourceIndex" in document.documentElement){G=function(U,T){var V=U.sourceIndex-T.sourceIndex;if(V===0){hasDuplicate=true}return V}}else{if(document.createRange){G=function(W,U){var V=W.ownerDocument.createRange(),T=U.ownerDocument.createRange();V.selectNode(W);V.collapse(true);T.selectNode(U);T.collapse(true);var X=V.compareBoundaryPoints(Range.START_TO_END,T);if(X===0){hasDuplicate=true}return X}}}}(function(){var U=document.createElement("form"),V="script"+(new Date).getTime();U.innerHTML="<input name='"+V+"'/>";var T=document.documentElement;T.insertBefore(U,T.firstChild);if(!!document.getElementById(V)){I.find.ID=function(X,Y,Z){if(typeof Y.getElementById!=="undefined"&&!Z){var W=Y.getElementById(X[1]);return W?W.id===X[1]||typeof W.getAttributeNode!=="undefined"&&W.getAttributeNode("id").nodeValue===X[1]?[W]:g:[]}};I.filter.ID=function(Y,W){var X=typeof Y.getAttributeNode!=="undefined"&&Y.getAttributeNode("id");return Y.nodeType===1&&X&&X.nodeValue===W}}T.removeChild(U)})();(function(){var T=document.createElement("div");T.appendChild(document.createComment(""));if(T.getElementsByTagName("*").length>0){I.find.TAG=function(U,Y){var X=Y.getElementsByTagName(U[1]);if(U[1]==="*"){var W=[];for(var V=0;X[V];V++){if(X[V].nodeType===1){W.push(X[V])}}X=W}return X}}T.innerHTML="<a href='#'></a>";if(T.firstChild&&typeof T.firstChild.getAttribute!=="undefined"&&T.firstChild.getAttribute("href")!=="#"){I.attrHandle.href=function(U){return U.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var T=F,U=document.createElement("div");U.innerHTML="<p class='TEST'></p>";if(U.querySelectorAll&&U.querySelectorAll(".TEST").length===0){return}F=function(Y,X,V,W){X=X||document;if(!W&&X.nodeType===9&&!Q(X)){try{return E(X.querySelectorAll(Y),V)}catch(Z){}}return T(Y,X,V,W)};F.find=T.find;F.filter=T.filter;F.selectors=T.selectors;F.matches=T.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var T=document.createElement("div");T.innerHTML="<div class='test e'></div><div class='test'></div>";if(T.getElementsByClassName("e").length===0){return}T.lastChild.className="e";if(T.getElementsByClassName("e").length===1){return}I.order.splice(1,0,"CLASS");I.find.CLASS=function(U,V,W){if(typeof V.getElementsByClassName!=="undefined"&&!W){return V.getElementsByClassName(U[1])}}})()}function P(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1&&!ac){T.sizcache=Y;T.sizset=W}if(T.nodeName===Z){X=T;break}T=T[U]}ad[W]=X}}}function S(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1){if(!ac){T.sizcache=Y;T.sizset=W}if(typeof Z!=="string"){if(T===Z){X=true;break}}else{if(F.filter(Z,[T]).length>0){X=T;break}}}T=T[U]}ad[W]=X}}}var K=document.compareDocumentPosition?function(U,T){return U.compareDocumentPosition(T)&16}:function(U,T){return U!==T&&(U.contains?U.contains(T):true)};var Q=function(T){return T.nodeType===9&&T.documentElement.nodeName!=="HTML"||!!T.ownerDocument&&Q(T.ownerDocument)};var J=function(T,aa){var W=[],X="",Y,V=aa.nodeType?[aa]:aa;while((Y=I.match.PSEUDO.exec(T))){X+=Y[0];T=T.replace(I.match.PSEUDO,"")}T=I.relative[T]?T+"*":T;for(var Z=0,U=V.length;Z<U;Z++){F(T,V[Z],W)}return F.filter(X,W)};o.find=F;o.filter=F.filter;o.expr=F.selectors;o.expr[":"]=o.expr.filters;F.selectors.filters.hidden=function(T){return T.offsetWidth===0||T.offsetHeight===0};F.selectors.filters.visible=function(T){return T.offsetWidth>0||T.offsetHeight>0};F.selectors.filters.animated=function(T){return o.grep(o.timers,function(U){return T===U.elem}).length};o.multiFilter=function(V,T,U){if(U){V=":not("+V+")"}return F.matches(V,T)};o.dir=function(V,U){var T=[],W=V[U];while(W&&W!=document){if(W.nodeType==1){T.push(W)}W=W[U]}return T};o.nth=function(X,T,V,W){T=T||1;var U=0;for(;X;X=X[V]){if(X.nodeType==1&&++U==T){break}}return X};o.sibling=function(V,U){var T=[];for(;V;V=V.nextSibling){if(V.nodeType==1&&V!=U){T.push(V)}}return T};return;l.Sizzle=F})();o.event={add:function(I,F,H,K){if(I.nodeType==3||I.nodeType==8){return}if(I.setInterval&&I!=l){I=l}if(!H.guid){H.guid=this.guid++}if(K!==g){var G=H;H=this.proxy(G);H.data=K}var E=o.data(I,"events")||o.data(I,"events",{}),J=o.data(I,"handle")||o.data(I,"handle",function(){return typeof o!=="undefined"&&!o.event.triggered?o.event.handle.apply(arguments.callee.elem,arguments):g});J.elem=I;o.each(F.split(/\s+/),function(M,N){var O=N.split(".");N=O.shift();H.type=O.slice().sort().join(".");var L=E[N];if(o.event.specialAll[N]){o.event.specialAll[N].setup.call(I,K,O)}if(!L){L=E[N]={};if(!o.event.special[N]||o.event.special[N].setup.call(I,K,O)===false){if(I.addEventListener){I.addEventListener(N,J,false)}else{if(I.attachEvent){I.attachEvent("on"+N,J)}}}}L[H.guid]=H;o.event.global[N]=true});I=null},guid:1,global:{},remove:function(K,H,J){if(K.nodeType==3||K.nodeType==8){return}var G=o.data(K,"events"),F,E;if(G){if(H===g||(typeof H==="string"&&H.charAt(0)==".")){for(var I in G){this.remove(K,I+(H||""))}}else{if(H.type){J=H.handler;H=H.type}o.each(H.split(/\s+/),function(M,O){var Q=O.split(".");O=Q.shift();var N=RegExp("(^|\\.)"+Q.slice().sort().join(".*\\.")+"(\\.|$)");if(G[O]){if(J){delete G[O][J.guid]}else{for(var P in G[O]){if(N.test(G[O][P].type)){delete G[O][P]}}}if(o.event.specialAll[O]){o.event.specialAll[O].teardown.call(K,Q)}for(F in G[O]){break}if(!F){if(!o.event.special[O]||o.event.special[O].teardown.call(K,Q)===false){if(K.removeEventListener){K.removeEventListener(O,o.data(K,"handle"),false)}else{if(K.detachEvent){K.detachEvent("on"+O,o.data(K,"handle"))}}}F=null;delete G[O]}}})}for(F in G){break}if(!F){var L=o.data(K,"handle");if(L){L.elem=null}o.removeData(K,"events");o.removeData(K,"handle")}}},trigger:function(I,K,H,E){var G=I.type||I;if(!E){I=typeof I==="object"?I[h]?I:o.extend(o.Event(G),I):o.Event(G);if(G.indexOf("!")>=0){I.type=G=G.slice(0,-1);I.exclusive=true}if(!H){I.stopPropagation();if(this.global[G]){o.each(o.cache,function(){if(this.events&&this.events[G]){o.event.trigger(I,K,this.handle.elem)}})}}if(!H||H.nodeType==3||H.nodeType==8){return g}I.result=g;I.target=H;K=o.makeArray(K);K.unshift(I)}I.currentTarget=H;var J=o.data(H,"handle");if(J){J.apply(H,K)}if((!H[G]||(o.nodeName(H,"a")&&G=="click"))&&H["on"+G]&&H["on"+G].apply(H,K)===false){I.result=false}if(!E&&H[G]&&!I.isDefaultPrevented()&&!(o.nodeName(H,"a")&&G=="click")){this.triggered=true;try{H[G]()}catch(L){}}this.triggered=false;if(!I.isPropagationStopped()){var F=H.parentNode||H.ownerDocument;if(F){o.event.trigger(I,K,F,true)}}},handle:function(K){var J,E;K=arguments[0]=o.event.fix(K||l.event);K.currentTarget=this;var L=K.type.split(".");K.type=L.shift();J=!L.length&&!K.exclusive;var I=RegExp("(^|\\.)"+L.slice().sort().join(".*\\.")+"(\\.|$)");E=(o.data(this,"events")||{})[K.type];for(var G in E){var H=E[G];if(J||I.test(H.type)){K.handler=H;K.data=H.data;var F=H.apply(this,arguments);if(F!==g){K.result=F;if(F===false){K.preventDefault();K.stopPropagation()}}if(K.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(H){if(H[h]){return H}var F=H;H=o.Event(F);for(var G=this.props.length,J;G;){J=this.props[--G];H[J]=F[J]}if(!H.target){H.target=H.srcElement||document}if(H.target.nodeType==3){H.target=H.target.parentNode}if(!H.relatedTarget&&H.fromElement){H.relatedTarget=H.fromElement==H.target?H.toElement:H.fromElement}if(H.pageX==null&&H.clientX!=null){var I=document.documentElement,E=document.body;H.pageX=H.clientX+(I&&I.scrollLeft||E&&E.scrollLeft||0)-(I.clientLeft||0);H.pageY=H.clientY+(I&&I.scrollTop||E&&E.scrollTop||0)-(I.clientTop||0)}if(!H.which&&((H.charCode||H.charCode===0)?H.charCode:H.keyCode)){H.which=H.charCode||H.keyCode}if(!H.metaKey&&H.ctrlKey){H.metaKey=H.ctrlKey}if(!H.which&&H.button){H.which=(H.button&1?1:(H.button&2?3:(H.button&4?2:0)))}return H},proxy:function(F,E){E=E||function(){return F.apply(this,arguments)};E.guid=F.guid=F.guid||E.guid||this.guid++;return E},special:{ready:{setup:B,teardown:function(){}}},specialAll:{live:{setup:function(E,F){o.event.add(this,F[0],c)},teardown:function(G){if(G.length){var E=0,F=RegExp("(^|\\.)"+G[0]+"(\\.|$)");o.each((o.data(this,"events").live||{}),function(){if(F.test(this.type)){E++}});if(E<1){o.event.remove(this,G[0],c)}}}}}};o.Event=function(E){if(!this.preventDefault){return new o.Event(E)}if(E&&E.type){this.originalEvent=E;this.type=E.type}else{this.type=E}this.timeStamp=e();this[h]=true};function k(){return false}function u(){return true}o.Event.prototype={preventDefault:function(){this.isDefaultPrevented=u;var E=this.originalEvent;if(!E){return}if(E.preventDefault){E.preventDefault()}E.returnValue=false},stopPropagation:function(){this.isPropagationStopped=u;var E=this.originalEvent;if(!E){return}if(E.stopPropagation){E.stopPropagation()}E.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=u;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(F){var E=F.relatedTarget;while(E&&E!=this){try{E=E.parentNode}catch(G){E=this}}if(E!=this){F.type=F.data;o.event.handle.apply(this,arguments)}};o.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(F,E){o.event.special[E]={setup:function(){o.event.add(this,F,a,E)},teardown:function(){o.event.remove(this,F,a)}}});o.fn.extend({bind:function(F,G,E){return F=="unload"?this.one(F,G,E):this.each(function(){o.event.add(this,F,E||G,E&&G)})},one:function(G,H,F){var E=o.event.proxy(F||H,function(I){o(this).unbind(I,E);return(F||H).apply(this,arguments)});return this.each(function(){o.event.add(this,G,E,F&&H)})},unbind:function(F,E){return this.each(function(){o.event.remove(this,F,E)})},trigger:function(E,F){return this.each(function(){o.event.trigger(E,F,this)})},triggerHandler:function(E,G){if(this[0]){var F=o.Event(E);F.preventDefault();F.stopPropagation();o.event.trigger(F,G,this[0]);return F.result}},toggle:function(G){var E=arguments,F=1;while(F<E.length){o.event.proxy(G,E[F++])}return this.click(o.event.proxy(G,function(H){this.lastToggle=(this.lastToggle||0)%F;H.preventDefault();return E[this.lastToggle++].apply(this,arguments)||false}))},hover:function(E,F){return this.mouseenter(E).mouseleave(F)},ready:function(E){B();if(o.isReady){E.call(document,o)}else{o.readyList.push(E)}return this},live:function(G,F){var E=o.event.proxy(F);E.guid+=this.selector+G;o(document).bind(i(G,this.selector),this.selector,E);return this},die:function(F,E){o(document).unbind(i(F,this.selector),E?{guid:E.guid+this.selector+F}:null);return this}});function c(H){var E=RegExp("(^|\\.)"+H.type+"(\\.|$)"),G=true,F=[];o.each(o.data(this,"events").live||[],function(I,J){if(E.test(J.type)){var K=o(H.target).closest(J.data)[0];if(K){F.push({elem:K,fn:J})}}});F.sort(function(J,I){return o.data(J.elem,"closest")-o.data(I.elem,"closest")});o.each(F,function(){if(this.fn.call(this.elem,H,this.fn.data)===false){return(G=false)}});return G}function i(F,E){return["live",F,E.replace(/\./g,"`").replace(/ /g,"|")].join(".")}o.extend({isReady:false,readyList:[],ready:function(){if(!o.isReady){o.isReady=true;if(o.readyList){o.each(o.readyList,function(){this.call(document,o)});o.readyList=null}o(document).triggerHandler("ready")}}});var x=false;function B(){if(x){return}x=true;if(document.addEventListener){document.addEventListener("DOMContentLoaded",function(){document.removeEventListener("DOMContentLoaded",arguments.callee,false);o.ready()},false)}else{if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);o.ready()}});if(document.documentElement.doScroll&&l==l.top){(function(){if(o.isReady){return}try{document.documentElement.doScroll("left")}catch(E){setTimeout(arguments.callee,0);return}o.ready()})()}}}o.event.add(l,"load",o.ready)}o.each(("blur,focus,load,resize,scroll,unload,click,dblclick,mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave,change,select,submit,keydown,keypress,keyup,error").split(","),function(F,E){o.fn[E]=function(G){return G?this.bind(E,G):this.trigger(E)}});o(l).bind("unload",function(){for(var E in o.cache){if(E!=1&&o.cache[E].handle){o.event.remove(o.cache[E].handle.elem)}}});(function(){o.support={};var F=document.documentElement,G=document.createElement("script"),K=document.createElement("div"),J="script"+(new Date).getTime();K.style.display="none";K.innerHTML=' <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param/></object>';var H=K.getElementsByTagName("*"),E=K.getElementsByTagName("a")[0];if(!H||!H.length||!E){return}o.support={leadingWhitespace:K.firstChild.nodeType==3,tbody:!K.getElementsByTagName("tbody").length,objectAll:!!K.getElementsByTagName("object")[0].getElementsByTagName("*").length,htmlSerialize:!!K.getElementsByTagName("link").length,style:/red/.test(E.getAttribute("style")),hrefNormalized:E.getAttribute("href")==="/a",opacity:E.style.opacity==="0.5",cssFloat:!!E.style.cssFloat,scriptEval:false,noCloneEvent:true,boxModel:null};G.type="text/javascript";try{G.appendChild(document.createTextNode("window."+J+"=1;"))}catch(I){}F.insertBefore(G,F.firstChild);if(l[J]){o.support.scriptEval=true;delete l[J]}F.removeChild(G);if(K.attachEvent&&K.fireEvent){K.attachEvent("onclick",function(){o.support.noCloneEvent=false;K.detachEvent("onclick",arguments.callee)});K.cloneNode(true).fireEvent("onclick")}o(function(){var L=document.createElement("div");L.style.width=L.style.paddingLeft="1px";document.body.appendChild(L);o.boxModel=o.support.boxModel=L.offsetWidth===2;document.body.removeChild(L).style.display="none"})})();var w=o.support.cssFloat?"cssFloat":"styleFloat";o.props={"for":"htmlFor","class":"className","float":w,cssFloat:w,styleFloat:w,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",tabindex:"tabIndex"};o.fn.extend({_load:o.fn.load,load:function(G,J,K){if(typeof G!=="string"){return this._load(G)}var I=G.indexOf(" ");if(I>=0){var E=G.slice(I,G.length);G=G.slice(0,I)}var H="GET";if(J){if(o.isFunction(J)){K=J;J=null}else{if(typeof J==="object"){J=o.param(J);H="POST"}}}var F=this;o.ajax({url:G,type:H,dataType:"html",data:J,complete:function(M,L){if(L=="success"||L=="notmodified"){F.html(E?o("<div/>").append(M.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(E):M.responseText)}if(K){F.each(K,[M.responseText,L,M])}}});return this},serialize:function(){return o.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?o.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type))}).map(function(E,F){var G=o(this).val();return G==null?null:o.isArray(G)?o.map(G,function(I,H){return{name:F.name,value:I}}):{name:F.name,value:G}}).get()}});o.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(E,F){o.fn[F]=function(G){return this.bind(F,G)}});var r=e();o.extend({get:function(E,G,H,F){if(o.isFunction(G)){H=G;G=null}return o.ajax({type:"GET",url:E,data:G,success:H,dataType:F})},getScript:function(E,F){return o.get(E,null,F,"script")},getJSON:function(E,F,G){return o.get(E,F,G,"json")},post:function(E,G,H,F){if(o.isFunction(G)){H=G;G={}}return o.ajax({type:"POST",url:E,data:G,success:H,dataType:F})},ajaxSetup:function(E){o.extend(o.ajaxSettings,E)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return l.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(M){M=o.extend(true,M,o.extend(true,{},o.ajaxSettings,M));var W,F=/=\?(&|$)/g,R,V,G=M.type.toUpperCase();if(M.data&&M.processData&&typeof M.data!=="string"){M.data=o.param(M.data)}if(M.dataType=="jsonp"){if(G=="GET"){if(!M.url.match(F)){M.url+=(M.url.match(/\?/)?"&":"?")+(M.jsonp||"callback")+"=?"}}else{if(!M.data||!M.data.match(F)){M.data=(M.data?M.data+"&":"")+(M.jsonp||"callback")+"=?"}}M.dataType="json"}if(M.dataType=="json"&&(M.data&&M.data.match(F)||M.url.match(F))){W="jsonp"+r++;if(M.data){M.data=(M.data+"").replace(F,"="+W+"$1")}M.url=M.url.replace(F,"="+W+"$1");M.dataType="script";l[W]=function(X){V=X;I();L();l[W]=g;try{delete l[W]}catch(Y){}if(H){H.removeChild(T)}}}if(M.dataType=="script"&&M.cache==null){M.cache=false}if(M.cache===false&&G=="GET"){var E=e();var U=M.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+E+"$2");M.url=U+((U==M.url)?(M.url.match(/\?/)?"&":"?")+"_="+E:"")}if(M.data&&G=="GET"){M.url+=(M.url.match(/\?/)?"&":"?")+M.data;M.data=null}if(M.global&&!o.active++){o.event.trigger("ajaxStart")}var Q=/^(\w+:)?\/\/([^\/?#]+)/.exec(M.url);if(M.dataType=="script"&&G=="GET"&&Q&&(Q[1]&&Q[1]!=location.protocol||Q[2]!=location.host)){var H=document.getElementsByTagName("head")[0];var T=document.createElement("script");T.src=M.url;if(M.scriptCharset){T.charset=M.scriptCharset}if(!W){var O=false;T.onload=T.onreadystatechange=function(){if(!O&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){O=true;I();L();T.onload=T.onreadystatechange=null;H.removeChild(T)}}}H.appendChild(T);return g}var K=false;var J=M.xhr();if(M.username){J.open(G,M.url,M.async,M.username,M.password)}else{J.open(G,M.url,M.async)}try{if(M.data){J.setRequestHeader("Content-Type",M.contentType)}if(M.ifModified){J.setRequestHeader("If-Modified-Since",o.lastModified[M.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}J.setRequestHeader("X-Requested-With","XMLHttpRequest");J.setRequestHeader("Accept",M.dataType&&M.accepts[M.dataType]?M.accepts[M.dataType]+", */*":M.accepts._default)}catch(S){}if(M.beforeSend&&M.beforeSend(J,M)===false){if(M.global&&!--o.active){o.event.trigger("ajaxStop")}J.abort();return false}if(M.global){o.event.trigger("ajaxSend",[J,M])}var N=function(X){if(J.readyState==0){if(P){clearInterval(P);P=null;if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}}else{if(!K&&J&&(J.readyState==4||X=="timeout")){K=true;if(P){clearInterval(P);P=null}R=X=="timeout"?"timeout":!o.httpSuccess(J)?"error":M.ifModified&&o.httpNotModified(J,M.url)?"notmodified":"success";if(R=="success"){try{V=o.httpData(J,M.dataType,M)}catch(Z){R="parsererror"}}if(R=="success"){var Y;try{Y=J.getResponseHeader("Last-Modified")}catch(Z){}if(M.ifModified&&Y){o.lastModified[M.url]=Y}if(!W){I()}}else{o.handleError(M,J,R)}L();if(X){J.abort()}if(M.async){J=null}}}};if(M.async){var P=setInterval(N,13);if(M.timeout>0){setTimeout(function(){if(J&&!K){N("timeout")}},M.timeout)}}try{J.send(M.data)}catch(S){o.handleError(M,J,null,S)}if(!M.async){N()}function I(){if(M.success){M.success(V,R)}if(M.global){o.event.trigger("ajaxSuccess",[J,M])}}function L(){if(M.complete){M.complete(J,R)}if(M.global){o.event.trigger("ajaxComplete",[J,M])}if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}return J},handleError:function(F,H,E,G){if(F.error){F.error(H,E,G)}if(F.global){o.event.trigger("ajaxError",[H,F,G])}},active:0,httpSuccess:function(F){try{return !F.status&&location.protocol=="file:"||(F.status>=200&&F.status<300)||F.status==304||F.status==1223}catch(E){}return false},httpNotModified:function(G,E){try{var H=G.getResponseHeader("Last-Modified");return G.status==304||H==o.lastModified[E]}catch(F){}return false},httpData:function(J,H,G){var F=J.getResponseHeader("content-type"),E=H=="xml"||!H&&F&&F.indexOf("xml")>=0,I=E?J.responseXML:J.responseText;if(E&&I.documentElement.tagName=="parsererror"){throw"parsererror"}if(G&&G.dataFilter){I=G.dataFilter(I,H)}if(typeof I==="string"){if(H=="script"){o.globalEval(I)}if(H=="json"){I=l["eval"]("("+I+")")}}return I},param:function(E){var G=[];function H(I,J){G[G.length]=encodeURIComponent(I)+"="+encodeURIComponent(J)}if(o.isArray(E)||E.jquery){o.each(E,function(){H(this.name,this.value)})}else{for(var F in E){if(o.isArray(E[F])){o.each(E[F],function(){H(F,this)})}else{H(F,o.isFunction(E[F])?E[F]():E[F])}}}return G.join("&").replace(/%20/g,"+")}});var m={},n,d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function t(F,E){var G={};o.each(d.concat.apply([],d.slice(0,E)),function(){G[this]=F});return G}o.fn.extend({show:function(J,L){if(J){return this.animate(t("show",3),J,L)}else{for(var H=0,F=this.length;H<F;H++){var E=o.data(this[H],"olddisplay");this[H].style.display=E||"";if(o.css(this[H],"display")==="none"){var G=this[H].tagName,K;if(m[G]){K=m[G]}else{var I=o("<"+G+" />").appendTo("body");K=I.css("display");if(K==="none"){K="block"}I.remove();m[G]=K}o.data(this[H],"olddisplay",K)}}for(var H=0,F=this.length;H<F;H++){this[H].style.display=o.data(this[H],"olddisplay")||""}return this}},hide:function(H,I){if(H){return this.animate(t("hide",3),H,I)}else{for(var G=0,F=this.length;G<F;G++){var E=o.data(this[G],"olddisplay");if(!E&&E!=="none"){o.data(this[G],"olddisplay",o.css(this[G],"display"))}}for(var G=0,F=this.length;G<F;G++){this[G].style.display="none"}return this}},_toggle:o.fn.toggle,toggle:function(G,F){var E=typeof G==="boolean";return o.isFunction(G)&&o.isFunction(F)?this._toggle.apply(this,arguments):G==null||E?this.each(function(){var H=E?G:o(this).is(":hidden");o(this)[H?"show":"hide"]()}):this.animate(t("toggle",3),G,F)},fadeTo:function(E,G,F){return this.animate({opacity:G},E,F)},animate:function(I,F,H,G){var E=o.speed(F,H,G);return this[E.queue===false?"each":"queue"](function(){var K=o.extend({},E),M,L=this.nodeType==1&&o(this).is(":hidden"),J=this;for(M in I){if(I[M]=="hide"&&L||I[M]=="show"&&!L){return K.complete.call(this)}if((M=="height"||M=="width")&&this.style){K.display=o.css(this,"display");K.overflow=this.style.overflow}}if(K.overflow!=null){this.style.overflow="hidden"}K.curAnim=o.extend({},I);o.each(I,function(O,S){var R=new o.fx(J,K,O);if(/toggle|show|hide/.test(S)){R[S=="toggle"?L?"show":"hide":S](I)}else{var Q=S.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),T=R.cur(true)||0;if(Q){var N=parseFloat(Q[2]),P=Q[3]||"px";if(P!="px"){J.style[O]=(N||1)+P;T=((N||1)/R.cur(true))*T;J.style[O]=T+P}if(Q[1]){N=((Q[1]=="-="?-1:1)*N)+T}R.custom(T,N,P)}else{R.custom(T,S,"")}}});return true})},stop:function(F,E){var G=o.timers;if(F){this.queue([])}this.each(function(){for(var H=G.length-1;H>=0;H--){if(G[H].elem==this){if(E){G[H](true)}G.splice(H,1)}}});if(!E){this.dequeue()}return this}});o.each({slideDown:t("show",1),slideUp:t("hide",1),slideToggle:t("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(E,F){o.fn[E]=function(G,H){return this.animate(F,G,H)}});o.extend({speed:function(G,H,F){var E=typeof G==="object"?G:{complete:F||!F&&H||o.isFunction(G)&&G,duration:G,easing:F&&H||H&&!o.isFunction(H)&&H};E.duration=o.fx.off?0:typeof E.duration==="number"?E.duration:o.fx.speeds[E.duration]||o.fx.speeds._default;E.old=E.complete;E.complete=function(){if(E.queue!==false){o(this).dequeue()}if(o.isFunction(E.old)){E.old.call(this)}};return E},easing:{linear:function(G,H,E,F){return E+F*G},swing:function(G,H,E,F){return((-Math.cos(G*Math.PI)/2)+0.5)*F+E}},timers:[],fx:function(F,E,G){this.options=E;this.elem=F;this.prop=G;if(!E.orig){E.orig={}}}});o.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(o.fx.step[this.prop]||o.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(F){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var E=parseFloat(o.css(this.elem,this.prop,F));return E&&E>-10000?E:parseFloat(o.curCSS(this.elem,this.prop))||0},custom:function(I,H,G){this.startTime=e();this.start=I;this.end=H;this.unit=G||this.unit||"px";this.now=this.start;this.pos=this.state=0;var E=this;function F(J){return E.step(J)}F.elem=this.elem;if(F()&&o.timers.push(F)&&!n){n=setInterval(function(){var K=o.timers;for(var J=0;J<K.length;J++){if(!K[J]()){K.splice(J--,1)}}if(!K.length){clearInterval(n);n=g}},13)}},show:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.show=true;this.custom(this.prop=="width"||this.prop=="height"?1:0,this.cur());o(this.elem).show()},hide:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(H){var G=e();if(H||G>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var E=true;for(var F in this.options.curAnim){if(this.options.curAnim[F]!==true){E=false}}if(E){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(o.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){o(this.elem).hide()}if(this.options.hide||this.options.show){for(var I in this.options.curAnim){o.attr(this.elem.style,I,this.options.orig[I])}}this.options.complete.call(this.elem)}return false}else{var J=G-this.startTime;this.state=J/this.options.duration;this.pos=o.easing[this.options.easing||(o.easing.swing?"swing":"linear")](this.state,J,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};o.extend(o.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(E){o.attr(E.elem.style,"opacity",E.now)},_default:function(E){if(E.elem.style&&E.elem.style[E.prop]!=null){E.elem.style[E.prop]=E.now+E.unit}else{E.elem[E.prop]=E.now}}}});if(document.documentElement.getBoundingClientRect){o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}var G=this[0].getBoundingClientRect(),J=this[0].ownerDocument,F=J.body,E=J.documentElement,L=E.clientTop||F.clientTop||0,K=E.clientLeft||F.clientLeft||0,I=G.top+(self.pageYOffset||o.boxModel&&E.scrollTop||F.scrollTop)-L,H=G.left+(self.pageXOffset||o.boxModel&&E.scrollLeft||F.scrollLeft)-K;return{top:I,left:H}}}else{o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}o.offset.initialized||o.offset.initialize();var J=this[0],G=J.offsetParent,F=J,O=J.ownerDocument,M,H=O.documentElement,K=O.body,L=O.defaultView,E=L.getComputedStyle(J,null),N=J.offsetTop,I=J.offsetLeft;while((J=J.parentNode)&&J!==K&&J!==H){M=L.getComputedStyle(J,null);N-=J.scrollTop,I-=J.scrollLeft;if(J===G){N+=J.offsetTop,I+=J.offsetLeft;if(o.offset.doesNotAddBorder&&!(o.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(J.tagName))){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}F=G,G=J.offsetParent}if(o.offset.subtractsBorderForOverflowNotVisible&&M.overflow!=="visible"){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}E=M}if(E.position==="relative"||E.position==="static"){N+=K.offsetTop,I+=K.offsetLeft}if(E.position==="fixed"){N+=Math.max(H.scrollTop,K.scrollTop),I+=Math.max(H.scrollLeft,K.scrollLeft)}return{top:N,left:I}}}o.offset={initialize:function(){if(this.initialized){return}var L=document.body,F=document.createElement("div"),H,G,N,I,M,E,J=L.style.marginTop,K='<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>';M={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(E in M){F.style[E]=M[E]}F.innerHTML=K;L.insertBefore(F,L.firstChild);H=F.firstChild,G=H.firstChild,I=H.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(G.offsetTop!==5);this.doesAddBorderForTableAndCells=(I.offsetTop===5);H.style.overflow="hidden",H.style.position="relative";this.subtractsBorderForOverflowNotVisible=(G.offsetTop===-5);L.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(L.offsetTop===0);L.style.marginTop=J;L.removeChild(F);this.initialized=true},bodyOffset:function(E){o.offset.initialized||o.offset.initialize();var G=E.offsetTop,F=E.offsetLeft;if(o.offset.doesNotIncludeMarginInBodyOffset){G+=parseInt(o.curCSS(E,"marginTop",true),10)||0,F+=parseInt(o.curCSS(E,"marginLeft",true),10)||0}return{top:G,left:F}}};o.fn.extend({position:function(){var I=0,H=0,F;if(this[0]){var G=this.offsetParent(),J=this.offset(),E=/^body|html$/i.test(G[0].tagName)?{top:0,left:0}:G.offset();J.top-=j(this,"marginTop");J.left-=j(this,"marginLeft");E.top+=j(G,"borderTopWidth");E.left+=j(G,"borderLeftWidth");F={top:J.top-E.top,left:J.left-E.left}}return F},offsetParent:function(){var E=this[0].offsetParent||document.body;while(E&&(!/^body|html$/i.test(E.tagName)&&o.css(E,"position")=="static")){E=E.offsetParent}return o(E)}});o.each(["Left","Top"],function(F,E){var G="scroll"+E;o.fn[G]=function(H){if(!this[0]){return null}return H!==g?this.each(function(){this==l||this==document?l.scrollTo(!F?H:o(l).scrollLeft(),F?H:o(l).scrollTop()):this[G]=H}):this[0]==l||this[0]==document?self[F?"pageYOffset":"pageXOffset"]||o.boxModel&&document.documentElement[G]||document.body[G]:this[0][G]}});o.each(["Height","Width"],function(I,G){var E=I?"Left":"Top",H=I?"Right":"Bottom",F=G.toLowerCase();o.fn["inner"+G]=function(){return this[0]?o.css(this[0],F,false,"padding"):null};o.fn["outer"+G]=function(K){return this[0]?o.css(this[0],F,false,K?"margin":"border"):null};var J=G.toLowerCase();o.fn[J]=function(K){return this[0]==l?document.compatMode=="CSS1Compat"&&document.documentElement["client"+G]||document.body["client"+G]:this[0]==document?Math.max(document.documentElement["client"+G],document.body["scroll"+G],document.documentElement["scroll"+G],document.body["offset"+G],document.documentElement["offset"+G]):K===g?(this.length?o.css(this[0],J):null):this.css(J,typeof K==="string"?K:K+"px")}})})();
\ No newline at end of file diff --git a/javascript/functions.js b/js/functions.js index e520663..5db31a3 100755..100644 --- a/javascript/functions.js +++ b/js/functions.js @@ -1,55 +1,3 @@ -function fullscreen() {
- var a = document.getElementsByTagName("a");
- for (var i = 0; i < a.length;i++) {
- if (a[i].className.match("noeffect")) {
- }
- else {
- a[i].onclick = function () {
- window.location = this.getAttribute("href");
- return false;
- };
- }
- }
-}
-
-function hideURLbar() {
- window.scrollTo(0, 0.9);
-}
-
-
-window.onload = function () {
- fullscreen();
- hideURLbar();
-}
-function updateOrientation() {
- switch(window.orientation) {
- case 0:
- orient = "portrait";
- break;
- case -90:
- orient = "landscape";
- break;
- case 90:
- orient = "landscape";
- break;
- case 180:
- orient = "portrait";
- break;
- }
- document.body.setAttribute("orient", orient);
- window.scrollTo(0, 1);
-
-}
-function sendForm(formid) {
- var frm;
- frm = document.getElementById(formid);
- frm.submit();
-}
-
-function swapPic(session) {
- document.getElementById('videofeed').src = "ram/" +session +"/stream.m3u8";
-}
-
function openSelectDate(timer_year,timer_month,timer_day) {
var now = new Date();
if ( timer_year == null ) {
@@ -88,12 +36,13 @@ function openSelectDate(timer_year,timer_month,timer_day) { function done_date() {
var results = SpinningWheel.getSelectedValues();
- document.getElementById('layer_date').innerHTML = results.keys.join('-');
- document.timer.timer_date.value = results.keys.join('-');
-
+ document.getElementById('layer_date').innerHTML = results.values.join('-');
+ document.timer.timer_date.value = results.values.join('-');
+ $('a').removeClass('active');
}
function cancel_date() {
+$('a').removeClass('active');
}
function openSelectTime(layer,timer_hour,timer_minute) {
if ( timer_hour == null ) {
@@ -121,8 +70,8 @@ function openSelectTime(layer,timer_hour,timer_minute) { //SpinningWheel.addSlot({ separator: 'h' }, 'readonly shrink');
SpinningWheel.addSlot(minutes, '', now_minute);
- SpinningWheel.setCancelAction( function() {} );
- SpinningWheel.setDoneAction(function () {var results = SpinningWheel.getSelectedValues(); document.getElementById(layer).innerHTML = results.values.join('h');if ( layer == 'layer_starttime' ) { var forminput = 'timer_starttime'; } else { var forminput = 'timer_endtime'; }; eval ("document.timer." + forminput + ".value = results.values.join('')"); });
+ SpinningWheel.setCancelAction( function() { $('a').removeClass('active');} );
+ SpinningWheel.setDoneAction(function () {var results = SpinningWheel.getSelectedValues(); document.getElementById(layer).innerHTML = results.values.join('h');if ( layer == 'layer_starttime' ) { var forminput = 'timer_starttime'; } else { var forminput = 'timer_endtime'; }; eval ("document.timer." + forminput + ".value = results.values.join('')");$('a').removeClass('active'); });
SpinningWheel.open();
}
@@ -160,55 +109,4 @@ function str_pad (input, pad_length, pad_string, pad_type) { return input;
}
-function checkform()
-{
-
- if ( document.timer.timer_name.value=="" )
- {
- alert('Recording name is missing');
- return false;
- }
- else if ( document.timer.timer_chan.value=="" )
- {
- alert('Select a channel to record');
- return false;
-t
- }
- else if ( document.timer.timer_date.value=="" )
- {
- alert('Select recording date');
- return false;
- }
- else if ( document.timer.timer_starttime.value=="" )
- {
- alert('Select recording start time');
- return false;
- }
- else if ( document.timer.timer_endtime.value=="" )
- {
- alert('Select recording end time');
- return false;
- }
-
- return true;
-
-}
-
-function addplayer(path,name,track) {
-
-
- playercode= "<embed src='" + escape(track[0]) + "' width='0' height='0' autoplay='false' name='player' type='audio/mp3' loop='true' controller='false' ";
- for ( var i=1; i<track.length; i+=1 ){
- playercode += "qtnext" + i + "='<" + escape(track[i]) + ">' ";
-
- }
- playercode+= "></embed>";
- playmusic(path,name);
- document.getElementById('div_player').innerHTML = playercode;
-
-}
-function errorMsg(errmessage) {
- htmlmsg="<span class='graytitle'>Error</span><ul class='pageitem'><li class='textbox'><span class='header'>Error</span><p><strong>" + errmessage + "</strong></li></ul>";
- document.getElementById('content').innerHTML = htmlmsg;
-}
diff --git a/js/istreamdev.js b/js/istreamdev.js new file mode 100644 index 0000000..fc9247b --- /dev/null +++ b/js/istreamdev.js @@ -0,0 +1,676 @@ +//INIT
+jQT = new $.jQTouch({
+ icon: 'img/istreamdev.png',
+ addGlossToIcon: true,
+ useFastTouch: true,
+ startupScreen: 'img/startup.png',
+ statusBar: 'black',
+ iconIsGlossy: true,
+ fullscreen: true,
+ preloadImages: [
+ 'themes/jqt/img/chevron.png',
+ 'themes/jqt/img/back_button.png',
+ 'themes/jqt/img/back_button_clicked.png',
+ 'themes/jqt/img/button_clicked.png',
+ 'themes/jqt/img/button.png',
+ 'themes/jqt/img/button_clicked.png',
+ 'themes/jqt/img/loading.gif',
+ 'themes/jqt/img/toolbar.png',
+ 'themes/jqt/img/on_off.png',
+ 'img/loading.gif',
+ 'img/audio.png',
+ 'img/epg.png',
+ 'img/media.png',
+ 'img/record.png',
+ 'img/timers.png',
+ 'img/timeron.png',
+ 'img/timeroff.png',
+ 'img/timerrec.png',
+ 'img/tv.png',
+ 'img/video.png',
+ 'img/stream.png',
+ 'img/stream_clicked.png',
+ 'img/istreamdev.png',
+ 'img/mask.png',
+ 'img/nologoTV.png',
+ 'img/nologoREC.png',
+ 'img/nologoMEDIA.png',
+ 'img/rec.png',
+ 'img/rec_clicked.png',
+ 'img/sw-alpha.png',
+ 'img/sw-button-cancel.png',
+ 'img/sw-button-done.png',
+ 'img/sw-header.png',
+ 'img/sw-slot-border.png'
+ ]
+});
+
+// [GENERIC STUFF]
+// Global variable
+
+dataString = "action=getGlobals";
+$.getJSON("bin/backend.php",
+ dataString,
+ function(data){
+ streamdev_server = data.streamdev_server;
+ rec_path = data.rec_path;
+ video_path = data.video_path;
+ audio_path = data.audio_path;
+ }
+ );
+//streamdev_server = "http://127.0.0.1:3000/TS/";
+//rec_path = "/video/";
+//video_path = "/mnt/media/Video/";
+//audio_path = "/mnt/media/Music/";
+
+
+
+//Goto home
+$('#home_but').tap(function(event) {
+ event.preventDefault();
+ jQT.goTo('#home','flip');
+});
+
+//JSON query loading handler
+function json_start(button) {
+ $(button).addClass('active');
+ $('#loader').addClass("loader");
+
+}
+function json_complete(destination,effect) {
+ $('#loader').removeClass("loader");
+ $('a').removeClass('active');
+ jQT.goTo(destination,effect);
+}
+function hide_loader() {
+ $('#loader').removeClass("loader");
+ $('a').removeClass('active');
+}
+
+// [/GENERIC STUFF]
+
+// [HOME SECTION]
+//buttons
+$('#categories_but').tap(function(event) {
+ event.preventDefault();
+ json_start(this);
+ gen_categories();
+ return false;
+});
+
+$('#recording_but').tap(function(event) {
+ event.preventDefault();
+ json_start(this);
+ browser = 1;
+ gen_browser(rec_path,browser,"Recordings","rec");
+ return false;
+});
+
+$('#timers_but').tap(function(event) {
+ event.preventDefault();
+ json_start(this);
+ gen_timers();
+ return false;
+});
+
+$('#video_but').tap(function(event) {
+ event.preventDefault();
+ json_start(this);
+ browser = 1;
+ gen_browser(video_path,browser,"Videos","vid");
+ return false;
+});
+// [/HOME SECTION]
+
+// [TV SECTION]
+//buttons
+$('#categories ul#cat_menu a').tap(function(event) {
+ event.preventDefault();
+ json_start(this);
+ var category = $(this).html();
+ gen_channels(category);
+ return false;
+});
+
+$('#channels ul#chan_menu a').tap(function(event) {
+ event.preventDefault();
+ json_start(this);
+ var channame = $(this).find('span[class="name"]').html();
+ var channumber = $(this).find('small[class="counter"]').html();
+ gen_streamchannel(channame,channumber);
+ return false;
+});
+
+//Gen Categories
+function gen_categories() {
+ $("#cat_menu").html('');
+ var dataString = "action=getTvCat";
+ //Json call to get category array
+ $.getJSON("bin/backend.php",
+ dataString,
+ function(data){
+ $.each(data.categories, function(i,categories){
+ $("#cat_menu").append('<li class="arrow"><a class="cat_but" href="#">' + categories.name + '</a><small class="counter">' + categories.channels + '</small></li>');
+ });
+ json_complete('#categories','cube');
+ })
+}
+
+//Gen Channels
+function gen_channels(category) {
+ $("#chan_menu").html('');
+ var dataString = "action=getTvChan&cat=" + category;
+ //Json call to get category array
+ $.getJSON("bin/backend.php",
+ dataString,
+ function(data){
+ $.each(data.channel,function(i,channel){
+ $("#chan_menu").append('<li class="channellist"><a class="chan_but" href="#"><img src="logos/' + channel.name + '.png"/><small class="counter">' + channel.number + '</small><span class="name">' + channel.name + '</span><span class="comment">' + channel.now_title + '</span></a></li>');
+ });
+ json_complete('#channels','cube');
+ })
+}
+
+
+// [/TV SECTION]
+// [STREAM SECTION]
+//buttons
+$('#streamchannel span.streamButton a').tap(function(event) {
+ event.preventDefault();
+ json_start(this);
+ var type = $("#streamchannel").find('span[rel="type"]').html();
+ var url = $("#streamchannel").find('span[rel="url"]').html();
+ var mode = $(this).attr('rel');
+ start_broadcast(type,url,mode);
+ return false;
+});
+$('#streamrec span.streamButton a').tap(function(event) {
+ event.preventDefault();
+ json_start(this);
+ var type = $("#streamrec").find('span[rel="type"]').html();
+ var url = $("#streamrec").find('span[rel="url"]').html();
+ var mode = $(this).attr('rel');
+ start_broadcast(type,url,mode);
+ return false;
+});
+$('#streamvid span.streamButton a').tap(function(event) {
+ event.preventDefault();
+ json_start(this);
+ var type = $("#streamvid").find('span[rel="type"]').html();
+ var url = $("#streamvid").find('span[rel="url"]').html();
+ var mode = $(this).attr('rel');
+ start_broadcast(type,url,mode);
+ return false;
+});
+$('#streaming span.streamButton a[rel="stopbroadcast"]').tap(function(event) {
+ event.preventDefault();
+ json_start(this);
+ var session = $("#streaming").find('span[rel="session"]').html();
+ stop_broadcast(session);
+ return false;
+});
+//Gen tv start stream
+function gen_streamchannel(channame,channumber) {
+ $('#streamchannel').find('h1').html( '<img class="menuicon" src="img/tv.png" /> ' +channame);
+ $('#streamchannel').find('#thumbnail').attr('src','logos/' + channame + ".png");
+ var dataString = "action=getChanInfo&chan=" + channumber;
+ //Json call to get tv program info
+ $.getJSON("bin/backend.php",
+ dataString,
+ function(data){
+ var program = data.program;
+ $("#streamchannel").find('span[class="name_now"]').html( 'Now: ' + program.now_title );
+ $("#streamchannel").find('span[class="epgtime_now"]').html( program.now_time );
+ $("#streamchannel").find('span[class="desc_now"]').html( program.now_desc );
+ $("#streamchannel").find('span[class="name_next"]').html( 'Next: ' + program.next_title );
+ $("#streamchannel").find('span[class="epgtime_next"]').html( program.next_time );
+ $("#streamchannel").find('span[rel="url"]').html(streamdev_server + channumber);
+ $("#streamchannel").find('span[rel="type"]').html('tv');
+ json_complete('#streamchannel','cube');
+ });
+}
+
+function gen_streamrec(folder,path) {
+ var dataString = "action=getRecInfo&rec=" + path + folder;
+ //Json call to get rec info
+ $.getJSON("bin/backend.php",
+ dataString,
+ function(data){
+ var program = data.program;
+ $('#streamrec').find('h1').html('<img class="menuicon" src="img/record.png" /> ' + program.name);
+ $('#streamrec').find('#thumbnail').attr('src','logos/' + program.channel + ".png");
+ $("#streamrec").find('span[class="name_now"]').html( program.name );
+ $("#streamrec").find('span[class="epgtime_now"]').html( 'Recorded: ' + program.recorded );
+ $("#streamrec").find('span[class="desc_now"]').html( program.desc );
+ $("#streamrec").find('span[rel="url"]').html( path + folder );
+ $("#streamrec").find('span[rel="type"]').html('rec');
+ json_complete('#streamrec','cube');
+ });
+}
+
+function gen_streamvid(filename,path) {
+ var dataString = "action=getVidInfo&file=" + path + filename;
+ //Json call to get rec info
+ $.getJSON("bin/backend.php",
+ dataString,
+ function(data){
+ var program = data.program;
+ $('#streamvid').find('h1').html('<img class="menuicon" src="img/video.png" /> ' + program.name);
+ $('#streamvid').find('#thumbnail').attr('src','ram/temp-logo.png');
+ $("#streamvid").find('span[class="name_now"]').html( program.name );
+ $("#streamvid").find('span[class="epgtime_now"]').html( 'Duration: ' + program.duration );
+ desc='<b>format: </b>' + program.format + '<br><b>video: </b>' + program.video + '<br><b>audio: </b>' + program.audio + '<br><b>resolution: </b>' + program.resolution;
+ $("#streamvid").find('span[class="desc_now"]').html( desc );
+ $("#streamvid").find('span[rel="url"]').html( path + filename );
+ $("#streamvid").find('span[rel="type"]').html('vid');
+ json_complete('#streamvid','cube');
+ });
+}
+//Gen streaming page
+function gen_streaming(session) {
+ $("#streaming").find('span[rel="session"]').html(session);
+ var dataString = "action=getStreamInfo&session=" + session;
+ //Json call to start streaming
+ $.getJSON("bin/backend.php",
+ dataString,
+ function(data){
+ var stream = data.stream;
+ $('#streaming').find('#thumbnail').attr('src','ram/session' + stream.session + '/thumb.png');
+ $("#streaming").find('span[rel="thumbwidth"]').html(stream.thumbwidth);
+ $("#streaming").find('span[rel="thumbheight"]').html(stream.thumbheight);
+ if (stream.type == "tv")
+ {
+ $('#streaming').find('h1').html('<img class="menuicon" src="img/tv.png" /> ' + stream.name );
+ $('#streaming').find('#player').css('width', '90px');
+ var streaminfo = '<li><span class="name_now">Now: ' + stream.now_title + '</span>';
+ streaminfo += '<span class="epgtime_now">' + stream.now_time + '</span>';
+ streaminfo += '<span class="desc_now">' + stream.now_desc + '</span></li>';
+ streaminfo += '<li><span class="name_next">Next: ' + stream.next_title + '</span>';
+ streaminfo += '<span class="epgtime_next">' + stream.next_time + '</span></li>';
+ $("#streaming").find('ul[class="streaminfo"]').html(streaminfo);
+ }
+ else if (stream.type == "rec")
+ {
+ $('#streaming').find('h1').html('<img class="menuicon" src="img/record.png" /> ' + stream.name );
+ $('#streaming').find('#player').css('width', '90px');
+ var streaminfo = '<li><span class="name_now">' + stream.name + '</span>';
+ streaminfo += '<span class="epgtime_now">Recorded: ' + stream.recorded + '</span>';
+ streaminfo += '<span class="desc_now">' + stream.desc + '</span></li>';
+ $("#streaming").find('ul[class="streaminfo"]').html(streaminfo);
+ }
+ else if (stream.type == "vid")
+ {
+ $('#streaming').find('h1').html('<img class="menuicon" src="img/video.png" /> ' + stream.name );
+ $('#streaming').find('#player').css('width', '190px');
+ var streaminfo = '<li><span class="name_now">' + stream.name + '</span>';
+ streaminfo += '<span class="epgtime_now">Duration: ' + stream.duration + '</span>';
+ desc='<b>format: </b>' + stream.format + '<br><b>video: </b>' + stream.video + '<br><b>audio: </b>' + stream.audio + '<br><b>resolution: </b>' + stream.resolution;
+ streaminfo += '<span class="desc_now">' + desc + '</span></li>';
+ $("#streaming").find('ul[class="streaminfo"]').html(streaminfo);
+ }
+ $('ul[class="streamstatus"]').find('span[class="mode"]').html('Please wait.');
+ $("#streaming").find('span[rel="name"]').html(stream.name);
+ json_complete('#streaming','cube');
+ });
+}
+
+//Start broadcast
+function start_broadcast(type,url,mode) {
+ var dataString = 'action=startBroadcast&type='+type+'&url='+url;
+ $.getJSON("bin/backend.php",
+ dataString,
+ function(data){
+ var session = data.session;
+ gen_streaming(session);
+ });
+
+}
+//Stop broadcast
+
+function stop_broadcast(session) {
+ var dataString = 'action=stopBroadcast&session='+session;
+ $.getJSON("bin/backend.php",
+ dataString,
+ function(data) {
+ var status = data.status;
+ var message = data.message;
+ hide_loader();
+ jQT.goBack();
+ });
+}
+
+//trick to prevent animation bug with object.
+$(document).ready(function(e){
+$('#streaming').bind('pageAnimationEnd', function(event, info){
+ if (info.direction == 'in') {
+ var session = $("#streaming").find('span[rel="session"]').html();
+ var name = $("#streaming").find('span[rel="name"]').html();
+ playvideo(session,name);
+ }
+})
+
+$('#streaming').bind('pageAnimationStart', function(event, info){
+ var session = $("#streaming").find('span[rel="session"]').html();
+ if (info.direction == 'out') {
+ $('#player').html('<img class="thumbnail" id="thumbnail" src="ram/session' + session + '/thumb.png"></img>');
+ }
+ })
+});
+
+//Get server status & Play video
+function playvideo(session,name) {
+ var prevmsg="";
+ var status_OnComplete = function(data) {
+ var status = data.status;
+ var message = data.message;
+ var url = data.url;
+ var thumbwidth = $('#streaming span[rel="thumbwidth"]').html();
+ var thumbheight = $('#streaming span[rel="thumbheight"]').html();
+ $('#streaming ul[class="streamstatus"]').find('span[class="mode"]').html(message);
+ if ( status == "ready" ) {
+ $('#player').html('<video id="videofeed" width="' + thumbwidth + '" height="' + thumbheight + '" poster="ram/session' + session + '/thumb.png" src="' + url + '" ></video><span rel="ready"></span>');
+ return false;
+ }
+ prevmsg = message;
+ status_Start(session,prevmsg);
+ }
+
+ var status_Start = function(session,prevmsg) {
+ dataString = "action=getStreamStatus&session=" + session + "&msg=" + prevmsg;
+ $.getJSON("bin/backend.php",
+ dataString,
+ function(data){
+ status_OnComplete(data)
+ });
+ }
+ status_Start(session,prevmsg);
+}
+// [/STREAM SECTION]
+
+// [BROWSER SECTION]
+//buttons
+$('ul[rel="filelist"] li.arrow a').tap(function(event) {
+ event.preventDefault();
+ json_start(this);
+ var type = $(this).attr('rel');
+ var name = $(this).find('span[class="menuname"]').html();
+ var path = $(this).parents('div').find('span[rel="path"]').html();
+ var browser = $(this).parents('div').find('span[rel="currentbrowser"]').html();
+ var foldertype = $(this).parents('div').find('span[rel="foldertype"]').html();
+ browser = parseInt(browser);
+ browser++;
+ if ( type == "folder" )
+ {
+ newpath=path+name;
+ gen_browser(newpath,browser,name,foldertype);
+ }
+ else if ( type == "rec" )
+ {
+ gen_streamrec(name,path);
+ }
+ else if ( type == "video" )
+ {
+ gen_streamvid(name,path);
+ }
+ return false;
+});
+
+$('div[rel="browser"] a[class="back"]').tap(function(event) {
+ event.preventDefault();
+ $(this).parents('div[rel="browser"]').remove();
+});
+
+$('div[rel="browser"] #home_but').tap(function(event) {
+ event.preventDefault();
+ $('#home').bind('pageAnimationEnd', function(event, info){
+ $('#jqt div[rel="browser"]').remove();
+ $('#home').unbind('pageAnimationEnd');
+
+ });
+});
+
+//functions
+function gen_browser(path,browser,name,foldertype) {
+ browser_template = '<div class="toolbar"></div>';
+ browser_template += '<ul rel="filelist" class="rounded"></ul>';
+ browser_template += '<div rel="dataholder" style="visibility:hidden">'
+ browser_template += '<span rel="path"></span>';
+ browser_template += '<span rel="currentbrowser"></span>';
+ browser_template += '<span rel="foldertype">' + foldertype + '</span>';
+ browser_template += '</div>';
+ $('#jqt').append('<div id="browser' + browser + '" rel="browser"></div>'),
+ $('#browser'+browser).html(browser_template);
+ if ( path == rec_path || path == video_path ) {
+ toolbar = '<a href="#" class="back">Home</a>';
+ if ( foldertype == 'rec' ){
+ toolbar += '<h1><img class="menuicon" src="img/record.png" /> ' + name + '</h1>';
+ }
+ else {
+ toolbar += '<h1><img class="menuicon" src="img/video.png" /> ' + name + '</h1>';
+ }
+ $('#browser' + browser + ' div[class="toolbar"]').html(toolbar);
+ }
+ else {
+ toolbar = '<a href="#" class="back">Back</a>';
+ toolbar += '<a href="#home" id="home_but" class="button">Home</a>';
+ if ( foldertype == 'rec' ){
+ toolbar += '<h1><img class="menuicon" src="img/record.png" /> ' + name + '</h1>';
+ }
+ else {
+ toolbar += '<h1><img class="menuicon" src="img/video.png" /> ' + name + '</h1>';
+ }
+ $('#browser' + browser + ' div[class="toolbar"]').html(toolbar);
+ }
+ var dataString = 'action=browseFolder&path='+path+'&browser=' + browser;
+ $.getJSON("bin/backend.php",
+ dataString,
+ function(data) {
+ $("#browser" + browser).find('ul').html('');
+ $("#browser" + browser).find('span[rel="path"]').html(path);
+ $("#browser" + browser).find('span[rel="currentbrowser"]').html(browser);
+ $.each(data.list, function(i,list){
+ if (list.type == "folder") {
+ $("#browser" + browser).find('ul').append('<li class="arrow"><a href="#" rel="folder"><span class="menuname">' + list.name + '</span></a></li>');
+ }
+ else if (list.type == "rec") {
+ $("#browser" + browser).find('ul').append('<li class="arrow"><a href="#" rel="rec"><img class="menuicon" src="img/record.png" /><span class="menuname">' + list.name + '</span></a></li>');
+ }
+ else if ( list.type == "video" ) {
+ $("#browser" + browser).find('ul').append('<li class="arrow"><a href="#" rel="video"><img class="menuicon" src="img/video.png" /><span class="menuname">' + list.name + '</span></a></li>');
+ }
+ });
+ json_complete('#browser' + browser,'cube');
+ });
+}
+
+
+// [/BROWSER SECTION]
+
+// [TIMER SECTION]
+//get fullchannel list onload
+
+$(document).ready(function(e){
+gen_formchanlist();
+});
+
+// buttons
+$('#timers li[class="arrow"] a').tap(function(event) {
+ event.preventDefault();
+ $(this).addClass('active');
+ if ( $(this).attr('rel') == "new" ) {
+ gen_edittimer();
+ } else {
+ timerid = $(this).attr('rel');
+ timerdata = $('#timers ul[rel="timers"] li a[rel="' + timerid + '"]').data("timerdata");
+ id = timerdata.id;
+ name = timerdata.name;
+ active = timerdata.active;
+ channumber = timerdata.channumber;
+ channame = timerdata.channame;
+ date = timerdata.date;
+ starttime = timerdata.starttime;
+ endtime = timerdata.endtime;
+ gen_edittimer(id,name,active,channumber,channame,date,starttime,endtime);
+ }
+});
+
+// gen Timers
+function gen_timers(edit) {
+ $('#timers ul[rel="timers"]').html('');
+ var dataString = 'action=getTimers';
+ $.getJSON("bin/backend.php",
+ dataString,
+ function(data) {
+ $('#timers ul[rel="timers"]').append('<li><span class="menutitle">Current timers</span></li>');
+ $.each(data.timer, function(i,timer){
+ if ( timer.running == "1" ) {
+ timerli = '<li class="arrow"><a rel="' + timer.id + '" href="#"><img class="menuicon" src="img/timerrec.png" /><span class="menuname">' + timer.date + ' ' + timer.name + '</span></a></li>';
+ }
+ else
+ {
+ if ( timer.active == "1" ) {
+ timerli = '<li class="arrow"><a rel="' + timer.id + '" href="#"><img class="menuicon" src="img/timeron.png" /><span class="menuname">' + timer.date + ' ' + timer.name + '</span></a></li>';
+ } else {
+ timerli = '<li class="arrow"><a rel="' + timer.id + '" href="#"><img class="menuicon" src="img/timeroff.png" /><span class="menuname">' + timer.date + ' ' + timer.name + '</span></a></li>';
+ }
+ }
+ $('#timers ul[rel="timers"]').append(timerli);
+ $('#timers ul[rel="timers"] li a[rel="' + timer.id + '"]').data("timerdata", timer);
+ });
+ if ( edit ) {
+ hide_loader();
+ jQT.goBack();
+ }
+ else {
+ json_complete('#timers','cube');
+ }
+ });
+}
+
+function gen_edittimer(id,name,active,channumber,channame,date,starttime,endtime) {
+ $('ul[ref="submitbut"]').remove();
+ if (id) {
+ $('#edittimer h1').html('<img class="menuicon" src="img/timers.png" / > EDIT TIMER');
+ if (active = 1)
+ {
+ $('#timer_active').attr("checked", "checked");
+ }
+ $('#timer_id').val(id);
+ $('#timer_name').val(name);
+ $('#timer_chan option[value="' + channumber + '"]').attr("selected", "selected");
+ $('#timer_date').val(date);
+ var wheeldate = date;
+ while (wheeldate.indexOf("-") > -1)
+ wheeldate = wheeldate.replace("-", ",");
+ $('#a_date').attr('href', "javascript:openSelectDate(" + wheeldate + ");");
+ $('#layer_date').html(date);
+ $('#timer_starttime').val(starttime);
+ $('#timer_endtime').val(endtime);
+ wheelstart_h = starttime.substring(0,2);
+ wheelstart_m = starttime.substring(2,4);
+ $('#layer_starttime').html(wheelstart_h + 'h' + wheelstart_m);
+ $('#a_starttime').attr('href', "javascript:openSelectTime('layer_starttime','" + wheelstart_h + "','" + wheelstart_m + "')");
+ wheelend_h = endtime.substring(0,2);
+ wheelend_m = endtime.substring(2,4);
+ $('#layer_endtime').html(wheelend_h + 'h' + wheelend_m);
+ $('#a_endtime').attr('href', "javascript:openSelectTime('layer_endtime','" + wheelend_h + "','" + wheelend_m + "')");
+ submitbuttons = '<ul ref="submitbut" class="individual">';
+ submitbuttons += '<li><a class="submit_form" href="#">Edit</a></li>';
+ submitbuttons += '<li><a class="abutton" href="javascript:deletetimer(\'id\');">Delete</a></li></ul>';
+ $('#timer').append(submitbuttons);
+ }
+ else {
+ $('#edittimer h1').html('<img class="menuicon" src="img/timers.png" / > NEW TIMER');
+ $('#timer_active').attr("checked", "checked");
+ $('#timer_id').val(null);
+ $('#timer_name').val(null);
+ $('#timer_chan option').removeAttr("selected");
+ $('#timer_chan option[value="1"]').attr("selected", "selected");
+ $('#a_date').attr('href', "javascript:openSelectDate();");
+ $('#layer_date').html("Select date");
+ $('#timer_date').val(null);
+ $('#timer_starttime').val(null);
+ $('#timer_endtime').val(null);
+ $('#a_starttime').attr('href', "javascript:openSelectTime('layer_starttime')");
+ $('#layer_starttime').html('Select start time');
+ $('#a_endtime').attr('href', "javascript:openSelectTime('layer_endtime')");
+ $('#layer_endtime').html('select end time');
+ submitbutton = '<ul ref="submitbut" class="rounded">';
+ submitbutton += '<li><center><a class="submit_form" href="#">Create</a></center></li></ul>';
+ $('#timer').append(submitbutton);
+ }
+ $('.formerror').hide();
+ json_complete('#edittimer','cube');
+}
+//get full chanlist for timer page ( doing it one time on document load ).
+function gen_formchanlist() {
+ var dataString = 'action=getFullChanList';
+ $.getJSON("bin/backend.php",
+ dataString,
+ function(data) {
+ $.each(data.category, function(i,category){
+ $('#timer_chan').append('<optgroup label="' + category.name + '">');
+ var catname = category.name;
+ $.each(category.channel, function(j, channel){
+ $('#timer_chan optgroup[label="' + catname +'"]').append('<option value="' + channel.number + '">' + channel.name +'</option>');
+ });
+ $('#timer_chan').append('</optgroup>');
+ });
+ });
+}
+
+// TIMER FORM VALIDATION & SUBMIT
+$('.submit_form').tap(function(event) {
+ event.preventDefault();
+ $('.formerror').hide();
+ $(this).removeClass('active');
+ var timer_name = $("input#timer_name").val();
+ if (timer_name == "") {
+ $("li#timer_name_error").show();
+ $.scrollTo('#edittimer #ul[rel="name"]');
+ return false;
+ }
+ var timer_date = $("input#timer_date").val();
+ if (timer_date == "") {
+ $("li#timer_date_error").show();
+ $.scrollTo('#edittimer #timer_date_error');
+ return false;
+ }
+ var timer_starttime = $("input#timer_starttime").val();
+ if (timer_starttime == "") {
+ $("li#timer_starttime_error").show();
+ $.scrollTo('#edittimer #timer_starttime_error');
+ return false;
+ }
+ var timer_endtime = $("input#timer_endtime").val();
+ if (timer_endtime == "") {
+ $("li#timer_endtime_error").show();
+ $.scrollTo('#edittimer #timer_endtime_error');
+ return false;
+ }
+ var timer_id = $("input#timer_id").val();
+ var timer_chan = $("select#timer_chan").val();
+ var timer_active = $("input#timer_active").val();
+ var dataString = 'action=editTimer&id=' + timer_id + '&active=' + timer_active + '&channumber=' + timer_chan + '&date=' + timer_date + '&starttime=' + timer_starttime + '&endtime=' + timer_endtime;
+ $.getJSON("bin/backend.php",
+ dataString,
+ function(data) {
+ message = data.status + ": " + data.message;
+ gen_timers("true");
+ json_start(this);
+ showStatus( 0,message );
+ return false;
+ });
+ return false;
+});
+
+function showStatus( timeout, message ) {
+ if( timeout == 0 ) {
+ $('#timer_status').html(message);
+ $('#timer_status').show();
+ setTimeout( function() { showStatus( 1, message ); }, 4000 );
+ } else if( timeout == 1 ) {
+ $('#timer_status').hide();
+ }
+}
+// [/TIMER SECTION]
\ No newline at end of file diff --git a/javascript/spinningwheel-min.js b/js/spinningwheel-min.js index a2b68dd..a2b68dd 100755..100644 --- a/javascript/spinningwheel-min.js +++ b/js/spinningwheel-min.js diff --git a/javascript/spinningwheel.js b/js/spinningwheel.js index 1147d3a..79f8ab6 100755..100644 --- a/javascript/spinningwheel.js +++ b/js/spinningwheel.js @@ -1,492 +1,492 @@ -/** - * - * Find more about the Spinning Wheel function at - * http://cubiq.org/spinning-wheel-on-webkit-for-iphone-ipod-touch/11 - * - * Copyright (c) 2009 Matteo Spinelli, http://cubiq.org/ - * Released under MIT license - * http://cubiq.org/dropbox/mit-license.txt - * - * Version 1.4 - Last updated: 2009.07.09 - * - */ - -var SpinningWheel = { - cellHeight: 44, - friction: 0.003, - slotData: [], - - - /** - * - * Event handler - * - */ - - handleEvent: function (e) { - if (e.type == 'touchstart') { - this.lockScreen(e); - if (e.currentTarget.id == 'sw-cancel' || e.currentTarget.id == 'sw-done') { - this.tapDown(e); - } else if (e.currentTarget.id == 'sw-frame') { - this.scrollStart(e); - } - } else if (e.type == 'touchmove') { - this.lockScreen(e); - - if (e.currentTarget.id == 'sw-cancel' || e.currentTarget.id == 'sw-done') { - this.tapCancel(e); - } else if (e.currentTarget.id == 'sw-frame') { - this.scrollMove(e); - } - } else if (e.type == 'touchend') { - if (e.currentTarget.id == 'sw-cancel' || e.currentTarget.id == 'sw-done') { - this.tapUp(e); - } else if (e.currentTarget.id == 'sw-frame') { - this.scrollEnd(e); - } - } else if (e.type == 'webkitTransitionEnd') { - if (e.target.id == 'sw-wrapper') { - this.destroy(); - } else { - this.backWithinBoundaries(e); - } - } else if (e.type == 'orientationchange') { - this.onOrientationChange(e); - } else if (e.type == 'scroll') { - this.onScroll(e); - } - }, - - - /** - * - * Global events - * - */ - - onOrientationChange: function (e) { - window.scrollTo(0, 0); - this.swWrapper.style.top = window.innerHeight + window.pageYOffset + 'px'; - this.calculateSlotsWidth(); - }, - - onScroll: function (e) { - this.swWrapper.style.top = window.innerHeight + window.pageYOffset + 'px'; - }, - - lockScreen: function (e) { - e.preventDefault(); - e.stopPropagation(); - }, - - - /** - * - * Initialization - * - */ - - reset: function () { - this.slotEl = []; - - this.activeSlot = null; - - this.swWrapper = undefined; - this.swSlotWrapper = undefined; - this.swSlots = undefined; - this.swFrame = undefined; - }, - - calculateSlotsWidth: function () { - var div = this.swSlots.getElementsByTagName('div'); - for (var i = 0; i < div.length; i += 1) { - this.slotEl[i].slotWidth = div[i].offsetWidth; - } - }, - - create: function () { - var i, l, out, ul, div; - - this.reset(); // Initialize object variables - - // Create the Spinning Wheel main wrapper - div = document.createElement('div'); - div.id = 'sw-wrapper'; - div.style.top = window.innerHeight + window.pageYOffset + 'px'; // Place the SW down the actual viewing screen - div.style.webkitTransitionProperty = '-webkit-transform'; - div.innerHTML = '<div id="sw-header"><div id="sw-cancel">Cancel</' + 'div><div id="sw-done">Done</' + 'div></' + 'div><div id="sw-slots-wrapper"><div id="sw-slots"></' + 'div></' + 'div><div id="sw-frame"></' + 'div>'; - - document.body.appendChild(div); - - this.swWrapper = div; // The SW wrapper - this.swSlotWrapper = document.getElementById('sw-slots-wrapper'); // Slots visible area - this.swSlots = document.getElementById('sw-slots'); // Pseudo table element (inner wrapper) - this.swFrame = document.getElementById('sw-frame'); // The scrolling controller - - // Create HTML slot elements - for (l = 0; l < this.slotData.length; l += 1) { - // Create the slot - ul = document.createElement('ul'); - out = ''; - for (i in this.slotData[l].values) { - out += '<li>' + this.slotData[l].values[i] + '<' + '/li>'; - } - ul.innerHTML = out; - - div = document.createElement('div'); // Create slot container - div.className = this.slotData[l].style; // Add styles to the container - div.appendChild(ul); - - // Append the slot to the wrapper - this.swSlots.appendChild(div); - - ul.slotPosition = l; // Save the slot position inside the wrapper - ul.slotYPosition = 0; - ul.slotWidth = 0; - ul.slotMaxScroll = this.swSlotWrapper.clientHeight - ul.clientHeight - 86; - ul.style.webkitTransitionTimingFunction = 'cubic-bezier(0, 0, 0.2, 1)'; // Add default transition - - this.slotEl.push(ul); // Save the slot for later use - - // Place the slot to its default position (if other than 0) - if (this.slotData[l].defaultValue) { - this.scrollToValue(l, this.slotData[l].defaultValue); - } - } - - this.calculateSlotsWidth(); - - // Global events - document.addEventListener('touchstart', this, false); // Prevent page scrolling - document.addEventListener('touchmove', this, false); // Prevent page scrolling - window.addEventListener('orientationchange', this, true); // Optimize SW on orientation change - window.addEventListener('scroll', this, true); // Reposition SW on page scroll - - // Cancel/Done buttons events - document.getElementById('sw-cancel').addEventListener('touchstart', this, false); - document.getElementById('sw-done').addEventListener('touchstart', this, false); - - // Add scrolling to the slots - this.swFrame.addEventListener('touchstart', this, false); - }, - - open: function () { - this.create(); - - this.swWrapper.style.webkitTransitionTimingFunction = 'ease-out'; - this.swWrapper.style.webkitTransitionDuration = '400ms'; - this.swWrapper.style.webkitTransform = 'translate3d(0, -260px, 0)'; - }, - - - /** - * - * Unload - * - */ - - destroy: function () { - this.swWrapper.removeEventListener('webkitTransitionEnd', this, false); - - this.swFrame.removeEventListener('touchstart', this, false); - - document.getElementById('sw-cancel').removeEventListener('touchstart', this, false); - document.getElementById('sw-done').removeEventListener('touchstart', this, false); - - document.removeEventListener('touchstart', this, false); - document.removeEventListener('touchmove', this, false); - window.removeEventListener('orientationchange', this, true); - window.removeEventListener('scroll', this, true); - - this.slotData = []; - this.cancelAction = function () { - return false; - }; - - this.cancelDone = function () { - return true; - }; - - this.reset(); - - document.body.removeChild(document.getElementById('sw-wrapper')); - }, - - close: function () { - this.swWrapper.style.webkitTransitionTimingFunction = 'ease-in'; - this.swWrapper.style.webkitTransitionDuration = '400ms'; - this.swWrapper.style.webkitTransform = 'translate3d(0, 0, 0)'; - - this.swWrapper.addEventListener('webkitTransitionEnd', this, false); - }, - - - /** - * - * Generic methods - * - */ - - addSlot: function (values, style, defaultValue) { - if (!style) { - style = ''; - } - - style = style.split(' '); - - for (var i = 0; i < style.length; i += 1) { - style[i] = 'sw-' + style[i]; - } - - style = style.join(' '); - - var obj = { 'values': values, 'style': style, 'defaultValue': defaultValue }; - this.slotData.push(obj); - }, - - getSelectedValues: function () { - var index, count, - i, l, - keys = [], values = []; - - for (i in this.slotEl) { - // Remove any residual animation - this.slotEl[i].removeEventListener('webkitTransitionEnd', this, false); - this.slotEl[i].style.webkitTransitionDuration = '0'; - - if (this.slotEl[i].slotYPosition > 0) { - this.setPosition(i, 0); - } else if (this.slotEl[i].slotYPosition < this.slotEl[i].slotMaxScroll) { - this.setPosition(i, this.slotEl[i].slotMaxScroll); - } - - index = -Math.round(this.slotEl[i].slotYPosition / this.cellHeight); - - count = 0; - for (l in this.slotData[i].values) { - if (count == index) { - keys.push(l); - values.push(this.slotData[i].values[l]); - break; - } - - count += 1; - } - } - - return { 'keys': keys, 'values': values }; - }, - - - /** - * - * Rolling slots - * - */ - - setPosition: function (slot, pos) { - this.slotEl[slot].slotYPosition = pos; - this.slotEl[slot].style.webkitTransform = 'translate3d(0, ' + pos + 'px, 0)'; - }, - - scrollStart: function (e) { - // Find the clicked slot - var xPos = e.targetTouches[0].clientX - this.swSlots.offsetLeft; // Clicked position minus left offset (should be 11px) - - // Find tapped slot - var slot = 0; - for (var i = 0; i < this.slotEl.length; i += 1) { - slot += this.slotEl[i].slotWidth; - - if (xPos < slot) { - this.activeSlot = i; - break; - } - } - - // If slot is readonly do nothing - if (this.slotData[this.activeSlot].style.match('readonly')) { - this.swFrame.removeEventListener('touchmove', this, false); - this.swFrame.removeEventListener('touchend', this, false); - return false; - } - - this.slotEl[this.activeSlot].removeEventListener('webkitTransitionEnd', this, false); // Remove transition event (if any) - this.slotEl[this.activeSlot].style.webkitTransitionDuration = '0'; // Remove any residual transition - - // Stop and hold slot position - var theTransform = window.getComputedStyle(this.slotEl[this.activeSlot]).webkitTransform; - theTransform = new WebKitCSSMatrix(theTransform).m42; - if (theTransform != this.slotEl[this.activeSlot].slotYPosition) { - this.setPosition(this.activeSlot, theTransform); - } - - this.startY = e.targetTouches[0].clientY; - this.scrollStartY = this.slotEl[this.activeSlot].slotYPosition; - this.scrollStartTime = e.timeStamp; - - this.swFrame.addEventListener('touchmove', this, false); - this.swFrame.addEventListener('touchend', this, false); - - return true; - }, - - scrollMove: function (e) { - var topDelta = e.targetTouches[0].clientY - this.startY; - - if (this.slotEl[this.activeSlot].slotYPosition > 0 || this.slotEl[this.activeSlot].slotYPosition < this.slotEl[this.activeSlot].slotMaxScroll) { - topDelta /= 2; - } - - this.setPosition(this.activeSlot, this.slotEl[this.activeSlot].slotYPosition + topDelta); - this.startY = e.targetTouches[0].clientY; - - // Prevent slingshot effect - if (e.timeStamp - this.scrollStartTime > 80) { - this.scrollStartY = this.slotEl[this.activeSlot].slotYPosition; - this.scrollStartTime = e.timeStamp; - } - }, - - scrollEnd: function (e) { - this.swFrame.removeEventListener('touchmove', this, false); - this.swFrame.removeEventListener('touchend', this, false); - - // If we are outside of the boundaries, let's go back to the sheepfold - if (this.slotEl[this.activeSlot].slotYPosition > 0 || this.slotEl[this.activeSlot].slotYPosition < this.slotEl[this.activeSlot].slotMaxScroll) { - this.scrollTo(this.activeSlot, this.slotEl[this.activeSlot].slotYPosition > 0 ? 0 : this.slotEl[this.activeSlot].slotMaxScroll); - return false; - } - - // Lame formula to calculate a fake deceleration - var scrollDistance = this.slotEl[this.activeSlot].slotYPosition - this.scrollStartY; - - // The drag session was too short - if (scrollDistance < this.cellHeight / 1.5 && scrollDistance > -this.cellHeight / 1.5) { - if (this.slotEl[this.activeSlot].slotYPosition % this.cellHeight) { - this.scrollTo(this.activeSlot, Math.round(this.slotEl[this.activeSlot].slotYPosition / this.cellHeight) * this.cellHeight, '100ms'); - } - - return false; - } - - var scrollDuration = e.timeStamp - this.scrollStartTime; - - var newDuration = (2 * scrollDistance / scrollDuration) / this.friction; - var newScrollDistance = (this.friction / 2) * (newDuration * newDuration); - - if (newDuration < 0) { - newDuration = -newDuration; - newScrollDistance = -newScrollDistance; - } - - var newPosition = this.slotEl[this.activeSlot].slotYPosition + newScrollDistance; - - if (newPosition > 0) { - // Prevent the slot to be dragged outside the visible area (top margin) - newPosition /= 2; - newDuration /= 3; - - if (newPosition > this.swSlotWrapper.clientHeight / 4) { - newPosition = this.swSlotWrapper.clientHeight / 4; - } - } else if (newPosition < this.slotEl[this.activeSlot].slotMaxScroll) { - // Prevent the slot to be dragged outside the visible area (bottom margin) - newPosition = (newPosition - this.slotEl[this.activeSlot].slotMaxScroll) / 2 + this.slotEl[this.activeSlot].slotMaxScroll; - newDuration /= 3; - - if (newPosition < this.slotEl[this.activeSlot].slotMaxScroll - this.swSlotWrapper.clientHeight / 4) { - newPosition = this.slotEl[this.activeSlot].slotMaxScroll - this.swSlotWrapper.clientHeight / 4; - } - } else { - newPosition = Math.round(newPosition / this.cellHeight) * this.cellHeight; - } - - this.scrollTo(this.activeSlot, Math.round(newPosition), Math.round(newDuration) + 'ms'); - - return true; - }, - - scrollTo: function (slotNum, dest, runtime) { - this.slotEl[slotNum].style.webkitTransitionDuration = runtime ? runtime : '100ms'; - this.setPosition(slotNum, dest ? dest : 0); - - // If we are outside of the boundaries go back to the sheepfold - if (this.slotEl[slotNum].slotYPosition > 0 || this.slotEl[slotNum].slotYPosition < this.slotEl[slotNum].slotMaxScroll) { - this.slotEl[slotNum].addEventListener('webkitTransitionEnd', this, false); - } - }, - - scrollToValue: function (slot, value) { - var yPos, count, i; - - this.slotEl[slot].removeEventListener('webkitTransitionEnd', this, false); - this.slotEl[slot].style.webkitTransitionDuration = '0'; - - count = 0; - for (i in this.slotData[slot].values) { - if (i == value) { - yPos = count * this.cellHeight; - this.setPosition(slot, yPos); - break; - } - - count -= 1; - } - }, - - backWithinBoundaries: function (e) { - e.target.removeEventListener('webkitTransitionEnd', this, false); - - this.scrollTo(e.target.slotPosition, e.target.slotYPosition > 0 ? 0 : e.target.slotMaxScroll, '150ms'); - return false; - }, - - - /** - * - * Buttons - * - */ - - tapDown: function (e) { - e.currentTarget.addEventListener('touchmove', this, false); - e.currentTarget.addEventListener('touchend', this, false); - e.currentTarget.className = 'sw-pressed'; - }, - - tapCancel: function (e) { - e.currentTarget.removeEventListener('touchmove', this, false); - e.currentTarget.removeEventListener('touchend', this, false); - e.currentTarget.className = ''; - }, - - tapUp: function (e) { - this.tapCancel(e); - - if (e.currentTarget.id == 'sw-cancel') { - this.cancelAction(); - } else { - this.doneAction(); - } - - this.close(); - }, - - setCancelAction: function (action) { - this.cancelAction = action; - }, - - setDoneAction: function (action) { - this.doneAction = action; - }, - - cancelAction: function () { - return false; - }, - - cancelDone: function () { - return true; - } +/**
+ *
+ * Find more about the Spinning Wheel function at
+ * http://cubiq.org/spinning-wheel-on-webkit-for-iphone-ipod-touch/11
+ *
+ * Copyright (c) 2009 Matteo Spinelli, http://cubiq.org/
+ * Released under MIT license
+ * http://cubiq.org/dropbox/mit-license.txt
+ *
+ * Version 1.4 - Last updated: 2009.07.09
+ *
+ */
+
+var SpinningWheel = {
+ cellHeight: 44,
+ friction: 0.003,
+ slotData: [],
+
+
+ /**
+ *
+ * Event handler
+ *
+ */
+
+ handleEvent: function (e) {
+ if (e.type == 'touchstart') {
+ this.lockScreen(e);
+ if (e.currentTarget.id == 'sw-cancel' || e.currentTarget.id == 'sw-done') {
+ this.tapDown(e);
+ } else if (e.currentTarget.id == 'sw-frame') {
+ this.scrollStart(e);
+ }
+ } else if (e.type == 'touchmove') {
+ this.lockScreen(e);
+
+ if (e.currentTarget.id == 'sw-cancel' || e.currentTarget.id == 'sw-done') {
+ this.tapCancel(e);
+ } else if (e.currentTarget.id == 'sw-frame') {
+ this.scrollMove(e);
+ }
+ } else if (e.type == 'touchend') {
+ if (e.currentTarget.id == 'sw-cancel' || e.currentTarget.id == 'sw-done') {
+ this.tapUp(e);
+ } else if (e.currentTarget.id == 'sw-frame') {
+ this.scrollEnd(e);
+ }
+ } else if (e.type == 'webkitTransitionEnd') {
+ if (e.target.id == 'sw-wrapper') {
+ this.destroy();
+ } else {
+ this.backWithinBoundaries(e);
+ }
+ } else if (e.type == 'orientationchange') {
+ this.onOrientationChange(e);
+ } else if (e.type == 'scroll') {
+ this.onScroll(e);
+ }
+ },
+
+
+ /**
+ *
+ * Global events
+ *
+ */
+
+ onOrientationChange: function (e) {
+ window.scrollTo(0, 0);
+ this.swWrapper.style.top = window.innerHeight + window.pageYOffset + 'px';
+ this.calculateSlotsWidth();
+ },
+
+ onScroll: function (e) {
+ this.swWrapper.style.top = window.innerHeight + window.pageYOffset + 'px';
+ },
+
+ lockScreen: function (e) {
+ e.preventDefault();
+ e.stopPropagation();
+ },
+
+
+ /**
+ *
+ * Initialization
+ *
+ */
+
+ reset: function () {
+ this.slotEl = [];
+
+ this.activeSlot = null;
+
+ this.swWrapper = undefined;
+ this.swSlotWrapper = undefined;
+ this.swSlots = undefined;
+ this.swFrame = undefined;
+ },
+
+ calculateSlotsWidth: function () {
+ var div = this.swSlots.getElementsByTagName('div');
+ for (var i = 0; i < div.length; i += 1) {
+ this.slotEl[i].slotWidth = div[i].offsetWidth;
+ }
+ },
+
+ create: function () {
+ var i, l, out, ul, div;
+
+ this.reset(); // Initialize object variables
+
+ // Create the Spinning Wheel main wrapper
+ div = document.createElement('div');
+ div.id = 'sw-wrapper';
+ div.style.top = window.innerHeight + window.pageYOffset + 'px'; // Place the SW down the actual viewing screen
+ div.style.webkitTransitionProperty = '-webkit-transform';
+ div.innerHTML = '<div id="sw-header"><div id="sw-cancel">Cancel</' + 'div><div id="sw-done">Done</' + 'div></' + 'div><div id="sw-slots-wrapper"><div id="sw-slots"></' + 'div></' + 'div><div id="sw-frame"></' + 'div>';
+
+ document.body.appendChild(div);
+
+ this.swWrapper = div; // The SW wrapper
+ this.swSlotWrapper = document.getElementById('sw-slots-wrapper'); // Slots visible area
+ this.swSlots = document.getElementById('sw-slots'); // Pseudo table element (inner wrapper)
+ this.swFrame = document.getElementById('sw-frame'); // The scrolling controller
+
+ // Create HTML slot elements
+ for (l = 0; l < this.slotData.length; l += 1) {
+ // Create the slot
+ ul = document.createElement('ul');
+ out = '';
+ for (i in this.slotData[l].values) {
+ out += '<li>' + this.slotData[l].values[i] + '<' + '/li>';
+ }
+ ul.innerHTML = out;
+
+ div = document.createElement('div'); // Create slot container
+ div.className = this.slotData[l].style; // Add styles to the container
+ div.appendChild(ul);
+
+ // Append the slot to the wrapper
+ this.swSlots.appendChild(div);
+
+ ul.slotPosition = l; // Save the slot position inside the wrapper
+ ul.slotYPosition = 0;
+ ul.slotWidth = 0;
+ ul.slotMaxScroll = this.swSlotWrapper.clientHeight - ul.clientHeight - 86;
+ ul.style.webkitTransitionTimingFunction = 'cubic-bezier(0, 0, 0.2, 1)'; // Add default transition
+
+ this.slotEl.push(ul); // Save the slot for later use
+
+ // Place the slot to its default position (if other than 0)
+ if (this.slotData[l].defaultValue) {
+ this.scrollToValue(l, this.slotData[l].defaultValue);
+ }
+ }
+
+ this.calculateSlotsWidth();
+
+ // Global events
+ document.addEventListener('touchstart', this, false); // Prevent page scrolling
+ document.addEventListener('touchmove', this, false); // Prevent page scrolling
+ window.addEventListener('orientationchange', this, true); // Optimize SW on orientation change
+ window.addEventListener('scroll', this, true); // Reposition SW on page scroll
+
+ // Cancel/Done buttons events
+ document.getElementById('sw-cancel').addEventListener('touchstart', this, false);
+ document.getElementById('sw-done').addEventListener('touchstart', this, false);
+
+ // Add scrolling to the slots
+ this.swFrame.addEventListener('touchstart', this, false);
+ },
+
+ open: function () {
+ this.create();
+
+ this.swWrapper.style.webkitTransitionTimingFunction = 'ease-out';
+ this.swWrapper.style.webkitTransitionDuration = '400ms';
+ this.swWrapper.style.webkitTransform = 'translate3d(0, -260px, 0)';
+ },
+
+
+ /**
+ *
+ * Unload
+ *
+ */
+
+ destroy: function () {
+ this.swWrapper.removeEventListener('webkitTransitionEnd', this, false);
+
+ this.swFrame.removeEventListener('touchstart', this, false);
+
+ document.getElementById('sw-cancel').removeEventListener('touchstart', this, false);
+ document.getElementById('sw-done').removeEventListener('touchstart', this, false);
+
+ document.removeEventListener('touchstart', this, false);
+ document.removeEventListener('touchmove', this, false);
+ window.removeEventListener('orientationchange', this, true);
+ window.removeEventListener('scroll', this, true);
+
+ this.slotData = [];
+ this.cancelAction = function () {
+ return false;
+ };
+
+ this.cancelDone = function () {
+ return true;
+ };
+
+ this.reset();
+
+ document.body.removeChild(document.getElementById('sw-wrapper'));
+ },
+
+ close: function () {
+ this.swWrapper.style.webkitTransitionTimingFunction = 'ease-in';
+ this.swWrapper.style.webkitTransitionDuration = '400ms';
+ this.swWrapper.style.webkitTransform = 'translate3d(0, 0, 0)';
+
+ this.swWrapper.addEventListener('webkitTransitionEnd', this, false);
+ },
+
+
+ /**
+ *
+ * Generic methods
+ *
+ */
+
+ addSlot: function (values, style, defaultValue) {
+ if (!style) {
+ style = '';
+ }
+
+ style = style.split(' ');
+
+ for (var i = 0; i < style.length; i += 1) {
+ style[i] = 'sw-' + style[i];
+ }
+
+ style = style.join(' ');
+
+ var obj = { 'values': values, 'style': style, 'defaultValue': defaultValue };
+ this.slotData.push(obj);
+ },
+
+ getSelectedValues: function () {
+ var index, count,
+ i, l,
+ keys = [], values = [];
+
+ for (i in this.slotEl) {
+ // Remove any residual animation
+ this.slotEl[i].removeEventListener('webkitTransitionEnd', this, false);
+ this.slotEl[i].style.webkitTransitionDuration = '0';
+
+ if (this.slotEl[i].slotYPosition > 0) {
+ this.setPosition(i, 0);
+ } else if (this.slotEl[i].slotYPosition < this.slotEl[i].slotMaxScroll) {
+ this.setPosition(i, this.slotEl[i].slotMaxScroll);
+ }
+
+ index = -Math.round(this.slotEl[i].slotYPosition / this.cellHeight);
+
+ count = 0;
+ for (l in this.slotData[i].values) {
+ if (count == index) {
+ keys.push(l);
+ values.push(this.slotData[i].values[l]);
+ break;
+ }
+
+ count += 1;
+ }
+ }
+
+ return { 'keys': keys, 'values': values };
+ },
+
+
+ /**
+ *
+ * Rolling slots
+ *
+ */
+
+ setPosition: function (slot, pos) {
+ this.slotEl[slot].slotYPosition = pos;
+ this.slotEl[slot].style.webkitTransform = 'translate3d(0, ' + pos + 'px, 0)';
+ },
+
+ scrollStart: function (e) {
+ // Find the clicked slot
+ var xPos = e.targetTouches[0].clientX - this.swSlots.offsetLeft; // Clicked position minus left offset (should be 11px)
+
+ // Find tapped slot
+ var slot = 0;
+ for (var i = 0; i < this.slotEl.length; i += 1) {
+ slot += this.slotEl[i].slotWidth;
+
+ if (xPos < slot) {
+ this.activeSlot = i;
+ break;
+ }
+ }
+
+ // If slot is readonly do nothing
+ if (this.slotData[this.activeSlot].style.match('readonly')) {
+ this.swFrame.removeEventListener('touchmove', this, false);
+ this.swFrame.removeEventListener('touchend', this, false);
+ return false;
+ }
+
+ this.slotEl[this.activeSlot].removeEventListener('webkitTransitionEnd', this, false); // Remove transition event (if any)
+ this.slotEl[this.activeSlot].style.webkitTransitionDuration = '0'; // Remove any residual transition
+
+ // Stop and hold slot position
+ var theTransform = window.getComputedStyle(this.slotEl[this.activeSlot]).webkitTransform;
+ theTransform = new WebKitCSSMatrix(theTransform).m42;
+ if (theTransform != this.slotEl[this.activeSlot].slotYPosition) {
+ this.setPosition(this.activeSlot, theTransform);
+ }
+
+ this.startY = e.targetTouches[0].clientY;
+ this.scrollStartY = this.slotEl[this.activeSlot].slotYPosition;
+ this.scrollStartTime = e.timeStamp;
+
+ this.swFrame.addEventListener('touchmove', this, false);
+ this.swFrame.addEventListener('touchend', this, false);
+
+ return true;
+ },
+
+ scrollMove: function (e) {
+ var topDelta = e.targetTouches[0].clientY - this.startY;
+
+ if (this.slotEl[this.activeSlot].slotYPosition > 0 || this.slotEl[this.activeSlot].slotYPosition < this.slotEl[this.activeSlot].slotMaxScroll) {
+ topDelta /= 2;
+ }
+
+ this.setPosition(this.activeSlot, this.slotEl[this.activeSlot].slotYPosition + topDelta);
+ this.startY = e.targetTouches[0].clientY;
+
+ // Prevent slingshot effect
+ if (e.timeStamp - this.scrollStartTime > 80) {
+ this.scrollStartY = this.slotEl[this.activeSlot].slotYPosition;
+ this.scrollStartTime = e.timeStamp;
+ }
+ },
+
+ scrollEnd: function (e) {
+ this.swFrame.removeEventListener('touchmove', this, false);
+ this.swFrame.removeEventListener('touchend', this, false);
+
+ // If we are outside of the boundaries, let's go back to the sheepfold
+ if (this.slotEl[this.activeSlot].slotYPosition > 0 || this.slotEl[this.activeSlot].slotYPosition < this.slotEl[this.activeSlot].slotMaxScroll) {
+ this.scrollTo(this.activeSlot, this.slotEl[this.activeSlot].slotYPosition > 0 ? 0 : this.slotEl[this.activeSlot].slotMaxScroll);
+ return false;
+ }
+
+ // Lame formula to calculate a fake deceleration
+ var scrollDistance = this.slotEl[this.activeSlot].slotYPosition - this.scrollStartY;
+
+ // The drag session was too short
+ if (scrollDistance < this.cellHeight / 1.5 && scrollDistance > -this.cellHeight / 1.5) {
+ if (this.slotEl[this.activeSlot].slotYPosition % this.cellHeight) {
+ this.scrollTo(this.activeSlot, Math.round(this.slotEl[this.activeSlot].slotYPosition / this.cellHeight) * this.cellHeight, '100ms');
+ }
+
+ return false;
+ }
+
+ var scrollDuration = e.timeStamp - this.scrollStartTime;
+
+ var newDuration = (2 * scrollDistance / scrollDuration) / this.friction;
+ var newScrollDistance = (this.friction / 2) * (newDuration * newDuration);
+
+ if (newDuration < 0) {
+ newDuration = -newDuration;
+ newScrollDistance = -newScrollDistance;
+ }
+
+ var newPosition = this.slotEl[this.activeSlot].slotYPosition + newScrollDistance;
+
+ if (newPosition > 0) {
+ // Prevent the slot to be dragged outside the visible area (top margin)
+ newPosition /= 2;
+ newDuration /= 3;
+
+ if (newPosition > this.swSlotWrapper.clientHeight / 4) {
+ newPosition = this.swSlotWrapper.clientHeight / 4;
+ }
+ } else if (newPosition < this.slotEl[this.activeSlot].slotMaxScroll) {
+ // Prevent the slot to be dragged outside the visible area (bottom margin)
+ newPosition = (newPosition - this.slotEl[this.activeSlot].slotMaxScroll) / 2 + this.slotEl[this.activeSlot].slotMaxScroll;
+ newDuration /= 3;
+
+ if (newPosition < this.slotEl[this.activeSlot].slotMaxScroll - this.swSlotWrapper.clientHeight / 4) {
+ newPosition = this.slotEl[this.activeSlot].slotMaxScroll - this.swSlotWrapper.clientHeight / 4;
+ }
+ } else {
+ newPosition = Math.round(newPosition / this.cellHeight) * this.cellHeight;
+ }
+
+ this.scrollTo(this.activeSlot, Math.round(newPosition), Math.round(newDuration) + 'ms');
+
+ return true;
+ },
+
+ scrollTo: function (slotNum, dest, runtime) {
+ this.slotEl[slotNum].style.webkitTransitionDuration = runtime ? runtime : '100ms';
+ this.setPosition(slotNum, dest ? dest : 0);
+
+ // If we are outside of the boundaries go back to the sheepfold
+ if (this.slotEl[slotNum].slotYPosition > 0 || this.slotEl[slotNum].slotYPosition < this.slotEl[slotNum].slotMaxScroll) {
+ this.slotEl[slotNum].addEventListener('webkitTransitionEnd', this, false);
+ }
+ },
+
+ scrollToValue: function (slot, value) {
+ var yPos, count, i;
+
+ this.slotEl[slot].removeEventListener('webkitTransitionEnd', this, false);
+ this.slotEl[slot].style.webkitTransitionDuration = '0';
+
+ count = 0;
+ for (i in this.slotData[slot].values) {
+ if (i == value) {
+ yPos = count * this.cellHeight;
+ this.setPosition(slot, yPos);
+ break;
+ }
+
+ count -= 1;
+ }
+ },
+
+ backWithinBoundaries: function (e) {
+ e.target.removeEventListener('webkitTransitionEnd', this, false);
+
+ this.scrollTo(e.target.slotPosition, e.target.slotYPosition > 0 ? 0 : e.target.slotMaxScroll, '150ms');
+ return false;
+ },
+
+
+ /**
+ *
+ * Buttons
+ *
+ */
+
+ tapDown: function (e) {
+ e.currentTarget.addEventListener('touchmove', this, false);
+ e.currentTarget.addEventListener('touchend', this, false);
+ e.currentTarget.className = 'sw-pressed';
+ },
+
+ tapCancel: function (e) {
+ e.currentTarget.removeEventListener('touchmove', this, false);
+ e.currentTarget.removeEventListener('touchend', this, false);
+ e.currentTarget.className = '';
+ },
+
+ tapUp: function (e) {
+ this.tapCancel(e);
+
+ if (e.currentTarget.id == 'sw-cancel') {
+ this.cancelAction();
+ } else {
+ this.doneAction();
+ }
+
+ this.close();
+ },
+
+ setCancelAction: function (action) {
+ this.cancelAction = action;
+ },
+
+ setDoneAction: function (action) {
+ this.doneAction = action;
+ },
+
+ cancelAction: function () {
+ return false;
+ },
+
+ cancelDone: function () {
+ return true;
+ }
};
\ No newline at end of file diff --git a/logos/FRANCE 2.png b/logos/FRANCE 2.png Binary files differnew file mode 100644 index 0000000..c77d725 --- /dev/null +++ b/logos/FRANCE 2.png diff --git a/logos/FRANCE 3.png b/logos/FRANCE 3.png Binary files differnew file mode 100644 index 0000000..8f20d16 --- /dev/null +++ b/logos/FRANCE 3.png diff --git a/logos/TF1.png b/logos/TF1.png Binary files differnew file mode 100644 index 0000000..56b1a74 --- /dev/null +++ b/logos/TF1.png diff --git a/logos/nologo.png b/logos/nologo.png Binary files differdeleted file mode 100755 index 7b5b555..0000000 --- a/logos/nologo.png +++ /dev/null diff --git a/logos/readme.txt b/logos/readme.txt deleted file mode 100755 index 7d77d39..0000000 --- a/logos/readme.txt +++ /dev/null @@ -1,3 +0,0 @@ -Put your own channels logo here. -Png format, 80x80 pixel. -Same name than your channels.conf ones. diff --git a/playlist/dummy.txt b/playlist/dummy.txt deleted file mode 100644 index 8b13789..0000000 --- a/playlist/dummy.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/ram/dummy.txt b/ram/dummy.txt deleted file mode 100644 index e69de29..0000000 --- a/ram/dummy.txt +++ /dev/null diff --git a/ram/session1/stream.m3u8 b/ram/session1/stream.m3u8 new file mode 100644 index 0000000..e3f9509 --- /dev/null +++ b/ram/session1/stream.m3u8 @@ -0,0 +1,2 @@ +#TEST +http://alib.hd.free.fr/istreamdev2/ram/session0/stream1.ts diff --git a/ram/session1/thumb.png b/ram/session1/thumb.png Binary files differnew file mode 100644 index 0000000..56b1a74 --- /dev/null +++ b/ram/session1/thumb.png diff --git a/ram/session2/stream.m3u8 b/ram/session2/stream.m3u8 new file mode 100644 index 0000000..e3f9509 --- /dev/null +++ b/ram/session2/stream.m3u8 @@ -0,0 +1,2 @@ +#TEST +http://alib.hd.free.fr/istreamdev2/ram/session0/stream1.ts diff --git a/ram/session2/thumb.png b/ram/session2/thumb.png Binary files differnew file mode 100644 index 0000000..56b1a74 --- /dev/null +++ b/ram/session2/thumb.png diff --git a/ram/session3/stream.m3u8 b/ram/session3/stream.m3u8 new file mode 100644 index 0000000..e3f9509 --- /dev/null +++ b/ram/session3/stream.m3u8 @@ -0,0 +1,2 @@ +#TEST +http://alib.hd.free.fr/istreamdev2/ram/session0/stream1.ts diff --git a/ram/session3/thumb.png b/ram/session3/thumb.png Binary files differnew file mode 100755 index 0000000..92d077a --- /dev/null +++ b/ram/session3/thumb.png diff --git a/ram/temp-logo.png b/ram/temp-logo.png Binary files differnew file mode 100755 index 0000000..92d077a --- /dev/null +++ b/ram/temp-logo.png diff --git a/segmenter/COPYING b/segmenter/COPYING deleted file mode 100644 index d511905..0000000 --- a/segmenter/COPYING +++ /dev/null @@ -1,339 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - <signature of Ty Coon>, 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. diff --git a/segmenter/Makefile b/segmenter/Makefile deleted file mode 100644 index c9ec717..0000000 --- a/segmenter/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -all: - gcc -Wall -g segmenter.c -o segmenter -lavformat -lavcodec -lavutil -lbz2 - -clean: - rm segmenter - -install: segmenter - cp segmenter /usr/local/bin/ - -uninstall: - rm /usr/local/bin/segmenter diff --git a/segmenter/segmenter.c b/segmenter/segmenter.c deleted file mode 100644 index b8cd963..0000000 --- a/segmenter/segmenter.c +++ /dev/null @@ -1,424 +0,0 @@ -/* - * Copyright (c) 2009 Chase Douglas - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version 2 - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -#include <stdlib.h> -#include <stdio.h> -#include <string.h> -#include <sys/types.h> -#include <unistd.h> - -#include "libavformat/avformat.h" - -static AVStream *add_output_stream(AVFormatContext *output_format_context, AVStream *input_stream) { - AVCodecContext *input_codec_context; - AVCodecContext *output_codec_context; - AVStream *output_stream; - - output_stream = av_new_stream(output_format_context, 0); - if (!output_stream) { - fprintf(stderr, "Could not allocate stream\n"); - exit(1); - } - - input_codec_context = input_stream->codec; - output_codec_context = output_stream->codec; - - output_codec_context->codec_id = input_codec_context->codec_id; - output_codec_context->codec_type = input_codec_context->codec_type; - output_codec_context->codec_tag = input_codec_context->codec_tag; - output_codec_context->bit_rate = input_codec_context->bit_rate; - output_codec_context->extradata = input_codec_context->extradata; - output_codec_context->extradata_size = input_codec_context->extradata_size; - - if(av_q2d(input_codec_context->time_base) * input_codec_context->ticks_per_frame > av_q2d(input_stream->time_base) && av_q2d(input_stream->time_base) < 1.0/1000) { - output_codec_context->time_base = input_codec_context->time_base; - output_codec_context->time_base.num *= input_codec_context->ticks_per_frame; - } - else { - output_codec_context->time_base = input_stream->time_base; - } - - switch (input_codec_context->codec_type) { - case CODEC_TYPE_AUDIO: - output_codec_context->channel_layout = input_codec_context->channel_layout; - output_codec_context->sample_rate = input_codec_context->sample_rate; - output_codec_context->channels = input_codec_context->channels; - output_codec_context->frame_size = input_codec_context->frame_size; - if ((input_codec_context->block_align == 1 && input_codec_context->codec_id == CODEC_ID_MP3) || input_codec_context->codec_id == CODEC_ID_AC3) { - output_codec_context->block_align = 0; - } - else { - output_codec_context->block_align = input_codec_context->block_align; - } - break; - case CODEC_TYPE_VIDEO: - output_codec_context->pix_fmt = input_codec_context->pix_fmt; - output_codec_context->width = input_codec_context->width; - output_codec_context->height = input_codec_context->height; - output_codec_context->has_b_frames = input_codec_context->has_b_frames; - - if (output_format_context->oformat->flags & AVFMT_GLOBALHEADER) { - output_codec_context->flags |= CODEC_FLAG_GLOBAL_HEADER; - } - break; - default: - break; - } - - return output_stream; -} - -int write_index_file(const char index[], const char tmp_index[], const unsigned int segment_duration, const char output_prefix[], const char http_prefix[], const unsigned int first_segment, const unsigned int last_segment, const int end, const int window) { - FILE *index_fp; - char *write_buf; - unsigned int i; - - index_fp = fopen(tmp_index, "w"); - if (!index_fp) { - fprintf(stderr, "Could not open temporary m3u8 index file (%s), no index file will be created\n", tmp_index); - return -1; - } - - write_buf = malloc(sizeof(char) * 1024); - if (!write_buf) { - fprintf(stderr, "Could not allocate write buffer for index file, index file will be invalid\n"); - fclose(index_fp); - return -1; - } - - if (window) { - snprintf(write_buf, 1024, "#EXTM3U\n#EXT-X-TARGETDURATION:%u\n#EXT-X-MEDIA-SEQUENCE:%u\n", segment_duration, first_segment); - } - else { - snprintf(write_buf, 1024, "#EXTM3U\n#EXT-X-TARGETDURATION:%u\n", segment_duration); - } - if (fwrite(write_buf, strlen(write_buf), 1, index_fp) != 1) { - fprintf(stderr, "Could not write to m3u8 index file, will not continue writing to index file\n"); - free(write_buf); - fclose(index_fp); - return -1; - } - - for (i = first_segment; i <= last_segment; i++) { - snprintf(write_buf, 1024, "#EXTINF:%u,\n%s%s-%u.ts\n", segment_duration, http_prefix, output_prefix, i); - if (fwrite(write_buf, strlen(write_buf), 1, index_fp) != 1) { - fprintf(stderr, "Could not write to m3u8 index file, will not continue writing to index file\n"); - free(write_buf); - fclose(index_fp); - return -1; - } - } - - if (end) { - snprintf(write_buf, 1024, "#EXT-X-ENDLIST\n"); - if (fwrite(write_buf, strlen(write_buf), 1, index_fp) != 1) { - fprintf(stderr, "Could not write last file and endlist tag to m3u8 index file\n"); - free(write_buf); - fclose(index_fp); - return -1; - } - } - - free(write_buf); - fclose(index_fp); - - return rename(tmp_index, index); -} - -int main(int argc, char **argv) -{ - const char *input; - const char *output_prefix; - double segment_duration; - char *segment_duration_check; - const char *index; - char *tmp_index; - const char *http_prefix; - long max_tsfiles = 0; - char *max_tsfiles_check; - double prev_segment_time = 0; - unsigned int output_index = 1; - AVInputFormat *ifmt; - AVOutputFormat *ofmt; - AVFormatContext *ic = NULL; - AVFormatContext *oc; - AVStream *video_st; - AVStream *audio_st; - AVCodec *codec; - char *output_filename; - char *remove_filename; - int video_index; - int audio_index; - unsigned int first_segment = 1; - unsigned int last_segment = 0; - int write_index = 1; - int decode_done; - char *dot; - int ret; - int i; - int remove_file; - FILE * pid_file; - - if (argc < 6 || argc > 7) { - fprintf(stderr, "Usage: %s <input MPEG-TS file> <segment duration in seconds> <output MPEG-TS file prefix> <output m3u8 index file> <http prefix> [<segment window size>]\n", argv[0]); - exit(1); - } - - // Create PID file - pid_file=fopen("./segmenter.pid", "w"); - if (pid_file) - { - fprintf(pid_file, "%d", getpid()); - fclose(pid_file); - } - - av_register_all(); - - input = argv[1]; - if (!strcmp(input, "-")) { - input = "pipe:"; - } - segment_duration = strtod(argv[2], &segment_duration_check); - if (segment_duration_check == argv[2] || segment_duration == HUGE_VAL || segment_duration == -HUGE_VAL) { - fprintf(stderr, "Segment duration time (%s) invalid\n", argv[2]); - goto error; - } - output_prefix = argv[3]; - index = argv[4]; - http_prefix=argv[5]; - if (argc == 7) { - max_tsfiles = strtol(argv[6], &max_tsfiles_check, 10); - if (max_tsfiles_check == argv[6] || max_tsfiles < 0 || max_tsfiles >= INT_MAX) { - fprintf(stderr, "Maximum number of ts files (%s) invalid\n", argv[6]); - goto error; - } - } - - remove_filename = malloc(sizeof(char) * (strlen(output_prefix) + 15)); - if (!remove_filename) { - fprintf(stderr, "Could not allocate space for remove filenames\n"); - goto error; - } - - output_filename = malloc(sizeof(char) * (strlen(output_prefix) + 15)); - if (!output_filename) { - fprintf(stderr, "Could not allocate space for output filenames\n"); - goto error; - } - - tmp_index = malloc(strlen(index) + 2); - if (!tmp_index) { - fprintf(stderr, "Could not allocate space for temporary index filename\n"); - goto error; - } - - strncpy(tmp_index, index, strlen(index) + 2); - dot = strrchr(tmp_index, '/'); - dot = dot ? dot + 1 : tmp_index; - for (i = strlen(tmp_index) + 1; i > dot - tmp_index; i--) { - tmp_index[i] = tmp_index[i - 1]; - } - *dot = '.'; - - ifmt = av_find_input_format("mpegts"); - if (!ifmt) { - fprintf(stderr, "Could not find MPEG-TS demuxer\n"); - goto error; - } - - ret = av_open_input_file(&ic, input, ifmt, 0, NULL); - if (ret != 0) { - fprintf(stderr, "Could not open input file, make sure it is an mpegts file: %d\n", ret); - goto error; - } - - if (av_find_stream_info(ic) < 0) { - fprintf(stderr, "Could not read stream information\n"); - goto error; - } - - ofmt = guess_format("mpegts", NULL, NULL); - if (!ofmt) { - fprintf(stderr, "Could not find MPEG-TS muxer\n"); - goto error; - } - - oc = avformat_alloc_context(); - if (!oc) { - fprintf(stderr, "Could not allocated output context"); - goto error; - } - oc->oformat = ofmt; - - video_index = -1; - audio_index = -1; - - for (i = 0; i < ic->nb_streams && (video_index < 0 || audio_index < 0); i++) { - switch (ic->streams[i]->codec->codec_type) { - case CODEC_TYPE_VIDEO: - video_index = i; - ic->streams[i]->discard = AVDISCARD_NONE; - video_st = add_output_stream(oc, ic->streams[i]); - break; - case CODEC_TYPE_AUDIO: - audio_index = i; - ic->streams[i]->discard = AVDISCARD_NONE; - audio_st = add_output_stream(oc, ic->streams[i]); - break; - default: - ic->streams[i]->discard = AVDISCARD_ALL; - break; - } - } - - if (av_set_parameters(oc, NULL) < 0) { - fprintf(stderr, "Invalid output format parameters\n"); - goto error; - } - - dump_format(oc, 0, output_prefix, 1); - - codec = avcodec_find_decoder(video_st->codec->codec_id); - if (!codec) { - fprintf(stderr, "Could not find video decoder, key frames will not be honored\n"); - } - - if (avcodec_open(video_st->codec, codec) < 0) { - fprintf(stderr, "Could not open video decoder, key frames will not be honored\n"); - } - - snprintf(output_filename, strlen(output_prefix) + 15, "%s-%u.ts", output_prefix, output_index++); - if (url_fopen(&oc->pb, output_filename, URL_WRONLY) < 0) { - fprintf(stderr, "Could not open '%s'\n", output_filename); - goto error; - } - - if (av_write_header(oc)) { - fprintf(stderr, "Could not write mpegts header to first output file\n"); - goto error; - } - - write_index = !write_index_file(index, tmp_index, segment_duration, output_prefix, http_prefix, first_segment, last_segment, 0, max_tsfiles); - - do { - double segment_time; - AVPacket packet; - - decode_done = av_read_frame(ic, &packet); - if (decode_done < 0) { - break; - } - - if (av_dup_packet(&packet) < 0) { - fprintf(stderr, "Could not duplicate packet"); - av_free_packet(&packet); - break; - } - - if (packet.stream_index == video_index && (packet.flags & PKT_FLAG_KEY)) { - segment_time = (double)video_st->pts.val * video_st->time_base.num / video_st->time_base.den; - } - else if (video_index < 0) { - segment_time = (double)audio_st->pts.val * audio_st->time_base.num / audio_st->time_base.den; - } - else { - segment_time = prev_segment_time; - } - - if (segment_time - prev_segment_time >= segment_duration) { - put_flush_packet(oc->pb); - url_fclose(oc->pb); - - if (max_tsfiles && (int)(last_segment - first_segment) >= max_tsfiles - 1) { - remove_file = 1; - first_segment++; - } - else { - remove_file = 0; - } - - if (write_index) { - write_index = !write_index_file(index, tmp_index, segment_duration, output_prefix, http_prefix, first_segment, ++last_segment, 0, max_tsfiles); - } - - if (remove_file) { - snprintf(remove_filename, strlen(output_prefix) + 15, "%s-%u.ts", output_prefix, first_segment - 1); - remove(remove_filename); - } - - snprintf(output_filename, strlen(output_prefix) + 15, "%s-%u.ts", output_prefix, output_index++); - if (url_fopen(&oc->pb, output_filename, URL_WRONLY) < 0) { - fprintf(stderr, "Could not open '%s'\n", output_filename); - break; - } - - prev_segment_time = segment_time; - } - - ret = av_interleaved_write_frame(oc, &packet); - if (ret < 0) { - fprintf(stderr, "Warning: Could not write frame of stream\n"); - } - else if (ret > 0) { - fprintf(stderr, "End of stream requested\n"); - av_free_packet(&packet); - break; - } - - av_free_packet(&packet); - } while (!decode_done); - - av_write_trailer(oc); - - avcodec_close(video_st->codec); - - for(i = 0; i < oc->nb_streams; i++) { - av_freep(&oc->streams[i]->codec); - av_freep(&oc->streams[i]); - } - - url_fclose(oc->pb); - av_free(oc); - - if (max_tsfiles && (int)(last_segment - first_segment) >= max_tsfiles - 1) { - remove_file = 1; - first_segment++; - } - else { - remove_file = 0; - } - - if (write_index) { - write_index_file(index, tmp_index, segment_duration, output_prefix, http_prefix, first_segment, ++last_segment, 1, max_tsfiles); - } - - if (remove_file) { - snprintf(remove_filename, strlen(output_prefix) + 15, "%s-%u.ts", output_prefix, first_segment - 1); - remove(remove_filename); - } - - remove("./segmenter.pid"); - - return 0; - -error: - remove("./segmenter.pid"); - - return 1; - -} - -// vim:sw=4:tw=4:ts=4:ai:expandtab diff --git a/streamstatus.php b/streamstatus.php deleted file mode 100755 index 3189afe..0000000 --- a/streamstatus.php +++ /dev/null @@ -1,47 +0,0 @@ -<?php - -if (file_exists('config.php')) - include ('config.php'); -else - include ('config_default.php'); - -global $maxencodingprocesses; - -header('Content-Type: text/xml'); -echo "<?xml version=\"1.0\"?>\n"; - -echo "<status>\n"; - -$session = $_REQUEST['session']; - -exec('echo ' .$session .' >/tmp/aa'); - -// First check that we are allowed to create a new encoding process -if (($session == "") || !count(glob('ram/' .$session))) -{ - $nbencprocess = exec("find ram/ -name segmenter.pid | wc | awk '{ print $1 }'"); - - if ($nbencprocess >= $maxencodingprocesses) - echo "<streamstatus>error</streamstatus><message>Error: maximun number of sessions reached</message>\n"; - else - echo "<streamstatus>error</streamstatus><message>Error: cannot create session</message>\n"; -} -else -{ - $cnt = 0; - while ( ( count(glob('ram/' .$session . '/*.ts')) < 2 ) && ( $cnt < 25 ) ) - { - // wait for stream available - sleep(1); - $cnt++; - } - - if ( count(glob('ram/' .$session . '/*.ts')) < 2 ) - echo "<streamstatus>error</streamstatus><message>Error: encoding did not start correctly</message>\n"; - else - echo "<streamstatus>ok</streamstatus>\n"; -} - -echo "</status>\n"; - -?> diff --git a/themes/.svn/all-wcprops b/themes/.svn/all-wcprops new file mode 100644 index 0000000..4e643fd --- /dev/null +++ b/themes/.svn/all-wcprops @@ -0,0 +1,5 @@ +K 25
+svn:wc:ra_dav:version-url
+V 30
+/svn/!svn/ver/133/trunk/themes
+END
diff --git a/themes/.svn/entries b/themes/.svn/entries new file mode 100644 index 0000000..8dd097d --- /dev/null +++ b/themes/.svn/entries @@ -0,0 +1,34 @@ +10
+
+dir
+133
+http://jqtouch.googlecode.com/svn/trunk/themes
+http://jqtouch.googlecode.com/svn
+
+
+
+2010-01-15T21:08:54.001495Z
+133
+RBoulanouar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+210952ee-217a-11de-8f7e-2b794b28c5cd
+
+apple
+dir
+
+jqt
+dir
+
diff --git a/themes/apple/.svn/all-wcprops b/themes/apple/.svn/all-wcprops new file mode 100644 index 0000000..e9ce505 --- /dev/null +++ b/themes/apple/.svn/all-wcprops @@ -0,0 +1,11 @@ +K 25
+svn:wc:ra_dav:version-url
+V 36
+/svn/!svn/ver/133/trunk/themes/apple
+END
+theme.css
+K 25
+svn:wc:ra_dav:version-url
+V 46
+/svn/!svn/ver/133/trunk/themes/apple/theme.css
+END
diff --git a/themes/apple/.svn/entries b/themes/apple/.svn/entries new file mode 100644 index 0000000..784f5ef --- /dev/null +++ b/themes/apple/.svn/entries @@ -0,0 +1,65 @@ +10
+
+dir
+133
+http://jqtouch.googlecode.com/svn/trunk/themes/apple
+http://jqtouch.googlecode.com/svn
+
+
+
+2010-01-15T21:08:54.001495Z
+133
+RBoulanouar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+210952ee-217a-11de-8f7e-2b794b28c5cd
+
+theme.css
+file
+
+
+
+
+2010-03-04T14:47:56.243073Z
+8c8fb5a689b7a0c55aca13d7a1643151
+2010-01-15T21:08:54.001495Z
+133
+RBoulanouar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+14938
+
+img
+dir
+
diff --git a/themes/apple/.svn/text-base/theme.css.svn-base b/themes/apple/.svn/text-base/theme.css.svn-base new file mode 100644 index 0000000..dbbb4dc --- /dev/null +++ b/themes/apple/.svn/text-base/theme.css.svn-base @@ -0,0 +1,727 @@ +body, #jqt { + background: rgb(0,0,0); +} + +body > *, #jqt > * { + background: rgb(197,204,211) url(img/pinstripes.png); +} + +#jqt h1, #jqt h2 { + font: bold 18px "Helvetica Neue", Helvetica; + text-shadow: rgba(255,255,255,.2) 0 1px 1px; + color: rgb(76, 86, 108); + margin: 10px 20px 6px; +} + +/* @group Toolbar */ + +#jqt .toolbar { + -webkit-box-sizing: border-box; + border-bottom: 1px solid #2d3642; + padding: 10px; + height: 45px; + background: url(img/toolbar.png) #6d84a2 repeat-x; + position: relative; +} + +#jqt .black-translucent .toolbar { + margin-top: 20px; +} + +div#jqt .toolbar > h1 { + position: absolute; + overflow: hidden; + left: 50%; + top: 10px; + line-height: 1em; + margin: 1px 0 0 -75px; + height: 40px; + font-size: 20px; + width: 150px; + font-weight: bold; + text-shadow: rgba(0, 0, 0, 0.4) 0px -1px 0; + text-align: center; + text-overflow: ellipsis; + white-space: nowrap; + color: #fff; +} + +div#jqt.landscape .toolbar > h1 { + margin-left: -125px; + width: 250px; +} + +#jqt .button, #jqt .back, #jqt .cancel, #jqt .add { + position: absolute; + overflow: hidden; + top: 8px; + right: 6px; + margin: 0; + border-width: 0 5px; + padding: 0 3px; + width: auto; + height: 30px; + line-height: 30px; + font-family: inherit; + font-size: 12px; + font-weight: bold; + color: #fff; + text-shadow: rgba(0, 0, 0, 0.5) 0px -1px 0; + text-overflow: ellipsis; + text-decoration: none; + white-space: nowrap; + background: none; + -webkit-border-image: url(img/toolButton.png) 0 5 0 5; +} + +#jqt .button.active, #jqt .cancel.active, #jqt .add.active { + -webkit-border-image: url(img/toolButton.png) 0 5 0 5; +} + +#jqt .blueButton { + -webkit-border-image: url(img/actionButton.png) 0 5 0 5; + border-width: 0 5px; +} + +#jqt .back { + left: 6px; + right: auto; + padding: 0; + max-width: 55px; + border-width: 0 8px 0 14px; + -webkit-border-image: url(img/backButton.png) 0 8 0 14; +} + +#jqt .back.active { + -webkit-border-image: url(img/backButton.png) 0 8 0 14; +} + +#jqt .leftButton, #jqt .cancel { + left: 6px; + right: auto; +} + +#jqt .add { + font-size: 24px; + line-height: 24px; + font-weight: bold; +} + +#jqt .whiteButton, +#jqt .grayButton, #jqt .redButton, #jqt .blueButton, #jqt .greenButton { + display: block; + border-width: 0 12px; + padding: 10px; + text-align: center; + font-size: 20px; + font-weight: bold; + text-decoration: inherit; + color: inherit; +} + +#jqt .whiteButton.active, #jqt .grayButton.active, #jqt .redButton.active, #jqt .blueButton.active, #jqt .greenButton.active, +#jqt .whiteButton:active, #jqt .grayButton:active, #jqt .redButton:active, #jqt .blueButton:active, #jqt .greenButton:active { + -webkit-border-image: url(img/activeButton.png) 0 12 0 12; +} + +#jqt .whiteButton { + -webkit-border-image: url(img/whiteButton.png) 0 12 0 12; + text-shadow: rgba(255, 255, 255, 0.7) 0 1px 0; +} + +#jqt .grayButton { + -webkit-border-image: url(img/grayButton.png) 0 12 0 12; + color: #FFFFFF; +} + +#jqt .redButton { + -webkit-border-image: url(img/redButton.png) 0 12 0 12; + color: #FFFFFF; +} + +#jqt .greenButton { + -webkit-border-image: url(img/greenButton.png) 0 12 0 12; + color: #FFFFFF; +} + +/* @end */ + +/* @group Lists */ + +#jqt h1 + ul, #jqt h2 + ul, #jqt h3 + ul, #jqt h4 + ul, #jqt h5 + ul, #jqt h6 + ul { + margin-top: 0; +} + +#jqt ul { + color: black; + background: #fff; + border: 1px solid #B4B4B4; + font: bold 17px "Helvetica Neue", Helvetica; + padding: 0; + margin: 15px 10px 17px 10px; + -webkit-border-radius: 8px; +} + +#jqt ul li { + color: #666; + border-top: 1px solid #B4B4B4; + list-style-type: none; + padding: 10px 10px 10px 10px; +} + +/* when you have a first LI item on any list */ + +#jqt li:first-child, #jqt li:first-child a { + border-top: 0; + -webkit-border-top-left-radius: 8px; + -webkit-border-top-right-radius: 8px; +} + +#jqt li:last-child, #jqt li:last-child a { + -webkit-border-bottom-left-radius: 8px; + -webkit-border-bottom-right-radius: 8px; +} + +/* universal arrows */ + +#jqt ul li.arrow { + background-image: url(img/chevron.png); + background-position: right center; + background-repeat: no-repeat; +} + +#jqt ul li.arrow a { + padding: 12px 22px 12px 10px; +} + +#jqt #plastic ul li.arrow, #jqt #metal ul li.arrow { + background-image: url(../images/chevron_dg.png); + background-position: right center; + background-repeat: no-repeat; +} + +/* universal links on list */ + +#jqt ul li a, #jqt li.img a + a { + color: #000; + text-decoration: none; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; + display: block; + padding: 12px 10px 12px 10px; + margin: -10px; + -webkit-tap-highlight-color: rgba(0,0,0,0); +} + +#jqt ul li a.active { + background: #194fdb url(img/selection.png) 0 0 repeat-x; + color: #fff; +} + +#jqt ul li a.button { + background-color: #194fdb; + color: #fff; +} + +#jqt ul li.img a + a { + margin: -10px 10px -20px -5px; + font-size: 17px; + font-weight: bold; +} + +#jqt ul li.img a + a + a { + font-size: 14px; + font-weight: normal; + margin-left: -10px; + margin-bottom: -10px; + margin-top: 0; +} + +#jqt ul li.img a + small + a { + margin-left: -5px; +} + +#jqt ul li.img a + small + a + a { + margin-left: -10px; + margin-top: -20px; + margin-bottom: -10px; + font-size: 14px; + font-weight: normal; +} + +#jqt ul li.img a + small + a + a + a { + margin-left: 0px !important; + margin-bottom: 0; +} + +#jqt ul li a + a { + color: #000; + font: 14px "Helvetica Neue", Helvetica; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; + display: block; + margin: 0; + padding: 0; +} + +#jqt ul li a + a + a, #jqt ul li.img a + a + a + a, #jqt ul li.img a + small + a + a + a { + color: #666; + font: 13px "Helvetica Neue", Helvetica; + margin: 0; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; + display: block; + padding: 0; +} + +/* +@end */ + +/* @group Forms */ + +#jqt ul.form li { + padding: 7px 10px; +} + +#jqt ul.form li.error { + border: 2px solid red; +} + +#jqt ul.form li.error + li.error { + border-top: 0; +} + +#jqt ul.form li:hover { + background: #fff; +} + +#jqt ul li input[type="text"], +#jqt ul li input[type="password"], +#jqt ul li input[type="tel"], +#jqt ul li input[type="number"], +#jqt ul li input[type="search"], +#jqt ul li input[type="email"], +#jqt ul li input[type="url"], +#jqt ul li textarea, +#jqt ul li select { + color: #777; + background: #fff url('data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=='); + border: 0; + font: normal 17px "Helvetica Neue", Helvetica; + padding: 0; + display: inline-block; + margin-left: 0px; + width: 100%; + -webkit-appearance: textarea; +} + +#jqt ul li textarea { + height: 120px; + padding: 0; + text-indent: -2px; +} + +#jqt ul li select { + text-indent: 0px; + background: transparent url(../images/chevron.png) no-repeat 103% 3px; + -webkit-appearance: textfield; + margin-left: -6px; + width: 104%; +} + +#jqt ul li input[type="checkbox"], #jqt ul li input[type="radio"] { + margin: 0; + color: rgb(50,79,133); + padding: 10px 10px; +} + +#jqt ul li input[type="checkbox"]:after, #jqt ul li input[type="radio"]:after { + content: attr(title); + font: 17px "Helvetica Neue", Helvetica; + display: block; + width: 246px; + margin: -12px 0 0 17px; +} + +/* @end */ + +/* @group Edge to edge */ +#jqt ul.edgetoedge { + -webkit-border-radius: 0; +} + +#jqt ul.edgetoedge li.sep { + background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgba(139, 159, 171, 1)), to(rgba(181, 193, 201, 1.0))); + border-bottom: 1px solid #b5c1c9; + border-top: 1px solid #b5c1c9; + color: #fff; + font-size: 16px; + margin: 1px 0 0 0; + padding: 2px 10px; + text-shadow: #636a6f 0 1px 0; +} + +#jqt .edgetoedge h4 { + color: #fff; + background: rgb(154,159,170) url(img/listGroup.png) top left repeat-x; + border-top: 1px solid rgb(165,177,186); + text-shadow: #666 0 1px 0; + margin: 0; + padding: 2px 10px; +} + +#jqt .edgetoedge, #jqt .metal { + margin: 0; + padding: 0; + background-color: rgb(255,255,255); +} + +#jqt .edgetoedge ul, #jqt .metal ul, #jqt .plastic ul { + -webkit-border-radius: 0; + margin: 0; + border-left: 0; + border-right: 0; + border-top: 0; +} + +#jqt .metal ul { + border-top: 0; + border-bottom: 0; + background: rgb(180,180,180); +} + +#jqt .edgetoedge ul li:first-child, +#jqt .edgetoedge ul li:first-child a, +#jqt .edgetoedge ul li:last-child, +#jqt .edgetoedge ul li:last-child a, +#jqt .metal ul li:first-child a, +#jqt .metal ul li:last-child a { + -webkit-border-radius: 0; +} + +#jqt .edgetoedge ul li small { + font-size: 16px; + line-height: 28px; +} + +#jqt .edgetoedge li, #jqt .metal li { + -webkit-border-radius: 0; +} + +#jqt .edgetoedge li em { + font-weight: normal; + font-style: normal; +} + +#jqt .edgetoedge h4 + ul { + border-top: 1px solid rgb(152,158,164); + border-bottom: 1px solid rgb(113,125,133); +} + +/* @end */ + +/* @group Mini Label */ + +#jqt ul li small { + color: #369; + font: 17px "Helvetica Neue", Helvetica; + text-align: right; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; + display: block; + width: 23%; + float: right; + padding: 3px 0px; +} + +#jqt ul li.arrow small { + padding: 0 15px; +} + +#jqt ul li small.counter { + font-size: 17px !important; + line-height: 13px !important; + font-weight: bold; + background: rgb(154,159,170); + color: #fff; + -webkit-border-radius: 11px; + padding: 4px 10px 5px 10px; + display: inline !important; + width: auto; + margin-top: -22px; +} + +#jqt ul li.arrow small.counter { + margin-right: 15px; +} + +/* @end */ + +/* @group Plastic */ + +#jqt #plastic ul li.arrow, #jqt #metal ul li.arrow { + background-image: url(img/listArrow.png); + background-position: right center; + background-repeat: no-repeat; +} + +#jqt .edgetoedge ul, #jqt .metal ul, #jqt .plastic ul { + -webkit-border-radius: 0; + margin: 0; + border-left: 0; + border-right: 0; + border-top: 0; +} + +#jqt .metal ul li { + border-top: 1px solid rgb(238,238,238); + border-bottom: 1px solid rgb(156,158,165); + background: url(../images/bgMetal.png) top left repeat-x; + font-size: 26px; + text-shadow: #fff 0 1px 0; +} + +#jqt .metal ul li a { + line-height: 26px; + margin: 0; + padding: 13px 0; +} + +#jqt .metal ul li a:hover { + color: rgb(0,0,0); +} + +#jqt .metal ul li:hover small { + color: inherit; +} + +#jqt .metal ul li a em { + display: block; + font-size: 14px; + font-style: normal; + color: #444; + width: 50%; + line-height: 14px; +} + +#jqt .metal ul li small { + float: right; + position: relative; + margin-top: 10px; + font-weight: bold; +} + +#jqt .metal ul li.arrow a small { + padding-right: 0; + line-height: 17px; +} + +#jqt .metal ul li.arrow { + background: url(../images/bgMetal.png) top left repeat-x, + url(../images/chevron_dg.png) right center no-repeat; +} + +#jqt .plastic { + margin: 0; + padding: 0; + background: rgb(173,173,173); +} + +#jqt .plastic ul { + -webkit-border-radius: 0; + margin: 0; + border-left: 0; + border-right: 0; + border-top: 0; + background-color: rgb(173,173,173); +} + +#jqt .plastic ul li { + -webkit-border-radius: 0; + border-top: 1px solid rgb(191,191,191); + border-bottom: 1px solid rgb(157,157,157); +} + +#jqt .plastic ul li:nth-child(odd) { + background-color: rgb(152,152,152); + border-top: 1px solid rgb(181,181,181); + border-bottom: 1px solid rgb(138,138,138); +} + +#jqt .plastic ul + p { + font-size: 11px; + color: #2f3237; + text-shadow: none; + padding: 10px 10px; +} + +#jqt .plastic ul + p strong { + font-size: 14px; + line-height: 18px; + text-shadow: #fff 0 1px 0; +} + +#jqt .plastic ul li a { + text-shadow: rgb(211,211,211) 0 1px 0; +} + +#jqt .plastic ul li:nth-child(odd) a { + text-shadow: rgb(191,191,191) 0 1px 0; +} + +#jqt .plastic ul li small { + color: #3C3C3C; + text-shadow: rgb(211,211,211) 0 1px 0; + font-size: 13px; + font-weight: bold; + text-transform: uppercase; + line-height: 24px; +} + +#jqt #plastic ul.minibanner, #jqt #plastic ul.bigbanner { + margin: 10px; + border: 0; + height: 81px; + clear: both; +} + +#jqt #plastic ul.bigbanner { + height: 140px !important; +} + +#jqt #plastic ul.minibanner li { + border: 1px solid rgb(138,138,138); + background-color: rgb(152,152,152); + width: 145px; + height: 81px; + float: left; + -webkit-border-radius: 5px; + padding: 0; +} + +#jqt #plastic ul.bigbanner li { + border: 1px solid rgb(138,138,138); + background-color: rgb(152,152,152); + width: 296px; + height: 140px; + float: left; + -webkit-border-radius: 5px; + padding: 0; + margin-bottom: 4px; +} + +#jqt #plastic ul.minibanner li:first-child { + margin-right: 6px; +} + +#jqt #plastic ul.minibanner li a { + color: transparent; + text-shadow: none; + display: block; + width: 145px; + height: 81px; +} + +#jqt #plastic ul.bigbanner li a { + color: transparent; + text-shadow: none; + display: block; + width: 296px; + height: 145px; +} + +/* @end */ + +/* @group Individual */ + +#jqt ul.individual { + border: 0; + background: none; + clear: both; + overflow: hidden; +} + +#jqt ul.individual li { + color: rgb(183,190,205); + background: white; + border: 1px solid rgb(180,180,180); + font-size: 14px; + text-align: center; + -webkit-border-radius: 8px; + -webkit-box-sizing: border-box; + width: 48%; + float: left; + display: block; + padding: 11px 10px 14px 10px; +} + +#jqt ul.individual li + li { + float: right; +} + +#jqt ul.individual li a { + color: rgb(50,79,133); + line-height: 16px; + margin: -11px -10px -14px -10px; + padding: 11px 10px 14px 10px; + -webkit-border-radius: 8px; +} + +#jqt ul.individual li a:hover { + color: #fff; + background: #36c; +} + +/* @end */ + +/* @group Toggle */ + + +#jqt .toggle { + width: 94px; + position: relative; + height: 27px; + display: block; + overflow: hidden; + float: right; +} + +#jqt .toggle input[type="checkbox"]:checked { + left: 0px; +} + +#jqt .toggle input[type="checkbox"] { + -webkit-tap-highlight-color: rgba(0,0,0,0); + margin: 0; + -webkit-border-radius: 5px; + background: #fff url(img/on_off.png) 0 0 no-repeat; + height: 27px; + overflow: hidden; + width: 149px; + border: 0; + -webkit-appearance: textarea; + background-color: transparent; + -webkit-transition: left .15s; + position: absolute; + top: 0; + left: -55px; +} +/* @end */ + + + +#jqt .info { + background: #dce1eb; + font-size: 12px; + line-height: 16px; + text-align: center; + text-shadow: rgba(255,255,255,.8) 0 1px 0; + color: rgb(76, 86, 108); + padding: 15px; + border-top: 1px solid rgba(76, 86, 108, .3); + font-weight: bold; +} diff --git a/themes/apple/img/.svn/all-wcprops b/themes/apple/img/.svn/all-wcprops new file mode 100644 index 0000000..0f667ce --- /dev/null +++ b/themes/apple/img/.svn/all-wcprops @@ -0,0 +1,119 @@ +K 25
+svn:wc:ra_dav:version-url
+V 40
+/svn/!svn/ver/115/trunk/themes/apple/img
+END
+greenButton.png
+K 25
+svn:wc:ra_dav:version-url
+V 56
+/svn/!svn/ver/115/trunk/themes/apple/img/greenButton.png
+END
+backButton.png
+K 25
+svn:wc:ra_dav:version-url
+V 54
+/svn/!svn/ver/57/trunk/themes/apple/img/backButton.png
+END
+grayButton.png
+K 25
+svn:wc:ra_dav:version-url
+V 53
+/svn/!svn/ver/9/trunk/themes/apple/img/grayButton.png
+END
+loading.gif
+K 25
+svn:wc:ra_dav:version-url
+V 50
+/svn/!svn/ver/9/trunk/themes/apple/img/loading.gif
+END
+pinstripes.png
+K 25
+svn:wc:ra_dav:version-url
+V 53
+/svn/!svn/ver/9/trunk/themes/apple/img/pinstripes.png
+END
+toolbar.png
+K 25
+svn:wc:ra_dav:version-url
+V 51
+/svn/!svn/ver/57/trunk/themes/apple/img/toolbar.png
+END
+chevron.png
+K 25
+svn:wc:ra_dav:version-url
+V 51
+/svn/!svn/ver/51/trunk/themes/apple/img/chevron.png
+END
+on_off.png
+K 25
+svn:wc:ra_dav:version-url
+V 50
+/svn/!svn/ver/57/trunk/themes/apple/img/on_off.png
+END
+redButton.png
+K 25
+svn:wc:ra_dav:version-url
+V 54
+/svn/!svn/ver/115/trunk/themes/apple/img/redButton.png
+END
+actionButton.png
+K 25
+svn:wc:ra_dav:version-url
+V 57
+/svn/!svn/ver/115/trunk/themes/apple/img/actionButton.png
+END
+toolButton.png
+K 25
+svn:wc:ra_dav:version-url
+V 54
+/svn/!svn/ver/57/trunk/themes/apple/img/toolButton.png
+END
+whiteButton.png
+K 25
+svn:wc:ra_dav:version-url
+V 54
+/svn/!svn/ver/9/trunk/themes/apple/img/whiteButton.png
+END
+toggleOn.png
+K 25
+svn:wc:ra_dav:version-url
+V 51
+/svn/!svn/ver/9/trunk/themes/apple/img/toggleOn.png
+END
+thumb.png
+K 25
+svn:wc:ra_dav:version-url
+V 49
+/svn/!svn/ver/57/trunk/themes/apple/img/thumb.png
+END
+toggle.png
+K 25
+svn:wc:ra_dav:version-url
+V 49
+/svn/!svn/ver/9/trunk/themes/apple/img/toggle.png
+END
+selection.png
+K 25
+svn:wc:ra_dav:version-url
+V 52
+/svn/!svn/ver/9/trunk/themes/apple/img/selection.png
+END
+cancel.png
+K 25
+svn:wc:ra_dav:version-url
+V 49
+/svn/!svn/ver/9/trunk/themes/apple/img/cancel.png
+END
+listGroup.png
+K 25
+svn:wc:ra_dav:version-url
+V 53
+/svn/!svn/ver/57/trunk/themes/apple/img/listGroup.png
+END
+listArrowSel.png
+K 25
+svn:wc:ra_dav:version-url
+V 55
+/svn/!svn/ver/9/trunk/themes/apple/img/listArrowSel.png
+END
diff --git a/themes/apple/img/.svn/entries b/themes/apple/img/.svn/entries new file mode 100644 index 0000000..19622c8 --- /dev/null +++ b/themes/apple/img/.svn/entries @@ -0,0 +1,674 @@ +10
+
+dir
+133
+http://jqtouch.googlecode.com/svn/trunk/themes/apple/img
+http://jqtouch.googlecode.com/svn
+
+
+
+2009-10-25T08:00:04.365941Z
+115
+davidcolbykaneda
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+210952ee-217a-11de-8f7e-2b794b28c5cd
+
+greenButton.png
+file
+
+
+
+
+2010-03-04T14:47:56.238073Z
+e77d96f3d42207c60248c958513177d7
+2009-10-25T08:00:04.365941Z
+115
+davidcolbykaneda
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+1935
+
+backButton.png
+file
+
+
+
+
+2010-03-04T14:47:56.238073Z
+dd5d1b2178d7f29c6988c7b351374865
+2009-09-03T18:03:08.814593Z
+57
+davidcolbykaneda
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+783
+
+grayButton.png
+file
+
+
+
+
+2010-03-04T14:47:56.238073Z
+1041b36eaff6868d89453dac81019839
+2009-04-11T19:17:40.360466Z
+6
+david@dyadcom.com
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+943
+
+loading.gif
+file
+
+
+
+
+2010-03-04T14:47:56.238073Z
+da76e45dd725f984f0fb5fd7fa6b5ed0
+2009-04-11T19:17:40.360466Z
+6
+david@dyadcom.com
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+1435
+
+pinstripes.png
+file
+
+
+
+
+2010-03-04T14:47:56.239073Z
+4083fe1c4e14f5ddd0ba98ac6c55e6af
+2009-04-11T19:17:40.360466Z
+6
+david@dyadcom.com
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+117
+
+toolbar.png
+file
+
+
+
+
+2010-03-04T14:47:56.239073Z
+2e759fec57af1684c18be5ebb4baa329
+2009-09-03T18:03:08.814593Z
+57
+davidcolbykaneda
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+168
+
+chevron.png
+file
+
+
+
+
+2010-03-04T14:47:56.239073Z
+3d059e6b6957c1be7a1bfdb4316776e6
+2009-08-31T02:22:55.434267Z
+51
+davidcolbykaneda
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+259
+
+on_off.png
+file
+
+
+
+
+2010-03-04T14:47:56.239073Z
+71f37708819cfac4c2d575ca5d03e587
+2009-09-03T18:03:08.814593Z
+57
+davidcolbykaneda
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+2634
+
+redButton.png
+file
+
+
+
+
+2010-03-04T14:47:56.239073Z
+c0c9af820d6172e61bd6a8f4cf9c7057
+2009-10-25T08:00:04.365941Z
+115
+davidcolbykaneda
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+1927
+
+actionButton.png
+file
+
+
+
+
+2010-03-04T14:47:56.240073Z
+d3da8bf9621bdc92397d51c96b495eac
+2009-10-25T08:00:04.365941Z
+115
+davidcolbykaneda
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+517
+
+toolButton.png
+file
+
+
+
+
+2010-03-04T14:47:56.240073Z
+98ca7468d06352b351b6ad50b4c23444
+2009-09-03T18:03:08.814593Z
+57
+davidcolbykaneda
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+521
+
+whiteButton.png
+file
+
+
+
+
+2010-03-04T14:47:56.240073Z
+17f06c4431d610ecac4361df5845b817
+2009-04-11T19:17:40.360466Z
+6
+david@dyadcom.com
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+978
+
+toggleOn.png
+file
+
+
+
+
+2010-03-04T14:47:56.240073Z
+d3660086fd6ac805dccaef5339633b64
+2009-04-11T19:17:40.360466Z
+6
+david@dyadcom.com
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+163
+
+thumb.png
+file
+
+
+
+
+2010-03-04T14:47:56.241073Z
+65de250b1baccedd8b81fa338c8627fe
+2009-09-03T18:03:08.814593Z
+57
+davidcolbykaneda
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+2834
+
+toggle.png
+file
+
+
+
+
+2010-03-04T14:47:56.241073Z
+bdebeb51c0c12ae443b9eb770fbb9bbe
+2009-04-11T19:17:40.360466Z
+6
+david@dyadcom.com
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+2815
+
+selection.png
+file
+
+
+
+
+2010-03-04T14:47:56.241073Z
+af582c91abf093b4a7648de3ed1496da
+2009-04-11T19:17:40.360466Z
+6
+david@dyadcom.com
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+159
+
+cancel.png
+file
+
+
+
+
+2010-03-04T14:47:56.241073Z
+47e9de7efdc94a42890a57d7b952128f
+2009-04-11T19:17:40.360466Z
+6
+david@dyadcom.com
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+362
+
+listGroup.png
+file
+
+
+
+
+2010-03-04T14:47:56.242073Z
+38a0ce9de336bcb064d79ea28223a692
+2009-09-03T18:03:08.814593Z
+57
+davidcolbykaneda
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+2863
+
+listArrowSel.png
+file
+
+
+
+
+2010-03-04T14:47:56.242073Z
+2f3cce7337192817acdf1c7bd533912a
+2009-04-11T19:17:40.360466Z
+6
+david@dyadcom.com
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+308
+
diff --git a/themes/apple/img/.svn/prop-base/actionButton.png.svn-base b/themes/apple/img/.svn/prop-base/actionButton.png.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/themes/apple/img/.svn/prop-base/actionButton.png.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/themes/apple/img/.svn/prop-base/backButton.png.svn-base b/themes/apple/img/.svn/prop-base/backButton.png.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/themes/apple/img/.svn/prop-base/backButton.png.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/themes/apple/img/.svn/prop-base/cancel.png.svn-base b/themes/apple/img/.svn/prop-base/cancel.png.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/themes/apple/img/.svn/prop-base/cancel.png.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/themes/apple/img/.svn/prop-base/chevron.png.svn-base b/themes/apple/img/.svn/prop-base/chevron.png.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/themes/apple/img/.svn/prop-base/chevron.png.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/themes/apple/img/.svn/prop-base/grayButton.png.svn-base b/themes/apple/img/.svn/prop-base/grayButton.png.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/themes/apple/img/.svn/prop-base/grayButton.png.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/themes/apple/img/.svn/prop-base/greenButton.png.svn-base b/themes/apple/img/.svn/prop-base/greenButton.png.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/themes/apple/img/.svn/prop-base/greenButton.png.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/themes/apple/img/.svn/prop-base/listArrowSel.png.svn-base b/themes/apple/img/.svn/prop-base/listArrowSel.png.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/themes/apple/img/.svn/prop-base/listArrowSel.png.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/themes/apple/img/.svn/prop-base/listGroup.png.svn-base b/themes/apple/img/.svn/prop-base/listGroup.png.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/themes/apple/img/.svn/prop-base/listGroup.png.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/themes/apple/img/.svn/prop-base/loading.gif.svn-base b/themes/apple/img/.svn/prop-base/loading.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/themes/apple/img/.svn/prop-base/loading.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/themes/apple/img/.svn/prop-base/on_off.png.svn-base b/themes/apple/img/.svn/prop-base/on_off.png.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/themes/apple/img/.svn/prop-base/on_off.png.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/themes/apple/img/.svn/prop-base/pinstripes.png.svn-base b/themes/apple/img/.svn/prop-base/pinstripes.png.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/themes/apple/img/.svn/prop-base/pinstripes.png.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/themes/apple/img/.svn/prop-base/redButton.png.svn-base b/themes/apple/img/.svn/prop-base/redButton.png.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/themes/apple/img/.svn/prop-base/redButton.png.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/themes/apple/img/.svn/prop-base/selection.png.svn-base b/themes/apple/img/.svn/prop-base/selection.png.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/themes/apple/img/.svn/prop-base/selection.png.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/themes/apple/img/.svn/prop-base/thumb.png.svn-base b/themes/apple/img/.svn/prop-base/thumb.png.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/themes/apple/img/.svn/prop-base/thumb.png.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/themes/apple/img/.svn/prop-base/toggle.png.svn-base b/themes/apple/img/.svn/prop-base/toggle.png.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/themes/apple/img/.svn/prop-base/toggle.png.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/themes/apple/img/.svn/prop-base/toggleOn.png.svn-base b/themes/apple/img/.svn/prop-base/toggleOn.png.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/themes/apple/img/.svn/prop-base/toggleOn.png.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/themes/apple/img/.svn/prop-base/toolButton.png.svn-base b/themes/apple/img/.svn/prop-base/toolButton.png.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/themes/apple/img/.svn/prop-base/toolButton.png.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/themes/apple/img/.svn/prop-base/toolbar.png.svn-base b/themes/apple/img/.svn/prop-base/toolbar.png.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/themes/apple/img/.svn/prop-base/toolbar.png.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/themes/apple/img/.svn/prop-base/whiteButton.png.svn-base b/themes/apple/img/.svn/prop-base/whiteButton.png.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/themes/apple/img/.svn/prop-base/whiteButton.png.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/themes/apple/img/.svn/text-base/actionButton.png.svn-base b/themes/apple/img/.svn/text-base/actionButton.png.svn-base Binary files differnew file mode 100644 index 0000000..0f92dfd --- /dev/null +++ b/themes/apple/img/.svn/text-base/actionButton.png.svn-base diff --git a/themes/apple/img/.svn/text-base/backButton.png.svn-base b/themes/apple/img/.svn/text-base/backButton.png.svn-base Binary files differnew file mode 100644 index 0000000..935f914 --- /dev/null +++ b/themes/apple/img/.svn/text-base/backButton.png.svn-base diff --git a/themes/apple/img/.svn/text-base/cancel.png.svn-base b/themes/apple/img/.svn/text-base/cancel.png.svn-base Binary files differnew file mode 100644 index 0000000..5f6dcc8 --- /dev/null +++ b/themes/apple/img/.svn/text-base/cancel.png.svn-base diff --git a/themes/apple/img/.svn/text-base/chevron.png.svn-base b/themes/apple/img/.svn/text-base/chevron.png.svn-base Binary files differnew file mode 100644 index 0000000..6421a16 --- /dev/null +++ b/themes/apple/img/.svn/text-base/chevron.png.svn-base diff --git a/themes/apple/img/.svn/text-base/grayButton.png.svn-base b/themes/apple/img/.svn/text-base/grayButton.png.svn-base Binary files differnew file mode 100644 index 0000000..0ce6a30 --- /dev/null +++ b/themes/apple/img/.svn/text-base/grayButton.png.svn-base diff --git a/themes/apple/img/.svn/text-base/greenButton.png.svn-base b/themes/apple/img/.svn/text-base/greenButton.png.svn-base Binary files differnew file mode 100644 index 0000000..a45594b --- /dev/null +++ b/themes/apple/img/.svn/text-base/greenButton.png.svn-base diff --git a/themes/apple/img/.svn/text-base/listArrowSel.png.svn-base b/themes/apple/img/.svn/text-base/listArrowSel.png.svn-base Binary files differnew file mode 100644 index 0000000..86832eb --- /dev/null +++ b/themes/apple/img/.svn/text-base/listArrowSel.png.svn-base diff --git a/themes/apple/img/.svn/text-base/listGroup.png.svn-base b/themes/apple/img/.svn/text-base/listGroup.png.svn-base Binary files differnew file mode 100644 index 0000000..567d858 --- /dev/null +++ b/themes/apple/img/.svn/text-base/listGroup.png.svn-base diff --git a/themes/apple/img/.svn/text-base/loading.gif.svn-base b/themes/apple/img/.svn/text-base/loading.gif.svn-base Binary files differnew file mode 100644 index 0000000..8522ddf --- /dev/null +++ b/themes/apple/img/.svn/text-base/loading.gif.svn-base diff --git a/themes/apple/img/.svn/text-base/on_off.png.svn-base b/themes/apple/img/.svn/text-base/on_off.png.svn-base Binary files differnew file mode 100644 index 0000000..62325a8 --- /dev/null +++ b/themes/apple/img/.svn/text-base/on_off.png.svn-base diff --git a/themes/apple/img/.svn/text-base/pinstripes.png.svn-base b/themes/apple/img/.svn/text-base/pinstripes.png.svn-base Binary files differnew file mode 100644 index 0000000..c997775 --- /dev/null +++ b/themes/apple/img/.svn/text-base/pinstripes.png.svn-base diff --git a/themes/apple/img/.svn/text-base/redButton.png.svn-base b/themes/apple/img/.svn/text-base/redButton.png.svn-base Binary files differnew file mode 100644 index 0000000..f5728df --- /dev/null +++ b/themes/apple/img/.svn/text-base/redButton.png.svn-base diff --git a/themes/apple/img/.svn/text-base/selection.png.svn-base b/themes/apple/img/.svn/text-base/selection.png.svn-base Binary files differnew file mode 100644 index 0000000..537e3f0 --- /dev/null +++ b/themes/apple/img/.svn/text-base/selection.png.svn-base diff --git a/themes/apple/img/.svn/text-base/thumb.png.svn-base b/themes/apple/img/.svn/text-base/thumb.png.svn-base Binary files differnew file mode 100644 index 0000000..81495a0 --- /dev/null +++ b/themes/apple/img/.svn/text-base/thumb.png.svn-base diff --git a/themes/apple/img/.svn/text-base/toggle.png.svn-base b/themes/apple/img/.svn/text-base/toggle.png.svn-base Binary files differnew file mode 100644 index 0000000..3b62ebf --- /dev/null +++ b/themes/apple/img/.svn/text-base/toggle.png.svn-base diff --git a/themes/apple/img/.svn/text-base/toggleOn.png.svn-base b/themes/apple/img/.svn/text-base/toggleOn.png.svn-base Binary files differnew file mode 100644 index 0000000..b016814 --- /dev/null +++ b/themes/apple/img/.svn/text-base/toggleOn.png.svn-base diff --git a/themes/apple/img/.svn/text-base/toolButton.png.svn-base b/themes/apple/img/.svn/text-base/toolButton.png.svn-base Binary files differnew file mode 100644 index 0000000..dfbba4e --- /dev/null +++ b/themes/apple/img/.svn/text-base/toolButton.png.svn-base diff --git a/themes/apple/img/.svn/text-base/toolbar.png.svn-base b/themes/apple/img/.svn/text-base/toolbar.png.svn-base Binary files differnew file mode 100644 index 0000000..2159c7d --- /dev/null +++ b/themes/apple/img/.svn/text-base/toolbar.png.svn-base diff --git a/themes/apple/img/.svn/text-base/whiteButton.png.svn-base b/themes/apple/img/.svn/text-base/whiteButton.png.svn-base Binary files differnew file mode 100644 index 0000000..5514b27 --- /dev/null +++ b/themes/apple/img/.svn/text-base/whiteButton.png.svn-base diff --git a/themes/apple/img/actionButton.png b/themes/apple/img/actionButton.png Binary files differnew file mode 100644 index 0000000..0f92dfd --- /dev/null +++ b/themes/apple/img/actionButton.png diff --git a/themes/apple/img/backButton.png b/themes/apple/img/backButton.png Binary files differnew file mode 100644 index 0000000..935f914 --- /dev/null +++ b/themes/apple/img/backButton.png diff --git a/themes/apple/img/blueButton.png b/themes/apple/img/blueButton.png Binary files differnew file mode 100644 index 0000000..0f92dfd --- /dev/null +++ b/themes/apple/img/blueButton.png diff --git a/themes/apple/img/cancel.png b/themes/apple/img/cancel.png Binary files differnew file mode 100644 index 0000000..5f6dcc8 --- /dev/null +++ b/themes/apple/img/cancel.png diff --git a/themes/apple/img/chevron.png b/themes/apple/img/chevron.png Binary files differnew file mode 100644 index 0000000..6421a16 --- /dev/null +++ b/themes/apple/img/chevron.png diff --git a/themes/apple/img/grayButton.png b/themes/apple/img/grayButton.png Binary files differnew file mode 100644 index 0000000..0ce6a30 --- /dev/null +++ b/themes/apple/img/grayButton.png diff --git a/themes/apple/img/greenButton.png b/themes/apple/img/greenButton.png Binary files differnew file mode 100644 index 0000000..a45594b --- /dev/null +++ b/themes/apple/img/greenButton.png diff --git a/themes/apple/img/listArrowSel.png b/themes/apple/img/listArrowSel.png Binary files differnew file mode 100644 index 0000000..86832eb --- /dev/null +++ b/themes/apple/img/listArrowSel.png diff --git a/themes/apple/img/listGroup.png b/themes/apple/img/listGroup.png Binary files differnew file mode 100644 index 0000000..567d858 --- /dev/null +++ b/themes/apple/img/listGroup.png diff --git a/themes/apple/img/loading.gif b/themes/apple/img/loading.gif Binary files differnew file mode 100644 index 0000000..8522ddf --- /dev/null +++ b/themes/apple/img/loading.gif diff --git a/themes/apple/img/on_off.png b/themes/apple/img/on_off.png Binary files differnew file mode 100644 index 0000000..62325a8 --- /dev/null +++ b/themes/apple/img/on_off.png diff --git a/themes/apple/img/pinstripes.png b/themes/apple/img/pinstripes.png Binary files differnew file mode 100644 index 0000000..c997775 --- /dev/null +++ b/themes/apple/img/pinstripes.png diff --git a/themes/apple/img/redButton.png b/themes/apple/img/redButton.png Binary files differnew file mode 100644 index 0000000..f5728df --- /dev/null +++ b/themes/apple/img/redButton.png diff --git a/themes/apple/img/selection.png b/themes/apple/img/selection.png Binary files differnew file mode 100644 index 0000000..537e3f0 --- /dev/null +++ b/themes/apple/img/selection.png diff --git a/themes/apple/img/thumb.png b/themes/apple/img/thumb.png Binary files differnew file mode 100644 index 0000000..81495a0 --- /dev/null +++ b/themes/apple/img/thumb.png diff --git a/themes/apple/img/toggle.png b/themes/apple/img/toggle.png Binary files differnew file mode 100644 index 0000000..3b62ebf --- /dev/null +++ b/themes/apple/img/toggle.png diff --git a/themes/apple/img/toggleOn.png b/themes/apple/img/toggleOn.png Binary files differnew file mode 100644 index 0000000..b016814 --- /dev/null +++ b/themes/apple/img/toggleOn.png diff --git a/themes/apple/img/toolButton.png b/themes/apple/img/toolButton.png Binary files differnew file mode 100644 index 0000000..dfbba4e --- /dev/null +++ b/themes/apple/img/toolButton.png diff --git a/themes/apple/img/toolbar.png b/themes/apple/img/toolbar.png Binary files differnew file mode 100644 index 0000000..2159c7d --- /dev/null +++ b/themes/apple/img/toolbar.png diff --git a/themes/apple/img/whiteButton.png b/themes/apple/img/whiteButton.png Binary files differnew file mode 100644 index 0000000..5514b27 --- /dev/null +++ b/themes/apple/img/whiteButton.png diff --git a/themes/apple/theme.css b/themes/apple/theme.css new file mode 100644 index 0000000..dbbb4dc --- /dev/null +++ b/themes/apple/theme.css @@ -0,0 +1,727 @@ +body, #jqt { + background: rgb(0,0,0); +} + +body > *, #jqt > * { + background: rgb(197,204,211) url(img/pinstripes.png); +} + +#jqt h1, #jqt h2 { + font: bold 18px "Helvetica Neue", Helvetica; + text-shadow: rgba(255,255,255,.2) 0 1px 1px; + color: rgb(76, 86, 108); + margin: 10px 20px 6px; +} + +/* @group Toolbar */ + +#jqt .toolbar { + -webkit-box-sizing: border-box; + border-bottom: 1px solid #2d3642; + padding: 10px; + height: 45px; + background: url(img/toolbar.png) #6d84a2 repeat-x; + position: relative; +} + +#jqt .black-translucent .toolbar { + margin-top: 20px; +} + +div#jqt .toolbar > h1 { + position: absolute; + overflow: hidden; + left: 50%; + top: 10px; + line-height: 1em; + margin: 1px 0 0 -75px; + height: 40px; + font-size: 20px; + width: 150px; + font-weight: bold; + text-shadow: rgba(0, 0, 0, 0.4) 0px -1px 0; + text-align: center; + text-overflow: ellipsis; + white-space: nowrap; + color: #fff; +} + +div#jqt.landscape .toolbar > h1 { + margin-left: -125px; + width: 250px; +} + +#jqt .button, #jqt .back, #jqt .cancel, #jqt .add { + position: absolute; + overflow: hidden; + top: 8px; + right: 6px; + margin: 0; + border-width: 0 5px; + padding: 0 3px; + width: auto; + height: 30px; + line-height: 30px; + font-family: inherit; + font-size: 12px; + font-weight: bold; + color: #fff; + text-shadow: rgba(0, 0, 0, 0.5) 0px -1px 0; + text-overflow: ellipsis; + text-decoration: none; + white-space: nowrap; + background: none; + -webkit-border-image: url(img/toolButton.png) 0 5 0 5; +} + +#jqt .button.active, #jqt .cancel.active, #jqt .add.active { + -webkit-border-image: url(img/toolButton.png) 0 5 0 5; +} + +#jqt .blueButton { + -webkit-border-image: url(img/actionButton.png) 0 5 0 5; + border-width: 0 5px; +} + +#jqt .back { + left: 6px; + right: auto; + padding: 0; + max-width: 55px; + border-width: 0 8px 0 14px; + -webkit-border-image: url(img/backButton.png) 0 8 0 14; +} + +#jqt .back.active { + -webkit-border-image: url(img/backButton.png) 0 8 0 14; +} + +#jqt .leftButton, #jqt .cancel { + left: 6px; + right: auto; +} + +#jqt .add { + font-size: 24px; + line-height: 24px; + font-weight: bold; +} + +#jqt .whiteButton, +#jqt .grayButton, #jqt .redButton, #jqt .blueButton, #jqt .greenButton { + display: block; + border-width: 0 12px; + padding: 10px; + text-align: center; + font-size: 20px; + font-weight: bold; + text-decoration: inherit; + color: inherit; +} + +#jqt .whiteButton.active, #jqt .grayButton.active, #jqt .redButton.active, #jqt .blueButton.active, #jqt .greenButton.active, +#jqt .whiteButton:active, #jqt .grayButton:active, #jqt .redButton:active, #jqt .blueButton:active, #jqt .greenButton:active { + -webkit-border-image: url(img/activeButton.png) 0 12 0 12; +} + +#jqt .whiteButton { + -webkit-border-image: url(img/whiteButton.png) 0 12 0 12; + text-shadow: rgba(255, 255, 255, 0.7) 0 1px 0; +} + +#jqt .grayButton { + -webkit-border-image: url(img/grayButton.png) 0 12 0 12; + color: #FFFFFF; +} + +#jqt .redButton { + -webkit-border-image: url(img/redButton.png) 0 12 0 12; + color: #FFFFFF; +} + +#jqt .greenButton { + -webkit-border-image: url(img/greenButton.png) 0 12 0 12; + color: #FFFFFF; +} + +/* @end */ + +/* @group Lists */ + +#jqt h1 + ul, #jqt h2 + ul, #jqt h3 + ul, #jqt h4 + ul, #jqt h5 + ul, #jqt h6 + ul { + margin-top: 0; +} + +#jqt ul { + color: black; + background: #fff; + border: 1px solid #B4B4B4; + font: bold 17px "Helvetica Neue", Helvetica; + padding: 0; + margin: 15px 10px 17px 10px; + -webkit-border-radius: 8px; +} + +#jqt ul li { + color: #666; + border-top: 1px solid #B4B4B4; + list-style-type: none; + padding: 10px 10px 10px 10px; +} + +/* when you have a first LI item on any list */ + +#jqt li:first-child, #jqt li:first-child a { + border-top: 0; + -webkit-border-top-left-radius: 8px; + -webkit-border-top-right-radius: 8px; +} + +#jqt li:last-child, #jqt li:last-child a { + -webkit-border-bottom-left-radius: 8px; + -webkit-border-bottom-right-radius: 8px; +} + +/* universal arrows */ + +#jqt ul li.arrow { + background-image: url(img/chevron.png); + background-position: right center; + background-repeat: no-repeat; +} + +#jqt ul li.arrow a { + padding: 12px 22px 12px 10px; +} + +#jqt #plastic ul li.arrow, #jqt #metal ul li.arrow { + background-image: url(../images/chevron_dg.png); + background-position: right center; + background-repeat: no-repeat; +} + +/* universal links on list */ + +#jqt ul li a, #jqt li.img a + a { + color: #000; + text-decoration: none; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; + display: block; + padding: 12px 10px 12px 10px; + margin: -10px; + -webkit-tap-highlight-color: rgba(0,0,0,0); +} + +#jqt ul li a.active { + background: #194fdb url(img/selection.png) 0 0 repeat-x; + color: #fff; +} + +#jqt ul li a.button { + background-color: #194fdb; + color: #fff; +} + +#jqt ul li.img a + a { + margin: -10px 10px -20px -5px; + font-size: 17px; + font-weight: bold; +} + +#jqt ul li.img a + a + a { + font-size: 14px; + font-weight: normal; + margin-left: -10px; + margin-bottom: -10px; + margin-top: 0; +} + +#jqt ul li.img a + small + a { + margin-left: -5px; +} + +#jqt ul li.img a + small + a + a { + margin-left: -10px; + margin-top: -20px; + margin-bottom: -10px; + font-size: 14px; + font-weight: normal; +} + +#jqt ul li.img a + small + a + a + a { + margin-left: 0px !important; + margin-bottom: 0; +} + +#jqt ul li a + a { + color: #000; + font: 14px "Helvetica Neue", Helvetica; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; + display: block; + margin: 0; + padding: 0; +} + +#jqt ul li a + a + a, #jqt ul li.img a + a + a + a, #jqt ul li.img a + small + a + a + a { + color: #666; + font: 13px "Helvetica Neue", Helvetica; + margin: 0; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; + display: block; + padding: 0; +} + +/* +@end */ + +/* @group Forms */ + +#jqt ul.form li { + padding: 7px 10px; +} + +#jqt ul.form li.error { + border: 2px solid red; +} + +#jqt ul.form li.error + li.error { + border-top: 0; +} + +#jqt ul.form li:hover { + background: #fff; +} + +#jqt ul li input[type="text"], +#jqt ul li input[type="password"], +#jqt ul li input[type="tel"], +#jqt ul li input[type="number"], +#jqt ul li input[type="search"], +#jqt ul li input[type="email"], +#jqt ul li input[type="url"], +#jqt ul li textarea, +#jqt ul li select { + color: #777; + background: #fff url('data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=='); + border: 0; + font: normal 17px "Helvetica Neue", Helvetica; + padding: 0; + display: inline-block; + margin-left: 0px; + width: 100%; + -webkit-appearance: textarea; +} + +#jqt ul li textarea { + height: 120px; + padding: 0; + text-indent: -2px; +} + +#jqt ul li select { + text-indent: 0px; + background: transparent url(../images/chevron.png) no-repeat 103% 3px; + -webkit-appearance: textfield; + margin-left: -6px; + width: 104%; +} + +#jqt ul li input[type="checkbox"], #jqt ul li input[type="radio"] { + margin: 0; + color: rgb(50,79,133); + padding: 10px 10px; +} + +#jqt ul li input[type="checkbox"]:after, #jqt ul li input[type="radio"]:after { + content: attr(title); + font: 17px "Helvetica Neue", Helvetica; + display: block; + width: 246px; + margin: -12px 0 0 17px; +} + +/* @end */ + +/* @group Edge to edge */ +#jqt ul.edgetoedge { + -webkit-border-radius: 0; +} + +#jqt ul.edgetoedge li.sep { + background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgba(139, 159, 171, 1)), to(rgba(181, 193, 201, 1.0))); + border-bottom: 1px solid #b5c1c9; + border-top: 1px solid #b5c1c9; + color: #fff; + font-size: 16px; + margin: 1px 0 0 0; + padding: 2px 10px; + text-shadow: #636a6f 0 1px 0; +} + +#jqt .edgetoedge h4 { + color: #fff; + background: rgb(154,159,170) url(img/listGroup.png) top left repeat-x; + border-top: 1px solid rgb(165,177,186); + text-shadow: #666 0 1px 0; + margin: 0; + padding: 2px 10px; +} + +#jqt .edgetoedge, #jqt .metal { + margin: 0; + padding: 0; + background-color: rgb(255,255,255); +} + +#jqt .edgetoedge ul, #jqt .metal ul, #jqt .plastic ul { + -webkit-border-radius: 0; + margin: 0; + border-left: 0; + border-right: 0; + border-top: 0; +} + +#jqt .metal ul { + border-top: 0; + border-bottom: 0; + background: rgb(180,180,180); +} + +#jqt .edgetoedge ul li:first-child, +#jqt .edgetoedge ul li:first-child a, +#jqt .edgetoedge ul li:last-child, +#jqt .edgetoedge ul li:last-child a, +#jqt .metal ul li:first-child a, +#jqt .metal ul li:last-child a { + -webkit-border-radius: 0; +} + +#jqt .edgetoedge ul li small { + font-size: 16px; + line-height: 28px; +} + +#jqt .edgetoedge li, #jqt .metal li { + -webkit-border-radius: 0; +} + +#jqt .edgetoedge li em { + font-weight: normal; + font-style: normal; +} + +#jqt .edgetoedge h4 + ul { + border-top: 1px solid rgb(152,158,164); + border-bottom: 1px solid rgb(113,125,133); +} + +/* @end */ + +/* @group Mini Label */ + +#jqt ul li small { + color: #369; + font: 17px "Helvetica Neue", Helvetica; + text-align: right; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; + display: block; + width: 23%; + float: right; + padding: 3px 0px; +} + +#jqt ul li.arrow small { + padding: 0 15px; +} + +#jqt ul li small.counter { + font-size: 17px !important; + line-height: 13px !important; + font-weight: bold; + background: rgb(154,159,170); + color: #fff; + -webkit-border-radius: 11px; + padding: 4px 10px 5px 10px; + display: inline !important; + width: auto; + margin-top: -22px; +} + +#jqt ul li.arrow small.counter { + margin-right: 15px; +} + +/* @end */ + +/* @group Plastic */ + +#jqt #plastic ul li.arrow, #jqt #metal ul li.arrow { + background-image: url(img/listArrow.png); + background-position: right center; + background-repeat: no-repeat; +} + +#jqt .edgetoedge ul, #jqt .metal ul, #jqt .plastic ul { + -webkit-border-radius: 0; + margin: 0; + border-left: 0; + border-right: 0; + border-top: 0; +} + +#jqt .metal ul li { + border-top: 1px solid rgb(238,238,238); + border-bottom: 1px solid rgb(156,158,165); + background: url(../images/bgMetal.png) top left repeat-x; + font-size: 26px; + text-shadow: #fff 0 1px 0; +} + +#jqt .metal ul li a { + line-height: 26px; + margin: 0; + padding: 13px 0; +} + +#jqt .metal ul li a:hover { + color: rgb(0,0,0); +} + +#jqt .metal ul li:hover small { + color: inherit; +} + +#jqt .metal ul li a em { + display: block; + font-size: 14px; + font-style: normal; + color: #444; + width: 50%; + line-height: 14px; +} + +#jqt .metal ul li small { + float: right; + position: relative; + margin-top: 10px; + font-weight: bold; +} + +#jqt .metal ul li.arrow a small { + padding-right: 0; + line-height: 17px; +} + +#jqt .metal ul li.arrow { + background: url(../images/bgMetal.png) top left repeat-x, + url(../images/chevron_dg.png) right center no-repeat; +} + +#jqt .plastic { + margin: 0; + padding: 0; + background: rgb(173,173,173); +} + +#jqt .plastic ul { + -webkit-border-radius: 0; + margin: 0; + border-left: 0; + border-right: 0; + border-top: 0; + background-color: rgb(173,173,173); +} + +#jqt .plastic ul li { + -webkit-border-radius: 0; + border-top: 1px solid rgb(191,191,191); + border-bottom: 1px solid rgb(157,157,157); +} + +#jqt .plastic ul li:nth-child(odd) { + background-color: rgb(152,152,152); + border-top: 1px solid rgb(181,181,181); + border-bottom: 1px solid rgb(138,138,138); +} + +#jqt .plastic ul + p { + font-size: 11px; + color: #2f3237; + text-shadow: none; + padding: 10px 10px; +} + +#jqt .plastic ul + p strong { + font-size: 14px; + line-height: 18px; + text-shadow: #fff 0 1px 0; +} + +#jqt .plastic ul li a { + text-shadow: rgb(211,211,211) 0 1px 0; +} + +#jqt .plastic ul li:nth-child(odd) a { + text-shadow: rgb(191,191,191) 0 1px 0; +} + +#jqt .plastic ul li small { + color: #3C3C3C; + text-shadow: rgb(211,211,211) 0 1px 0; + font-size: 13px; + font-weight: bold; + text-transform: uppercase; + line-height: 24px; +} + +#jqt #plastic ul.minibanner, #jqt #plastic ul.bigbanner { + margin: 10px; + border: 0; + height: 81px; + clear: both; +} + +#jqt #plastic ul.bigbanner { + height: 140px !important; +} + +#jqt #plastic ul.minibanner li { + border: 1px solid rgb(138,138,138); + background-color: rgb(152,152,152); + width: 145px; + height: 81px; + float: left; + -webkit-border-radius: 5px; + padding: 0; +} + +#jqt #plastic ul.bigbanner li { + border: 1px solid rgb(138,138,138); + background-color: rgb(152,152,152); + width: 296px; + height: 140px; + float: left; + -webkit-border-radius: 5px; + padding: 0; + margin-bottom: 4px; +} + +#jqt #plastic ul.minibanner li:first-child { + margin-right: 6px; +} + +#jqt #plastic ul.minibanner li a { + color: transparent; + text-shadow: none; + display: block; + width: 145px; + height: 81px; +} + +#jqt #plastic ul.bigbanner li a { + color: transparent; + text-shadow: none; + display: block; + width: 296px; + height: 145px; +} + +/* @end */ + +/* @group Individual */ + +#jqt ul.individual { + border: 0; + background: none; + clear: both; + overflow: hidden; +} + +#jqt ul.individual li { + color: rgb(183,190,205); + background: white; + border: 1px solid rgb(180,180,180); + font-size: 14px; + text-align: center; + -webkit-border-radius: 8px; + -webkit-box-sizing: border-box; + width: 48%; + float: left; + display: block; + padding: 11px 10px 14px 10px; +} + +#jqt ul.individual li + li { + float: right; +} + +#jqt ul.individual li a { + color: rgb(50,79,133); + line-height: 16px; + margin: -11px -10px -14px -10px; + padding: 11px 10px 14px 10px; + -webkit-border-radius: 8px; +} + +#jqt ul.individual li a:hover { + color: #fff; + background: #36c; +} + +/* @end */ + +/* @group Toggle */ + + +#jqt .toggle { + width: 94px; + position: relative; + height: 27px; + display: block; + overflow: hidden; + float: right; +} + +#jqt .toggle input[type="checkbox"]:checked { + left: 0px; +} + +#jqt .toggle input[type="checkbox"] { + -webkit-tap-highlight-color: rgba(0,0,0,0); + margin: 0; + -webkit-border-radius: 5px; + background: #fff url(img/on_off.png) 0 0 no-repeat; + height: 27px; + overflow: hidden; + width: 149px; + border: 0; + -webkit-appearance: textarea; + background-color: transparent; + -webkit-transition: left .15s; + position: absolute; + top: 0; + left: -55px; +} +/* @end */ + + + +#jqt .info { + background: #dce1eb; + font-size: 12px; + line-height: 16px; + text-align: center; + text-shadow: rgba(255,255,255,.8) 0 1px 0; + color: rgb(76, 86, 108); + padding: 15px; + border-top: 1px solid rgba(76, 86, 108, .3); + font-weight: bold; +} diff --git a/themes/apple/theme.min.css b/themes/apple/theme.min.css new file mode 100644 index 0000000..decc185 --- /dev/null +++ b/themes/apple/theme.min.css @@ -0,0 +1 @@ +body{background:#000;}body>*{background:#c5ccd3 url(img/pinstripes.png);}h1,h2{font:bold 18px Helvetica;text-shadow:rgba(255,255,255,.2) 0 1px 1px;color:#4c566c;margin:10px 20px 6px;}.toolbar{-webkit-box-sizing:border-box;border-bottom:1px solid #2d3642;padding:10px;height:45px;background:url(img/toolbar.png) #6d84a2 repeat-x;position:relative;}.black-translucent .toolbar{margin-top:20px;}.toolbar>h1{position:absolute;overflow:hidden;left:50%;top:10px;line-height:1em;margin:1px 0 0 -75px;height:40px;font-size:20px;width:150px;font-weight:bold;text-shadow:rgba(0,0,0,0.4) 0 -1px 0;text-align:center;text-overflow:ellipsis;white-space:nowrap;color:#fff;}body.landscape .toolbar>h1{margin-left:-125px;width:250px;}.button,.back,.cancel,.add{position:absolute;overflow:hidden;top:8px;right:6px;margin:0;border-width:0 5px;padding:0 3px;width:auto;height:30px;line-height:30px;font-family:inherit;font-size:12px;font-weight:bold;color:#fff;text-shadow:rgba(0,0,0,0.5) 0 -1px 0;text-overflow:ellipsis;text-decoration:none;white-space:nowrap;background:none;-webkit-border-image:url(img/toolButton.png) 0 5 0 5;}.button.active,.back.active,.cancel.active,.add.active{-webkit-border-image:url(img/toolButton.png) 0 5 0 5;}.blueButton{-webkit-border-image:url(img/blueButton.png) 0 5 0 5;border-width:0 5px;}.back{left:6px;right:auto;padding:0;max-width:55px;border-width:0 8px 0 14px;-webkit-border-image:url(img/backButton.png) 0 8 0 14;}.leftButton,.cancel{left:6px;right:auto;}.add{font-size:24px;line-height:24px;font-weight:bold;}.whiteButton,.grayButton{display:block;border-width:0 12px;padding:10px;text-align:center;font-size:20px;font-weight:bold;text-decoration:inherit;color:inherit;}.whiteButton{-webkit-border-image:url(img/whiteButton.png) 0 12 0 12;text-shadow:rgba(255,255,255,0.7) 0 1px 0;}.grayButton{-webkit-border-image:url(img/grayButton.png) 0 12 0 12;color:#FFF;}h1+ul,h2+ul,h3+ul,h4+ul,h5+ul,h6+ul{margin-top:0;}ul{color:black;background:#fff;border:1px solid #B4B4B4;font:bold 17px Helvetica;padding:0;margin:15px 10px 17px 10px;-webkit-border-radius:8px;}ul li{color:#666;border-top:1px solid #B4B4B4;list-style-type:none;padding:10px 10px 10px 10px;}li:first-child,li:first-child a{border-top:0;-webkit-border-top-left-radius:8px;-webkit-border-top-right-radius:8px;}li:last-child,li:last-child a{-webkit-border-bottom-left-radius:8px;-webkit-border-bottom-right-radius:8px;}ul li.arrow{background-image:url(img/chevron.png);background-position:right center;background-repeat:no-repeat;}#plastic ul li.arrow,#metal ul li.arrow{background-image:url(../images/chevron_dg.png);background-position:right center;background-repeat:no-repeat;}ul li a,li.img a+a{color:#000;text-decoration:none;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;display:block;padding:12px 10px 12px 10px;margin:-10px;-webkit-tap-highlight-color:rgba(0,0,0,0);}ul li a.active{background:#194fdb url(img/selection.png) 0 0 repeat-x;color:#fff;}ul li a.button{background-color:#194fdb;color:#fff;}ul li.img a+a{margin:-10px 10px -20px -5px;font-size:17px;font-weight:bold;}ul li.img a+a+a{font-size:14px;font-weight:normal;margin-left:-10px;margin-bottom:-10px;margin-top:0;}ul li.img a+small+a{margin-left:-5px;}ul li.img a+small+a+a{margin-left:-10px;margin-top:-20px;margin-bottom:-10px;font-size:14px;font-weight:normal;}ul li.img a+small+a+a+a{margin-left:0!important;margin-bottom:0;}ul li a+a{color:#000;font:14px Helvetica;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;display:block;margin:0;padding:0;}ul li a+a+a,ul li.img a+a+a+a,ul li.img a+small+a+a+a{color:#666;font:13px Helvetica;margin:0;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;display:block;padding:0;}ul.form li{padding:7px 10px;}ul.form li.error{border:2px solid red;}ul.form li.error+li.error{border-top:0;}ul.form li:hover{background:#fff;}ul li input[type="text"],ul li input[type="password"],ul li textarea,ul li select{color:#777;background:#fff url(../.png);border:0;font:normal 17px Helvetica;padding:0;display:inline-block;margin-left:0;width:100%;-webkit-appearance:textarea;}ul li textarea{height:120px;padding:0;text-indent:-2px;}ul li select{text-indent:0;background:transparent url(../images/chevron.png) no-repeat 103% 3px;-webkit-appearance:textfield;margin-left:-6px;width:104%;}ul li input[type="checkbox"],ul li input[type="radio"]{margin:0;color:#324f85;padding:10px 10px;}ul li input[type="checkbox"]:after,ul li input[type="radio"]:after{content:attr(title);font:17px Helvetica;display:block;width:246px;margin:-12px 0 0 17px;}.edgetoedge h4{color:#fff;background:#9a9faa url(img/listGroup.png) top left repeat-x;border-top:1px solid #a5b1ba;text-shadow:#666 0 1px 0;margin:0;padding:2px 10px;}.edgetoedge,.metal{margin:0;padding:0;background-color:#fff;}.edgetoedge ul,.metal ul,.plastic ul{-webkit-border-radius:0;margin:0;border-left:0;border-right:0;border-top:0;}.metal ul{border-top:0;border-bottom:0;background:#b4b4b4;}.edgetoedge ul li:first-child,.edgetoedge ul li:first-child a,.edgetoedge ul li:last-child,.edgetoedge ul li:last-child a,.metal ul li:first-child a,.metal ul li:last-child a{-webkit-border-radius:0;}.edgetoedge ul li small{font-size:16px;line-height:28px;}.edgetoedge li,.metal li{-webkit-border-radius:0;}.edgetoedge li em{font-weight:normal;font-style:normal;}.edgetoedge h4+ul{border-top:1px solid #989ea4;border-bottom:1px solid #717d85;}ul li small{color:#369;font:17px Helvetica;text-align:right;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;display:block;width:23%;float:right;padding:3px 0;}ul li.arrow small{padding:0 15px;}ul li small.counter{font-size:17px!important;line-height:13px!important;font-weight:bold;background:#9a9faa;color:#fff;-webkit-border-radius:11px;padding:4px 10px 5px 10px;display:inline!important;width:auto;margin-top:-22px;}ul li.arrow small.counter{margin-right:15px;}#plastic ul li.arrow,#metal ul li.arrow{background-image:url(img/listArrow.png);background-position:right center;background-repeat:no-repeat;}.edgetoedge ul,.metal ul,.plastic ul{-webkit-border-radius:0;margin:0;border-left:0;border-right:0;border-top:0;}.metal ul li{border-top:1px solid #eee;border-bottom:1px solid #9c9ea5;background:url(../images/bgMetal.png) top left repeat-x;font-size:26px;text-shadow:#fff 0 1px 0;}.metal ul li a{line-height:26px;margin:0;padding:13px 0;}.metal ul li a:hover{color:#000;}.metal ul li:hover small{color:inherit;}.metal ul li a em{display:block;font-size:14px;font-style:normal;color:#444;width:50%;line-height:14px;}.metal ul li small{float:right;position:relative;margin-top:10px;font-weight:bold;}.metal ul li.arrow a small{padding-right:0;line-height:17px;}.metal ul li.arrow{background:url(../images/bgMetal.png) top left repeat-x,url(../images/chevron_dg.png) right center no-repeat;}.plastic{margin:0;padding:0;background:#adadad;}.plastic ul{-webkit-border-radius:0;margin:0;border-left:0;border-right:0;border-top:0;background-color:#adadad;}.plastic ul li{-webkit-border-radius:0;border-top:1px solid #bfbfbf;border-bottom:1px solid #9d9d9d;}.plastic ul li:nth-child(odd){background-color:#989898;border-top:1px solid #b5b5b5;border-bottom:1px solid #8a8a8a;}.plastic ul+p{font-size:11px;color:#2f3237;text-shadow:none;padding:10px 10px;}.plastic ul+p strong{font-size:14px;line-height:18px;text-shadow:#fff 0 1px 0;}.plastic ul li a{text-shadow:#d3d3d3 0 1px 0;}.plastic ul li:nth-child(odd) a{text-shadow:#bfbfbf 0 1px 0;}.plastic ul li small{color:#3C3C3C;text-shadow:#d3d3d3 0 1px 0;font-size:13px;font-weight:bold;text-transform:uppercase;line-height:24px;}#plastic ul.minibanner,#plastic ul.bigbanner{margin:10px;border:0;height:81px;clear:both;}#plastic ul.bigbanner{height:140px!important;}#plastic ul.minibanner li{border:1px solid #8a8a8a;background-color:#989898;width:145px;height:81px;float:left;-webkit-border-radius:5px;padding:0;}#plastic ul.bigbanner li{border:1px solid #8a8a8a;background-color:#989898;width:296px;height:140px;float:left;-webkit-border-radius:5px;padding:0;margin-bottom:4px;}#plastic ul.minibanner li:first-child{margin-right:6px;}#plastic ul.minibanner li a{color:transparent;text-shadow:none;display:block;width:145px;height:81px;}#plastic ul.bigbanner li a{color:transparent;text-shadow:none;display:block;width:296px;height:145px;}ul.individual{border:0;background:none;clear:both;overflow:hidden;}ul.individual li{color:#b7becd;background:white;border:1px solid #b4b4b4;font-size:14px;text-align:center;-webkit-border-radius:8px;-webkit-box-sizing:border-box;width:48%;float:left;display:block;padding:11px 10px 14px 10px;}ul.individual li+li{float:right;}ul.individual li a{color:#324f85;line-height:16px;margin:-11px -10px -14px -10px;padding:11px 10px 14px 10px;-webkit-border-radius:8px;}ul.individual li a:hover{color:#fff;background:#36c;}.toggle{width:94px;position:relative;height:27px;display:block;overflow:hidden;float:right;}.toggle input[type="checkbox"]:checked{left:0;}.toggle input[type="checkbox"]{-webkit-tap-highlight-color:rgba(0,0,0,0);margin:0;-webkit-border-radius:5px;background:#fff url(img/on_off.png) 0 0 no-repeat;height:27px;overflow:hidden;width:149px;border:0;-webkit-appearance:textarea;background-color:transparent;-webkit-transition:left .15s;position:absolute;top:0;left:-55px;}.info{background:#dce1eb;font-size:12px;line-height:16px;text-align:center;text-shadow:rgba(255,255,255,.8) 0 1px 0;color:#4c566c;padding:15px;border-top:1px solid rgba(76,86,108,.3);font-weight:bold;}
\ No newline at end of file diff --git a/themes/bin/backend.php b/themes/bin/backend.php new file mode 100644 index 0000000..54e0058 --- /dev/null +++ b/themes/bin/backend.php @@ -0,0 +1,129 @@ +<?php +header('Content-type: text/html'); +$action=$_REQUEST['action']; +switch ($action) + { + case ("getGlobals"): + $tree = file_get_contents("textfiles/getGlobals.txt"); + print $tree; + break; + + case ("getTvCat"): + $tree = file_get_contents("textfiles/getTvCat.txt"); + print $tree; + break; + + case ("getFullChanList"): + $tree = file_get_contents("textfiles/getFullChanList.txt"); + print $tree; + break; + + case ("getTvChan"): + $tree = file_get_contents("textfiles/getTvChan.txt"); + print $tree; + break; + + case ("getChanInfo"): + $tree = file_get_contents("textfiles/getChanInfo.txt"); + print $tree; + break; + + case ("getRecInfo"): + $tree = file_get_contents("textfiles/getRecInfo.txt"); + print $tree; + break; + + case ("getVidInfo"): + $tree = file_get_contents("textfiles/getVidInfo.txt"); + print $tree; + break; + + case ("getStreamInfo"): + $session = $_REQUEST['session']; + $tree = file_get_contents("textfiles/getStreamInfo-" . $session . ".txt"); + print $tree; + break; + + case ("startBroadcast"): + $type = $_REQUEST['type']; + $url = $_REQUEST['url']; + $tree = file_get_contents("textfiles/startBroadcast-" . $type . ".txt"); + print $tree; + break; + + case ("stopBroadcast"): + $tree = file_get_contents("textfiles/stopBroadcast.txt"); + print $tree; + break; + + case ("getStreamStatus"): + $time = time(); + $session = $_REQUEST['session']; + $prevmsg = $_REQUEST['msg']; + while((time() - $time) < 29) + { + $tree = file_get_contents("textfiles/getStreamStatus.txt"); + $data = json_decode($tree); + $message = $data->message; + $status = $data->status; + if ($prevmsg != $message) { + print $tree; + break; + } + else if ($status == "ready") + { + print $tree; + break; + } + usleep(1000); + } + break; + + case ("getTimers"): + $tree = file_get_contents("textfiles/getTimers.txt"); + print $tree; + break; + + case ("editTimer"): + $id = $_REQUEST['id']; + if (id) { + $tree = file_get_contents("textfiles/editTimer.txt"); + } + else { + $tree = file_get_contents("textfiles/addTimer.txt"); + } + print $tree; + break; + + case ("deltimer"): + $tree = file_get_contents("textfiles/delTimer.txt"); + print $tree; + break; + + case ("browseFolder"): + $path = $_REQUEST['path']; + if ( $path == "/video/" ) { + $tree = file_get_contents("textfiles/browseFolder-rec.txt"); + } + else { + $tree = file_get_contents("textfiles/browseFolder-vid.txt"); + } + print $tree; + break; + + case ("browseRec"): + $tree = file_get_contents("textfiles/browseRec.txt"); + print $tree; + break; + + case ("browseAudio"): + $tree = file_get_contents("textfiles/browseAudio.txt"); + print $tree; + break; + + case ("streamAudio"): + $tree = file_get_contents("textfiles/streamAudio.txt"); + print $tree; + break; + } +?> diff --git a/themes/bin/textfiles/addTimer.txt b/themes/bin/textfiles/addTimer.txt new file mode 100644 index 0000000..728616e --- /dev/null +++ b/themes/bin/textfiles/addTimer.txt @@ -0,0 +1 @@ +{ "status": "Ok", "message":"Timer created successfully" } diff --git a/themes/bin/textfiles/browseAudio.txt b/themes/bin/textfiles/browseAudio.txt new file mode 100644 index 0000000..2f91c4f --- /dev/null +++ b/themes/bin/textfiles/browseAudio.txt @@ -0,0 +1,21 @@ +{ + "list": + [ + { + "type": "folder", + "name": "album1", + "path": "/mnt/music/album1" + }, + { + "type": "folder", + "name": "album2", + "path": "/mnt/music/album2" + }, + { + "type": "audio", + "name": "audiofile.mp3", + "length": "3.30", + "path": "/mnt/music/audiofile.mp3" + } + ] +} diff --git a/themes/bin/textfiles/browseFolder-rec.txt b/themes/bin/textfiles/browseFolder-rec.txt new file mode 100644 index 0000000..c3d721c --- /dev/null +++ b/themes/bin/textfiles/browseFolder-rec.txt @@ -0,0 +1,22 @@ +{ + "list": + [ + { + "type": "folder", + "name": "rec1", + "path": "/video/rec1" + }, + { + "type": "folder", + "name": "rec2", + "path": "/video/rec2" + }, + { + "type": "rec", + "name": "2010/02/25 at 23h21", + "path": "/video/rec1/2010-02-25.23.21.3-0.rec" + } + + ] +} + diff --git a/themes/bin/textfiles/browseFolder-vid.txt b/themes/bin/textfiles/browseFolder-vid.txt new file mode 100644 index 0000000..62fecf3 --- /dev/null +++ b/themes/bin/textfiles/browseFolder-vid.txt @@ -0,0 +1,20 @@ +{ + "list": + [ + { + "type": "folder", + "name": "movie1", + "path": "/mnt/videos/movie1" + }, + { + "type": "folder", + "name": "movie2", + "path": "/mnt/videos/movie2" + }, + { + "type": "video", + "name": "videofile.avi", + "path": "/mnt/videos/videofile.avi" + } + ] +} diff --git a/themes/bin/textfiles/delTimer.txt b/themes/bin/textfiles/delTimer.txt new file mode 100644 index 0000000..9ab3b92 --- /dev/null +++ b/themes/bin/textfiles/delTimer.txt @@ -0,0 +1 @@ +{ "status": "ok", "message":"Timer successfully deleted" } diff --git a/themes/bin/textfiles/editTimer.txt b/themes/bin/textfiles/editTimer.txt new file mode 100644 index 0000000..bad3855 --- /dev/null +++ b/themes/bin/textfiles/editTimer.txt @@ -0,0 +1 @@ +{ "status": "Ok", "message":"Timer edited successfully" } diff --git a/themes/bin/textfiles/getChanInfo.txt b/themes/bin/textfiles/getChanInfo.txt new file mode 100644 index 0000000..94f302d --- /dev/null +++ b/themes/bin/textfiles/getChanInfo.txt @@ -0,0 +1,14 @@ +{ + "program": + { + "name": "TF1", + "number": "1", + "now_time": "13h00-13h30", + "now_title": "Journal de 13h", + "now_desc": "Les informations de 13h... Blahblah..", + "next_time": "13h35-13h45", + "next_title": "Météo", + "next_desc": "Le bulletin météo de la journée." + } +} + diff --git a/themes/bin/textfiles/getFullChanList.txt b/themes/bin/textfiles/getFullChanList.txt new file mode 100644 index 0000000..80e0495 --- /dev/null +++ b/themes/bin/textfiles/getFullChanList.txt @@ -0,0 +1,34 @@ +{ + "category": + [ + { + "name": "Nationales&TNT", + "channel": + [ + { + "name": "TF1", + "number": "1" + },{ + "name": "FRANCE 2", + "number": "2" + },{ + "name": "FRANCE 3", + "number": "3" + } + ] + }, + { + "name": "Divertissement", + "channel": + [ + { + "name": "Paris Première", + "number": "10" + },{ + "name": "RTL Télévision", + "number": "11" + } + ] + } + ] +} diff --git a/themes/bin/textfiles/getGlobals.txt b/themes/bin/textfiles/getGlobals.txt new file mode 100644 index 0000000..87a9994 --- /dev/null +++ b/themes/bin/textfiles/getGlobals.txt @@ -0,0 +1,6 @@ +{ + "streamdev_server": "http://127.0.0.1:3000", + "rec_path": "/video/", + "video_path": "/mnt/media/Video/", + "audio_path": "/mnt/media/Music/" +} diff --git a/themes/bin/textfiles/getRecInfo.txt b/themes/bin/textfiles/getRecInfo.txt new file mode 100644 index 0000000..6488ea7 --- /dev/null +++ b/themes/bin/textfiles/getRecInfo.txt @@ -0,0 +1,10 @@ +{ + "program": + { + "name": "Journal de 13h", + "channel": "TF1", + "recorded": "2010-02-02 at 19h30", + "desc": "Les informations de 13h..." + } +} + diff --git a/themes/bin/textfiles/getStreamInfo-1.txt b/themes/bin/textfiles/getStreamInfo-1.txt new file mode 100644 index 0000000..fe89488 --- /dev/null +++ b/themes/bin/textfiles/getStreamInfo-1.txt @@ -0,0 +1,17 @@ +{ + "stream": + { + "session": "1", + "type": "tv", + "name": "TF1", + "mode": "3G", + "now_time": "13h00-13h30", + "now_title": "Journal de 13h", + "now_desc": "Les informations de 13h...", + "next_time": "13h35-13h45", + "next_title": "Météo", + "next_desc": "Le bulletin météo de la journée.", + "thumbwidth" : "80", + "thumbheight" : "80" + } +} diff --git a/themes/bin/textfiles/getStreamInfo-2.txt b/themes/bin/textfiles/getStreamInfo-2.txt new file mode 100644 index 0000000..f097b7f --- /dev/null +++ b/themes/bin/textfiles/getStreamInfo-2.txt @@ -0,0 +1,16 @@ +{ + "stream": + { + "session": "2", + "type": "rec", + "name": "Journal de 13h", + "channel": "TF1", + "recorded": "2010-02-02 at 19h30", + "desc": "Les informations de 13h...", + "mode": "3G", + "thumbwidth": "80", + "thumbheight": "80" + } +} + + diff --git a/themes/bin/textfiles/getStreamInfo-3.txt b/themes/bin/textfiles/getStreamInfo-3.txt new file mode 100644 index 0000000..a0f2558 --- /dev/null +++ b/themes/bin/textfiles/getStreamInfo-3.txt @@ -0,0 +1,17 @@ +{ + "stream": + { + "session": "3", + "type": "vid", + "name": "Mavideo.avi", + "desc": "", + "duration": "1:41:55", + "format": "avi", + "video": "XviD MPEG-4", + "audio": "MPEG Layer 3", + "resolution": "608x256", + "mode": "3G", + "thumbwidth": "180", + "thumbheight": "100" + } +} diff --git a/themes/bin/textfiles/getStreamStatus.txt b/themes/bin/textfiles/getStreamStatus.txt new file mode 100644 index 0000000..d14a003 --- /dev/null +++ b/themes/bin/textfiles/getStreamStatus.txt @@ -0,0 +1 @@ +{"status": "ready","message": "3G Broadcast ready", "url": "ram/session1/stream.m3u8"} diff --git a/themes/bin/textfiles/getTimers.txt b/themes/bin/textfiles/getTimers.txt new file mode 100644 index 0000000..103d110 --- /dev/null +++ b/themes/bin/textfiles/getTimers.txt @@ -0,0 +1,38 @@ +{ + "timer": + [ + { + "id": "1", + "name": "Timername", + "active": "1", + "channumber": "2", + "channame": "FRANCE 2", + "date": "2010-03-10", + "starttime": "2030", + "endtime": "2230", + "running": "0" + }, + { + "id": "2", + "name": "Timername2", + "active": "0", + "channumber": "3", + "channame": "FRANCE 3", + "date": "2010-05-10", + "starttime": "1030", + "endtime": "1230", + "running": "0" + }, + { + "id": "3", + "name": "Timername3", + "active": "1", + "channumber": "4", + "channame": "Canal +", + "date": "2010-03-13", + "starttime": "2030", + "endtime": "2230", + "running": "1" + } + ] +} diff --git a/themes/bin/textfiles/getTvCat.txt b/themes/bin/textfiles/getTvCat.txt new file mode 100644 index 0000000..0d95dca --- /dev/null +++ b/themes/bin/textfiles/getTvCat.txt @@ -0,0 +1,16 @@ +{ + "categories": + [ + { + "name": "Nationales&TNT", + "channels": "17" + },{ + "name": "Divertissements", + "channels": "12" + },{ + "name": "Information", + "channels": "6" + } + ] +} + diff --git a/themes/bin/textfiles/getTvChan.txt b/themes/bin/textfiles/getTvChan.txt new file mode 100644 index 0000000..03d4840 --- /dev/null +++ b/themes/bin/textfiles/getTvChan.txt @@ -0,0 +1,19 @@ +{ + "channel": + [ + { + "name": "TF1", + "number": "1", + "now_title": "Journal de 13h", + },{ + "name": "FRANCE 2", + "number": "2", + "now_title": "Tournez manège", + },{ + "name": "FRANCE 3", + "number": "3", + "now_title": "Journal régional" + } + ] +} + diff --git a/themes/bin/textfiles/getVidInfo.txt b/themes/bin/textfiles/getVidInfo.txt new file mode 100644 index 0000000..11a58f7 --- /dev/null +++ b/themes/bin/textfiles/getVidInfo.txt @@ -0,0 +1,13 @@ +{ + "program": + { + "name": "Mavideo.avi", + "desc": "", + "duration": "1:41:55", + "format": "avi", + "video": "XviD MPEG-4", + "audio": "MPEG Layer 3", + "resolution": "608x256" + } +} + diff --git a/themes/bin/textfiles/startBroadcast-rec.txt b/themes/bin/textfiles/startBroadcast-rec.txt new file mode 100644 index 0000000..e24cc29 --- /dev/null +++ b/themes/bin/textfiles/startBroadcast-rec.txt @@ -0,0 +1,2 @@ +{ "session": "2" } + diff --git a/themes/bin/textfiles/startBroadcast-tv.txt b/themes/bin/textfiles/startBroadcast-tv.txt new file mode 100644 index 0000000..b34344a --- /dev/null +++ b/themes/bin/textfiles/startBroadcast-tv.txt @@ -0,0 +1,2 @@ +{ "session": "1" } + diff --git a/themes/bin/textfiles/startBroadcast-vid.txt b/themes/bin/textfiles/startBroadcast-vid.txt new file mode 100644 index 0000000..a1fffae --- /dev/null +++ b/themes/bin/textfiles/startBroadcast-vid.txt @@ -0,0 +1,2 @@ +{ "session": "3" } + diff --git a/themes/bin/textfiles/stopBroadcast.txt b/themes/bin/textfiles/stopBroadcast.txt new file mode 100644 index 0000000..0b99d06 --- /dev/null +++ b/themes/bin/textfiles/stopBroadcast.txt @@ -0,0 +1 @@ +{ "status": "ok", "message": "Successfully stopped broadcast" } diff --git a/themes/bin/textfiles/streamAudio.txt b/themes/bin/textfiles/streamAudio.txt new file mode 100644 index 0000000..28cca73 --- /dev/null +++ b/themes/bin/textfiles/streamAudio.txt @@ -0,0 +1,14 @@ +{ + playlist: + [ + { + "file": "/istreamdev/playlist/track1.mp3" + }, + { + "file": "/istreamdev/playlist/track2.mp3" + }, + { + "file": "/istreamdev/playlist/track3.mp3" + } + ] +} diff --git a/themes/css/istreamdev.css b/themes/css/istreamdev.css new file mode 100644 index 0000000..ac58b7a --- /dev/null +++ b/themes/css/istreamdev.css @@ -0,0 +1,316 @@ + +div.loader { + font-family: Arial, Helvetica, sans-serif; + font-size: 14px; + + background-image: url(../img/loading.gif); + background-repeat: no-repeat; + background-position: 50% 50%; + text-align: center; + vertical-align: middle; + height: 100%; + width: 100%; + position: absolute; + z-index: 10; + left: 0px; + top: 0px; + opacity: .85; + display: block; + +} + +ul li img.menuicon { +vertical-align: middle; +} + +h1 img.menuicon { +position:relative; +top: 3px; +width: 22px; +height: 20px; +} + +.menuname { +vertical-align: middle; +margin: 0 0 0 10px; +} + +li.forward > a > span, span.substring { +vertical-align: middle; +} +li.channellist { +height: 55px; +background-image: url(../img/chevron.png), -webkit-gradient(linear, 0% 0%, 0% 100%, from(#4c4d4e), to(#404142)); +background-position: right center; +background-repeat: no-repeat; +} + +li.channellist img { +width: 55px; +height: 55px; +vertical-align: middle; +position: relative; +-webkit-mask-box-image: url(../img/mask.png) 80 stretch; +top: 0px; +} + +li.channellist span.name { +margin: 10px 0 0 0px; +left: 90px; +text-overflow: ellipsis; +overflow: hidden; +max-width: 80%!important; +white-space: nowrap; +font-size: 17px; +line-height: normal; +position: absolute; +font-weight: bold; + +} +li.channellist span.comment { +margin: 28px 0 0 0px; +left: 90px; +max-width: 80%!important; +font-size: 14px; +line-height: normal; +position: absolute; +top: 15 px; +font-style: italic; +font-weight: normal; +} + +li.channellist small.counter { + margin-right: 15px; + position: relative; + top: 36px; + font-size: 17px; + line-height: 13px; + font-weight: bold; + background: rgba(0,0,0,.15); + color: #fff; + -webkit-border-radius: 11px; + display: block; + width: auto; + -webkit-box-shadow: rgba(255,255,255,.1) 0 1px 0; +} +ul.thumb { +-webkit-border-radius: 8px; +-webkit-box-shadow: rgba(0,0,0,.3) 1px 1px 3px; +} + +.thumbnail { +vertical-align: middle; +margin: 5px 0 5px 0; +} + +span.streamButton a{ +margin: 5px 5px 5px 5px; +border-width: 0 12px; +padding: 8px; +text-align: center; +font-size: 14px; +font-weight: bold; +text-decoration: inherit; +color: inherit; +-webkit-border-image: url(../img/stream.png) 0 12 0 12; +color: #FFFFFF; +} +span.streamButton a:active{ +color: #aaa; +-webkit-border-image: url(../img/stream_clicked.png) 0 12 0 12; +} +span.recButton a{ +margin: 5px 5px 5px 5px; +border-width: 0 12px; +padding: 8px; +text-align: center; +font-size: 14px; +font-weight: bold; +text-decoration: inherit; +color: inherit; +-webkit-border-image: url(../img/rec.png) 0 12 0 12; +color: #FFFFFF; +} +span.recButton a:active{ +color: #aaa; +-webkit-border-image: url(../img/rec_clicked.png) 0 12 0 12; +} + +ul.streaminfo { +-webkit-border-radius: 8px; +-webkit-box-shadow: rgba(0,0,0,.3) 1px 1px 3px; +} +ul.streaminfo li:first-child, ul.streaminfo li:first-child a { + border-top: 0; + -webkit-border-top-left-radius: 8px; + -webkit-border-top-right-radius: 8px; +} +ul.streaminfo li:last-child, ul.streaminfo li:last-child a { + -webkit-border-bottom-left-radius: 8px; + -webkit-border-bottom-right-radius: 8px; +} + +ul.streaminfo span.name_now, span.name_next { +padding-top: 0px; +padding-right: 10px; +padding-left: 10px; +font-size: 17px; +font-weight: bold; +display: block; +color: white; +text-shadow: rgba(0,0,0,.8) 0 1px 0; +} +ul.streaminfo span.epgtime_now, span.epgtime_next { +padding-top: 0px; +padding-right: 10px; +padding-left: 10px; +font-size: 14px; +font-weight: bold; +display: block; +color: #ccc; +text-shadow: rgba(0,0,0,.8) 0 1px 0; +} +ul.streaminfo span.desc_now { +position: relative; +padding-top: 5px; +padding-right: 10px; +padding-bottom: 10px; +padding-left: 10px; +display: block; +color: white; +font-size: 14px; +font-style: italic; +font-weight: normal; +line-height: normal; + +} + +ul.streamstatus { +-webkit-border-radius: 8px; +-webkit-box-shadow: rgba(0,0,0,.3) 1px 1px 3px; +} +ul.streamstatus span.title { +padding-top: 10px; +padding-right: 10px; +padding-left: 10px; +font-size: 17px; +font-weight: bold; +display: block; +color: white; +text-shadow: rgba(0,0,0,.8) 0 1px 0; +} + +ul.streamstatus span.mode { +position: relative; +padding-top: 10px; +padding-right: 10px; +padding-bottom: 10px; +padding-left: 10px; +display: block; +color: white; +font-size: 14px; +font-style: italic; +font-weight: normal; +line-height: normal; +} +#jqt ul li select option{ +color: #000000; +} +#jqt ul li select optgroup{ +color: #999; +} +span.timertitle { +padding-right: 10px; +padding-left: 10px; +font-size: 14px; +font-weight: bold; +color: #999; +text-shadow: rgba(0,0,0,.8) 0 1px 0; +} +span.menutitle { +padding-right: 10px; +padding-left: 10px; +font-size: 17px; +font-weight: bold; +color: #999; +text-shadow: rgba(0,0,0,.8) 0 1px 0; +} +.formerrormsg { +padding-right: 10px; +padding-left: 10px; +font-size: 12px; +color: #FF8300; + +} +#timers .info { +display: none; +} + +a.cat_but { + +} + +video { +padding-top:5px; +} +li.track small.counter { +margin-right: 15px; +position: relative; +top: -2px; +font-size: 17px; +line-height: 13px; +font-weight: bold; +background: rgba(0,0,0,.15); +color: #fff; +-webkit-border-radius: 11px; +display: block; +width: auto; +-webkit-box-shadow: rgba(255,255,255,.1) 0 1px 0; +} +li.track { +height: 20px; +padding: 0; +} + +li.track .numberbox { +position: relative; +width: 23px; +height: 42px; +top: -10px; +display: block; +float: left; +margin-right: 3px; +border-right: 1px solid #333333; +-webkit-box-shadow: rgba(255,255,255,.1) 0 1px 0; +} +li.track .number { +position: absolute; +color: #9c9ea0; +top: 10px; +left: 2px; +} +li.track a span.tracktitle { +position: relative; +left: 32px; +padding-left: 4px; +top: -3px; +} +li.track div.timebox { +position: relative; +width: 30px; +height: 42px; +top: -38px; +display: block; +float: right; +margin-left: 3px; +border-left: 1px solid #333333; +-webkit-box-shadow: rgba(255,255,255,.1) 0 1px 0; +} +li.track .time { +position: absolute; +color: #9c9ea0; +top: 13px; +left: 5px; +font-size: 14px; +} + diff --git a/themes/css/spinningwheel.css b/themes/css/spinningwheel.css new file mode 100644 index 0000000..169853a --- /dev/null +++ b/themes/css/spinningwheel.css @@ -0,0 +1,96 @@ +#sw-wrapper { + position:absolute; z-index:1000; + left:0; + width:100%; + display:inline !important; + min-height: 0px !important; + font-family:helvetica, sans-serif; + background:rgba(0,0,0,0.7); + text-align:left; +} + +#sw-header { + position:relative; + width:100%; height:43px; + border-top:1px solid #000; border-bottom:1px solid #000; + background:url(../img/sw-header.png) 0 0 repeat-x; + opacity: 0.9; +} + +#sw-cancel, #sw-done { + position:absolute; + top:7px; + height:20px; line-height:20px; + padding:0 5px; margin:0; + border-width:5px; + font-size:12px; font-weight:bold; + text-shadow:rgba(0,0,0,0.8) 0 -1px 0; + color:#fff; +} + +#sw-cancel { + left:7px; + float:left; + -webkit-border-image:url(../img/sw-button-cancel.png) 5; +} + +#sw-done { + right:7px; + float:right; + -webkit-border-image:url(../img/sw-button-done.png) 5; +} + +.sw-pressed { opacity:0.4; } + +#sw-slots-wrapper { + position:relative; z-index:999; + display:block; + height:215px; + padding:0 11px; + overflow:hidden; +} + +#sw-slots { + display:table; + width:100%; + background:#fcfcfc; +} + +#sw-slots div { + display:table-cell; + height:100%; + padding-top:86px; + border-left:2px solid #0d0e0f; + background-color:#fcfcfc; + background-image: url(../img/sw-slot-border.png); + background-position: 0 0, 100% 0; + background-repeat: repeat-y; +} + +#sw-slots div:first-child { border:0; } + +#sw-slots ul { + padding:0 0 85px 0; margin:0; + list-style:none; +} + +#sw-slots .sw-right { text-align:right; } +#sw-slots .sw-shrink { width:1%; } +#sw-slots .sw-readonly { background:#ddd; } + +#sw-slots li { + border-top: 0px solid black !important; + color:#000000 !important; + padding:0 8px; + height:44px; + overflow:hidden; + font:bold 24px/44px Helvetica,sans-serif; +} + +#sw-frame { + position:absolute; z-index:1000; + left:0; right:0; bottom:0; + height:183px; + border-width:16px; + -webkit-border-image:url(../img/sw-alpha.png) 16; +}
\ No newline at end of file diff --git a/themes/extensions/.svn/all-wcprops b/themes/extensions/.svn/all-wcprops new file mode 100644 index 0000000..e72a5c1 --- /dev/null +++ b/themes/extensions/.svn/all-wcprops @@ -0,0 +1,29 @@ +K 25
+svn:wc:ra_dav:version-url
+V 34
+/svn/!svn/ver/130/trunk/extensions
+END
+jqt.location.js
+K 25
+svn:wc:ra_dav:version-url
+V 49
+/svn/!svn/ver/87/trunk/extensions/jqt.location.js
+END
+jqt.autotitles.js
+K 25
+svn:wc:ra_dav:version-url
+V 52
+/svn/!svn/ver/130/trunk/extensions/jqt.autotitles.js
+END
+jqt.floaty.js
+K 25
+svn:wc:ra_dav:version-url
+V 47
+/svn/!svn/ver/92/trunk/extensions/jqt.floaty.js
+END
+jqt.offline.js
+K 25
+svn:wc:ra_dav:version-url
+V 48
+/svn/!svn/ver/88/trunk/extensions/jqt.offline.js
+END
diff --git a/themes/extensions/.svn/entries b/themes/extensions/.svn/entries new file mode 100644 index 0000000..c0c93cd --- /dev/null +++ b/themes/extensions/.svn/entries @@ -0,0 +1,164 @@ +10
+
+dir
+133
+http://jqtouch.googlecode.com/svn/trunk/extensions
+http://jqtouch.googlecode.com/svn
+
+
+
+2010-01-07T21:41:55.246845Z
+130
+RBoulanouar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+210952ee-217a-11de-8f7e-2b794b28c5cd
+
+jqt.location.js
+file
+
+
+
+
+2010-03-04T14:47:55.242266Z
+62b4ccafb57c6d4ad68310e31b9be8c5
+2009-09-29T19:27:22.524742Z
+87
+davidcolbykaneda
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+2359
+
+jqt.autotitles.js
+file
+
+
+
+
+2010-03-04T14:47:55.242266Z
+7b9fb5c8e2cfa161627e35b8045a3ff6
+2010-01-07T21:41:55.246845Z
+130
+RBoulanouar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+1674
+
+jqt.floaty.js
+file
+
+
+
+
+2010-03-04T14:47:55.242266Z
+594e49444cb823a1f98b59728419b309
+2009-10-02T18:26:35.525065Z
+92
+davidcolbykaneda
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+3357
+
+jqt.offline.js
+file
+
+
+
+
+2010-03-04T14:47:55.243073Z
+f2301fb7d6f82d39cd9cf0e45edfa61d
+2009-09-30T17:50:08.206588Z
+88
+davidcolbykaneda
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+3820
+
diff --git a/themes/extensions/.svn/text-base/jqt.autotitles.js.svn-base b/themes/extensions/.svn/text-base/jqt.autotitles.js.svn-base new file mode 100644 index 0000000..74ba6f8 --- /dev/null +++ b/themes/extensions/.svn/text-base/jqt.autotitles.js.svn-base @@ -0,0 +1,51 @@ +/* + + _/ _/_/ _/_/_/_/_/ _/ + _/ _/ _/ _/_/ _/ _/ _/_/_/ _/_/_/ + _/ _/ _/_/ _/ _/ _/ _/ _/ _/ _/ _/ + _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ + _/ _/_/ _/ _/ _/_/ _/_/_/ _/_/_/ _/ _/ + _/ + _/ + + Created by David Kaneda <http://www.davidkaneda.com> + Documentation and issue tracking on Google Code <http://code.google.com/p/jqtouch/> + + Special thanks to Jonathan Stark <http://jonathanstark.com/> + and pinch/zoom <http://www.pinchzoom.com/> + + (c) 2009 by jQTouch project members. + See LICENSE.txt for license. + +*/ + +(function($) { + if ($.jQTouch) + { + $.jQTouch.addExtension(function AutoTitles(jQT){ + + var titleSelector='.toolbar h1'; + + $(function(){ + $('#jqt').bind('pageAnimationStart', function(e, data){ + if (data.direction === 'in'){ + var $title = $(titleSelector, $(e.target)); + var $ref = $(e.target).data('referrer'); + if ($title.length && $ref){ + $title.html($ref.text()); + } + } + }); + }); + + function setTitleSelector(ts){ + titleSelector=ts; + } + + return { + setTitleSelector: setTitleSelector + } + + }); + } +})(jQuery);
\ No newline at end of file diff --git a/themes/extensions/.svn/text-base/jqt.floaty.js.svn-base b/themes/extensions/.svn/text-base/jqt.floaty.js.svn-base new file mode 100644 index 0000000..63fb5e6 --- /dev/null +++ b/themes/extensions/.svn/text-base/jqt.floaty.js.svn-base @@ -0,0 +1,92 @@ +/* + + _/ _/_/ _/_/_/_/_/ _/ + _/ _/ _/ _/_/ _/ _/ _/_/_/ _/_/_/ + _/ _/ _/_/ _/ _/ _/ _/ _/ _/ _/ _/ + _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ + _/ _/_/ _/ _/ _/_/ _/_/_/ _/_/_/ _/ _/ + _/ + _/ + + Created by David Kaneda <http://www.davidkaneda.com> + Documentation and issue tracking on Google Code <http://code.google.com/p/jqtouch/> + + Special thanks to Jonathan Stark <http://jonathanstark.com/> + and pinch/zoom <http://www.pinchzoom.com/> + + (c) 2009 by jQTouch project members. + See LICENSE.txt for license. + +*/ + +(function($) { + if ($.jQTouch) + { + $.jQTouch.addExtension(function Floaty(jQT){ + + $.fn.makeFloaty = function(options){ + var defaults = { + align: 'top', + spacing: 20, + time: '.3s' + } + var settings = $.extend({}, defaults, options); + settings.align = (settings.align == 'top') ? 'top' : 'bottom'; + + return this.each(function(){ + var $el = $(this); + + $el.css({ + '-webkit-transition': 'top ' + settings.time + ' ease-in-out', + 'display': 'block', + 'min-height': '0 !important' + }).data('settings', settings); + + $(document).bind('scroll', function(){ + if ($el.data('floatyVisible') === true) + { + $el.scrollFloaty(); + } + }); + $el.scrollFloaty(); + }); + } + + $.fn.scrollFloaty = function(){ + return this.each(function(){ + var $el = $(this); + var settings = $el.data('settings'); + var wHeight = $('html').attr('clientHeight'); // WRONG + + var newY = window.pageYOffset + + ((settings.align == 'top') ? + settings.spacing : wHeight - settings.spacing - $el.get(0).offsetHeight); + + $el.css('top', newY).data('floatyVisible', true); + }); + } + + $.fn.hideFloaty = function(){ + return this.each(function(){ + var $el = $(this); + var oh = $el.get(0).offsetHeight; + + $el.css('top', -oh-10).data('floatyVisible', false); + }); + } + + $.fn.toggleFloaty = function(){ + return this.each(function(){ + var $el = $(this); + if ($el.data('floatyVisible') === true){ + $el.hideFloaty(); + } + else + { + $el.scrollFloaty(); + } + }); + } + }); + } +})(jQuery);
\ No newline at end of file diff --git a/themes/extensions/.svn/text-base/jqt.location.js.svn-base b/themes/extensions/.svn/text-base/jqt.location.js.svn-base new file mode 100644 index 0000000..a944953 --- /dev/null +++ b/themes/extensions/.svn/text-base/jqt.location.js.svn-base @@ -0,0 +1,68 @@ +/* + + _/ _/_/ _/_/_/_/_/ _/ + _/ _/ _/ _/_/ _/ _/ _/_/_/ _/_/_/ + _/ _/ _/_/ _/ _/ _/ _/ _/ _/ _/ _/ + _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ + _/ _/_/ _/ _/ _/_/ _/_/_/ _/_/_/ _/ _/ + _/ + _/ + + Created by David Kaneda <http://www.davidkaneda.com> + Documentation and issue tracking on Google Code <http://code.google.com/p/jqtouch/> + + Special thanks to Jonathan Stark <http://jonathanstark.com/> + and pinch/zoom <http://www.pinchzoom.com/> + + (c) 2009 by jQTouch project members. + See LICENSE.txt for license. + +*/ + +(function($) { + if ($.jQTouch) + { + $.jQTouch.addExtension(function Location(){ + + var latitude, longitude, callback; + + function checkGeoLocation() { + return navigator.geolocation; + } + function updateLocation(fn) { + if (checkGeoLocation()) + { + callback = fn; + navigator.geolocation.getCurrentPosition(savePosition); + return true; + } else { + console.log('Device not capable of geo-location.'); + fn(false); + return false; + } + } + function savePosition(position) { + latitude = position.coords.latitude; + longitude = position.coords.longitude; + if (callback) { + callback(getLocation()); + } + } + function getLocation() { + if (latitude && longitude) { + return { + latitude: latitude, + longitude: longitude + } + } else { + console.log('No location available. Try calling updateLocation() first.'); + return false; + } + } + return { + updateLocation: updateLocation, + getLocation: getLocation + } + }); + } +})(jQuery);
\ No newline at end of file diff --git a/themes/extensions/.svn/text-base/jqt.offline.js.svn-base b/themes/extensions/.svn/text-base/jqt.offline.js.svn-base new file mode 100644 index 0000000..b333a16 --- /dev/null +++ b/themes/extensions/.svn/text-base/jqt.offline.js.svn-base @@ -0,0 +1,97 @@ +/* + + _/ _/_/ _/_/_/_/_/ _/ + _/ _/ _/ _/_/ _/ _/ _/_/_/ _/_/_/ + _/ _/ _/_/ _/ _/ _/ _/ _/ _/ _/ _/ + _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ + _/ _/_/ _/ _/ _/_/ _/_/_/ _/_/_/ _/ _/ + _/ + _/ + + Created by David Kaneda <http://www.davidkaneda.com> + Documentation and issue tracking on Google Code <http://code.google.com/p/jqtouch/> + + Special thanks to Jonathan Stark <http://jonathanstark.com/> + + Lots of this code is specifically derived from Jonathan's book, + "Building iPhone Apps with HTML, CSS, and JavaScript" + + (c) 2009 by jQTouch project members. + See LICENSE.txt for license. + +*/ + +(function($) { + if ($.jQTouch) + { + $.jQTouch.addExtension(function Offline(){ + + // Convenience array of status values + var cacheStatusValues = []; + cacheStatusValues[0] = 'uncached'; + cacheStatusValues[1] = 'idle'; + cacheStatusValues[2] = 'checking'; + cacheStatusValues[3] = 'downloading'; + cacheStatusValues[4] = 'updateready'; + cacheStatusValues[5] = 'obsolete'; + + // Listeners for all possible events + var cache = window.applicationCache; + cache.addEventListener('cached', logEvent, false); + cache.addEventListener('checking', logEvent, false); + cache.addEventListener('downloading', logEvent, false); + cache.addEventListener('error', logEvent, false); + cache.addEventListener('noupdate', logEvent, false); + cache.addEventListener('obsolete', logEvent, false); + cache.addEventListener('progress', logEvent, false); + cache.addEventListener('updateready', logEvent, false); + + // Log every event to the console + function logEvent(e) { + var online, status, type, message; + online = (isOnline()) ? 'yes' : 'no'; + status = cacheStatusValues[cache.status]; + type = e.type; + message = 'online: ' + online; + message+= ', event: ' + type; + message+= ', status: ' + status; + if (type == 'error' && navigator.onLine) { + message+= ' There was an unknown error, check your Cache Manifest.'; + } + console.log(message); + } + + function isOnline() { + return navigator.onLine; + } + + if (!$('html').attr('manifest')) { + console.log('No Cache Manifest listed on the <html> tag.') + } + + // Swap in newly download files when update is ready + cache.addEventListener('updateready', function(e){ + // Don't perform "swap" if this is the first cache + if (cacheStatusValues[cache.status] != 'idle') { + cache.swapCache(); + console.log('Swapped/updated the Cache Manifest.'); + } + } + , false); + + // These two functions check for updates to the manifest file + function checkForUpdates(){ + cache.update(); + } + function autoCheckForUpdates(){ + setInterval(function(){cache.update()}, 10000); + } + + return { + isOnline: isOnline, + checkForUpdates: checkForUpdates, + autoCheckForUpdates: autoCheckForUpdates + } + }); + } +})(jQuery);
\ No newline at end of file diff --git a/themes/extensions/jqt.autotitles.js b/themes/extensions/jqt.autotitles.js new file mode 100644 index 0000000..f10142b --- /dev/null +++ b/themes/extensions/jqt.autotitles.js @@ -0,0 +1,51 @@ +/*
+
+ _/ _/_/ _/_/_/_/_/ _/
+ _/ _/ _/ _/_/ _/ _/ _/_/_/ _/_/_/
+ _/ _/ _/_/ _/ _/ _/ _/ _/ _/ _/ _/
+ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/
+ _/ _/_/ _/ _/ _/_/ _/_/_/ _/_/_/ _/ _/
+ _/
+ _/
+
+ Created by David Kaneda <http://www.davidkaneda.com>
+ Documentation and issue tracking on Google Code <http://code.google.com/p/jqtouch/>
+
+ Special thanks to Jonathan Stark <http://jonathanstark.com/>
+ and pinch/zoom <http://www.pinchzoom.com/>
+
+ (c) 2009 by jQTouch project members.
+ See LICENSE.txt for license.
+
+*/
+
+(function($) {
+ if ($.jQTouch)
+ {
+ $.jQTouch.addExtension(function AutoTitles(jQT){
+
+ var titleSelector='.toolbar h1';
+
+ $(function(){
+ $('#jqt').bind('pageAnimationStart', function(e, data){
+ if (data.direction === 'in'){
+ var $title = $(titleSelector, $(e.target));
+ var $ref = $(e.target).data('referrer');
+ if ($title.length && $ref){
+ $title.html($ref.text());
+ }
+ }
+ });
+ });
+
+ function setTitleSelector(ts){
+ titleSelector=ts;
+ }
+
+ return {
+ setTitleSelector: setTitleSelector
+ }
+
+ });
+ }
+})(jQuery);
\ No newline at end of file diff --git a/themes/extensions/jqt.floaty.js b/themes/extensions/jqt.floaty.js new file mode 100644 index 0000000..2ae8f4d --- /dev/null +++ b/themes/extensions/jqt.floaty.js @@ -0,0 +1,92 @@ +/*
+
+ _/ _/_/ _/_/_/_/_/ _/
+ _/ _/ _/ _/_/ _/ _/ _/_/_/ _/_/_/
+ _/ _/ _/_/ _/ _/ _/ _/ _/ _/ _/ _/
+ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/
+ _/ _/_/ _/ _/ _/_/ _/_/_/ _/_/_/ _/ _/
+ _/
+ _/
+
+ Created by David Kaneda <http://www.davidkaneda.com>
+ Documentation and issue tracking on Google Code <http://code.google.com/p/jqtouch/>
+
+ Special thanks to Jonathan Stark <http://jonathanstark.com/>
+ and pinch/zoom <http://www.pinchzoom.com/>
+
+ (c) 2009 by jQTouch project members.
+ See LICENSE.txt for license.
+
+*/
+
+(function($) {
+ if ($.jQTouch)
+ {
+ $.jQTouch.addExtension(function Floaty(jQT){
+
+ $.fn.makeFloaty = function(options){
+ var defaults = {
+ align: 'top',
+ spacing: 20,
+ time: '.3s'
+ }
+ var settings = $.extend({}, defaults, options);
+ settings.align = (settings.align == 'top') ? 'top' : 'bottom';
+
+ return this.each(function(){
+ var $el = $(this);
+
+ $el.css({
+ '-webkit-transition': 'top ' + settings.time + ' ease-in-out',
+ 'display': 'block',
+ 'min-height': '0 !important'
+ }).data('settings', settings);
+
+ $(document).bind('scroll', function(){
+ if ($el.data('floatyVisible') === true)
+ {
+ $el.scrollFloaty();
+ }
+ });
+ $el.scrollFloaty();
+ });
+ }
+
+ $.fn.scrollFloaty = function(){
+ return this.each(function(){
+ var $el = $(this);
+ var settings = $el.data('settings');
+ var wHeight = $('html').attr('clientHeight'); // WRONG
+
+ var newY = window.pageYOffset +
+ ((settings.align == 'top') ?
+ settings.spacing : wHeight - settings.spacing - $el.get(0).offsetHeight);
+
+ $el.css('top', newY).data('floatyVisible', true);
+ });
+ }
+
+ $.fn.hideFloaty = function(){
+ return this.each(function(){
+ var $el = $(this);
+ var oh = $el.get(0).offsetHeight;
+
+ $el.css('top', -oh-10).data('floatyVisible', false);
+ });
+ }
+
+ $.fn.toggleFloaty = function(){
+ return this.each(function(){
+ var $el = $(this);
+ if ($el.data('floatyVisible') === true){
+ $el.hideFloaty();
+ }
+ else
+ {
+ $el.scrollFloaty();
+ }
+ });
+ }
+ });
+ }
+})(jQuery);
\ No newline at end of file diff --git a/themes/extensions/jqt.location.js b/themes/extensions/jqt.location.js new file mode 100644 index 0000000..29b79a0 --- /dev/null +++ b/themes/extensions/jqt.location.js @@ -0,0 +1,68 @@ +/*
+
+ _/ _/_/ _/_/_/_/_/ _/
+ _/ _/ _/ _/_/ _/ _/ _/_/_/ _/_/_/
+ _/ _/ _/_/ _/ _/ _/ _/ _/ _/ _/ _/
+ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/
+ _/ _/_/ _/ _/ _/_/ _/_/_/ _/_/_/ _/ _/
+ _/
+ _/
+
+ Created by David Kaneda <http://www.davidkaneda.com>
+ Documentation and issue tracking on Google Code <http://code.google.com/p/jqtouch/>
+
+ Special thanks to Jonathan Stark <http://jonathanstark.com/>
+ and pinch/zoom <http://www.pinchzoom.com/>
+
+ (c) 2009 by jQTouch project members.
+ See LICENSE.txt for license.
+
+*/
+
+(function($) {
+ if ($.jQTouch)
+ {
+ $.jQTouch.addExtension(function Location(){
+
+ var latitude, longitude, callback;
+
+ function checkGeoLocation() {
+ return navigator.geolocation;
+ }
+ function updateLocation(fn) {
+ if (checkGeoLocation())
+ {
+ callback = fn;
+ navigator.geolocation.getCurrentPosition(savePosition);
+ return true;
+ } else {
+ console.log('Device not capable of geo-location.');
+ fn(false);
+ return false;
+ }
+ }
+ function savePosition(position) {
+ latitude = position.coords.latitude;
+ longitude = position.coords.longitude;
+ if (callback) {
+ callback(getLocation());
+ }
+ }
+ function getLocation() {
+ if (latitude && longitude) {
+ return {
+ latitude: latitude,
+ longitude: longitude
+ }
+ } else {
+ console.log('No location available. Try calling updateLocation() first.');
+ return false;
+ }
+ }
+ return {
+ updateLocation: updateLocation,
+ getLocation: getLocation
+ }
+ });
+ }
+})(jQuery);
\ No newline at end of file diff --git a/themes/extensions/jqt.offline.js b/themes/extensions/jqt.offline.js new file mode 100644 index 0000000..6145727 --- /dev/null +++ b/themes/extensions/jqt.offline.js @@ -0,0 +1,97 @@ +/*
+
+ _/ _/_/ _/_/_/_/_/ _/
+ _/ _/ _/ _/_/ _/ _/ _/_/_/ _/_/_/
+ _/ _/ _/_/ _/ _/ _/ _/ _/ _/ _/ _/
+ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/
+ _/ _/_/ _/ _/ _/_/ _/_/_/ _/_/_/ _/ _/
+ _/
+ _/
+
+ Created by David Kaneda <http://www.davidkaneda.com>
+ Documentation and issue tracking on Google Code <http://code.google.com/p/jqtouch/>
+
+ Special thanks to Jonathan Stark <http://jonathanstark.com/>
+
+ Lots of this code is specifically derived from Jonathan's book,
+ "Building iPhone Apps with HTML, CSS, and JavaScript"
+
+ (c) 2009 by jQTouch project members.
+ See LICENSE.txt for license.
+
+*/
+
+(function($) {
+ if ($.jQTouch)
+ {
+ $.jQTouch.addExtension(function Offline(){
+
+ // Convenience array of status values
+ var cacheStatusValues = [];
+ cacheStatusValues[0] = 'uncached';
+ cacheStatusValues[1] = 'idle';
+ cacheStatusValues[2] = 'checking';
+ cacheStatusValues[3] = 'downloading';
+ cacheStatusValues[4] = 'updateready';
+ cacheStatusValues[5] = 'obsolete';
+
+ // Listeners for all possible events
+ var cache = window.applicationCache;
+ cache.addEventListener('cached', logEvent, false);
+ cache.addEventListener('checking', logEvent, false);
+ cache.addEventListener('downloading', logEvent, false);
+ cache.addEventListener('error', logEvent, false);
+ cache.addEventListener('noupdate', logEvent, false);
+ cache.addEventListener('obsolete', logEvent, false);
+ cache.addEventListener('progress', logEvent, false);
+ cache.addEventListener('updateready', logEvent, false);
+
+ // Log every event to the console
+ function logEvent(e) {
+ var online, status, type, message;
+ online = (isOnline()) ? 'yes' : 'no';
+ status = cacheStatusValues[cache.status];
+ type = e.type;
+ message = 'online: ' + online;
+ message+= ', event: ' + type;
+ message+= ', status: ' + status;
+ if (type == 'error' && navigator.onLine) {
+ message+= ' There was an unknown error, check your Cache Manifest.';
+ }
+ console.log(message);
+ }
+
+ function isOnline() {
+ return navigator.onLine;
+ }
+
+ if (!$('html').attr('manifest')) {
+ console.log('No Cache Manifest listed on the <html> tag.')
+ }
+
+ // Swap in newly download files when update is ready
+ cache.addEventListener('updateready', function(e){
+ // Don't perform "swap" if this is the first cache
+ if (cacheStatusValues[cache.status] != 'idle') {
+ cache.swapCache();
+ console.log('Swapped/updated the Cache Manifest.');
+ }
+ }
+ , false);
+
+ // These two functions check for updates to the manifest file
+ function checkForUpdates(){
+ cache.update();
+ }
+ function autoCheckForUpdates(){
+ setInterval(function(){cache.update()}, 10000);
+ }
+
+ return {
+ isOnline: isOnline,
+ checkForUpdates: checkForUpdates,
+ autoCheckForUpdates: autoCheckForUpdates
+ }
+ });
+ }
+})(jQuery);
\ No newline at end of file diff --git a/themes/extensions/jquery.blockUI.js b/themes/extensions/jquery.blockUI.js new file mode 100644 index 0000000..f35de1c --- /dev/null +++ b/themes/extensions/jquery.blockUI.js @@ -0,0 +1,477 @@ +/*!
+ * jQuery blockUI plugin
+ * Version 2.31 (06-JAN-2010)
+ * @requires jQuery v1.2.3 or later
+ *
+ * Examples at: http://malsup.com/jquery/block/
+ * Copyright (c) 2007-2008 M. Alsup
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+ *
+ * Thanks to Amir-Hossein Sobhi for some excellent contributions!
+ */
+
+;(function($) {
+
+if (/1\.(0|1|2)\.(0|1|2)/.test($.fn.jquery) || /^1.1/.test($.fn.jquery)) {
+ alert('blockUI requires jQuery v1.2.3 or later! You are using v' + $.fn.jquery);
+ return;
+}
+
+$.fn._fadeIn = $.fn.fadeIn;
+
+var noOp = function() {};
+
+// this bit is to ensure we don't call setExpression when we shouldn't (with extra muscle to handle
+// retarded userAgent strings on Vista)
+var mode = document.documentMode || 0;
+var setExpr = $.browser.msie && (($.browser.version < 8 && !mode) || mode < 8);
+var ie6 = $.browser.msie && /MSIE 6.0/.test(navigator.userAgent) && !mode;
+
+// global $ methods for blocking/unblocking the entire page
+$.blockUI = function(opts) { install(window, opts); };
+$.unblockUI = function(opts) { remove(window, opts); };
+
+// convenience method for quick growl-like notifications (http://www.google.com/search?q=growl)
+$.growlUI = function(title, message, timeout, onClose) {
+ var $m = $('<div class="growlUI"></div>');
+ if (title) $m.append('<h1>'+title+'</h1>');
+ if (message) $m.append('<h2>'+message+'</h2>');
+ if (timeout == undefined) timeout = 3000;
+ $.blockUI({
+ message: $m, fadeIn: 700, fadeOut: 1000, centerY: false,
+ timeout: timeout, showOverlay: false,
+ onUnblock: onClose,
+ css: $.blockUI.defaults.growlCSS
+ });
+};
+
+// plugin method for blocking element content
+$.fn.block = function(opts) {
+ return this.unblock({ fadeOut: 0 }).each(function() {
+ if ($.css(this,'position') == 'static')
+ this.style.position = 'relative';
+ if ($.browser.msie)
+ this.style.zoom = 1; // force 'hasLayout'
+ install(this, opts);
+ });
+};
+
+// plugin method for unblocking element content
+$.fn.unblock = function(opts) {
+ return this.each(function() {
+ remove(this, opts);
+ });
+};
+
+$.blockUI.version = 2.31; // 2nd generation blocking at no extra cost!
+
+// override these in your code to change the default behavior and style
+$.blockUI.defaults = {
+ // message displayed when blocking (use null for no message)
+ message: '<h1>Please wait...</h1>',
+
+ title: null, // title string; only used when theme == true
+ draggable: true, // only used when theme == true (requires jquery-ui.js to be loaded)
+
+ theme: false, // set to true to use with jQuery UI themes
+
+ // styles for the message when blocking; if you wish to disable
+ // these and use an external stylesheet then do this in your code:
+ // $.blockUI.defaults.css = {};
+ css: {
+ padding: 0,
+ margin: 0,
+ width: '30%',
+ top: '40%',
+ left: '35%',
+ textAlign: 'center',
+ color: '#000',
+ border: '3px solid #aaa',
+ backgroundColor:'#fff',
+ cursor: 'wait'
+ },
+
+ // minimal style set used when themes are used
+ themedCSS: {
+ width: '30%',
+ top: '40%',
+ left: '35%'
+ },
+
+ // styles for the overlay
+ overlayCSS: {
+ backgroundColor: '#000',
+ opacity: 0.6,
+ cursor: 'wait'
+ },
+
+ // styles applied when using $.growlUI
+ growlCSS: {
+ width: '350px',
+ top: '10px',
+ left: '',
+ right: '10px',
+ border: 'none',
+ padding: '5px',
+ opacity: 0.6,
+ cursor: 'default',
+ color: '#fff',
+ backgroundColor: '#000',
+ '-webkit-border-radius': '10px',
+ '-moz-border-radius': '10px'
+ },
+
+ // IE issues: 'about:blank' fails on HTTPS and javascript:false is s-l-o-w
+ // (hat tip to Jorge H. N. de Vasconcelos)
+ iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank',
+
+ // force usage of iframe in non-IE browsers (handy for blocking applets)
+ forceIframe: false,
+
+ // z-index for the blocking overlay
+ baseZ: 1000,
+
+ // set these to true to have the message automatically centered
+ centerX: true, // <-- only effects element blocking (page block controlled via css above)
+ centerY: true,
+
+ // allow body element to be stetched in ie6; this makes blocking look better
+ // on "short" pages. disable if you wish to prevent changes to the body height
+ allowBodyStretch: true,
+
+ // enable if you want key and mouse events to be disabled for content that is blocked
+ bindEvents: true,
+
+ // be default blockUI will supress tab navigation from leaving blocking content
+ // (if bindEvents is true)
+ constrainTabKey: true,
+
+ // fadeIn time in millis; set to 0 to disable fadeIn on block
+ fadeIn: 200,
+
+ // fadeOut time in millis; set to 0 to disable fadeOut on unblock
+ fadeOut: 400,
+
+ // time in millis to wait before auto-unblocking; set to 0 to disable auto-unblock
+ timeout: 0,
+
+ // disable if you don't want to show the overlay
+ showOverlay: true,
+
+ // if true, focus will be placed in the first available input field when
+ // page blocking
+ focusInput: true,
+
+ // suppresses the use of overlay styles on FF/Linux (due to performance issues with opacity)
+ applyPlatformOpacityRules: true,
+
+ // callback method invoked when fadeIn has completed and blocking message is visible
+ onBlock: null,
+
+ // callback method invoked when unblocking has completed; the callback is
+ // passed the element that has been unblocked (which is the window object for page
+ // blocks) and the options that were passed to the unblock call:
+ // onUnblock(element, options)
+ onUnblock: null,
+
+ // don't ask; if you really must know: http://groups.google.com/group/jquery-en/browse_thread/thread/36640a8730503595/2f6a79a77a78e493#2f6a79a77a78e493
+ quirksmodeOffsetHack: 4
+};
+
+// private data and functions follow...
+
+var pageBlock = null;
+var pageBlockEls = [];
+
+function install(el, opts) {
+ var full = (el == window);
+ var msg = opts && opts.message !== undefined ? opts.message : undefined;
+ opts = $.extend({}, $.blockUI.defaults, opts || {});
+ opts.overlayCSS = $.extend({}, $.blockUI.defaults.overlayCSS, opts.overlayCSS || {});
+ var css = $.extend({}, $.blockUI.defaults.css, opts.css || {});
+ var themedCSS = $.extend({}, $.blockUI.defaults.themedCSS, opts.themedCSS || {});
+ msg = msg === undefined ? opts.message : msg;
+
+ // remove the current block (if there is one)
+ if (full && pageBlock)
+ remove(window, {fadeOut:0});
+
+ // if an existing element is being used as the blocking content then we capture
+ // its current place in the DOM (and current display style) so we can restore
+ // it when we unblock
+ if (msg && typeof msg != 'string' && (msg.parentNode || msg.jquery)) {
+ var node = msg.jquery ? msg[0] : msg;
+ var data = {};
+ $(el).data('blockUI.history', data);
+ data.el = node;
+ data.parent = node.parentNode;
+ data.display = node.style.display;
+ data.position = node.style.position;
+ if (data.parent)
+ data.parent.removeChild(node);
+ }
+
+ var z = opts.baseZ;
+
+ // blockUI uses 3 layers for blocking, for simplicity they are all used on every platform;
+ // layer1 is the iframe layer which is used to supress bleed through of underlying content
+ // layer2 is the overlay layer which has opacity and a wait cursor (by default)
+ // layer3 is the message content that is displayed while blocking
+
+ var lyr1 = ($.browser.msie || opts.forceIframe)
+ ? $('<iframe class="blockUI" style="z-index:'+ (z++) +';display:none;border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0" src="'+opts.iframeSrc+'"></iframe>')
+ : $('<div class="blockUI" style="display:none"></div>');
+ var lyr2 = $('<div class="blockUI blockOverlay" style="z-index:'+ (z++) +';display:none;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"></div>');
+
+ var lyr3;
+ if (opts.theme && full) {
+ var s = '<div class="blockUI blockMsg blockPage ui-dialog ui-widget ui-corner-all" style="z-index:'+z+';display:none;position:fixed">' +
+ '<div class="ui-widget-header ui-dialog-titlebar blockTitle">'+(opts.title || ' ')+'</div>' +
+ '<div class="ui-widget-content ui-dialog-content"></div>' +
+ '</div>';
+ lyr3 = $(s);
+ }
+ else {
+ lyr3 = full ? $('<div class="blockUI blockMsg blockPage" style="z-index:'+z+';display:none;position:fixed"></div>')
+ : $('<div class="blockUI blockMsg blockElement" style="z-index:'+z+';display:none;position:absolute"></div>');
+ }
+
+ // if we have a message, style it
+ if (msg) {
+ if (opts.theme) {
+ lyr3.css(themedCSS);
+ lyr3.addClass('ui-widget-content');
+ }
+ else
+ lyr3.css(css);
+ }
+
+ // style the overlay
+ if (!opts.applyPlatformOpacityRules || !($.browser.mozilla && /Linux/.test(navigator.platform)))
+ lyr2.css(opts.overlayCSS);
+ lyr2.css('position', full ? 'fixed' : 'absolute');
+
+ // make iframe layer transparent in IE
+ if ($.browser.msie || opts.forceIframe)
+ lyr1.css('opacity',0.0);
+
+ //$([lyr1[0],lyr2[0],lyr3[0]]).appendTo(full ? 'body' : el);
+ var layers = [lyr1,lyr2,lyr3], $par = full ? $('body') : $(el);
+ $.each(layers, function() {
+ this.appendTo($par);
+ });
+
+ if (opts.theme && opts.draggable && $.fn.draggable) {
+ lyr3.draggable({
+ handle: '.ui-dialog-titlebar',
+ cancel: 'li'
+ });
+ }
+
+ // ie7 must use absolute positioning in quirks mode and to account for activex issues (when scrolling)
+ var expr = setExpr && (!$.boxModel || $('object,embed', full ? null : el).length > 0);
+ if (ie6 || expr) {
+ // give body 100% height
+ if (full && opts.allowBodyStretch && $.boxModel)
+ $('html,body').css('height','100%');
+
+ // fix ie6 issue when blocked element has a border width
+ if ((ie6 || !$.boxModel) && !full) {
+ var t = sz(el,'borderTopWidth'), l = sz(el,'borderLeftWidth');
+ var fixT = t ? '(0 - '+t+')' : 0;
+ var fixL = l ? '(0 - '+l+')' : 0;
+ }
+
+ // simulate fixed position
+ $.each([lyr1,lyr2,lyr3], function(i,o) {
+ var s = o[0].style;
+ s.position = 'absolute';
+ if (i < 2) {
+ full ? s.setExpression('height','Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.boxModel?0:'+opts.quirksmodeOffsetHack+') + "px"')
+ : s.setExpression('height','this.parentNode.offsetHeight + "px"');
+ full ? s.setExpression('width','jQuery.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"')
+ : s.setExpression('width','this.parentNode.offsetWidth + "px"');
+ if (fixL) s.setExpression('left', fixL);
+ if (fixT) s.setExpression('top', fixT);
+ }
+ else if (opts.centerY) {
+ if (full) s.setExpression('top','(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"');
+ s.marginTop = 0;
+ }
+ else if (!opts.centerY && full) {
+ var top = (opts.css && opts.css.top) ? parseInt(opts.css.top) : 0;
+ var expression = '((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + '+top+') + "px"';
+ s.setExpression('top',expression);
+ }
+ });
+ }
+
+ // show the message
+ if (msg) {
+ if (opts.theme)
+ lyr3.find('.ui-widget-content').append(msg);
+ else
+ lyr3.append(msg);
+ if (msg.jquery || msg.nodeType)
+ $(msg).show();
+ }
+
+ if (($.browser.msie || opts.forceIframe) && opts.showOverlay)
+ lyr1.show(); // opacity is zero
+ if (opts.fadeIn) {
+ var cb = opts.onBlock ? opts.onBlock : noOp;
+ var cb1 = (opts.showOverlay && !msg) ? cb : noOp;
+ var cb2 = msg ? cb : noOp;
+ if (opts.showOverlay)
+ lyr2._fadeIn(opts.fadeIn, cb1);
+ if (msg)
+ lyr3._fadeIn(opts.fadeIn, cb2);
+ }
+ else {
+ if (opts.showOverlay)
+ lyr2.show();
+ if (msg)
+ lyr3.show();
+ if (opts.onBlock)
+ opts.onBlock();
+ }
+
+ // bind key and mouse events
+ bind(1, el, opts);
+
+ if (full) {
+ pageBlock = lyr3[0];
+ pageBlockEls = $(':input:enabled:visible',pageBlock);
+ if (opts.focusInput)
+ setTimeout(focus, 20);
+ }
+ else
+ center(lyr3[0], opts.centerX, opts.centerY);
+
+ if (opts.timeout) {
+ // auto-unblock
+ var to = setTimeout(function() {
+ full ? $.unblockUI(opts) : $(el).unblock(opts);
+ }, opts.timeout);
+ $(el).data('blockUI.timeout', to);
+ }
+};
+
+// remove the block
+function remove(el, opts) {
+ var full = (el == window);
+ var $el = $(el);
+ var data = $el.data('blockUI.history');
+ var to = $el.data('blockUI.timeout');
+ if (to) {
+ clearTimeout(to);
+ $el.removeData('blockUI.timeout');
+ }
+ opts = $.extend({}, $.blockUI.defaults, opts || {});
+ bind(0, el, opts); // unbind events
+
+ var els;
+ if (full) // crazy selector to handle odd field errors in ie6/7
+ els = $('body').children().filter('.blockUI').add('body > .blockUI');
+ else
+ els = $('.blockUI', el);
+
+ if (full)
+ pageBlock = pageBlockEls = null;
+
+ if (opts.fadeOut) {
+ els.fadeOut(opts.fadeOut);
+ setTimeout(function() { reset(els,data,opts,el); }, opts.fadeOut);
+ }
+ else
+ reset(els, data, opts, el);
+};
+
+// move blocking element back into the DOM where it started
+function reset(els,data,opts,el) {
+ els.each(function(i,o) {
+ // remove via DOM calls so we don't lose event handlers
+ if (this.parentNode)
+ this.parentNode.removeChild(this);
+ });
+
+ if (data && data.el) {
+ data.el.style.display = data.display;
+ data.el.style.position = data.position;
+ if (data.parent)
+ data.parent.appendChild(data.el);
+ $(el).removeData('blockUI.history');
+ }
+
+ if (typeof opts.onUnblock == 'function')
+ opts.onUnblock(el,opts);
+};
+
+// bind/unbind the handler
+function bind(b, el, opts) {
+ var full = el == window, $el = $(el);
+
+ // don't bother unbinding if there is nothing to unbind
+ if (!b && (full && !pageBlock || !full && !$el.data('blockUI.isBlocked')))
+ return;
+ if (!full)
+ $el.data('blockUI.isBlocked', b);
+
+ // don't bind events when overlay is not in use or if bindEvents is false
+ if (!opts.bindEvents || (b && !opts.showOverlay))
+ return;
+
+ // bind anchors and inputs for mouse and key events
+ var events = 'mousedown mouseup keydown keypress';
+ b ? $(document).bind(events, opts, handler) : $(document).unbind(events, handler);
+
+// former impl...
+// var $e = $('a,:input');
+// b ? $e.bind(events, opts, handler) : $e.unbind(events, handler);
+};
+
+// event handler to suppress keyboard/mouse events when blocking
+function handler(e) {
+ // allow tab navigation (conditionally)
+ if (e.keyCode && e.keyCode == 9) {
+ if (pageBlock && e.data.constrainTabKey) {
+ var els = pageBlockEls;
+ var fwd = !e.shiftKey && e.target == els[els.length-1];
+ var back = e.shiftKey && e.target == els[0];
+ if (fwd || back) {
+ setTimeout(function(){focus(back)},10);
+ return false;
+ }
+ }
+ }
+ // allow events within the message content
+ if ($(e.target).parents('div.blockMsg').length > 0)
+ return true;
+
+ // allow events for content that is not being blocked
+ return $(e.target).parents().children().filter('div.blockUI').length == 0;
+};
+
+function focus(back) {
+ if (!pageBlockEls)
+ return;
+ var e = pageBlockEls[back===true ? pageBlockEls.length-1 : 0];
+ if (e)
+ e.focus();
+};
+
+function center(el, x, y) {
+ var p = el.parentNode, s = el.style;
+ var l = ((p.offsetWidth - el.offsetWidth)/2) - sz(p,'borderLeftWidth');
+ var t = ((p.offsetHeight - el.offsetHeight)/2) - sz(p,'borderTopWidth');
+ if (x) s.left = l > 0 ? (l+'px') : '0';
+ if (y) s.top = t > 0 ? (t+'px') : '0';
+};
+
+function sz(el, p) {
+ return parseInt($.css(el,p))||0;
+};
+
+})(jQuery);
diff --git a/themes/extensions/jquery.httpstream.js b/themes/extensions/jquery.httpstream.js new file mode 100644 index 0000000..e1be612 --- /dev/null +++ b/themes/extensions/jquery.httpstream.js @@ -0,0 +1,161 @@ +/* jQuery ajax stream plugin
+* Version 0.1
+* Copyright (C) 2009 Chris Tarquini
+* Licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License (http://creativecommons.org/licenses/by-sa/3.0/)
+* Permissions beyond the scope of this license may be available by contacting petros000[at]hotmail.com.
+*/
+
+(function($) {
+
+// Save the original AJAX function
+var ajax_old = $.ajax;
+var get_old = $.get;
+var post_old = $.post;
+var active = true;
+// Add our settings
+$.ajaxSetup({stream: false,pollInterval: 500/*, onDataRecieved: function(){}*/ });
+$.enableAjaxStream = function(enable)
+{
+if(typeof enable == 'undefined') enable = !active;
+if(!enable)
+{
+$.ajax = ajax_old;
+$.get = get_old;
+$.post = post_old;
+active = false;
+}
+else
+{
+$.ajax = ajax_stream;
+$.get = ajax_get_stream;
+$.post = ajax_post_stream;
+active = true;
+}
+
+
+}
+var ajax_stream = $.ajax = function(options)
+{
+//copied from original ajax function
+ options = jQuery.extend(true, options, jQuery.extend(true, {}, jQuery.ajaxSettings, options));
+if(options.stream)
+{
+var timer = 0;
+var offset = 0;
+var xmlhttp = null;
+var lastlen = 0;
+var done = false;
+var hook = function(xhr)
+{
+xmlhttp = xhr;
+checkagain();
+}
+var fix = function(){ check('stream'); };// fixes weird bug with random numbers as arg
+var checkagain = function(){if(!done) timer = setTimeout(fix,options.pollInterval);}
+var check = function(status)
+{
+if(typeof status == 'undefined') status = "stream";
+if(xmlhttp.status < 3) return; //only get the latest packet if data has been sent
+var text = xmlhttp.responseText;
+if(status == 'stream') //if we arent streaming then just flush the buffer
+{
+if(text.length <= lastlen) { checkagain(); return;}
+lastlength = text.length;
+if(offset == text.length) { checkagain(); return;}
+}
+var pkt = text.substr(offset);
+offset = text.length;
+if($.isFunction(options.OnDataRecieved))
+{
+options.OnDataRecieved(pkt, status, xmlhttp.responseText, xmlhttp);
+}
+if(xmlhttp.status != 4)
+checkagain();
+}
+var complete = function(xhr,s)
+{
+clearTimeout(timer);//done..stop polling
+done = true;
+// send final call
+check(s);
+}
+// If the complete callback is set create a new callback that calls the users and outs
+if($.isFunction(options.success))
+{
+var oc = options.success;
+options.success = function(xhr,s){ complete(xhr,s); oc(xhr,s);};
+
+}
+else options.success = complete;
+// Set up our hook on the beforeSend
+if($.isFunction(options.beforeSend))
+{
+var obs = options.beforeSend;
+options.beforeSend = function(xhr){ obs(xhr); hook(xhr);};
+}
+else options.beforeSend = hook;
+
+}
+ajax_old(options);
+}
+
+var ajax_get_stream = $.get = function(url,data,callback,type,stream)
+{
+if($.isFunction(data))
+{
+var orgcb = callback;
+callback = data;
+if($.isFunction(orgcb))
+{
+stream = orgcb;
+}
+data = null;
+
+}
+if($.isFunction(type))
+{
+stream = type;
+type = undefined;
+}
+var dostream = $.isFunction(stream);
+ return jQuery.ajax({
+ type: "GET",
+ url: url,
+ data: data,
+ success: callback,
+ dataType: type,
+stream: dostream,
+OnDataRecieved: stream
+ });
+
+}
+
+var ajax_post_stream = $.post = function(url,data,callback,type,stream)
+{
+ if($.isFunction(data))
+ {
+var orgcb = callback;
+ callback = data;
+ data = {};
+if($.isFunction(orgcb)) { stream = orgcb;}
+
+ }
+ if($.isFunction(type))
+ {
+ stream = type;
+ type = undefined;
+ }
+ var dostream = $.isFunction(stream);
+ return jQuery.ajax({
+ type: "POST",
+ url: url,
+ data: data,
+ success: callback,
+ dataType: type,
+ stream: dostream,
+ OnDataRecieved: stream
+ });
+
+}
+
+})(jQuery);
diff --git a/themes/extensions/jquery.scrollTo-min.js b/themes/extensions/jquery.scrollTo-min.js new file mode 100644 index 0000000..73a3341 --- /dev/null +++ b/themes/extensions/jquery.scrollTo-min.js @@ -0,0 +1,11 @@ +/**
+ * jQuery.ScrollTo - Easy element scrolling using jQuery.
+ * Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
+ * Dual licensed under MIT and GPL.
+ * Date: 5/25/2009
+ * @author Ariel Flesler
+ * @version 1.4.2
+ *
+ * http://flesler.blogspot.com/2007/10/jqueryscrollto.html
+ */
+;(function(d){var k=d.scrollTo=function(a,i,e){d(window).scrollTo(a,i,e)};k.defaults={axis:'xy',duration:parseFloat(d.fn.jquery)>=1.3?0:1};k.window=function(a){return d(window)._scrollable()};d.fn._scrollable=function(){return this.map(function(){var a=this,i=!a.nodeName||d.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!i)return a;var e=(a.contentWindow||a).document||a.ownerDocument||a;return d.browser.safari||e.compatMode=='BackCompat'?e.body:e.documentElement})};d.fn.scrollTo=function(n,j,b){if(typeof j=='object'){b=j;j=0}if(typeof b=='function')b={onAfter:b};if(n=='max')n=9e9;b=d.extend({},k.defaults,b);j=j||b.speed||b.duration;b.queue=b.queue&&b.axis.length>1;if(b.queue)j/=2;b.offset=p(b.offset);b.over=p(b.over);return this._scrollable().each(function(){var q=this,r=d(q),f=n,s,g={},u=r.is('html,body');switch(typeof f){case'number':case'string':if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(f)){f=p(f);break}f=d(f,this);case'object':if(f.is||f.style)s=(f=d(f)).offset()}d.each(b.axis.split(''),function(a,i){var e=i=='x'?'Left':'Top',h=e.toLowerCase(),c='scroll'+e,l=q[c],m=k.max(q,i);if(s){g[c]=s[h]+(u?0:l-r.offset()[h]);if(b.margin){g[c]-=parseInt(f.css('margin'+e))||0;g[c]-=parseInt(f.css('border'+e+'Width'))||0}g[c]+=b.offset[h]||0;if(b.over[h])g[c]+=f[i=='x'?'width':'height']()*b.over[h]}else{var o=f[h];g[c]=o.slice&&o.slice(-1)=='%'?parseFloat(o)/100*m:o}if(/^\d+$/.test(g[c]))g[c]=g[c]<=0?0:Math.min(g[c],m);if(!a&&b.queue){if(l!=g[c])t(b.onAfterFirst);delete g[c]}});t(b.onAfter);function t(a){r.animate(g,j,b.easing,a&&function(){a.call(this,n,b)})}}).end()};k.max=function(a,i){var e=i=='x'?'Width':'Height',h='scroll'+e;if(!d(a).is('html,body'))return a[h]-d(a)[e.toLowerCase()]();var c='client'+e,l=a.ownerDocument.documentElement,m=a.ownerDocument.body;return Math.max(l[h],m[h])-Math.min(l[c],m[c])};function p(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery);
\ No newline at end of file diff --git a/themes/extensions/jquery.scrollTo.js b/themes/extensions/jquery.scrollTo.js new file mode 100644 index 0000000..eec31e1 --- /dev/null +++ b/themes/extensions/jquery.scrollTo.js @@ -0,0 +1,215 @@ +/**
+ * jQuery.ScrollTo
+ * Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
+ * Dual licensed under MIT and GPL.
+ * Date: 5/25/2009
+ *
+ * @projectDescription Easy element scrolling using jQuery.
+ * http://flesler.blogspot.com/2007/10/jqueryscrollto.html
+ * Works with jQuery +1.2.6. Tested on FF 2/3, IE 6/7/8, Opera 9.5/6, Safari 3, Chrome 1 on WinXP.
+ *
+ * @author Ariel Flesler
+ * @version 1.4.2
+ *
+ * @id jQuery.scrollTo
+ * @id jQuery.fn.scrollTo
+ * @param {String, Number, DOMElement, jQuery, Object} target Where to scroll the matched elements.
+ * The different options for target are:
+ * - A number position (will be applied to all axes).
+ * - A string position ('44', '100px', '+=90', etc ) will be applied to all axes
+ * - A jQuery/DOM element ( logically, child of the element to scroll )
+ * - A string selector, that will be relative to the element to scroll ( 'li:eq(2)', etc )
+ * - A hash { top:x, left:y }, x and y can be any kind of number/string like above.
+* - A percentage of the container's dimension/s, for example: 50% to go to the middle.
+ * - The string 'max' for go-to-end.
+ * @param {Number} duration The OVERALL length of the animation, this argument can be the settings object instead.
+ * @param {Object,Function} settings Optional set of settings or the onAfter callback.
+ * @option {String} axis Which axis must be scrolled, use 'x', 'y', 'xy' or 'yx'.
+ * @option {Number} duration The OVERALL length of the animation.
+ * @option {String} easing The easing method for the animation.
+ * @option {Boolean} margin If true, the margin of the target element will be deducted from the final position.
+ * @option {Object, Number} offset Add/deduct from the end position. One number for both axes or { top:x, left:y }.
+ * @option {Object, Number} over Add/deduct the height/width multiplied by 'over', can be { top:x, left:y } when using both axes.
+ * @option {Boolean} queue If true, and both axis are given, the 2nd axis will only be animated after the first one ends.
+ * @option {Function} onAfter Function to be called after the scrolling ends.
+ * @option {Function} onAfterFirst If queuing is activated, this function will be called after the first scrolling ends.
+ * @return {jQuery} Returns the same jQuery object, for chaining.
+ *
+ * @desc Scroll to a fixed position
+ * @example $('div').scrollTo( 340 );
+ *
+ * @desc Scroll relatively to the actual position
+ * @example $('div').scrollTo( '+=340px', { axis:'y' } );
+ *
+ * @dec Scroll using a selector (relative to the scrolled element)
+ * @example $('div').scrollTo( 'p.paragraph:eq(2)', 500, { easing:'swing', queue:true, axis:'xy' } );
+ *
+ * @ Scroll to a DOM element (same for jQuery object)
+ * @example var second_child = document.getElementById('container').firstChild.nextSibling;
+ * $('#container').scrollTo( second_child, { duration:500, axis:'x', onAfter:function(){
+ * alert('scrolled!!');
+ * }});
+ *
+ * @desc Scroll on both axes, to different values
+ * @example $('div').scrollTo( { top: 300, left:'+=200' }, { axis:'xy', offset:-20 } );
+ */
+;(function( $ ){
+
+ var $scrollTo = $.scrollTo = function( target, duration, settings ){
+ $(window).scrollTo( target, duration, settings );
+ };
+
+ $scrollTo.defaults = {
+ axis:'xy',
+ duration: parseFloat($.fn.jquery) >= 1.3 ? 0 : 1
+ };
+
+ // Returns the element that needs to be animated to scroll the window.
+ // Kept for backwards compatibility (specially for localScroll & serialScroll)
+ $scrollTo.window = function( scope ){
+ return $(window)._scrollable();
+ };
+
+ // Hack, hack, hack :)
+ // Returns the real elements to scroll (supports window/iframes, documents and regular nodes)
+ $.fn._scrollable = function(){
+ return this.map(function(){
+ var elem = this,
+ isWin = !elem.nodeName || $.inArray( elem.nodeName.toLowerCase(), ['iframe','#document','html','body'] ) != -1;
+
+ if( !isWin )
+ return elem;
+
+ var doc = (elem.contentWindow || elem).document || elem.ownerDocument || elem;
+
+ return $.browser.safari || doc.compatMode == 'BackCompat' ?
+ doc.body :
+ doc.documentElement;
+ });
+ };
+
+ $.fn.scrollTo = function( target, duration, settings ){
+ if( typeof duration == 'object' ){
+ settings = duration;
+ duration = 0;
+ }
+ if( typeof settings == 'function' )
+ settings = { onAfter:settings };
+
+ if( target == 'max' )
+ target = 9e9;
+
+ settings = $.extend( {}, $scrollTo.defaults, settings );
+ // Speed is still recognized for backwards compatibility
+ duration = duration || settings.speed || settings.duration;
+ // Make sure the settings are given right
+ settings.queue = settings.queue && settings.axis.length > 1;
+
+ if( settings.queue )
+ // Let's keep the overall duration
+ duration /= 2;
+ settings.offset = both( settings.offset );
+ settings.over = both( settings.over );
+
+ return this._scrollable().each(function(){
+ var elem = this,
+ $elem = $(elem),
+ targ = target, toff, attr = {},
+ win = $elem.is('html,body');
+
+ switch( typeof targ ){
+ // A number will pass the regex
+ case 'number':
+ case 'string':
+ if( /^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(targ) ){
+ targ = both( targ );
+ // We are done
+ break;
+ }
+ // Relative selector, no break!
+ targ = $(targ,this);
+ case 'object':
+ // DOMElement / jQuery
+ if( targ.is || targ.style )
+ // Get the real position of the target
+ toff = (targ = $(targ)).offset();
+ }
+ $.each( settings.axis.split(''), function( i, axis ){
+ var Pos = axis == 'x' ? 'Left' : 'Top',
+ pos = Pos.toLowerCase(),
+ key = 'scroll' + Pos,
+ old = elem[key],
+ max = $scrollTo.max(elem, axis);
+
+ if( toff ){// jQuery / DOMElement
+ attr[key] = toff[pos] + ( win ? 0 : old - $elem.offset()[pos] );
+
+ // If it's a dom element, reduce the margin
+ if( settings.margin ){
+ attr[key] -= parseInt(targ.css('margin'+Pos)) || 0;
+ attr[key] -= parseInt(targ.css('border'+Pos+'Width')) || 0;
+ }
+
+ attr[key] += settings.offset[pos] || 0;
+
+ if( settings.over[pos] )
+ // Scroll to a fraction of its width/height
+ attr[key] += targ[axis=='x'?'width':'height']() * settings.over[pos];
+ }else{
+ var val = targ[pos];
+ // Handle percentage values
+ attr[key] = val.slice && val.slice(-1) == '%' ?
+ parseFloat(val) / 100 * max
+ : val;
+ }
+
+ // Number or 'number'
+ if( /^\d+$/.test(attr[key]) )
+ // Check the limits
+ attr[key] = attr[key] <= 0 ? 0 : Math.min( attr[key], max );
+
+ // Queueing axes
+ if( !i && settings.queue ){
+ // Don't waste time animating, if there's no need.
+ if( old != attr[key] )
+ // Intermediate animation
+ animate( settings.onAfterFirst );
+ // Don't animate this axis again in the next iteration.
+ delete attr[key];
+ }
+ });
+
+ animate( settings.onAfter );
+
+ function animate( callback ){
+ $elem.animate( attr, duration, settings.easing, callback && function(){
+ callback.call(this, target, settings);
+ });
+ };
+
+ }).end();
+ };
+
+ // Max scrolling position, works on quirks mode
+ // It only fails (not too badly) on IE, quirks mode.
+ $scrollTo.max = function( elem, axis ){
+ var Dim = axis == 'x' ? 'Width' : 'Height',
+ scroll = 'scroll'+Dim;
+
+ if( !$(elem).is('html,body') )
+ return elem[scroll] - $(elem)[Dim.toLowerCase()]();
+
+ var size = 'client' + Dim,
+ html = elem.ownerDocument.documentElement,
+ body = elem.ownerDocument.body;
+
+ return Math.max( html[scroll], body[scroll] )
+ - Math.min( html[size] , body[size] );
+
+ };
+
+ function both( val ){
+ return typeof val == 'object' ? val : { top:val, left:val };
+ };
+
+})( jQuery );
\ No newline at end of file diff --git a/themes/getstatus.php.bak b/themes/getstatus.php.bak new file mode 100755 index 0000000..368991b --- /dev/null +++ b/themes/getstatus.php.bak @@ -0,0 +1,30 @@ +<?php +header('Content-type: application/json'); +$oldtree = null; +$time = time(); +$i = 0; +while((time() - $time) < 29) +{ + $tree = file_get_contents("status.txt"); + + if ($tree !== $oldtree ) + { + $i+=1; + print $tree; + ob_flush(); + flush(); + } + $data = json_decode($tree); + if ($data->status == "ready") + { + break; + } else if ($data->status == "error") + { + break; + } + $oldtree = $tree; + usleep(1000); + +} + +?> diff --git a/themes/img/audio.png b/themes/img/audio.png Binary files differnew file mode 100644 index 0000000..e0f14a3 --- /dev/null +++ b/themes/img/audio.png diff --git a/themes/img/epg.png b/themes/img/epg.png Binary files differnew file mode 100644 index 0000000..7c09685 --- /dev/null +++ b/themes/img/epg.png diff --git a/themes/img/istreamdev.png b/themes/img/istreamdev.png Binary files differnew file mode 100644 index 0000000..f4153e4 --- /dev/null +++ b/themes/img/istreamdev.png diff --git a/themes/img/loading.gif b/themes/img/loading.gif Binary files differnew file mode 100644 index 0000000..6ab75dd --- /dev/null +++ b/themes/img/loading.gif diff --git a/themes/img/mask-55.png b/themes/img/mask-55.png Binary files differnew file mode 100644 index 0000000..182ea20 --- /dev/null +++ b/themes/img/mask-55.png diff --git a/themes/img/mask.png b/themes/img/mask.png Binary files differnew file mode 100644 index 0000000..e35a3f8 --- /dev/null +++ b/themes/img/mask.png diff --git a/themes/img/media.png b/themes/img/media.png Binary files differnew file mode 100644 index 0000000..647578f --- /dev/null +++ b/themes/img/media.png diff --git a/themes/img/nologoMEDIA.png b/themes/img/nologoMEDIA.png Binary files differnew file mode 100644 index 0000000..6510dbe --- /dev/null +++ b/themes/img/nologoMEDIA.png diff --git a/themes/img/nologoREC.png b/themes/img/nologoREC.png Binary files differnew file mode 100644 index 0000000..fd15428 --- /dev/null +++ b/themes/img/nologoREC.png diff --git a/themes/img/nologoTV.png b/themes/img/nologoTV.png Binary files differnew file mode 100644 index 0000000..4f0a9da --- /dev/null +++ b/themes/img/nologoTV.png diff --git a/themes/img/rec.png b/themes/img/rec.png Binary files differnew file mode 100644 index 0000000..d8744bd --- /dev/null +++ b/themes/img/rec.png diff --git a/themes/img/rec_clicked.png b/themes/img/rec_clicked.png Binary files differnew file mode 100644 index 0000000..a54d5e2 --- /dev/null +++ b/themes/img/rec_clicked.png diff --git a/themes/img/record.png b/themes/img/record.png Binary files differnew file mode 100644 index 0000000..c0a1d79 --- /dev/null +++ b/themes/img/record.png diff --git a/themes/img/startup.png b/themes/img/startup.png Binary files differnew file mode 100644 index 0000000..e095c82 --- /dev/null +++ b/themes/img/startup.png diff --git a/themes/img/stream.png b/themes/img/stream.png Binary files differnew file mode 100644 index 0000000..16d66d2 --- /dev/null +++ b/themes/img/stream.png diff --git a/themes/img/stream_clicked.png b/themes/img/stream_clicked.png Binary files differnew file mode 100644 index 0000000..c63595c --- /dev/null +++ b/themes/img/stream_clicked.png diff --git a/themes/img/sw-alpha.png b/themes/img/sw-alpha.png Binary files differnew file mode 100644 index 0000000..b80659a --- /dev/null +++ b/themes/img/sw-alpha.png diff --git a/themes/img/sw-button-cancel.png b/themes/img/sw-button-cancel.png Binary files differnew file mode 100644 index 0000000..cea9e38 --- /dev/null +++ b/themes/img/sw-button-cancel.png diff --git a/themes/img/sw-button-done.png b/themes/img/sw-button-done.png Binary files differnew file mode 100644 index 0000000..a1e8f32 --- /dev/null +++ b/themes/img/sw-button-done.png diff --git a/themes/img/sw-header.png b/themes/img/sw-header.png Binary files differnew file mode 100644 index 0000000..db4ec27 --- /dev/null +++ b/themes/img/sw-header.png diff --git a/themes/img/sw-slot-border.png b/themes/img/sw-slot-border.png Binary files differnew file mode 100644 index 0000000..d9f6026 --- /dev/null +++ b/themes/img/sw-slot-border.png diff --git a/themes/img/timeroff.png b/themes/img/timeroff.png Binary files differnew file mode 100644 index 0000000..1bf58dd --- /dev/null +++ b/themes/img/timeroff.png diff --git a/themes/img/timeron.png b/themes/img/timeron.png Binary files differnew file mode 100644 index 0000000..25ee571 --- /dev/null +++ b/themes/img/timeron.png diff --git a/themes/img/timerrec.png b/themes/img/timerrec.png Binary files differnew file mode 100644 index 0000000..e4f5617 --- /dev/null +++ b/themes/img/timerrec.png diff --git a/themes/img/timers.png b/themes/img/timers.png Binary files differnew file mode 100644 index 0000000..d7f86e1 --- /dev/null +++ b/themes/img/timers.png diff --git a/themes/img/tv.png b/themes/img/tv.png Binary files differnew file mode 100644 index 0000000..74f9fdc --- /dev/null +++ b/themes/img/tv.png diff --git a/themes/img/video.png b/themes/img/video.png Binary files differnew file mode 100644 index 0000000..090114a --- /dev/null +++ b/themes/img/video.png diff --git a/themes/index.html b/themes/index.html new file mode 100644 index 0000000..66c8fa7 --- /dev/null +++ b/themes/index.html @@ -0,0 +1,244 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" manifest="istreamdev.manifest"> + <head> + <meta charset="UTF-8" /> + <title>iStreamdev</title> + <style type="text/css" media="screen">@import "jqtouch/jqtouch.css";</style> + <style type="text/css" media="screen">@import "themes/jqt/theme.css";</style> + <style type="text/css" media="screen">@import "css/istreamdev.css";</style> + <script src="jqtouch/jquery.1.3.2.min.js" type="text/javascript" charset="utf-8"></script> + <script src="jqtouch/jqtouch.js" type="application/x-javascript" charset="utf-8"></script> + <script src="jqtouch/jqtouch.transitions.js" type="application/x-javascript" charset="utf-8"></script> + <script src="extensions/jquery.scrollTo-min.js" type="application/x-javascript" charset="utf-8"></script> + <script src="js/spinningwheel.js" type="application/x-javascript" charset="utf-8"></script> + <script src="js/functions.js" type="application/x-javascript" charset="utf-8"></script> + <script src="js/istreamdev.js" type="application/x-javascript" charset="utf-8"></script> + <style type="text/css" media="screen">@import "css/spinningwheel.css";</style> + </head> + <body> + <div id="loader"></div> + <div id="jqt"> + <!---------------------------------- HOME SCREEN (always present) ----------------------------------> + <div id="home" class="current"> + <div class="toolbar"> + <h1>HOME</h1> + </div> + <ul class="rounded"> + <li><span class="menutitle">VDR</span></li> + <li class="arrow"><a id="categories_but" href="#"><img class="menuicon" src="img/tv.png" /><span class="menuname">Watch TV</span></a></li> + <li class="arrow"><a id="recording_but" href="#"><img class="menuicon" src="img/record.png" /><span class="menuname">Recordings</span></a></li> + <li class="arrow"><a id="timers_but" href="#"><img class="menuicon" src="img/timers.png" /><span class="menuname">Timers</span></a></li> + <li class="arrow"><a id="epg_but" href="#"><img class="menuicon" src="img/epg.png" /><span class="menuname">Program Guide</span></a></li> + </ul> + <ul class="rounded"> + <li><span class="menutitle">FILES</span></li> + <li class="arrow"><a id="video_but" href="#browser"><img class="menuicon" src="img/video.png" /><span class="menuname">Video</span></a></li> + <li class="arrow"><a id="audio_but" class="cube" href="#audio"><img class="menuicon" src="img/audio.png" /><span class="menuname">Audio</span></a></li> + </ul> + </div> + <!----------------------------------/ HOME SCREEN ----------------------------------> + <!---------------------------------- CHAN CATEGORY SCREEN ----------------------------------> + <!----------------------------------categories------------------------------> + <div id="categories"> + <div class="toolbar"> + <a href="#" class="back">Home</a> + <h1><img class="menuicon" src="img/tv.png" /> CATEGORIES</h1> + </div> + <ul id="cat_menu" class="rounded"> + </ul> + </div> + <!----------------------------------channels------------------------------> + <div id="channels"> + <div class="toolbar"> + <a href="#" class="back">Back</a> + <a href="#home" id="home_but" class="button">Home</a> + <h1><img class="menuicon" src="img/tv.png" /> CHANNELS</h1> + </div> + <ul id="chan_menu" class="rounded"> + </ul> + </div> + <!---------------------------------- /CHAN CATEGORY SCREEN ----------------------------------> + <!---------------------------------- STREAM SCREEN ----------------------------------> + <!------------------------ tv start stream -----------------------------------------> + <div id="streamchannel"> + <div class="toolbar"> + <a href="#" class="back">Back</a> + <a href="#home" id="home_but" class="button">Home</a> + <h1><img class="menuicon" src="img/tv.png" />Channel</h1> + </div> + <center><ul class="thumb" style="width:90px"><img class="thumbnail" id="thumbnail" src="" /></ul></center> + <ul class="streaminfo"> + <li><span class="name_now"></span> + <span class="epgtime_now"></span> + <span class="desc_now"></span></li> + <li> + <span class="name_next"></span> + <span class="epgtime_next"></span></li> + </ul> + <center> + <br> + <span class="streamButton"><a id="edge" href="#">Edge</a></span><span class="streamButton"><a id="3g" href="#" class="cube"> 3G </a></span><span class="streamButton"><a id="wifi" href="#" class="cube">Wifi</a></span><span class="recButton"><a id="rec" href="#" class="cube">Rec.</a></span> + <br><br> + </center> + <div rel="dataholder" style="visibility:hidden"> + <span rel="type"></span> + <span rel="url"></span> + </div> + </div> + + <div id="streamrec"> + <div class="toolbar"> + <a href="#" class="back">Back</a> + <a href="#home" id="home_but" class="button">Home</a> + <h1>Recordings</h1> + </div> + <center><ul class="thumb" style="width:90px"><img class="thumbnail" id="thumbnail" src="" /></ul></center> + <ul class="streaminfo"> + <li> + <span class="name_now"></span> + <span class="epgtime_now"></span> + <span class="desc_now"></span> + </li> + </ul> + <center><br> + <span class="streamButton"><a id="edge" href="#">Edge</a></span><span class="streamButton"><a id="3g" href="#" class="cube"> 3G </a></span><span class="streamButton"><a id="wifi" href="#" class="cube">Wifi</a></span><span class="recButton"><a id="rec" href="#" class="cube">Rec.</a></span> + <br><br> + </center> + <div rel="dataholder" style="visibility:hidden"> + <span rel="type"></span> + <span rel="url"></span> + </div> + </div> + <div id="streamvid"> + <div class="toolbar"> + <a href="#" class="back">Back</a> + <a href="#home" id="home_but" class="button">Home</a> + <h1>Video</h1> + </div> + <center><ul class="thumb" style="width:190px;"><img class="thumbnail" id="thumbnail" src="" /></ul></center> + <ul class="streaminfo"> + <li> + <span class="name_now"></span> + <span class="epgtime_now"></span> + <span class="desc_now"></span> + </li> + </ul> + <center><br> + <span class="streamButton"><a id="edge" href="#">Edge</a></span><span class="streamButton"><a id="3g" href="#" class="cube"> 3G </a></span><span class="streamButton"><a id="wifi" href="#" class="cube">Wifi</a></span><span class="recButton"><a id="rec" href="#" class="cube">Rec.</a></span> + <br><br> + </center> + <div rel="dataholder" style="visibility:hidden"> + <span rel="type"></span> + <span rel="url"></span> + </div> + </div> + + <div id="streaming"> + <div class="toolbar"> + <a href="#" class="back">Back</a> + <a href="#home" id="home_but" class="button">Home</a> + <h1></h1> + </div> + <center><ul class="thumb" id="player"><img class="thumbnail" id="thumbnail" src="" /></ul></center> + <ul class="streamstatus"> + <span class="title">Status</span> + <span class="mode"></span> + </ul> + <ul class="streaminfo"> + </ul> + <center> + <span class="streamButton"><a rel="stopbroadcast" href="#">Stop stream</a></span> + <span class="recButton"><a rel="rec" href="#">Rec.</a></span> + <br><br> + </center> + <div rel="dataholder" style="visibility:hidden"> + <span rel="session"></span> + <span rel="name"></span> + <span rel="thumbwidth"></span> + <span rel="thumbheight"></span> + </div> + </div> + + <!---------------------------------- /STREAM SCREEN ----------------------------------> + <!---------------------------------- TIMERS SCREEN ----------------------------------> + + <div id="timers"> + <div class="toolbar"> + <a href="#" class="back">Home</a> + <h1><img class="menuicon" src="img/timers.png" /> TIMERS</h1> + </div> + <div class="info" id="timer_status"></div> + <ul class="rounded" rel="timers"> + </ul> + <ul class="rounded"> + <li class="arrow"><a href="#" rel="new"><span class="menuname">New Timer</span></a></li> + </ul> + </div> + + <div id="edittimer"> + <div class="toolbar"> + <a href="#" class="back">Back</a> + <a href="#home" id="home_but" class="button slideup">Home</a> + <h1></h1> + </div> + <form name="timer" id="timer" action=""> + <ul class="rounded"> + <li><span class="timertitle">Active</span><span class="toggle"><input id="timer_active" name="timer_active" type="checkbox" /></span></li> + </ul> + <ul class="rounded" rel="name"> + <li><span class="timertitle">Name</span></li> + <li class="formerror" id="timer_name_error"><span class="formerrormsg">Recording name is missing</span></li> + <li><input type="text" name="name" placeholder="Enter recording name" id="timer_name" style="color: #FFFFFF" /></li> + </ul> + <ul class="rounded" rel="channel"> + <li> + <span class="timertitle">Channel</span> + </li> + <li> + <select id="timer_chan"> + </select> + </li> + </ul> + <ul class="rounded" rel="date"> + <li><span class="timertitle">Date</span></li> + <li class="formerror" id="timer_date_error"><span class="formerrormsg">Date is missing</span></li> + <li class="arrow"><a id="a_date" class="abutton" href="#" onClick="$('#timer_date_error').hide();"><span class="menuname" id="layer_date">Select date</span></a></li> + + </ul> + <ul class="rounded" rel="stime"> + <li><span class="timertitle">Start time</span></li> + <li class="formerror" id="timer_starttime_error"><span class="formerrormsg">Starting time is missing</span></li> + <li class="arrow"><a id="a_starttime" class="abutton" href="#" onClick="$('#timer_starttime_error').hide();"><span class="menuname" id="layer_starttime">Select start time</span></a></li> + + </ul> + <ul class="rounded" rel="etime"> + <li><span class="timertitle">End time</span></li> + <li class="formerror" id="timer_endtime_error"><span class="formerrormsg">Ending time is missing</span></li> + <li class="arrow"><a id="a_endtime" class="abutton" href="#" onClick="$('#timer_endtime_error').hide();"><span class="menuname" id="layer_endtime">Select end time</span></a></li> + </ul> + <input name="timer_id" type="hidden" id="timer_id" value="" /> + <input name="timer_date" type="hidden" id="timer_date" value="" /> + <input name="timer_starttime" type="hidden" id="timer_starttime" value="" /> + <input name="timer_endtime" type="hidden" id="timer_endtime" value="" /> + </form> + </div> + <!---------------------------------- /TIMERS SCREEN ----------------------------------> + <!---------------------------------- AUDIO ----------------------------------------> + <div id="audio"> + <div class="toolbar"> + <a href="#" class="back">Home</a> + <h1><img class="menuicon" src="img/audio.png" /> Audio</h1> + </div> + <ul class="rounded"> + <li class="arrow"><a class="cube" href="#audio"><span class="menuname">Album1</span></a></li> + <li class="arrow"><a class="cube" href="#audio"><span class="menuname">Album2</span></a></li> + <li class="track"><div class="numberbox"><span class="number">1</span></div><a class="cube" href="#startstream"><span class="tracktitle">track1.mp3</span></a><div class="timebox"><span class="time">2:35</span></div></li> + <li class="track"><div class="numberbox"><span class="number">2</span></div><a class="cube" href="#startstream"><span class="tracktitle">track2.mp3</span></a><div class="timebox"><span class="time">1:12</span></div></li> + <li class="track"><div class="numberbox"><span class="number">3</span></div><a class="cube" href="#startstream"><span class="tracktitle">track3.mp3</span></a><div class="timebox"><span class="time">3:25</span></div></li> + <li class="track"><div class="numberbox"><span class="number">4</span></div><a class="cube" href="#startstream"><span class="tracktitle">track4.mp3</span></a><div class="timebox"><span class="time">4:02</span></div></li> + </ul> + </div> + <!---------------------------------- /AUDIO ----------------------------------------> + </div> + </body> +</html>
\ No newline at end of file diff --git a/themes/indexfake.html b/themes/indexfake.html new file mode 100644 index 0000000..222335b --- /dev/null +++ b/themes/indexfake.html @@ -0,0 +1,551 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" manifest="istreamdev.manifest"> + <head> + <meta charset="UTF-8" /> + <title>iStreamdev</title> + <style type="text/css" media="screen">@import "jqtouch/jqtouch.css";</style> + <style type="text/css" media="screen">@import "themes/jqt/theme.css";</style> + <script src="jqtouch/jquery.1.3.2.min.js" type="text/javascript" charset="utf-8"></script> + <script src="jqtouch/jqtouch.js" type="application/x-javascript" charset="utf-8"></script> + <script src="jqtouch/jqtouch.transitions.js" type="application/x-javascript" charset="utf-8"></script> + <script src="js/spinningwheel.js" type="application/x-javascript" charset="utf-8"></script> + <script src="js/functions.js" type="application/x-javascript" charset="utf-8"></script> + <style type="text/css" media="screen">@import "css/spinningwheel.css";</style> + <script type="text/javascript" charset="utf-8"> + + $.jQTouch({ + icon: 'img/istreamdev.png', + addGlossToIcon: true, + useFastTouch: true, + startupScreen: 'img/startup.png', + statusBar: 'black', + iconIsGlossy: true, + fullscreen: true, + preloadImages: [ + 'themes/jqt/img/chevron.png', + 'themes/jqt/img/back_button.png', + 'themes/jqt/img/back_button_clicked.png', + 'themes/jqt/img/button_clicked.png', + 'themes/jqt/img/button.png', + 'theme/jqt/img/button_clicked.png', + 'theme/jqt/img/loading.gif', + 'theme/jqt/img/toolbar.png', + 'theme/jqt/img/on_off.png', + 'img/audio.png', + 'img/epg.png', + 'img/media.png', + 'img/record.png', + 'img/timers.png', + 'img/timeron.png', + 'img/timeroff.png', + 'img/timerrec.png', + 'img/tv.png', + 'img/video.png', + 'img/stream.png', + 'img/stream_clicked.png', + 'img/istreamdev.png', + 'img/mask.png', + 'img/nologoTV.png', + 'img/nologoREC.png', + 'img/nologoMEDIA.png', + 'img/rec.png', + 'img/rec_clicked.png', + 'img/sw-alpha.png', + 'img/sw-button-cancel.png', + 'img/sw-button-done.png', + 'img/sw-header.png', + 'img/sw-slot-border.png' + ] + }); + + $(document).ready(function(e){ + $('#streaming').bind('pageAnimationEnd', function(event, info){ + if (info.direction == 'in') { + $('#player').html('<video id="videofeed" width="80" height="80" poster="logos/TF1.png" ></video>'); + } + }) + $('#streaming').bind('pageAnimationStart', function(event, info){ + if (info.direction == 'out') { + $('#player').html('<img class="thumbnail" id="thumbnail" src="logos/TF1.png"></img>'); + } + }) + }); + + $('#home_but').tap(function(event) { + event.preventDefault(); + window.location = "#home"; + }); + + $(function() { + $('a[class="abutton"]').click(function() { + $(this).removeClass('active'); + }); + + }); + + $(function() { + $('.formerror').hide(); + $(".submit_form").click(function() { + $(this).removeClass('active'); + + $('.formerror').hide(); + var timer_name = $("input#timer_name").val(); + if (timer_name == "") { + $("li#timer_name_error").show(); + $("input#timer_name").focus(); + return false; + } + var timer_chan = $("input#timer_date").val(); + if (timer_chan == "") { + $("li#timer_date_error").show(); + $("a#a_date").focus(); + return false; + } + var timer_starttime = $("input#timer_starttime").val(); + if (timer_starttime == "") { + $("li#timer_starttime_error").show(); + $("a#a_starttime").focus(); + return false; + } + var timer_endtime = $("input#timer_endtime").val(); + if (timer_endtime == "") { + $("li#timer_endtime_error").show(); + $("a#a_endtime").focus(); + return false; + } + var timer_chan = $("select#timer_chan").val(); + var timer_active = $("input#timer_active").val(); + var dataString = 'action=edittimer&timer_name='+ timer_name + '&timer_chan=' + timer_chan + '&timer_date=' + timer_date + '&timer_starttime=' + timer_starttime + 'timer_endtime=' + timer_endtime + 'timer_active=' + timer_active; + $.ajax({ + type: "POST", + url: "bin/process.php", + data: dataString, + success: function() { + window.location = "#timers"; + $('#timer_status').html('New timer created successfully'); + $('#timer_status').show(); + return false; + } + + }); + window.location = "#timers"; + $('#timer_status').html('Error: Timer was not created'); + $('#timer_status').show(); + return false; + }); + }); + </script> + <style type="text/css"> + img.menuicon { + vertical-align: middle; + } + .menuname { + vertical-align: middle; + margin: 0 0 0 10px; + } + + li.forward > a > span, span.substring { + vertical-align: middle; + } + li.channellist { + height: 55px; + background-image: url(img/chevron.png), -webkit-gradient(linear, 0% 0%, 0% 100%, from(#4c4d4e), to(#404142)); + background-position: right center; + background-repeat: no-repeat; + } + + li.channellist img { + width: 55px; + height: 55px; + vertical-align: middle; + position: relative; + -webkit-mask-box-image: url(img/mask.png) 80 stretch; + top: 0px; + } + + li.channellist span.name { + margin: 10px 0 0 0px; + left: 90px; + text-overflow: ellipsis; + overflow: hidden; + max-width: 80%!important; + white-space: nowrap; + font-size: 17px; + line-height: normal; + position: absolute; + font-weight: bold; + + } + li.channellist span.comment { + margin: 28px 0 0 0px; + left: 90px; + max-width: 80%!important; + font-size: 14px; + line-height: normal; + position: absolute; + top: 15 px; + font-style: italic; + font-weight: normal; + } + ul.thumb { + -webkit-border-radius: 8px; + -webkit-box-shadow: rgba(0,0,0,.3) 1px 1px 3px; + } + + .thumbnail { + -webkit-mask-box-image: url(img/mask.png) 80 stretch; + vertical-align: middle; + margin: 5px 0 5px 0; + } + + span.streamButton a{ + margin: 5px 5px 5px 5px; + border-width: 0 12px; + padding: 8px; + text-align: center; + font-size: 14px; + font-weight: bold; + text-decoration: inherit; + color: inherit; + -webkit-border-image: url(img/stream.png) 0 12 0 12; + color: #FFFFFF; + } + span.streamButton a:active{ + color: #aaa; + -webkit-border-image: url(img/stream_clicked.png) 0 12 0 12; + } + span.recButton a{ + margin: 5px 5px 5px 5px; + border-width: 0 12px; + padding: 8px; + text-align: center; + font-size: 14px; + font-weight: bold; + text-decoration: inherit; + color: inherit; + -webkit-border-image: url(img/rec.png) 0 12 0 12; + color: #FFFFFF; + } + span.recButton a:active{ + color: #aaa; + -webkit-border-image: url(img/rec_clicked.png) 0 12 0 12; + } + + ul.streaminfo { + -webkit-border-radius: 8px; + -webkit-box-shadow: rgba(0,0,0,.3) 1px 1px 3px; + } + + ul.streaminfo span.name { + padding-top: 10px; + padding-right: 10px; + padding-left: 10px; + font-size: 17px; + font-weight: bold; + display: block; + color: white; + text-shadow: rgba(0,0,0,.8) 0 1px 0; + } + ul.streaminfo span.epgtime { + padding-top: 5px; + padding-right: 10px; + padding-left: 10px; + font-size: 14px; + font-weight: bold; + display: block; + text-shadow: rgba(0,0,0,.8) 0 1px 0; + } + ul.streaminfo span.desc { + position: relative; + padding-top: 10px; + padding-right: 10px; + padding-bottom: 10px; + padding-left: 10px; + display: block; + color: white; + font-size: 14px; + font-style: italic; + font-weight: normal; + line-height: normal; + + } + ul.streamstatus { + -webkit-border-radius: 8px; + -webkit-box-shadow: rgba(0,0,0,.3) 1px 1px 3px; + } + ul.streamstatus span.title { + padding-top: 10px; + padding-right: 10px; + padding-left: 10px; + font-size: 17px; + font-weight: bold; + display: block; + color: white; + text-shadow: rgba(0,0,0,.8) 0 1px 0; + } + + ul.streamstatus span.mode { + position: relative; + padding-top: 10px; + padding-right: 10px; + padding-bottom: 10px; + padding-left: 10px; + display: block; + color: white; + font-size: 14px; + font-style: italic; + font-weight: normal; + line-height: normal; + } + #jqt ul li select option{ + color: #000000; + } + #jqt ul li select optgroup{ + color: #999; + } + span.timertitle { + padding-right: 10px; + padding-left: 10px; + font-size: 14px; + font-weight: bold; + color: #999; + text-shadow: rgba(0,0,0,.8) 0 1px 0; + } + span.menutitle { + padding-right: 10px; + padding-left: 10px; + font-size: 17px; + font-weight: bold; + color: #999; + text-shadow: rgba(0,0,0,.8) 0 1px 0; + } + .formerrormsg { + padding-right: 10px; + padding-left: 10px; + font-size: 12px; + color: #FF8300; + + } + #timers .info { + display: none; + } + + </style> + </head> + <body> + <div id="jqt"> + <!---------------------------------- HOME SCREEN ----------------------------------> + <div id="home" class="current"> + <div class="toolbar"> + <h1>HOME</h1> + </div> + <ul class="rounded"> + <li><span class="menutitle">VDR</span></li> + <li class="arrow"><a class="cube" href="#categories"><img class="menuicon" src="img/tv.png" /><span class="menuname">Watch TV</span></a></li> + <li class="arrow"><a class="cube" href="#browser"><img class="menuicon" src="img/record.png" /><span class="menuname">Recordings</span></a></li> + <li class="arrow"><a class="cube" href="#timers"><img class="menuicon" src="img/timers.png" /><span class="menuname">Timers</span></a></li> + <li class="arrow"><a class="cube" href="#epg"><img class="menuicon" src="img/epg.png" /><span class="menuname">Program Guide</span></a></li> + </ul> + <ul class="rounded"> + <li><span class="menutitle">FILES</span></li> + <li class="arrow"><a class="cube" href="#browser"><img class="menuicon" src="img/video.png" /><span class="menuname">Video</span></a></li> + <li class="arrow"><a class="cube" href="#audio"><img class="menuicon" src="img/audio.png" /><span class="menuname">Audio</span></a></li> + </ul> + </div> + <!----------------------------------/ HOME SCREEN ----------------------------------> + + <!---------------------------------- CHAN CATEGORY SCREEN ----------------------------------> + <div id="categories"> + <div class="toolbar"> + <a href="#home" class="back">Home</a> + <h1>CATEGORIES</h1> + </div> + <ul class="rounded"> + <li class="arrow"><a class="cube" href="#channels" rel="Nationales & Tnt">NATIONALES & TNT</a><small class="counter">17</small></li> + <li class="arrow"><a class="cube" href="#channels" rel="Divertissements">DIVERTISSEMENTS</a><small class="counter">12</small></li> + </div> + <!---------------------------------- /CHAN CATEGORY SCREEN ----------------------------------> + <!---------------------------------- CHANNELS SCREEN ----------------------------------> + <div id="channels"> + <div class="toolbar"> + <a href="#" class="back">Back</a> + <a href="#home" id="home_but" class="button slideup">Home</a> + <h1>CHANNELS</h1> + </div> + <ul class="rounded"> + <li class="channellist"><a class="cube" href="#startstream" rel="TF1"><img src="logos/TF1.png"/><span class="name">TF1</span><span class="comment">Journal de 13h</span></a></li> + <li class="channellist"><a class="cube" href="#startstream" rel="FRANCE 2"><img src="logos/FRANCE 2.png"/><span class="name">FRANCE 2</span><span class="comment">Tournez Manège</span></a></li> + <li class="channellist"><a class="cube" href="#startstream" rel="FRANCE 3"><img src="logos/FRANCE 3.png"/><span class="name">FRANCE 3</span><span class="comment">Journal Régional</span></a></li> + <li class="channellist"><a class="cube" href="#startstream" rel="TF1"><img src="logos/TF1.png"/><span class="name">TF1</span><span class="comment">Journal de 13h</span></a></li> + <li class="channellist"><a class="cube" href="#startstream" rel="TF1"><img src="logos/TF1.png"/><span class="name">TF1</span><span class="comment">Journal de 13h</span></a></li> + <li class="channellist"><a class="cube" href="#startstream" rel="TF1"><img src="logos/TF1.png"/><span class="name">TF1</span><span class="comment">Journal de 13h</span></a></li> + <li class="channellist"><a class="cube" href="#startstream" rel="TF1"><img src="logos/TF1.png"/><span class="name">TF1</span><span class="comment">Journal de 13h</span></a></li> + <li class="channellist"><a class="cube" href="#startstream" rel="TF1"><img src="logos/TF1.png"/><span class="name">TF1</span><span class="comment">Journal de 13h</span></a></li> + <li class="channellist"><a class="cube" href="#startstream" rel="TF1"><img src="logos/TF1.png"/><span class="name">TF1</span><span class="comment">Journal de 13h</span></a></li> + <li class="channellist"><a class="cube" href="#startstream" rel="TF1"><img src="logos/TF1.png"/><span class="name">TF1</span><span class="comment">Journal de 13h</span></a></li> + + </ul> + </div> + <!---------------------------------- /CHANNELS SCREEN ----------------------------------> + <!---------------------------------- START STREAM ----------------------------------> + <div id="startstream"> + <div class="toolbar"> + <a href="#" class="back">Back</a> + <a href="#home" id="home_but" class="button slideup">Home</a> + <h1>TF1</h1> + </div> + <center><ul class="thumb" style="width:90px"><img class="thumbnail" id="thumbnail" src="logos/TF1.png" /></ul></center> + + <ul class="streaminfo"> + <span class="epgtime">Now: 19h00-19h45</span> + <span class="name">Tout le monde veut prendre sa place</span> + <span class="desc">Jeu présenté par Nagui. Six candidats s'affrontent lors d'un quiz pour prendre la place du champion et remporter des gains.</span> + <span class="epgtime">Next: 19h45-20h45</span> + <span class="name">Informations</span> + </ul> + <center> + <span class="streamButton"><a href="#streaming" class="cube">Edge</a></span><span class="streamButton"><a href="#streaming" class="cube"> 3G </a></span><span class="streamButton"><a href="#streaming" class="cube">Wifi</a></span><span class="recButton"><a href="#" class="cube">Rec.</a></span> + </center> + </div> + <!---------------------------------- /START STREAM ----------------------------------> + <!---------------------------------- STREAMING ----------------------------------> + <div id="streaming"> + <div class="toolbar"> + <a href="#" class="back">Back</a> + <a href="#home" id="home_but" class="button slideup">Home</a> + <h1>TF1</h1> + </div> + <center><ul class="thumb" id="player" style="width:90px"><img class="thumbnail" id="thumbnail" src="logos/TF1.png" /></ul></center> + + <ul class="streaminfo"> + <span class="epgtime">2010-03-02 19h00-19h45</span> + <span class="name">Tout le monde veut prendre sa place</span> + <span class="desc">Jeu présenté par Nagui. Six candidats s'affrontent lors d'un quiz pour prendre la place du champion et remporter des gains.</span> + </ul> + <ul class="streamstatus"> + <span class="title">Status</span> + <span class="mode">Now streaming in 3G mode</span> + </ul> + <center> + <span class="streamButton"><a href="#startstream" class="slide goback">Stop stream</a></span> + <span class="recButton"><a href="#" class="cube">Rec.</a></span> + <br><br> + </center> + </div> + <!---------------------------------- /STREAMING ----------------------------------> + <!---------------------------------- BROWSER ----------------------------------> + <div id="browser"> + <div class="toolbar"> + <a href="#" class="back">Home</a> + <h1>RECORDINGS</h1> + </div> + <ul class="rounded"> + <li class="arrow"><a class="cube" href="#browser2"><span class="menuname">Movies</span></a></li> + <li class="arrow"><a class="cube" href="#browser2"><span class="menuname">TV Shows</span></a></li> + <li><a class="cube" href="#startstream"><img class="menuicon" src="img/video.png" /><span class="menuname">Gran.Torino-Trailer.avi</span></a></li> + </ul> + </div> + + <!---------------------------------- /BROWSER ---------------------------------> + <!---------------------------------- BROWSER ----------------------------------> + <div id="browser2"> + <div class="toolbar"> + <a href="#" class="back">Back</a> + <a href="#home" id="home_but" class="button slideup">Home</a> + <h1>RECORDINGS</h1> + </div> + <ul class="rounded"> + <li><a class="cube" href="#startstream"><img class="menuicon" src="img/video.png" /><span class="menuname">Ghostbuster.avi</span></a></li> + <li><a class="cube" href="#startstream"><img class="menuicon" src="img/video.png" /><span class="menuname">Starwars-Ep.1.avi</span></a></li> + <li><a class="cube" href="#startstream"><img class="menuicon" src="img/video.png" /><span class="menuname">Starwars-Ep.2.avi</span></a></li> + </ul> + </div> + + <!---------------------------------- /BROWSER ---------------------------------> + <!---------------------------------- TIMERS ---------------------------------> + <div id="timers"> + <div class="toolbar"> + <a href="#" class="back">Home</a> + <h1>TIMERS</h1> + </div> + <div class="info" id="timer_status"></div> + <ul class="rounded"> + <li><span class="menutitle">Current timers</span></li> + <li class="arrow"><a class="cube" href="#edittimer"><img class="menuicon" src="img/timeron.png" /><span class="menuname">2010-03-08 La Ferme Célébrité</span></a></li> + <li class="arrow"><a class="cube" href="#edittimer"><img class="menuicon" src="img/timeroff.png" /><span class="menuname">2010-03-12 Football</span></a></li> + <li class="arrow"><a class="cube" href="#edittimer"><img class="menuicon" src="img/timerrec.png" /><span class="menuname">2010-03-05 Le Journal</span></a></li> + </ul> + <ul class="rounded"> + <li class="arrow"><a class="cube" href="#edittimer"><span class="menuname">New Timer</span></a></li> + </ul> + </div> + <!---------------------------------- /TIMERS ---------------------------------> + <!---------------------------------- EDIT TIMERS ---------------------------------> + <div id="edittimer"> + <div class="toolbar"> + <a href="#" class="back">Back</a> + <a href="#home" id="home_but" class="button slideup">Home</a> + <h1>EDIT TIMER</h1> + </div> + <form name="timer" id="timer" action=""> + <ul class="rounded"> + <li><span class="timertitle">Active</span><span class="toggle"><input id="timer_active" name="timer_active" type="checkbox" checked/></span></li> + </ul> + <ul class="rounded"> + <li><span class="timertitle">Name</span></li> + <li class="formerror" id="timer_name_error"><span class="formerrormsg">Recording name is missing</span></li> + <li><input type="text" name="name" placeholder="Enter recording name" id="timer_name" style="color: #FFFFFF"/></li> + </ul> + <ul class="rounded"> + <li><span class="timertitle">Channel</span></li> + <li><select id="timer_chan"> + <optgroup label="NATIONALES & TNT"> + <option value="1">TF1</option> + <option value="2">FRANCE 2</option> + <option value="3">FRANCE 3</option> + <option value="4">FRANCE 4</option> + <option value="5">TV5</option> + <option value="6">M6</option> + </optgroup> + <optgroup label="DIVERTISSEMENT"> + <option value="11">COMEDIE!</option> + <option value="12">13EME RUE</option> + <option value="13">FOX LIFE</option> + </optgroup> + </select> + </li> + </ul> + <ul class="rounded"> + <li><span class="timertitle">Date</span></li> + <li class="formerror" id="timer_date_error"><span class="formerrormsg">Date is missing</span></li> + <li class="arrow"><a id="a_date" class="abutton" href="javascript:openSelectDate(2010,03,05);" onClick="$('#timer_date_error').hide();"><span class="menuname" id="layer_date">Select date</span></a></li> + + </ul> + <ul class="rounded"> + <li><span class="timertitle">Start time</span></li> + <li class="formerror" id="timer_starttime_error"><span class="formerrormsg">Starting time is missing</span></li> + <li class="arrow"><a id="a_starttime" class="abutton" href="javascript:openSelectTime('layer_starttime','20','30')" onClick="$('#timer_starttime_error').hide();"><span class="menuname" id="layer_starttime">Select start time</span></a></li> + + </ul> + <ul class="rounded"> + <li><span class="timertitle">End time</span></li> + <li class="formerror" id="timer_endtime_error"><span class="formerrormsg">Ending time is missing</span></li> + <li class="arrow"><a id="a_endtime" class="abutton" href="javascript:openSelectTime('layer_endtime','20','30')" onClick="$('#timer_endtime_error').hide();"><span class="menuname" id="layer_endtime">Select end time</span></a></li> + </ul> + + <input name="timer_date" type="hidden" id="timer_date" value="" \> + <input name="timer_starttime" type="hidden" id="timer_starttime" value="" /> + <input name="timer_endtime" type="hidden" id="timer_endtime" value="" /> + <ul class="individual"> + <li><a class="submit_form" href="#">Edit</a></li> + <li><a class="abutton" href="javascript:deletetimer('montimer');">Delete</a></li> + </ul> + <ul class="rounded"> + <li><center><a class="submit_form" href="#">Create</a></center></li> + </ul> + </form> + </div> + <!---------------------------------- /EDIT TIMERS ---------------------------------> + </div> + </body> +</html>
\ No newline at end of file diff --git a/themes/istreamdev.manifest b/themes/istreamdev.manifest new file mode 100644 index 0000000..b194aa5 --- /dev/null +++ b/themes/istreamdev.manifest @@ -0,0 +1,36 @@ +CACHE MANIFEST +themes/jqt/img/chevron.png +themes/jqt/img/back_button.png +themes/jqt/img/back_button_clicked.png +themes/jqt/img/button_clicked.png +themes/jqt/img/button.png +themes/jqt/img/button_clicked.png +themes/jqt/img/loading.gif +themes/jqt/img/toolbar.png +themes/jqt/img/on_off.png +img/loading.gif +img/audio.png +img/epg.png +img/media.png +img/record.png +img/timers.png +img/timeron.png +img/timeroff.png +img/timerrec.png +img/tv.png +img/video.png +img/stream.png +img/stream_clicked.png +img/istreamdev.png +img/mask.png +img/nologoTV.png +img/nologoREC.png +img/nologoMEDIA.png +img/rec.png +img/rec_clicked.png +img/sw-alpha.png +img/sw-button-cancel.png +img/sw-button-done.png +img/sw-header.png +img/sw-slot-border.png +logos/*
\ No newline at end of file diff --git a/themes/jqt/.svn/all-wcprops b/themes/jqt/.svn/all-wcprops new file mode 100644 index 0000000..9cb8fd9 --- /dev/null +++ b/themes/jqt/.svn/all-wcprops @@ -0,0 +1,11 @@ +K 25
+svn:wc:ra_dav:version-url
+V 34
+/svn/!svn/ver/133/trunk/themes/jqt
+END
+theme.css
+K 25
+svn:wc:ra_dav:version-url
+V 44
+/svn/!svn/ver/133/trunk/themes/jqt/theme.css
+END
diff --git a/themes/jqt/.svn/entries b/themes/jqt/.svn/entries new file mode 100644 index 0000000..d6dda81 --- /dev/null +++ b/themes/jqt/.svn/entries @@ -0,0 +1,65 @@ +10
+
+dir
+133
+http://jqtouch.googlecode.com/svn/trunk/themes/jqt
+http://jqtouch.googlecode.com/svn
+
+
+
+2010-01-15T21:08:54.001495Z
+133
+RBoulanouar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+210952ee-217a-11de-8f7e-2b794b28c5cd
+
+theme.css
+file
+
+
+
+
+2010-03-04T14:47:56.967073Z
+ea89d52f4a301917d7f4f148d7c2a7d4
+2010-01-15T21:08:54.001495Z
+133
+RBoulanouar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+14134
+
+img
+dir
+
diff --git a/themes/jqt/.svn/text-base/theme.css.svn-base b/themes/jqt/.svn/text-base/theme.css.svn-base new file mode 100644 index 0000000..e429903 --- /dev/null +++ b/themes/jqt/.svn/text-base/theme.css.svn-base @@ -0,0 +1,561 @@ +body, #jqt { + background: #000; + color: #ddd; +} +body > *, div#jqt > * { + background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#333), to(#5e5e65)); +} +#jqt h1, #jqt h2 { + font: bold 18px "Helvetica Neue", Helvetica; + text-shadow: rgba(255,255,255,.2) 0 1px 1px; + color: #000; + margin: 10px 20px 5px; +} +/* @group Toolbar */ +#jqt .toolbar { + -webkit-box-sizing: border-box; + border-bottom: 1px solid #000; + padding: 10px; + height: 45px; + background: url(img/toolbar.png) #000000 repeat-x; + position: relative; +} +#jqt .black-translucent .toolbar { + margin-top: 20px; +} +div#jqt .toolbar > h1 { + position: absolute; + overflow: hidden; + left: 50%; + top: 10px; + line-height: 1em; + margin: 1px 0 0 -75px; + height: 40px; + font-size: 20px; + width: 150px; + font-weight: bold; + text-shadow: rgba(0,0,0,1) 0 -1px 1px; + text-align: center; + text-overflow: ellipsis; + white-space: nowrap; + color: #fff; +} +div#jqt.landscape .toolbar > h1 { + margin-left: -125px; + width: 250px; +} +#jqt .button, #jqt .back, #jqt .cancel, #jqt .add { + position: absolute; + overflow: hidden; + top: 8px; + right: 10px; + margin: 0; + border-width: 0 5px; + padding: 0 3px; + width: auto; + height: 30px; + line-height: 30px; + font-family: inherit; + font-size: 12px; + font-weight: bold; + color: #fff; + text-shadow: rgba(0, 0, 0, 0.5) 0px -1px 0; + text-overflow: ellipsis; + text-decoration: none; + white-space: nowrap; + background: none; + -webkit-border-image: url(img/button.png) 0 5 0 5; +} +#jqt .button.active, #jqt .cancel.active, #jqt .add.active { + -webkit-border-image: url(img/button_clicked.png) 0 5 0 5; + color: #aaa; +} +#jqt .blueButton { + -webkit-border-image: url(img/blueButton.png) 0 5 0 5; + border-width: 0 5px; +} +#jqt .back { + left: 6px; + right: auto; + padding: 0; + max-width: 55px; + border-width: 0 8px 0 14px; + -webkit-border-image: url(img/back_button.png) 0 8 0 14; +} +#jqt .back.active { + -webkit-border-image: url(img/back_button_clicked.png) 0 8 0 14; + color: #aaa; +} +#jqt .leftButton, #jqt .cancel { + left: 6px; + right: auto; +} +#jqt .add { + font-size: 24px; + line-height: 24px; + font-weight: bold; +} +#jqt .whiteButton, +#jqt .grayButton, #jqt .redButton, #jqt .blueButton, #jqt .greenButton { + display: block; + border-width: 0 12px; + padding: 10px; + text-align: center; + font-size: 20px; + font-weight: bold; + text-decoration: inherit; + color: inherit; +} + +#jqt .whiteButton.active, #jqt .grayButton.active, #jqt .redButton.active, #jqt .blueButton.active, #jqt .greenButton.active, +#jqt .whiteButton:active, #jqt .grayButton:active, #jqt .redButton:active, #jqt .blueButton:active, #jqt .greenButton:active { + -webkit-border-image: url(img/activeButton.png) 0 12 0 12; +} +#jqt .whiteButton { + -webkit-border-image: url(img/whiteButton.png) 0 12 0 12; + text-shadow: rgba(255, 255, 255, 0.7) 0 1px 0; +} +#jqt .grayButton { + -webkit-border-image: url(img/grayButton.png) 0 12 0 12; + color: #FFFFFF; +} + +#jqt .redButton { + -webkit-border-image: url(img/redButton.png) 0 12 0 12; + color: #FFFFFF; +} + +#jqt .greenButton { + -webkit-border-image: url(img/greenButton.png) 0 12 0 12; + color: #FFFFFF; +} + + +/* @end */ +/* @group Lists */ +#jqt h1 + ul, #jqt h2 + ul, #jqt h3 + ul, #jqt h4 + ul, #jqt h5 + ul, #jqt h6 + ul { + margin-top: 0; +} +#jqt ul { + color: #aaa; + border: 1px solid #333333; + font: bold 18px "Helvetica Neue", Helvetica; + padding: 0; + margin: 15px 10px 17px 10px; +} +#jqt ul.rounded { + -webkit-border-radius: 8px; + -webkit-box-shadow: rgba(0,0,0,.3) 1px 1px 3px; +} +#jqt ul.rounded li:first-child, #jqt ul.rounded li:first-child a { + border-top: 0; + -webkit-border-top-left-radius: 8px; + -webkit-border-top-right-radius: 8px; +} +#jqt ul.rounded li:last-child, #jqt ul.rounded li:last-child a { + -webkit-border-bottom-left-radius: 8px; + -webkit-border-bottom-right-radius: 8px; +} +#jqt ul li { + color: #666; + border-top: 1px solid #333; + border-bottom: #555858; + list-style-type: none; + padding: 10px 10px 10px 10px; + background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#4c4d4e), to(#404142)); + overflow: hidden; +} +#jqt ul li.arrow { + background-image: url(img/chevron.png), -webkit-gradient(linear, 0% 0%, 0% 100%, from(#4c4d4e), to(#404142)); + background-position: right center; + background-repeat: no-repeat; +} + +#jqt ul li.arrow a { + padding: 12px 22px 12px 10px; +} + +#jqt ul li.forward { + background-image: url(img/chevron_circle.png), -webkit-gradient(linear, 0% 0%, 0% 100%, from(#4c4d4e), to(#404142)); + background-position: right center; + background-repeat: no-repeat; +} +/* universal links on list */ +#jqt ul li a, #jqt li.img a + a { + color: #fff; + text-decoration: none; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; + display: block; + padding: 12px 10px 12px 10px; + margin: -10px; + -webkit-tap-highlight-color: rgba(0,0,0,0); + text-shadow: rgba(0,0,0,.2) 0 1px 1px; +} +#jqt ul li a.active, #jqt ul li a.button { + background-color: #53b401; + color: #fff; +} +#jqt ul li a.active.loading { + background-image: url(img/loading.gif); + background-position: 95% center; + background-repeat: no-repeat; +} +#jqt ul li.arrow a.active { + background-image: url(img/chevron.png); + background-position: right center; + background-repeat: no-repeat; +} +#jqt ul li.forward a.active { + background-image: url(img/chevron_circle.png); + background-position: right center; + background-repeat: no-repeat; +} +#jqt ul li.img a + a { + margin: -10px 10px -20px -5px; + font-size: 17px; + font-weight: bold; +} +#jqt ul li.img a + a + a { + font-size: 14px; + font-weight: normal; + margin-left: -10px; + margin-bottom: -10px; + margin-top: 0; +} +#jqt ul li.img a + small + a { + margin-left: -5px; +} +#jqt ul li.img a + small + a + a { + margin-left: -10px; + margin-top: -20px; + margin-bottom: -10px; + font-size: 14px; + font-weight: normal; +} +#jqt ul li.img a + small + a + a + a { + margin-left: 0px !important; + margin-bottom: 0; +} +#jqt ul li a + a { + color: #000; + font: 14px "Helvetica Neue", Helvetica; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; + display: block; + margin: 0; + padding: 0; +} +#jqt ul li a + a + a, #jqt ul li.img a + a + a + a, #jqt ul li.img a + small + a + a + a { + color: #666; + font: 13px "Helvetica Neue", Helvetica; + margin: 0; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; + display: block; + padding: 0; +} +/* +@end */ +/* @group Forms */ +#jqt ul.form li { + padding: 7px 10px; +} +#jqt ul.form li.error { + border: 2px solid red; +} +#jqt ul.form li.error + li.error { + border-top: 0; +} +#jqt ul li input[type="text"], +#jqt ul li input[type="password"], +#jqt ul li input[type="tel"], +#jqt ul li input[type="number"], +#jqt ul li input[type="search"], +#jqt ul li input[type="email"], +#jqt ul li input[type="url"], +#jqt ul li textarea, +#jqt ul li select { + color: #777; + background: transparent url('data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=='); + border: 0; + font: normal 17px "Helvetica Neue", Helvetica; + padding: 0; + display: inline-block; + margin-left: 0px; + width: 100%; + -webkit-appearance: textarea; +} +#jqt ul li textarea { + height: 120px; + padding: 0; + text-indent: -2px; +} +#jqt ul li select { + text-indent: 0px; + background: transparent url(img/chevron.png) no-repeat right center; + -webkit-appearance: textfield; + margin-left: -6px; + width: 104%; +} +#jqt ul li input[type="checkbox"], #jqt ul li input[type="radio"] { + margin: 0; + padding: 10px 10px; +} +#jqt ul li input[type="checkbox"]:after, #jqt ul li input[type="radio"]:after { + content: attr(title); + font: 17px "Helvetica Neue", Helvetica; + display: block; + width: 246px; + color: #777; + margin: -12px 0 0 17px; +} +/* @end */ +/* @group Mini Label */ +#jqt ul li small { + color: #64c114; + font: 17px "Helvetica Neue", Helvetica; + text-align: right; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; + display: block; + width: 23%; + float: right; + padding: 0; +} +#jqt ul li.arrow small { + padding: 0 15px; +} +#jqt ul li small.counter { + font-size: 17px; + line-height: 13px; + font-weight: bold; + background: rgba(0,0,0,.15); + color: #fff; + -webkit-border-radius: 11px; + padding: 4px 10px 5px 10px; + display: block; + width: auto; + margin-top: -22px; + -webkit-box-shadow: rgba(255,255,255,.1) 0 1px 0; +} +#jqt ul li.arrow small.counter { + margin-right: 15px; +} +/* @end */ +/* @group Individual */ +#jqt ul.individual { + border: 0; + background: none; + clear: both; + overflow: hidden; + padding-bottom: 3px; + -webkit-box-shadow: none; +} +#jqt ul.individual li { + background: #4c4d4e; + border: 1px solid #333; + font-size: 14px; + text-align: center; + -webkit-border-radius: 8px; + -webkit-box-sizing: border-box; + width: 48%; + float: left; + display: block; + padding: 11px 10px 14px 10px; + -webkit-box-shadow: rgba(0,0,0,.2) 1px 1px 3px; + background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#4c4d4e), to(#404142)); +} +#jqt ul.individual li + li { + float: right; +} +#jqt ul.individual li a { + color: #fff; + line-height: 16px; + margin: -11px -10px -14px -10px; + padding: 11px 10px 14px 10px; + -webkit-border-radius: 8px; +} +/* @end */ +/* @group Toggle */ +#jqt .toggle { + width: 94px; + position: relative; + height: 27px; + display: block; + overflow: hidden; + float: right; +} +#jqt .toggle input[type="checkbox"]:checked { + left: 0px; +} +#jqt .toggle input[type="checkbox"] { + -webkit-appearance: textarea; + -webkit-border-radius: 5px; + -webkit-tap-highlight-color: rgba(0,0,0,0); + -webkit-transition: left .15s; + background-color: transparent; + background: #fff url(img/on_off.png) 0 0 no-repeat; + border: 0; + height: 27px; + left: -55px; + margin: 0; + overflow: hidden; + position: absolute; + top: 0; + width: 149px; +} +/* @end */ +/* @group Info */ +#jqt .info { + background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#ccc), to(#aaa), color-stop(.6,#CCCCCC)); + font-size: 12px; + line-height: 16px; + text-align: center; + text-shadow: rgba(255,255,255,.8) 0 1px 0; + color: #444; + padding: 15px; + border-top: 1px solid rgba(255,255,255,.2); + font-weight: bold; +} +/* @end */ +/* @group Edge to edge */ +#jqt ul.edgetoedge { + border-width: 1px 0; + margin: 0; + padding: 0; +} +#jqt ul.edgetoedge li { + background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#1e1f21), to(#272729)); + border-bottom: 2px solid #000; + border-top: 1px solid #4a4b4d; + font-size: 20px; + margin-bottom: -1px; +} +#jqt ul.edgetoedge li.sep { + background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgba(0,0,0,0)), to(rgba(0,0,0,.5))); + border-bottom: 1px solid #111113; + border-top: 1px solid #666; + color: #3e9ac3; + font-size: 16px; + margin: 1px 0 0 0; + padding: 2px 10px; + text-shadow: #000 0 1px 0; +} +#jqt ul.edgetoedge li em { + font-weight: normal; + font-style: normal; +} +/* @end */ +/* @group Plastic */ +#jqt #plastic { + background: #17181a; +} +#jqt ul.plastic { + background: #17181a; + color: #aaa; + font: bold 18px "Helvetica Neue", Helvetica; + margin: 0; + padding: 0; + border-width: 0 0 1px 0; +} +#jqt ul.plastic li { + border-width: 1px 0; + border-style: solid; + border-top-color: #222; + border-bottom-color: #000; + color: #666; + list-style-type: none; + overflow: hidden; + padding: 10px 10px 10px 10px; +} +#jqt ul.plastic li a.active.loading { + background-image: url(img/loading.gif); + background-position: 95% center; + background-repeat: no-repeat; +} +#jqt ul.plastic li small { + color: #888; + font-size: 13px; + font-weight: bold; + line-height: 24px; + text-transform: uppercase; +} +#jqt ul.plastic li:nth-child(odd) { + background-color: #1c1c1f; +} +#jqt ul.plastic li.arrow { + background-image: url(img/chevron.png); + background-position: right center; + background-repeat: no-repeat; +} +#jqt ul.plastic li.arrow a.active { + background-image: url(img/chevron.png); + background-position: right center; + background-repeat: no-repeat; +} +#jqt ul.plastic li.forward { + background-image: url(img/chevron_circle.png); + background-position: right center; + background-repeat: no-repeat; +} +#jqt ul.plastic li.forward a.active { + background-image: url(img/chevron_circle.png); + background-position: right center; + background-repeat: no-repeat; +} +/* @group Metal */ +#jqt ul.metal { + border-bottom: 0; + border-left: 0; + border-right: 0; + border-top: 0; + margin: 0; +} +#jqt ul.metal li { + background-image: none; + border-top: 1px solid #fff; + border-bottom: 1px solid #666; + font-size: 26px; + background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgba(238,238,238,1)), to(rgba(156,158,160,1))); +} +#jqt ul.metal li a { + line-height: 26px; + margin: 0; + text-shadow: #fff 0 1px 0; + padding: 13px 0; +} +#jqt ul.metal li a em { + display: block; + font-size: 14px; + font-style: normal; + color: #444; + width: 50%; + line-height: 14px; +} +#jqt ul.metal li a.active { + color: rgb(0,0,0); +} +#jqt ul.metal li small { + float: right; + position: relative; + margin-top: 10px; + font-weight: bold; +} +#jqt ul.metal li.arrow { + background-image: url(img/chevron.png); + background-position: right center; + background-repeat: no-repeat; + background-image: url(img/chevron.png), -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgba(238,238,238,1)), to(rgba(156,158,160,1))); + background-repeat: no-repeat; + background-position: right center; +} +#jqt ul.metal li.arrow a small { + padding-right: 15px; + line-height: 17px; +} +/* @end */ diff --git a/themes/jqt/img/.svn/all-wcprops b/themes/jqt/img/.svn/all-wcprops new file mode 100644 index 0000000..93ad5f8 --- /dev/null +++ b/themes/jqt/img/.svn/all-wcprops @@ -0,0 +1,113 @@ +K 25
+svn:wc:ra_dav:version-url
+V 38
+/svn/!svn/ver/115/trunk/themes/jqt/img
+END
+greenButton.png
+K 25
+svn:wc:ra_dav:version-url
+V 54
+/svn/!svn/ver/115/trunk/themes/jqt/img/greenButton.png
+END
+grayButton.png
+K 25
+svn:wc:ra_dav:version-url
+V 51
+/svn/!svn/ver/9/trunk/themes/jqt/img/grayButton.png
+END
+loading.gif
+K 25
+svn:wc:ra_dav:version-url
+V 49
+/svn/!svn/ver/57/trunk/themes/jqt/img/loading.gif
+END
+toolbar.png
+K 25
+svn:wc:ra_dav:version-url
+V 49
+/svn/!svn/ver/57/trunk/themes/jqt/img/toolbar.png
+END
+chevron.png
+K 25
+svn:wc:ra_dav:version-url
+V 49
+/svn/!svn/ver/57/trunk/themes/jqt/img/chevron.png
+END
+on_off.png
+K 25
+svn:wc:ra_dav:version-url
+V 48
+/svn/!svn/ver/57/trunk/themes/jqt/img/on_off.png
+END
+redButton.png
+K 25
+svn:wc:ra_dav:version-url
+V 52
+/svn/!svn/ver/115/trunk/themes/jqt/img/redButton.png
+END
+activeButton.png
+K 25
+svn:wc:ra_dav:version-url
+V 55
+/svn/!svn/ver/115/trunk/themes/jqt/img/activeButton.png
+END
+back_button_clicked.png
+K 25
+svn:wc:ra_dav:version-url
+V 60
+/svn/!svn/ver/9/trunk/themes/jqt/img/back_button_clicked.png
+END
+button.png
+K 25
+svn:wc:ra_dav:version-url
+V 47
+/svn/!svn/ver/9/trunk/themes/jqt/img/button.png
+END
+whiteButton.png
+K 25
+svn:wc:ra_dav:version-url
+V 52
+/svn/!svn/ver/9/trunk/themes/jqt/img/whiteButton.png
+END
+toggleOn.png
+K 25
+svn:wc:ra_dav:version-url
+V 49
+/svn/!svn/ver/9/trunk/themes/jqt/img/toggleOn.png
+END
+toggle.png
+K 25
+svn:wc:ra_dav:version-url
+V 47
+/svn/!svn/ver/9/trunk/themes/jqt/img/toggle.png
+END
+blueButton.png
+K 25
+svn:wc:ra_dav:version-url
+V 53
+/svn/!svn/ver/115/trunk/themes/jqt/img/blueButton.png
+END
+chevron_circle.png
+K 25
+svn:wc:ra_dav:version-url
+V 56
+/svn/!svn/ver/57/trunk/themes/jqt/img/chevron_circle.png
+END
+rowhead.png
+K 25
+svn:wc:ra_dav:version-url
+V 49
+/svn/!svn/ver/57/trunk/themes/jqt/img/rowhead.png
+END
+button_clicked.png
+K 25
+svn:wc:ra_dav:version-url
+V 55
+/svn/!svn/ver/9/trunk/themes/jqt/img/button_clicked.png
+END
+back_button.png
+K 25
+svn:wc:ra_dav:version-url
+V 52
+/svn/!svn/ver/9/trunk/themes/jqt/img/back_button.png
+END
diff --git a/themes/jqt/img/.svn/entries b/themes/jqt/img/.svn/entries new file mode 100644 index 0000000..3fadd7c --- /dev/null +++ b/themes/jqt/img/.svn/entries @@ -0,0 +1,640 @@ +10
+
+dir
+133
+http://jqtouch.googlecode.com/svn/trunk/themes/jqt/img
+http://jqtouch.googlecode.com/svn
+
+
+
+2009-10-25T08:00:04.365941Z
+115
+davidcolbykaneda
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+210952ee-217a-11de-8f7e-2b794b28c5cd
+
+greenButton.png
+file
+
+
+
+
+2010-03-04T14:47:56.962073Z
+e77d96f3d42207c60248c958513177d7
+2009-10-25T08:00:04.365941Z
+115
+davidcolbykaneda
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+1935
+
+grayButton.png
+file
+
+
+
+
+2010-03-04T14:47:56.962073Z
+1041b36eaff6868d89453dac81019839
+2009-04-11T19:17:40.360466Z
+6
+david@dyadcom.com
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+943
+
+loading.gif
+file
+
+
+
+
+2010-03-04T14:47:56.962073Z
+95b7a04cd85d0c04cd12c07d02596e23
+2009-09-03T18:03:08.814593Z
+57
+davidcolbykaneda
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+2536
+
+toolbar.png
+file
+
+
+
+
+2010-03-04T14:47:56.963073Z
+b869b6ec32d23cc99125a9aecae821fc
+2009-09-03T18:03:08.814593Z
+57
+davidcolbykaneda
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+805
+
+chevron.png
+file
+
+
+
+
+2010-03-04T14:47:56.963073Z
+b97109798e637cea3b114647cc7e86b9
+2009-09-03T18:03:08.814593Z
+57
+davidcolbykaneda
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+3074
+
+on_off.png
+file
+
+
+
+
+2010-03-04T14:47:56.963073Z
+f0106a0a0b980be828f3d0cfb49f988b
+2009-09-03T18:03:08.814593Z
+57
+davidcolbykaneda
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+2496
+
+redButton.png
+file
+
+
+
+
+2010-03-04T14:47:56.963073Z
+c0c9af820d6172e61bd6a8f4cf9c7057
+2009-10-25T08:00:04.365941Z
+115
+davidcolbykaneda
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+1927
+
+activeButton.png
+file
+
+
+
+
+2010-03-04T14:47:56.964073Z
+c44b9444f9aec80b5212671948dfccda
+2009-10-25T08:00:04.365941Z
+115
+davidcolbykaneda
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+1827
+
+back_button_clicked.png
+file
+
+
+
+
+2010-03-04T14:47:56.964073Z
+75049a40f200455923c5ee198ac185f4
+2009-04-11T19:17:40.360466Z
+6
+david@dyadcom.com
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+3741
+
+button.png
+file
+
+
+
+
+2010-03-04T14:47:56.964073Z
+0d3d3aede455501353db2db92d22b808
+2009-04-11T19:17:40.360466Z
+6
+david@dyadcom.com
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+3315
+
+whiteButton.png
+file
+
+
+
+
+2010-03-04T14:47:56.964073Z
+17f06c4431d610ecac4361df5845b817
+2009-04-11T19:17:40.360466Z
+6
+david@dyadcom.com
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+978
+
+toggleOn.png
+file
+
+
+
+
+2010-03-04T14:47:56.964073Z
+d3660086fd6ac805dccaef5339633b64
+2009-04-11T19:17:40.360466Z
+6
+david@dyadcom.com
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+163
+
+toggle.png
+file
+
+
+
+
+2010-03-04T14:47:56.965073Z
+bdebeb51c0c12ae443b9eb770fbb9bbe
+2009-04-11T19:17:40.360466Z
+6
+david@dyadcom.com
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+2815
+
+blueButton.png
+file
+
+
+
+
+2010-03-04T14:47:56.965073Z
+31e6bb205785b14b99f972469309a1d1
+2009-10-25T08:00:04.365941Z
+115
+davidcolbykaneda
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+1979
+
+chevron_circle.png
+file
+
+
+
+
+2010-03-04T14:47:56.965073Z
+7bdca122d9c225a352e9b5b8fdfa8b75
+2009-09-03T18:03:08.814593Z
+57
+davidcolbykaneda
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+1243
+
+rowhead.png
+file
+
+
+
+
+2010-03-04T14:47:56.965073Z
+09562c0978c632fc8b15c5612614711e
+2009-09-03T18:03:08.814593Z
+57
+davidcolbykaneda
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+171
+
+button_clicked.png
+file
+
+
+
+
+2010-03-04T14:47:56.966073Z
+0f3e780733d57f036943d65631417f76
+2009-04-11T19:17:40.360466Z
+6
+david@dyadcom.com
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+3283
+
+back_button.png
+file
+
+
+
+
+2010-03-04T14:47:56.966073Z
+29b39e2432440df4b0b1781dd4a41408
+2009-04-11T19:17:40.360466Z
+6
+david@dyadcom.com
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+3756
+
diff --git a/themes/jqt/img/.svn/prop-base/activeButton.png.svn-base b/themes/jqt/img/.svn/prop-base/activeButton.png.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/themes/jqt/img/.svn/prop-base/activeButton.png.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/themes/jqt/img/.svn/prop-base/back_button.png.svn-base b/themes/jqt/img/.svn/prop-base/back_button.png.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/themes/jqt/img/.svn/prop-base/back_button.png.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/themes/jqt/img/.svn/prop-base/back_button_clicked.png.svn-base b/themes/jqt/img/.svn/prop-base/back_button_clicked.png.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/themes/jqt/img/.svn/prop-base/back_button_clicked.png.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/themes/jqt/img/.svn/prop-base/blueButton.png.svn-base b/themes/jqt/img/.svn/prop-base/blueButton.png.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/themes/jqt/img/.svn/prop-base/blueButton.png.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/themes/jqt/img/.svn/prop-base/button.png.svn-base b/themes/jqt/img/.svn/prop-base/button.png.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/themes/jqt/img/.svn/prop-base/button.png.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/themes/jqt/img/.svn/prop-base/button_clicked.png.svn-base b/themes/jqt/img/.svn/prop-base/button_clicked.png.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/themes/jqt/img/.svn/prop-base/button_clicked.png.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/themes/jqt/img/.svn/prop-base/chevron.png.svn-base b/themes/jqt/img/.svn/prop-base/chevron.png.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/themes/jqt/img/.svn/prop-base/chevron.png.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/themes/jqt/img/.svn/prop-base/chevron_circle.png.svn-base b/themes/jqt/img/.svn/prop-base/chevron_circle.png.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/themes/jqt/img/.svn/prop-base/chevron_circle.png.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/themes/jqt/img/.svn/prop-base/grayButton.png.svn-base b/themes/jqt/img/.svn/prop-base/grayButton.png.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/themes/jqt/img/.svn/prop-base/grayButton.png.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/themes/jqt/img/.svn/prop-base/greenButton.png.svn-base b/themes/jqt/img/.svn/prop-base/greenButton.png.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/themes/jqt/img/.svn/prop-base/greenButton.png.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/themes/jqt/img/.svn/prop-base/loading.gif.svn-base b/themes/jqt/img/.svn/prop-base/loading.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/themes/jqt/img/.svn/prop-base/loading.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/themes/jqt/img/.svn/prop-base/on_off.png.svn-base b/themes/jqt/img/.svn/prop-base/on_off.png.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/themes/jqt/img/.svn/prop-base/on_off.png.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/themes/jqt/img/.svn/prop-base/redButton.png.svn-base b/themes/jqt/img/.svn/prop-base/redButton.png.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/themes/jqt/img/.svn/prop-base/redButton.png.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/themes/jqt/img/.svn/prop-base/rowhead.png.svn-base b/themes/jqt/img/.svn/prop-base/rowhead.png.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/themes/jqt/img/.svn/prop-base/rowhead.png.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/themes/jqt/img/.svn/prop-base/toggle.png.svn-base b/themes/jqt/img/.svn/prop-base/toggle.png.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/themes/jqt/img/.svn/prop-base/toggle.png.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/themes/jqt/img/.svn/prop-base/toggleOn.png.svn-base b/themes/jqt/img/.svn/prop-base/toggleOn.png.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/themes/jqt/img/.svn/prop-base/toggleOn.png.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/themes/jqt/img/.svn/prop-base/toolbar.png.svn-base b/themes/jqt/img/.svn/prop-base/toolbar.png.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/themes/jqt/img/.svn/prop-base/toolbar.png.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/themes/jqt/img/.svn/prop-base/whiteButton.png.svn-base b/themes/jqt/img/.svn/prop-base/whiteButton.png.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/themes/jqt/img/.svn/prop-base/whiteButton.png.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/themes/jqt/img/.svn/text-base/activeButton.png.svn-base b/themes/jqt/img/.svn/text-base/activeButton.png.svn-base Binary files differnew file mode 100644 index 0000000..a472f1b --- /dev/null +++ b/themes/jqt/img/.svn/text-base/activeButton.png.svn-base diff --git a/themes/jqt/img/.svn/text-base/back_button.png.svn-base b/themes/jqt/img/.svn/text-base/back_button.png.svn-base Binary files differnew file mode 100644 index 0000000..9873901 --- /dev/null +++ b/themes/jqt/img/.svn/text-base/back_button.png.svn-base diff --git a/themes/jqt/img/.svn/text-base/back_button_clicked.png.svn-base b/themes/jqt/img/.svn/text-base/back_button_clicked.png.svn-base Binary files differnew file mode 100644 index 0000000..5ec4230 --- /dev/null +++ b/themes/jqt/img/.svn/text-base/back_button_clicked.png.svn-base diff --git a/themes/jqt/img/.svn/text-base/blueButton.png.svn-base b/themes/jqt/img/.svn/text-base/blueButton.png.svn-base Binary files differnew file mode 100644 index 0000000..7c39f27 --- /dev/null +++ b/themes/jqt/img/.svn/text-base/blueButton.png.svn-base diff --git a/themes/jqt/img/.svn/text-base/button.png.svn-base b/themes/jqt/img/.svn/text-base/button.png.svn-base Binary files differnew file mode 100644 index 0000000..52cc7e2 --- /dev/null +++ b/themes/jqt/img/.svn/text-base/button.png.svn-base diff --git a/themes/jqt/img/.svn/text-base/button_clicked.png.svn-base b/themes/jqt/img/.svn/text-base/button_clicked.png.svn-base Binary files differnew file mode 100644 index 0000000..25d478f --- /dev/null +++ b/themes/jqt/img/.svn/text-base/button_clicked.png.svn-base diff --git a/themes/jqt/img/.svn/text-base/chevron.png.svn-base b/themes/jqt/img/.svn/text-base/chevron.png.svn-base Binary files differnew file mode 100644 index 0000000..5bdaa46 --- /dev/null +++ b/themes/jqt/img/.svn/text-base/chevron.png.svn-base diff --git a/themes/jqt/img/.svn/text-base/chevron_circle.png.svn-base b/themes/jqt/img/.svn/text-base/chevron_circle.png.svn-base Binary files differnew file mode 100644 index 0000000..b477e7c --- /dev/null +++ b/themes/jqt/img/.svn/text-base/chevron_circle.png.svn-base diff --git a/themes/jqt/img/.svn/text-base/grayButton.png.svn-base b/themes/jqt/img/.svn/text-base/grayButton.png.svn-base Binary files differnew file mode 100644 index 0000000..0ce6a30 --- /dev/null +++ b/themes/jqt/img/.svn/text-base/grayButton.png.svn-base diff --git a/themes/jqt/img/.svn/text-base/greenButton.png.svn-base b/themes/jqt/img/.svn/text-base/greenButton.png.svn-base Binary files differnew file mode 100644 index 0000000..a45594b --- /dev/null +++ b/themes/jqt/img/.svn/text-base/greenButton.png.svn-base diff --git a/themes/jqt/img/.svn/text-base/loading.gif.svn-base b/themes/jqt/img/.svn/text-base/loading.gif.svn-base Binary files differnew file mode 100644 index 0000000..2b4205b --- /dev/null +++ b/themes/jqt/img/.svn/text-base/loading.gif.svn-base diff --git a/themes/jqt/img/.svn/text-base/on_off.png.svn-base b/themes/jqt/img/.svn/text-base/on_off.png.svn-base Binary files differnew file mode 100644 index 0000000..95d6d5c --- /dev/null +++ b/themes/jqt/img/.svn/text-base/on_off.png.svn-base diff --git a/themes/jqt/img/.svn/text-base/redButton.png.svn-base b/themes/jqt/img/.svn/text-base/redButton.png.svn-base Binary files differnew file mode 100644 index 0000000..f5728df --- /dev/null +++ b/themes/jqt/img/.svn/text-base/redButton.png.svn-base diff --git a/themes/jqt/img/.svn/text-base/rowhead.png.svn-base b/themes/jqt/img/.svn/text-base/rowhead.png.svn-base Binary files differnew file mode 100644 index 0000000..b2fa8f6 --- /dev/null +++ b/themes/jqt/img/.svn/text-base/rowhead.png.svn-base diff --git a/themes/jqt/img/.svn/text-base/toggle.png.svn-base b/themes/jqt/img/.svn/text-base/toggle.png.svn-base Binary files differnew file mode 100644 index 0000000..3b62ebf --- /dev/null +++ b/themes/jqt/img/.svn/text-base/toggle.png.svn-base diff --git a/themes/jqt/img/.svn/text-base/toggleOn.png.svn-base b/themes/jqt/img/.svn/text-base/toggleOn.png.svn-base Binary files differnew file mode 100644 index 0000000..b016814 --- /dev/null +++ b/themes/jqt/img/.svn/text-base/toggleOn.png.svn-base diff --git a/themes/jqt/img/.svn/text-base/toolbar.png.svn-base b/themes/jqt/img/.svn/text-base/toolbar.png.svn-base Binary files differnew file mode 100644 index 0000000..c17bcf2 --- /dev/null +++ b/themes/jqt/img/.svn/text-base/toolbar.png.svn-base diff --git a/themes/jqt/img/.svn/text-base/whiteButton.png.svn-base b/themes/jqt/img/.svn/text-base/whiteButton.png.svn-base Binary files differnew file mode 100644 index 0000000..5514b27 --- /dev/null +++ b/themes/jqt/img/.svn/text-base/whiteButton.png.svn-base diff --git a/themes/jqt/img/activeButton.png b/themes/jqt/img/activeButton.png Binary files differnew file mode 100644 index 0000000..a472f1b --- /dev/null +++ b/themes/jqt/img/activeButton.png diff --git a/themes/jqt/img/back_button.png b/themes/jqt/img/back_button.png Binary files differnew file mode 100644 index 0000000..9873901 --- /dev/null +++ b/themes/jqt/img/back_button.png diff --git a/themes/jqt/img/back_button_clicked.png b/themes/jqt/img/back_button_clicked.png Binary files differnew file mode 100644 index 0000000..5ec4230 --- /dev/null +++ b/themes/jqt/img/back_button_clicked.png diff --git a/themes/jqt/img/blueButton.png b/themes/jqt/img/blueButton.png Binary files differnew file mode 100644 index 0000000..7c39f27 --- /dev/null +++ b/themes/jqt/img/blueButton.png diff --git a/themes/jqt/img/button.png b/themes/jqt/img/button.png Binary files differnew file mode 100644 index 0000000..52cc7e2 --- /dev/null +++ b/themes/jqt/img/button.png diff --git a/themes/jqt/img/button_clicked.png b/themes/jqt/img/button_clicked.png Binary files differnew file mode 100644 index 0000000..25d478f --- /dev/null +++ b/themes/jqt/img/button_clicked.png diff --git a/themes/jqt/img/chevron.png b/themes/jqt/img/chevron.png Binary files differnew file mode 100644 index 0000000..5bdaa46 --- /dev/null +++ b/themes/jqt/img/chevron.png diff --git a/themes/jqt/img/chevron_circle.png b/themes/jqt/img/chevron_circle.png Binary files differnew file mode 100644 index 0000000..b477e7c --- /dev/null +++ b/themes/jqt/img/chevron_circle.png diff --git a/themes/jqt/img/grayButton.png b/themes/jqt/img/grayButton.png Binary files differnew file mode 100644 index 0000000..0ce6a30 --- /dev/null +++ b/themes/jqt/img/grayButton.png diff --git a/themes/jqt/img/greenButton.png b/themes/jqt/img/greenButton.png Binary files differnew file mode 100644 index 0000000..a45594b --- /dev/null +++ b/themes/jqt/img/greenButton.png diff --git a/themes/jqt/img/loading.gif b/themes/jqt/img/loading.gif Binary files differnew file mode 100644 index 0000000..2b4205b --- /dev/null +++ b/themes/jqt/img/loading.gif diff --git a/themes/jqt/img/on_off.png b/themes/jqt/img/on_off.png Binary files differnew file mode 100644 index 0000000..1fed123 --- /dev/null +++ b/themes/jqt/img/on_off.png diff --git a/themes/jqt/img/redButton.png b/themes/jqt/img/redButton.png Binary files differnew file mode 100644 index 0000000..f5728df --- /dev/null +++ b/themes/jqt/img/redButton.png diff --git a/themes/jqt/img/rowhead.png b/themes/jqt/img/rowhead.png Binary files differnew file mode 100644 index 0000000..b2fa8f6 --- /dev/null +++ b/themes/jqt/img/rowhead.png diff --git a/themes/jqt/img/toggle.png b/themes/jqt/img/toggle.png Binary files differnew file mode 100644 index 0000000..3b62ebf --- /dev/null +++ b/themes/jqt/img/toggle.png diff --git a/themes/jqt/img/toggleOn.png b/themes/jqt/img/toggleOn.png Binary files differnew file mode 100644 index 0000000..b016814 --- /dev/null +++ b/themes/jqt/img/toggleOn.png diff --git a/themes/jqt/img/toolbar.png b/themes/jqt/img/toolbar.png Binary files differnew file mode 100644 index 0000000..c17bcf2 --- /dev/null +++ b/themes/jqt/img/toolbar.png diff --git a/themes/jqt/img/whiteButton.png b/themes/jqt/img/whiteButton.png Binary files differnew file mode 100644 index 0000000..5514b27 --- /dev/null +++ b/themes/jqt/img/whiteButton.png diff --git a/themes/jqt/theme.css b/themes/jqt/theme.css new file mode 100644 index 0000000..38f1455 --- /dev/null +++ b/themes/jqt/theme.css @@ -0,0 +1,561 @@ +body, #jqt { + background: #000; + color: #ddd; +} +body > *, div#jqt > * { + background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#333), to(#5e5e65)); +} +#jqt h1, #jqt h2 { + font: bold 18px "Helvetica Neue", Helvetica; + text-shadow: rgba(255,255,255,.2) 0 1px 1px; + color: #000; + margin: 10px 20px 5px; +} +/* @group Toolbar */ +#jqt .toolbar { + -webkit-box-sizing: border-box; + border-bottom: 1px solid #000; + padding: 8px; + height: 45px; + background: url(img/toolbar.png) #000000 repeat-x; + position: relative; +} +#jqt .black-translucent .toolbar { + margin-top: 20px; +} +div#jqt .toolbar > h1 { + position: absolute; + overflow: hidden; + left: 48%; + vertical-align:middle; + line-height: 1em; + margin: 1px 0 0 -75px; + height: 40px; + font-size: 18px; + width: 150px; + font-weight: bold; + text-shadow: rgba(0,0,0,1) 0 -1px 1px; + text-align: center; + text-overflow: ellipsis; + white-space: nowrap; + color: #fff; +} +div#jqt.landscape .toolbar > h1 { + margin-left: -125px; + width: 250px; +} +#jqt .button, #jqt .back, #jqt .cancel, #jqt .add { + position: absolute; + overflow: hidden; + top: 8px; + right: 10px; + margin: 0; + border-width: 0 5px; + padding: 0 3px; + width: auto; + height: 30px; + line-height: 30px; + font-family: inherit; + font-size: 12px; + font-weight: bold; + color: #fff; + text-shadow: rgba(0, 0, 0, 0.5) 0px -1px 0; + text-overflow: ellipsis; + text-decoration: none; + white-space: nowrap; + background: none; + -webkit-border-image: url(img/button.png) 0 5 0 5; +} +#jqt .button.active, #jqt .cancel.active, #jqt .add.active { + -webkit-border-image: url(img/button_clicked.png) 0 5 0 5; + color: #aaa; +} +#jqt .blueButton { + -webkit-border-image: url(img/blueButton.png) 0 5 0 5; + border-width: 0 5px; +} +#jqt .back { + left: 6px; + right: auto; + padding: 0; + max-width: 55px; + border-width: 0 8px 0 14px; + -webkit-border-image: url(img/back_button.png) 0 8 0 14; +} +#jqt .back.active { + -webkit-border-image: url(img/back_button_clicked.png) 0 8 0 14; + color: #aaa; +} +#jqt .leftButton, #jqt .cancel { + left: 6px; + right: auto; +} +#jqt .add { + font-size: 24px; + line-height: 24px; + font-weight: bold; +} +#jqt .whiteButton, +#jqt .grayButton, #jqt .redButton, #jqt .blueButton, #jqt .greenButton { + display: block; + border-width: 0 12px; + padding: 10px; + text-align: center; + font-size: 20px; + font-weight: bold; + text-decoration: inherit; + color: inherit; +} + +#jqt .whiteButton.active, #jqt .grayButton.active, #jqt .redButton.active, #jqt .blueButton.active, #jqt .greenButton.active, +#jqt .whiteButton:active, #jqt .grayButton:active, #jqt .redButton:active, #jqt .blueButton:active, #jqt .greenButton:active { + -webkit-border-image: url(img/activeButton.png) 0 12 0 12; +} +#jqt .whiteButton { + -webkit-border-image: url(img/whiteButton.png) 0 12 0 12; + text-shadow: rgba(255, 255, 255, 0.7) 0 1px 0; +} +#jqt .grayButton { + -webkit-border-image: url(img/grayButton.png) 0 12 0 12; + color: #FFFFFF; +} + +#jqt .redButton { + -webkit-border-image: url(img/redButton.png) 0 12 0 12; + color: #FFFFFF; +} + +#jqt .greenButton { + -webkit-border-image: url(img/greenButton.png) 0 12 0 12; + color: #FFFFFF; +} + + +/* @end */ +/* @group Lists */ +#jqt h1 + ul, #jqt h2 + ul, #jqt h3 + ul, #jqt h4 + ul, #jqt h5 + ul, #jqt h6 + ul { + margin-top: 0; +} +#jqt ul { + color: #aaa; + border: 1px solid #333333; + font: bold 18px "Helvetica Neue", Helvetica; + padding: 0; + margin: 15px 10px 17px 10px; +} +#jqt ul.rounded { + -webkit-border-radius: 8px; + -webkit-box-shadow: rgba(0,0,0,.3) 1px 1px 3px; +} +#jqt ul.rounded li:first-child, #jqt ul.rounded li:first-child a { + border-top: 0; + -webkit-border-top-left-radius: 8px; + -webkit-border-top-right-radius: 8px; +} +#jqt ul.rounded li:last-child, #jqt ul.rounded li:last-child a { + -webkit-border-bottom-left-radius: 8px; + -webkit-border-bottom-right-radius: 8px; +} +#jqt ul li { + color: #666; + border-top: 1px solid #333; + border-bottom: #555858; + list-style-type: none; + padding: 10px 10px 10px 10px; + background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#4c4d4e), to(#404142)); + overflow: hidden; +} +#jqt ul li.arrow { + background-image: url(img/chevron.png), -webkit-gradient(linear, 0% 0%, 0% 100%, from(#4c4d4e), to(#404142)); + background-position: right center; + background-repeat: no-repeat; +} + +#jqt ul li.arrow a { + padding: 12px 22px 12px 10px; +} + +#jqt ul li.forward { + background-image: url(img/chevron_circle.png), -webkit-gradient(linear, 0% 0%, 0% 100%, from(#4c4d4e), to(#404142)); + background-position: right center; + background-repeat: no-repeat; +} +/* universal links on list */ +#jqt ul li a, #jqt li.img a + a { + color: #fff; + text-decoration: none; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; + display: block; + padding: 12px 10px 12px 10px; + margin: -10px; + -webkit-tap-highlight-color: rgba(0,0,0,0); + text-shadow: rgba(0,0,0,.2) 0 1px 1px; +} +#jqt ul li a.active, #jqt ul li a.button { + background-color: #ff8300; + color: #fff; +} +#jqt ul li a.active.loading { + background-image: url(img/loading.gif); + background-position: 95% center; + background-repeat: no-repeat; +} +#jqt ul li.arrow a.active { + background-image: url(img/chevron.png); + background-position: right center; + background-repeat: no-repeat; +} +#jqt ul li.forward a.active { + background-image: url(img/chevron_circle.png); + background-position: right center; + background-repeat: no-repeat; +} +#jqt ul li.img a + a { + margin: -10px 10px -20px -5px; + font-size: 17px; + font-weight: bold; +} +#jqt ul li.img a + a + a { + font-size: 14px; + font-weight: normal; + margin-left: -10px; + margin-bottom: -10px; + margin-top: 0; +} +#jqt ul li.img a + small + a { + margin-left: -5px; +} +#jqt ul li.img a + small + a + a { + margin-left: -10px; + margin-top: -20px; + margin-bottom: -10px; + font-size: 14px; + font-weight: normal; +} +#jqt ul li.img a + small + a + a + a { + margin-left: 0px !important; + margin-bottom: 0; +} +#jqt ul li a + a { + color: #000; + font: 14px "Helvetica Neue", Helvetica; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; + display: block; + margin: 0; + padding: 0; +} +#jqt ul li a + a + a, #jqt ul li.img a + a + a + a, #jqt ul li.img a + small + a + a + a { + color: #666; + font: 13px "Helvetica Neue", Helvetica; + margin: 0; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; + display: block; + padding: 0; +} +/* +@end */ +/* @group Forms */ +#jqt ul.form li { + padding: 7px 10px; +} +#jqt ul.form li.error { + border: 2px solid red; +} +#jqt ul.form li.error + li.error { + border-top: 0; +} +#jqt ul li input[type="text"], +#jqt ul li input[type="password"], +#jqt ul li input[type="tel"], +#jqt ul li input[type="number"], +#jqt ul li input[type="search"], +#jqt ul li input[type="email"], +#jqt ul li input[type="url"], +#jqt ul li textarea, +#jqt ul li select { + color: #FFFFFF; + background: transparent url('data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=='); + border: 0; + font: bold 17px "Helvetica Neue", Helvetica; + padding: 0; + display: inline-block; + margin-left: 10px; + width: 100%; + -webkit-appearance: textarea; +} +#jqt ul li textarea { + height: 120px; + padding: 0; + text-indent: -2px; +} +#jqt ul li select { + text-indent: 15px; + background: transparent url(img/chevron.png) no-repeat right center; + -webkit-appearance: textfield; + margin-left: -6px; + width: 104%; +} +#jqt ul li input[type="checkbox"], #jqt ul li input[type="radio"] { + margin: 0; + padding: 10px 10px; +} +#jqt ul li input[type="checkbox"]:after, #jqt ul li input[type="radio"]:after { + content: attr(title); + font: 17px "Helvetica Neue", Helvetica; + display: block; + width: 246px; + color: #ff8300; + margin: -12px 0 0 17px; +} +/* @end */ +/* @group Mini Label */ +#jqt ul li small { + color: #64c114; + font: 17px "Helvetica Neue", Helvetica; + text-align: right; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; + display: block; + width: 23%; + float: right; + padding: 0; +} +#jqt ul li.arrow small { + padding: 0 15px; +} +#jqt ul li small.counter { + font-size: 17px; + line-height: 13px; + font-weight: bold; + background: rgba(0,0,0,.15); + color: #fff; + -webkit-border-radius: 11px; + padding: 4px 10px 5px 10px; + display: block; + width: auto; + margin-top: -25px; + -webkit-box-shadow: rgba(255,255,255,.1) 0 1px 0; +} +#jqt ul li.arrow small.counter { + margin-right: 15px; +} +/* @end */ +/* @group Individual */ +#jqt ul.individual { + border: 0; + background: none; + clear: both; + overflow: hidden; + padding-bottom: 3px; + -webkit-box-shadow: none; +} +#jqt ul.individual li { + background: #4c4d4e; + border: 1px solid #333; + font-size: 14px; + text-align: center; + -webkit-border-radius: 8px; + -webkit-box-sizing: border-box; + width: 48%; + float: left; + display: block; + padding: 11px 10px 14px 10px; + -webkit-box-shadow: rgba(0,0,0,.2) 1px 1px 3px; + background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#4c4d4e), to(#404142)); +} +#jqt ul.individual li + li { + float: right; +} +#jqt ul.individual li a { + color: #fff; + line-height: 16px; + margin: -11px -10px -14px -10px; + padding: 11px 10px 14px 10px; + -webkit-border-radius: 8px; +} +/* @end */ +/* @group Toggle */ +#jqt .toggle { + width: 94px; + position: relative; + height: 27px; + display: block; + overflow: hidden; + float: right; +} +#jqt .toggle input[type="checkbox"]:checked { + left: 0px; +} +#jqt .toggle input[type="checkbox"] { + -webkit-appearance: textarea; + -webkit-border-radius: 5px; + -webkit-tap-highlight-color: rgba(0,0,0,0); + -webkit-transition: left .15s; + background-color: transparent; + background: #fff url(img/on_off.png) 0 0 no-repeat; + border: 0; + height: 27px; + left: -55px; + margin: 0; + overflow: hidden; + position: absolute; + top: 0; + width: 149px; +} +/* @end */ +/* @group Info */ +#jqt .info { + background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#ccc), to(#aaa), color-stop(.6,#CCCCCC)); + font-size: 12px; + line-height: 16px; + text-align: center; + text-shadow: rgba(255,255,255,.8) 0 1px 0; + color: #444; + padding: 15px; + border-top: 1px solid rgba(255,255,255,.2); + font-weight: bold; +} +/* @end */ +/* @group Edge to edge */ +#jqt ul.edgetoedge { + border-width: 1px 0; + margin: 0; + padding: 0; +} +#jqt ul.edgetoedge li { + background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#1e1f21), to(#272729)); + border-bottom: 2px solid #000; + border-top: 1px solid #4a4b4d; + font-size: 20px; + margin-bottom: -1px; +} +#jqt ul.edgetoedge li.sep { + background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgba(0,0,0,0)), to(rgba(0,0,0,.5))); + border-bottom: 1px solid #111113; + border-top: 1px solid #666; + color: #3e9ac3; + font-size: 16px; + margin: 1px 0 0 0; + padding: 2px 10px; + text-shadow: #000 0 1px 0; +} +#jqt ul.edgetoedge li em { + font-weight: normal; + font-style: normal; +} +/* @end */ +/* @group Plastic */ +#jqt #plastic { + background: #17181a; +} +#jqt ul.plastic { + background: #17181a; + color: #aaa; + font: bold 18px "Helvetica Neue", Helvetica; + margin: 0; + padding: 0; + border-width: 0 0 1px 0; +} +#jqt ul.plastic li { + border-width: 1px 0; + border-style: solid; + border-top-color: #222; + border-bottom-color: #000; + color: #666; + list-style-type: none; + overflow: hidden; + padding: 10px 10px 10px 10px; +} +#jqt ul.plastic li a.active.loading { + background-image: url(img/loading.gif); + background-position: 95% center; + background-repeat: no-repeat; +} +#jqt ul.plastic li small { + color: #888; + font-size: 13px; + font-weight: bold; + line-height: 24px; + text-transform: uppercase; +} +#jqt ul.plastic li:nth-child(odd) { + background-color: #1c1c1f; +} +#jqt ul.plastic li.arrow { + background-image: url(img/chevron.png); + background-position: right center; + background-repeat: no-repeat; +} +#jqt ul.plastic li.arrow a.active { + background-image: url(img/chevron.png); + background-position: right center; + background-repeat: no-repeat; +} +#jqt ul.plastic li.forward { + background-image: url(img/chevron_circle.png); + background-position: right center; + background-repeat: no-repeat; +} +#jqt ul.plastic li.forward a.active { + background-image: url(img/chevron_circle.png); + background-position: right center; + background-repeat: no-repeat; +} +/* @group Metal */ +#jqt ul.metal { + border-bottom: 0; + border-left: 0; + border-right: 0; + border-top: 0; + margin: 0; +} +#jqt ul.metal li { + background-image: none; + border-top: 1px solid #fff; + border-bottom: 1px solid #666; + font-size: 26px; + background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgba(238,238,238,1)), to(rgba(156,158,160,1))); +} +#jqt ul.metal li a { + line-height: 26px; + margin: 0; + text-shadow: #fff 0 1px 0; + padding: 13px 0; +} +#jqt ul.metal li a em { + display: block; + font-size: 14px; + font-style: normal; + color: #444; + width: 50%; + line-height: 14px; +} +#jqt ul.metal li a.active { + color: rgb(0,0,0); +} +#jqt ul.metal li small { + float: right; + position: relative; + margin-top: 10px; + font-weight: bold; +} +#jqt ul.metal li.arrow { + background-image: url(img/chevron.png); + background-position: right center; + background-repeat: no-repeat; + background-image: url(img/chevron.png), -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgba(238,238,238,1)), to(rgba(156,158,160,1))); + background-repeat: no-repeat; + background-position: right center; +} +#jqt ul.metal li.arrow a small { + padding-right: 15px; + line-height: 17px; +} +/* @end */ diff --git a/themes/jqt/theme.min.css b/themes/jqt/theme.min.css new file mode 100644 index 0000000..0182b88 --- /dev/null +++ b/themes/jqt/theme.min.css @@ -0,0 +1 @@ +body{background:#000;color:#ddd;}body>*{background:-webkit-gradient(linear,0% 0,0% 100%,from(#333),to(#5e5e65));}h1,h2{font:bold 18px Helvetica;text-shadow:rgba(255,255,255,.2) 0 1px 1px;color:#000;margin:10px 20px 5px;}.toolbar{-webkit-box-sizing:border-box;border-bottom:1px solid #000;padding:10px;height:45px;background:url(img/toolbar.png) #000 repeat-x;position:relative;}.black-translucent .toolbar{margin-top:20px;}.toolbar>h1{position:absolute;overflow:hidden;left:50%;top:10px;line-height:1em;margin:1px 0 0 -75px;height:40px;font-size:20px;width:150px;font-weight:bold;text-shadow:rgba(0,0,0,1) 0 -1px 1px;text-align:center;text-overflow:ellipsis;white-space:nowrap;color:#fff;}body.landscape .toolbar>h1{margin-left:-125px;width:250px;}.button,.back,.cancel,.add{position:absolute;overflow:hidden;top:8px;right:10px;margin:0;border-width:0 5px;padding:0 3px;width:auto;height:30px;line-height:30px;font-family:inherit;font-size:12px;font-weight:bold;color:#fff;text-shadow:rgba(0,0,0,0.5) 0 -1px 0;text-overflow:ellipsis;text-decoration:none;white-space:nowrap;background:none;-webkit-border-image:url(img/button.png) 0 5 0 5;}.blueButton{-webkit-border-image:url(img/blueButton.png) 0 5 0 5;border-width:0 5px;}.back{left:6px;right:auto;padding:0;max-width:55px;border-width:0 8px 0 14px;-webkit-border-image:url(img/back_button.png) 0 8 0 14;}.back.active{-webkit-border-image:url(img/back_button_clicked.png) 0 8 0 14;color:#aaa;}.leftButton,.cancel{left:6px;right:auto;}.add{font-size:24px;line-height:24px;font-weight:bold;}.whiteButton,.grayButton{display:block;border-width:0 12px;padding:10px;text-align:center;font-size:20px;font-weight:bold;text-decoration:inherit;color:inherit;}.whiteButton{-webkit-border-image:url(img/whiteButton.png) 0 12 0 12;text-shadow:rgba(255,255,255,0.7) 0 1px 0;}.grayButton{-webkit-border-image:url(img/grayButton.png) 0 12 0 12;color:#FFF;}h1+ul,h2+ul,h3+ul,h4+ul,h5+ul,h6+ul{margin-top:0;}ul{color:#aaa;border:1px solid #333;font:bold 18px Helvetica;padding:0;margin:15px 10px 17px 10px;}ul.rounded{-webkit-border-radius:8px;-webkit-box-shadow:rgba(0,0,0,.3) 1px 1px 3px;}ul.rounded li:first-child,ul.rounded li:first-child a{border-top:0;-webkit-border-top-left-radius:8px;-webkit-border-top-right-radius:8px;}ul.rounded li:last-child,ul.rounded li:last-child a{-webkit-border-bottom-left-radius:8px;-webkit-border-bottom-right-radius:8px;}ul li{color:#666;border-top:1px solid #333;border-bottom:#555858;list-style-type:none;padding:10px 10px 10px 10px;background:-webkit-gradient(linear,0% 0,0% 100%,from(#4c4d4e),to(#404142));overflow:hidden;}ul li.arrow{background-image:url(img/chevron.png),-webkit-gradient(linear,0% 0,0% 100%,from(#4c4d4e),to(#404142));background-position:right center;background-repeat:no-repeat;}ul li.forward{background-image:url(img/chevron_circle.png),-webkit-gradient(linear,0% 0,0% 100%,from(#4c4d4e),to(#404142));background-position:right center;background-repeat:no-repeat;}ul li a,li.img a+a{color:#fff;text-decoration:none;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;display:block;padding:12px 10px 12px 10px;margin:-10px;-webkit-tap-highlight-color:rgba(0,0,0,0);text-shadow:rgba(0,0,0,.2) 0 1px 1px;}ul li a.active,ul li a.button{background-color:#53b401;color:#fff;}ul li a.active.loading{background-image:url(img/loading.gif);background-position:95% center;background-repeat:no-repeat;}ul li.arrow a.active{background-image:url(img/chevron.png);background-position:right center;background-repeat:no-repeat;}ul li.forward a.active{background-image:url(img/chevron_circle.png);background-position:right center;background-repeat:no-repeat;}ul li.img a+a{margin:-10px 10px -20px -5px;font-size:17px;font-weight:bold;}ul li.img a+a+a{font-size:14px;font-weight:normal;margin-left:-10px;margin-bottom:-10px;margin-top:0;}ul li.img a+small+a{margin-left:-5px;}ul li.img a+small+a+a{margin-left:-10px;margin-top:-20px;margin-bottom:-10px;font-size:14px;font-weight:normal;}ul li.img a+small+a+a+a{margin-left:0!important;margin-bottom:0;}ul li a+a{color:#000;font:14px Helvetica;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;display:block;margin:0;padding:0;}ul li a+a+a,ul li.img a+a+a+a,ul li.img a+small+a+a+a{color:#666;font:13px Helvetica;margin:0;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;display:block;padding:0;}ul.form li{padding:7px 10px;}ul.form li.error{border:2px solid red;}ul.form li.error+li.error{border-top:0;}ul li input[type="text"],ul li input[type="password"],ul li textarea,ul li select{color:#777;background:transparent url(../.png);border:0;font:normal 17px Helvetica;padding:0;display:inline-block;margin-left:0;width:100%;-webkit-appearance:textarea;}ul li textarea{height:120px;padding:0;text-indent:-2px;}ul li select{text-indent:0;background:transparent url(img/chevron.png) no-repeat right center;-webkit-appearance:textfield;margin-left:-6px;width:104%;}ul li input[type="checkbox"],ul li input[type="radio"]{margin:0;padding:10px 10px;}ul li input[type="checkbox"]:after,ul li input[type="radio"]:after{content:attr(title);font:17px Helvetica;display:block;width:246px;color:#777;margin:-12px 0 0 17px;}ul li small{color:#64c114;font:17px Helvetica;text-align:right;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;display:block;width:23%;float:right;padding:0;}ul li.arrow small{padding:0 15px;}ul li small.counter{font-size:17px;line-height:13px;font-weight:bold;background:rgba(0,0,0,.15);color:#fff;-webkit-border-radius:11px;padding:4px 10px 5px 10px;display:block;width:auto;margin-top:-22px;-webkit-box-shadow:rgba(255,255,255,.1) 0 1px 0;}ul li.arrow small.counter{margin-right:15px;}ul.individual{border:0;background:none;clear:both;overflow:hidden;padding-bottom:3px;-webkit-box-shadow:none;}ul.individual li{background:#4c4d4e;border:1px solid #333;font-size:14px;text-align:center;-webkit-border-radius:8px;-webkit-box-sizing:border-box;width:48%;float:left;display:block;padding:11px 10px 14px 10px;-webkit-box-shadow:rgba(0,0,0,.2) 1px 1px 3px;background:-webkit-gradient(linear,0% 0,0% 100%,from(#4c4d4e),to(#404142));}ul.individual li+li{float:right;}ul.individual li a{color:#fff;line-height:16px;margin:-11px -10px -14px -10px;padding:11px 10px 14px 10px;-webkit-border-radius:8px;}.toggle{width:94px;position:relative;height:27px;display:block;overflow:hidden;float:right;}.toggle input[type="checkbox"]:checked{left:0;}.toggle input[type="checkbox"]{-webkit-appearance:textarea;-webkit-border-radius:5px;-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-transition:left .15s;background-color:transparent;background:#fff url(img/on_off.png) 0 0 no-repeat;border:0;height:27px;left:-55px;margin:0;overflow:hidden;position:absolute;top:0;width:149px;}.info{background:-webkit-gradient(linear,0% 0,0% 100%,from(#ccc),to(#aaa),color-stop(.6,#CCC));font-size:12px;line-height:16px;text-align:center;text-shadow:rgba(255,255,255,.8) 0 1px 0;color:#444;padding:15px;border-top:1px solid rgba(255,255,255,.2);font-weight:bold;}ul.edgetoedge{border-width:1px 0;margin:0;padding:0;}ul.edgetoedge li{background:-webkit-gradient(linear,0% 0,0% 100%,from(#1e1f21),to(#272729));border-bottom:2px solid #000;border-top:1px solid #4a4b4d;font-size:20px;margin-bottom:-1px;}ul.edgetoedge li.sep{background:-webkit-gradient(linear,0% 0,0% 100%,from(rgba(0,0,0,0)),to(rgba(0,0,0,.5)));border-bottom:1px solid #111113;border-top:1px solid #666;color:#3e9ac3;font-size:16px;margin:1px 0 0 0;padding:2px 10px;text-shadow:#000 0 1px 0;}ul.edgetoedge li em{font-weight:normal;font-style:normal;}#plastic{background:#17181a;}ul.plastic{background:#17181a;color:#aaa;font:bold 18px Helvetica;margin:0;padding:0;border-width:0 0 1px 0;}ul.plastic li{border-width:1px 0;border-style:solid;border-top-color:#222;border-bottom-color:#000;color:#666;list-style-type:none;overflow:hidden;padding:10px 10px 10px 10px;}ul.plastic li a.active.loading{background-image:url(img/loading.gif);background-position:95% center;background-repeat:no-repeat;}ul.plastic li small{color:#888;font-size:13px;font-weight:bold;line-height:24px;text-transform:uppercase;}ul.plastic li:nth-child(odd){background-color:#1c1c1f;}ul.plastic li.arrow{background-image:url(img/chevron.png);background-position:right center;background-repeat:no-repeat;}ul.plastic li.arrow a.active{background-image:url(img/chevron.png);background-position:right center;background-repeat:no-repeat;}ul.plastic li.forward{background-image:url(img/chevron_circle.png);background-position:right center;background-repeat:no-repeat;}ul.plastic li.forward a.active{background-image:url(img/chevron_circle.png);background-position:right center;background-repeat:no-repeat;}ul.metal{border-bottom:0;border-left:0;border-right:0;border-top:0;margin:0;}ul.metal li{background-image:none;border-top:1px solid #fff;border-bottom:1px solid #666;font-size:26px;background:-webkit-gradient(linear,0% 0,0% 100%,from(rgba(238,238,238,1)),to(rgba(156,158,160,1)));}ul.metal li a{line-height:26px;margin:0;text-shadow:#fff 0 1px 0;padding:13px 0;}ul.metal li a em{display:block;font-size:14px;font-style:normal;color:#444;width:50%;line-height:14px;}ul.metal li a.active{color:#000;}ul.metal li small{float:right;position:relative;margin-top:10px;font-weight:bold;}ul.metal li.arrow{background-image:url(img/chevron.png);background-position:right center;background-repeat:no-repeat;background-image:url(img/chevron.png),-webkit-gradient(linear,0% 0,0% 100%,from(rgba(238,238,238,1)),to(rgba(156,158,160,1)));background-repeat:no-repeat;background-position:right center;}ul.metal li.arrow a small{padding-right:15px;line-height:17px;}
\ No newline at end of file diff --git a/themes/jqtouch/.svn/all-wcprops b/themes/jqtouch/.svn/all-wcprops new file mode 100644 index 0000000..67b37e1 --- /dev/null +++ b/themes/jqtouch/.svn/all-wcprops @@ -0,0 +1,29 @@ +K 25
+svn:wc:ra_dav:version-url
+V 31
+/svn/!svn/ver/133/trunk/jqtouch
+END
+jqtouch.css
+K 25
+svn:wc:ra_dav:version-url
+V 43
+/svn/!svn/ver/133/trunk/jqtouch/jqtouch.css
+END
+jqtouch.transitions.js
+K 25
+svn:wc:ra_dav:version-url
+V 53
+/svn/!svn/ver/72/trunk/jqtouch/jqtouch.transitions.js
+END
+jqtouch.js
+K 25
+svn:wc:ra_dav:version-url
+V 42
+/svn/!svn/ver/133/trunk/jqtouch/jqtouch.js
+END
+jquery.1.3.2.min.js
+K 25
+svn:wc:ra_dav:version-url
+V 50
+/svn/!svn/ver/28/trunk/jqtouch/jquery.1.3.2.min.js
+END
diff --git a/themes/jqtouch/.svn/entries b/themes/jqtouch/.svn/entries new file mode 100644 index 0000000..d44e925 --- /dev/null +++ b/themes/jqtouch/.svn/entries @@ -0,0 +1,164 @@ +10
+
+dir
+133
+http://jqtouch.googlecode.com/svn/trunk/jqtouch
+http://jqtouch.googlecode.com/svn
+
+
+
+2010-01-15T21:08:54.001495Z
+133
+RBoulanouar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+210952ee-217a-11de-8f7e-2b794b28c5cd
+
+jqtouch.css
+file
+
+
+
+
+2010-03-04T14:47:59.244073Z
+898ec31c8e5cf1d6252df62fd19ccbda
+2010-01-15T21:08:54.001495Z
+133
+RBoulanouar
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+7795
+
+jqtouch.transitions.js
+file
+
+
+
+
+2010-03-04T14:47:59.244073Z
+7bc05f2402439d5cbec9289f97e57c17
+2009-09-22T22:22:25.485736Z
+72
+davidcolbykaneda
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+2144
+
+jqtouch.js
+file
+
+
+
+
+2010-03-04T14:47:59.245073Z
+d8734e570dbe87ac837cda20c8b6f4d3
+2010-01-15T21:08:54.001495Z
+133
+RBoulanouar
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+23145
+
+jquery.1.3.2.min.js
+file
+
+
+
+
+2010-03-04T14:47:59.245073Z
+bb381e2d19d8eace86b34d20759491a5
+2009-07-28T15:50:29.885230Z
+28
+david@dyadcom.com
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+57254
+
diff --git a/themes/jqtouch/.svn/prop-base/jqtouch.css.svn-base b/themes/jqtouch/.svn/prop-base/jqtouch.css.svn-base new file mode 100644 index 0000000..be4ccab --- /dev/null +++ b/themes/jqtouch/.svn/prop-base/jqtouch.css.svn-base @@ -0,0 +1,13 @@ +K 13 +svn:eol-style +V 6 +native +K 12 +svn:keywords +V 30 +LastChangedBy Date Revision Id +K 13 +svn:mime-type +V 8 +text/css +END diff --git a/themes/jqtouch/.svn/prop-base/jqtouch.js.svn-base b/themes/jqtouch/.svn/prop-base/jqtouch.js.svn-base new file mode 100644 index 0000000..2897092 --- /dev/null +++ b/themes/jqtouch/.svn/prop-base/jqtouch.js.svn-base @@ -0,0 +1,13 @@ +K 13 +svn:eol-style +V 6 +native +K 12 +svn:keywords +V 30 +LastChangedBy Date Revision Id +K 13 +svn:mime-type +V 15 +text/javascript +END diff --git a/themes/jqtouch/.svn/prop-base/jquery.1.3.2.min.js.svn-base b/themes/jqtouch/.svn/prop-base/jquery.1.3.2.min.js.svn-base new file mode 100644 index 0000000..2897092 --- /dev/null +++ b/themes/jqtouch/.svn/prop-base/jquery.1.3.2.min.js.svn-base @@ -0,0 +1,13 @@ +K 13 +svn:eol-style +V 6 +native +K 12 +svn:keywords +V 30 +LastChangedBy Date Revision Id +K 13 +svn:mime-type +V 15 +text/javascript +END diff --git a/themes/jqtouch/.svn/text-base/jqtouch.css.svn-base b/themes/jqtouch/.svn/text-base/jqtouch.css.svn-base new file mode 100644 index 0000000..5c3e736 --- /dev/null +++ b/themes/jqtouch/.svn/text-base/jqtouch.css.svn-base @@ -0,0 +1,373 @@ +* { + margin: 0; + padding: 0; +} +a { + -webkit-tap-highlight-color: rgba(0,0,0,0); +} + +div#jqt { + /*overflow-x: hidden;*/ + -webkit-user-select: none; + -webkit-text-size-adjust: none; + font-family: "Helvetica Neue", Helvetica; + -webkit-perspective: 800; + -webkit-transform-style: preserve-3d; +} +#jqt .selectable, #jqt input, #jqt textarea { + -webkit-user-select: auto; +} +div#jqt > * { + -webkit-backface-visibility: hidden; + -webkit-box-sizing: border-box; + display: none; + position: absolute; + left: 0; + width: 100%; + -webkit-transform: translate3d(0,0,0) rotate(0) scale(1); + min-height: 420px !important; +} +#jqt.fullscreen > * { + min-height: 460px !important; +} +#jqt.fullscreen.black-translucent > * { + min-height: 480px !important; +} +#jqt.landscape > * { + min-height: 320px !important; +} +div#jqt > .current { + display: block !important; +} + +#jqt .in, #jqt .out { + -webkit-animation-timing-function: ease-in-out; + -webkit-animation-duration: 350ms; +} + +#jqt .slide.in { + -webkit-animation-name: slideinfromright; +} + +#jqt .slide.out { + -webkit-animation-name: slideouttoleft; +} + +#jqt .slide.in.reverse { + -webkit-animation-name: slideinfromleft; +} + +#jqt .slide.out.reverse { + -webkit-animation-name: slideouttoright; +} + +@-webkit-keyframes slideinfromright { + from { -webkit-transform: translateX(100%); } + to { -webkit-transform: translateX(0); } +} + +@-webkit-keyframes slideinfromleft { + from { -webkit-transform: translateX(-100%); } + to { -webkit-transform: translateX(0); } +} + +@-webkit-keyframes slideouttoleft { + from { -webkit-transform: translateX(0); } + to { -webkit-transform: translateX(-100%); } +} + +@-webkit-keyframes slideouttoright { + from { -webkit-transform: translateX(0); } + to { -webkit-transform: translateX(100%); } +} + +@-webkit-keyframes fadein { + from { opacity: 0; } + to { opacity: 1; } +} + +@-webkit-keyframes fadeout { + from { opacity: 1; } + to { opacity: 0; } +} + +#jqt .fade.in { + z-index: 10; + -webkit-animation-name: fadein; +} +#jqt .fade.out { + z-index: 0; +} + +#jqt .dissolve.in { + -webkit-animation-name: fadein; +} + +#jqt .dissolve.out { + -webkit-animation-name: fadeout; +} + + + +#jqt .flip { + -webkit-animation-duration: .65s; +} + +#jqt .flip.in { + -webkit-animation-name: flipinfromleft; +} + +#jqt .flip.out { + -webkit-animation-name: flipouttoleft; +} + +/* Shake it all about */ + +#jqt .flip.in.reverse { + -webkit-animation-name: flipinfromright; +} + +#jqt .flip.out.reverse { + -webkit-animation-name: flipouttoright; +} + +@-webkit-keyframes flipinfromright { + from { -webkit-transform: rotateY(-180deg) scale(.8); } + to { -webkit-transform: rotateY(0) scale(1); } +} + +@-webkit-keyframes flipinfromleft { + from { -webkit-transform: rotateY(180deg) scale(.8); } + to { -webkit-transform: rotateY(0) scale(1); } +} + +@-webkit-keyframes flipouttoleft { + from { -webkit-transform: rotateY(0) scale(1); } + to { -webkit-transform: rotateY(-180deg) scale(.8); } +} + +@-webkit-keyframes flipouttoright { + from { -webkit-transform: rotateY(0) scale(1); } + to { -webkit-transform: rotateY(180deg) scale(.8); } +} + +#jqt .slideup.in { + -webkit-animation-name: slideup; + z-index: 10; +} + +#jqt .slideup.out { + -webkit-animation-name: dontmove; + z-index: 0; +} + +#jqt .slideup.out.reverse { + z-index: 10; + -webkit-animation-name: slidedown; +} + +#jqt .slideup.in.reverse { + z-index: 0; + -webkit-animation-name: dontmove; +} + + +@-webkit-keyframes slideup { + from { -webkit-transform: translateY(100%); } + to { -webkit-transform: translateY(0); } +} + +@-webkit-keyframes slidedown { + from { -webkit-transform: translateY(0); } + to { -webkit-transform: translateY(100%); } +} + + + +/* Hackish, but reliable. */ + +@-webkit-keyframes dontmove { + from { opacity: 1; } + to { opacity: 1; } +} + +#jqt .swap { + -webkit-transform: perspective(800); + -webkit-animation-duration: .7s; +} +#jqt .swap.out { + -webkit-animation-name: swapouttoleft; +} +#jqt .swap.in { + -webkit-animation-name: swapinfromright; +} +#jqt .swap.out.reverse { + -webkit-animation-name: swapouttoright; +} +#jqt .swap.in.reverse { + -webkit-animation-name: swapinfromleft; +} + + +@-webkit-keyframes swapouttoright { + 0% { + -webkit-transform: translate3d(0px, 0px, 0px) rotateY(0deg); + -webkit-animation-timing-function: ease-in-out; + } + 50% { + -webkit-transform: translate3d(-180px, 0px, -400px) rotateY(20deg); + -webkit-animation-timing-function: ease-in; + } + 100% { + -webkit-transform: translate3d(0px, 0px, -800px) rotateY(70deg); + } +} + +@-webkit-keyframes swapouttoleft { + 0% { + -webkit-transform: translate3d(0px, 0px, 0px) rotateY(0deg); + -webkit-animation-timing-function: ease-in-out; + } + 50% { + -webkit-transform: translate3d(180px, 0px, -400px) rotateY(-20deg); + -webkit-animation-timing-function: ease-in; + } + 100% { + -webkit-transform: translate3d(0px, 0px, -800px) rotateY(-70deg); + } +} + +@-webkit-keyframes swapinfromright { + 0% { + -webkit-transform: translate3d(0px, 0px, -800px) rotateY(70deg); + -webkit-animation-timing-function: ease-out; + } + 50% { + -webkit-transform: translate3d(-180px, 0px, -400px) rotateY(20deg); + -webkit-animation-timing-function: ease-in-out; + } + 100% { + -webkit-transform: translate3d(0px, 0px, 0px) rotateY(0deg); + } +} + +@-webkit-keyframes swapinfromleft { + 0% { + -webkit-transform: translate3d(0px, 0px, -800px) rotateY(-70deg); + -webkit-animation-timing-function: ease-out; + } + 50% { + -webkit-transform: translate3d(180px, 0px, -400px) rotateY(-20deg); + -webkit-animation-timing-function: ease-in-out; + } + 100% { + -webkit-transform: translate3d(0px, 0px, 0px) rotateY(0deg); + } +} + +#jqt .cube { + -webkit-animation-duration: .55s; +} + +#jqt .cube.in { + -webkit-animation-name: cubeinfromright; + -webkit-transform-origin: 0% 50%; +} +#jqt .cube.out { + -webkit-animation-name: cubeouttoleft; + -webkit-transform-origin: 100% 50%; +} +#jqt .cube.in.reverse { + -webkit-animation-name: cubeinfromleft; + -webkit-transform-origin: 100% 50%; +} +#jqt .cube.out.reverse { + -webkit-animation-name: cubeouttoright; + -webkit-transform-origin: 0% 50%; + +} + +@-webkit-keyframes cubeinfromleft { + from { + -webkit-transform: rotateY(-90deg) translateZ(320px); + opacity: .5; + } + to { + -webkit-transform: rotateY(0deg) translateZ(0); + opacity: 1; + } +} +@-webkit-keyframes cubeouttoright { + from { + -webkit-transform: rotateY(0deg) translateX(0); + opacity: 1; + } + to { + -webkit-transform: rotateY(90deg) translateZ(320px); + opacity: .5; + } +} +@-webkit-keyframes cubeinfromright { + from { + -webkit-transform: rotateY(90deg) translateZ(320px); + opacity: .5; + } + to { + -webkit-transform: rotateY(0deg) translateZ(0); + opacity: 1; + } +} +@-webkit-keyframes cubeouttoleft { + from { + -webkit-transform: rotateY(0deg) translateZ(0); + opacity: 1; + } + to { + -webkit-transform: rotateY(-90deg) translateZ(320px); + opacity: .5; + } +} + + + + +#jqt .pop { + -webkit-transform-origin: 50% 50%; +} + +#jqt .pop.in { + -webkit-animation-name: popin; + z-index: 10; +} + +#jqt .pop.out.reverse { + -webkit-animation-name: popout; + z-index: 10; +} + +#jqt .pop.in.reverse { + z-index: 0; + -webkit-animation-name: dontmove; +} + +@-webkit-keyframes popin { + from { + -webkit-transform: scale(.2); + opacity: 0; + } + to { + -webkit-transform: scale(1); + opacity: 1; + } +} + +@-webkit-keyframes popout { + from { + -webkit-transform: scale(1); + opacity: 1; + } + to { + -webkit-transform: scale(.2); + opacity: 0; + } +}
\ No newline at end of file diff --git a/themes/jqtouch/.svn/text-base/jqtouch.js.svn-base b/themes/jqtouch/.svn/text-base/jqtouch.js.svn-base new file mode 100644 index 0000000..7641727 --- /dev/null +++ b/themes/jqtouch/.svn/text-base/jqtouch.js.svn-base @@ -0,0 +1,624 @@ +/* + + _/ _/_/ _/_/_/_/_/ _/ + _/ _/ _/ _/_/ _/ _/ _/_/_/ _/_/_/ + _/ _/ _/_/ _/ _/ _/ _/ _/ _/ _/ _/ + _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ + _/ _/_/ _/ _/ _/_/ _/_/_/ _/_/_/ _/ _/ + _/ + _/ + + Created by David Kaneda <http://www.davidkaneda.com> + Documentation and issue tracking on Google Code <http://code.google.com/p/jqtouch/> + + Special thanks to Jonathan Stark <http://jonathanstark.com/> + and pinch/zoom <http://www.pinchzoom.com/> + + (c) 2009 by jQTouch project members. + See LICENSE.txt for license. + + $Revision$ + $Date$ + $LastChangedBy$ + +*/ + +(function($) { + $.jQTouch = function(options) { + + // Set support values + $.support.WebKitCSSMatrix = (typeof WebKitCSSMatrix == "object"); + $.support.touch = (typeof Touch == "object"); + $.support.WebKitAnimationEvent = (typeof WebKitTransitionEvent == "object"); + + // Initialize internal variables + var $body, + $head=$('head'), + hist=[], + newPageCount=0, + jQTSettings={}, + hashCheckInterval, + currentPage, + orientation, + isMobileWebKit = RegExp(" Mobile/").test(navigator.userAgent), + tapReady=true, + lastAnimationTime=0, + touchSelectors=[], + publicObj={}, + extensions=$.jQTouch.prototype.extensions, + defaultAnimations=['slide','flip','slideup','swap','cube','pop','dissolve','fade','back'], + animations=[], + hairextensions=''; + // Get the party started + init(options); + + function init(options) { + + var defaults = { + addGlossToIcon: true, + backSelector: '.back, .cancel, .goback', + cacheGetRequests: true, + cubeSelector: '.cube', + dissolveSelector: '.dissolve', + fadeSelector: '.fade', + fixedViewport: true, + flipSelector: '.flip', + formSelector: 'form', + fullScreen: true, + fullScreenClass: 'fullscreen', + icon: null, + touchSelector: 'a, .touch', + popSelector: '.pop', + preloadImages: false, + slideSelector: '#jqt > * > ul li a', + slideupSelector: '.slideup', + startupScreen: null, + statusBar: 'default', // other options: black-translucent, black + submitSelector: '.submit', + swapSelector: '.swap', + useAnimations: true, + useFastTouch: true // Experimental. + }; + jQTSettings = $.extend({}, defaults, options); + + // Preload images + if (jQTSettings.preloadImages) { + for (var i = jQTSettings.preloadImages.length - 1; i >= 0; i--) { + (new Image()).src = jQTSettings.preloadImages[i]; + }; + } + // Set icon + if (jQTSettings.icon) { + var precomposed = (jQTSettings.addGlossToIcon) ? '' : '-precomposed'; + hairextensions += '<link rel="apple-touch-icon' + precomposed + '" href="' + jQTSettings.icon + '" />'; + } + // Set startup screen + if (jQTSettings.startupScreen) { + hairextensions += '<link rel="apple-touch-startup-image" href="' + jQTSettings.startupScreen + '" />'; + } + // Set viewport + if (jQTSettings.fixedViewport) { + hairextensions += '<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;"/>'; + } + // Set full-screen + if (jQTSettings.fullScreen) { + hairextensions += '<meta name="apple-mobile-web-app-capable" content="yes" />'; + if (jQTSettings.statusBar) { + hairextensions += '<meta name="apple-mobile-web-app-status-bar-style" content="' + jQTSettings.statusBar + '" />'; + } + } + if (hairextensions) { + $head.prepend(hairextensions); + } + + // Initialize on document load: + $(document).ready(function() { + + // Add extensions + for (var i in extensions) { + var fn = extensions[i]; + if ($.isFunction(fn)) { + $.extend(publicObj, fn(publicObj)); + } + } + + // Add animations + for (var i in defaultAnimations) { + var name = defaultAnimations[i]; + var selector = jQTSettings[name + 'Selector']; + if (typeof(selector) == 'string') { + addAnimation({name:name, selector:selector}); + } + } + + touchSelectors.push('input'); + touchSelectors.push(jQTSettings.touchSelector); + touchSelectors.push(jQTSettings.backSelector); + touchSelectors.push(jQTSettings.submitSelector); + $(touchSelectors.join(', ')).css('-webkit-touch-callout', 'none'); + $(jQTSettings.backSelector).tap(liveTap); + $(jQTSettings.submitSelector).tap(submitParentForm); + + $body = $('#jqt'); + + if (jQTSettings.fullScreenClass && window.navigator.standalone == true) { + $body.addClass(jQTSettings.fullScreenClass + ' ' + jQTSettings.statusBar); + } + + // Create custom live events + $body + .bind('touchstart', handleTouch) + .bind('orientationchange', updateOrientation) + .trigger('orientationchange') + .submit(submitForm); + + if (jQTSettings.useFastTouch && $.support.touch) { + $body.click(function(e) { + var $el = $(e.target); + + if ($el.attr('nodeName')!=='A' && $el.attr('nodeName')!=='AREA' && $el.attr('nodeName')!=='INPUT') { + $el = $el.closest('a, area'); + } + + if ($el.isExternalLink()) { + return true; + } else { + return false; + } + }); + + // This additionally gets rid of form focusses + $body.mousedown(function(e) { + var timeDiff = (new Date()).getTime() - lastAnimationTime; + if (timeDiff < 200) { + return false; + } + }); + } + + // Make sure exactly one child of body has "current" class + if ($('#jqt > .current').length == 0) { + currentPage = $('#jqt > *:first'); + } else { + currentPage = $('#jqt > .current:first'); + $('#jqt > .current').removeClass('current'); + } + + // Go to the top of the "current" page + $(currentPage).addClass('current'); + location.hash = '#' + $(currentPage).attr('id'); + addPageToHistory(currentPage); + scrollTo(0, 0); + startHashCheck(); + }); + } + + // PUBLIC FUNCTIONS + function goBack(to) { + // Init the param + var numberOfPages = Math.min(parseInt(to || 1, 10), hist.length-1), + curPage = hist[0]; + + // Search through the history for an ID + if(isNaN(numberOfPages) && typeof(to) === "string" && to != '#' ) { + for( var i=1, length=hist.length; i < length; i++ ) { + if( '#' + hist[i].id === to ) { + numberOfPages = i; + break; + } + } + } + + // If still nothing, assume one + if(isNaN(numberOfPages) || numberOfPages < 1) { + numberOfPages = 1; + }; + + if (hist.length > 1) { + // Remove all pages in front of the target page + hist.splice(0, numberOfPages); + animatePages(curPage.page, hist[0].page, curPage.animation, curPage.reverse === false); + } else { + location.hash = '#' + curPage.id; + } + + return publicObj; + } + function goTo(toPage, animation, reverse) { + var fromPage = hist[0].page; + + if (typeof(toPage) === 'string') { + toPage = $(toPage); + } + if (typeof(animation) === 'string') { + for (var i = animations.length - 1; i >= 0; i--) { + if (animations[i].name === animation) { + animation = animations[i]; + break; + } + } + } + if (animatePages(fromPage, toPage, animation, reverse)) { + addPageToHistory(toPage, animation, reverse); + return publicObj; + } else { + console.error('Could not animate pages.'); + return false; + } + } + function getOrientation() { + return orientation; + } + + // PRIVATE FUNCTIONS + function liveTap(e){ + + // Grab the clicked element + var $el = $(e.target); + + if ($el.attr('nodeName')!=='A' && $el.attr('nodeName')!=='AREA') { + $el = $el.closest('a, area'); + } + + var target = $el.attr('target'), + hash = $el.attr('hash'), + animation=null; + + if (tapReady == false || !$el.length) { + console.warn('Not able to tap element.'); + return false; + } + + if ($el.isExternalLink()) { + $el.removeClass('active'); + return true; + } + + // Figure out the animation to use + for (var i = animations.length - 1; i >= 0; i--) { + if ($el.is(animations[i].selector)) { + animation = animations[i]; + break; + } + }; + + // User clicked an internal link, fullscreen mode + if (target == '_webapp') { + window.location = $el.attr('href'); + } + // User clicked a back button + else if ($el.is(jQTSettings.backSelector)) { + goBack(hash); + } + // Allow tap on item with no href + else if ($el.attr('href') == '#') { + $el.unselect(); + return true; + } + // Branch on internal or external href + else if (hash && hash!='#') { + $el.addClass('active'); + goTo($(hash).data('referrer', $el), animation, $(this).hasClass('reverse')); + } else { + $el.addClass('loading active'); + showPageByHref($el.attr('href'), { + animation: animation, + callback: function() { + $el.removeClass('loading'); setTimeout($.fn.unselect, 250, $el); + }, + $referrer: $el + }); + } + return false; + } + function addPageToHistory(page, animation, reverse) { + // Grab some info + var pageId = page.attr('id'); + // Prepend info to page history + hist.unshift({ + page: page, + animation: animation, + reverse: reverse || false, + id: pageId + }); + } + function animatePages(fromPage, toPage, animation, backwards) { + // Error check for target page + if (toPage.length === 0) { + $.fn.unselect(); + console.error('Target element is missing.'); + return false; + } + + // Error check for fromPage=toPage + if (toPage.hasClass('current')) { + $.fn.unselect(); + console.error('Target element is the current page.'); + return false; + } + + // Collapse the keyboard + $(':focus').blur(); + + // Make sure we are scrolled up to hide location bar + scrollTo(0, 0); + + // Define callback to run after animation completes + var callback = function animationEnd(event) { + if (animation) { + toPage.removeClass('in ' + animation.name); + fromPage.removeClass('current out ' + animation.name); + if (backwards) { + toPage.toggleClass('reverse'); + fromPage.toggleClass('reverse'); + } + } else { + fromPage.removeClass('current'); + } + + toPage.trigger('pageAnimationEnd', { direction: 'in' }); + fromPage.trigger('pageAnimationEnd', { direction: 'out' }); + + clearInterval(hashCheckInterval); + currentPage = toPage; + location.hash = '#' + currentPage.attr('id'); + startHashCheck(); + + var $originallink = toPage.data('referrer'); + if ($originallink) { + $originallink.unselect(); + } + lastAnimationTime = (new Date()).getTime(); + tapReady = true; + } + + fromPage.trigger('pageAnimationStart', { direction: 'out' }); + toPage.trigger('pageAnimationStart', { direction: 'in' }); + + if ($.support.WebKitAnimationEvent && animation && jQTSettings.useAnimations) { + toPage.one('webkitAnimationEnd', callback); + tapReady = false; + if (backwards) { + toPage.toggleClass('reverse'); + fromPage.toggleClass('reverse'); + } + toPage.addClass(animation.name + ' in current '); + fromPage.addClass(animation.name + ' out'); + + } else { + toPage.addClass('current'); + callback(); + } + + return true; + } + function hashCheck() { + var curid = currentPage.attr('id'); + if (location.hash == '') { + location.hash = '#' + curid; + } else if (location.hash != '#' + curid) { + clearInterval(hashCheckInterval); + goBack(location.hash); + } + } + function startHashCheck() { + hashCheckInterval = setInterval(hashCheck, 100); + } + function insertPages(nodes, animation) { + var targetPage = null; + $(nodes).each(function(index, node) { + var $node = $(this); + if (!$node.attr('id')) { + $node.attr('id', 'page-' + (++newPageCount)); + } + + $body.trigger('pageInserted', {page: $node.appendTo($body)}); + + if ($node.hasClass('current') || !targetPage) { + targetPage = $node; + } + }); + if (targetPage !== null) { + goTo(targetPage, animation); + return targetPage; + } else { + return false; + } + } + function showPageByHref(href, options) { + var defaults = { + data: null, + method: 'GET', + animation: null, + callback: null, + $referrer: null + }; + + var settings = $.extend({}, defaults, options); + + if (href != '#') { + $.ajax({ + url: href, + data: settings.data, + type: settings.method, + success: function (data, textStatus) { + var firstPage = insertPages(data, settings.animation); + if (firstPage) { + if (settings.method == 'GET' && jQTSettings.cacheGetRequests === true && settings.$referrer) { + settings.$referrer.attr('href', '#' + firstPage.attr('id')); + } + if (settings.callback) { + settings.callback(true); + } + } + }, + error: function (data) { + if (settings.$referrer) { + settings.$referrer.unselect(); + } + if (settings.callback) { + settings.callback(false); + } + } + }); + } + else if (settings.$referrer) { + settings.$referrer.unselect(); + } + } + function submitForm(e, callback) { + var $form = (typeof(e)==='string') ? $(e).eq(0) : (e.target ? $(e.target) : $(e)); + + if ($form.length && $form.is(jQTSettings.formSelector)) { + showPageByHref($form.attr('action'), { + data: $form.serialize(), + method: $form.attr('method') || "POST", + animation: animations[0] || null, + callback: callback + }); + return false; + } + return true; + } + function submitParentForm(e) { + var $form = $(this).closest('form'); + if ($form.length) { + evt = jQuery.Event("submit"); + evt.preventDefault(); + $form.trigger(evt); + return false; + } + return true; + } + function addAnimation(animation) { + if (typeof(animation.selector) == 'string' && typeof(animation.name) == 'string') { + animations.push(animation); + $(animation.selector).tap(liveTap); + touchSelectors.push(animation.selector); + } + } + function updateOrientation() { + orientation = window.innerWidth < window.innerHeight ? 'profile' : 'landscape'; + $body.removeClass('profile landscape').addClass(orientation).trigger('turn', {orientation: orientation}); + // scrollTo(0, 0); + } + function handleTouch(e) { + var $el = $(e.target); + + // Only handle touchSelectors + if (!$(e.target).is(touchSelectors.join(', '))) { + var $link = $(e.target).closest('a, area'); + + if ($link.length && $link.is(touchSelectors.join(', '))) { + $el = $link; + } else { + return; + } + } + + if (e) { + var hoverTimeout = null, + startX = event.changedTouches[0].clientX, + startY = event.changedTouches[0].clientY, + startTime = (new Date).getTime(), + deltaX = 0, + deltaY = 0, + deltaT = 0; + + // Let's bind these after the fact, so we can keep some internal values + $el.bind('touchmove', touchmove).bind('touchend', touchend); + + hoverTimeout = setTimeout(function() { + $el.makeActive(); + }, 100); + + } + + // Private touch functions (TODO: insert dirty joke) + function touchmove(e) { + + updateChanges(); + var absX = Math.abs(deltaX); + var absY = Math.abs(deltaY); + + // Check for swipe + if (absX > absY && (absX > 35) && deltaT < 1000) { + $el.trigger('swipe', {direction: (deltaX < 0) ? 'left' : 'right', deltaX: deltaX, deltaY: deltaY }).unbind('touchmove touchend'); + } else if (absY > 1) { + $el.removeClass('active'); + } + + clearTimeout(hoverTimeout); + } + + function touchend() { + updateChanges(); + + if (deltaY === 0 && deltaX === 0) { + $el.makeActive(); + $el.trigger('tap'); + } else { + $el.removeClass('active'); + } + $el.unbind('touchmove touchend'); + clearTimeout(hoverTimeout); + } + + function updateChanges() { + var first = event.changedTouches[0] || null; + deltaX = first.pageX - startX; + deltaY = first.pageY - startY; + deltaT = (new Date).getTime() - startTime; + } + + } // End touch handler + + // Public jQuery Fns + $.fn.unselect = function(obj) { + if (obj) { + obj.removeClass('active'); + } else { + $('.active').removeClass('active'); + } + } + $.fn.makeActive = function() { + return $(this).addClass('active'); + } + $.fn.swipe = function(fn) { + if ($.isFunction(fn)) { + return $(this).bind('swipe', fn); + } else { + return $(this).trigger('swipe'); + } + } + $.fn.tap = function(fn) { + if ($.isFunction(fn)) { + var tapEvent = (jQTSettings.useFastTouch && $.support.touch) ? 'tap' : 'click'; + return $(this).live(tapEvent, fn); + } else { + return $(this).trigger('tap'); + } + } + $.fn.isExternalLink = function() { + var $el = $(this); + return ($el.attr('target') == '_blank' || $el.attr('rel') == 'external' || $el.is('input[type="checkbox"], input[type="radio"], a[href^="http://maps.google.com:"], a[href^="mailto:"], a[href^="tel:"], a[href^="javascript:"], a[href*="youtube.com/v"], a[href*="youtube.com/watch"]')); + } + + publicObj = { + getOrientation: getOrientation, + goBack: goBack, + goTo: goTo, + addAnimation: addAnimation, + submitForm: submitForm + } + + return publicObj; + } + + // Extensions directly manipulate the jQTouch object, before it's initialized. + $.jQTouch.prototype.extensions = []; + $.jQTouch.addExtension = function(extension) { + $.jQTouch.prototype.extensions.push(extension); + } + +})(jQuery);
\ No newline at end of file diff --git a/themes/jqtouch/.svn/text-base/jqtouch.transitions.js.svn-base b/themes/jqtouch/.svn/text-base/jqtouch.transitions.js.svn-base new file mode 100644 index 0000000..9d8970f --- /dev/null +++ b/themes/jqtouch/.svn/text-base/jqtouch.transitions.js.svn-base @@ -0,0 +1,60 @@ +/* + + _/ _/_/ _/_/_/_/_/ _/ + _/ _/ _/ _/_/ _/ _/ _/_/_/ _/_/_/ + _/ _/ _/_/ _/ _/ _/ _/ _/ _/ _/ _/ + _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ + _/ _/_/ _/ _/ _/_/ _/_/_/ _/_/_/ _/ _/ + _/ + _/ + + Created by David Kaneda <http://www.davidkaneda.com> + Documentation and issue tracking on Google Code <http://code.google.com/p/jqtouch/> + + Special thanks to Jonathan Stark <http://jonathanstark.com/> + and pinch/zoom <http://www.pinchzoom.com/> + + (c) 2009 by jQTouch project members. + See LICENSE.txt for license. + +*/ + +(function($) { + + $.fn.transition = function(css, options) { + return this.each(function(){ + var $el = $(this); + var defaults = { + speed : '300ms', + callback: null, + ease: 'ease-in-out' + }; + var settings = $.extend({}, defaults, options); + if(settings.speed === 0) { + $el.css(css); + window.setTimeout(settings.callback, 0); + } else { + if ($.browser.safari) + { + var s = []; + for(var i in css) { + s.push(i); + } + $el.css({ + webkitTransitionProperty: s.join(", "), + webkitTransitionDuration: settings.speed, + webkitTransitionTimingFunction: settings.ease + }); + if (settings.callback) { + $el.one('webkitTransitionEnd', settings.callback); + } + setTimeout(function(el){ el.css(css) }, 0, $el); + } + else + { + $el.animate(css, settings.speed, settings.callback); + } + } + }); + } +})(jQuery);
\ No newline at end of file diff --git a/themes/jqtouch/.svn/text-base/jquery.1.3.2.min.js.svn-base b/themes/jqtouch/.svn/text-base/jquery.1.3.2.min.js.svn-base new file mode 100644 index 0000000..b1ae21d --- /dev/null +++ b/themes/jqtouch/.svn/text-base/jquery.1.3.2.min.js.svn-base @@ -0,0 +1,19 @@ +/* + * jQuery JavaScript Library v1.3.2 + * http://jquery.com/ + * + * Copyright (c) 2009 John Resig + * Dual licensed under the MIT and GPL licenses. + * http://docs.jquery.com/License + * + * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009) + * Revision: 6246 + */ +(function(){var l=this,g,y=l.jQuery,p=l.$,o=l.jQuery=l.$=function(E,F){return new o.fn.init(E,F)},D=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;o.fn=o.prototype={init:function(E,H){E=E||document;if(E.nodeType){this[0]=E;this.length=1;this.context=E;return this}if(typeof E==="string"){var G=D.exec(E);if(G&&(G[1]||!H)){if(G[1]){E=o.clean([G[1]],H)}else{var I=document.getElementById(G[3]);if(I&&I.id!=G[3]){return o().find(E)}var F=o(I||[]);F.context=document;F.selector=E;return F}}else{return o(H).find(E)}}else{if(o.isFunction(E)){return o(document).ready(E)}}if(E.selector&&E.context){this.selector=E.selector;this.context=E.context}return this.setArray(o.isArray(E)?E:o.makeArray(E))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(E){return E===g?Array.prototype.slice.call(this):this[E]},pushStack:function(F,H,E){var G=o(F);G.prevObject=this;G.context=this.context;if(H==="find"){G.selector=this.selector+(this.selector?" ":"")+E}else{if(H){G.selector=this.selector+"."+H+"("+E+")"}}return G},setArray:function(E){this.length=0;Array.prototype.push.apply(this,E);return this},each:function(F,E){return o.each(this,F,E)},index:function(E){return o.inArray(E&&E.jquery?E[0]:E,this)},attr:function(F,H,G){var E=F;if(typeof F==="string"){if(H===g){return this[0]&&o[G||"attr"](this[0],F)}else{E={};E[F]=H}}return this.each(function(I){for(F in E){o.attr(G?this.style:this,F,o.prop(this,E[F],G,I,F))}})},css:function(E,F){if((E=="width"||E=="height")&&parseFloat(F)<0){F=g}return this.attr(E,F,"curCSS")},text:function(F){if(typeof F!=="object"&&F!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(F))}var E="";o.each(F||this,function(){o.each(this.childNodes,function(){if(this.nodeType!=8){E+=this.nodeType!=1?this.nodeValue:o.fn.text([this])}})});return E},wrapAll:function(E){if(this[0]){var F=o(E,this[0].ownerDocument).clone();if(this[0].parentNode){F.insertBefore(this[0])}F.map(function(){var G=this;while(G.firstChild){G=G.firstChild}return G}).append(this)}return this},wrapInner:function(E){return this.each(function(){o(this).contents().wrapAll(E)})},wrap:function(E){return this.each(function(){o(this).wrapAll(E)})},append:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.appendChild(E)}})},prepend:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.insertBefore(E,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this)})},after:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this.nextSibling)})},end:function(){return this.prevObject||o([])},push:[].push,sort:[].sort,splice:[].splice,find:function(E){if(this.length===1){var F=this.pushStack([],"find",E);F.length=0;o.find(E,this[0],F);return F}else{return this.pushStack(o.unique(o.map(this,function(G){return o.find(E,G)})),"find",E)}},clone:function(G){var E=this.map(function(){if(!o.support.noCloneEvent&&!o.isXMLDoc(this)){var I=this.outerHTML;if(!I){var J=this.ownerDocument.createElement("div");J.appendChild(this.cloneNode(true));I=J.innerHTML}return o.clean([I.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else{return this.cloneNode(true)}});if(G===true){var H=this.find("*").andSelf(),F=0;E.find("*").andSelf().each(function(){if(this.nodeName!==H[F].nodeName){return}var I=o.data(H[F],"events");for(var K in I){for(var J in I[K]){o.event.add(this,K,I[K][J],I[K][J].data)}}F++})}return E},filter:function(E){return this.pushStack(o.isFunction(E)&&o.grep(this,function(G,F){return E.call(G,F)})||o.multiFilter(E,o.grep(this,function(F){return F.nodeType===1})),"filter",E)},closest:function(E){var G=o.expr.match.POS.test(E)?o(E):null,F=0;return this.map(function(){var H=this;while(H&&H.ownerDocument){if(G?G.index(H)>-1:o(H).is(E)){o.data(H,"closest",F);return H}H=H.parentNode;F++}})},not:function(E){if(typeof E==="string"){if(f.test(E)){return this.pushStack(o.multiFilter(E,this,true),"not",E)}else{E=o.multiFilter(E,this)}}var F=E.length&&E[E.length-1]!==g&&!E.nodeType;return this.filter(function(){return F?o.inArray(this,E)<0:this!=E})},add:function(E){return this.pushStack(o.unique(o.merge(this.get(),typeof E==="string"?o(E):o.makeArray(E))))},is:function(E){return !!E&&o.multiFilter(E,this).length>0},hasClass:function(E){return !!E&&this.is("."+E)},val:function(K){if(K===g){var E=this[0];if(E){if(o.nodeName(E,"option")){return(E.attributes.value||{}).specified?E.value:E.text}if(o.nodeName(E,"select")){var I=E.selectedIndex,L=[],M=E.options,H=E.type=="select-one";if(I<0){return null}for(var F=H?I:0,J=H?I+1:M.length;F<J;F++){var G=M[F];if(G.selected){K=o(G).val();if(H){return K}L.push(K)}}return L}return(E.value||"").replace(/\r/g,"")}return g}if(typeof K==="number"){K+=""}return this.each(function(){if(this.nodeType!=1){return}if(o.isArray(K)&&/radio|checkbox/.test(this.type)){this.checked=(o.inArray(this.value,K)>=0||o.inArray(this.name,K)>=0)}else{if(o.nodeName(this,"select")){var N=o.makeArray(K);o("option",this).each(function(){this.selected=(o.inArray(this.value,N)>=0||o.inArray(this.text,N)>=0)});if(!N.length){this.selectedIndex=-1}}else{this.value=K}}})},html:function(E){return E===g?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(E)},replaceWith:function(E){return this.after(E).remove()},eq:function(E){return this.slice(E,+E+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(E){return this.pushStack(o.map(this,function(G,F){return E.call(G,F,G)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(J,M,L){if(this[0]){var I=(this[0].ownerDocument||this[0]).createDocumentFragment(),F=o.clean(J,(this[0].ownerDocument||this[0]),I),H=I.firstChild;if(H){for(var G=0,E=this.length;G<E;G++){L.call(K(this[G],H),this.length>1||G>0?I.cloneNode(true):I)}}if(F){o.each(F,z)}}return this;function K(N,O){return M&&o.nodeName(N,"table")&&o.nodeName(O,"tr")?(N.getElementsByTagName("tbody")[0]||N.appendChild(N.ownerDocument.createElement("tbody"))):N}}};o.fn.init.prototype=o.fn;function z(E,F){if(F.src){o.ajax({url:F.src,async:false,dataType:"script"})}else{o.globalEval(F.text||F.textContent||F.innerHTML||"")}if(F.parentNode){F.parentNode.removeChild(F)}}function e(){return +new Date}o.extend=o.fn.extend=function(){var J=arguments[0]||{},H=1,I=arguments.length,E=false,G;if(typeof J==="boolean"){E=J;J=arguments[1]||{};H=2}if(typeof J!=="object"&&!o.isFunction(J)){J={}}if(I==H){J=this;--H}for(;H<I;H++){if((G=arguments[H])!=null){for(var F in G){var K=J[F],L=G[F];if(J===L){continue}if(E&&L&&typeof L==="object"&&!L.nodeType){J[F]=o.extend(E,K||(L.length!=null?[]:{}),L)}else{if(L!==g){J[F]=L}}}}}return J};var b=/z-?index|font-?weight|opacity|zoom|line-?height/i,q=document.defaultView||{},s=Object.prototype.toString;o.extend({noConflict:function(E){l.$=p;if(E){l.jQuery=y}return o},isFunction:function(E){return s.call(E)==="[object Function]"},isArray:function(E){return s.call(E)==="[object Array]"},isXMLDoc:function(E){return E.nodeType===9&&E.documentElement.nodeName!=="HTML"||!!E.ownerDocument&&o.isXMLDoc(E.ownerDocument)},globalEval:function(G){if(G&&/\S/.test(G)){var F=document.getElementsByTagName("head")[0]||document.documentElement,E=document.createElement("script");E.type="text/javascript";if(o.support.scriptEval){E.appendChild(document.createTextNode(G))}else{E.text=G}F.insertBefore(E,F.firstChild);F.removeChild(E)}},nodeName:function(F,E){return F.nodeName&&F.nodeName.toUpperCase()==E.toUpperCase()},each:function(G,K,F){var E,H=0,I=G.length;if(F){if(I===g){for(E in G){if(K.apply(G[E],F)===false){break}}}else{for(;H<I;){if(K.apply(G[H++],F)===false){break}}}}else{if(I===g){for(E in G){if(K.call(G[E],E,G[E])===false){break}}}else{for(var J=G[0];H<I&&K.call(J,H,J)!==false;J=G[++H]){}}}return G},prop:function(H,I,G,F,E){if(o.isFunction(I)){I=I.call(H,F)}return typeof I==="number"&&G=="curCSS"&&!b.test(E)?I+"px":I},className:{add:function(E,F){o.each((F||"").split(/\s+/),function(G,H){if(E.nodeType==1&&!o.className.has(E.className,H)){E.className+=(E.className?" ":"")+H}})},remove:function(E,F){if(E.nodeType==1){E.className=F!==g?o.grep(E.className.split(/\s+/),function(G){return !o.className.has(F,G)}).join(" "):""}},has:function(F,E){return F&&o.inArray(E,(F.className||F).toString().split(/\s+/))>-1}},swap:function(H,G,I){var E={};for(var F in G){E[F]=H.style[F];H.style[F]=G[F]}I.call(H);for(var F in G){H.style[F]=E[F]}},css:function(H,F,J,E){if(F=="width"||F=="height"){var L,G={position:"absolute",visibility:"hidden",display:"block"},K=F=="width"?["Left","Right"]:["Top","Bottom"];function I(){L=F=="width"?H.offsetWidth:H.offsetHeight;if(E==="border"){return}o.each(K,function(){if(!E){L-=parseFloat(o.curCSS(H,"padding"+this,true))||0}if(E==="margin"){L+=parseFloat(o.curCSS(H,"margin"+this,true))||0}else{L-=parseFloat(o.curCSS(H,"border"+this+"Width",true))||0}})}if(H.offsetWidth!==0){I()}else{o.swap(H,G,I)}return Math.max(0,Math.round(L))}return o.curCSS(H,F,J)},curCSS:function(I,F,G){var L,E=I.style;if(F=="opacity"&&!o.support.opacity){L=o.attr(E,"opacity");return L==""?"1":L}if(F.match(/float/i)){F=w}if(!G&&E&&E[F]){L=E[F]}else{if(q.getComputedStyle){if(F.match(/float/i)){F="float"}F=F.replace(/([A-Z])/g,"-$1").toLowerCase();var M=q.getComputedStyle(I,null);if(M){L=M.getPropertyValue(F)}if(F=="opacity"&&L==""){L="1"}}else{if(I.currentStyle){var J=F.replace(/\-(\w)/g,function(N,O){return O.toUpperCase()});L=I.currentStyle[F]||I.currentStyle[J];if(!/^\d+(px)?$/i.test(L)&&/^\d/.test(L)){var H=E.left,K=I.runtimeStyle.left;I.runtimeStyle.left=I.currentStyle.left;E.left=L||0;L=E.pixelLeft+"px";E.left=H;I.runtimeStyle.left=K}}}}return L},clean:function(F,K,I){K=K||document;if(typeof K.createElement==="undefined"){K=K.ownerDocument||K[0]&&K[0].ownerDocument||document}if(!I&&F.length===1&&typeof F[0]==="string"){var H=/^<(\w+)\s*\/?>$/.exec(F[0]);if(H){return[K.createElement(H[1])]}}var G=[],E=[],L=K.createElement("div");o.each(F,function(P,S){if(typeof S==="number"){S+=""}if(!S){return}if(typeof S==="string"){S=S.replace(/(<(\w+)[^>]*?)\/>/g,function(U,V,T){return T.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?U:V+"></"+T+">"});var O=S.replace(/^\s+/,"").substring(0,10).toLowerCase();var Q=!O.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!O.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||O.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!O.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!O.indexOf("<td")||!O.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!O.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||!o.support.htmlSerialize&&[1,"div<div>","</div>"]||[0,"",""];L.innerHTML=Q[1]+S+Q[2];while(Q[0]--){L=L.lastChild}if(!o.support.tbody){var R=/<tbody/i.test(S),N=!O.indexOf("<table")&&!R?L.firstChild&&L.firstChild.childNodes:Q[1]=="<table>"&&!R?L.childNodes:[];for(var M=N.length-1;M>=0;--M){if(o.nodeName(N[M],"tbody")&&!N[M].childNodes.length){N[M].parentNode.removeChild(N[M])}}}if(!o.support.leadingWhitespace&&/^\s/.test(S)){L.insertBefore(K.createTextNode(S.match(/^\s*/)[0]),L.firstChild)}S=o.makeArray(L.childNodes)}if(S.nodeType){G.push(S)}else{G=o.merge(G,S)}});if(I){for(var J=0;G[J];J++){if(o.nodeName(G[J],"script")&&(!G[J].type||G[J].type.toLowerCase()==="text/javascript")){E.push(G[J].parentNode?G[J].parentNode.removeChild(G[J]):G[J])}else{if(G[J].nodeType===1){G.splice.apply(G,[J+1,0].concat(o.makeArray(G[J].getElementsByTagName("script"))))}I.appendChild(G[J])}}return E}return G},attr:function(J,G,K){if(!J||J.nodeType==3||J.nodeType==8){return g}var H=!o.isXMLDoc(J),L=K!==g;G=H&&o.props[G]||G;if(J.tagName){var F=/href|src|style/.test(G);if(G=="selected"&&J.parentNode){J.parentNode.selectedIndex}if(G in J&&H&&!F){if(L){if(G=="type"&&o.nodeName(J,"input")&&J.parentNode){throw"type property can't be changed"}J[G]=K}if(o.nodeName(J,"form")&&J.getAttributeNode(G)){return J.getAttributeNode(G).nodeValue}if(G=="tabIndex"){var I=J.getAttributeNode("tabIndex");return I&&I.specified?I.value:J.nodeName.match(/(button|input|object|select|textarea)/i)?0:J.nodeName.match(/^(a|area)$/i)&&J.href?0:g}return J[G]}if(!o.support.style&&H&&G=="style"){return o.attr(J.style,"cssText",K)}if(L){J.setAttribute(G,""+K)}var E=!o.support.hrefNormalized&&H&&F?J.getAttribute(G,2):J.getAttribute(G);return E===null?g:E}if(!o.support.opacity&&G=="opacity"){if(L){J.zoom=1;J.filter=(J.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(K)+""=="NaN"?"":"alpha(opacity="+K*100+")")}return J.filter&&J.filter.indexOf("opacity=")>=0?(parseFloat(J.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}G=G.replace(/-([a-z])/ig,function(M,N){return N.toUpperCase()});if(L){J[G]=K}return J[G]},trim:function(E){return(E||"").replace(/^\s+|\s+$/g,"")},makeArray:function(G){var E=[];if(G!=null){var F=G.length;if(F==null||typeof G==="string"||o.isFunction(G)||G.setInterval){E[0]=G}else{while(F){E[--F]=G[F]}}}return E},inArray:function(G,H){for(var E=0,F=H.length;E<F;E++){if(H[E]===G){return E}}return -1},merge:function(H,E){var F=0,G,I=H.length;if(!o.support.getAll){while((G=E[F++])!=null){if(G.nodeType!=8){H[I++]=G}}}else{while((G=E[F++])!=null){H[I++]=G}}return H},unique:function(K){var F=[],E={};try{for(var G=0,H=K.length;G<H;G++){var J=o.data(K[G]);if(!E[J]){E[J]=true;F.push(K[G])}}}catch(I){F=K}return F},grep:function(F,J,E){var G=[];for(var H=0,I=F.length;H<I;H++){if(!E!=!J(F[H],H)){G.push(F[H])}}return G},map:function(E,J){var F=[];for(var G=0,H=E.length;G<H;G++){var I=J(E[G],G);if(I!=null){F[F.length]=I}}return F.concat.apply([],F)}});var C=navigator.userAgent.toLowerCase();o.browser={version:(C.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1],safari:/webkit/.test(C),opera:/opera/.test(C),msie:/msie/.test(C)&&!/opera/.test(C),mozilla:/mozilla/.test(C)&&!/(compatible|webkit)/.test(C)};o.each({parent:function(E){return E.parentNode},parents:function(E){return o.dir(E,"parentNode")},next:function(E){return o.nth(E,2,"nextSibling")},prev:function(E){return o.nth(E,2,"previousSibling")},nextAll:function(E){return o.dir(E,"nextSibling")},prevAll:function(E){return o.dir(E,"previousSibling")},siblings:function(E){return o.sibling(E.parentNode.firstChild,E)},children:function(E){return o.sibling(E.firstChild)},contents:function(E){return o.nodeName(E,"iframe")?E.contentDocument||E.contentWindow.document:o.makeArray(E.childNodes)}},function(E,F){o.fn[E]=function(G){var H=o.map(this,F);if(G&&typeof G=="string"){H=o.multiFilter(G,H)}return this.pushStack(o.unique(H),E,G)}});o.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(E,F){o.fn[E]=function(G){var J=[],L=o(G);for(var K=0,H=L.length;K<H;K++){var I=(K>0?this.clone(true):this).get();o.fn[F].apply(o(L[K]),I);J=J.concat(I)}return this.pushStack(J,E,G)}});o.each({removeAttr:function(E){o.attr(this,E,"");if(this.nodeType==1){this.removeAttribute(E)}},addClass:function(E){o.className.add(this,E)},removeClass:function(E){o.className.remove(this,E)},toggleClass:function(F,E){if(typeof E!=="boolean"){E=!o.className.has(this,F)}o.className[E?"add":"remove"](this,F)},remove:function(E){if(!E||o.filter(E,[this]).length){o("*",this).add([this]).each(function(){o.event.remove(this);o.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){o(this).children().remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(E,F){o.fn[E]=function(){return this.each(F,arguments)}});function j(E,F){return E[0]&&parseInt(o.curCSS(E[0],F,true),10)||0}var h="jQuery"+e(),v=0,A={};o.extend({cache:{},data:function(F,E,G){F=F==l?A:F;var H=F[h];if(!H){H=F[h]=++v}if(E&&!o.cache[H]){o.cache[H]={}}if(G!==g){o.cache[H][E]=G}return E?o.cache[H][E]:H},removeData:function(F,E){F=F==l?A:F;var H=F[h];if(E){if(o.cache[H]){delete o.cache[H][E];E="";for(E in o.cache[H]){break}if(!E){o.removeData(F)}}}else{try{delete F[h]}catch(G){if(F.removeAttribute){F.removeAttribute(h)}}delete o.cache[H]}},queue:function(F,E,H){if(F){E=(E||"fx")+"queue";var G=o.data(F,E);if(!G||o.isArray(H)){G=o.data(F,E,o.makeArray(H))}else{if(H){G.push(H)}}}return G},dequeue:function(H,G){var E=o.queue(H,G),F=E.shift();if(!G||G==="fx"){F=E[0]}if(F!==g){F.call(H)}}});o.fn.extend({data:function(E,G){var H=E.split(".");H[1]=H[1]?"."+H[1]:"";if(G===g){var F=this.triggerHandler("getData"+H[1]+"!",[H[0]]);if(F===g&&this.length){F=o.data(this[0],E)}return F===g&&H[1]?this.data(H[0]):F}else{return this.trigger("setData"+H[1]+"!",[H[0],G]).each(function(){o.data(this,E,G)})}},removeData:function(E){return this.each(function(){o.removeData(this,E)})},queue:function(E,F){if(typeof E!=="string"){F=E;E="fx"}if(F===g){return o.queue(this[0],E)}return this.each(function(){var G=o.queue(this,E,F);if(E=="fx"&&G.length==1){G[0].call(this)}})},dequeue:function(E){return this.each(function(){o.dequeue(this,E)})}}); +/* + * Sizzle CSS Selector Engine - v0.9.3 + * Copyright 2009, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * More information: http://sizzlejs.com/ + */ +(function(){var R=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,L=0,H=Object.prototype.toString;var F=function(Y,U,ab,ac){ab=ab||[];U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!Y||typeof Y!=="string"){return ab}var Z=[],W,af,ai,T,ad,V,X=true;R.lastIndex=0;while((W=R.exec(Y))!==null){Z.push(W[1]);if(W[2]){V=RegExp.rightContext;break}}if(Z.length>1&&M.exec(Y)){if(Z.length===2&&I.relative[Z[0]]){af=J(Z[0]+Z[1],U)}else{af=I.relative[Z[0]]?[U]:F(Z.shift(),U);while(Z.length){Y=Z.shift();if(I.relative[Y]){Y+=Z.shift()}af=J(Y,af)}}}else{var ae=ac?{expr:Z.pop(),set:E(ac)}:F.find(Z.pop(),Z.length===1&&U.parentNode?U.parentNode:U,Q(U));af=F.filter(ae.expr,ae.set);if(Z.length>0){ai=E(af)}else{X=false}while(Z.length){var ah=Z.pop(),ag=ah;if(!I.relative[ah]){ah=""}else{ag=Z.pop()}if(ag==null){ag=U}I.relative[ah](ai,ag,Q(U))}}if(!ai){ai=af}if(!ai){throw"Syntax error, unrecognized expression: "+(ah||Y)}if(H.call(ai)==="[object Array]"){if(!X){ab.push.apply(ab,ai)}else{if(U.nodeType===1){for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&(ai[aa]===true||ai[aa].nodeType===1&&K(U,ai[aa]))){ab.push(af[aa])}}}else{for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&ai[aa].nodeType===1){ab.push(af[aa])}}}}}else{E(ai,ab)}if(V){F(V,U,ab,ac);if(G){hasDuplicate=false;ab.sort(G);if(hasDuplicate){for(var aa=1;aa<ab.length;aa++){if(ab[aa]===ab[aa-1]){ab.splice(aa--,1)}}}}}return ab};F.matches=function(T,U){return F(T,null,null,U)};F.find=function(aa,T,ab){var Z,X;if(!aa){return[]}for(var W=0,V=I.order.length;W<V;W++){var Y=I.order[W],X;if((X=I.match[Y].exec(aa))){var U=RegExp.leftContext;if(U.substr(U.length-1)!=="\\"){X[1]=(X[1]||"").replace(/\\/g,"");Z=I.find[Y](X,T,ab);if(Z!=null){aa=aa.replace(I.match[Y],"");break}}}}if(!Z){Z=T.getElementsByTagName("*")}return{set:Z,expr:aa}};F.filter=function(ad,ac,ag,W){var V=ad,ai=[],aa=ac,Y,T,Z=ac&&ac[0]&&Q(ac[0]);while(ad&&ac.length){for(var ab in I.filter){if((Y=I.match[ab].exec(ad))!=null){var U=I.filter[ab],ah,af;T=false;if(aa==ai){ai=[]}if(I.preFilter[ab]){Y=I.preFilter[ab](Y,aa,ag,ai,W,Z);if(!Y){T=ah=true}else{if(Y===true){continue}}}if(Y){for(var X=0;(af=aa[X])!=null;X++){if(af){ah=U(af,Y,X,aa);var ae=W^!!ah;if(ag&&ah!=null){if(ae){T=true}else{aa[X]=false}}else{if(ae){ai.push(af);T=true}}}}}if(ah!==g){if(!ag){aa=ai}ad=ad.replace(I.match[ab],"");if(!T){return[]}break}}}if(ad==V){if(T==null){throw"Syntax error, unrecognized expression: "+ad}else{break}}V=ad}return aa};var I=F.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(T){return T.getAttribute("href")}},relative:{"+":function(aa,T,Z){var X=typeof T==="string",ab=X&&!/\W/.test(T),Y=X&&!ab;if(ab&&!Z){T=T.toUpperCase()}for(var W=0,V=aa.length,U;W<V;W++){if((U=aa[W])){while((U=U.previousSibling)&&U.nodeType!==1){}aa[W]=Y||U&&U.nodeName===T?U||false:U===T}}if(Y){F.filter(T,aa,true)}},">":function(Z,U,aa){var X=typeof U==="string";if(X&&!/\W/.test(U)){U=aa?U:U.toUpperCase();for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){var W=Y.parentNode;Z[V]=W.nodeName===U?W:false}}}else{for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){Z[V]=X?Y.parentNode:Y.parentNode===U}}if(X){F.filter(U,Z,true)}}},"":function(W,U,Y){var V=L++,T=S;if(!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("parentNode",U,V,W,X,Y)},"~":function(W,U,Y){var V=L++,T=S;if(typeof U==="string"&&!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("previousSibling",U,V,W,X,Y)}},find:{ID:function(U,V,W){if(typeof V.getElementById!=="undefined"&&!W){var T=V.getElementById(U[1]);return T?[T]:[]}},NAME:function(V,Y,Z){if(typeof Y.getElementsByName!=="undefined"){var U=[],X=Y.getElementsByName(V[1]);for(var W=0,T=X.length;W<T;W++){if(X[W].getAttribute("name")===V[1]){U.push(X[W])}}return U.length===0?null:U}},TAG:function(T,U){return U.getElementsByTagName(T[1])}},preFilter:{CLASS:function(W,U,V,T,Z,aa){W=" "+W[1].replace(/\\/g,"")+" ";if(aa){return W}for(var X=0,Y;(Y=U[X])!=null;X++){if(Y){if(Z^(Y.className&&(" "+Y.className+" ").indexOf(W)>=0)){if(!V){T.push(Y)}}else{if(V){U[X]=false}}}}return false},ID:function(T){return T[1].replace(/\\/g,"")},TAG:function(U,T){for(var V=0;T[V]===false;V++){}return T[V]&&Q(T[V])?U[1]:U[1].toUpperCase()},CHILD:function(T){if(T[1]=="nth"){var U=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(T[2]=="even"&&"2n"||T[2]=="odd"&&"2n+1"||!/\D/.test(T[2])&&"0n+"+T[2]||T[2]);T[2]=(U[1]+(U[2]||1))-0;T[3]=U[3]-0}T[0]=L++;return T},ATTR:function(X,U,V,T,Y,Z){var W=X[1].replace(/\\/g,"");if(!Z&&I.attrMap[W]){X[1]=I.attrMap[W]}if(X[2]==="~="){X[4]=" "+X[4]+" "}return X},PSEUDO:function(X,U,V,T,Y){if(X[1]==="not"){if(X[3].match(R).length>1||/^\w/.test(X[3])){X[3]=F(X[3],null,null,U)}else{var W=F.filter(X[3],U,V,true^Y);if(!V){T.push.apply(T,W)}return false}}else{if(I.match.POS.test(X[0])||I.match.CHILD.test(X[0])){return true}}return X},POS:function(T){T.unshift(true);return T}},filters:{enabled:function(T){return T.disabled===false&&T.type!=="hidden"},disabled:function(T){return T.disabled===true},checked:function(T){return T.checked===true},selected:function(T){T.parentNode.selectedIndex;return T.selected===true},parent:function(T){return !!T.firstChild},empty:function(T){return !T.firstChild},has:function(V,U,T){return !!F(T[3],V).length},header:function(T){return/h\d/i.test(T.nodeName)},text:function(T){return"text"===T.type},radio:function(T){return"radio"===T.type},checkbox:function(T){return"checkbox"===T.type},file:function(T){return"file"===T.type},password:function(T){return"password"===T.type},submit:function(T){return"submit"===T.type},image:function(T){return"image"===T.type},reset:function(T){return"reset"===T.type},button:function(T){return"button"===T.type||T.nodeName.toUpperCase()==="BUTTON"},input:function(T){return/input|select|textarea|button/i.test(T.nodeName)}},setFilters:{first:function(U,T){return T===0},last:function(V,U,T,W){return U===W.length-1},even:function(U,T){return T%2===0},odd:function(U,T){return T%2===1},lt:function(V,U,T){return U<T[3]-0},gt:function(V,U,T){return U>T[3]-0},nth:function(V,U,T){return T[3]-0==U},eq:function(V,U,T){return T[3]-0==U}},filter:{PSEUDO:function(Z,V,W,aa){var U=V[1],X=I.filters[U];if(X){return X(Z,W,V,aa)}else{if(U==="contains"){return(Z.textContent||Z.innerText||"").indexOf(V[3])>=0}else{if(U==="not"){var Y=V[3];for(var W=0,T=Y.length;W<T;W++){if(Y[W]===Z){return false}}return true}}}},CHILD:function(T,W){var Z=W[1],U=T;switch(Z){case"only":case"first":while(U=U.previousSibling){if(U.nodeType===1){return false}}if(Z=="first"){return true}U=T;case"last":while(U=U.nextSibling){if(U.nodeType===1){return false}}return true;case"nth":var V=W[2],ac=W[3];if(V==1&&ac==0){return true}var Y=W[0],ab=T.parentNode;if(ab&&(ab.sizcache!==Y||!T.nodeIndex)){var X=0;for(U=ab.firstChild;U;U=U.nextSibling){if(U.nodeType===1){U.nodeIndex=++X}}ab.sizcache=Y}var aa=T.nodeIndex-ac;if(V==0){return aa==0}else{return(aa%V==0&&aa/V>=0)}}},ID:function(U,T){return U.nodeType===1&&U.getAttribute("id")===T},TAG:function(U,T){return(T==="*"&&U.nodeType===1)||U.nodeName===T},CLASS:function(U,T){return(" "+(U.className||U.getAttribute("class"))+" ").indexOf(T)>-1},ATTR:function(Y,W){var V=W[1],T=I.attrHandle[V]?I.attrHandle[V](Y):Y[V]!=null?Y[V]:Y.getAttribute(V),Z=T+"",X=W[2],U=W[4];return T==null?X==="!=":X==="="?Z===U:X==="*="?Z.indexOf(U)>=0:X==="~="?(" "+Z+" ").indexOf(U)>=0:!U?Z&&T!==false:X==="!="?Z!=U:X==="^="?Z.indexOf(U)===0:X==="$="?Z.substr(Z.length-U.length)===U:X==="|="?Z===U||Z.substr(0,U.length+1)===U+"-":false},POS:function(X,U,V,Y){var T=U[2],W=I.setFilters[T];if(W){return W(X,V,U,Y)}}}};var M=I.match.POS;for(var O in I.match){I.match[O]=RegExp(I.match[O].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var E=function(U,T){U=Array.prototype.slice.call(U);if(T){T.push.apply(T,U);return T}return U};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(N){E=function(X,W){var U=W||[];if(H.call(X)==="[object Array]"){Array.prototype.push.apply(U,X)}else{if(typeof X.length==="number"){for(var V=0,T=X.length;V<T;V++){U.push(X[V])}}else{for(var V=0;X[V];V++){U.push(X[V])}}}return U}}var G;if(document.documentElement.compareDocumentPosition){G=function(U,T){var V=U.compareDocumentPosition(T)&4?-1:U===T?0:1;if(V===0){hasDuplicate=true}return V}}else{if("sourceIndex" in document.documentElement){G=function(U,T){var V=U.sourceIndex-T.sourceIndex;if(V===0){hasDuplicate=true}return V}}else{if(document.createRange){G=function(W,U){var V=W.ownerDocument.createRange(),T=U.ownerDocument.createRange();V.selectNode(W);V.collapse(true);T.selectNode(U);T.collapse(true);var X=V.compareBoundaryPoints(Range.START_TO_END,T);if(X===0){hasDuplicate=true}return X}}}}(function(){var U=document.createElement("form"),V="script"+(new Date).getTime();U.innerHTML="<input name='"+V+"'/>";var T=document.documentElement;T.insertBefore(U,T.firstChild);if(!!document.getElementById(V)){I.find.ID=function(X,Y,Z){if(typeof Y.getElementById!=="undefined"&&!Z){var W=Y.getElementById(X[1]);return W?W.id===X[1]||typeof W.getAttributeNode!=="undefined"&&W.getAttributeNode("id").nodeValue===X[1]?[W]:g:[]}};I.filter.ID=function(Y,W){var X=typeof Y.getAttributeNode!=="undefined"&&Y.getAttributeNode("id");return Y.nodeType===1&&X&&X.nodeValue===W}}T.removeChild(U)})();(function(){var T=document.createElement("div");T.appendChild(document.createComment(""));if(T.getElementsByTagName("*").length>0){I.find.TAG=function(U,Y){var X=Y.getElementsByTagName(U[1]);if(U[1]==="*"){var W=[];for(var V=0;X[V];V++){if(X[V].nodeType===1){W.push(X[V])}}X=W}return X}}T.innerHTML="<a href='#'></a>";if(T.firstChild&&typeof T.firstChild.getAttribute!=="undefined"&&T.firstChild.getAttribute("href")!=="#"){I.attrHandle.href=function(U){return U.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var T=F,U=document.createElement("div");U.innerHTML="<p class='TEST'></p>";if(U.querySelectorAll&&U.querySelectorAll(".TEST").length===0){return}F=function(Y,X,V,W){X=X||document;if(!W&&X.nodeType===9&&!Q(X)){try{return E(X.querySelectorAll(Y),V)}catch(Z){}}return T(Y,X,V,W)};F.find=T.find;F.filter=T.filter;F.selectors=T.selectors;F.matches=T.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var T=document.createElement("div");T.innerHTML="<div class='test e'></div><div class='test'></div>";if(T.getElementsByClassName("e").length===0){return}T.lastChild.className="e";if(T.getElementsByClassName("e").length===1){return}I.order.splice(1,0,"CLASS");I.find.CLASS=function(U,V,W){if(typeof V.getElementsByClassName!=="undefined"&&!W){return V.getElementsByClassName(U[1])}}})()}function P(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1&&!ac){T.sizcache=Y;T.sizset=W}if(T.nodeName===Z){X=T;break}T=T[U]}ad[W]=X}}}function S(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1){if(!ac){T.sizcache=Y;T.sizset=W}if(typeof Z!=="string"){if(T===Z){X=true;break}}else{if(F.filter(Z,[T]).length>0){X=T;break}}}T=T[U]}ad[W]=X}}}var K=document.compareDocumentPosition?function(U,T){return U.compareDocumentPosition(T)&16}:function(U,T){return U!==T&&(U.contains?U.contains(T):true)};var Q=function(T){return T.nodeType===9&&T.documentElement.nodeName!=="HTML"||!!T.ownerDocument&&Q(T.ownerDocument)};var J=function(T,aa){var W=[],X="",Y,V=aa.nodeType?[aa]:aa;while((Y=I.match.PSEUDO.exec(T))){X+=Y[0];T=T.replace(I.match.PSEUDO,"")}T=I.relative[T]?T+"*":T;for(var Z=0,U=V.length;Z<U;Z++){F(T,V[Z],W)}return F.filter(X,W)};o.find=F;o.filter=F.filter;o.expr=F.selectors;o.expr[":"]=o.expr.filters;F.selectors.filters.hidden=function(T){return T.offsetWidth===0||T.offsetHeight===0};F.selectors.filters.visible=function(T){return T.offsetWidth>0||T.offsetHeight>0};F.selectors.filters.animated=function(T){return o.grep(o.timers,function(U){return T===U.elem}).length};o.multiFilter=function(V,T,U){if(U){V=":not("+V+")"}return F.matches(V,T)};o.dir=function(V,U){var T=[],W=V[U];while(W&&W!=document){if(W.nodeType==1){T.push(W)}W=W[U]}return T};o.nth=function(X,T,V,W){T=T||1;var U=0;for(;X;X=X[V]){if(X.nodeType==1&&++U==T){break}}return X};o.sibling=function(V,U){var T=[];for(;V;V=V.nextSibling){if(V.nodeType==1&&V!=U){T.push(V)}}return T};return;l.Sizzle=F})();o.event={add:function(I,F,H,K){if(I.nodeType==3||I.nodeType==8){return}if(I.setInterval&&I!=l){I=l}if(!H.guid){H.guid=this.guid++}if(K!==g){var G=H;H=this.proxy(G);H.data=K}var E=o.data(I,"events")||o.data(I,"events",{}),J=o.data(I,"handle")||o.data(I,"handle",function(){return typeof o!=="undefined"&&!o.event.triggered?o.event.handle.apply(arguments.callee.elem,arguments):g});J.elem=I;o.each(F.split(/\s+/),function(M,N){var O=N.split(".");N=O.shift();H.type=O.slice().sort().join(".");var L=E[N];if(o.event.specialAll[N]){o.event.specialAll[N].setup.call(I,K,O)}if(!L){L=E[N]={};if(!o.event.special[N]||o.event.special[N].setup.call(I,K,O)===false){if(I.addEventListener){I.addEventListener(N,J,false)}else{if(I.attachEvent){I.attachEvent("on"+N,J)}}}}L[H.guid]=H;o.event.global[N]=true});I=null},guid:1,global:{},remove:function(K,H,J){if(K.nodeType==3||K.nodeType==8){return}var G=o.data(K,"events"),F,E;if(G){if(H===g||(typeof H==="string"&&H.charAt(0)==".")){for(var I in G){this.remove(K,I+(H||""))}}else{if(H.type){J=H.handler;H=H.type}o.each(H.split(/\s+/),function(M,O){var Q=O.split(".");O=Q.shift();var N=RegExp("(^|\\.)"+Q.slice().sort().join(".*\\.")+"(\\.|$)");if(G[O]){if(J){delete G[O][J.guid]}else{for(var P in G[O]){if(N.test(G[O][P].type)){delete G[O][P]}}}if(o.event.specialAll[O]){o.event.specialAll[O].teardown.call(K,Q)}for(F in G[O]){break}if(!F){if(!o.event.special[O]||o.event.special[O].teardown.call(K,Q)===false){if(K.removeEventListener){K.removeEventListener(O,o.data(K,"handle"),false)}else{if(K.detachEvent){K.detachEvent("on"+O,o.data(K,"handle"))}}}F=null;delete G[O]}}})}for(F in G){break}if(!F){var L=o.data(K,"handle");if(L){L.elem=null}o.removeData(K,"events");o.removeData(K,"handle")}}},trigger:function(I,K,H,E){var G=I.type||I;if(!E){I=typeof I==="object"?I[h]?I:o.extend(o.Event(G),I):o.Event(G);if(G.indexOf("!")>=0){I.type=G=G.slice(0,-1);I.exclusive=true}if(!H){I.stopPropagation();if(this.global[G]){o.each(o.cache,function(){if(this.events&&this.events[G]){o.event.trigger(I,K,this.handle.elem)}})}}if(!H||H.nodeType==3||H.nodeType==8){return g}I.result=g;I.target=H;K=o.makeArray(K);K.unshift(I)}I.currentTarget=H;var J=o.data(H,"handle");if(J){J.apply(H,K)}if((!H[G]||(o.nodeName(H,"a")&&G=="click"))&&H["on"+G]&&H["on"+G].apply(H,K)===false){I.result=false}if(!E&&H[G]&&!I.isDefaultPrevented()&&!(o.nodeName(H,"a")&&G=="click")){this.triggered=true;try{H[G]()}catch(L){}}this.triggered=false;if(!I.isPropagationStopped()){var F=H.parentNode||H.ownerDocument;if(F){o.event.trigger(I,K,F,true)}}},handle:function(K){var J,E;K=arguments[0]=o.event.fix(K||l.event);K.currentTarget=this;var L=K.type.split(".");K.type=L.shift();J=!L.length&&!K.exclusive;var I=RegExp("(^|\\.)"+L.slice().sort().join(".*\\.")+"(\\.|$)");E=(o.data(this,"events")||{})[K.type];for(var G in E){var H=E[G];if(J||I.test(H.type)){K.handler=H;K.data=H.data;var F=H.apply(this,arguments);if(F!==g){K.result=F;if(F===false){K.preventDefault();K.stopPropagation()}}if(K.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(H){if(H[h]){return H}var F=H;H=o.Event(F);for(var G=this.props.length,J;G;){J=this.props[--G];H[J]=F[J]}if(!H.target){H.target=H.srcElement||document}if(H.target.nodeType==3){H.target=H.target.parentNode}if(!H.relatedTarget&&H.fromElement){H.relatedTarget=H.fromElement==H.target?H.toElement:H.fromElement}if(H.pageX==null&&H.clientX!=null){var I=document.documentElement,E=document.body;H.pageX=H.clientX+(I&&I.scrollLeft||E&&E.scrollLeft||0)-(I.clientLeft||0);H.pageY=H.clientY+(I&&I.scrollTop||E&&E.scrollTop||0)-(I.clientTop||0)}if(!H.which&&((H.charCode||H.charCode===0)?H.charCode:H.keyCode)){H.which=H.charCode||H.keyCode}if(!H.metaKey&&H.ctrlKey){H.metaKey=H.ctrlKey}if(!H.which&&H.button){H.which=(H.button&1?1:(H.button&2?3:(H.button&4?2:0)))}return H},proxy:function(F,E){E=E||function(){return F.apply(this,arguments)};E.guid=F.guid=F.guid||E.guid||this.guid++;return E},special:{ready:{setup:B,teardown:function(){}}},specialAll:{live:{setup:function(E,F){o.event.add(this,F[0],c)},teardown:function(G){if(G.length){var E=0,F=RegExp("(^|\\.)"+G[0]+"(\\.|$)");o.each((o.data(this,"events").live||{}),function(){if(F.test(this.type)){E++}});if(E<1){o.event.remove(this,G[0],c)}}}}}};o.Event=function(E){if(!this.preventDefault){return new o.Event(E)}if(E&&E.type){this.originalEvent=E;this.type=E.type}else{this.type=E}this.timeStamp=e();this[h]=true};function k(){return false}function u(){return true}o.Event.prototype={preventDefault:function(){this.isDefaultPrevented=u;var E=this.originalEvent;if(!E){return}if(E.preventDefault){E.preventDefault()}E.returnValue=false},stopPropagation:function(){this.isPropagationStopped=u;var E=this.originalEvent;if(!E){return}if(E.stopPropagation){E.stopPropagation()}E.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=u;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(F){var E=F.relatedTarget;while(E&&E!=this){try{E=E.parentNode}catch(G){E=this}}if(E!=this){F.type=F.data;o.event.handle.apply(this,arguments)}};o.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(F,E){o.event.special[E]={setup:function(){o.event.add(this,F,a,E)},teardown:function(){o.event.remove(this,F,a)}}});o.fn.extend({bind:function(F,G,E){return F=="unload"?this.one(F,G,E):this.each(function(){o.event.add(this,F,E||G,E&&G)})},one:function(G,H,F){var E=o.event.proxy(F||H,function(I){o(this).unbind(I,E);return(F||H).apply(this,arguments)});return this.each(function(){o.event.add(this,G,E,F&&H)})},unbind:function(F,E){return this.each(function(){o.event.remove(this,F,E)})},trigger:function(E,F){return this.each(function(){o.event.trigger(E,F,this)})},triggerHandler:function(E,G){if(this[0]){var F=o.Event(E);F.preventDefault();F.stopPropagation();o.event.trigger(F,G,this[0]);return F.result}},toggle:function(G){var E=arguments,F=1;while(F<E.length){o.event.proxy(G,E[F++])}return this.click(o.event.proxy(G,function(H){this.lastToggle=(this.lastToggle||0)%F;H.preventDefault();return E[this.lastToggle++].apply(this,arguments)||false}))},hover:function(E,F){return this.mouseenter(E).mouseleave(F)},ready:function(E){B();if(o.isReady){E.call(document,o)}else{o.readyList.push(E)}return this},live:function(G,F){var E=o.event.proxy(F);E.guid+=this.selector+G;o(document).bind(i(G,this.selector),this.selector,E);return this},die:function(F,E){o(document).unbind(i(F,this.selector),E?{guid:E.guid+this.selector+F}:null);return this}});function c(H){var E=RegExp("(^|\\.)"+H.type+"(\\.|$)"),G=true,F=[];o.each(o.data(this,"events").live||[],function(I,J){if(E.test(J.type)){var K=o(H.target).closest(J.data)[0];if(K){F.push({elem:K,fn:J})}}});F.sort(function(J,I){return o.data(J.elem,"closest")-o.data(I.elem,"closest")});o.each(F,function(){if(this.fn.call(this.elem,H,this.fn.data)===false){return(G=false)}});return G}function i(F,E){return["live",F,E.replace(/\./g,"`").replace(/ /g,"|")].join(".")}o.extend({isReady:false,readyList:[],ready:function(){if(!o.isReady){o.isReady=true;if(o.readyList){o.each(o.readyList,function(){this.call(document,o)});o.readyList=null}o(document).triggerHandler("ready")}}});var x=false;function B(){if(x){return}x=true;if(document.addEventListener){document.addEventListener("DOMContentLoaded",function(){document.removeEventListener("DOMContentLoaded",arguments.callee,false);o.ready()},false)}else{if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);o.ready()}});if(document.documentElement.doScroll&&l==l.top){(function(){if(o.isReady){return}try{document.documentElement.doScroll("left")}catch(E){setTimeout(arguments.callee,0);return}o.ready()})()}}}o.event.add(l,"load",o.ready)}o.each(("blur,focus,load,resize,scroll,unload,click,dblclick,mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave,change,select,submit,keydown,keypress,keyup,error").split(","),function(F,E){o.fn[E]=function(G){return G?this.bind(E,G):this.trigger(E)}});o(l).bind("unload",function(){for(var E in o.cache){if(E!=1&&o.cache[E].handle){o.event.remove(o.cache[E].handle.elem)}}});(function(){o.support={};var F=document.documentElement,G=document.createElement("script"),K=document.createElement("div"),J="script"+(new Date).getTime();K.style.display="none";K.innerHTML=' <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param/></object>';var H=K.getElementsByTagName("*"),E=K.getElementsByTagName("a")[0];if(!H||!H.length||!E){return}o.support={leadingWhitespace:K.firstChild.nodeType==3,tbody:!K.getElementsByTagName("tbody").length,objectAll:!!K.getElementsByTagName("object")[0].getElementsByTagName("*").length,htmlSerialize:!!K.getElementsByTagName("link").length,style:/red/.test(E.getAttribute("style")),hrefNormalized:E.getAttribute("href")==="/a",opacity:E.style.opacity==="0.5",cssFloat:!!E.style.cssFloat,scriptEval:false,noCloneEvent:true,boxModel:null};G.type="text/javascript";try{G.appendChild(document.createTextNode("window."+J+"=1;"))}catch(I){}F.insertBefore(G,F.firstChild);if(l[J]){o.support.scriptEval=true;delete l[J]}F.removeChild(G);if(K.attachEvent&&K.fireEvent){K.attachEvent("onclick",function(){o.support.noCloneEvent=false;K.detachEvent("onclick",arguments.callee)});K.cloneNode(true).fireEvent("onclick")}o(function(){var L=document.createElement("div");L.style.width=L.style.paddingLeft="1px";document.body.appendChild(L);o.boxModel=o.support.boxModel=L.offsetWidth===2;document.body.removeChild(L).style.display="none"})})();var w=o.support.cssFloat?"cssFloat":"styleFloat";o.props={"for":"htmlFor","class":"className","float":w,cssFloat:w,styleFloat:w,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",tabindex:"tabIndex"};o.fn.extend({_load:o.fn.load,load:function(G,J,K){if(typeof G!=="string"){return this._load(G)}var I=G.indexOf(" ");if(I>=0){var E=G.slice(I,G.length);G=G.slice(0,I)}var H="GET";if(J){if(o.isFunction(J)){K=J;J=null}else{if(typeof J==="object"){J=o.param(J);H="POST"}}}var F=this;o.ajax({url:G,type:H,dataType:"html",data:J,complete:function(M,L){if(L=="success"||L=="notmodified"){F.html(E?o("<div/>").append(M.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(E):M.responseText)}if(K){F.each(K,[M.responseText,L,M])}}});return this},serialize:function(){return o.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?o.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type))}).map(function(E,F){var G=o(this).val();return G==null?null:o.isArray(G)?o.map(G,function(I,H){return{name:F.name,value:I}}):{name:F.name,value:G}}).get()}});o.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(E,F){o.fn[F]=function(G){return this.bind(F,G)}});var r=e();o.extend({get:function(E,G,H,F){if(o.isFunction(G)){H=G;G=null}return o.ajax({type:"GET",url:E,data:G,success:H,dataType:F})},getScript:function(E,F){return o.get(E,null,F,"script")},getJSON:function(E,F,G){return o.get(E,F,G,"json")},post:function(E,G,H,F){if(o.isFunction(G)){H=G;G={}}return o.ajax({type:"POST",url:E,data:G,success:H,dataType:F})},ajaxSetup:function(E){o.extend(o.ajaxSettings,E)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return l.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(M){M=o.extend(true,M,o.extend(true,{},o.ajaxSettings,M));var W,F=/=\?(&|$)/g,R,V,G=M.type.toUpperCase();if(M.data&&M.processData&&typeof M.data!=="string"){M.data=o.param(M.data)}if(M.dataType=="jsonp"){if(G=="GET"){if(!M.url.match(F)){M.url+=(M.url.match(/\?/)?"&":"?")+(M.jsonp||"callback")+"=?"}}else{if(!M.data||!M.data.match(F)){M.data=(M.data?M.data+"&":"")+(M.jsonp||"callback")+"=?"}}M.dataType="json"}if(M.dataType=="json"&&(M.data&&M.data.match(F)||M.url.match(F))){W="jsonp"+r++;if(M.data){M.data=(M.data+"").replace(F,"="+W+"$1")}M.url=M.url.replace(F,"="+W+"$1");M.dataType="script";l[W]=function(X){V=X;I();L();l[W]=g;try{delete l[W]}catch(Y){}if(H){H.removeChild(T)}}}if(M.dataType=="script"&&M.cache==null){M.cache=false}if(M.cache===false&&G=="GET"){var E=e();var U=M.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+E+"$2");M.url=U+((U==M.url)?(M.url.match(/\?/)?"&":"?")+"_="+E:"")}if(M.data&&G=="GET"){M.url+=(M.url.match(/\?/)?"&":"?")+M.data;M.data=null}if(M.global&&!o.active++){o.event.trigger("ajaxStart")}var Q=/^(\w+:)?\/\/([^\/?#]+)/.exec(M.url);if(M.dataType=="script"&&G=="GET"&&Q&&(Q[1]&&Q[1]!=location.protocol||Q[2]!=location.host)){var H=document.getElementsByTagName("head")[0];var T=document.createElement("script");T.src=M.url;if(M.scriptCharset){T.charset=M.scriptCharset}if(!W){var O=false;T.onload=T.onreadystatechange=function(){if(!O&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){O=true;I();L();T.onload=T.onreadystatechange=null;H.removeChild(T)}}}H.appendChild(T);return g}var K=false;var J=M.xhr();if(M.username){J.open(G,M.url,M.async,M.username,M.password)}else{J.open(G,M.url,M.async)}try{if(M.data){J.setRequestHeader("Content-Type",M.contentType)}if(M.ifModified){J.setRequestHeader("If-Modified-Since",o.lastModified[M.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}J.setRequestHeader("X-Requested-With","XMLHttpRequest");J.setRequestHeader("Accept",M.dataType&&M.accepts[M.dataType]?M.accepts[M.dataType]+", */*":M.accepts._default)}catch(S){}if(M.beforeSend&&M.beforeSend(J,M)===false){if(M.global&&!--o.active){o.event.trigger("ajaxStop")}J.abort();return false}if(M.global){o.event.trigger("ajaxSend",[J,M])}var N=function(X){if(J.readyState==0){if(P){clearInterval(P);P=null;if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}}else{if(!K&&J&&(J.readyState==4||X=="timeout")){K=true;if(P){clearInterval(P);P=null}R=X=="timeout"?"timeout":!o.httpSuccess(J)?"error":M.ifModified&&o.httpNotModified(J,M.url)?"notmodified":"success";if(R=="success"){try{V=o.httpData(J,M.dataType,M)}catch(Z){R="parsererror"}}if(R=="success"){var Y;try{Y=J.getResponseHeader("Last-Modified")}catch(Z){}if(M.ifModified&&Y){o.lastModified[M.url]=Y}if(!W){I()}}else{o.handleError(M,J,R)}L();if(X){J.abort()}if(M.async){J=null}}}};if(M.async){var P=setInterval(N,13);if(M.timeout>0){setTimeout(function(){if(J&&!K){N("timeout")}},M.timeout)}}try{J.send(M.data)}catch(S){o.handleError(M,J,null,S)}if(!M.async){N()}function I(){if(M.success){M.success(V,R)}if(M.global){o.event.trigger("ajaxSuccess",[J,M])}}function L(){if(M.complete){M.complete(J,R)}if(M.global){o.event.trigger("ajaxComplete",[J,M])}if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}return J},handleError:function(F,H,E,G){if(F.error){F.error(H,E,G)}if(F.global){o.event.trigger("ajaxError",[H,F,G])}},active:0,httpSuccess:function(F){try{return !F.status&&location.protocol=="file:"||(F.status>=200&&F.status<300)||F.status==304||F.status==1223}catch(E){}return false},httpNotModified:function(G,E){try{var H=G.getResponseHeader("Last-Modified");return G.status==304||H==o.lastModified[E]}catch(F){}return false},httpData:function(J,H,G){var F=J.getResponseHeader("content-type"),E=H=="xml"||!H&&F&&F.indexOf("xml")>=0,I=E?J.responseXML:J.responseText;if(E&&I.documentElement.tagName=="parsererror"){throw"parsererror"}if(G&&G.dataFilter){I=G.dataFilter(I,H)}if(typeof I==="string"){if(H=="script"){o.globalEval(I)}if(H=="json"){I=l["eval"]("("+I+")")}}return I},param:function(E){var G=[];function H(I,J){G[G.length]=encodeURIComponent(I)+"="+encodeURIComponent(J)}if(o.isArray(E)||E.jquery){o.each(E,function(){H(this.name,this.value)})}else{for(var F in E){if(o.isArray(E[F])){o.each(E[F],function(){H(F,this)})}else{H(F,o.isFunction(E[F])?E[F]():E[F])}}}return G.join("&").replace(/%20/g,"+")}});var m={},n,d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function t(F,E){var G={};o.each(d.concat.apply([],d.slice(0,E)),function(){G[this]=F});return G}o.fn.extend({show:function(J,L){if(J){return this.animate(t("show",3),J,L)}else{for(var H=0,F=this.length;H<F;H++){var E=o.data(this[H],"olddisplay");this[H].style.display=E||"";if(o.css(this[H],"display")==="none"){var G=this[H].tagName,K;if(m[G]){K=m[G]}else{var I=o("<"+G+" />").appendTo("body");K=I.css("display");if(K==="none"){K="block"}I.remove();m[G]=K}o.data(this[H],"olddisplay",K)}}for(var H=0,F=this.length;H<F;H++){this[H].style.display=o.data(this[H],"olddisplay")||""}return this}},hide:function(H,I){if(H){return this.animate(t("hide",3),H,I)}else{for(var G=0,F=this.length;G<F;G++){var E=o.data(this[G],"olddisplay");if(!E&&E!=="none"){o.data(this[G],"olddisplay",o.css(this[G],"display"))}}for(var G=0,F=this.length;G<F;G++){this[G].style.display="none"}return this}},_toggle:o.fn.toggle,toggle:function(G,F){var E=typeof G==="boolean";return o.isFunction(G)&&o.isFunction(F)?this._toggle.apply(this,arguments):G==null||E?this.each(function(){var H=E?G:o(this).is(":hidden");o(this)[H?"show":"hide"]()}):this.animate(t("toggle",3),G,F)},fadeTo:function(E,G,F){return this.animate({opacity:G},E,F)},animate:function(I,F,H,G){var E=o.speed(F,H,G);return this[E.queue===false?"each":"queue"](function(){var K=o.extend({},E),M,L=this.nodeType==1&&o(this).is(":hidden"),J=this;for(M in I){if(I[M]=="hide"&&L||I[M]=="show"&&!L){return K.complete.call(this)}if((M=="height"||M=="width")&&this.style){K.display=o.css(this,"display");K.overflow=this.style.overflow}}if(K.overflow!=null){this.style.overflow="hidden"}K.curAnim=o.extend({},I);o.each(I,function(O,S){var R=new o.fx(J,K,O);if(/toggle|show|hide/.test(S)){R[S=="toggle"?L?"show":"hide":S](I)}else{var Q=S.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),T=R.cur(true)||0;if(Q){var N=parseFloat(Q[2]),P=Q[3]||"px";if(P!="px"){J.style[O]=(N||1)+P;T=((N||1)/R.cur(true))*T;J.style[O]=T+P}if(Q[1]){N=((Q[1]=="-="?-1:1)*N)+T}R.custom(T,N,P)}else{R.custom(T,S,"")}}});return true})},stop:function(F,E){var G=o.timers;if(F){this.queue([])}this.each(function(){for(var H=G.length-1;H>=0;H--){if(G[H].elem==this){if(E){G[H](true)}G.splice(H,1)}}});if(!E){this.dequeue()}return this}});o.each({slideDown:t("show",1),slideUp:t("hide",1),slideToggle:t("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(E,F){o.fn[E]=function(G,H){return this.animate(F,G,H)}});o.extend({speed:function(G,H,F){var E=typeof G==="object"?G:{complete:F||!F&&H||o.isFunction(G)&&G,duration:G,easing:F&&H||H&&!o.isFunction(H)&&H};E.duration=o.fx.off?0:typeof E.duration==="number"?E.duration:o.fx.speeds[E.duration]||o.fx.speeds._default;E.old=E.complete;E.complete=function(){if(E.queue!==false){o(this).dequeue()}if(o.isFunction(E.old)){E.old.call(this)}};return E},easing:{linear:function(G,H,E,F){return E+F*G},swing:function(G,H,E,F){return((-Math.cos(G*Math.PI)/2)+0.5)*F+E}},timers:[],fx:function(F,E,G){this.options=E;this.elem=F;this.prop=G;if(!E.orig){E.orig={}}}});o.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(o.fx.step[this.prop]||o.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(F){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var E=parseFloat(o.css(this.elem,this.prop,F));return E&&E>-10000?E:parseFloat(o.curCSS(this.elem,this.prop))||0},custom:function(I,H,G){this.startTime=e();this.start=I;this.end=H;this.unit=G||this.unit||"px";this.now=this.start;this.pos=this.state=0;var E=this;function F(J){return E.step(J)}F.elem=this.elem;if(F()&&o.timers.push(F)&&!n){n=setInterval(function(){var K=o.timers;for(var J=0;J<K.length;J++){if(!K[J]()){K.splice(J--,1)}}if(!K.length){clearInterval(n);n=g}},13)}},show:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.show=true;this.custom(this.prop=="width"||this.prop=="height"?1:0,this.cur());o(this.elem).show()},hide:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(H){var G=e();if(H||G>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var E=true;for(var F in this.options.curAnim){if(this.options.curAnim[F]!==true){E=false}}if(E){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(o.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){o(this.elem).hide()}if(this.options.hide||this.options.show){for(var I in this.options.curAnim){o.attr(this.elem.style,I,this.options.orig[I])}}this.options.complete.call(this.elem)}return false}else{var J=G-this.startTime;this.state=J/this.options.duration;this.pos=o.easing[this.options.easing||(o.easing.swing?"swing":"linear")](this.state,J,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};o.extend(o.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(E){o.attr(E.elem.style,"opacity",E.now)},_default:function(E){if(E.elem.style&&E.elem.style[E.prop]!=null){E.elem.style[E.prop]=E.now+E.unit}else{E.elem[E.prop]=E.now}}}});if(document.documentElement.getBoundingClientRect){o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}var G=this[0].getBoundingClientRect(),J=this[0].ownerDocument,F=J.body,E=J.documentElement,L=E.clientTop||F.clientTop||0,K=E.clientLeft||F.clientLeft||0,I=G.top+(self.pageYOffset||o.boxModel&&E.scrollTop||F.scrollTop)-L,H=G.left+(self.pageXOffset||o.boxModel&&E.scrollLeft||F.scrollLeft)-K;return{top:I,left:H}}}else{o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}o.offset.initialized||o.offset.initialize();var J=this[0],G=J.offsetParent,F=J,O=J.ownerDocument,M,H=O.documentElement,K=O.body,L=O.defaultView,E=L.getComputedStyle(J,null),N=J.offsetTop,I=J.offsetLeft;while((J=J.parentNode)&&J!==K&&J!==H){M=L.getComputedStyle(J,null);N-=J.scrollTop,I-=J.scrollLeft;if(J===G){N+=J.offsetTop,I+=J.offsetLeft;if(o.offset.doesNotAddBorder&&!(o.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(J.tagName))){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}F=G,G=J.offsetParent}if(o.offset.subtractsBorderForOverflowNotVisible&&M.overflow!=="visible"){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}E=M}if(E.position==="relative"||E.position==="static"){N+=K.offsetTop,I+=K.offsetLeft}if(E.position==="fixed"){N+=Math.max(H.scrollTop,K.scrollTop),I+=Math.max(H.scrollLeft,K.scrollLeft)}return{top:N,left:I}}}o.offset={initialize:function(){if(this.initialized){return}var L=document.body,F=document.createElement("div"),H,G,N,I,M,E,J=L.style.marginTop,K='<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>';M={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(E in M){F.style[E]=M[E]}F.innerHTML=K;L.insertBefore(F,L.firstChild);H=F.firstChild,G=H.firstChild,I=H.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(G.offsetTop!==5);this.doesAddBorderForTableAndCells=(I.offsetTop===5);H.style.overflow="hidden",H.style.position="relative";this.subtractsBorderForOverflowNotVisible=(G.offsetTop===-5);L.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(L.offsetTop===0);L.style.marginTop=J;L.removeChild(F);this.initialized=true},bodyOffset:function(E){o.offset.initialized||o.offset.initialize();var G=E.offsetTop,F=E.offsetLeft;if(o.offset.doesNotIncludeMarginInBodyOffset){G+=parseInt(o.curCSS(E,"marginTop",true),10)||0,F+=parseInt(o.curCSS(E,"marginLeft",true),10)||0}return{top:G,left:F}}};o.fn.extend({position:function(){var I=0,H=0,F;if(this[0]){var G=this.offsetParent(),J=this.offset(),E=/^body|html$/i.test(G[0].tagName)?{top:0,left:0}:G.offset();J.top-=j(this,"marginTop");J.left-=j(this,"marginLeft");E.top+=j(G,"borderTopWidth");E.left+=j(G,"borderLeftWidth");F={top:J.top-E.top,left:J.left-E.left}}return F},offsetParent:function(){var E=this[0].offsetParent||document.body;while(E&&(!/^body|html$/i.test(E.tagName)&&o.css(E,"position")=="static")){E=E.offsetParent}return o(E)}});o.each(["Left","Top"],function(F,E){var G="scroll"+E;o.fn[G]=function(H){if(!this[0]){return null}return H!==g?this.each(function(){this==l||this==document?l.scrollTo(!F?H:o(l).scrollLeft(),F?H:o(l).scrollTop()):this[G]=H}):this[0]==l||this[0]==document?self[F?"pageYOffset":"pageXOffset"]||o.boxModel&&document.documentElement[G]||document.body[G]:this[0][G]}});o.each(["Height","Width"],function(I,G){var E=I?"Left":"Top",H=I?"Right":"Bottom",F=G.toLowerCase();o.fn["inner"+G]=function(){return this[0]?o.css(this[0],F,false,"padding"):null};o.fn["outer"+G]=function(K){return this[0]?o.css(this[0],F,false,K?"margin":"border"):null};var J=G.toLowerCase();o.fn[J]=function(K){return this[0]==l?document.compatMode=="CSS1Compat"&&document.documentElement["client"+G]||document.body["client"+G]:this[0]==document?Math.max(document.documentElement["client"+G],document.body["scroll"+G],document.documentElement["scroll"+G],document.body["offset"+G],document.documentElement["offset"+G]):K===g?(this.length?o.css(this[0],J):null):this.css(J,typeof K==="string"?K:K+"px")}})})();
\ No newline at end of file diff --git a/themes/jqtouch/jqtouch.css b/themes/jqtouch/jqtouch.css new file mode 100644 index 0000000..5c3e736 --- /dev/null +++ b/themes/jqtouch/jqtouch.css @@ -0,0 +1,373 @@ +* { + margin: 0; + padding: 0; +} +a { + -webkit-tap-highlight-color: rgba(0,0,0,0); +} + +div#jqt { + /*overflow-x: hidden;*/ + -webkit-user-select: none; + -webkit-text-size-adjust: none; + font-family: "Helvetica Neue", Helvetica; + -webkit-perspective: 800; + -webkit-transform-style: preserve-3d; +} +#jqt .selectable, #jqt input, #jqt textarea { + -webkit-user-select: auto; +} +div#jqt > * { + -webkit-backface-visibility: hidden; + -webkit-box-sizing: border-box; + display: none; + position: absolute; + left: 0; + width: 100%; + -webkit-transform: translate3d(0,0,0) rotate(0) scale(1); + min-height: 420px !important; +} +#jqt.fullscreen > * { + min-height: 460px !important; +} +#jqt.fullscreen.black-translucent > * { + min-height: 480px !important; +} +#jqt.landscape > * { + min-height: 320px !important; +} +div#jqt > .current { + display: block !important; +} + +#jqt .in, #jqt .out { + -webkit-animation-timing-function: ease-in-out; + -webkit-animation-duration: 350ms; +} + +#jqt .slide.in { + -webkit-animation-name: slideinfromright; +} + +#jqt .slide.out { + -webkit-animation-name: slideouttoleft; +} + +#jqt .slide.in.reverse { + -webkit-animation-name: slideinfromleft; +} + +#jqt .slide.out.reverse { + -webkit-animation-name: slideouttoright; +} + +@-webkit-keyframes slideinfromright { + from { -webkit-transform: translateX(100%); } + to { -webkit-transform: translateX(0); } +} + +@-webkit-keyframes slideinfromleft { + from { -webkit-transform: translateX(-100%); } + to { -webkit-transform: translateX(0); } +} + +@-webkit-keyframes slideouttoleft { + from { -webkit-transform: translateX(0); } + to { -webkit-transform: translateX(-100%); } +} + +@-webkit-keyframes slideouttoright { + from { -webkit-transform: translateX(0); } + to { -webkit-transform: translateX(100%); } +} + +@-webkit-keyframes fadein { + from { opacity: 0; } + to { opacity: 1; } +} + +@-webkit-keyframes fadeout { + from { opacity: 1; } + to { opacity: 0; } +} + +#jqt .fade.in { + z-index: 10; + -webkit-animation-name: fadein; +} +#jqt .fade.out { + z-index: 0; +} + +#jqt .dissolve.in { + -webkit-animation-name: fadein; +} + +#jqt .dissolve.out { + -webkit-animation-name: fadeout; +} + + + +#jqt .flip { + -webkit-animation-duration: .65s; +} + +#jqt .flip.in { + -webkit-animation-name: flipinfromleft; +} + +#jqt .flip.out { + -webkit-animation-name: flipouttoleft; +} + +/* Shake it all about */ + +#jqt .flip.in.reverse { + -webkit-animation-name: flipinfromright; +} + +#jqt .flip.out.reverse { + -webkit-animation-name: flipouttoright; +} + +@-webkit-keyframes flipinfromright { + from { -webkit-transform: rotateY(-180deg) scale(.8); } + to { -webkit-transform: rotateY(0) scale(1); } +} + +@-webkit-keyframes flipinfromleft { + from { -webkit-transform: rotateY(180deg) scale(.8); } + to { -webkit-transform: rotateY(0) scale(1); } +} + +@-webkit-keyframes flipouttoleft { + from { -webkit-transform: rotateY(0) scale(1); } + to { -webkit-transform: rotateY(-180deg) scale(.8); } +} + +@-webkit-keyframes flipouttoright { + from { -webkit-transform: rotateY(0) scale(1); } + to { -webkit-transform: rotateY(180deg) scale(.8); } +} + +#jqt .slideup.in { + -webkit-animation-name: slideup; + z-index: 10; +} + +#jqt .slideup.out { + -webkit-animation-name: dontmove; + z-index: 0; +} + +#jqt .slideup.out.reverse { + z-index: 10; + -webkit-animation-name: slidedown; +} + +#jqt .slideup.in.reverse { + z-index: 0; + -webkit-animation-name: dontmove; +} + + +@-webkit-keyframes slideup { + from { -webkit-transform: translateY(100%); } + to { -webkit-transform: translateY(0); } +} + +@-webkit-keyframes slidedown { + from { -webkit-transform: translateY(0); } + to { -webkit-transform: translateY(100%); } +} + + + +/* Hackish, but reliable. */ + +@-webkit-keyframes dontmove { + from { opacity: 1; } + to { opacity: 1; } +} + +#jqt .swap { + -webkit-transform: perspective(800); + -webkit-animation-duration: .7s; +} +#jqt .swap.out { + -webkit-animation-name: swapouttoleft; +} +#jqt .swap.in { + -webkit-animation-name: swapinfromright; +} +#jqt .swap.out.reverse { + -webkit-animation-name: swapouttoright; +} +#jqt .swap.in.reverse { + -webkit-animation-name: swapinfromleft; +} + + +@-webkit-keyframes swapouttoright { + 0% { + -webkit-transform: translate3d(0px, 0px, 0px) rotateY(0deg); + -webkit-animation-timing-function: ease-in-out; + } + 50% { + -webkit-transform: translate3d(-180px, 0px, -400px) rotateY(20deg); + -webkit-animation-timing-function: ease-in; + } + 100% { + -webkit-transform: translate3d(0px, 0px, -800px) rotateY(70deg); + } +} + +@-webkit-keyframes swapouttoleft { + 0% { + -webkit-transform: translate3d(0px, 0px, 0px) rotateY(0deg); + -webkit-animation-timing-function: ease-in-out; + } + 50% { + -webkit-transform: translate3d(180px, 0px, -400px) rotateY(-20deg); + -webkit-animation-timing-function: ease-in; + } + 100% { + -webkit-transform: translate3d(0px, 0px, -800px) rotateY(-70deg); + } +} + +@-webkit-keyframes swapinfromright { + 0% { + -webkit-transform: translate3d(0px, 0px, -800px) rotateY(70deg); + -webkit-animation-timing-function: ease-out; + } + 50% { + -webkit-transform: translate3d(-180px, 0px, -400px) rotateY(20deg); + -webkit-animation-timing-function: ease-in-out; + } + 100% { + -webkit-transform: translate3d(0px, 0px, 0px) rotateY(0deg); + } +} + +@-webkit-keyframes swapinfromleft { + 0% { + -webkit-transform: translate3d(0px, 0px, -800px) rotateY(-70deg); + -webkit-animation-timing-function: ease-out; + } + 50% { + -webkit-transform: translate3d(180px, 0px, -400px) rotateY(-20deg); + -webkit-animation-timing-function: ease-in-out; + } + 100% { + -webkit-transform: translate3d(0px, 0px, 0px) rotateY(0deg); + } +} + +#jqt .cube { + -webkit-animation-duration: .55s; +} + +#jqt .cube.in { + -webkit-animation-name: cubeinfromright; + -webkit-transform-origin: 0% 50%; +} +#jqt .cube.out { + -webkit-animation-name: cubeouttoleft; + -webkit-transform-origin: 100% 50%; +} +#jqt .cube.in.reverse { + -webkit-animation-name: cubeinfromleft; + -webkit-transform-origin: 100% 50%; +} +#jqt .cube.out.reverse { + -webkit-animation-name: cubeouttoright; + -webkit-transform-origin: 0% 50%; + +} + +@-webkit-keyframes cubeinfromleft { + from { + -webkit-transform: rotateY(-90deg) translateZ(320px); + opacity: .5; + } + to { + -webkit-transform: rotateY(0deg) translateZ(0); + opacity: 1; + } +} +@-webkit-keyframes cubeouttoright { + from { + -webkit-transform: rotateY(0deg) translateX(0); + opacity: 1; + } + to { + -webkit-transform: rotateY(90deg) translateZ(320px); + opacity: .5; + } +} +@-webkit-keyframes cubeinfromright { + from { + -webkit-transform: rotateY(90deg) translateZ(320px); + opacity: .5; + } + to { + -webkit-transform: rotateY(0deg) translateZ(0); + opacity: 1; + } +} +@-webkit-keyframes cubeouttoleft { + from { + -webkit-transform: rotateY(0deg) translateZ(0); + opacity: 1; + } + to { + -webkit-transform: rotateY(-90deg) translateZ(320px); + opacity: .5; + } +} + + + + +#jqt .pop { + -webkit-transform-origin: 50% 50%; +} + +#jqt .pop.in { + -webkit-animation-name: popin; + z-index: 10; +} + +#jqt .pop.out.reverse { + -webkit-animation-name: popout; + z-index: 10; +} + +#jqt .pop.in.reverse { + z-index: 0; + -webkit-animation-name: dontmove; +} + +@-webkit-keyframes popin { + from { + -webkit-transform: scale(.2); + opacity: 0; + } + to { + -webkit-transform: scale(1); + opacity: 1; + } +} + +@-webkit-keyframes popout { + from { + -webkit-transform: scale(1); + opacity: 1; + } + to { + -webkit-transform: scale(.2); + opacity: 0; + } +}
\ No newline at end of file diff --git a/themes/jqtouch/jqtouch.js b/themes/jqtouch/jqtouch.js new file mode 100644 index 0000000..b5057eb --- /dev/null +++ b/themes/jqtouch/jqtouch.js @@ -0,0 +1,624 @@ +/*
+
+ _/ _/_/ _/_/_/_/_/ _/
+ _/ _/ _/ _/_/ _/ _/ _/_/_/ _/_/_/
+ _/ _/ _/_/ _/ _/ _/ _/ _/ _/ _/ _/
+ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/
+ _/ _/_/ _/ _/ _/_/ _/_/_/ _/_/_/ _/ _/
+ _/
+ _/
+
+ Created by David Kaneda <http://www.davidkaneda.com>
+ Documentation and issue tracking on Google Code <http://code.google.com/p/jqtouch/>
+
+ Special thanks to Jonathan Stark <http://jonathanstark.com/>
+ and pinch/zoom <http://www.pinchzoom.com/>
+
+ (c) 2009 by jQTouch project members.
+ See LICENSE.txt for license.
+
+ $Revision: 133 $
+ $Date: 2010-01-15 22:08:54 +0100 (ven. 15 janv. 2010) $
+ $LastChangedBy: RBoulanouar $
+
+*/
+
+(function($) {
+ $.jQTouch = function(options) {
+
+ // Set support values
+ $.support.WebKitCSSMatrix = (typeof WebKitCSSMatrix == "object");
+ $.support.touch = (typeof Touch == "object");
+ $.support.WebKitAnimationEvent = (typeof WebKitTransitionEvent == "object");
+
+ // Initialize internal variables
+ var $body,
+ $head=$('head'),
+ hist=[],
+ newPageCount=0,
+ jQTSettings={},
+ hashCheckInterval,
+ currentPage,
+ orientation,
+ isMobileWebKit = RegExp(" Mobile/").test(navigator.userAgent),
+ tapReady=true,
+ lastAnimationTime=0,
+ touchSelectors=[],
+ publicObj={},
+ extensions=$.jQTouch.prototype.extensions,
+ defaultAnimations=['slide','flip','slideup','swap','cube','pop','dissolve','fade','back'],
+ animations=[],
+ hairextensions='';
+ // Get the party started
+ init(options);
+
+ function init(options) {
+
+ var defaults = {
+ addGlossToIcon: true,
+ backSelector: '.back, .cancel, .goback',
+ cacheGetRequests: true,
+ cubeSelector: '.cube',
+ dissolveSelector: '.dissolve',
+ fadeSelector: '.fade',
+ fixedViewport: true,
+ flipSelector: '.flip',
+ formSelector: 'form',
+ fullScreen: true,
+ fullScreenClass: 'fullscreen',
+ icon: null,
+ touchSelector: 'a, .touch',
+ popSelector: '.pop',
+ preloadImages: false,
+ slideSelector: '#jqt > * > ul li a',
+ slideupSelector: '.slideup',
+ startupScreen: null,
+ statusBar: 'default', // other options: black-translucent, black
+ submitSelector: '.submit',
+ swapSelector: '.swap',
+ useAnimations: true,
+ useFastTouch: true // Experimental.
+ };
+ jQTSettings = $.extend({}, defaults, options);
+
+ // Preload images
+ if (jQTSettings.preloadImages) {
+ for (var i = jQTSettings.preloadImages.length - 1; i >= 0; i--) {
+ (new Image()).src = jQTSettings.preloadImages[i];
+ };
+ }
+ // Set icon
+ if (jQTSettings.icon) {
+ var precomposed = (jQTSettings.addGlossToIcon) ? '' : '-precomposed';
+ hairextensions += '<link rel="apple-touch-icon' + precomposed + '" href="' + jQTSettings.icon + '" />';
+ }
+ // Set startup screen
+ if (jQTSettings.startupScreen) {
+ hairextensions += '<link rel="apple-touch-startup-image" href="' + jQTSettings.startupScreen + '" />';
+ }
+ // Set viewport
+ if (jQTSettings.fixedViewport) {
+ hairextensions += '<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;"/>';
+ }
+ // Set full-screen
+ if (jQTSettings.fullScreen) {
+ hairextensions += '<meta name="apple-mobile-web-app-capable" content="yes" />';
+ if (jQTSettings.statusBar) {
+ hairextensions += '<meta name="apple-mobile-web-app-status-bar-style" content="' + jQTSettings.statusBar + '" />';
+ }
+ }
+ if (hairextensions) {
+ $head.prepend(hairextensions);
+ }
+
+ // Initialize on document load:
+ $(document).ready(function() {
+
+ // Add extensions
+ for (var i in extensions) {
+ var fn = extensions[i];
+ if ($.isFunction(fn)) {
+ $.extend(publicObj, fn(publicObj));
+ }
+ }
+
+ // Add animations
+ for (var i in defaultAnimations) {
+ var name = defaultAnimations[i];
+ var selector = jQTSettings[name + 'Selector'];
+ if (typeof(selector) == 'string') {
+ addAnimation({name:name, selector:selector});
+ }
+ }
+
+ touchSelectors.push('input');
+ touchSelectors.push(jQTSettings.touchSelector);
+ touchSelectors.push(jQTSettings.backSelector);
+ touchSelectors.push(jQTSettings.submitSelector);
+ $(touchSelectors.join(', ')).css('-webkit-touch-callout', 'none');
+ $(jQTSettings.backSelector).tap(liveTap);
+ $(jQTSettings.submitSelector).tap(submitParentForm);
+
+ $body = $('#jqt');
+
+ if (jQTSettings.fullScreenClass && window.navigator.standalone == true) {
+ $body.addClass(jQTSettings.fullScreenClass + ' ' + jQTSettings.statusBar);
+ }
+
+ // Create custom live events
+ $body
+ .bind('touchstart', handleTouch)
+ .bind('orientationchange', updateOrientation)
+ .trigger('orientationchange')
+ .submit(submitForm);
+
+ if (jQTSettings.useFastTouch && $.support.touch) {
+ $body.click(function(e) {
+ var $el = $(e.target);
+
+ if ($el.attr('nodeName')!=='A' && $el.attr('nodeName')!=='AREA' && $el.attr('nodeName')!=='INPUT') {
+ $el = $el.closest('a, area');
+ }
+
+ if ($el.isExternalLink()) {
+ return true;
+ } else {
+ return false;
+ }
+ });
+
+ // This additionally gets rid of form focusses
+ $body.mousedown(function(e) {
+ var timeDiff = (new Date()).getTime() - lastAnimationTime;
+ if (timeDiff < 200) {
+ return false;
+ }
+ });
+ }
+
+ // Make sure exactly one child of body has "current" class
+ if ($('#jqt > .current').length == 0) {
+ currentPage = $('#jqt > *:first');
+ } else {
+ currentPage = $('#jqt > .current:first');
+ $('#jqt > .current').removeClass('current');
+ }
+
+ // Go to the top of the "current" page
+ $(currentPage).addClass('current');
+ location.hash = '#' + $(currentPage).attr('id');
+ addPageToHistory(currentPage);
+ scrollTo(0, 0);
+ startHashCheck();
+ });
+ }
+
+ // PUBLIC FUNCTIONS
+ function goBack(to) {
+ // Init the param
+ var numberOfPages = Math.min(parseInt(to || 1, 10), hist.length-1),
+ curPage = hist[0];
+
+ // Search through the history for an ID
+ if(isNaN(numberOfPages) && typeof(to) === "string" && to != '#' ) {
+ for( var i=1, length=hist.length; i < length; i++ ) {
+ if( '#' + hist[i].id === to ) {
+ numberOfPages = i;
+ break;
+ }
+ }
+ }
+
+ // If still nothing, assume one
+ if(isNaN(numberOfPages) || numberOfPages < 1) {
+ numberOfPages = 1;
+ };
+
+ if (hist.length > 1) {
+ // Remove all pages in front of the target page
+ hist.splice(0, numberOfPages);
+ animatePages(curPage.page, hist[0].page, curPage.animation, curPage.reverse === false);
+ } else {
+ location.hash = '#' + curPage.id;
+ }
+
+ return publicObj;
+ }
+ function goTo(toPage, animation, reverse) {
+ var fromPage = hist[0].page;
+
+ if (typeof(toPage) === 'string') {
+ toPage = $(toPage);
+ }
+ if (typeof(animation) === 'string') {
+ for (var i = animations.length - 1; i >= 0; i--) {
+ if (animations[i].name === animation) {
+ animation = animations[i];
+ break;
+ }
+ }
+ }
+ if (animatePages(fromPage, toPage, animation, reverse)) {
+ addPageToHistory(toPage, animation, reverse);
+ return publicObj;
+ } else {
+ console.error('Could not animate pages.');
+ return false;
+ }
+ }
+ function getOrientation() {
+ return orientation;
+ }
+
+ // PRIVATE FUNCTIONS
+ function liveTap(e){
+
+ // Grab the clicked element
+ var $el = $(e.target);
+
+ if ($el.attr('nodeName')!=='A' && $el.attr('nodeName')!=='AREA') {
+ $el = $el.closest('a, area');
+ }
+
+ var target = $el.attr('target'),
+ hash = $el.attr('hash'),
+ animation=null;
+
+ if (tapReady == false || !$el.length) {
+ console.warn('Not able to tap element.');
+ return false;
+ }
+
+ if ($el.isExternalLink()) {
+ $el.removeClass('active');
+ return true;
+ }
+
+ // Figure out the animation to use
+ for (var i = animations.length - 1; i >= 0; i--) {
+ if ($el.is(animations[i].selector)) {
+ animation = animations[i];
+ break;
+ }
+ };
+
+ // User clicked an internal link, fullscreen mode
+ if (target == '_webapp') {
+ window.location = $el.attr('href');
+ }
+ // User clicked a back button
+ else if ($el.is(jQTSettings.backSelector)) {
+ goBack(hash);
+ }
+ // Allow tap on item with no href
+ else if ($el.attr('href') == '#') {
+ $el.unselect();
+ return true;
+ }
+ // Branch on internal or external href
+ else if (hash && hash!='#') {
+ $el.addClass('active');
+ goTo($(hash).data('referrer', $el), animation, $(this).hasClass('reverse'));
+ } else {
+ $el.addClass('loading active');
+ showPageByHref($el.attr('href'), {
+ animation: animation,
+ callback: function() {
+ $el.removeClass('loading'); setTimeout($.fn.unselect, 250, $el);
+ },
+ $referrer: $el
+ });
+ }
+ return false;
+ }
+ function addPageToHistory(page, animation, reverse) {
+ // Grab some info
+ var pageId = page.attr('id');
+ // Prepend info to page history
+ hist.unshift({
+ page: page,
+ animation: animation,
+ reverse: reverse || false,
+ id: pageId
+ });
+ }
+ function animatePages(fromPage, toPage, animation, backwards) {
+ // Error check for target page
+ if (toPage.length === 0) {
+ $.fn.unselect();
+ console.error('Target element is missing.');
+ return false;
+ }
+
+ // Error check for fromPage=toPage
+ if (toPage.hasClass('current')) {
+ $.fn.unselect();
+ console.error('Target element is the current page.');
+ return false;
+ }
+
+ // Collapse the keyboard
+ $(':focus').blur();
+
+ // Make sure we are scrolled up to hide location bar
+ scrollTo(0, 0);
+
+ // Define callback to run after animation completes
+ var callback = function animationEnd(event) {
+ if (animation) {
+ toPage.removeClass('in ' + animation.name);
+ fromPage.removeClass('current out ' + animation.name);
+ if (backwards) {
+ toPage.toggleClass('reverse');
+ fromPage.toggleClass('reverse');
+ }
+ } else {
+ fromPage.removeClass('current');
+ }
+
+ toPage.trigger('pageAnimationEnd', { direction: 'in' });
+ fromPage.trigger('pageAnimationEnd', { direction: 'out' });
+
+ clearInterval(hashCheckInterval);
+ currentPage = toPage;
+ location.hash = '#' + currentPage.attr('id');
+ startHashCheck();
+
+ var $originallink = toPage.data('referrer');
+ if ($originallink) {
+ $originallink.unselect();
+ }
+ lastAnimationTime = (new Date()).getTime();
+ tapReady = true;
+ }
+
+ fromPage.trigger('pageAnimationStart', { direction: 'out' });
+ toPage.trigger('pageAnimationStart', { direction: 'in' });
+
+ if ($.support.WebKitAnimationEvent && animation && jQTSettings.useAnimations) {
+ toPage.one('webkitAnimationEnd', callback);
+ tapReady = false;
+ if (backwards) {
+ toPage.toggleClass('reverse');
+ fromPage.toggleClass('reverse');
+ }
+ toPage.addClass(animation.name + ' in current ');
+ fromPage.addClass(animation.name + ' out');
+
+ } else {
+ toPage.addClass('current');
+ callback();
+ }
+
+ return true;
+ }
+ function hashCheck() {
+ var curid = currentPage.attr('id');
+ if (location.hash == '') {
+ location.hash = '#' + curid;
+ } else if (location.hash != '#' + curid) {
+ clearInterval(hashCheckInterval);
+ goBack(location.hash);
+ }
+ }
+ function startHashCheck() {
+ hashCheckInterval = setInterval(hashCheck, 100);
+ }
+ function insertPages(nodes, animation) {
+ var targetPage = null;
+ $(nodes).each(function(index, node) {
+ var $node = $(this);
+ if (!$node.attr('id')) {
+ $node.attr('id', 'page-' + (++newPageCount));
+ }
+
+ $body.trigger('pageInserted', {page: $node.appendTo($body)});
+
+ if ($node.hasClass('current') || !targetPage) {
+ targetPage = $node;
+ }
+ });
+ if (targetPage !== null) {
+ goTo(targetPage, animation);
+ return targetPage;
+ } else {
+ return false;
+ }
+ }
+ function showPageByHref(href, options) {
+ var defaults = {
+ data: null,
+ method: 'GET',
+ animation: null,
+ callback: null,
+ $referrer: null
+ };
+
+ var settings = $.extend({}, defaults, options);
+
+ if (href != '#') {
+ $.ajax({
+ url: href,
+ data: settings.data,
+ type: settings.method,
+ success: function (data, textStatus) {
+ var firstPage = insertPages(data, settings.animation);
+ if (firstPage) {
+ if (settings.method == 'GET' && jQTSettings.cacheGetRequests === true && settings.$referrer) {
+ settings.$referrer.attr('href', '#' + firstPage.attr('id'));
+ }
+ if (settings.callback) {
+ settings.callback(true);
+ }
+ }
+ },
+ error: function (data) {
+ if (settings.$referrer) {
+ settings.$referrer.unselect();
+ }
+ if (settings.callback) {
+ settings.callback(false);
+ }
+ }
+ });
+ }
+ else if (settings.$referrer) {
+ settings.$referrer.unselect();
+ }
+ }
+ function submitForm(e, callback) {
+ var $form = (typeof(e)==='string') ? $(e).eq(0) : (e.target ? $(e.target) : $(e));
+
+ if ($form.length && $form.is(jQTSettings.formSelector)) {
+ showPageByHref($form.attr('action'), {
+ data: $form.serialize(),
+ method: $form.attr('method') || "POST",
+ animation: animations[0] || null,
+ callback: callback
+ });
+ return false;
+ }
+ return true;
+ }
+ function submitParentForm(e) {
+ var $form = $(this).closest('form');
+ if ($form.length) {
+ evt = jQuery.Event("submit");
+ evt.preventDefault();
+ $form.trigger(evt);
+ return false;
+ }
+ return true;
+ }
+ function addAnimation(animation) {
+ if (typeof(animation.selector) == 'string' && typeof(animation.name) == 'string') {
+ animations.push(animation);
+ $(animation.selector).tap(liveTap);
+ touchSelectors.push(animation.selector);
+ }
+ }
+ function updateOrientation() {
+ orientation = window.innerWidth < window.innerHeight ? 'profile' : 'landscape';
+ $body.removeClass('profile landscape').addClass(orientation).trigger('turn', {orientation: orientation});
+ // scrollTo(0, 0);
+ }
+ function handleTouch(e) {
+ var $el = $(e.target);
+
+ // Only handle touchSelectors
+ if (!$(e.target).is(touchSelectors.join(', '))) {
+ var $link = $(e.target).closest('a, area');
+
+ if ($link.length && $link.is(touchSelectors.join(', '))) {
+ $el = $link;
+ } else {
+ return;
+ }
+ }
+
+ if (e) {
+ var hoverTimeout = null,
+ startX = event.changedTouches[0].clientX,
+ startY = event.changedTouches[0].clientY,
+ startTime = (new Date).getTime(),
+ deltaX = 0,
+ deltaY = 0,
+ deltaT = 0;
+
+ // Let's bind these after the fact, so we can keep some internal values
+ $el.bind('touchmove', touchmove).bind('touchend', touchend);
+
+ hoverTimeout = setTimeout(function() {
+ $el.makeActive();
+ }, 100);
+
+ }
+
+ // Private touch functions (TODO: insert dirty joke)
+ function touchmove(e) {
+
+ updateChanges();
+ var absX = Math.abs(deltaX);
+ var absY = Math.abs(deltaY);
+
+ // Check for swipe
+ if (absX > absY && (absX > 35) && deltaT < 1000) {
+ $el.trigger('swipe', {direction: (deltaX < 0) ? 'left' : 'right', deltaX: deltaX, deltaY: deltaY }).unbind('touchmove touchend');
+ } else if (absY > 1) {
+ $el.removeClass('active');
+ }
+
+ clearTimeout(hoverTimeout);
+ }
+
+ function touchend() {
+ updateChanges();
+
+ if (deltaY === 0 && deltaX === 0) {
+ $el.makeActive();
+ $el.trigger('tap');
+ } else {
+ $el.removeClass('active');
+ }
+ $el.unbind('touchmove touchend');
+ clearTimeout(hoverTimeout);
+ }
+
+ function updateChanges() {
+ var first = event.changedTouches[0] || null;
+ deltaX = first.pageX - startX;
+ deltaY = first.pageY - startY;
+ deltaT = (new Date).getTime() - startTime;
+ }
+
+ } // End touch handler
+
+ // Public jQuery Fns
+ $.fn.unselect = function(obj) {
+ if (obj) {
+ obj.removeClass('active');
+ } else {
+ $('.active').removeClass('active');
+ }
+ }
+ $.fn.makeActive = function() {
+ return $(this).addClass('active');
+ }
+ $.fn.swipe = function(fn) {
+ if ($.isFunction(fn)) {
+ return $(this).bind('swipe', fn);
+ } else {
+ return $(this).trigger('swipe');
+ }
+ }
+ $.fn.tap = function(fn) {
+ if ($.isFunction(fn)) {
+ var tapEvent = (jQTSettings.useFastTouch && $.support.touch) ? 'tap' : 'click';
+ return $(this).live(tapEvent, fn);
+ } else {
+ return $(this).trigger('tap');
+ }
+ }
+ $.fn.isExternalLink = function() {
+ var $el = $(this);
+ return ($el.attr('target') == '_blank' || $el.attr('rel') == 'external' || $el.is('input[type="checkbox"], input[type="radio"], a[href^="http://maps.google.com:"], a[href^="mailto:"], a[href^="tel:"], a[href^="javascript:"], a[href*="youtube.com/v"], a[href*="youtube.com/watch"]'));
+ }
+
+ publicObj = {
+ getOrientation: getOrientation,
+ goBack: goBack,
+ goTo: goTo,
+ addAnimation: addAnimation,
+ submitForm: submitForm
+ }
+
+ return publicObj;
+ }
+
+ // Extensions directly manipulate the jQTouch object, before it's initialized.
+ $.jQTouch.prototype.extensions = [];
+ $.jQTouch.addExtension = function(extension) {
+ $.jQTouch.prototype.extensions.push(extension);
+ }
+
+})(jQuery);
\ No newline at end of file diff --git a/themes/jqtouch/jqtouch.min.css b/themes/jqtouch/jqtouch.min.css new file mode 100644 index 0000000..37ef6fe --- /dev/null +++ b/themes/jqtouch/jqtouch.min.css @@ -0,0 +1 @@ +*{margin:0;padding:0;}a{-webkit-tap-highlight-color:rgba(0,0,0,0);}body{overflow-x:hidden;-webkit-user-select:none;-webkit-text-size-adjust:none;font-family:Helvetica;-webkit-perspective:800;-webkit-transform-style:preserve-3d;}.selectable,input,textarea{-webkit-user-select:auto;}body>*{-webkit-backface-visibility:hidden;-webkit-box-sizing:border-box;display:none;position:absolute;left:0;width:100%;-webkit-transform:translate3d(0,0,0) rotate(0) scale(1);min-height:420px!important;}body.fullscreen>*{min-height:460px!important;}body.fullscreen.black-translucent>*{min-height:480px!important;}body.landscape>*{min-height:320px;}body>.current{display:block!important;}.in,.out{-webkit-animation-timing-function:ease-in-out;-webkit-animation-duration:350ms;}.slide.in{-webkit-animation-name:slideinfromright;}.slide.out{-webkit-animation-name:slideouttoleft;}.slide.in.reverse{-webkit-animation-name:slideinfromleft;}.slide.out.reverse{-webkit-animation-name:slideouttoright;}@-webkit-keyframes slideinfromright{from{-webkit-transform:translateX(100%);}to{-webkit-transform:translateX(0);}}@-webkit-keyframes slideinfromleft{from{-webkit-transform:translateX(-100%);}to{-webkit-transform:translateX(0);}}@-webkit-keyframes slideouttoleft{from{-webkit-transform:translateX(0);}to{-webkit-transform:translateX(-100%);}}@-webkit-keyframes slideouttoright{from{-webkit-transform:translateX(0);}to{-webkit-transform:translateX(100%);}}@-webkit-keyframes fadein{from{opacity:0;}to{opacity:1;}}@-webkit-keyframes fadeout{from{opacity:1;}to{opacity:0;}}.fade.in{z-index:10;-webkit-animation-name:fadein;}.fade.out{z-index:0;}.dissolve.in{-webkit-animation-name:fadein;}.dissolve.out{-webkit-animation-name:fadeout;}.flip{-webkit-animation-duration:.65s;}.flip.in{-webkit-animation-name:flipinfromleft;}.flip.out{-webkit-animation-name:flipouttoleft;}.flip.in.reverse{-webkit-animation-name:flipinfromright;}.flip.out.reverse{-webkit-animation-name:flipouttoright;}@-webkit-keyframes flipinfromright{from{-webkit-transform:rotateY(-180deg) scale(.8);}to{-webkit-transform:rotateY(0) scale(1);}}@-webkit-keyframes flipinfromleft{from{-webkit-transform:rotateY(180deg) scale(.8);}to{-webkit-transform:rotateY(0) scale(1);}}@-webkit-keyframes flipouttoleft{from{-webkit-transform:rotateY(0) scale(1);}to{-webkit-transform:rotateY(-180deg) scale(.8);}}@-webkit-keyframes flipouttoright{from{-webkit-transform:rotateY(0) scale(1);}to{-webkit-transform:rotateY(180deg) scale(.8);}}.slideup.in{-webkit-animation-name:slideup;z-index:10;}.slideup.out{-webkit-animation-name:dontmove;z-index:0;}.slideup.out.reverse{z-index:10;-webkit-animation-name:slidedown;}.slideup.in.reverse{z-index:0;-webkit-animation-name:dontmove;}@-webkit-keyframes slideup{from{-webkit-transform:translateY(100%);}to{-webkit-transform:translateY(0);}}@-webkit-keyframes slidedown{from{-webkit-transform:translateY(0);}to{-webkit-transform:translateY(100%);}}@-webkit-keyframes dontmove{from{opacity:1;}to{opacity:1;}}.swap{-webkit-transform:perspective(800);-webkit-animation-duration:.7s;}.swap.out{-webkit-animation-name:swapouttoleft;}.swap.in{-webkit-animation-name:swapinfromright;}.swap.out.reverse{-webkit-animation-name:swapouttoright;}.swap.in.reverse{-webkit-animation-name:swapinfromleft;}@-webkit-keyframes swapouttoright{0%{-webkit-transform:translate3d(0px,0px,0px) rotateY(0deg);-webkit-animation-timing-function:ease-in-out;}50%{-webkit-transform:translate3d(-180px,0px,-400px) rotateY(20deg);-webkit-animation-timing-function:ease-in;}100%{-webkit-transform:translate3d(0px,0px,-800px) rotateY(70deg);}}@-webkit-keyframes swapouttoleft{0%{-webkit-transform:translate3d(0px,0px,0px) rotateY(0deg);-webkit-animation-timing-function:ease-in-out;}50%{-webkit-transform:translate3d(180px,0px,-400px) rotateY(-20deg);-webkit-animation-timing-function:ease-in;}100%{-webkit-transform:translate3d(0px,0px,-800px) rotateY(-70deg);}}@-webkit-keyframes swapinfromright{0%{-webkit-transform:translate3d(0px,0px,-800px) rotateY(70deg);-webkit-animation-timing-function:ease-out;}50%{-webkit-transform:translate3d(-180px,0px,-400px) rotateY(20deg);-webkit-animation-timing-function:ease-in-out;}100%{-webkit-transform:translate3d(0px,0px,0px) rotateY(0deg);}}@-webkit-keyframes swapinfromleft{0%{-webkit-transform:translate3d(0px,0px,-800px) rotateY(-70deg);-webkit-animation-timing-function:ease-out;}50%{-webkit-transform:translate3d(180px,0px,-400px) rotateY(-20deg);-webkit-animation-timing-function:ease-in-out;}100%{-webkit-transform:translate3d(0px,0px,0px) rotateY(0deg);}}.cube{-webkit-animation-duration:.55s;}.cube.in{-webkit-animation-name:cubeinfromright;-webkit-transform-origin:0 50%;}.cube.out{-webkit-animation-name:cubeouttoleft;-webkit-transform-origin:100% 50%;}.cube.in.reverse{-webkit-animation-name:cubeinfromleft;-webkit-transform-origin:100% 50%;}.cube.out.reverse{-webkit-animation-name:cubeouttoright;-webkit-transform-origin:0 50%;}@-webkit-keyframes cubeinfromleft{from{-webkit-transform:rotateY(-90deg) translateZ(320px);opacity:.5;}to{-webkit-transform:rotateY(0deg) translateZ(0);opacity:1;}}@-webkit-keyframes cubeouttoright{from{-webkit-transform:rotateY(0deg) translateX(0);opacity:1;}to{-webkit-transform:rotateY(90deg) translateZ(320px);opacity:.5;}}@-webkit-keyframes cubeinfromright{from{-webkit-transform:rotateY(90deg) translateZ(320px);opacity:.5;}to{-webkit-transform:rotateY(0deg) translateZ(0);opacity:1;}}@-webkit-keyframes cubeouttoleft{from{-webkit-transform:rotateY(0deg) translateZ(0);opacity:1;}to{-webkit-transform:rotateY(-90deg) translateZ(320px);opacity:.5;}}.pop{-webkit-transform-origin:50% 50%;}.pop.in{-webkit-animation-name:popin;z-index:10;}.pop.out.reverse{-webkit-animation-name:popout;z-index:10;}.pop.in.reverse{z-index:0;-webkit-animation-name:dontmove;}@-webkit-keyframes popin{from{-webkit-transform:scale(.2);opacity:0;}to{-webkit-transform:scale(1);opacity:1;}}@-webkit-keyframes popout{from{-webkit-transform:scale(1);opacity:1;}to{-webkit-transform:scale(.2);opacity:0;}}
\ No newline at end of file diff --git a/themes/jqtouch/jqtouch.min.js b/themes/jqtouch/jqtouch.min.js new file mode 100644 index 0000000..f43917e --- /dev/null +++ b/themes/jqtouch/jqtouch.min.js @@ -0,0 +1 @@ +(function($){$.jQTouch=function(_2){$.support.WebKitCSSMatrix=(typeof WebKitCSSMatrix=="object");$.support.touch=(typeof Touch=="object");$.support.WebKitAnimationEvent=(typeof WebKitTransitionEvent=="object");var _3,$head=$("head"),hist=[],newPageCount=0,jQTSettings={},hashCheck,currentPage,orientation,isMobileWebKit=RegExp(" Mobile/").test(navigator.userAgent),tapReady=true,lastAnimationTime=0,touchSelectors=[],publicObj={},extensions=$.jQTouch.prototype.extensions,defaultAnimations=["slide","flip","slideup","swap","cube","pop","dissolve","fade","back"],animations=[],hairextensions="";init(_2);function init(_4){var _5={addGlossToIcon:true,backSelector:".back, .cancel, .goback",cacheGetRequests:true,cubeSelector:".cube",dissolveSelector:".dissolve",fadeSelector:".fade",fixedViewport:true,flipSelector:".flip",formSelector:"form",fullScreen:true,fullScreenClass:"fullscreen",icon:null,touchSelector:"a, .touch",popSelector:".pop",preloadImages:false,slideSelector:"body > * > ul li a",slideupSelector:".slideup",startupScreen:null,statusBar:"default",submitSelector:".submit",swapSelector:".swap",useAnimations:true,useFastTouch:true};jQTSettings=$.extend({},_5,_4);if(jQTSettings.preloadImages){for(var i=jQTSettings.preloadImages.length-1;i>=0;i--){(new Image()).src=jQTSettings.preloadImages[i];}}if(jQTSettings.icon){var _7=(jQTSettings.addGlossToIcon)?"":"-precomposed";hairextensions+="<link rel=\"apple-touch-icon"+_7+"\" href=\""+jQTSettings.icon+"\" />";}if(jQTSettings.startupScreen){hairextensions+="<link rel=\"apple-touch-startup-image\" href=\""+jQTSettings.startupScreen+"\" />";}if(jQTSettings.fixedViewport){hairextensions+="<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;\"/>";}if(jQTSettings.fullScreen){hairextensions+="<meta name=\"apple-mobile-web-app-capable\" content=\"yes\" />";if(jQTSettings.statusBar){hairextensions+="<meta name=\"apple-mobile-web-app-status-bar-style\" content=\""+jQTSettings.statusBar+"\" />";}}if(hairextensions){$head.append(hairextensions);}$(document).ready(function(){for(var i in extensions){var fn=extensions[i];if($.isFunction(fn)){$.extend(publicObj,fn(publicObj));}}for(var i in defaultAnimations){var _a=defaultAnimations[i];var _b=jQTSettings[_a+"Selector"];if(typeof (_b)=="string"){addAnimation({name:_a,selector:_b});}}touchSelectors.push("input");touchSelectors.push(jQTSettings.touchSelector);touchSelectors.push(jQTSettings.backSelector);touchSelectors.push(jQTSettings.submitSelector);$(touchSelectors.join(", ")).css("-webkit-touch-callout","none");$(jQTSettings.backSelector).tap(liveTap);$(jQTSettings.submitSelector).tap(submitParentForm);_3=$("body");if(jQTSettings.fullScreenClass&&window.navigator.standalone==true){_3.addClass(jQTSettings.fullScreenClass+" "+jQTSettings.statusBar);}_3.bind("touchstart",handleTouch).bind("orientationchange",updateOrientation).trigger("orientationchange").submit(submitForm);if(jQTSettings.useFastTouch&&$.support.touch){_3.click(function(e){var _d=$(e.target);if(_d.attr("target")=="_blank"||_d.attr("rel")=="external"||_d.is("input[type=\"checkbox\"]")){return true;}else{return false;}});_3.mousedown(function(e){var _f=(new Date()).getTime()-lastAnimationTime;if(_f<200){return false;}});}if($("body > .current").length==0){currentPage=$("body > *:first");}else{currentPage=$("body > .current:first");$("body > .current").removeClass("current");}$(currentPage).addClass("current");location.hash=$(currentPage).attr("id");addPageToHistory(currentPage);scrollTo(0,0);dumbLoopStart();});}function goBack(to){if(hist.length>1){var _11=Math.min(parseInt(to||1,10),hist.length-1);if(isNaN(_11)&&typeof (to)==="string"&&to!="#"){for(var i=1,length=hist.length;i<length;i++){if("#"+hist[i].id===to){_11=i;break;}}}if(isNaN(_11)||_11<1){_11=1;}var _13=hist[0].animation;var _14=hist[0].page;hist.splice(0,_11);var _15=hist[0].page;animatePages(_14,_15,_13,true);return publicObj;}else{console.error("No pages in history.");return false;}}function goTo(_16,_17){var _18=hist[0].page;if(typeof (_16)==="string"){_16=$(_16);}if(typeof (_17)==="string"){for(var i=animations.length-1;i>=0;i--){if(animations[i].name===_17){_17=animations[i];break;}}}if(animatePages(_18,_16,_17)){addPageToHistory(_16,_17);return publicObj;}else{console.error("Could not animate pages.");return false;}}function getOrientation(){return orientation;}function liveTap(e){var $el=$(e.target);if($el.attr("nodeName")!=="A"){$el=$el.parent("a");}var _1c=$el.attr("target"),hash=$el.attr("hash"),animation=null;if(tapReady==false||!$el.length){console.warn("Not able to tap element.");return false;}if($el.attr("target")=="_blank"||$el.attr("rel")=="external"){return true;}for(var i=animations.length-1;i>=0;i--){if($el.is(animations[i].selector)){animation=animations[i];break;}}if(_1c=="_webapp"){window.location=$el.attr("href");}else{if($el.is(jQTSettings.backSelector)){goBack(hash);}else{if(hash&&hash!="#"){$el.addClass("active");goTo($(hash).data("referrer",$el),animation);}else{$el.addClass("loading active");showPageByHref($el.attr("href"),{animation:animation,callback:function(){$el.removeClass("loading");setTimeout($.fn.unselect,250,$el);},$referrer:$el});}}}return false;}function addPageToHistory(_1e,_1f){var _20=_1e.attr("id");hist.unshift({page:_1e,animation:_1f,id:_20});}function animatePages(_21,_22,_23,_24){if(_22.length===0){$.fn.unselect();console.error("Target element is missing.");return false;}$(":focus").blur();scrollTo(0,0);var _25=function(_26){if(_23){_22.removeClass("in reverse "+_23.name);_21.removeClass("current out reverse "+_23.name);}else{_21.removeClass("current");}_22.trigger("pageAnimationEnd",{direction:"in"});_21.trigger("pageAnimationEnd",{direction:"out"});clearInterval(dumbLoop);currentPage=_22;location.hash=currentPage.attr("id");dumbLoopStart();var _27=_22.data("referrer");if(_27){_27.unselect();}lastAnimationTime=(new Date()).getTime();tapReady=true;};_21.trigger("pageAnimationStart",{direction:"out"});_22.trigger("pageAnimationStart",{direction:"in"});if($.support.WebKitAnimationEvent&&_23&&jQTSettings.useAnimations){_22.one("webkitAnimationEnd",_25);tapReady=false;_22.addClass(_23.name+" in current "+(_24?" reverse":""));_21.addClass(_23.name+" out"+(_24?" reverse":""));}else{_22.addClass("current");_25();}return true;}function dumbLoopStart(){dumbLoop=setInterval(function(){var _28=currentPage.attr("id");if(location.hash==""){location.hash="#"+_28;}else{if(location.hash!="#"+_28){try{goBack(location.hash);}catch(e){console.error("Unknown hash change.");}}}},100);}function insertPages(_29,_2a){var _2b=null;$(_29).each(function(_2c,_2d){var _2e=$(this);if(!_2e.attr("id")){_2e.attr("id","page-"+(++newPageCount));}_2e.appendTo(_3);if(_2e.hasClass("current")||!_2b){_2b=_2e;}});if(_2b!==null){goTo(_2b,_2a);return _2b;}else{return false;}}function showPageByHref(_2f,_30){var _31={data:null,method:"GET",animation:null,callback:null,$referrer:null};var _32=$.extend({},_31,_30);if(_2f!="#"){$.ajax({url:_2f,data:_32.data,type:_32.method,success:function(_33,_34){var _35=insertPages(_33,_32.animation);if(_35){if(_32.method=="GET"&&jQTSettings.cacheGetRequests&&_32.$referrer){_32.$referrer.attr("href","#"+_35.attr("id"));}if(_32.callback){_32.callback(true);}}},error:function(_36){if(_32.$referrer){_32.$referrer.unselect();}if(_32.callback){_32.callback(false);}}});}else{if($referrer){$referrer.unselect();}}}function submitForm(e,_38){var _39=(typeof (e)==="string")?$(e):$(e.target);if(_39.length&&_39.is(jQTSettings.formSelector)&&_39.attr("action")){showPageByHref(_39.attr("action"),{data:_39.serialize(),method:_39.attr("method")||"POST",animation:animations[0]||null,callback:_38});return false;}return true;}function submitParentForm(e){var _3b=$(this).closest("form");if(_3b.length){evt=jQuery.Event("submit");evt.preventDefault();_3b.trigger(evt);return false;}return true;}function addAnimation(_3c){if(typeof (_3c.selector)=="string"&&typeof (_3c.name)=="string"){animations.push(_3c);$(_3c.selector).tap(liveTap);touchSelectors.push(_3c.selector);}}function updateOrientation(){orientation=window.innerWidth<window.innerHeight?"profile":"landscape";_3.removeClass("profile landscape").addClass(orientation).trigger("turn",{orientation:orientation});}function handleTouch(e){var $el=$(e.target);if(!$(e.target).is(touchSelectors.join(", "))){var _3f=$(e.target).closest("a");if(_3f.length){$el=_3f;}else{return;}}if(event){var _40=null,startX=event.changedTouches[0].clientX,startY=event.changedTouches[0].clientY,startTime=(new Date).getTime(),deltaX=0,deltaY=0,deltaT=0;$el.bind("touchmove",touchmove).bind("touchend",touchend);_40=setTimeout(function(){$el.makeActive();},100);}function touchmove(e){updateChanges();var _42=Math.abs(deltaX);var _43=Math.abs(deltaY);if(_42>_43&&(_42>35)&&deltaT<1000){$el.trigger("swipe",{direction:(deltaX<0)?"left":"right"}).unbind("touchmove touchend");}else{if(_43>1){$el.removeClass("active");}}clearTimeout(_40);}function touchend(){updateChanges();if(deltaY===0&&deltaX===0){$el.makeActive();$el.trigger("tap");}else{$el.removeClass("active");}$el.unbind("touchmove touchend");clearTimeout(_40);}function updateChanges(){var _44=event.changedTouches[0]||null;deltaX=_44.pageX-startX;deltaY=_44.pageY-startY;deltaT=(new Date).getTime()-startTime;}}$.fn.unselect=function(obj){if(obj){obj.removeClass("active");}else{$(".active").removeClass("active");}};$.fn.makeActive=function(){return $(this).addClass("active");};$.fn.swipe=function(fn){if($.isFunction(fn)){return this.each(function(i,el){$(el).bind("swipe",fn);});}};$.fn.tap=function(fn){if($.isFunction(fn)){var _4a=(jQTSettings.useFastTouch&&$.support.touch)?"tap":"click";return $(this).live(_4a,fn);}else{$(this).trigger("tap");}};publicObj={getOrientation:getOrientation,goBack:goBack,goTo:goTo,addAnimation:addAnimation,submitForm:submitForm};return publicObj;};$.jQTouch.prototype.extensions=[];$.jQTouch.addExtension=function(_4b){$.jQTouch.prototype.extensions.push(_4b);};})(jQuery);
\ No newline at end of file diff --git a/themes/jqtouch/jqtouch.transitions.js b/themes/jqtouch/jqtouch.transitions.js new file mode 100644 index 0000000..3fcdc02 --- /dev/null +++ b/themes/jqtouch/jqtouch.transitions.js @@ -0,0 +1,60 @@ +/*
+
+ _/ _/_/ _/_/_/_/_/ _/
+ _/ _/ _/ _/_/ _/ _/ _/_/_/ _/_/_/
+ _/ _/ _/_/ _/ _/ _/ _/ _/ _/ _/ _/
+ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/
+ _/ _/_/ _/ _/ _/_/ _/_/_/ _/_/_/ _/ _/
+ _/
+ _/
+
+ Created by David Kaneda <http://www.davidkaneda.com>
+ Documentation and issue tracking on Google Code <http://code.google.com/p/jqtouch/>
+
+ Special thanks to Jonathan Stark <http://jonathanstark.com/>
+ and pinch/zoom <http://www.pinchzoom.com/>
+
+ (c) 2009 by jQTouch project members.
+ See LICENSE.txt for license.
+
+*/
+
+(function($) {
+
+ $.fn.transition = function(css, options) {
+ return this.each(function(){
+ var $el = $(this);
+ var defaults = {
+ speed : '300ms',
+ callback: null,
+ ease: 'ease-in-out'
+ };
+ var settings = $.extend({}, defaults, options);
+ if(settings.speed === 0) {
+ $el.css(css);
+ window.setTimeout(settings.callback, 0);
+ } else {
+ if ($.browser.safari)
+ {
+ var s = [];
+ for(var i in css) {
+ s.push(i);
+ }
+ $el.css({
+ webkitTransitionProperty: s.join(", "),
+ webkitTransitionDuration: settings.speed,
+ webkitTransitionTimingFunction: settings.ease
+ });
+ if (settings.callback) {
+ $el.one('webkitTransitionEnd', settings.callback);
+ }
+ setTimeout(function(el){ el.css(css) }, 0, $el);
+ }
+ else
+ {
+ $el.animate(css, settings.speed, settings.callback);
+ }
+ }
+ });
+ }
+})(jQuery);
\ No newline at end of file diff --git a/themes/jqtouch/jquery.1.3.2.min.js b/themes/jqtouch/jquery.1.3.2.min.js new file mode 100644 index 0000000..55c2e6d --- /dev/null +++ b/themes/jqtouch/jquery.1.3.2.min.js @@ -0,0 +1,19 @@ +/*
+ * jQuery JavaScript Library v1.3.2
+ * http://jquery.com/
+ *
+ * Copyright (c) 2009 John Resig
+ * Dual licensed under the MIT and GPL licenses.
+ * http://docs.jquery.com/License
+ *
+ * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009)
+ * Revision: 6246
+ */
+(function(){var l=this,g,y=l.jQuery,p=l.$,o=l.jQuery=l.$=function(E,F){return new o.fn.init(E,F)},D=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;o.fn=o.prototype={init:function(E,H){E=E||document;if(E.nodeType){this[0]=E;this.length=1;this.context=E;return this}if(typeof E==="string"){var G=D.exec(E);if(G&&(G[1]||!H)){if(G[1]){E=o.clean([G[1]],H)}else{var I=document.getElementById(G[3]);if(I&&I.id!=G[3]){return o().find(E)}var F=o(I||[]);F.context=document;F.selector=E;return F}}else{return o(H).find(E)}}else{if(o.isFunction(E)){return o(document).ready(E)}}if(E.selector&&E.context){this.selector=E.selector;this.context=E.context}return this.setArray(o.isArray(E)?E:o.makeArray(E))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(E){return E===g?Array.prototype.slice.call(this):this[E]},pushStack:function(F,H,E){var G=o(F);G.prevObject=this;G.context=this.context;if(H==="find"){G.selector=this.selector+(this.selector?" ":"")+E}else{if(H){G.selector=this.selector+"."+H+"("+E+")"}}return G},setArray:function(E){this.length=0;Array.prototype.push.apply(this,E);return this},each:function(F,E){return o.each(this,F,E)},index:function(E){return o.inArray(E&&E.jquery?E[0]:E,this)},attr:function(F,H,G){var E=F;if(typeof F==="string"){if(H===g){return this[0]&&o[G||"attr"](this[0],F)}else{E={};E[F]=H}}return this.each(function(I){for(F in E){o.attr(G?this.style:this,F,o.prop(this,E[F],G,I,F))}})},css:function(E,F){if((E=="width"||E=="height")&&parseFloat(F)<0){F=g}return this.attr(E,F,"curCSS")},text:function(F){if(typeof F!=="object"&&F!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(F))}var E="";o.each(F||this,function(){o.each(this.childNodes,function(){if(this.nodeType!=8){E+=this.nodeType!=1?this.nodeValue:o.fn.text([this])}})});return E},wrapAll:function(E){if(this[0]){var F=o(E,this[0].ownerDocument).clone();if(this[0].parentNode){F.insertBefore(this[0])}F.map(function(){var G=this;while(G.firstChild){G=G.firstChild}return G}).append(this)}return this},wrapInner:function(E){return this.each(function(){o(this).contents().wrapAll(E)})},wrap:function(E){return this.each(function(){o(this).wrapAll(E)})},append:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.appendChild(E)}})},prepend:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.insertBefore(E,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this)})},after:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this.nextSibling)})},end:function(){return this.prevObject||o([])},push:[].push,sort:[].sort,splice:[].splice,find:function(E){if(this.length===1){var F=this.pushStack([],"find",E);F.length=0;o.find(E,this[0],F);return F}else{return this.pushStack(o.unique(o.map(this,function(G){return o.find(E,G)})),"find",E)}},clone:function(G){var E=this.map(function(){if(!o.support.noCloneEvent&&!o.isXMLDoc(this)){var I=this.outerHTML;if(!I){var J=this.ownerDocument.createElement("div");J.appendChild(this.cloneNode(true));I=J.innerHTML}return o.clean([I.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else{return this.cloneNode(true)}});if(G===true){var H=this.find("*").andSelf(),F=0;E.find("*").andSelf().each(function(){if(this.nodeName!==H[F].nodeName){return}var I=o.data(H[F],"events");for(var K in I){for(var J in I[K]){o.event.add(this,K,I[K][J],I[K][J].data)}}F++})}return E},filter:function(E){return this.pushStack(o.isFunction(E)&&o.grep(this,function(G,F){return E.call(G,F)})||o.multiFilter(E,o.grep(this,function(F){return F.nodeType===1})),"filter",E)},closest:function(E){var G=o.expr.match.POS.test(E)?o(E):null,F=0;return this.map(function(){var H=this;while(H&&H.ownerDocument){if(G?G.index(H)>-1:o(H).is(E)){o.data(H,"closest",F);return H}H=H.parentNode;F++}})},not:function(E){if(typeof E==="string"){if(f.test(E)){return this.pushStack(o.multiFilter(E,this,true),"not",E)}else{E=o.multiFilter(E,this)}}var F=E.length&&E[E.length-1]!==g&&!E.nodeType;return this.filter(function(){return F?o.inArray(this,E)<0:this!=E})},add:function(E){return this.pushStack(o.unique(o.merge(this.get(),typeof E==="string"?o(E):o.makeArray(E))))},is:function(E){return !!E&&o.multiFilter(E,this).length>0},hasClass:function(E){return !!E&&this.is("."+E)},val:function(K){if(K===g){var E=this[0];if(E){if(o.nodeName(E,"option")){return(E.attributes.value||{}).specified?E.value:E.text}if(o.nodeName(E,"select")){var I=E.selectedIndex,L=[],M=E.options,H=E.type=="select-one";if(I<0){return null}for(var F=H?I:0,J=H?I+1:M.length;F<J;F++){var G=M[F];if(G.selected){K=o(G).val();if(H){return K}L.push(K)}}return L}return(E.value||"").replace(/\r/g,"")}return g}if(typeof K==="number"){K+=""}return this.each(function(){if(this.nodeType!=1){return}if(o.isArray(K)&&/radio|checkbox/.test(this.type)){this.checked=(o.inArray(this.value,K)>=0||o.inArray(this.name,K)>=0)}else{if(o.nodeName(this,"select")){var N=o.makeArray(K);o("option",this).each(function(){this.selected=(o.inArray(this.value,N)>=0||o.inArray(this.text,N)>=0)});if(!N.length){this.selectedIndex=-1}}else{this.value=K}}})},html:function(E){return E===g?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(E)},replaceWith:function(E){return this.after(E).remove()},eq:function(E){return this.slice(E,+E+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(E){return this.pushStack(o.map(this,function(G,F){return E.call(G,F,G)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(J,M,L){if(this[0]){var I=(this[0].ownerDocument||this[0]).createDocumentFragment(),F=o.clean(J,(this[0].ownerDocument||this[0]),I),H=I.firstChild;if(H){for(var G=0,E=this.length;G<E;G++){L.call(K(this[G],H),this.length>1||G>0?I.cloneNode(true):I)}}if(F){o.each(F,z)}}return this;function K(N,O){return M&&o.nodeName(N,"table")&&o.nodeName(O,"tr")?(N.getElementsByTagName("tbody")[0]||N.appendChild(N.ownerDocument.createElement("tbody"))):N}}};o.fn.init.prototype=o.fn;function z(E,F){if(F.src){o.ajax({url:F.src,async:false,dataType:"script"})}else{o.globalEval(F.text||F.textContent||F.innerHTML||"")}if(F.parentNode){F.parentNode.removeChild(F)}}function e(){return +new Date}o.extend=o.fn.extend=function(){var J=arguments[0]||{},H=1,I=arguments.length,E=false,G;if(typeof J==="boolean"){E=J;J=arguments[1]||{};H=2}if(typeof J!=="object"&&!o.isFunction(J)){J={}}if(I==H){J=this;--H}for(;H<I;H++){if((G=arguments[H])!=null){for(var F in G){var K=J[F],L=G[F];if(J===L){continue}if(E&&L&&typeof L==="object"&&!L.nodeType){J[F]=o.extend(E,K||(L.length!=null?[]:{}),L)}else{if(L!==g){J[F]=L}}}}}return J};var b=/z-?index|font-?weight|opacity|zoom|line-?height/i,q=document.defaultView||{},s=Object.prototype.toString;o.extend({noConflict:function(E){l.$=p;if(E){l.jQuery=y}return o},isFunction:function(E){return s.call(E)==="[object Function]"},isArray:function(E){return s.call(E)==="[object Array]"},isXMLDoc:function(E){return E.nodeType===9&&E.documentElement.nodeName!=="HTML"||!!E.ownerDocument&&o.isXMLDoc(E.ownerDocument)},globalEval:function(G){if(G&&/\S/.test(G)){var F=document.getElementsByTagName("head")[0]||document.documentElement,E=document.createElement("script");E.type="text/javascript";if(o.support.scriptEval){E.appendChild(document.createTextNode(G))}else{E.text=G}F.insertBefore(E,F.firstChild);F.removeChild(E)}},nodeName:function(F,E){return F.nodeName&&F.nodeName.toUpperCase()==E.toUpperCase()},each:function(G,K,F){var E,H=0,I=G.length;if(F){if(I===g){for(E in G){if(K.apply(G[E],F)===false){break}}}else{for(;H<I;){if(K.apply(G[H++],F)===false){break}}}}else{if(I===g){for(E in G){if(K.call(G[E],E,G[E])===false){break}}}else{for(var J=G[0];H<I&&K.call(J,H,J)!==false;J=G[++H]){}}}return G},prop:function(H,I,G,F,E){if(o.isFunction(I)){I=I.call(H,F)}return typeof I==="number"&&G=="curCSS"&&!b.test(E)?I+"px":I},className:{add:function(E,F){o.each((F||"").split(/\s+/),function(G,H){if(E.nodeType==1&&!o.className.has(E.className,H)){E.className+=(E.className?" ":"")+H}})},remove:function(E,F){if(E.nodeType==1){E.className=F!==g?o.grep(E.className.split(/\s+/),function(G){return !o.className.has(F,G)}).join(" "):""}},has:function(F,E){return F&&o.inArray(E,(F.className||F).toString().split(/\s+/))>-1}},swap:function(H,G,I){var E={};for(var F in G){E[F]=H.style[F];H.style[F]=G[F]}I.call(H);for(var F in G){H.style[F]=E[F]}},css:function(H,F,J,E){if(F=="width"||F=="height"){var L,G={position:"absolute",visibility:"hidden",display:"block"},K=F=="width"?["Left","Right"]:["Top","Bottom"];function I(){L=F=="width"?H.offsetWidth:H.offsetHeight;if(E==="border"){return}o.each(K,function(){if(!E){L-=parseFloat(o.curCSS(H,"padding"+this,true))||0}if(E==="margin"){L+=parseFloat(o.curCSS(H,"margin"+this,true))||0}else{L-=parseFloat(o.curCSS(H,"border"+this+"Width",true))||0}})}if(H.offsetWidth!==0){I()}else{o.swap(H,G,I)}return Math.max(0,Math.round(L))}return o.curCSS(H,F,J)},curCSS:function(I,F,G){var L,E=I.style;if(F=="opacity"&&!o.support.opacity){L=o.attr(E,"opacity");return L==""?"1":L}if(F.match(/float/i)){F=w}if(!G&&E&&E[F]){L=E[F]}else{if(q.getComputedStyle){if(F.match(/float/i)){F="float"}F=F.replace(/([A-Z])/g,"-$1").toLowerCase();var M=q.getComputedStyle(I,null);if(M){L=M.getPropertyValue(F)}if(F=="opacity"&&L==""){L="1"}}else{if(I.currentStyle){var J=F.replace(/\-(\w)/g,function(N,O){return O.toUpperCase()});L=I.currentStyle[F]||I.currentStyle[J];if(!/^\d+(px)?$/i.test(L)&&/^\d/.test(L)){var H=E.left,K=I.runtimeStyle.left;I.runtimeStyle.left=I.currentStyle.left;E.left=L||0;L=E.pixelLeft+"px";E.left=H;I.runtimeStyle.left=K}}}}return L},clean:function(F,K,I){K=K||document;if(typeof K.createElement==="undefined"){K=K.ownerDocument||K[0]&&K[0].ownerDocument||document}if(!I&&F.length===1&&typeof F[0]==="string"){var H=/^<(\w+)\s*\/?>$/.exec(F[0]);if(H){return[K.createElement(H[1])]}}var G=[],E=[],L=K.createElement("div");o.each(F,function(P,S){if(typeof S==="number"){S+=""}if(!S){return}if(typeof S==="string"){S=S.replace(/(<(\w+)[^>]*?)\/>/g,function(U,V,T){return T.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?U:V+"></"+T+">"});var O=S.replace(/^\s+/,"").substring(0,10).toLowerCase();var Q=!O.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!O.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||O.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!O.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!O.indexOf("<td")||!O.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!O.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||!o.support.htmlSerialize&&[1,"div<div>","</div>"]||[0,"",""];L.innerHTML=Q[1]+S+Q[2];while(Q[0]--){L=L.lastChild}if(!o.support.tbody){var R=/<tbody/i.test(S),N=!O.indexOf("<table")&&!R?L.firstChild&&L.firstChild.childNodes:Q[1]=="<table>"&&!R?L.childNodes:[];for(var M=N.length-1;M>=0;--M){if(o.nodeName(N[M],"tbody")&&!N[M].childNodes.length){N[M].parentNode.removeChild(N[M])}}}if(!o.support.leadingWhitespace&&/^\s/.test(S)){L.insertBefore(K.createTextNode(S.match(/^\s*/)[0]),L.firstChild)}S=o.makeArray(L.childNodes)}if(S.nodeType){G.push(S)}else{G=o.merge(G,S)}});if(I){for(var J=0;G[J];J++){if(o.nodeName(G[J],"script")&&(!G[J].type||G[J].type.toLowerCase()==="text/javascript")){E.push(G[J].parentNode?G[J].parentNode.removeChild(G[J]):G[J])}else{if(G[J].nodeType===1){G.splice.apply(G,[J+1,0].concat(o.makeArray(G[J].getElementsByTagName("script"))))}I.appendChild(G[J])}}return E}return G},attr:function(J,G,K){if(!J||J.nodeType==3||J.nodeType==8){return g}var H=!o.isXMLDoc(J),L=K!==g;G=H&&o.props[G]||G;if(J.tagName){var F=/href|src|style/.test(G);if(G=="selected"&&J.parentNode){J.parentNode.selectedIndex}if(G in J&&H&&!F){if(L){if(G=="type"&&o.nodeName(J,"input")&&J.parentNode){throw"type property can't be changed"}J[G]=K}if(o.nodeName(J,"form")&&J.getAttributeNode(G)){return J.getAttributeNode(G).nodeValue}if(G=="tabIndex"){var I=J.getAttributeNode("tabIndex");return I&&I.specified?I.value:J.nodeName.match(/(button|input|object|select|textarea)/i)?0:J.nodeName.match(/^(a|area)$/i)&&J.href?0:g}return J[G]}if(!o.support.style&&H&&G=="style"){return o.attr(J.style,"cssText",K)}if(L){J.setAttribute(G,""+K)}var E=!o.support.hrefNormalized&&H&&F?J.getAttribute(G,2):J.getAttribute(G);return E===null?g:E}if(!o.support.opacity&&G=="opacity"){if(L){J.zoom=1;J.filter=(J.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(K)+""=="NaN"?"":"alpha(opacity="+K*100+")")}return J.filter&&J.filter.indexOf("opacity=")>=0?(parseFloat(J.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}G=G.replace(/-([a-z])/ig,function(M,N){return N.toUpperCase()});if(L){J[G]=K}return J[G]},trim:function(E){return(E||"").replace(/^\s+|\s+$/g,"")},makeArray:function(G){var E=[];if(G!=null){var F=G.length;if(F==null||typeof G==="string"||o.isFunction(G)||G.setInterval){E[0]=G}else{while(F){E[--F]=G[F]}}}return E},inArray:function(G,H){for(var E=0,F=H.length;E<F;E++){if(H[E]===G){return E}}return -1},merge:function(H,E){var F=0,G,I=H.length;if(!o.support.getAll){while((G=E[F++])!=null){if(G.nodeType!=8){H[I++]=G}}}else{while((G=E[F++])!=null){H[I++]=G}}return H},unique:function(K){var F=[],E={};try{for(var G=0,H=K.length;G<H;G++){var J=o.data(K[G]);if(!E[J]){E[J]=true;F.push(K[G])}}}catch(I){F=K}return F},grep:function(F,J,E){var G=[];for(var H=0,I=F.length;H<I;H++){if(!E!=!J(F[H],H)){G.push(F[H])}}return G},map:function(E,J){var F=[];for(var G=0,H=E.length;G<H;G++){var I=J(E[G],G);if(I!=null){F[F.length]=I}}return F.concat.apply([],F)}});var C=navigator.userAgent.toLowerCase();o.browser={version:(C.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1],safari:/webkit/.test(C),opera:/opera/.test(C),msie:/msie/.test(C)&&!/opera/.test(C),mozilla:/mozilla/.test(C)&&!/(compatible|webkit)/.test(C)};o.each({parent:function(E){return E.parentNode},parents:function(E){return o.dir(E,"parentNode")},next:function(E){return o.nth(E,2,"nextSibling")},prev:function(E){return o.nth(E,2,"previousSibling")},nextAll:function(E){return o.dir(E,"nextSibling")},prevAll:function(E){return o.dir(E,"previousSibling")},siblings:function(E){return o.sibling(E.parentNode.firstChild,E)},children:function(E){return o.sibling(E.firstChild)},contents:function(E){return o.nodeName(E,"iframe")?E.contentDocument||E.contentWindow.document:o.makeArray(E.childNodes)}},function(E,F){o.fn[E]=function(G){var H=o.map(this,F);if(G&&typeof G=="string"){H=o.multiFilter(G,H)}return this.pushStack(o.unique(H),E,G)}});o.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(E,F){o.fn[E]=function(G){var J=[],L=o(G);for(var K=0,H=L.length;K<H;K++){var I=(K>0?this.clone(true):this).get();o.fn[F].apply(o(L[K]),I);J=J.concat(I)}return this.pushStack(J,E,G)}});o.each({removeAttr:function(E){o.attr(this,E,"");if(this.nodeType==1){this.removeAttribute(E)}},addClass:function(E){o.className.add(this,E)},removeClass:function(E){o.className.remove(this,E)},toggleClass:function(F,E){if(typeof E!=="boolean"){E=!o.className.has(this,F)}o.className[E?"add":"remove"](this,F)},remove:function(E){if(!E||o.filter(E,[this]).length){o("*",this).add([this]).each(function(){o.event.remove(this);o.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){o(this).children().remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(E,F){o.fn[E]=function(){return this.each(F,arguments)}});function j(E,F){return E[0]&&parseInt(o.curCSS(E[0],F,true),10)||0}var h="jQuery"+e(),v=0,A={};o.extend({cache:{},data:function(F,E,G){F=F==l?A:F;var H=F[h];if(!H){H=F[h]=++v}if(E&&!o.cache[H]){o.cache[H]={}}if(G!==g){o.cache[H][E]=G}return E?o.cache[H][E]:H},removeData:function(F,E){F=F==l?A:F;var H=F[h];if(E){if(o.cache[H]){delete o.cache[H][E];E="";for(E in o.cache[H]){break}if(!E){o.removeData(F)}}}else{try{delete F[h]}catch(G){if(F.removeAttribute){F.removeAttribute(h)}}delete o.cache[H]}},queue:function(F,E,H){if(F){E=(E||"fx")+"queue";var G=o.data(F,E);if(!G||o.isArray(H)){G=o.data(F,E,o.makeArray(H))}else{if(H){G.push(H)}}}return G},dequeue:function(H,G){var E=o.queue(H,G),F=E.shift();if(!G||G==="fx"){F=E[0]}if(F!==g){F.call(H)}}});o.fn.extend({data:function(E,G){var H=E.split(".");H[1]=H[1]?"."+H[1]:"";if(G===g){var F=this.triggerHandler("getData"+H[1]+"!",[H[0]]);if(F===g&&this.length){F=o.data(this[0],E)}return F===g&&H[1]?this.data(H[0]):F}else{return this.trigger("setData"+H[1]+"!",[H[0],G]).each(function(){o.data(this,E,G)})}},removeData:function(E){return this.each(function(){o.removeData(this,E)})},queue:function(E,F){if(typeof E!=="string"){F=E;E="fx"}if(F===g){return o.queue(this[0],E)}return this.each(function(){var G=o.queue(this,E,F);if(E=="fx"&&G.length==1){G[0].call(this)}})},dequeue:function(E){return this.each(function(){o.dequeue(this,E)})}});
+/*
+ * Sizzle CSS Selector Engine - v0.9.3
+ * Copyright 2009, The Dojo Foundation
+ * Released under the MIT, BSD, and GPL Licenses.
+ * More information: http://sizzlejs.com/
+ */
+(function(){var R=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,L=0,H=Object.prototype.toString;var F=function(Y,U,ab,ac){ab=ab||[];U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!Y||typeof Y!=="string"){return ab}var Z=[],W,af,ai,T,ad,V,X=true;R.lastIndex=0;while((W=R.exec(Y))!==null){Z.push(W[1]);if(W[2]){V=RegExp.rightContext;break}}if(Z.length>1&&M.exec(Y)){if(Z.length===2&&I.relative[Z[0]]){af=J(Z[0]+Z[1],U)}else{af=I.relative[Z[0]]?[U]:F(Z.shift(),U);while(Z.length){Y=Z.shift();if(I.relative[Y]){Y+=Z.shift()}af=J(Y,af)}}}else{var ae=ac?{expr:Z.pop(),set:E(ac)}:F.find(Z.pop(),Z.length===1&&U.parentNode?U.parentNode:U,Q(U));af=F.filter(ae.expr,ae.set);if(Z.length>0){ai=E(af)}else{X=false}while(Z.length){var ah=Z.pop(),ag=ah;if(!I.relative[ah]){ah=""}else{ag=Z.pop()}if(ag==null){ag=U}I.relative[ah](ai,ag,Q(U))}}if(!ai){ai=af}if(!ai){throw"Syntax error, unrecognized expression: "+(ah||Y)}if(H.call(ai)==="[object Array]"){if(!X){ab.push.apply(ab,ai)}else{if(U.nodeType===1){for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&(ai[aa]===true||ai[aa].nodeType===1&&K(U,ai[aa]))){ab.push(af[aa])}}}else{for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&ai[aa].nodeType===1){ab.push(af[aa])}}}}}else{E(ai,ab)}if(V){F(V,U,ab,ac);if(G){hasDuplicate=false;ab.sort(G);if(hasDuplicate){for(var aa=1;aa<ab.length;aa++){if(ab[aa]===ab[aa-1]){ab.splice(aa--,1)}}}}}return ab};F.matches=function(T,U){return F(T,null,null,U)};F.find=function(aa,T,ab){var Z,X;if(!aa){return[]}for(var W=0,V=I.order.length;W<V;W++){var Y=I.order[W],X;if((X=I.match[Y].exec(aa))){var U=RegExp.leftContext;if(U.substr(U.length-1)!=="\\"){X[1]=(X[1]||"").replace(/\\/g,"");Z=I.find[Y](X,T,ab);if(Z!=null){aa=aa.replace(I.match[Y],"");break}}}}if(!Z){Z=T.getElementsByTagName("*")}return{set:Z,expr:aa}};F.filter=function(ad,ac,ag,W){var V=ad,ai=[],aa=ac,Y,T,Z=ac&&ac[0]&&Q(ac[0]);while(ad&&ac.length){for(var ab in I.filter){if((Y=I.match[ab].exec(ad))!=null){var U=I.filter[ab],ah,af;T=false;if(aa==ai){ai=[]}if(I.preFilter[ab]){Y=I.preFilter[ab](Y,aa,ag,ai,W,Z);if(!Y){T=ah=true}else{if(Y===true){continue}}}if(Y){for(var X=0;(af=aa[X])!=null;X++){if(af){ah=U(af,Y,X,aa);var ae=W^!!ah;if(ag&&ah!=null){if(ae){T=true}else{aa[X]=false}}else{if(ae){ai.push(af);T=true}}}}}if(ah!==g){if(!ag){aa=ai}ad=ad.replace(I.match[ab],"");if(!T){return[]}break}}}if(ad==V){if(T==null){throw"Syntax error, unrecognized expression: "+ad}else{break}}V=ad}return aa};var I=F.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(T){return T.getAttribute("href")}},relative:{"+":function(aa,T,Z){var X=typeof T==="string",ab=X&&!/\W/.test(T),Y=X&&!ab;if(ab&&!Z){T=T.toUpperCase()}for(var W=0,V=aa.length,U;W<V;W++){if((U=aa[W])){while((U=U.previousSibling)&&U.nodeType!==1){}aa[W]=Y||U&&U.nodeName===T?U||false:U===T}}if(Y){F.filter(T,aa,true)}},">":function(Z,U,aa){var X=typeof U==="string";if(X&&!/\W/.test(U)){U=aa?U:U.toUpperCase();for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){var W=Y.parentNode;Z[V]=W.nodeName===U?W:false}}}else{for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){Z[V]=X?Y.parentNode:Y.parentNode===U}}if(X){F.filter(U,Z,true)}}},"":function(W,U,Y){var V=L++,T=S;if(!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("parentNode",U,V,W,X,Y)},"~":function(W,U,Y){var V=L++,T=S;if(typeof U==="string"&&!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("previousSibling",U,V,W,X,Y)}},find:{ID:function(U,V,W){if(typeof V.getElementById!=="undefined"&&!W){var T=V.getElementById(U[1]);return T?[T]:[]}},NAME:function(V,Y,Z){if(typeof Y.getElementsByName!=="undefined"){var U=[],X=Y.getElementsByName(V[1]);for(var W=0,T=X.length;W<T;W++){if(X[W].getAttribute("name")===V[1]){U.push(X[W])}}return U.length===0?null:U}},TAG:function(T,U){return U.getElementsByTagName(T[1])}},preFilter:{CLASS:function(W,U,V,T,Z,aa){W=" "+W[1].replace(/\\/g,"")+" ";if(aa){return W}for(var X=0,Y;(Y=U[X])!=null;X++){if(Y){if(Z^(Y.className&&(" "+Y.className+" ").indexOf(W)>=0)){if(!V){T.push(Y)}}else{if(V){U[X]=false}}}}return false},ID:function(T){return T[1].replace(/\\/g,"")},TAG:function(U,T){for(var V=0;T[V]===false;V++){}return T[V]&&Q(T[V])?U[1]:U[1].toUpperCase()},CHILD:function(T){if(T[1]=="nth"){var U=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(T[2]=="even"&&"2n"||T[2]=="odd"&&"2n+1"||!/\D/.test(T[2])&&"0n+"+T[2]||T[2]);T[2]=(U[1]+(U[2]||1))-0;T[3]=U[3]-0}T[0]=L++;return T},ATTR:function(X,U,V,T,Y,Z){var W=X[1].replace(/\\/g,"");if(!Z&&I.attrMap[W]){X[1]=I.attrMap[W]}if(X[2]==="~="){X[4]=" "+X[4]+" "}return X},PSEUDO:function(X,U,V,T,Y){if(X[1]==="not"){if(X[3].match(R).length>1||/^\w/.test(X[3])){X[3]=F(X[3],null,null,U)}else{var W=F.filter(X[3],U,V,true^Y);if(!V){T.push.apply(T,W)}return false}}else{if(I.match.POS.test(X[0])||I.match.CHILD.test(X[0])){return true}}return X},POS:function(T){T.unshift(true);return T}},filters:{enabled:function(T){return T.disabled===false&&T.type!=="hidden"},disabled:function(T){return T.disabled===true},checked:function(T){return T.checked===true},selected:function(T){T.parentNode.selectedIndex;return T.selected===true},parent:function(T){return !!T.firstChild},empty:function(T){return !T.firstChild},has:function(V,U,T){return !!F(T[3],V).length},header:function(T){return/h\d/i.test(T.nodeName)},text:function(T){return"text"===T.type},radio:function(T){return"radio"===T.type},checkbox:function(T){return"checkbox"===T.type},file:function(T){return"file"===T.type},password:function(T){return"password"===T.type},submit:function(T){return"submit"===T.type},image:function(T){return"image"===T.type},reset:function(T){return"reset"===T.type},button:function(T){return"button"===T.type||T.nodeName.toUpperCase()==="BUTTON"},input:function(T){return/input|select|textarea|button/i.test(T.nodeName)}},setFilters:{first:function(U,T){return T===0},last:function(V,U,T,W){return U===W.length-1},even:function(U,T){return T%2===0},odd:function(U,T){return T%2===1},lt:function(V,U,T){return U<T[3]-0},gt:function(V,U,T){return U>T[3]-0},nth:function(V,U,T){return T[3]-0==U},eq:function(V,U,T){return T[3]-0==U}},filter:{PSEUDO:function(Z,V,W,aa){var U=V[1],X=I.filters[U];if(X){return X(Z,W,V,aa)}else{if(U==="contains"){return(Z.textContent||Z.innerText||"").indexOf(V[3])>=0}else{if(U==="not"){var Y=V[3];for(var W=0,T=Y.length;W<T;W++){if(Y[W]===Z){return false}}return true}}}},CHILD:function(T,W){var Z=W[1],U=T;switch(Z){case"only":case"first":while(U=U.previousSibling){if(U.nodeType===1){return false}}if(Z=="first"){return true}U=T;case"last":while(U=U.nextSibling){if(U.nodeType===1){return false}}return true;case"nth":var V=W[2],ac=W[3];if(V==1&&ac==0){return true}var Y=W[0],ab=T.parentNode;if(ab&&(ab.sizcache!==Y||!T.nodeIndex)){var X=0;for(U=ab.firstChild;U;U=U.nextSibling){if(U.nodeType===1){U.nodeIndex=++X}}ab.sizcache=Y}var aa=T.nodeIndex-ac;if(V==0){return aa==0}else{return(aa%V==0&&aa/V>=0)}}},ID:function(U,T){return U.nodeType===1&&U.getAttribute("id")===T},TAG:function(U,T){return(T==="*"&&U.nodeType===1)||U.nodeName===T},CLASS:function(U,T){return(" "+(U.className||U.getAttribute("class"))+" ").indexOf(T)>-1},ATTR:function(Y,W){var V=W[1],T=I.attrHandle[V]?I.attrHandle[V](Y):Y[V]!=null?Y[V]:Y.getAttribute(V),Z=T+"",X=W[2],U=W[4];return T==null?X==="!=":X==="="?Z===U:X==="*="?Z.indexOf(U)>=0:X==="~="?(" "+Z+" ").indexOf(U)>=0:!U?Z&&T!==false:X==="!="?Z!=U:X==="^="?Z.indexOf(U)===0:X==="$="?Z.substr(Z.length-U.length)===U:X==="|="?Z===U||Z.substr(0,U.length+1)===U+"-":false},POS:function(X,U,V,Y){var T=U[2],W=I.setFilters[T];if(W){return W(X,V,U,Y)}}}};var M=I.match.POS;for(var O in I.match){I.match[O]=RegExp(I.match[O].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var E=function(U,T){U=Array.prototype.slice.call(U);if(T){T.push.apply(T,U);return T}return U};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(N){E=function(X,W){var U=W||[];if(H.call(X)==="[object Array]"){Array.prototype.push.apply(U,X)}else{if(typeof X.length==="number"){for(var V=0,T=X.length;V<T;V++){U.push(X[V])}}else{for(var V=0;X[V];V++){U.push(X[V])}}}return U}}var G;if(document.documentElement.compareDocumentPosition){G=function(U,T){var V=U.compareDocumentPosition(T)&4?-1:U===T?0:1;if(V===0){hasDuplicate=true}return V}}else{if("sourceIndex" in document.documentElement){G=function(U,T){var V=U.sourceIndex-T.sourceIndex;if(V===0){hasDuplicate=true}return V}}else{if(document.createRange){G=function(W,U){var V=W.ownerDocument.createRange(),T=U.ownerDocument.createRange();V.selectNode(W);V.collapse(true);T.selectNode(U);T.collapse(true);var X=V.compareBoundaryPoints(Range.START_TO_END,T);if(X===0){hasDuplicate=true}return X}}}}(function(){var U=document.createElement("form"),V="script"+(new Date).getTime();U.innerHTML="<input name='"+V+"'/>";var T=document.documentElement;T.insertBefore(U,T.firstChild);if(!!document.getElementById(V)){I.find.ID=function(X,Y,Z){if(typeof Y.getElementById!=="undefined"&&!Z){var W=Y.getElementById(X[1]);return W?W.id===X[1]||typeof W.getAttributeNode!=="undefined"&&W.getAttributeNode("id").nodeValue===X[1]?[W]:g:[]}};I.filter.ID=function(Y,W){var X=typeof Y.getAttributeNode!=="undefined"&&Y.getAttributeNode("id");return Y.nodeType===1&&X&&X.nodeValue===W}}T.removeChild(U)})();(function(){var T=document.createElement("div");T.appendChild(document.createComment(""));if(T.getElementsByTagName("*").length>0){I.find.TAG=function(U,Y){var X=Y.getElementsByTagName(U[1]);if(U[1]==="*"){var W=[];for(var V=0;X[V];V++){if(X[V].nodeType===1){W.push(X[V])}}X=W}return X}}T.innerHTML="<a href='#'></a>";if(T.firstChild&&typeof T.firstChild.getAttribute!=="undefined"&&T.firstChild.getAttribute("href")!=="#"){I.attrHandle.href=function(U){return U.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var T=F,U=document.createElement("div");U.innerHTML="<p class='TEST'></p>";if(U.querySelectorAll&&U.querySelectorAll(".TEST").length===0){return}F=function(Y,X,V,W){X=X||document;if(!W&&X.nodeType===9&&!Q(X)){try{return E(X.querySelectorAll(Y),V)}catch(Z){}}return T(Y,X,V,W)};F.find=T.find;F.filter=T.filter;F.selectors=T.selectors;F.matches=T.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var T=document.createElement("div");T.innerHTML="<div class='test e'></div><div class='test'></div>";if(T.getElementsByClassName("e").length===0){return}T.lastChild.className="e";if(T.getElementsByClassName("e").length===1){return}I.order.splice(1,0,"CLASS");I.find.CLASS=function(U,V,W){if(typeof V.getElementsByClassName!=="undefined"&&!W){return V.getElementsByClassName(U[1])}}})()}function P(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1&&!ac){T.sizcache=Y;T.sizset=W}if(T.nodeName===Z){X=T;break}T=T[U]}ad[W]=X}}}function S(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1){if(!ac){T.sizcache=Y;T.sizset=W}if(typeof Z!=="string"){if(T===Z){X=true;break}}else{if(F.filter(Z,[T]).length>0){X=T;break}}}T=T[U]}ad[W]=X}}}var K=document.compareDocumentPosition?function(U,T){return U.compareDocumentPosition(T)&16}:function(U,T){return U!==T&&(U.contains?U.contains(T):true)};var Q=function(T){return T.nodeType===9&&T.documentElement.nodeName!=="HTML"||!!T.ownerDocument&&Q(T.ownerDocument)};var J=function(T,aa){var W=[],X="",Y,V=aa.nodeType?[aa]:aa;while((Y=I.match.PSEUDO.exec(T))){X+=Y[0];T=T.replace(I.match.PSEUDO,"")}T=I.relative[T]?T+"*":T;for(var Z=0,U=V.length;Z<U;Z++){F(T,V[Z],W)}return F.filter(X,W)};o.find=F;o.filter=F.filter;o.expr=F.selectors;o.expr[":"]=o.expr.filters;F.selectors.filters.hidden=function(T){return T.offsetWidth===0||T.offsetHeight===0};F.selectors.filters.visible=function(T){return T.offsetWidth>0||T.offsetHeight>0};F.selectors.filters.animated=function(T){return o.grep(o.timers,function(U){return T===U.elem}).length};o.multiFilter=function(V,T,U){if(U){V=":not("+V+")"}return F.matches(V,T)};o.dir=function(V,U){var T=[],W=V[U];while(W&&W!=document){if(W.nodeType==1){T.push(W)}W=W[U]}return T};o.nth=function(X,T,V,W){T=T||1;var U=0;for(;X;X=X[V]){if(X.nodeType==1&&++U==T){break}}return X};o.sibling=function(V,U){var T=[];for(;V;V=V.nextSibling){if(V.nodeType==1&&V!=U){T.push(V)}}return T};return;l.Sizzle=F})();o.event={add:function(I,F,H,K){if(I.nodeType==3||I.nodeType==8){return}if(I.setInterval&&I!=l){I=l}if(!H.guid){H.guid=this.guid++}if(K!==g){var G=H;H=this.proxy(G);H.data=K}var E=o.data(I,"events")||o.data(I,"events",{}),J=o.data(I,"handle")||o.data(I,"handle",function(){return typeof o!=="undefined"&&!o.event.triggered?o.event.handle.apply(arguments.callee.elem,arguments):g});J.elem=I;o.each(F.split(/\s+/),function(M,N){var O=N.split(".");N=O.shift();H.type=O.slice().sort().join(".");var L=E[N];if(o.event.specialAll[N]){o.event.specialAll[N].setup.call(I,K,O)}if(!L){L=E[N]={};if(!o.event.special[N]||o.event.special[N].setup.call(I,K,O)===false){if(I.addEventListener){I.addEventListener(N,J,false)}else{if(I.attachEvent){I.attachEvent("on"+N,J)}}}}L[H.guid]=H;o.event.global[N]=true});I=null},guid:1,global:{},remove:function(K,H,J){if(K.nodeType==3||K.nodeType==8){return}var G=o.data(K,"events"),F,E;if(G){if(H===g||(typeof H==="string"&&H.charAt(0)==".")){for(var I in G){this.remove(K,I+(H||""))}}else{if(H.type){J=H.handler;H=H.type}o.each(H.split(/\s+/),function(M,O){var Q=O.split(".");O=Q.shift();var N=RegExp("(^|\\.)"+Q.slice().sort().join(".*\\.")+"(\\.|$)");if(G[O]){if(J){delete G[O][J.guid]}else{for(var P in G[O]){if(N.test(G[O][P].type)){delete G[O][P]}}}if(o.event.specialAll[O]){o.event.specialAll[O].teardown.call(K,Q)}for(F in G[O]){break}if(!F){if(!o.event.special[O]||o.event.special[O].teardown.call(K,Q)===false){if(K.removeEventListener){K.removeEventListener(O,o.data(K,"handle"),false)}else{if(K.detachEvent){K.detachEvent("on"+O,o.data(K,"handle"))}}}F=null;delete G[O]}}})}for(F in G){break}if(!F){var L=o.data(K,"handle");if(L){L.elem=null}o.removeData(K,"events");o.removeData(K,"handle")}}},trigger:function(I,K,H,E){var G=I.type||I;if(!E){I=typeof I==="object"?I[h]?I:o.extend(o.Event(G),I):o.Event(G);if(G.indexOf("!")>=0){I.type=G=G.slice(0,-1);I.exclusive=true}if(!H){I.stopPropagation();if(this.global[G]){o.each(o.cache,function(){if(this.events&&this.events[G]){o.event.trigger(I,K,this.handle.elem)}})}}if(!H||H.nodeType==3||H.nodeType==8){return g}I.result=g;I.target=H;K=o.makeArray(K);K.unshift(I)}I.currentTarget=H;var J=o.data(H,"handle");if(J){J.apply(H,K)}if((!H[G]||(o.nodeName(H,"a")&&G=="click"))&&H["on"+G]&&H["on"+G].apply(H,K)===false){I.result=false}if(!E&&H[G]&&!I.isDefaultPrevented()&&!(o.nodeName(H,"a")&&G=="click")){this.triggered=true;try{H[G]()}catch(L){}}this.triggered=false;if(!I.isPropagationStopped()){var F=H.parentNode||H.ownerDocument;if(F){o.event.trigger(I,K,F,true)}}},handle:function(K){var J,E;K=arguments[0]=o.event.fix(K||l.event);K.currentTarget=this;var L=K.type.split(".");K.type=L.shift();J=!L.length&&!K.exclusive;var I=RegExp("(^|\\.)"+L.slice().sort().join(".*\\.")+"(\\.|$)");E=(o.data(this,"events")||{})[K.type];for(var G in E){var H=E[G];if(J||I.test(H.type)){K.handler=H;K.data=H.data;var F=H.apply(this,arguments);if(F!==g){K.result=F;if(F===false){K.preventDefault();K.stopPropagation()}}if(K.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(H){if(H[h]){return H}var F=H;H=o.Event(F);for(var G=this.props.length,J;G;){J=this.props[--G];H[J]=F[J]}if(!H.target){H.target=H.srcElement||document}if(H.target.nodeType==3){H.target=H.target.parentNode}if(!H.relatedTarget&&H.fromElement){H.relatedTarget=H.fromElement==H.target?H.toElement:H.fromElement}if(H.pageX==null&&H.clientX!=null){var I=document.documentElement,E=document.body;H.pageX=H.clientX+(I&&I.scrollLeft||E&&E.scrollLeft||0)-(I.clientLeft||0);H.pageY=H.clientY+(I&&I.scrollTop||E&&E.scrollTop||0)-(I.clientTop||0)}if(!H.which&&((H.charCode||H.charCode===0)?H.charCode:H.keyCode)){H.which=H.charCode||H.keyCode}if(!H.metaKey&&H.ctrlKey){H.metaKey=H.ctrlKey}if(!H.which&&H.button){H.which=(H.button&1?1:(H.button&2?3:(H.button&4?2:0)))}return H},proxy:function(F,E){E=E||function(){return F.apply(this,arguments)};E.guid=F.guid=F.guid||E.guid||this.guid++;return E},special:{ready:{setup:B,teardown:function(){}}},specialAll:{live:{setup:function(E,F){o.event.add(this,F[0],c)},teardown:function(G){if(G.length){var E=0,F=RegExp("(^|\\.)"+G[0]+"(\\.|$)");o.each((o.data(this,"events").live||{}),function(){if(F.test(this.type)){E++}});if(E<1){o.event.remove(this,G[0],c)}}}}}};o.Event=function(E){if(!this.preventDefault){return new o.Event(E)}if(E&&E.type){this.originalEvent=E;this.type=E.type}else{this.type=E}this.timeStamp=e();this[h]=true};function k(){return false}function u(){return true}o.Event.prototype={preventDefault:function(){this.isDefaultPrevented=u;var E=this.originalEvent;if(!E){return}if(E.preventDefault){E.preventDefault()}E.returnValue=false},stopPropagation:function(){this.isPropagationStopped=u;var E=this.originalEvent;if(!E){return}if(E.stopPropagation){E.stopPropagation()}E.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=u;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(F){var E=F.relatedTarget;while(E&&E!=this){try{E=E.parentNode}catch(G){E=this}}if(E!=this){F.type=F.data;o.event.handle.apply(this,arguments)}};o.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(F,E){o.event.special[E]={setup:function(){o.event.add(this,F,a,E)},teardown:function(){o.event.remove(this,F,a)}}});o.fn.extend({bind:function(F,G,E){return F=="unload"?this.one(F,G,E):this.each(function(){o.event.add(this,F,E||G,E&&G)})},one:function(G,H,F){var E=o.event.proxy(F||H,function(I){o(this).unbind(I,E);return(F||H).apply(this,arguments)});return this.each(function(){o.event.add(this,G,E,F&&H)})},unbind:function(F,E){return this.each(function(){o.event.remove(this,F,E)})},trigger:function(E,F){return this.each(function(){o.event.trigger(E,F,this)})},triggerHandler:function(E,G){if(this[0]){var F=o.Event(E);F.preventDefault();F.stopPropagation();o.event.trigger(F,G,this[0]);return F.result}},toggle:function(G){var E=arguments,F=1;while(F<E.length){o.event.proxy(G,E[F++])}return this.click(o.event.proxy(G,function(H){this.lastToggle=(this.lastToggle||0)%F;H.preventDefault();return E[this.lastToggle++].apply(this,arguments)||false}))},hover:function(E,F){return this.mouseenter(E).mouseleave(F)},ready:function(E){B();if(o.isReady){E.call(document,o)}else{o.readyList.push(E)}return this},live:function(G,F){var E=o.event.proxy(F);E.guid+=this.selector+G;o(document).bind(i(G,this.selector),this.selector,E);return this},die:function(F,E){o(document).unbind(i(F,this.selector),E?{guid:E.guid+this.selector+F}:null);return this}});function c(H){var E=RegExp("(^|\\.)"+H.type+"(\\.|$)"),G=true,F=[];o.each(o.data(this,"events").live||[],function(I,J){if(E.test(J.type)){var K=o(H.target).closest(J.data)[0];if(K){F.push({elem:K,fn:J})}}});F.sort(function(J,I){return o.data(J.elem,"closest")-o.data(I.elem,"closest")});o.each(F,function(){if(this.fn.call(this.elem,H,this.fn.data)===false){return(G=false)}});return G}function i(F,E){return["live",F,E.replace(/\./g,"`").replace(/ /g,"|")].join(".")}o.extend({isReady:false,readyList:[],ready:function(){if(!o.isReady){o.isReady=true;if(o.readyList){o.each(o.readyList,function(){this.call(document,o)});o.readyList=null}o(document).triggerHandler("ready")}}});var x=false;function B(){if(x){return}x=true;if(document.addEventListener){document.addEventListener("DOMContentLoaded",function(){document.removeEventListener("DOMContentLoaded",arguments.callee,false);o.ready()},false)}else{if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);o.ready()}});if(document.documentElement.doScroll&&l==l.top){(function(){if(o.isReady){return}try{document.documentElement.doScroll("left")}catch(E){setTimeout(arguments.callee,0);return}o.ready()})()}}}o.event.add(l,"load",o.ready)}o.each(("blur,focus,load,resize,scroll,unload,click,dblclick,mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave,change,select,submit,keydown,keypress,keyup,error").split(","),function(F,E){o.fn[E]=function(G){return G?this.bind(E,G):this.trigger(E)}});o(l).bind("unload",function(){for(var E in o.cache){if(E!=1&&o.cache[E].handle){o.event.remove(o.cache[E].handle.elem)}}});(function(){o.support={};var F=document.documentElement,G=document.createElement("script"),K=document.createElement("div"),J="script"+(new Date).getTime();K.style.display="none";K.innerHTML=' <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param/></object>';var H=K.getElementsByTagName("*"),E=K.getElementsByTagName("a")[0];if(!H||!H.length||!E){return}o.support={leadingWhitespace:K.firstChild.nodeType==3,tbody:!K.getElementsByTagName("tbody").length,objectAll:!!K.getElementsByTagName("object")[0].getElementsByTagName("*").length,htmlSerialize:!!K.getElementsByTagName("link").length,style:/red/.test(E.getAttribute("style")),hrefNormalized:E.getAttribute("href")==="/a",opacity:E.style.opacity==="0.5",cssFloat:!!E.style.cssFloat,scriptEval:false,noCloneEvent:true,boxModel:null};G.type="text/javascript";try{G.appendChild(document.createTextNode("window."+J+"=1;"))}catch(I){}F.insertBefore(G,F.firstChild);if(l[J]){o.support.scriptEval=true;delete l[J]}F.removeChild(G);if(K.attachEvent&&K.fireEvent){K.attachEvent("onclick",function(){o.support.noCloneEvent=false;K.detachEvent("onclick",arguments.callee)});K.cloneNode(true).fireEvent("onclick")}o(function(){var L=document.createElement("div");L.style.width=L.style.paddingLeft="1px";document.body.appendChild(L);o.boxModel=o.support.boxModel=L.offsetWidth===2;document.body.removeChild(L).style.display="none"})})();var w=o.support.cssFloat?"cssFloat":"styleFloat";o.props={"for":"htmlFor","class":"className","float":w,cssFloat:w,styleFloat:w,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",tabindex:"tabIndex"};o.fn.extend({_load:o.fn.load,load:function(G,J,K){if(typeof G!=="string"){return this._load(G)}var I=G.indexOf(" ");if(I>=0){var E=G.slice(I,G.length);G=G.slice(0,I)}var H="GET";if(J){if(o.isFunction(J)){K=J;J=null}else{if(typeof J==="object"){J=o.param(J);H="POST"}}}var F=this;o.ajax({url:G,type:H,dataType:"html",data:J,complete:function(M,L){if(L=="success"||L=="notmodified"){F.html(E?o("<div/>").append(M.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(E):M.responseText)}if(K){F.each(K,[M.responseText,L,M])}}});return this},serialize:function(){return o.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?o.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type))}).map(function(E,F){var G=o(this).val();return G==null?null:o.isArray(G)?o.map(G,function(I,H){return{name:F.name,value:I}}):{name:F.name,value:G}}).get()}});o.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(E,F){o.fn[F]=function(G){return this.bind(F,G)}});var r=e();o.extend({get:function(E,G,H,F){if(o.isFunction(G)){H=G;G=null}return o.ajax({type:"GET",url:E,data:G,success:H,dataType:F})},getScript:function(E,F){return o.get(E,null,F,"script")},getJSON:function(E,F,G){return o.get(E,F,G,"json")},post:function(E,G,H,F){if(o.isFunction(G)){H=G;G={}}return o.ajax({type:"POST",url:E,data:G,success:H,dataType:F})},ajaxSetup:function(E){o.extend(o.ajaxSettings,E)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return l.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(M){M=o.extend(true,M,o.extend(true,{},o.ajaxSettings,M));var W,F=/=\?(&|$)/g,R,V,G=M.type.toUpperCase();if(M.data&&M.processData&&typeof M.data!=="string"){M.data=o.param(M.data)}if(M.dataType=="jsonp"){if(G=="GET"){if(!M.url.match(F)){M.url+=(M.url.match(/\?/)?"&":"?")+(M.jsonp||"callback")+"=?"}}else{if(!M.data||!M.data.match(F)){M.data=(M.data?M.data+"&":"")+(M.jsonp||"callback")+"=?"}}M.dataType="json"}if(M.dataType=="json"&&(M.data&&M.data.match(F)||M.url.match(F))){W="jsonp"+r++;if(M.data){M.data=(M.data+"").replace(F,"="+W+"$1")}M.url=M.url.replace(F,"="+W+"$1");M.dataType="script";l[W]=function(X){V=X;I();L();l[W]=g;try{delete l[W]}catch(Y){}if(H){H.removeChild(T)}}}if(M.dataType=="script"&&M.cache==null){M.cache=false}if(M.cache===false&&G=="GET"){var E=e();var U=M.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+E+"$2");M.url=U+((U==M.url)?(M.url.match(/\?/)?"&":"?")+"_="+E:"")}if(M.data&&G=="GET"){M.url+=(M.url.match(/\?/)?"&":"?")+M.data;M.data=null}if(M.global&&!o.active++){o.event.trigger("ajaxStart")}var Q=/^(\w+:)?\/\/([^\/?#]+)/.exec(M.url);if(M.dataType=="script"&&G=="GET"&&Q&&(Q[1]&&Q[1]!=location.protocol||Q[2]!=location.host)){var H=document.getElementsByTagName("head")[0];var T=document.createElement("script");T.src=M.url;if(M.scriptCharset){T.charset=M.scriptCharset}if(!W){var O=false;T.onload=T.onreadystatechange=function(){if(!O&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){O=true;I();L();T.onload=T.onreadystatechange=null;H.removeChild(T)}}}H.appendChild(T);return g}var K=false;var J=M.xhr();if(M.username){J.open(G,M.url,M.async,M.username,M.password)}else{J.open(G,M.url,M.async)}try{if(M.data){J.setRequestHeader("Content-Type",M.contentType)}if(M.ifModified){J.setRequestHeader("If-Modified-Since",o.lastModified[M.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}J.setRequestHeader("X-Requested-With","XMLHttpRequest");J.setRequestHeader("Accept",M.dataType&&M.accepts[M.dataType]?M.accepts[M.dataType]+", */*":M.accepts._default)}catch(S){}if(M.beforeSend&&M.beforeSend(J,M)===false){if(M.global&&!--o.active){o.event.trigger("ajaxStop")}J.abort();return false}if(M.global){o.event.trigger("ajaxSend",[J,M])}var N=function(X){if(J.readyState==0){if(P){clearInterval(P);P=null;if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}}else{if(!K&&J&&(J.readyState==4||X=="timeout")){K=true;if(P){clearInterval(P);P=null}R=X=="timeout"?"timeout":!o.httpSuccess(J)?"error":M.ifModified&&o.httpNotModified(J,M.url)?"notmodified":"success";if(R=="success"){try{V=o.httpData(J,M.dataType,M)}catch(Z){R="parsererror"}}if(R=="success"){var Y;try{Y=J.getResponseHeader("Last-Modified")}catch(Z){}if(M.ifModified&&Y){o.lastModified[M.url]=Y}if(!W){I()}}else{o.handleError(M,J,R)}L();if(X){J.abort()}if(M.async){J=null}}}};if(M.async){var P=setInterval(N,13);if(M.timeout>0){setTimeout(function(){if(J&&!K){N("timeout")}},M.timeout)}}try{J.send(M.data)}catch(S){o.handleError(M,J,null,S)}if(!M.async){N()}function I(){if(M.success){M.success(V,R)}if(M.global){o.event.trigger("ajaxSuccess",[J,M])}}function L(){if(M.complete){M.complete(J,R)}if(M.global){o.event.trigger("ajaxComplete",[J,M])}if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}return J},handleError:function(F,H,E,G){if(F.error){F.error(H,E,G)}if(F.global){o.event.trigger("ajaxError",[H,F,G])}},active:0,httpSuccess:function(F){try{return !F.status&&location.protocol=="file:"||(F.status>=200&&F.status<300)||F.status==304||F.status==1223}catch(E){}return false},httpNotModified:function(G,E){try{var H=G.getResponseHeader("Last-Modified");return G.status==304||H==o.lastModified[E]}catch(F){}return false},httpData:function(J,H,G){var F=J.getResponseHeader("content-type"),E=H=="xml"||!H&&F&&F.indexOf("xml")>=0,I=E?J.responseXML:J.responseText;if(E&&I.documentElement.tagName=="parsererror"){throw"parsererror"}if(G&&G.dataFilter){I=G.dataFilter(I,H)}if(typeof I==="string"){if(H=="script"){o.globalEval(I)}if(H=="json"){I=l["eval"]("("+I+")")}}return I},param:function(E){var G=[];function H(I,J){G[G.length]=encodeURIComponent(I)+"="+encodeURIComponent(J)}if(o.isArray(E)||E.jquery){o.each(E,function(){H(this.name,this.value)})}else{for(var F in E){if(o.isArray(E[F])){o.each(E[F],function(){H(F,this)})}else{H(F,o.isFunction(E[F])?E[F]():E[F])}}}return G.join("&").replace(/%20/g,"+")}});var m={},n,d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function t(F,E){var G={};o.each(d.concat.apply([],d.slice(0,E)),function(){G[this]=F});return G}o.fn.extend({show:function(J,L){if(J){return this.animate(t("show",3),J,L)}else{for(var H=0,F=this.length;H<F;H++){var E=o.data(this[H],"olddisplay");this[H].style.display=E||"";if(o.css(this[H],"display")==="none"){var G=this[H].tagName,K;if(m[G]){K=m[G]}else{var I=o("<"+G+" />").appendTo("body");K=I.css("display");if(K==="none"){K="block"}I.remove();m[G]=K}o.data(this[H],"olddisplay",K)}}for(var H=0,F=this.length;H<F;H++){this[H].style.display=o.data(this[H],"olddisplay")||""}return this}},hide:function(H,I){if(H){return this.animate(t("hide",3),H,I)}else{for(var G=0,F=this.length;G<F;G++){var E=o.data(this[G],"olddisplay");if(!E&&E!=="none"){o.data(this[G],"olddisplay",o.css(this[G],"display"))}}for(var G=0,F=this.length;G<F;G++){this[G].style.display="none"}return this}},_toggle:o.fn.toggle,toggle:function(G,F){var E=typeof G==="boolean";return o.isFunction(G)&&o.isFunction(F)?this._toggle.apply(this,arguments):G==null||E?this.each(function(){var H=E?G:o(this).is(":hidden");o(this)[H?"show":"hide"]()}):this.animate(t("toggle",3),G,F)},fadeTo:function(E,G,F){return this.animate({opacity:G},E,F)},animate:function(I,F,H,G){var E=o.speed(F,H,G);return this[E.queue===false?"each":"queue"](function(){var K=o.extend({},E),M,L=this.nodeType==1&&o(this).is(":hidden"),J=this;for(M in I){if(I[M]=="hide"&&L||I[M]=="show"&&!L){return K.complete.call(this)}if((M=="height"||M=="width")&&this.style){K.display=o.css(this,"display");K.overflow=this.style.overflow}}if(K.overflow!=null){this.style.overflow="hidden"}K.curAnim=o.extend({},I);o.each(I,function(O,S){var R=new o.fx(J,K,O);if(/toggle|show|hide/.test(S)){R[S=="toggle"?L?"show":"hide":S](I)}else{var Q=S.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),T=R.cur(true)||0;if(Q){var N=parseFloat(Q[2]),P=Q[3]||"px";if(P!="px"){J.style[O]=(N||1)+P;T=((N||1)/R.cur(true))*T;J.style[O]=T+P}if(Q[1]){N=((Q[1]=="-="?-1:1)*N)+T}R.custom(T,N,P)}else{R.custom(T,S,"")}}});return true})},stop:function(F,E){var G=o.timers;if(F){this.queue([])}this.each(function(){for(var H=G.length-1;H>=0;H--){if(G[H].elem==this){if(E){G[H](true)}G.splice(H,1)}}});if(!E){this.dequeue()}return this}});o.each({slideDown:t("show",1),slideUp:t("hide",1),slideToggle:t("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(E,F){o.fn[E]=function(G,H){return this.animate(F,G,H)}});o.extend({speed:function(G,H,F){var E=typeof G==="object"?G:{complete:F||!F&&H||o.isFunction(G)&&G,duration:G,easing:F&&H||H&&!o.isFunction(H)&&H};E.duration=o.fx.off?0:typeof E.duration==="number"?E.duration:o.fx.speeds[E.duration]||o.fx.speeds._default;E.old=E.complete;E.complete=function(){if(E.queue!==false){o(this).dequeue()}if(o.isFunction(E.old)){E.old.call(this)}};return E},easing:{linear:function(G,H,E,F){return E+F*G},swing:function(G,H,E,F){return((-Math.cos(G*Math.PI)/2)+0.5)*F+E}},timers:[],fx:function(F,E,G){this.options=E;this.elem=F;this.prop=G;if(!E.orig){E.orig={}}}});o.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(o.fx.step[this.prop]||o.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(F){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var E=parseFloat(o.css(this.elem,this.prop,F));return E&&E>-10000?E:parseFloat(o.curCSS(this.elem,this.prop))||0},custom:function(I,H,G){this.startTime=e();this.start=I;this.end=H;this.unit=G||this.unit||"px";this.now=this.start;this.pos=this.state=0;var E=this;function F(J){return E.step(J)}F.elem=this.elem;if(F()&&o.timers.push(F)&&!n){n=setInterval(function(){var K=o.timers;for(var J=0;J<K.length;J++){if(!K[J]()){K.splice(J--,1)}}if(!K.length){clearInterval(n);n=g}},13)}},show:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.show=true;this.custom(this.prop=="width"||this.prop=="height"?1:0,this.cur());o(this.elem).show()},hide:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(H){var G=e();if(H||G>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var E=true;for(var F in this.options.curAnim){if(this.options.curAnim[F]!==true){E=false}}if(E){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(o.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){o(this.elem).hide()}if(this.options.hide||this.options.show){for(var I in this.options.curAnim){o.attr(this.elem.style,I,this.options.orig[I])}}this.options.complete.call(this.elem)}return false}else{var J=G-this.startTime;this.state=J/this.options.duration;this.pos=o.easing[this.options.easing||(o.easing.swing?"swing":"linear")](this.state,J,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};o.extend(o.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(E){o.attr(E.elem.style,"opacity",E.now)},_default:function(E){if(E.elem.style&&E.elem.style[E.prop]!=null){E.elem.style[E.prop]=E.now+E.unit}else{E.elem[E.prop]=E.now}}}});if(document.documentElement.getBoundingClientRect){o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}var G=this[0].getBoundingClientRect(),J=this[0].ownerDocument,F=J.body,E=J.documentElement,L=E.clientTop||F.clientTop||0,K=E.clientLeft||F.clientLeft||0,I=G.top+(self.pageYOffset||o.boxModel&&E.scrollTop||F.scrollTop)-L,H=G.left+(self.pageXOffset||o.boxModel&&E.scrollLeft||F.scrollLeft)-K;return{top:I,left:H}}}else{o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}o.offset.initialized||o.offset.initialize();var J=this[0],G=J.offsetParent,F=J,O=J.ownerDocument,M,H=O.documentElement,K=O.body,L=O.defaultView,E=L.getComputedStyle(J,null),N=J.offsetTop,I=J.offsetLeft;while((J=J.parentNode)&&J!==K&&J!==H){M=L.getComputedStyle(J,null);N-=J.scrollTop,I-=J.scrollLeft;if(J===G){N+=J.offsetTop,I+=J.offsetLeft;if(o.offset.doesNotAddBorder&&!(o.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(J.tagName))){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}F=G,G=J.offsetParent}if(o.offset.subtractsBorderForOverflowNotVisible&&M.overflow!=="visible"){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}E=M}if(E.position==="relative"||E.position==="static"){N+=K.offsetTop,I+=K.offsetLeft}if(E.position==="fixed"){N+=Math.max(H.scrollTop,K.scrollTop),I+=Math.max(H.scrollLeft,K.scrollLeft)}return{top:N,left:I}}}o.offset={initialize:function(){if(this.initialized){return}var L=document.body,F=document.createElement("div"),H,G,N,I,M,E,J=L.style.marginTop,K='<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>';M={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(E in M){F.style[E]=M[E]}F.innerHTML=K;L.insertBefore(F,L.firstChild);H=F.firstChild,G=H.firstChild,I=H.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(G.offsetTop!==5);this.doesAddBorderForTableAndCells=(I.offsetTop===5);H.style.overflow="hidden",H.style.position="relative";this.subtractsBorderForOverflowNotVisible=(G.offsetTop===-5);L.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(L.offsetTop===0);L.style.marginTop=J;L.removeChild(F);this.initialized=true},bodyOffset:function(E){o.offset.initialized||o.offset.initialize();var G=E.offsetTop,F=E.offsetLeft;if(o.offset.doesNotIncludeMarginInBodyOffset){G+=parseInt(o.curCSS(E,"marginTop",true),10)||0,F+=parseInt(o.curCSS(E,"marginLeft",true),10)||0}return{top:G,left:F}}};o.fn.extend({position:function(){var I=0,H=0,F;if(this[0]){var G=this.offsetParent(),J=this.offset(),E=/^body|html$/i.test(G[0].tagName)?{top:0,left:0}:G.offset();J.top-=j(this,"marginTop");J.left-=j(this,"marginLeft");E.top+=j(G,"borderTopWidth");E.left+=j(G,"borderLeftWidth");F={top:J.top-E.top,left:J.left-E.left}}return F},offsetParent:function(){var E=this[0].offsetParent||document.body;while(E&&(!/^body|html$/i.test(E.tagName)&&o.css(E,"position")=="static")){E=E.offsetParent}return o(E)}});o.each(["Left","Top"],function(F,E){var G="scroll"+E;o.fn[G]=function(H){if(!this[0]){return null}return H!==g?this.each(function(){this==l||this==document?l.scrollTo(!F?H:o(l).scrollLeft(),F?H:o(l).scrollTop()):this[G]=H}):this[0]==l||this[0]==document?self[F?"pageYOffset":"pageXOffset"]||o.boxModel&&document.documentElement[G]||document.body[G]:this[0][G]}});o.each(["Height","Width"],function(I,G){var E=I?"Left":"Top",H=I?"Right":"Bottom",F=G.toLowerCase();o.fn["inner"+G]=function(){return this[0]?o.css(this[0],F,false,"padding"):null};o.fn["outer"+G]=function(K){return this[0]?o.css(this[0],F,false,K?"margin":"border"):null};var J=G.toLowerCase();o.fn[J]=function(K){return this[0]==l?document.compatMode=="CSS1Compat"&&document.documentElement["client"+G]||document.body["client"+G]:this[0]==document?Math.max(document.documentElement["client"+G],document.body["scroll"+G],document.documentElement["scroll"+G],document.body["offset"+G],document.documentElement["offset"+G]):K===g?(this.length?o.css(this[0],J):null):this.css(J,typeof K==="string"?K:K+"px")}})})();
\ No newline at end of file diff --git a/themes/js/functions.js b/themes/js/functions.js new file mode 100644 index 0000000..5db31a3 --- /dev/null +++ b/themes/js/functions.js @@ -0,0 +1,112 @@ +function openSelectDate(timer_year,timer_month,timer_day) {
+ var now = new Date();
+ if ( timer_year == null ) {
+ var now_year = now.getFullYear();
+ var now_month = now.getMonth()+1;
+ var now_day = now.getDate();
+ }
+ else
+ {
+ var now_year = timer_year;
+ var now_month = timer_month;
+ var now_day = timer_day;
+ }
+ var layer = 'layer_date';
+ var days = { };
+ var years = { };
+ var months = { '01': '01', '02': '02', '03': '03', '04': '04', '05': '05','06': '06', '07': '07', '08': '08', '09': '09', '10': '10', '11': '11', '12': '12' };
+
+ for( var i = 1; i < 32; i += 1 ) {
+ days[i] = str_pad(i, 2, '0', 'STR_PAD_LEFT');
+ }
+
+ for( i = now.getFullYear(); i < now.getFullYear()+5; i += 1 ) {
+ years[i] = i;
+ }
+
+ SpinningWheel.addSlot(years, 'right', now_year );
+ SpinningWheel.addSlot(months, '', now_month);
+ SpinningWheel.addSlot(days, 'right', now_day);
+ SpinningWheel.setCancelAction(cancel_date);
+ SpinningWheel.setDoneAction(done_date);
+
+ SpinningWheel.open();
+}
+
+function done_date() {
+ var results = SpinningWheel.getSelectedValues();
+
+ document.getElementById('layer_date').innerHTML = results.values.join('-');
+ document.timer.timer_date.value = results.values.join('-');
+ $('a').removeClass('active');
+}
+
+function cancel_date() {
+$('a').removeClass('active');
+}
+function openSelectTime(layer,timer_hour,timer_minute) {
+ if ( timer_hour == null ) {
+ var now = new Date();
+ var now_hour = now.getHours();
+ var now_minute = now.getMinutes()+1;
+ }
+ else
+ {
+ var now_hour = timer_hour;
+ var now_minute = timer_minute;
+ }
+ var hours = { };
+ var minutes = { };
+
+ for( var i = 0; i < 24; i += 1 ) {
+ hours[i] = str_pad(i,2,'0','STR_PAD_LEFT');
+ }
+
+ for( var i = 0; i < 60; i += 1 ) {
+ minutes[i] = str_pad(i,2,'0','STR_PAD_LEFT');
+ }
+
+ SpinningWheel.addSlot(hours, 'right', now_hour);
+ //SpinningWheel.addSlot({ separator: 'h' }, 'readonly shrink');
+ SpinningWheel.addSlot(minutes, '', now_minute);
+
+ SpinningWheel.setCancelAction( function() { $('a').removeClass('active');} );
+ SpinningWheel.setDoneAction(function () {var results = SpinningWheel.getSelectedValues(); document.getElementById(layer).innerHTML = results.values.join('h');if ( layer == 'layer_starttime' ) { var forminput = 'timer_starttime'; } else { var forminput = 'timer_endtime'; }; eval ("document.timer." + forminput + ".value = results.values.join('')");$('a').removeClass('active'); });
+ SpinningWheel.open();
+}
+
+function str_pad (input, pad_length, pad_string, pad_type) {
+ // Returns input string padded on the left or right to specified length with pad_string
+ //
+ // version: 909.322
+ // discuss at: http://phpjs.org/functions/str_pad // + original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
+ // + namespaced by: Michael White (http://getsprink.com)
+ // + input by: Marco van Oort
+ // + bugfixed by: Brett Zamir (http://brett-zamir.me)
+ // * example 1: str_pad('Kevin van Zonneveld', 30, '-=', 'STR_PAD_LEFT'); // * returns 1: '-=-=-=-=-=-Kevin van Zonneveld'
+ // * example 2: str_pad('Kevin van Zonneveld', 30, '-', 'STR_PAD_BOTH');
+ // * returns 2: '------Kevin van Zonneveld-----'
+ var half = '', pad_to_go;
+ var str_pad_repeater = function (s, len) {
+ var collect = '', i;
+
+ while (collect.length < len) {collect += s;}
+ collect = collect.substr(0,len);
+ return collect;
+ };
+
+ input += ''; pad_string = pad_string !== undefined ? pad_string : ' ';
+
+ if (pad_type != 'STR_PAD_LEFT' && pad_type != 'STR_PAD_RIGHT' && pad_type != 'STR_PAD_BOTH') { pad_type = 'STR_PAD_RIGHT'; }
+ if ((pad_to_go = pad_length - input.length) > 0) {
+ if (pad_type == 'STR_PAD_LEFT') { input = str_pad_repeater(pad_string, pad_to_go) + input; } else if (pad_type == 'STR_PAD_RIGHT') { input = input + str_pad_repeater(pad_string, pad_to_go); }
+ else if (pad_type == 'STR_PAD_BOTH') {
+ half = str_pad_repeater(pad_string, Math.ceil(pad_to_go/2));
+ input = half + input + half;
+ input = input.substr(0, pad_length); }
+ }
+
+ return input;
+}
+
+
diff --git a/themes/js/istreamdev.js b/themes/js/istreamdev.js new file mode 100644 index 0000000..fc9247b --- /dev/null +++ b/themes/js/istreamdev.js @@ -0,0 +1,676 @@ +//INIT
+jQT = new $.jQTouch({
+ icon: 'img/istreamdev.png',
+ addGlossToIcon: true,
+ useFastTouch: true,
+ startupScreen: 'img/startup.png',
+ statusBar: 'black',
+ iconIsGlossy: true,
+ fullscreen: true,
+ preloadImages: [
+ 'themes/jqt/img/chevron.png',
+ 'themes/jqt/img/back_button.png',
+ 'themes/jqt/img/back_button_clicked.png',
+ 'themes/jqt/img/button_clicked.png',
+ 'themes/jqt/img/button.png',
+ 'themes/jqt/img/button_clicked.png',
+ 'themes/jqt/img/loading.gif',
+ 'themes/jqt/img/toolbar.png',
+ 'themes/jqt/img/on_off.png',
+ 'img/loading.gif',
+ 'img/audio.png',
+ 'img/epg.png',
+ 'img/media.png',
+ 'img/record.png',
+ 'img/timers.png',
+ 'img/timeron.png',
+ 'img/timeroff.png',
+ 'img/timerrec.png',
+ 'img/tv.png',
+ 'img/video.png',
+ 'img/stream.png',
+ 'img/stream_clicked.png',
+ 'img/istreamdev.png',
+ 'img/mask.png',
+ 'img/nologoTV.png',
+ 'img/nologoREC.png',
+ 'img/nologoMEDIA.png',
+ 'img/rec.png',
+ 'img/rec_clicked.png',
+ 'img/sw-alpha.png',
+ 'img/sw-button-cancel.png',
+ 'img/sw-button-done.png',
+ 'img/sw-header.png',
+ 'img/sw-slot-border.png'
+ ]
+});
+
+// [GENERIC STUFF]
+// Global variable
+
+dataString = "action=getGlobals";
+$.getJSON("bin/backend.php",
+ dataString,
+ function(data){
+ streamdev_server = data.streamdev_server;
+ rec_path = data.rec_path;
+ video_path = data.video_path;
+ audio_path = data.audio_path;
+ }
+ );
+//streamdev_server = "http://127.0.0.1:3000/TS/";
+//rec_path = "/video/";
+//video_path = "/mnt/media/Video/";
+//audio_path = "/mnt/media/Music/";
+
+
+
+//Goto home
+$('#home_but').tap(function(event) {
+ event.preventDefault();
+ jQT.goTo('#home','flip');
+});
+
+//JSON query loading handler
+function json_start(button) {
+ $(button).addClass('active');
+ $('#loader').addClass("loader");
+
+}
+function json_complete(destination,effect) {
+ $('#loader').removeClass("loader");
+ $('a').removeClass('active');
+ jQT.goTo(destination,effect);
+}
+function hide_loader() {
+ $('#loader').removeClass("loader");
+ $('a').removeClass('active');
+}
+
+// [/GENERIC STUFF]
+
+// [HOME SECTION]
+//buttons
+$('#categories_but').tap(function(event) {
+ event.preventDefault();
+ json_start(this);
+ gen_categories();
+ return false;
+});
+
+$('#recording_but').tap(function(event) {
+ event.preventDefault();
+ json_start(this);
+ browser = 1;
+ gen_browser(rec_path,browser,"Recordings","rec");
+ return false;
+});
+
+$('#timers_but').tap(function(event) {
+ event.preventDefault();
+ json_start(this);
+ gen_timers();
+ return false;
+});
+
+$('#video_but').tap(function(event) {
+ event.preventDefault();
+ json_start(this);
+ browser = 1;
+ gen_browser(video_path,browser,"Videos","vid");
+ return false;
+});
+// [/HOME SECTION]
+
+// [TV SECTION]
+//buttons
+$('#categories ul#cat_menu a').tap(function(event) {
+ event.preventDefault();
+ json_start(this);
+ var category = $(this).html();
+ gen_channels(category);
+ return false;
+});
+
+$('#channels ul#chan_menu a').tap(function(event) {
+ event.preventDefault();
+ json_start(this);
+ var channame = $(this).find('span[class="name"]').html();
+ var channumber = $(this).find('small[class="counter"]').html();
+ gen_streamchannel(channame,channumber);
+ return false;
+});
+
+//Gen Categories
+function gen_categories() {
+ $("#cat_menu").html('');
+ var dataString = "action=getTvCat";
+ //Json call to get category array
+ $.getJSON("bin/backend.php",
+ dataString,
+ function(data){
+ $.each(data.categories, function(i,categories){
+ $("#cat_menu").append('<li class="arrow"><a class="cat_but" href="#">' + categories.name + '</a><small class="counter">' + categories.channels + '</small></li>');
+ });
+ json_complete('#categories','cube');
+ })
+}
+
+//Gen Channels
+function gen_channels(category) {
+ $("#chan_menu").html('');
+ var dataString = "action=getTvChan&cat=" + category;
+ //Json call to get category array
+ $.getJSON("bin/backend.php",
+ dataString,
+ function(data){
+ $.each(data.channel,function(i,channel){
+ $("#chan_menu").append('<li class="channellist"><a class="chan_but" href="#"><img src="logos/' + channel.name + '.png"/><small class="counter">' + channel.number + '</small><span class="name">' + channel.name + '</span><span class="comment">' + channel.now_title + '</span></a></li>');
+ });
+ json_complete('#channels','cube');
+ })
+}
+
+
+// [/TV SECTION]
+// [STREAM SECTION]
+//buttons
+$('#streamchannel span.streamButton a').tap(function(event) {
+ event.preventDefault();
+ json_start(this);
+ var type = $("#streamchannel").find('span[rel="type"]').html();
+ var url = $("#streamchannel").find('span[rel="url"]').html();
+ var mode = $(this).attr('rel');
+ start_broadcast(type,url,mode);
+ return false;
+});
+$('#streamrec span.streamButton a').tap(function(event) {
+ event.preventDefault();
+ json_start(this);
+ var type = $("#streamrec").find('span[rel="type"]').html();
+ var url = $("#streamrec").find('span[rel="url"]').html();
+ var mode = $(this).attr('rel');
+ start_broadcast(type,url,mode);
+ return false;
+});
+$('#streamvid span.streamButton a').tap(function(event) {
+ event.preventDefault();
+ json_start(this);
+ var type = $("#streamvid").find('span[rel="type"]').html();
+ var url = $("#streamvid").find('span[rel="url"]').html();
+ var mode = $(this).attr('rel');
+ start_broadcast(type,url,mode);
+ return false;
+});
+$('#streaming span.streamButton a[rel="stopbroadcast"]').tap(function(event) {
+ event.preventDefault();
+ json_start(this);
+ var session = $("#streaming").find('span[rel="session"]').html();
+ stop_broadcast(session);
+ return false;
+});
+//Gen tv start stream
+function gen_streamchannel(channame,channumber) {
+ $('#streamchannel').find('h1').html( '<img class="menuicon" src="img/tv.png" /> ' +channame);
+ $('#streamchannel').find('#thumbnail').attr('src','logos/' + channame + ".png");
+ var dataString = "action=getChanInfo&chan=" + channumber;
+ //Json call to get tv program info
+ $.getJSON("bin/backend.php",
+ dataString,
+ function(data){
+ var program = data.program;
+ $("#streamchannel").find('span[class="name_now"]').html( 'Now: ' + program.now_title );
+ $("#streamchannel").find('span[class="epgtime_now"]').html( program.now_time );
+ $("#streamchannel").find('span[class="desc_now"]').html( program.now_desc );
+ $("#streamchannel").find('span[class="name_next"]').html( 'Next: ' + program.next_title );
+ $("#streamchannel").find('span[class="epgtime_next"]').html( program.next_time );
+ $("#streamchannel").find('span[rel="url"]').html(streamdev_server + channumber);
+ $("#streamchannel").find('span[rel="type"]').html('tv');
+ json_complete('#streamchannel','cube');
+ });
+}
+
+function gen_streamrec(folder,path) {
+ var dataString = "action=getRecInfo&rec=" + path + folder;
+ //Json call to get rec info
+ $.getJSON("bin/backend.php",
+ dataString,
+ function(data){
+ var program = data.program;
+ $('#streamrec').find('h1').html('<img class="menuicon" src="img/record.png" /> ' + program.name);
+ $('#streamrec').find('#thumbnail').attr('src','logos/' + program.channel + ".png");
+ $("#streamrec").find('span[class="name_now"]').html( program.name );
+ $("#streamrec").find('span[class="epgtime_now"]').html( 'Recorded: ' + program.recorded );
+ $("#streamrec").find('span[class="desc_now"]').html( program.desc );
+ $("#streamrec").find('span[rel="url"]').html( path + folder );
+ $("#streamrec").find('span[rel="type"]').html('rec');
+ json_complete('#streamrec','cube');
+ });
+}
+
+function gen_streamvid(filename,path) {
+ var dataString = "action=getVidInfo&file=" + path + filename;
+ //Json call to get rec info
+ $.getJSON("bin/backend.php",
+ dataString,
+ function(data){
+ var program = data.program;
+ $('#streamvid').find('h1').html('<img class="menuicon" src="img/video.png" /> ' + program.name);
+ $('#streamvid').find('#thumbnail').attr('src','ram/temp-logo.png');
+ $("#streamvid").find('span[class="name_now"]').html( program.name );
+ $("#streamvid").find('span[class="epgtime_now"]').html( 'Duration: ' + program.duration );
+ desc='<b>format: </b>' + program.format + '<br><b>video: </b>' + program.video + '<br><b>audio: </b>' + program.audio + '<br><b>resolution: </b>' + program.resolution;
+ $("#streamvid").find('span[class="desc_now"]').html( desc );
+ $("#streamvid").find('span[rel="url"]').html( path + filename );
+ $("#streamvid").find('span[rel="type"]').html('vid');
+ json_complete('#streamvid','cube');
+ });
+}
+//Gen streaming page
+function gen_streaming(session) {
+ $("#streaming").find('span[rel="session"]').html(session);
+ var dataString = "action=getStreamInfo&session=" + session;
+ //Json call to start streaming
+ $.getJSON("bin/backend.php",
+ dataString,
+ function(data){
+ var stream = data.stream;
+ $('#streaming').find('#thumbnail').attr('src','ram/session' + stream.session + '/thumb.png');
+ $("#streaming").find('span[rel="thumbwidth"]').html(stream.thumbwidth);
+ $("#streaming").find('span[rel="thumbheight"]').html(stream.thumbheight);
+ if (stream.type == "tv")
+ {
+ $('#streaming').find('h1').html('<img class="menuicon" src="img/tv.png" /> ' + stream.name );
+ $('#streaming').find('#player').css('width', '90px');
+ var streaminfo = '<li><span class="name_now">Now: ' + stream.now_title + '</span>';
+ streaminfo += '<span class="epgtime_now">' + stream.now_time + '</span>';
+ streaminfo += '<span class="desc_now">' + stream.now_desc + '</span></li>';
+ streaminfo += '<li><span class="name_next">Next: ' + stream.next_title + '</span>';
+ streaminfo += '<span class="epgtime_next">' + stream.next_time + '</span></li>';
+ $("#streaming").find('ul[class="streaminfo"]').html(streaminfo);
+ }
+ else if (stream.type == "rec")
+ {
+ $('#streaming').find('h1').html('<img class="menuicon" src="img/record.png" /> ' + stream.name );
+ $('#streaming').find('#player').css('width', '90px');
+ var streaminfo = '<li><span class="name_now">' + stream.name + '</span>';
+ streaminfo += '<span class="epgtime_now">Recorded: ' + stream.recorded + '</span>';
+ streaminfo += '<span class="desc_now">' + stream.desc + '</span></li>';
+ $("#streaming").find('ul[class="streaminfo"]').html(streaminfo);
+ }
+ else if (stream.type == "vid")
+ {
+ $('#streaming').find('h1').html('<img class="menuicon" src="img/video.png" /> ' + stream.name );
+ $('#streaming').find('#player').css('width', '190px');
+ var streaminfo = '<li><span class="name_now">' + stream.name + '</span>';
+ streaminfo += '<span class="epgtime_now">Duration: ' + stream.duration + '</span>';
+ desc='<b>format: </b>' + stream.format + '<br><b>video: </b>' + stream.video + '<br><b>audio: </b>' + stream.audio + '<br><b>resolution: </b>' + stream.resolution;
+ streaminfo += '<span class="desc_now">' + desc + '</span></li>';
+ $("#streaming").find('ul[class="streaminfo"]').html(streaminfo);
+ }
+ $('ul[class="streamstatus"]').find('span[class="mode"]').html('Please wait.');
+ $("#streaming").find('span[rel="name"]').html(stream.name);
+ json_complete('#streaming','cube');
+ });
+}
+
+//Start broadcast
+function start_broadcast(type,url,mode) {
+ var dataString = 'action=startBroadcast&type='+type+'&url='+url;
+ $.getJSON("bin/backend.php",
+ dataString,
+ function(data){
+ var session = data.session;
+ gen_streaming(session);
+ });
+
+}
+//Stop broadcast
+
+function stop_broadcast(session) {
+ var dataString = 'action=stopBroadcast&session='+session;
+ $.getJSON("bin/backend.php",
+ dataString,
+ function(data) {
+ var status = data.status;
+ var message = data.message;
+ hide_loader();
+ jQT.goBack();
+ });
+}
+
+//trick to prevent animation bug with object.
+$(document).ready(function(e){
+$('#streaming').bind('pageAnimationEnd', function(event, info){
+ if (info.direction == 'in') {
+ var session = $("#streaming").find('span[rel="session"]').html();
+ var name = $("#streaming").find('span[rel="name"]').html();
+ playvideo(session,name);
+ }
+})
+
+$('#streaming').bind('pageAnimationStart', function(event, info){
+ var session = $("#streaming").find('span[rel="session"]').html();
+ if (info.direction == 'out') {
+ $('#player').html('<img class="thumbnail" id="thumbnail" src="ram/session' + session + '/thumb.png"></img>');
+ }
+ })
+});
+
+//Get server status & Play video
+function playvideo(session,name) {
+ var prevmsg="";
+ var status_OnComplete = function(data) {
+ var status = data.status;
+ var message = data.message;
+ var url = data.url;
+ var thumbwidth = $('#streaming span[rel="thumbwidth"]').html();
+ var thumbheight = $('#streaming span[rel="thumbheight"]').html();
+ $('#streaming ul[class="streamstatus"]').find('span[class="mode"]').html(message);
+ if ( status == "ready" ) {
+ $('#player').html('<video id="videofeed" width="' + thumbwidth + '" height="' + thumbheight + '" poster="ram/session' + session + '/thumb.png" src="' + url + '" ></video><span rel="ready"></span>');
+ return false;
+ }
+ prevmsg = message;
+ status_Start(session,prevmsg);
+ }
+
+ var status_Start = function(session,prevmsg) {
+ dataString = "action=getStreamStatus&session=" + session + "&msg=" + prevmsg;
+ $.getJSON("bin/backend.php",
+ dataString,
+ function(data){
+ status_OnComplete(data)
+ });
+ }
+ status_Start(session,prevmsg);
+}
+// [/STREAM SECTION]
+
+// [BROWSER SECTION]
+//buttons
+$('ul[rel="filelist"] li.arrow a').tap(function(event) {
+ event.preventDefault();
+ json_start(this);
+ var type = $(this).attr('rel');
+ var name = $(this).find('span[class="menuname"]').html();
+ var path = $(this).parents('div').find('span[rel="path"]').html();
+ var browser = $(this).parents('div').find('span[rel="currentbrowser"]').html();
+ var foldertype = $(this).parents('div').find('span[rel="foldertype"]').html();
+ browser = parseInt(browser);
+ browser++;
+ if ( type == "folder" )
+ {
+ newpath=path+name;
+ gen_browser(newpath,browser,name,foldertype);
+ }
+ else if ( type == "rec" )
+ {
+ gen_streamrec(name,path);
+ }
+ else if ( type == "video" )
+ {
+ gen_streamvid(name,path);
+ }
+ return false;
+});
+
+$('div[rel="browser"] a[class="back"]').tap(function(event) {
+ event.preventDefault();
+ $(this).parents('div[rel="browser"]').remove();
+});
+
+$('div[rel="browser"] #home_but').tap(function(event) {
+ event.preventDefault();
+ $('#home').bind('pageAnimationEnd', function(event, info){
+ $('#jqt div[rel="browser"]').remove();
+ $('#home').unbind('pageAnimationEnd');
+
+ });
+});
+
+//functions
+function gen_browser(path,browser,name,foldertype) {
+ browser_template = '<div class="toolbar"></div>';
+ browser_template += '<ul rel="filelist" class="rounded"></ul>';
+ browser_template += '<div rel="dataholder" style="visibility:hidden">'
+ browser_template += '<span rel="path"></span>';
+ browser_template += '<span rel="currentbrowser"></span>';
+ browser_template += '<span rel="foldertype">' + foldertype + '</span>';
+ browser_template += '</div>';
+ $('#jqt').append('<div id="browser' + browser + '" rel="browser"></div>'),
+ $('#browser'+browser).html(browser_template);
+ if ( path == rec_path || path == video_path ) {
+ toolbar = '<a href="#" class="back">Home</a>';
+ if ( foldertype == 'rec' ){
+ toolbar += '<h1><img class="menuicon" src="img/record.png" /> ' + name + '</h1>';
+ }
+ else {
+ toolbar += '<h1><img class="menuicon" src="img/video.png" /> ' + name + '</h1>';
+ }
+ $('#browser' + browser + ' div[class="toolbar"]').html(toolbar);
+ }
+ else {
+ toolbar = '<a href="#" class="back">Back</a>';
+ toolbar += '<a href="#home" id="home_but" class="button">Home</a>';
+ if ( foldertype == 'rec' ){
+ toolbar += '<h1><img class="menuicon" src="img/record.png" /> ' + name + '</h1>';
+ }
+ else {
+ toolbar += '<h1><img class="menuicon" src="img/video.png" /> ' + name + '</h1>';
+ }
+ $('#browser' + browser + ' div[class="toolbar"]').html(toolbar);
+ }
+ var dataString = 'action=browseFolder&path='+path+'&browser=' + browser;
+ $.getJSON("bin/backend.php",
+ dataString,
+ function(data) {
+ $("#browser" + browser).find('ul').html('');
+ $("#browser" + browser).find('span[rel="path"]').html(path);
+ $("#browser" + browser).find('span[rel="currentbrowser"]').html(browser);
+ $.each(data.list, function(i,list){
+ if (list.type == "folder") {
+ $("#browser" + browser).find('ul').append('<li class="arrow"><a href="#" rel="folder"><span class="menuname">' + list.name + '</span></a></li>');
+ }
+ else if (list.type == "rec") {
+ $("#browser" + browser).find('ul').append('<li class="arrow"><a href="#" rel="rec"><img class="menuicon" src="img/record.png" /><span class="menuname">' + list.name + '</span></a></li>');
+ }
+ else if ( list.type == "video" ) {
+ $("#browser" + browser).find('ul').append('<li class="arrow"><a href="#" rel="video"><img class="menuicon" src="img/video.png" /><span class="menuname">' + list.name + '</span></a></li>');
+ }
+ });
+ json_complete('#browser' + browser,'cube');
+ });
+}
+
+
+// [/BROWSER SECTION]
+
+// [TIMER SECTION]
+//get fullchannel list onload
+
+$(document).ready(function(e){
+gen_formchanlist();
+});
+
+// buttons
+$('#timers li[class="arrow"] a').tap(function(event) {
+ event.preventDefault();
+ $(this).addClass('active');
+ if ( $(this).attr('rel') == "new" ) {
+ gen_edittimer();
+ } else {
+ timerid = $(this).attr('rel');
+ timerdata = $('#timers ul[rel="timers"] li a[rel="' + timerid + '"]').data("timerdata");
+ id = timerdata.id;
+ name = timerdata.name;
+ active = timerdata.active;
+ channumber = timerdata.channumber;
+ channame = timerdata.channame;
+ date = timerdata.date;
+ starttime = timerdata.starttime;
+ endtime = timerdata.endtime;
+ gen_edittimer(id,name,active,channumber,channame,date,starttime,endtime);
+ }
+});
+
+// gen Timers
+function gen_timers(edit) {
+ $('#timers ul[rel="timers"]').html('');
+ var dataString = 'action=getTimers';
+ $.getJSON("bin/backend.php",
+ dataString,
+ function(data) {
+ $('#timers ul[rel="timers"]').append('<li><span class="menutitle">Current timers</span></li>');
+ $.each(data.timer, function(i,timer){
+ if ( timer.running == "1" ) {
+ timerli = '<li class="arrow"><a rel="' + timer.id + '" href="#"><img class="menuicon" src="img/timerrec.png" /><span class="menuname">' + timer.date + ' ' + timer.name + '</span></a></li>';
+ }
+ else
+ {
+ if ( timer.active == "1" ) {
+ timerli = '<li class="arrow"><a rel="' + timer.id + '" href="#"><img class="menuicon" src="img/timeron.png" /><span class="menuname">' + timer.date + ' ' + timer.name + '</span></a></li>';
+ } else {
+ timerli = '<li class="arrow"><a rel="' + timer.id + '" href="#"><img class="menuicon" src="img/timeroff.png" /><span class="menuname">' + timer.date + ' ' + timer.name + '</span></a></li>';
+ }
+ }
+ $('#timers ul[rel="timers"]').append(timerli);
+ $('#timers ul[rel="timers"] li a[rel="' + timer.id + '"]').data("timerdata", timer);
+ });
+ if ( edit ) {
+ hide_loader();
+ jQT.goBack();
+ }
+ else {
+ json_complete('#timers','cube');
+ }
+ });
+}
+
+function gen_edittimer(id,name,active,channumber,channame,date,starttime,endtime) {
+ $('ul[ref="submitbut"]').remove();
+ if (id) {
+ $('#edittimer h1').html('<img class="menuicon" src="img/timers.png" / > EDIT TIMER');
+ if (active = 1)
+ {
+ $('#timer_active').attr("checked", "checked");
+ }
+ $('#timer_id').val(id);
+ $('#timer_name').val(name);
+ $('#timer_chan option[value="' + channumber + '"]').attr("selected", "selected");
+ $('#timer_date').val(date);
+ var wheeldate = date;
+ while (wheeldate.indexOf("-") > -1)
+ wheeldate = wheeldate.replace("-", ",");
+ $('#a_date').attr('href', "javascript:openSelectDate(" + wheeldate + ");");
+ $('#layer_date').html(date);
+ $('#timer_starttime').val(starttime);
+ $('#timer_endtime').val(endtime);
+ wheelstart_h = starttime.substring(0,2);
+ wheelstart_m = starttime.substring(2,4);
+ $('#layer_starttime').html(wheelstart_h + 'h' + wheelstart_m);
+ $('#a_starttime').attr('href', "javascript:openSelectTime('layer_starttime','" + wheelstart_h + "','" + wheelstart_m + "')");
+ wheelend_h = endtime.substring(0,2);
+ wheelend_m = endtime.substring(2,4);
+ $('#layer_endtime').html(wheelend_h + 'h' + wheelend_m);
+ $('#a_endtime').attr('href', "javascript:openSelectTime('layer_endtime','" + wheelend_h + "','" + wheelend_m + "')");
+ submitbuttons = '<ul ref="submitbut" class="individual">';
+ submitbuttons += '<li><a class="submit_form" href="#">Edit</a></li>';
+ submitbuttons += '<li><a class="abutton" href="javascript:deletetimer(\'id\');">Delete</a></li></ul>';
+ $('#timer').append(submitbuttons);
+ }
+ else {
+ $('#edittimer h1').html('<img class="menuicon" src="img/timers.png" / > NEW TIMER');
+ $('#timer_active').attr("checked", "checked");
+ $('#timer_id').val(null);
+ $('#timer_name').val(null);
+ $('#timer_chan option').removeAttr("selected");
+ $('#timer_chan option[value="1"]').attr("selected", "selected");
+ $('#a_date').attr('href', "javascript:openSelectDate();");
+ $('#layer_date').html("Select date");
+ $('#timer_date').val(null);
+ $('#timer_starttime').val(null);
+ $('#timer_endtime').val(null);
+ $('#a_starttime').attr('href', "javascript:openSelectTime('layer_starttime')");
+ $('#layer_starttime').html('Select start time');
+ $('#a_endtime').attr('href', "javascript:openSelectTime('layer_endtime')");
+ $('#layer_endtime').html('select end time');
+ submitbutton = '<ul ref="submitbut" class="rounded">';
+ submitbutton += '<li><center><a class="submit_form" href="#">Create</a></center></li></ul>';
+ $('#timer').append(submitbutton);
+ }
+ $('.formerror').hide();
+ json_complete('#edittimer','cube');
+}
+//get full chanlist for timer page ( doing it one time on document load ).
+function gen_formchanlist() {
+ var dataString = 'action=getFullChanList';
+ $.getJSON("bin/backend.php",
+ dataString,
+ function(data) {
+ $.each(data.category, function(i,category){
+ $('#timer_chan').append('<optgroup label="' + category.name + '">');
+ var catname = category.name;
+ $.each(category.channel, function(j, channel){
+ $('#timer_chan optgroup[label="' + catname +'"]').append('<option value="' + channel.number + '">' + channel.name +'</option>');
+ });
+ $('#timer_chan').append('</optgroup>');
+ });
+ });
+}
+
+// TIMER FORM VALIDATION & SUBMIT
+$('.submit_form').tap(function(event) {
+ event.preventDefault();
+ $('.formerror').hide();
+ $(this).removeClass('active');
+ var timer_name = $("input#timer_name").val();
+ if (timer_name == "") {
+ $("li#timer_name_error").show();
+ $.scrollTo('#edittimer #ul[rel="name"]');
+ return false;
+ }
+ var timer_date = $("input#timer_date").val();
+ if (timer_date == "") {
+ $("li#timer_date_error").show();
+ $.scrollTo('#edittimer #timer_date_error');
+ return false;
+ }
+ var timer_starttime = $("input#timer_starttime").val();
+ if (timer_starttime == "") {
+ $("li#timer_starttime_error").show();
+ $.scrollTo('#edittimer #timer_starttime_error');
+ return false;
+ }
+ var timer_endtime = $("input#timer_endtime").val();
+ if (timer_endtime == "") {
+ $("li#timer_endtime_error").show();
+ $.scrollTo('#edittimer #timer_endtime_error');
+ return false;
+ }
+ var timer_id = $("input#timer_id").val();
+ var timer_chan = $("select#timer_chan").val();
+ var timer_active = $("input#timer_active").val();
+ var dataString = 'action=editTimer&id=' + timer_id + '&active=' + timer_active + '&channumber=' + timer_chan + '&date=' + timer_date + '&starttime=' + timer_starttime + '&endtime=' + timer_endtime;
+ $.getJSON("bin/backend.php",
+ dataString,
+ function(data) {
+ message = data.status + ": " + data.message;
+ gen_timers("true");
+ json_start(this);
+ showStatus( 0,message );
+ return false;
+ });
+ return false;
+});
+
+function showStatus( timeout, message ) {
+ if( timeout == 0 ) {
+ $('#timer_status').html(message);
+ $('#timer_status').show();
+ setTimeout( function() { showStatus( 1, message ); }, 4000 );
+ } else if( timeout == 1 ) {
+ $('#timer_status').hide();
+ }
+}
+// [/TIMER SECTION]
\ No newline at end of file diff --git a/themes/js/spinningwheel-min.js b/themes/js/spinningwheel-min.js new file mode 100644 index 0000000..a2b68dd --- /dev/null +++ b/themes/js/spinningwheel-min.js @@ -0,0 +1 @@ +var SpinningWheel={cellHeight:44,friction:0.003,slotData:[],handleEvent:function(e){if(e.type=="touchstart"){this.lockScreen(e);if(e.currentTarget.id=="sw-cancel"||e.currentTarget.id=="sw-done"){this.tapDown(e)}else{if(e.currentTarget.id=="sw-frame"){this.scrollStart(e)}}}else{if(e.type=="touchmove"){this.lockScreen(e);if(e.currentTarget.id=="sw-cancel"||e.currentTarget.id=="sw-done"){this.tapCancel(e)}else{if(e.currentTarget.id=="sw-frame"){this.scrollMove(e)}}}else{if(e.type=="touchend"){if(e.currentTarget.id=="sw-cancel"||e.currentTarget.id=="sw-done"){this.tapUp(e)}else{if(e.currentTarget.id=="sw-frame"){this.scrollEnd(e)}}}else{if(e.type=="webkitTransitionEnd"){if(e.target.id=="sw-wrapper"){this.destroy()}else{this.backWithinBoundaries(e)}}else{if(e.type=="orientationchange"){this.onOrientationChange(e)}else{if(e.type=="scroll"){this.onScroll(e)}}}}}}},onOrientationChange:function(e){window.scrollTo(0,0);this.swWrapper.style.top=window.innerHeight+window.pageYOffset+"px";this.calculateSlotsWidth()},onScroll:function(e){this.swWrapper.style.top=window.innerHeight+window.pageYOffset+"px"},lockScreen:function(e){e.preventDefault();e.stopPropagation()},reset:function(){this.slotEl=[];this.activeSlot=null;this.swWrapper=undefined;this.swSlotWrapper=undefined;this.swSlots=undefined;this.swFrame=undefined},calculateSlotsWidth:function(){var div=this.swSlots.getElementsByTagName("div");for(var i=0;i<div.length;i+=1){this.slotEl[i].slotWidth=div[i].offsetWidth}},create:function(){var i,l,out,ul,div;this.reset();div=document.createElement("div");div.id="sw-wrapper";div.style.top=window.innerHeight+window.pageYOffset+"px";div.style.webkitTransitionProperty="-webkit-transform";div.innerHTML='<div id="sw-header"><div id="sw-cancel">Cancel</div><div id="sw-done">Done</div></div><div id="sw-slots-wrapper"><div id="sw-slots"></div></div><div id="sw-frame"></div>';document.body.appendChild(div);this.swWrapper=div;this.swSlotWrapper=document.getElementById("sw-slots-wrapper");this.swSlots=document.getElementById("sw-slots");this.swFrame=document.getElementById("sw-frame");for(l=0;l<this.slotData.length;l+=1){ul=document.createElement("ul");out="";for(i in this.slotData[l].values){out+="<li>"+this.slotData[l].values[i]+"</li>"}ul.innerHTML=out;div=document.createElement("div");div.className=this.slotData[l].style;div.appendChild(ul);this.swSlots.appendChild(div);ul.slotPosition=l;ul.slotYPosition=0;ul.slotWidth=0;ul.slotMaxScroll=this.swSlotWrapper.clientHeight-ul.clientHeight-86;ul.style.webkitTransitionTimingFunction="cubic-bezier(0, 0, 0.2, 1)";this.slotEl.push(ul);if(this.slotData[l].defaultValue){this.scrollToValue(l,this.slotData[l].defaultValue)}}this.calculateSlotsWidth();document.addEventListener("touchstart",this,false);document.addEventListener("touchmove",this,false);window.addEventListener("orientationchange",this,true);window.addEventListener("scroll",this,true);document.getElementById("sw-cancel").addEventListener("touchstart",this,false);document.getElementById("sw-done").addEventListener("touchstart",this,false);this.swFrame.addEventListener("touchstart",this,false)},open:function(){this.create();this.swWrapper.style.webkitTransitionTimingFunction="ease-out";this.swWrapper.style.webkitTransitionDuration="400ms";this.swWrapper.style.webkitTransform="translate3d(0, -260px, 0)"},destroy:function(){this.swWrapper.removeEventListener("webkitTransitionEnd",this,false);this.swFrame.removeEventListener("touchstart",this,false);document.getElementById("sw-cancel").removeEventListener("touchstart",this,false);document.getElementById("sw-done").removeEventListener("touchstart",this,false);document.removeEventListener("touchstart",this,false);document.removeEventListener("touchmove",this,false);window.removeEventListener("orientationchange",this,true);window.removeEventListener("scroll",this,true);this.slotData=[];this.cancelAction=function(){return false};this.cancelDone=function(){return true};this.reset();document.body.removeChild(document.getElementById("sw-wrapper"))},close:function(){this.swWrapper.style.webkitTransitionTimingFunction="ease-in";this.swWrapper.style.webkitTransitionDuration="400ms";this.swWrapper.style.webkitTransform="translate3d(0, 0, 0)";this.swWrapper.addEventListener("webkitTransitionEnd",this,false)},addSlot:function(values,style,defaultValue){if(!style){style=""}style=style.split(" ");for(var i=0;i<style.length;i+=1){style[i]="sw-"+style[i]}style=style.join(" ");var obj={values:values,style:style,defaultValue:defaultValue};this.slotData.push(obj)},getSelectedValues:function(){var index,count,i,l,keys=[],values=[];for(i in this.slotEl){this.slotEl[i].removeEventListener("webkitTransitionEnd",this,false);this.slotEl[i].style.webkitTransitionDuration="0";if(this.slotEl[i].slotYPosition>0){this.setPosition(i,0)}else{if(this.slotEl[i].slotYPosition<this.slotEl[i].slotMaxScroll){this.setPosition(i,this.slotEl[i].slotMaxScroll)}}index=-Math.round(this.slotEl[i].slotYPosition/this.cellHeight);count=0;for(l in this.slotData[i].values){if(count==index){keys.push(l);values.push(this.slotData[i].values[l]);break}count+=1}}return{keys:keys,values:values}},setPosition:function(slot,pos){this.slotEl[slot].slotYPosition=pos;this.slotEl[slot].style.webkitTransform="translate3d(0, "+pos+"px, 0)"},scrollStart:function(e){var xPos=e.targetTouches[0].clientX-this.swSlots.offsetLeft;var slot=0;for(var i=0;i<this.slotEl.length;i+=1){slot+=this.slotEl[i].slotWidth;if(xPos<slot){this.activeSlot=i;break}}if(this.slotData[this.activeSlot].style.match("readonly")){this.swFrame.removeEventListener("touchmove",this,false);this.swFrame.removeEventListener("touchend",this,false);return false}this.slotEl[this.activeSlot].removeEventListener("webkitTransitionEnd",this,false);this.slotEl[this.activeSlot].style.webkitTransitionDuration="0";var theTransform=window.getComputedStyle(this.slotEl[this.activeSlot]).webkitTransform;theTransform=new WebKitCSSMatrix(theTransform).m42;if(theTransform!=this.slotEl[this.activeSlot].slotYPosition){this.setPosition(this.activeSlot,theTransform)}this.startY=e.targetTouches[0].clientY;this.scrollStartY=this.slotEl[this.activeSlot].slotYPosition;this.scrollStartTime=e.timeStamp;this.swFrame.addEventListener("touchmove",this,false);this.swFrame.addEventListener("touchend",this,false);return true},scrollMove:function(e){var topDelta=e.targetTouches[0].clientY-this.startY;if(this.slotEl[this.activeSlot].slotYPosition>0||this.slotEl[this.activeSlot].slotYPosition<this.slotEl[this.activeSlot].slotMaxScroll){topDelta/=2}this.setPosition(this.activeSlot,this.slotEl[this.activeSlot].slotYPosition+topDelta);this.startY=e.targetTouches[0].clientY;if(e.timeStamp-this.scrollStartTime>80){this.scrollStartY=this.slotEl[this.activeSlot].slotYPosition;this.scrollStartTime=e.timeStamp}},scrollEnd:function(e){this.swFrame.removeEventListener("touchmove",this,false);this.swFrame.removeEventListener("touchend",this,false);if(this.slotEl[this.activeSlot].slotYPosition>0||this.slotEl[this.activeSlot].slotYPosition<this.slotEl[this.activeSlot].slotMaxScroll){this.scrollTo(this.activeSlot,this.slotEl[this.activeSlot].slotYPosition>0?0:this.slotEl[this.activeSlot].slotMaxScroll);return false}var scrollDistance=this.slotEl[this.activeSlot].slotYPosition-this.scrollStartY;if(scrollDistance<this.cellHeight/1.5&&scrollDistance>-this.cellHeight/1.5){if(this.slotEl[this.activeSlot].slotYPosition%this.cellHeight){this.scrollTo(this.activeSlot,Math.round(this.slotEl[this.activeSlot].slotYPosition/this.cellHeight)*this.cellHeight,"100ms")}return false}var scrollDuration=e.timeStamp-this.scrollStartTime;var newDuration=(2*scrollDistance/scrollDuration)/this.friction;var newScrollDistance=(this.friction/2)*(newDuration*newDuration);if(newDuration<0){newDuration=-newDuration;newScrollDistance=-newScrollDistance}var newPosition=this.slotEl[this.activeSlot].slotYPosition+newScrollDistance;if(newPosition>0){newPosition/=2;newDuration/=3;if(newPosition>this.swSlotWrapper.clientHeight/4){newPosition=this.swSlotWrapper.clientHeight/4}}else{if(newPosition<this.slotEl[this.activeSlot].slotMaxScroll){newPosition=(newPosition-this.slotEl[this.activeSlot].slotMaxScroll)/2+this.slotEl[this.activeSlot].slotMaxScroll;newDuration/=3;if(newPosition<this.slotEl[this.activeSlot].slotMaxScroll-this.swSlotWrapper.clientHeight/4){newPosition=this.slotEl[this.activeSlot].slotMaxScroll-this.swSlotWrapper.clientHeight/4}}else{newPosition=Math.round(newPosition/this.cellHeight)*this.cellHeight}}this.scrollTo(this.activeSlot,Math.round(newPosition),Math.round(newDuration)+"ms");return true},scrollTo:function(slotNum,dest,runtime){this.slotEl[slotNum].style.webkitTransitionDuration=runtime?runtime:"100ms";this.setPosition(slotNum,dest?dest:0);if(this.slotEl[slotNum].slotYPosition>0||this.slotEl[slotNum].slotYPosition<this.slotEl[slotNum].slotMaxScroll){this.slotEl[slotNum].addEventListener("webkitTransitionEnd",this,false)}},scrollToValue:function(slot,value){var yPos,count,i;this.slotEl[slot].removeEventListener("webkitTransitionEnd",this,false);this.slotEl[slot].style.webkitTransitionDuration="0";count=0;for(i in this.slotData[slot].values){if(i==value){yPos=count*this.cellHeight;this.setPosition(slot,yPos);break}count-=1}},backWithinBoundaries:function(e){e.target.removeEventListener("webkitTransitionEnd",this,false);this.scrollTo(e.target.slotPosition,e.target.slotYPosition>0?0:e.target.slotMaxScroll,"150ms");return false},tapDown:function(e){e.currentTarget.addEventListener("touchmove",this,false);e.currentTarget.addEventListener("touchend",this,false);e.currentTarget.className="sw-pressed"},tapCancel:function(e){e.currentTarget.removeEventListener("touchmove",this,false);e.currentTarget.removeEventListener("touchend",this,false);e.currentTarget.className=""},tapUp:function(e){this.tapCancel(e);if(e.currentTarget.id=="sw-cancel"){this.cancelAction()}else{this.doneAction()}this.close()},setCancelAction:function(action){this.cancelAction=action},setDoneAction:function(action){this.doneAction=action},cancelAction:function(){return false},cancelDone:function(){return true}};
\ No newline at end of file diff --git a/themes/js/spinningwheel.js b/themes/js/spinningwheel.js new file mode 100644 index 0000000..79f8ab6 --- /dev/null +++ b/themes/js/spinningwheel.js @@ -0,0 +1,492 @@ +/**
+ *
+ * Find more about the Spinning Wheel function at
+ * http://cubiq.org/spinning-wheel-on-webkit-for-iphone-ipod-touch/11
+ *
+ * Copyright (c) 2009 Matteo Spinelli, http://cubiq.org/
+ * Released under MIT license
+ * http://cubiq.org/dropbox/mit-license.txt
+ *
+ * Version 1.4 - Last updated: 2009.07.09
+ *
+ */
+
+var SpinningWheel = {
+ cellHeight: 44,
+ friction: 0.003,
+ slotData: [],
+
+
+ /**
+ *
+ * Event handler
+ *
+ */
+
+ handleEvent: function (e) {
+ if (e.type == 'touchstart') {
+ this.lockScreen(e);
+ if (e.currentTarget.id == 'sw-cancel' || e.currentTarget.id == 'sw-done') {
+ this.tapDown(e);
+ } else if (e.currentTarget.id == 'sw-frame') {
+ this.scrollStart(e);
+ }
+ } else if (e.type == 'touchmove') {
+ this.lockScreen(e);
+
+ if (e.currentTarget.id == 'sw-cancel' || e.currentTarget.id == 'sw-done') {
+ this.tapCancel(e);
+ } else if (e.currentTarget.id == 'sw-frame') {
+ this.scrollMove(e);
+ }
+ } else if (e.type == 'touchend') {
+ if (e.currentTarget.id == 'sw-cancel' || e.currentTarget.id == 'sw-done') {
+ this.tapUp(e);
+ } else if (e.currentTarget.id == 'sw-frame') {
+ this.scrollEnd(e);
+ }
+ } else if (e.type == 'webkitTransitionEnd') {
+ if (e.target.id == 'sw-wrapper') {
+ this.destroy();
+ } else {
+ this.backWithinBoundaries(e);
+ }
+ } else if (e.type == 'orientationchange') {
+ this.onOrientationChange(e);
+ } else if (e.type == 'scroll') {
+ this.onScroll(e);
+ }
+ },
+
+
+ /**
+ *
+ * Global events
+ *
+ */
+
+ onOrientationChange: function (e) {
+ window.scrollTo(0, 0);
+ this.swWrapper.style.top = window.innerHeight + window.pageYOffset + 'px';
+ this.calculateSlotsWidth();
+ },
+
+ onScroll: function (e) {
+ this.swWrapper.style.top = window.innerHeight + window.pageYOffset + 'px';
+ },
+
+ lockScreen: function (e) {
+ e.preventDefault();
+ e.stopPropagation();
+ },
+
+
+ /**
+ *
+ * Initialization
+ *
+ */
+
+ reset: function () {
+ this.slotEl = [];
+
+ this.activeSlot = null;
+
+ this.swWrapper = undefined;
+ this.swSlotWrapper = undefined;
+ this.swSlots = undefined;
+ this.swFrame = undefined;
+ },
+
+ calculateSlotsWidth: function () {
+ var div = this.swSlots.getElementsByTagName('div');
+ for (var i = 0; i < div.length; i += 1) {
+ this.slotEl[i].slotWidth = div[i].offsetWidth;
+ }
+ },
+
+ create: function () {
+ var i, l, out, ul, div;
+
+ this.reset(); // Initialize object variables
+
+ // Create the Spinning Wheel main wrapper
+ div = document.createElement('div');
+ div.id = 'sw-wrapper';
+ div.style.top = window.innerHeight + window.pageYOffset + 'px'; // Place the SW down the actual viewing screen
+ div.style.webkitTransitionProperty = '-webkit-transform';
+ div.innerHTML = '<div id="sw-header"><div id="sw-cancel">Cancel</' + 'div><div id="sw-done">Done</' + 'div></' + 'div><div id="sw-slots-wrapper"><div id="sw-slots"></' + 'div></' + 'div><div id="sw-frame"></' + 'div>';
+
+ document.body.appendChild(div);
+
+ this.swWrapper = div; // The SW wrapper
+ this.swSlotWrapper = document.getElementById('sw-slots-wrapper'); // Slots visible area
+ this.swSlots = document.getElementById('sw-slots'); // Pseudo table element (inner wrapper)
+ this.swFrame = document.getElementById('sw-frame'); // The scrolling controller
+
+ // Create HTML slot elements
+ for (l = 0; l < this.slotData.length; l += 1) {
+ // Create the slot
+ ul = document.createElement('ul');
+ out = '';
+ for (i in this.slotData[l].values) {
+ out += '<li>' + this.slotData[l].values[i] + '<' + '/li>';
+ }
+ ul.innerHTML = out;
+
+ div = document.createElement('div'); // Create slot container
+ div.className = this.slotData[l].style; // Add styles to the container
+ div.appendChild(ul);
+
+ // Append the slot to the wrapper
+ this.swSlots.appendChild(div);
+
+ ul.slotPosition = l; // Save the slot position inside the wrapper
+ ul.slotYPosition = 0;
+ ul.slotWidth = 0;
+ ul.slotMaxScroll = this.swSlotWrapper.clientHeight - ul.clientHeight - 86;
+ ul.style.webkitTransitionTimingFunction = 'cubic-bezier(0, 0, 0.2, 1)'; // Add default transition
+
+ this.slotEl.push(ul); // Save the slot for later use
+
+ // Place the slot to its default position (if other than 0)
+ if (this.slotData[l].defaultValue) {
+ this.scrollToValue(l, this.slotData[l].defaultValue);
+ }
+ }
+
+ this.calculateSlotsWidth();
+
+ // Global events
+ document.addEventListener('touchstart', this, false); // Prevent page scrolling
+ document.addEventListener('touchmove', this, false); // Prevent page scrolling
+ window.addEventListener('orientationchange', this, true); // Optimize SW on orientation change
+ window.addEventListener('scroll', this, true); // Reposition SW on page scroll
+
+ // Cancel/Done buttons events
+ document.getElementById('sw-cancel').addEventListener('touchstart', this, false);
+ document.getElementById('sw-done').addEventListener('touchstart', this, false);
+
+ // Add scrolling to the slots
+ this.swFrame.addEventListener('touchstart', this, false);
+ },
+
+ open: function () {
+ this.create();
+
+ this.swWrapper.style.webkitTransitionTimingFunction = 'ease-out';
+ this.swWrapper.style.webkitTransitionDuration = '400ms';
+ this.swWrapper.style.webkitTransform = 'translate3d(0, -260px, 0)';
+ },
+
+
+ /**
+ *
+ * Unload
+ *
+ */
+
+ destroy: function () {
+ this.swWrapper.removeEventListener('webkitTransitionEnd', this, false);
+
+ this.swFrame.removeEventListener('touchstart', this, false);
+
+ document.getElementById('sw-cancel').removeEventListener('touchstart', this, false);
+ document.getElementById('sw-done').removeEventListener('touchstart', this, false);
+
+ document.removeEventListener('touchstart', this, false);
+ document.removeEventListener('touchmove', this, false);
+ window.removeEventListener('orientationchange', this, true);
+ window.removeEventListener('scroll', this, true);
+
+ this.slotData = [];
+ this.cancelAction = function () {
+ return false;
+ };
+
+ this.cancelDone = function () {
+ return true;
+ };
+
+ this.reset();
+
+ document.body.removeChild(document.getElementById('sw-wrapper'));
+ },
+
+ close: function () {
+ this.swWrapper.style.webkitTransitionTimingFunction = 'ease-in';
+ this.swWrapper.style.webkitTransitionDuration = '400ms';
+ this.swWrapper.style.webkitTransform = 'translate3d(0, 0, 0)';
+
+ this.swWrapper.addEventListener('webkitTransitionEnd', this, false);
+ },
+
+
+ /**
+ *
+ * Generic methods
+ *
+ */
+
+ addSlot: function (values, style, defaultValue) {
+ if (!style) {
+ style = '';
+ }
+
+ style = style.split(' ');
+
+ for (var i = 0; i < style.length; i += 1) {
+ style[i] = 'sw-' + style[i];
+ }
+
+ style = style.join(' ');
+
+ var obj = { 'values': values, 'style': style, 'defaultValue': defaultValue };
+ this.slotData.push(obj);
+ },
+
+ getSelectedValues: function () {
+ var index, count,
+ i, l,
+ keys = [], values = [];
+
+ for (i in this.slotEl) {
+ // Remove any residual animation
+ this.slotEl[i].removeEventListener('webkitTransitionEnd', this, false);
+ this.slotEl[i].style.webkitTransitionDuration = '0';
+
+ if (this.slotEl[i].slotYPosition > 0) {
+ this.setPosition(i, 0);
+ } else if (this.slotEl[i].slotYPosition < this.slotEl[i].slotMaxScroll) {
+ this.setPosition(i, this.slotEl[i].slotMaxScroll);
+ }
+
+ index = -Math.round(this.slotEl[i].slotYPosition / this.cellHeight);
+
+ count = 0;
+ for (l in this.slotData[i].values) {
+ if (count == index) {
+ keys.push(l);
+ values.push(this.slotData[i].values[l]);
+ break;
+ }
+
+ count += 1;
+ }
+ }
+
+ return { 'keys': keys, 'values': values };
+ },
+
+
+ /**
+ *
+ * Rolling slots
+ *
+ */
+
+ setPosition: function (slot, pos) {
+ this.slotEl[slot].slotYPosition = pos;
+ this.slotEl[slot].style.webkitTransform = 'translate3d(0, ' + pos + 'px, 0)';
+ },
+
+ scrollStart: function (e) {
+ // Find the clicked slot
+ var xPos = e.targetTouches[0].clientX - this.swSlots.offsetLeft; // Clicked position minus left offset (should be 11px)
+
+ // Find tapped slot
+ var slot = 0;
+ for (var i = 0; i < this.slotEl.length; i += 1) {
+ slot += this.slotEl[i].slotWidth;
+
+ if (xPos < slot) {
+ this.activeSlot = i;
+ break;
+ }
+ }
+
+ // If slot is readonly do nothing
+ if (this.slotData[this.activeSlot].style.match('readonly')) {
+ this.swFrame.removeEventListener('touchmove', this, false);
+ this.swFrame.removeEventListener('touchend', this, false);
+ return false;
+ }
+
+ this.slotEl[this.activeSlot].removeEventListener('webkitTransitionEnd', this, false); // Remove transition event (if any)
+ this.slotEl[this.activeSlot].style.webkitTransitionDuration = '0'; // Remove any residual transition
+
+ // Stop and hold slot position
+ var theTransform = window.getComputedStyle(this.slotEl[this.activeSlot]).webkitTransform;
+ theTransform = new WebKitCSSMatrix(theTransform).m42;
+ if (theTransform != this.slotEl[this.activeSlot].slotYPosition) {
+ this.setPosition(this.activeSlot, theTransform);
+ }
+
+ this.startY = e.targetTouches[0].clientY;
+ this.scrollStartY = this.slotEl[this.activeSlot].slotYPosition;
+ this.scrollStartTime = e.timeStamp;
+
+ this.swFrame.addEventListener('touchmove', this, false);
+ this.swFrame.addEventListener('touchend', this, false);
+
+ return true;
+ },
+
+ scrollMove: function (e) {
+ var topDelta = e.targetTouches[0].clientY - this.startY;
+
+ if (this.slotEl[this.activeSlot].slotYPosition > 0 || this.slotEl[this.activeSlot].slotYPosition < this.slotEl[this.activeSlot].slotMaxScroll) {
+ topDelta /= 2;
+ }
+
+ this.setPosition(this.activeSlot, this.slotEl[this.activeSlot].slotYPosition + topDelta);
+ this.startY = e.targetTouches[0].clientY;
+
+ // Prevent slingshot effect
+ if (e.timeStamp - this.scrollStartTime > 80) {
+ this.scrollStartY = this.slotEl[this.activeSlot].slotYPosition;
+ this.scrollStartTime = e.timeStamp;
+ }
+ },
+
+ scrollEnd: function (e) {
+ this.swFrame.removeEventListener('touchmove', this, false);
+ this.swFrame.removeEventListener('touchend', this, false);
+
+ // If we are outside of the boundaries, let's go back to the sheepfold
+ if (this.slotEl[this.activeSlot].slotYPosition > 0 || this.slotEl[this.activeSlot].slotYPosition < this.slotEl[this.activeSlot].slotMaxScroll) {
+ this.scrollTo(this.activeSlot, this.slotEl[this.activeSlot].slotYPosition > 0 ? 0 : this.slotEl[this.activeSlot].slotMaxScroll);
+ return false;
+ }
+
+ // Lame formula to calculate a fake deceleration
+ var scrollDistance = this.slotEl[this.activeSlot].slotYPosition - this.scrollStartY;
+
+ // The drag session was too short
+ if (scrollDistance < this.cellHeight / 1.5 && scrollDistance > -this.cellHeight / 1.5) {
+ if (this.slotEl[this.activeSlot].slotYPosition % this.cellHeight) {
+ this.scrollTo(this.activeSlot, Math.round(this.slotEl[this.activeSlot].slotYPosition / this.cellHeight) * this.cellHeight, '100ms');
+ }
+
+ return false;
+ }
+
+ var scrollDuration = e.timeStamp - this.scrollStartTime;
+
+ var newDuration = (2 * scrollDistance / scrollDuration) / this.friction;
+ var newScrollDistance = (this.friction / 2) * (newDuration * newDuration);
+
+ if (newDuration < 0) {
+ newDuration = -newDuration;
+ newScrollDistance = -newScrollDistance;
+ }
+
+ var newPosition = this.slotEl[this.activeSlot].slotYPosition + newScrollDistance;
+
+ if (newPosition > 0) {
+ // Prevent the slot to be dragged outside the visible area (top margin)
+ newPosition /= 2;
+ newDuration /= 3;
+
+ if (newPosition > this.swSlotWrapper.clientHeight / 4) {
+ newPosition = this.swSlotWrapper.clientHeight / 4;
+ }
+ } else if (newPosition < this.slotEl[this.activeSlot].slotMaxScroll) {
+ // Prevent the slot to be dragged outside the visible area (bottom margin)
+ newPosition = (newPosition - this.slotEl[this.activeSlot].slotMaxScroll) / 2 + this.slotEl[this.activeSlot].slotMaxScroll;
+ newDuration /= 3;
+
+ if (newPosition < this.slotEl[this.activeSlot].slotMaxScroll - this.swSlotWrapper.clientHeight / 4) {
+ newPosition = this.slotEl[this.activeSlot].slotMaxScroll - this.swSlotWrapper.clientHeight / 4;
+ }
+ } else {
+ newPosition = Math.round(newPosition / this.cellHeight) * this.cellHeight;
+ }
+
+ this.scrollTo(this.activeSlot, Math.round(newPosition), Math.round(newDuration) + 'ms');
+
+ return true;
+ },
+
+ scrollTo: function (slotNum, dest, runtime) {
+ this.slotEl[slotNum].style.webkitTransitionDuration = runtime ? runtime : '100ms';
+ this.setPosition(slotNum, dest ? dest : 0);
+
+ // If we are outside of the boundaries go back to the sheepfold
+ if (this.slotEl[slotNum].slotYPosition > 0 || this.slotEl[slotNum].slotYPosition < this.slotEl[slotNum].slotMaxScroll) {
+ this.slotEl[slotNum].addEventListener('webkitTransitionEnd', this, false);
+ }
+ },
+
+ scrollToValue: function (slot, value) {
+ var yPos, count, i;
+
+ this.slotEl[slot].removeEventListener('webkitTransitionEnd', this, false);
+ this.slotEl[slot].style.webkitTransitionDuration = '0';
+
+ count = 0;
+ for (i in this.slotData[slot].values) {
+ if (i == value) {
+ yPos = count * this.cellHeight;
+ this.setPosition(slot, yPos);
+ break;
+ }
+
+ count -= 1;
+ }
+ },
+
+ backWithinBoundaries: function (e) {
+ e.target.removeEventListener('webkitTransitionEnd', this, false);
+
+ this.scrollTo(e.target.slotPosition, e.target.slotYPosition > 0 ? 0 : e.target.slotMaxScroll, '150ms');
+ return false;
+ },
+
+
+ /**
+ *
+ * Buttons
+ *
+ */
+
+ tapDown: function (e) {
+ e.currentTarget.addEventListener('touchmove', this, false);
+ e.currentTarget.addEventListener('touchend', this, false);
+ e.currentTarget.className = 'sw-pressed';
+ },
+
+ tapCancel: function (e) {
+ e.currentTarget.removeEventListener('touchmove', this, false);
+ e.currentTarget.removeEventListener('touchend', this, false);
+ e.currentTarget.className = '';
+ },
+
+ tapUp: function (e) {
+ this.tapCancel(e);
+
+ if (e.currentTarget.id == 'sw-cancel') {
+ this.cancelAction();
+ } else {
+ this.doneAction();
+ }
+
+ this.close();
+ },
+
+ setCancelAction: function (action) {
+ this.cancelAction = action;
+ },
+
+ setDoneAction: function (action) {
+ this.doneAction = action;
+ },
+
+ cancelAction: function () {
+ return false;
+ },
+
+ cancelDone: function () {
+ return true;
+ }
+};
\ No newline at end of file diff --git a/themes/logos/FRANCE 2.png b/themes/logos/FRANCE 2.png Binary files differnew file mode 100644 index 0000000..c77d725 --- /dev/null +++ b/themes/logos/FRANCE 2.png diff --git a/themes/logos/FRANCE 3.png b/themes/logos/FRANCE 3.png Binary files differnew file mode 100644 index 0000000..8f20d16 --- /dev/null +++ b/themes/logos/FRANCE 3.png diff --git a/themes/logos/TF1.png b/themes/logos/TF1.png Binary files differnew file mode 100644 index 0000000..56b1a74 --- /dev/null +++ b/themes/logos/TF1.png diff --git a/themes/ram/session1/stream.m3u8 b/themes/ram/session1/stream.m3u8 new file mode 100644 index 0000000..e3f9509 --- /dev/null +++ b/themes/ram/session1/stream.m3u8 @@ -0,0 +1,2 @@ +#TEST +http://alib.hd.free.fr/istreamdev2/ram/session0/stream1.ts diff --git a/themes/ram/session1/thumb.png b/themes/ram/session1/thumb.png Binary files differnew file mode 100644 index 0000000..56b1a74 --- /dev/null +++ b/themes/ram/session1/thumb.png diff --git a/themes/ram/session2/stream.m3u8 b/themes/ram/session2/stream.m3u8 new file mode 100644 index 0000000..e3f9509 --- /dev/null +++ b/themes/ram/session2/stream.m3u8 @@ -0,0 +1,2 @@ +#TEST +http://alib.hd.free.fr/istreamdev2/ram/session0/stream1.ts diff --git a/themes/ram/session2/thumb.png b/themes/ram/session2/thumb.png Binary files differnew file mode 100644 index 0000000..56b1a74 --- /dev/null +++ b/themes/ram/session2/thumb.png diff --git a/themes/ram/session3/stream.m3u8 b/themes/ram/session3/stream.m3u8 new file mode 100644 index 0000000..e3f9509 --- /dev/null +++ b/themes/ram/session3/stream.m3u8 @@ -0,0 +1,2 @@ +#TEST +http://alib.hd.free.fr/istreamdev2/ram/session0/stream1.ts diff --git a/themes/ram/session3/thumb.png b/themes/ram/session3/thumb.png Binary files differnew file mode 100755 index 0000000..92d077a --- /dev/null +++ b/themes/ram/session3/thumb.png diff --git a/themes/ram/temp-logo.png b/themes/ram/temp-logo.png Binary files differnew file mode 100755 index 0000000..92d077a --- /dev/null +++ b/themes/ram/temp-logo.png |