diff options
author | Karl Berry <karl@freefriends.org> | 2015-02-24 23:13:21 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2015-02-24 23:13:21 +0000 |
commit | 25dd544fb7b08b7c4a371086ab9611c1a668fc92 (patch) | |
tree | 94e411d40073d82ebc263f39262db5c5220e502a /Master | |
parent | 998e0574c61935f455335c25a36f268e159dc797 (diff) |
media9 (24feb15)
git-svn-id: svn://tug.org/texlive/trunk@36375 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/doc/latex/media9/ChangeLog | 4 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/media9/media9.pdf | bin | 3281492 -> 3281436 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/media9/files/3dsystem.fig (renamed from Master/texmf-dist/doc/latex/media9/files/3dsystem.fig) | 0 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/media9/files/3dsystem.pdf (renamed from Master/texmf-dist/doc/latex/media9/files/3dsystem.pdf) | bin | 5989 -> 5989 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/media9/files/3dsystem.tex (renamed from Master/texmf-dist/doc/latex/media9/files/3dsystem.tex) | 0 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/media9/files/bird.mp3 (renamed from Master/texmf-dist/doc/latex/media9/files/bird.mp3) | bin | 735130 -> 735130 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/media9/files/boutona.pdf (renamed from Master/texmf-dist/doc/latex/media9/files/boutona.pdf) | bin | 2363 -> 2363 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/media9/files/boutonb.pdf (renamed from Master/texmf-dist/doc/latex/media9/files/boutonb.pdf) | bin | 2203 -> 2203 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/media9/files/boutonc.pdf (renamed from Master/texmf-dist/doc/latex/media9/files/boutonc.pdf) | bin | 2364 -> 2364 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/media9/files/boutond.pdf (renamed from Master/texmf-dist/doc/latex/media9/files/boutond.pdf) | bin | 2199 -> 2199 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/media9/files/boutone.pdf (renamed from Master/texmf-dist/doc/latex/media9/files/boutone.pdf) | bin | 2236 -> 2236 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/media9/files/boutonf.pdf (renamed from Master/texmf-dist/doc/latex/media9/files/boutonf.pdf) | bin | 2208 -> 2208 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/media9/files/cube.asy (renamed from Master/texmf-dist/doc/latex/media9/files/cube.asy) | 0 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/media9/files/cube.mp4 (renamed from Master/texmf-dist/doc/latex/media9/files/cube.mp4) | bin | 262653 -> 262653 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/media9/files/cubeposter.png (renamed from Master/texmf-dist/doc/latex/media9/files/cubeposter.png) | bin | 3462 -> 3462 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/media9/files/dice.u3d (renamed from Master/texmf-dist/doc/latex/media9/files/dice.u3d) | bin | 160672 -> 160672 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/media9/files/dice.vws (renamed from Master/texmf-dist/doc/latex/media9/files/dice.vws) | 0 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/media9/files/dice.wrl (renamed from Master/texmf-dist/doc/latex/media9/files/dice.wrl) | 0 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/media9/files/epix.asy (renamed from Master/texmf-dist/doc/latex/media9/files/epix.asy) | 0 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/media9/files/epix.prc (renamed from Master/texmf-dist/doc/latex/media9/files/epix.prc) | bin | 55043 -> 55043 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/media9/files/epixposter.pdf (renamed from Master/texmf-dist/doc/latex/media9/files/epixposter.pdf) | bin | 111371 -> 111371 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/media9/files/mailto.png (renamed from Master/texmf-dist/doc/latex/media9/files/mailto.png) | bin | 962 -> 962 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/media9/files/malte.js (renamed from Master/texmf-dist/doc/latex/media9/files/malte.js) | 0 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/media9/files/malte.u3d (renamed from Master/texmf-dist/doc/latex/media9/files/malte.u3d) | bin | 105696 -> 105696 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/media9/files/random.mp4 (renamed from Master/texmf-dist/doc/latex/media9/files/random.mp4) | bin | 20206 -> 20206 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/media9/media9.tex (renamed from Master/texmf-dist/doc/latex/media9/media9.tex) | 0 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/media9/players/APlayer.mxml | 393 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/media9/players/APlayer9.mxml | 380 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/media9/players/BSD-License | 32 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/media9/players/SMPfixes.patch | 158 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/media9/players/StrobeMediaPlayback-license | 5 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/media9/players/VPlayer.mxml | 303 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/media9/players/VPlayer9.mxml | 294 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/media9/media9.sty | 135 |
34 files changed, 1627 insertions, 77 deletions
diff --git a/Master/texmf-dist/doc/latex/media9/ChangeLog b/Master/texmf-dist/doc/latex/media9/ChangeLog index ae62c8eed9f..bbd2456b43e 100644 --- a/Master/texmf-dist/doc/latex/media9/ChangeLog +++ b/Master/texmf-dist/doc/latex/media9/ChangeLog @@ -1,3 +1,7 @@ +2015-02-24 + * v0.50 + * Fix: minor code changes; reorganized TDS packaging + 2015-01-21 * v0.49 * Fix: some more OCG related code changes diff --git a/Master/texmf-dist/doc/latex/media9/media9.pdf b/Master/texmf-dist/doc/latex/media9/media9.pdf Binary files differindex d802fae1557..d76a1062854 100644 --- a/Master/texmf-dist/doc/latex/media9/media9.pdf +++ b/Master/texmf-dist/doc/latex/media9/media9.pdf diff --git a/Master/texmf-dist/doc/latex/media9/files/3dsystem.fig b/Master/texmf-dist/source/latex/media9/files/3dsystem.fig index e2273139db8..e2273139db8 100644 --- a/Master/texmf-dist/doc/latex/media9/files/3dsystem.fig +++ b/Master/texmf-dist/source/latex/media9/files/3dsystem.fig diff --git a/Master/texmf-dist/doc/latex/media9/files/3dsystem.pdf b/Master/texmf-dist/source/latex/media9/files/3dsystem.pdf Binary files differindex 4d09d34fc43..4d09d34fc43 100644 --- a/Master/texmf-dist/doc/latex/media9/files/3dsystem.pdf +++ b/Master/texmf-dist/source/latex/media9/files/3dsystem.pdf diff --git a/Master/texmf-dist/doc/latex/media9/files/3dsystem.tex b/Master/texmf-dist/source/latex/media9/files/3dsystem.tex index 6bd2ffa1964..6bd2ffa1964 100644 --- a/Master/texmf-dist/doc/latex/media9/files/3dsystem.tex +++ b/Master/texmf-dist/source/latex/media9/files/3dsystem.tex diff --git a/Master/texmf-dist/doc/latex/media9/files/bird.mp3 b/Master/texmf-dist/source/latex/media9/files/bird.mp3 Binary files differindex c9bee679cd6..c9bee679cd6 100644 --- a/Master/texmf-dist/doc/latex/media9/files/bird.mp3 +++ b/Master/texmf-dist/source/latex/media9/files/bird.mp3 diff --git a/Master/texmf-dist/doc/latex/media9/files/boutona.pdf b/Master/texmf-dist/source/latex/media9/files/boutona.pdf Binary files differindex 7ba15d820d7..7ba15d820d7 100644 --- a/Master/texmf-dist/doc/latex/media9/files/boutona.pdf +++ b/Master/texmf-dist/source/latex/media9/files/boutona.pdf diff --git a/Master/texmf-dist/doc/latex/media9/files/boutonb.pdf b/Master/texmf-dist/source/latex/media9/files/boutonb.pdf Binary files differindex 605076e4070..605076e4070 100644 --- a/Master/texmf-dist/doc/latex/media9/files/boutonb.pdf +++ b/Master/texmf-dist/source/latex/media9/files/boutonb.pdf diff --git a/Master/texmf-dist/doc/latex/media9/files/boutonc.pdf b/Master/texmf-dist/source/latex/media9/files/boutonc.pdf Binary files differindex adf016f9556..adf016f9556 100644 --- a/Master/texmf-dist/doc/latex/media9/files/boutonc.pdf +++ b/Master/texmf-dist/source/latex/media9/files/boutonc.pdf diff --git a/Master/texmf-dist/doc/latex/media9/files/boutond.pdf b/Master/texmf-dist/source/latex/media9/files/boutond.pdf Binary files differindex a8170efa614..a8170efa614 100644 --- a/Master/texmf-dist/doc/latex/media9/files/boutond.pdf +++ b/Master/texmf-dist/source/latex/media9/files/boutond.pdf diff --git a/Master/texmf-dist/doc/latex/media9/files/boutone.pdf b/Master/texmf-dist/source/latex/media9/files/boutone.pdf Binary files differindex a87b38d6fd9..a87b38d6fd9 100644 --- a/Master/texmf-dist/doc/latex/media9/files/boutone.pdf +++ b/Master/texmf-dist/source/latex/media9/files/boutone.pdf diff --git a/Master/texmf-dist/doc/latex/media9/files/boutonf.pdf b/Master/texmf-dist/source/latex/media9/files/boutonf.pdf Binary files differindex b687d0aa2ef..b687d0aa2ef 100644 --- a/Master/texmf-dist/doc/latex/media9/files/boutonf.pdf +++ b/Master/texmf-dist/source/latex/media9/files/boutonf.pdf diff --git a/Master/texmf-dist/doc/latex/media9/files/cube.asy b/Master/texmf-dist/source/latex/media9/files/cube.asy index 606375763d5..606375763d5 100644 --- a/Master/texmf-dist/doc/latex/media9/files/cube.asy +++ b/Master/texmf-dist/source/latex/media9/files/cube.asy diff --git a/Master/texmf-dist/doc/latex/media9/files/cube.mp4 b/Master/texmf-dist/source/latex/media9/files/cube.mp4 Binary files differindex cbd115b2117..cbd115b2117 100644 --- a/Master/texmf-dist/doc/latex/media9/files/cube.mp4 +++ b/Master/texmf-dist/source/latex/media9/files/cube.mp4 diff --git a/Master/texmf-dist/doc/latex/media9/files/cubeposter.png b/Master/texmf-dist/source/latex/media9/files/cubeposter.png Binary files differindex ae57869756f..ae57869756f 100644 --- a/Master/texmf-dist/doc/latex/media9/files/cubeposter.png +++ b/Master/texmf-dist/source/latex/media9/files/cubeposter.png diff --git a/Master/texmf-dist/doc/latex/media9/files/dice.u3d b/Master/texmf-dist/source/latex/media9/files/dice.u3d Binary files differindex ae14b756a16..ae14b756a16 100644 --- a/Master/texmf-dist/doc/latex/media9/files/dice.u3d +++ b/Master/texmf-dist/source/latex/media9/files/dice.u3d diff --git a/Master/texmf-dist/doc/latex/media9/files/dice.vws b/Master/texmf-dist/source/latex/media9/files/dice.vws index ef77a276fe8..ef77a276fe8 100644 --- a/Master/texmf-dist/doc/latex/media9/files/dice.vws +++ b/Master/texmf-dist/source/latex/media9/files/dice.vws diff --git a/Master/texmf-dist/doc/latex/media9/files/dice.wrl b/Master/texmf-dist/source/latex/media9/files/dice.wrl index 23b1ef92a26..23b1ef92a26 100644 --- a/Master/texmf-dist/doc/latex/media9/files/dice.wrl +++ b/Master/texmf-dist/source/latex/media9/files/dice.wrl diff --git a/Master/texmf-dist/doc/latex/media9/files/epix.asy b/Master/texmf-dist/source/latex/media9/files/epix.asy index 60720aaba05..60720aaba05 100644 --- a/Master/texmf-dist/doc/latex/media9/files/epix.asy +++ b/Master/texmf-dist/source/latex/media9/files/epix.asy diff --git a/Master/texmf-dist/doc/latex/media9/files/epix.prc b/Master/texmf-dist/source/latex/media9/files/epix.prc Binary files differindex 99e33eed236..99e33eed236 100644 --- a/Master/texmf-dist/doc/latex/media9/files/epix.prc +++ b/Master/texmf-dist/source/latex/media9/files/epix.prc diff --git a/Master/texmf-dist/doc/latex/media9/files/epixposter.pdf b/Master/texmf-dist/source/latex/media9/files/epixposter.pdf Binary files differindex 92506d1092d..92506d1092d 100644 --- a/Master/texmf-dist/doc/latex/media9/files/epixposter.pdf +++ b/Master/texmf-dist/source/latex/media9/files/epixposter.pdf diff --git a/Master/texmf-dist/doc/latex/media9/files/mailto.png b/Master/texmf-dist/source/latex/media9/files/mailto.png Binary files differindex 12831c2410b..12831c2410b 100644 --- a/Master/texmf-dist/doc/latex/media9/files/mailto.png +++ b/Master/texmf-dist/source/latex/media9/files/mailto.png diff --git a/Master/texmf-dist/doc/latex/media9/files/malte.js b/Master/texmf-dist/source/latex/media9/files/malte.js index 4d019e43a62..4d019e43a62 100644 --- a/Master/texmf-dist/doc/latex/media9/files/malte.js +++ b/Master/texmf-dist/source/latex/media9/files/malte.js diff --git a/Master/texmf-dist/doc/latex/media9/files/malte.u3d b/Master/texmf-dist/source/latex/media9/files/malte.u3d Binary files differindex d4ea72aaa31..d4ea72aaa31 100644 --- a/Master/texmf-dist/doc/latex/media9/files/malte.u3d +++ b/Master/texmf-dist/source/latex/media9/files/malte.u3d diff --git a/Master/texmf-dist/doc/latex/media9/files/random.mp4 b/Master/texmf-dist/source/latex/media9/files/random.mp4 Binary files differindex 36be0388e98..36be0388e98 100644 --- a/Master/texmf-dist/doc/latex/media9/files/random.mp4 +++ b/Master/texmf-dist/source/latex/media9/files/random.mp4 diff --git a/Master/texmf-dist/doc/latex/media9/media9.tex b/Master/texmf-dist/source/latex/media9/media9.tex index cd41fbdc650..cd41fbdc650 100644 --- a/Master/texmf-dist/doc/latex/media9/media9.tex +++ b/Master/texmf-dist/source/latex/media9/media9.tex diff --git a/Master/texmf-dist/source/latex/media9/players/APlayer.mxml b/Master/texmf-dist/source/latex/media9/players/APlayer.mxml new file mode 100644 index 00000000000..30ae5de9229 --- /dev/null +++ b/Master/texmf-dist/source/latex/media9/players/APlayer.mxml @@ -0,0 +1,393 @@ +<?xml version="1.0"?> +<!-- --> +<!-- Apache Flex 4 source file of APlayer.swf, --> +<!-- a FlashPlayer-10 compatible component for playing --> +<!-- MP3 audio files and streams. --> +<!-- --> +<!-- version 20140625 --> +<!-- --> +<!-- --> +<!-- The free Apache Flex 4 SDK is required to compile --> +<!-- this file. Get it from --> +<!-- --> +<!-- http://flex.apache.org/download-binaries.html --> +<!-- --> +<!-- and run --> +<!-- --> +<!-- mxmlc -static-link-runtime-shared-libraries APlayer.mxml --> +<!-- --> +<!-- on the command line. --> +<!-- --> +<!-- --> +<!-- Copyright (C) 2012-today Alexander Grahn --> +<!-- --> +<!-- This work may be distributed and/or modified under the --> +<!-- conditions of the LaTeX Project Public License, either --> +<!-- version 1.3 of this license or (at your option) any later --> +<!-- version. --> +<!-- --> +<!-- The latest version of this license is in --> +<!-- http://www.latex-project.org/lppl.txt --> +<!-- and version 1.3 or later is part of all distributions of --> +<!-- LaTeX version 2005/12/01 or later. --> +<!-- --> +<!-- This work has the LPPL maintenance status `maintained'. --> +<!-- --> +<!-- The current maintainer of this work is A. Grahn. --> +<!-- --> + +<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" + xmlns:s="library://ns.adobe.com/flex/spark" + xmlns:mx="library://ns.adobe.com/flex/mx" + preinitialize="initialise(FlexGlobals.topLevelApplication.parameters);" + applicationComplete="initSound();addEventListeners(); + fadeTargets=new Array(playProgress, caption);" + creationComplete="initCallBacks();" + mouseDown="pause();setFocus();" + mouseUp="play();" + backgroundAlpha="0" +> + + <fx:Script> + <![CDATA[ + [Bindable] private var source:String; + [Bindable] private var policy:String=null; + [Bindable] private var autoPlay:Boolean=false; + [Bindable] private var loop:Boolean=false; + [Bindable] private var vol:Number=0.75; + [Bindable] private var pan:Number=0; + [Bindable] private var hideBar:Boolean=false; + [Bindable] private var fadeTargets:Array; + [Bindable] private var txtAlign:String; + + private var snd:Sound; + private var id3:ID3Info; + private var sndCh:SoundChannel; + private var sndTr:SoundTransform; + private var playResumePos:Number = 0; + private var pauseAtPos:Number = -1; + private var toBePaused:Boolean = false; + private var plyng:Boolean = false; + private var muted:Boolean = false; + private var lastVol:Number; + + private var deltaSeek:Number; + private var curTime:Number; + private var keyPressed:Boolean=false; + private var mouseIsOver:Boolean=false; + + import mx.core.FlexGlobals; + private function initialise(flashVars:Object):void { + source=flashVars.source; + if(flashVars.policy) policy=flashVars.policy; + if(flashVars.autoPlay=='true') autoPlay=true; + if(flashVars.loop=='true') loop=true; + if(flashVars.volume) vol=Number(flashVars.volume); + if(flashVars.balance) pan=Number(flashVars.balance); + if(flashVars.hideBar=='true') hideBar=true; + } + + import mx.controls.Alert; + + private function initSound():void { + snd = new Sound(); id3=null; + sndTr = new SoundTransform(vol, pan); + snd.addEventListener(Event.ID3, onID3Info); + snd.addEventListener(IOErrorEvent.IO_ERROR, onError); + snd.addEventListener(ProgressEvent.PROGRESS, onProgress); + snd.addEventListener(Event.COMPLETE, onComplete); + if(policy) Security.loadPolicyFile(policy); + snd.load(new URLRequest(source), new SoundLoaderContext(1000, true)); + if(autoPlay) play(); + } + + private function onMouseOver(e:MouseEvent):void { + mouseIsOver=true; + fadeEffect.end(); + playProgress.alpha=caption.alpha=1.0; + } + + private function onMouseOut(e:MouseEvent):void { + mouseIsOver=false; + fadeEffect.play(); + } + + private function onKeyDown(e:KeyboardEvent):void { + switch(e.keyCode) { + case 32: //space bar + playPause(); + break; + case 36: //home + pause(); + playResumePos=(0); + break; + case 35: //end + if(playProgress.indeterminate) break; + pause(); + playResumePos=(snd.length); + break; + case 37: //<-- + fadeEffect.end(); + playProgress.alpha=caption.alpha=1.0; + if(e.ctrlKey){ + pan=Math.max(-1,pan-0.025); + balance(pan); + break; + } + if(!keyPressed){ + deltaSeek=Math.max(100,snd.length/10000); + if(plyng) + curTime=sndCh.position; + else + curTime=playResumePos; + } + keyPressed=true; + playResumePos=Math.max(0,curTime-deltaSeek); + if(plyng) seek(playResumePos/1000); + deltaSeek*=1.1; + break; + case 39: //--> + fadeEffect.end(); + playProgress.alpha=caption.alpha=1.0; + if(e.ctrlKey){ + pan=Math.min(1,pan+0.025); + balance(pan); + break; + } + if(!keyPressed){ + deltaSeek=Math.max(100,snd.length/10000); + if(plyng) + curTime=sndCh.position; + else + curTime=playResumePos; + } + keyPressed=true; + playResumePos=Math.min(snd.length-10,curTime+deltaSeek); + seek(playResumePos/1000); + deltaSeek*=1.1; + break; + case 38: + vol=Math.min(1,vol+0.025); + volume(vol); + break; + case 40: + if(e.ctrlKey){ + pan=0; + balance(pan); + break; + } + vol=Math.max(0,vol-0.025); + volume(vol); + break; + default: + if(e.charCode==109) mute(); //`m' + } + } + + private function onKeyUp(e:KeyboardEvent):void { + switch(e.keyCode) { + case 37: //<-- + case 39: //--> + deltaSeek=Math.max(100,snd.length/10000); + keyPressed=false; + if (!mouseIsOver) fadeEffect.play(); + break; + } + } + + private function formatLabel(s:Number):String { + s/=1000; + var hrs:Number = Math.floor(s / 3600); + var min:Number = Math.floor(s / 60 % 60); + var sec:Number = Math.floor(s % 60); + var fmtd:String=''; + if(hrs>0) fmtd = String(hrs)+':'; + if(hrs>0 && min <10) fmtd+='0'; + fmtd += String(min)+':'; + if(sec<10) fmtd+='0'; + fmtd += String(sec); + txtAlign="center"; + try{ + if(id3.songName) + fmtd += ' '+ String.fromCharCode(0x2014) + ' ' + id3.songName; + if(id3.artist) fmtd += ' | ' + id3.artist; + if(id3.album) fmtd += ' | ' + id3.album; + if(id3) txtAlign="start"; + }catch(e:Object){} + return fmtd; + } + + private function addEventListeners():void { + this.setFocus(); + this.addEventListener(Event.ENTER_FRAME, onEnterFrame); + this.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown); + this.addEventListener(KeyboardEvent.KEY_UP, onKeyUp); + this.addEventListener(MouseEvent.MOUSE_OUT, onMouseOut); + this.addEventListener(MouseEvent.MOUSE_OVER, onMouseOver); + } + + private function setSource(s:String):void { + pause(); + source=s; + initSound(); + pause();seek(0); + } + + private function loadPolicy(p:String):void {policy=p;} + + private function play(p:Number=-1):void { + if(p>=0) seek(p); + if(plyng) return; + try{sndCh = snd.play(playResumePos, 0, sndTr);} + catch(e:Error){Alert.show(e.message,'Error');} + sndCh.addEventListener(Event.SOUND_COMPLETE, onSoundComplete); + plyng = true; + } + + private function pause(p:Number=-1):void { + if(p>=0){pauseAtPos=p*1000;return;} + if(!plyng) return; + playResumePos = sndCh.position; + sndCh.stop(); + plyng = false; + } + + private function playPause():void { + if(plyng) pause(); else play(); + } + + private function seek(p:Number):void { + playResumePos = p*1000; + if(!plyng) return; + sndCh.stop(); + plyng = false; + play(); + } + + private function rewind():void { + seek(0); + } + + private function volume(v:Number):void { + sndTr.volume = v; + sndCh.soundTransform=sndTr; + } + + private function mute():void { + if(muted) { + if(lastVol==0) lastVol=0.75; + volume(lastVol); + muted=false; + } + else { + lastVol = sndTr.volume + volume(0); + muted=true; + } + } + + private function balance(p:Number):void { + sndTr.pan = p; + sndCh.soundTransform=sndTr; + } + + private function currentTime():Number { + return sndCh.position/1000; + } + + private function playing():Boolean { + return plyng; + } + + private function duration():Number { + return snd.length/1000; + } + + private function ismuted():Boolean { + return muted; + } + + private function initCallBacks():void { + ExternalInterface.addCallback("play", play); + ExternalInterface.addCallback("pause", pause); + ExternalInterface.addCallback("playPause", playPause); + ExternalInterface.addCallback("seek", seek); + ExternalInterface.addCallback("rewind", rewind); + ExternalInterface.addCallback("volume", volume); + ExternalInterface.addCallback("balance", balance); + ExternalInterface.addCallback("mute", mute); + ExternalInterface.addCallback("setSource", setSource); + ExternalInterface.addCallback("loadPolicy", loadPolicy); + ExternalInterface.addCallback("currentTime", currentTime); + ExternalInterface.addCallback("duration", duration); + ExternalInterface.addCallback("playing", playing); + ExternalInterface.addCallback("muted", ismuted); + } + + private function onSoundComplete(e:Event):void { + plyng = false; + playResumePos = 0; + if(loop) play(); + } + + private function onComplete(e:Event):void { + playProgress.indeterminate=false; + } + + private function onProgress(e:ProgressEvent):void { + playProgress.indeterminate=true; + } + + private function onEnterFrame(e:Event):void { + if(!playProgress.indeterminate) { + if(plyng) { + playProgress.setProgress(sndCh.position,snd.length); + caption.text=formatLabel(sndCh.position); + } else { + playProgress.setProgress(playResumePos,snd.length); + caption.text=formatLabel(playResumePos); + } + }else{ + if(plyng) { + playProgress.setProgress(Math.random(),1); + caption.text=formatLabel(sndCh.position); + } else { + playProgress.setProgress(snd.bytesLoaded,snd.bytesTotal); + caption.text=formatLabel(playResumePos); + } + } + if(plyng&&pauseAtPos>=0&&sndCh.position<pauseAtPos) + toBePaused=true; + if( + plyng&&pauseAtPos>=0&& + sndCh.position>=pauseAtPos&&toBePaused + ){ + pause(); + pauseAtPos=-1; + toBePaused=false; + } + } + + private function onID3Info(e:Event):void {id3 = e.target.id3;} + + private function onError(e:ErrorEvent):void { + Alert.show(e.type, e.text); + } + ]]> + </fx:Script> + + <fx:Declarations> + <s:Fade id="fadeEffect" targets="{fadeTargets}" alphaFrom="1.0" alphaTo="0" + duration="2000"/> + </fx:Declarations> + + <mx:ProgressBar width="100%" height="100%" mode="manual" + labelPlacement="center" label="" id="playProgress" + visible="{!hideBar}" + /> + + <s:Label id="caption" width="100%" height="100%" verticalCenter="0" + paddingTop="2" fontWeight="bold" verticalAlign="middle" visible="{!hideBar}" + textAlign="{txtAlign}" paddingLeft="5" + /> +</s:Application> diff --git a/Master/texmf-dist/source/latex/media9/players/APlayer9.mxml b/Master/texmf-dist/source/latex/media9/players/APlayer9.mxml new file mode 100644 index 00000000000..1a80f98c921 --- /dev/null +++ b/Master/texmf-dist/source/latex/media9/players/APlayer9.mxml @@ -0,0 +1,380 @@ +<?xml version="1.0"?> +<!-- --> +<!-- Adobe Flex 3 source file of APlayer9.swf, --> +<!-- a FlashPlayer-9 compatible component for playing --> +<!-- MP3 audio files and streams. --> +<!-- --> +<!-- version 20140625 --> +<!-- --> +<!-- Copyright (C) 2012-today Alexander Grahn --> +<!-- --> +<!-- This work may be distributed and/or modified under the --> +<!-- conditions of the LaTeX Project Public License, either --> +<!-- version 1.3 of this license or (at your option) any later --> +<!-- version. --> +<!-- --> +<!-- The latest version of this license is in --> +<!-- http://www.latex-project.org/lppl.txt --> +<!-- and version 1.3 or later is part of all distributions of --> +<!-- LaTeX version 2005/12/01 or later. --> +<!-- --> +<!-- This work has the LPPL maintenance status `maintained'. --> +<!-- --> +<!-- The current maintainer of this work is A. Grahn. --> +<!-- --> + +<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" + preinitialize="initialise(Application.application.parameters);" + applicationComplete="initSound();addEventListeners();" + creationComplete="initCallBacks();" + mouseDown="pause();setFocus();" + mouseUp="play();" + backgroundAlpha="0" + paddingTop="0" paddingBottom="0" + paddingLeft="0" paddingRight="0" + layout="absolute" clipContent="false" +> + + <mx:Script> + <![CDATA[ + [Bindable] private var source:String; + [Bindable] private var policy:String=null; + [Bindable] private var autoPlay:Boolean=false; + [Bindable] private var loop:Boolean=false; + [Bindable] private var vol:Number=0.75; + [Bindable] private var pan:Number=0; + [Bindable] private var hideBar:Boolean=false; + [Bindable] private var txtAlign:String; + + private var snd:Sound; + private var id3:ID3Info; + private var sndCh:SoundChannel; + private var sndTr:SoundTransform; + private var playResumePos:Number = 0; + private var pauseAtPos:Number = -1; + private var toBePaused:Boolean = false; + private var plyng:Boolean = false; + private var muted:Boolean = false; + private var lastVol:Number; + + private var deltaSeek:Number; + private var curTime:Number; + private var keyPressed:Boolean=false; + private var mouseIsOver:Boolean=false; + + import flash.external.*; + private function initialise(flashVars:Object):void { + source=flashVars.source; + if(flashVars.policy) policy=flashVars.policy; + if(flashVars.autoPlay=='true') autoPlay=true; + if(flashVars.loop=='true') loop=true; + if(flashVars.volume) vol=Number(flashVars.volume); + if(flashVars.balance) pan=Number(flashVars.balance); + if(flashVars.hideBar=='true') hideBar=true; + } + + import mx.controls.Alert; + + private function initSound():void { + snd = new Sound(); id3=null; + sndTr = new SoundTransform(vol, pan); + snd.addEventListener(Event.ID3, onID3Info); + snd.addEventListener(IOErrorEvent.IO_ERROR, onError); + snd.addEventListener(ProgressEvent.PROGRESS, onProgress); + snd.addEventListener(Event.COMPLETE, onComplete); + if(policy) Security.loadPolicyFile(policy); + snd.load(new URLRequest(source), new SoundLoaderContext(1000, true)); + if(autoPlay) play(); + } + + private function onMouseOver(e:MouseEvent):void { + mouseIsOver=true; + fadeEffect.end(); + playProgress.alpha=caption.alpha=1.0; + caption.visible=!hideBar; + } + + private function onMouseOut(e:MouseEvent):void { + mouseIsOver=false; + fadeEffect.play(); + } + + private function onKeyDown(e:KeyboardEvent):void { + switch(e.keyCode) { + case 32: //space bar + playPause(); + break; + case 36: //home + pause(); + playResumePos=(0); + break; + case 35: //end + if(playProgress.indeterminate) break; + pause(); + playResumePos=(snd.length); + break; + case 37: //<-- + fadeEffect.end(); + playProgress.alpha=caption.alpha=1.0; + caption.visible=!hideBar; + if(e.ctrlKey){ + pan=Math.max(-1,pan-0.025); + balance(pan); + break; + } + if(!keyPressed){ + deltaSeek=Math.max(100,snd.length/10000); + if(plyng) + curTime=sndCh.position; + else + curTime=playResumePos; + } + keyPressed=true; + playResumePos=Math.max(0,curTime-deltaSeek); + if(plyng) seek(playResumePos/1000); + deltaSeek*=1.1; + break; + case 39: //--> + fadeEffect.end(); + playProgress.alpha=caption.alpha=1.0; + caption.visible=!hideBar; + if(e.ctrlKey){ + pan=Math.min(1,pan+0.025); + balance(pan); + break; + } + if(!keyPressed){ + deltaSeek=Math.max(100,snd.length/10000); + if(plyng) + curTime=sndCh.position; + else + curTime=playResumePos; + } + keyPressed=true; + playResumePos=Math.min(snd.length-10,curTime+deltaSeek); + seek(playResumePos/1000); + deltaSeek*=1.1; + break; + case 38: + vol=Math.min(1,vol+0.025); + volume(vol); + break; + case 40: + if(e.ctrlKey){ + pan=0; + balance(pan); + break; + } + vol=Math.max(0,vol-0.025); + volume(vol); + break; + default: + if(e.charCode==109) mute(); //`m' + } + } + + private function onKeyUp(e:KeyboardEvent):void { + switch(e.keyCode) { + case 37: //<-- + case 39: //--> + deltaSeek=Math.max(100,snd.length/10000); + keyPressed=false; + if (!mouseIsOver) fadeEffect.play(); + break; + } + } + + private function formatLabel(s:Number):String { + s/=1000; + var hrs:Number = Math.floor(s / 3600); + var min:Number = Math.floor(s / 60 % 60); + var sec:Number = Math.floor(s % 60); + var fmtd:String=''; + if(hrs>0) fmtd = String(hrs)+':'; + if(hrs>0 && min <10) fmtd+='0'; + fmtd += String(min)+':'; + if(sec<10) fmtd+='0'; + fmtd += String(sec); + txtAlign="center"; + try{ + if(id3.songName) + fmtd += ' '+ String.fromCharCode(0x2014) + ' ' + id3.songName; + if(id3.artist) fmtd += ' | ' + id3.artist; + if(id3.album) fmtd += ' | ' + id3.album; + if(id3) txtAlign="start"; + }catch(e:Object){} + return fmtd; + } + + private function addEventListeners():void { + this.setFocus(); + this.addEventListener(Event.ENTER_FRAME, onEnterFrame); + this.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown); + this.addEventListener(KeyboardEvent.KEY_UP, onKeyUp); + this.addEventListener(MouseEvent.MOUSE_OUT, onMouseOut); + this.addEventListener(MouseEvent.MOUSE_OVER, onMouseOver); + } + + private function setSource(s:String):void { + pause(); + source=s; + initSound(); + pause();seek(0); + } + + private function loadPolicy(p:String):void {policy=p;} + + private function play(p:Number=-1):void { + if(p>=0) seek(p); + if(plyng) return; + try{sndCh = snd.play(playResumePos, 0, sndTr);} + catch(e:Error){Alert.show(e.message,'Error');} + sndCh.addEventListener(Event.SOUND_COMPLETE, onSoundComplete); + plyng = true; + } + + private function pause(p:Number=-1):void { + if(p>=0){pauseAtPos=p*1000;return;} + if(!plyng) return; + playResumePos = sndCh.position; + sndCh.stop(); + plyng = false; + } + + private function playPause():void { + if(plyng) pause(); else play(); + } + + private function seek(p:Number):void { + playResumePos = p*1000; + if(!plyng) return; + sndCh.stop(); + plyng = false; + play(); + } + + private function rewind():void { + seek(0); + } + + private function volume(v:Number):void { + sndTr.volume = v; + sndCh.soundTransform=sndTr; + } + + private function mute():void { + if(muted) { + if(lastVol==0) lastVol=0.75; + volume(lastVol); + muted=false; + } + else { + lastVol = sndTr.volume + volume(0); + muted=true; + } + } + + private function balance(p:Number):void { + sndTr.pan = p; + sndCh.soundTransform=sndTr; + } + + private function currentTime():Number { + return sndCh.position/1000; + } + + private function playing():Boolean { + return plyng; + } + + private function duration():Number { + return snd.length/1000; + } + + private function ismuted():Boolean { + return muted; + } + + private function initCallBacks():void { + ExternalInterface.addCallback("play", play); + ExternalInterface.addCallback("pause", pause); + ExternalInterface.addCallback("playPause", playPause); + ExternalInterface.addCallback("seek", seek); + ExternalInterface.addCallback("rewind", rewind); + ExternalInterface.addCallback("volume", volume); + ExternalInterface.addCallback("balance", balance); + ExternalInterface.addCallback("mute", mute); + ExternalInterface.addCallback("setSource", setSource); + ExternalInterface.addCallback("loadPolicy", loadPolicy); + ExternalInterface.addCallback("currentTime", currentTime); + ExternalInterface.addCallback("duration", duration); + ExternalInterface.addCallback("playing", playing); + ExternalInterface.addCallback("muted", ismuted); + } + + private function onSoundComplete(e:Event):void { + plyng = false; + playResumePos = 0; + if(loop) play(); + } + + private function onComplete(e:Event):void { + playProgress.indeterminate=false; + } + + private function onProgress(e:ProgressEvent):void { + playProgress.indeterminate=true; + } + + private function onEnterFrame(e:Event):void { + if(!playProgress.indeterminate) { + if(plyng) { + playProgress.setProgress(sndCh.position,snd.length); + caption.text=formatLabel(sndCh.position); + } else { + playProgress.setProgress(playResumePos,snd.length); + caption.text=formatLabel(playResumePos); + } + }else{ + if(plyng) { + playProgress.setProgress(Math.random(),1); + caption.text=formatLabel(sndCh.position); + } else { + playProgress.setProgress(snd.bytesLoaded,snd.bytesTotal); + caption.text=formatLabel(playResumePos); + } + } + if(plyng&&pauseAtPos>=0&&sndCh.position<pauseAtPos) + toBePaused=true; + if( + plyng&&pauseAtPos>=0&& + sndCh.position>=pauseAtPos&&toBePaused + ){ + pause(); + pauseAtPos=-1; + toBePaused=false; + } + } + + private function onID3Info(e:Event):void {id3 = e.target.id3;} + + private function onError(e:ErrorEvent):void { + Alert.show(e.type, e.text); + } + ]]> + </mx:Script> + + <mx:Fade id="fadeEffect" target="{playProgress}" alphaFrom="1.0" alphaTo="0" + effectEnd="caption.visible=false" duration="2000"/> + + <mx:ProgressBar width="100%" height="100%" mode="manual" + labelPlacement="center" label="" id="playProgress" + visible="{!hideBar}" + /> + + <mx:Label id="caption" width="100%" verticalCenter="0" + paddingTop="2" fontWeight="bold" visible="{!hideBar}" + textAlign="{txtAlign}" paddingLeft="5" + /> +</mx:Application> diff --git a/Master/texmf-dist/source/latex/media9/players/BSD-License b/Master/texmf-dist/source/latex/media9/players/BSD-License new file mode 100644 index 00000000000..67b0fe71645 --- /dev/null +++ b/Master/texmf-dist/source/latex/media9/players/BSD-License @@ -0,0 +1,32 @@ +The BSD License + +Copyright (c) 2010, Adobe Systems Incorporated +All rights reserved. + +Redistribution and use in source and binary forms, with or +without modification, are permitted provided that the following +conditions are met: + +* Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution. + +* Neither the name of Adobe Systems Incorporated, nor the names of its +contributors may be used to endorse or promote products derived from this +software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + diff --git a/Master/texmf-dist/source/latex/media9/players/SMPfixes.patch b/Master/texmf-dist/source/latex/media9/players/SMPfixes.patch new file mode 100644 index 00000000000..04e48f41281 --- /dev/null +++ b/Master/texmf-dist/source/latex/media9/players/SMPfixes.patch @@ -0,0 +1,158 @@ +--- ./player/StrobeMediaPlayback/src/org/osmf/player/chrome/widgets/PlayButtonOverlay.as.orig 2012-11-14 15:48:22.000000000 +0100 ++++ ./player/StrobeMediaPlayback/src/org/osmf/player/chrome/widgets/PlayButtonOverlay.as 2012-11-20 15:14:02.000000000 +0100 +@@ -98,6 +98,11 @@ + override protected function onMouseClick(event:MouseEvent):void + { + var playable:PlayTrait = media.getTrait(MediaTraitType.PLAY) as PlayTrait; ++ var seekable:SeekTrait = media.getTrait(MediaTraitType.SEEK) as SeekTrait; ++ if(playable.playState == PlayState.STOPPED) ++ { ++ try{seekable.seek(0);}catch(e:Object){} ++ } + playable.play(); + } + +@@ -134,4 +139,4 @@ + /* static */ + private static const VISIBILITY_DELAY:int = 500; + } +-} +\ No newline at end of file ++} +--- ./player/StrobeMediaPlayback/src/org/osmf/player/chrome/widgets/Slider.as.orig 2012-11-14 15:48:22.000000000 +0100 ++++ ./player/StrobeMediaPlayback/src/org/osmf/player/chrome/widgets/Slider.as 2012-11-14 15:42:53.000000000 +0100 +@@ -106,7 +106,7 @@ + if (_enabled && _sliding == false) + { + _sliding = true; +- stage.addEventListener(MouseEvent.MOUSE_UP, onStageExitDrag); ++ stage.addEventListener(MouseEvent.MOUSE_UP, onStageExitDrag, true); + updateFace(down); + scrubTimer.start(); + dispatchEvent(new ScrubberEvent(ScrubberEvent.SCRUB_START)); +--- ./player/StrobeMediaPlayback/src/org/osmf/player/chrome/widgets/PlayButton.as.orig 2012-11-14 15:48:22.000000000 +0100 ++++ ./player/StrobeMediaPlayback/src/org/osmf/player/chrome/widgets/PlayButton.as 2012-11-14 15:42:53.000000000 +0100 +@@ -26,6 +26,7 @@ + import org.osmf.traits.MediaTraitType; + import org.osmf.traits.PlayState; + import org.osmf.traits.PlayTrait; ++ import org.osmf.traits.SeekTrait; + + public class PlayButton extends PlayableButton + { +@@ -44,6 +45,11 @@ + override protected function onMouseClick(event:MouseEvent):void + { + var playable:PlayTrait = media.getTrait(MediaTraitType.PLAY) as PlayTrait; ++ var seekable:SeekTrait = media.getTrait(MediaTraitType.SEEK) as SeekTrait; ++ if(playable.playState == PlayState.STOPPED) ++ { ++ try{seekable.seek(0);}catch(e:Object){} ++ } + playable.play(); + event.stopImmediatePropagation(); + } +@@ -58,4 +64,4 @@ + } + } + } +-} +\ No newline at end of file ++} +--- ./player/StrobeMediaPlayback/src/StrobeMediaPlayback.as.orig 2012-11-14 15:48:22.000000000 +0100 ++++ ./player/StrobeMediaPlayback/src/StrobeMediaPlayback.as 2012-11-14 15:42:54.000000000 +0100 +@@ -52,6 +52,7 @@ + import org.osmf.traits.MediaTraitType; + import org.osmf.traits.PlayState; + import org.osmf.traits.PlayTrait; ++ import org.osmf.traits.SeekTrait; + import org.osmf.utils.OSMFSettings; + import org.osmf.utils.OSMFStrings; + +@@ -152,6 +153,7 @@ + + player.addEventListener(TimeEvent.COMPLETE, onComplete); + player.addEventListener(MediaErrorEvent.MEDIA_ERROR, onMediaError); ++ player.addEventListener(MediaPlayerCapabilityChangeEvent.CAN_PLAY_CHANGE, onCanPlayChange); + + // Add DRM error handler + var drmManager:DRMManager = DRMManager.getDRMManager(); +@@ -338,6 +340,8 @@ + mainContainer.backgroundAlpha = 0; + mainContainer.addEventListener(MouseEvent.DOUBLE_CLICK, onFullScreenRequest); + mainContainer.addEventListener(MouseEvent.CLICK, onMainClick, false); ++ mainContainer.addEventListener(MouseEvent.MOUSE_DOWN, onMainDown, false); ++ mainContainer.addEventListener(MouseEvent.MOUSE_UP, onMainUp, false); + mainContainer.doubleClickEnabled = true; + + addChild(mainContainer); +@@ -415,6 +419,9 @@ + } + + player.addEventListener(PlayEvent.PLAY_STATE_CHANGE, onSetAutoHide); ++ ++ controlBarContainer.addEventListener(MouseEvent.MOUSE_DOWN, onControlBarAny, false); ++ controlBarContainer.addEventListener(MouseEvent.MOUSE_UP, onControlBarAny, false); + + layout(); + +@@ -757,6 +764,38 @@ + } + } + ++ private function onMainDown(event:MouseEvent):void ++ { ++ var playable:PlayTrait = player.media.getTrait(MediaTraitType.PLAY) as PlayTrait; ++ if (playable.playState == PlayState.PLAYING) ++ { ++ playable.pause(); ++ } ++ } ++ ++ private function onMainUp(event:MouseEvent):void ++ { ++ var playable:PlayTrait = player.media.getTrait(MediaTraitType.PLAY) as PlayTrait; ++ var seekable:SeekTrait = player.media.getTrait(MediaTraitType.SEEK) as SeekTrait; ++ if(playable.playState == PlayState.STOPPED) ++ { ++ if(player.canSeek){seekable.seek(0);} ++ playable.play(); ++ } ++ else if(playable.playState == PlayState.PAUSED) ++ { ++ playable.play(); ++ } ++ } ++ ++ private function onControlBarAny(event:MouseEvent):void ++ { ++ if(event.eventPhase == EventPhase.BUBBLING_PHASE) ++ { ++ event.stopImmediatePropagation(); ++ } ++ } ++ + /** + * Toggles full screen state. + */ +@@ -1036,12 +1075,20 @@ + && configuration.endOfVideoOverlay != "" + && player.loop == false + && player.playing == false ++ && player.autoRewind == true + ) + { + processPoster(configuration.endOfVideoOverlay); + } + } + ++ private function onCanPlayChange(event:MediaPlayerCapabilityChangeEvent):void ++ { ++ // Make sure this event gets handled only once: ++ player.removeEventListener(event.type, arguments.callee); ++ player.play(); player.stop(); ++ } ++ + private function onMediaError(event:MediaErrorEvent):void + { + // Make sure this event gets handled only once: diff --git a/Master/texmf-dist/source/latex/media9/players/StrobeMediaPlayback-license b/Master/texmf-dist/source/latex/media9/players/StrobeMediaPlayback-license new file mode 100644 index 00000000000..4a3d2ec8c0d --- /dev/null +++ b/Master/texmf-dist/source/latex/media9/players/StrobeMediaPlayback-license @@ -0,0 +1,5 @@ +Strobe Media Playback is covered under the BSD Licence. See file BSD-License + +OSMF and NetMocker are covered under version 1.1 of the MPL Licence. You may obtain a copy of the License at http://www.mozilla.org/MPL/ + +The font we used by the player, Playback Sans, is released under the SIL Open Font License - see file player/StrobeMediaPlayback/assets/font/PlaybackSansEULA.txt diff --git a/Master/texmf-dist/source/latex/media9/players/VPlayer.mxml b/Master/texmf-dist/source/latex/media9/players/VPlayer.mxml new file mode 100644 index 00000000000..7d73ce43b7d --- /dev/null +++ b/Master/texmf-dist/source/latex/media9/players/VPlayer.mxml @@ -0,0 +1,303 @@ +<?xml version="1.0"?> +<!-- --> +<!-- Apache Flex 4 source file of VPlayer.swf, --> +<!-- a FlashPlayer-10 compatible component for playing --> +<!-- FLV and MP4/H.264 video files and streams. --> +<!-- --> +<!-- version 20140625 --> +<!-- --> +<!-- --> +<!-- The free Apache Flex 4 SDK is required to compile --> +<!-- this file. Get it from --> +<!-- --> +<!-- http://flex.apache.org/download-binaries.html --> +<!-- --> +<!-- and run --> +<!-- --> +<!-- mxmlc -static-link-runtime-shared-libraries VPlayer.mxml --> +<!-- --> +<!-- on the command line. --> +<!-- --> +<!-- --> +<!-- Copyright (C) 2012-today Alexander Grahn --> +<!-- --> +<!-- This work may be distributed and/or modified under the --> +<!-- conditions of the LaTeX Project Public License, either --> +<!-- version 1.3 of this license or (at your option) any later --> +<!-- version. --> +<!-- --> +<!-- The latest version of this license is in --> +<!-- http://www.latex-project.org/lppl.txt --> +<!-- and version 1.3 or later is part of all distributions of --> +<!-- LaTeX version 2005/12/01 or later. --> +<!-- --> +<!-- This work has the LPPL maintenance status `maintained'. --> +<!-- --> +<!-- The current maintainer of this work is A. Grahn. --> +<!-- --> + +<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" + xmlns:s="library://ns.adobe.com/flex/spark" + xmlns:mx="library://ns.adobe.com/flex/mx" + preinitialize="initialise(FlexGlobals.topLevelApplication.parameters);" + creationComplete="init();" + backgroundAlpha="0" +> + <fx:Script> + <![CDATA[ + [Bindable] private var scaleMode:String='stretch'; + [Bindable] private var source:String; + [Bindable] private var autoPlay:Boolean=false; + [Bindable] private var autoRewind:Boolean=false; + [Bindable] private var loop:Boolean=false; + [Bindable] private var vol:Number=0.75; + [Bindable] private var stepping:Boolean=false; + private var vidComplete:Boolean=false; + private var deltaSeek:Number; + private var curTime:Number; + private var newPos:Number; + private var keyPressed:Boolean=false; + private var pauseAtPos:Number = -1; + private var toBePaused:Boolean = false; + + import mx.core.FlexGlobals; + private function initialise(flashVars:Object):void { + source=flashVars.source; + if(flashVars.autoPlay=='true'){autoPlay=true} + if(flashVars.autoRewind=='true'){autoRewind=true} + if(flashVars.loop=='true'){loop=true} + if(flashVars.volume){vol=Number(flashVars.volume)} + if(flashVars.scaleMode){scaleMode=flashVars.scaleMode} + if(flashVars.stepping){stepping=flashVars.stepping} + } + + private function onProgress(event:ProgressEvent):void { + if (event.bytesTotal) event.target.visible=true; + else event.target.visible=false; + } + + import org.osmf.events.MediaPlayerStateChangeEvent; + import mx.controls.Alert; + private function onStateChange(event:MediaPlayerStateChangeEvent):void { + vidComplete=false; + if(event.state=='playbackError') + Alert.show('Unable to play \''+event.target.source+'\'','Error'); + } + + private function onKeyDown(e:KeyboardEvent):void { + switch(e.keyCode) { + case 32: //space bar + playPause(); + break; + case 36: //home + vidDisp.pause(); + vidDisp.seek(0); + break; + case 35: //end + if(vidDisp.bytesTotal){ + vidDisp.pause(); + vidDisp.seek(vidDisp.duration-0.1); + } + break; + case 37: //<-- + fadeEffect.end(); + playProgress.alpha=0.5; + playProgress.visible=true; + if(!keyPressed){ + deltaSeek=Math.max(1,vidDisp.duration/1000); + curTime=vidDisp.currentTime; + } + keyPressed=true; + newPos=Math.max(0,curTime-deltaSeek); + playProgress.setProgress(newPos,vidDisp.duration); + playProgress.label=formatTime(newPos); + vidDisp.seek(newPos); + deltaSeek*=1.1; + break; + case 39: //--> + fadeEffect.end(); + playProgress.alpha=0.5; + playProgress.visible=true; + if(!keyPressed){ + deltaSeek=Math.max(1,vidDisp.duration/1000); + curTime=vidDisp.currentTime; + } + keyPressed=true; + newPos=Math.min(vidDisp.duration-0.1,curTime+deltaSeek); + playProgress.setProgress(newPos,vidDisp.duration); + playProgress.label=formatTime(newPos); + vidDisp.seek(newPos); + deltaSeek*=1.1; + break; + case 38: + vol=Math.min(1,vol+0.025); + volume(vol); + break; + case 40: + vol=Math.max(0,vol-0.025); + volume(vol); + break; + default: + if(e.charCode==109) mute(); //`m' + } + } + + private function onKeyUp(e:KeyboardEvent):void { + switch(e.keyCode) { + case 37: //<-- + case 39: //--> + deltaSeek=Math.max(1,vidDisp.duration/1000); + keyPressed=false; + fadeEffect.play(); + break; + } + } + + private function onEnterFrame(e:Event):void { + if(stepping&&vidDisp.playing){vidDisp.pause();} + } + + private function onCurrentTimeChange(e:Event):void { + if(vidDisp.playing&&pauseAtPos>=0&&vidDisp.currentTime<pauseAtPos) + toBePaused=true; + if( + vidDisp.playing&&pauseAtPos>=0&& + vidDisp.currentTime>=pauseAtPos&&toBePaused + ){ + pause(); + pauseAtPos=-1; + toBePaused=false; + } + } + + private function play(p:Number=-1):void { + if(p>=0) seek(p); + if(vidComplete){seek(0);}vidDisp.play(); + } + + private function pause(p:Number=-1):void { + if(p>=0){pauseAtPos=p;return;} + vidDisp.pause(); + } + + private function playPause():void { + if(vidDisp.playing) vidDisp.pause(); else vidDisp.play(); + } + + private function seek(p:Number):void { + vidDisp.seek(p); + } + + private function step():void { + if(stepping){stepping=false;}else{stepping=true;} + } + + private function rewind():void { + vidDisp.seek(0); + } + + private function volume(v:Number):void { + vidDisp.muted=false; + vidDisp.volume = v; + } + + private function mute():void { + if(vidDisp.muted) { + vidDisp.muted=false; + if (vidDisp.volume==0) volume(0.75); + } + else { + vidDisp.muted=true; + } + } + + private function setSource(s:Object):void { + vidDisp.source = s; + } + + private function formatTime(s:Number):String { + var hrs:Number = Math.floor(s / 3600); + var min:Number = Math.floor(s / 60 % 60); + var sec:Number = Math.floor(s % 60); + + var fmtd:String=''; + + if (hrs>0) fmtd = String(hrs)+':'; + + if (hrs>0 && min <10) fmtd+='0'; + fmtd += String(min)+':'; + + if (sec<10) fmtd+='0'; + fmtd += String(sec); + + return fmtd; + } + + private function currentTime():Number { + return vidDisp.currentTime; + } + + private function playing():Boolean { + return vidDisp.playing; + } + + private function duration():Number { + return vidDisp.duration; + } + + private function muted():Boolean { + return vidDisp.muted; + } + + private function init():void { + this.setFocus(); + this.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown); + this.addEventListener(KeyboardEvent.KEY_UP, onKeyUp); + this.addEventListener(Event.ENTER_FRAME, onEnterFrame); + ExternalInterface.addCallback("play", play); + ExternalInterface.addCallback("pause", pause); + ExternalInterface.addCallback("playPause", playPause); + ExternalInterface.addCallback("seek", seek); + ExternalInterface.addCallback("rewind", rewind); + ExternalInterface.addCallback("volume", volume); + ExternalInterface.addCallback("mute", mute); + ExternalInterface.addCallback("setSource", setSource); + ExternalInterface.addCallback("stepping", step); + ExternalInterface.addCallback("currentTime", currentTime); + ExternalInterface.addCallback("duration", duration); + ExternalInterface.addCallback("playing", playing); + ExternalInterface.addCallback("muted", muted); + } + ]]> + </fx:Script> + + <fx:Declarations> + <s:Fade id="fadeEffect" target="{playProgress}" alphaFrom="0.5" alphaTo="0" duration="2000"/> + </fx:Declarations> + + <s:VideoDisplay + id="vidDisp" + width="100%" height="100%" scaleMode="{scaleMode}" + source="{source}" volume="{vol}" + autoPlay="{autoPlay}" autoRewind="{autoRewind}" loop="{loop}" + mouseDown="if(stepping){vidDisp.play();}else{vidDisp.pause();}this.setFocus();" + mouseUp="if(vidComplete) vidDisp.seek(0);if(!stepping){vidDisp.play();}" + mediaPlayerStateChange="onStateChange(event);" + complete="vidComplete=true;" + durationChange="vidDisp.seek(0);" + currentTimeChange="onCurrentTimeChange(event);" + /> + + <mx:ProgressBar width="100%" mode="polled" source="vidDisp" + horizontalCenter="0" bottom="0" labelPlacement="center" + id="loadingProgress" alpha="0.5" + complete="loadingProgress.visible=false;" + progress="onProgress(event)" + /> + + <mx:ProgressBar width="100%" mode="manual" + horizontalCenter="0" bottom="0" labelPlacement="center" + id="playProgress" alpha="0.5" + visible="false" + /> +</s:Application> diff --git a/Master/texmf-dist/source/latex/media9/players/VPlayer9.mxml b/Master/texmf-dist/source/latex/media9/players/VPlayer9.mxml new file mode 100644 index 00000000000..02c684ffe32 --- /dev/null +++ b/Master/texmf-dist/source/latex/media9/players/VPlayer9.mxml @@ -0,0 +1,294 @@ +<?xml version="1.0"?> +<!-- --> +<!-- Adobe Flex 3 source file of VPlayer9.swf, --> +<!-- a FlashPlayer-9 compatible component for playing --> +<!-- FLV and MP4/H.264 video files and streams. --> +<!-- --> +<!-- version 20140625 --> +<!-- --> +<!-- Copyright (C) 2012-today Alexander Grahn --> +<!-- --> +<!-- This work may be distributed and/or modified under the --> +<!-- conditions of the LaTeX Project Public License, either --> +<!-- version 1.3 of this license or (at your option) any later --> +<!-- version. --> +<!-- --> +<!-- The latest version of this license is in --> +<!-- http://www.latex-project.org/lppl.txt --> +<!-- and version 1.3 or later is part of all distributions of --> +<!-- LaTeX version 2005/12/01 or later. --> +<!-- --> +<!-- This work has the LPPL maintenance status `maintained'. --> +<!-- --> +<!-- The current maintainer of this work is A. Grahn. --> +<!-- --> + +<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" + preinitialize="initialise(Application.application.parameters);" + creationComplete="init();" + backgroundAlpha="0" + paddingTop="0" paddingBottom="0" + paddingLeft="0" paddingRight="0" + layout="absolute" clipContent="false" +> + <mx:Script> + <![CDATA[ + [Bindable] private var source:String; + [Bindable] private var autoPlay:Boolean=false; + [Bindable] private var loop:Boolean=false; + [Bindable] private var vol:Number=0.75; + [Bindable] private var stepping:Boolean=false; + [Bindable] private var letterbox:Boolean=false; + private var vidComplete:Boolean=false; + private var deltaSeek:Number; + private var playheadTime:Number; + private var newPos:Number; + private var keyPressed:Boolean=false; + private var muted:Boolean=false; + private var lastVolume:Number; + private var pauseAtPos:Number = -1; + private var toBePaused:Boolean = false; + + import flash.external.*; + private function initialise(flashVars:Object):void { + source=flashVars.source; + if(flashVars.autoPlay=='true'){autoPlay=true} + if(flashVars.loop=='true'){loop=true} + if(flashVars.volume){vol=Number(flashVars.volume)} + if(flashVars.stepping){stepping=flashVars.stepping} + if(flashVars.scaleMode=='letterbox'){letterbox=true} + } + + private function onProgress(event:ProgressEvent):void { + if (event.bytesTotal) event.target.visible=true; + else event.target.visible=false; + } + + import mx.events.VideoEvent; + import mx.controls.Alert; + private function onStateChange(event:VideoEvent):void { + vidComplete=false; + if(event.state=='connectionError') + Alert.show('Unable to play \''+event.target.source+'\'','Error'); + } + + private function onKeyDown(e:KeyboardEvent):void { + switch(e.keyCode) { + case 32: //space bar + playPause(); + break; + case 36: //home + vidDisp.pause(); + vidDisp.playheadTime=0; + break; + case 35: //end + if(vidDisp.bytesTotal){ + vidDisp.pause(); + vidDisp.playheadTime=vidDisp.totalTime-0.1; + } + break; + case 37: //<-- + fadeEffect.end(); + playProgress.alpha=0.5; + playProgress.visible=true; + if(!keyPressed){ + deltaSeek=Math.max(1,vidDisp.totalTime/1000); + playheadTime=vidDisp.playheadTime; + } + keyPressed=true; + newPos=Math.max(0,playheadTime-deltaSeek); + playProgress.setProgress(newPos,vidDisp.totalTime); + playProgress.label=formatTime(newPos); + vidDisp.playheadTime=newPos; + deltaSeek*=1.1; + break; + case 39: //--> + fadeEffect.end(); + playProgress.alpha=0.5; + playProgress.visible=true; + if(!keyPressed){ + deltaSeek=Math.max(1,vidDisp.totalTime/1000); + playheadTime=vidDisp.playheadTime; + } + keyPressed=true; + newPos=Math.min(vidDisp.totalTime-0.1,playheadTime+deltaSeek); + playProgress.setProgress(newPos,vidDisp.totalTime); + playProgress.label=formatTime(newPos); + vidDisp.playheadTime=newPos; + deltaSeek*=1.1; + break; + case 38: + vol=Math.min(1,vol+0.025); + volume(vol); + break; + case 40: + vol=Math.max(0,vol-0.025); + volume(vol); + break; + default: + if(e.charCode==109) mute(); //`m' + } + } + + private function onKeyUp(e:KeyboardEvent):void { + switch(e.keyCode) { + case 37: //<-- + case 39: //--> + deltaSeek=Math.max(1,vidDisp.totalTime/1000); + keyPressed=false; + fadeEffect.play(); + break; + } + } + + private function onEnterFrame(e:Event):void { + if(stepping&&vidDisp.playing){vidDisp.pause();} + } + + private function onPlayheadUpdate(e:Event):void { + if(vidDisp.playing&&pauseAtPos>=0&&vidDisp.playheadTime<pauseAtPos) + toBePaused=true; + if( + vidDisp.playing&&pauseAtPos>=0&& + vidDisp.playheadTime>=pauseAtPos&&toBePaused + ){ + pause(); + pauseAtPos=-1; + toBePaused=false; + } + } + + private function play(p:Number=-1):void { + if(p>=0) seek(p); + if(vidComplete){seek(0);}vidDisp.play(); + } + + private function pause(p:Number=-1):void { + if(p>=0){pauseAtPos=p;return;} + vidDisp.pause(); + } + + private function playPause():void { + if(vidDisp.playing) vidDisp.pause(); else vidDisp.play(); + } + + private function seek(p:Number):void { + vidDisp.playheadTime=p; + } + + private function step():void { + if(stepping){stepping=false;}else{stepping=true;} + } + + private function rewind():void { + vidDisp.playheadTime=0; + } + + private function volume(v:Number):void { + muted=false; + vidDisp.volume = v; + } + + private function mute():void { + if(muted) { + if (lastVolume==0) volume(0.75); + else volume(lastVolume); + } + else { + muted=true;lastVolume=vidDisp.volume;vidDisp.volume=0; + } + } + + private function setSource(s:String):void { + vidDisp.pause();vidDisp.source = s; + vidDisp.play();vidDisp.pause(); + vidDisp.playheadTime=0; + } + + private function formatTime(s:Number):String { + var hrs:Number = Math.floor(s / 3600); + var min:Number = Math.floor(s / 60 % 60); + var sec:Number = Math.floor(s % 60); + + var fmtd:String=''; + + if (hrs>0) fmtd = String(hrs)+':'; + + if (hrs>0 && min <10) fmtd+='0'; + fmtd += String(min)+':'; + + if (sec<10) fmtd+='0'; + fmtd += String(sec); + + return fmtd; + } + + private function currentTime():Number { + return vidDisp.playheadTime; + } + + private function playing():Boolean { + return vidDisp.playing; + } + + private function duration():Number { + return vidDisp.totalTime; + } + + private function ismuted():Boolean { + return muted; + } + + private function init():void { + this.setFocus(); + this.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown); + this.addEventListener(KeyboardEvent.KEY_UP, onKeyUp); + this.addEventListener(Event.ENTER_FRAME, onEnterFrame); + ExternalInterface.addCallback("play", play); + ExternalInterface.addCallback("pause", pause); + ExternalInterface.addCallback("playPause", playPause); + ExternalInterface.addCallback("seek", seek); + ExternalInterface.addCallback("rewind", rewind); + ExternalInterface.addCallback("volume", volume); + ExternalInterface.addCallback("mute", mute); + ExternalInterface.addCallback("setSource", setSource); + ExternalInterface.addCallback("stepping", step); + ExternalInterface.addCallback("currentTime", currentTime); + ExternalInterface.addCallback("duration", duration); + ExternalInterface.addCallback("playing", playing); + ExternalInterface.addCallback("muted", ismuted); + } + ]]> + </mx:Script> + + <mx:Fade id="fadeEffect" target="{playProgress}" alphaFrom="0.5" alphaTo="0" duration="2000" + effectEnd="playProgress.label=''" + /> + + <mx:VideoDisplay + id="vidDisp" + width="100%" height="100%" maintainAspectRatio="{letterbox}" + backgroundAlpha="0" borderThickness="0" + source="{source}" volume="{vol}" + autoPlay="{autoPlay}" autoRewind="{loop}" + mouseDown="if(stepping){vidDisp.play();}else{vidDisp.pause();}this.setFocus();" + mouseUp="if(vidComplete) vidDisp.playheadTime=0;if(!stepping){vidDisp.play();}" + stateChange="onStateChange(event);" + complete="vidComplete=true;" + rewind="vidDisp.play();" + playheadUpdate="onPlayheadUpdate(event);" + /> + + <mx:ProgressBar width="100%" mode="polled" source="vidDisp" + horizontalCenter="0" bottom="0" labelPlacement="center" + id="loadingProgress" alpha="0.5" + complete="loadingProgress.visible=false;" + progress="onProgress(event)" + /> + + <mx:ProgressBar width="100%" mode="manual" + horizontalCenter="0" bottom="0" labelPlacement="center" + id="playProgress" alpha="0.5" + visible="false" + /> +</mx:Application> diff --git a/Master/texmf-dist/tex/latex/media9/media9.sty b/Master/texmf-dist/tex/latex/media9/media9.sty index 3a9afab95f0..549db4d51bd 100644 --- a/Master/texmf-dist/tex/latex/media9/media9.sty +++ b/Master/texmf-dist/tex/latex/media9/media9.sty @@ -43,8 +43,8 @@ \RequirePackage{atenddvi} \RequirePackage{tikz} -\def\g@mix@date@tl{2015/01/21} -\def\g@mix@version@tl{0.49} +\def\g@mix@date@tl{2015/02/24} +\def\g@mix@version@tl{0.50} \def\g@mix@liiikerneldate{2014/07/20} \def\g@mix@liiipkgdate{2014/07/20} @@ -393,8 +393,8 @@ \cs_gset:Nn\mix_keytoaux_now:nn{ \iow_now:Nx\@auxout{\token_to_str:N\mix@newkey{#1}{#2}} - \bool_if:nF{ - \cs_if_exist_p:c{#1} && \str_if_eq_x_p:nn{\tl_use:c{#1}}{#2} + \bool_if:nT{ + !\cs_if_exist_p:c{#1} || !\str_if_eq_x_p:nn{\tl_use:c{#1}}{#2} }{ \cs_if_exist:NF\g_mix_rerunwarned_tl{ \tl_new:N\g_mix_rerunwarned_tl @@ -594,17 +594,17 @@ %helper func to remove `0 R' part from pdf obj reference \cs_new:Npn\mix_reftonum:w #1~0~R {#1} \cs_new:Nn\mix_pdfobj:nnn{ - % #1:objref; if empty, a new object number will be reserved - % #2:type of object (dict|array|stream|fstream) - % #3:content (key-value, file, string); may be empty + % #1: predefined obj ref to be used with the current obj; may be empty + % #2: type of object (dict|array|stream|fstream) + % #3: content (key-value, file, string); if #3 && #1 are both empty, an + % object reference will be reserved for later use \tl_clear:N\l_mix_usenum_tl - \tl_if_blank:oTF{#1}{ - \pdfobj~reserveobjnum - \tl_set:Nx\l_mix_usenum_tl{useobjnum~\the\pdflastobj} - }{ + \tl_if_blank:oF{#1}{ \tl_set:Nx\l_mix_usenum_tl{useobjnum~\exp_after:wN \mix_reftonum:w #1} } - \tl_if_blank:oF{#3}{ + \bool_if:nTF{\tl_if_blank_p:o{#1}&&\tl_if_blank_p:o{#3}}{ + \pdfobj~reserveobjnum + }{ \str_case:nnn{#2}{ {dict}{\immediate\pdfobj~\l_mix_usenum_tl~{<<#3>>}} {array}{\immediate\pdfobj~\l_mix_usenum_tl~{[#3]}} @@ -612,17 +612,21 @@ {fstream}{\immediate\pdfobj~\l_mix_usenum_tl~stream~file~{#3}} }{} } - \tl_gset:Nx\g_mix_pdflastobj_tl{\int_use:c{pdflastobj}~0~R} + \tl_gset:Nx\g_mix_pdflastobj_tl{\the\pdflastobj\space 0~R} } \cs_new:Nn\mix_pdfannot:nnnn{ % #1:width, #2:height, #3:depth, #4:content (key-value) - \immediate\pdfannot~width~#1~height~#2~depth~#3 {#4} + \immediate\pdfannot~width~#1~height~#2~depth~#3 { + #4\cs_if_exist_use:N\fxocg@insert@OC + } \tl_gset:Nx\g_mix_pdflastann_tl{\int_use:c{pdflastannot}~0~R} } \cs_new:Nn\mix_pdflink:nn{% #1:dict, #2:text - \immediate\pdfstartlink~user~{#1}#2\pdfendlink + \immediate\pdfstartlink~user~{ + #1\cs_if_exist_use:N\fxocg@insert@OC + }#2\pdfendlink } \cs_new:Nn\mix_pdfxform:n{%#1:savebox number @@ -686,32 +690,28 @@ \int_new:N\g_mix_obj_int % object ID \bool_if:NTF\g_mix_dvipdfmx_bool{ %dvipdfmx/XeTeX \cs_new:Nn\mix_pdfobj:nnn{ - % #1:objref; if empty, a new object number will be reserved - % #2:type of object (dict|array|stream|fstream) - % #3:content (key-value, file, string); may be empty - \tl_clear:N\l_mix_usenum_tl + % #1: predefined obj ref to be used with the current obj; may be empty + % #2: type of object (dict|array|stream|fstream) + % #3: content (key-value, file, string); if #3 && #1 are both empty, an + % object reference will be reserved for later use \tl_if_blank:oTF{#1}{ - \str_case:nnn{#2}{ - {dict}{\special{pdf:obj~@mix@obj\int_use:N\g_mix_obj_int\space<<>>}} - {array}{\special{pdf:obj~@mix@obj\int_use:N\g_mix_obj_int\space[]}} - {stream}{\special{pdf:stream~@mix@obj\int_use:N\g_mix_obj_int\space(#3)}} - {fstream}{ - \message{<#3>} - \special{pdf:fstream~@mix@obj\int_use:N\g_mix_obj_int\space(#3)} - } - }{} \tl_set:Nx\l_mix_usenum_tl{@mix@obj\int_use:N\g_mix_obj_int} \int_gincr:N\g_mix_obj_int - }{ + }{ \tl_set:Nx\l_mix_usenum_tl{#1} } \tl_if_blank:oF{#3}{ \str_case:nnn{#2}{ - {dict}{\special{pdf:put~\l_mix_usenum_tl\space<<#3>>}} - {array}{\special{pdf:put~\l_mix_usenum_tl\space#3}} + {dict}{\special{pdf:obj~\l_mix_usenum_tl\space<<#3>>}} + {array}{\special{pdf:obj~\l_mix_usenum_tl\space[#3]}} + {stream}{\special{pdf:stream~\l_mix_usenum_tl\space(#3)}} + {fstream}{ + \message{<#3>} + \special{pdf:fstream~\l_mix_usenum_tl\space(#3)} + } }{} } - \tl_gset:Nx\g_mix_pdflastobj_tl{\l_mix_usenum_tl} + \tl_gset_eq:NN\g_mix_pdflastobj_tl\l_mix_usenum_tl } \cs_new:Nn\mix_pdfannot:nnnn{ @@ -719,14 +719,16 @@ \special{pdf:ann~@mix@obj\int_use:N\g_mix_obj_int\space width~#1\space height~#2\space - depth~#3~<<#4>> + depth~#3~<<#4\cs_if_exist_use:N\fxocg@insert@OC>> } \tl_gset:Nx\g_mix_pdflastann_tl{@mix@obj\int_use:N\g_mix_obj_int} \int_gincr:N\g_mix_obj_int } \cs_new:Nn\mix_pdflink:nn{% #1:dict, #2:text - \special{pdf:bann~<<#1>>}#2\special{pdf:eann} + \special{pdf:bann~<< + #1\cs_if_exist_use:N\fxocg@insert@OC + >>}#2\special{pdf:eann} } \cs_new:Nn\mix_pdfxform:n{%#1:savebox number @@ -828,20 +830,27 @@ \AtEndDvi{\special{ps:\g_mix_dpiwarning_tl}} \cs_new:Nn\mix_pdfobj:nnn{ - % #1:objref; if empty, a new object number will be reserved - % #2:type of object (dict|array|stream|fstream) - % #3:content (key-value, file, string); may be empty + % #1: predefined obj ref to be used with the current obj; may be empty + % #2: type of object (dict|array|stream|fstream) + % #3: content (key-value, file, string); if #3 && #1 are both empty, an + % object reference will be reserved for later use \tl_clear:N\l_mix_usenum_tl \tl_if_blank:oTF{#1}{ + \tl_set:Nx\l_mix_usenum_tl{{mix@obj\int_use:N\g_mix_obj_int}} + \int_gincr:N\g_mix_obj_int + }{ + \tl_set:Nx\l_mix_usenum_tl{#1} + } + \tl_if_blank:oF{#3}{ \bool_if:nTF{ \g_mix_pkgbigfiles_bool && \str_if_eq_p:nn{#2}{fstream} }{ \iow_now:Nx\g_mix_mstreams_stream{ - M9D~begin~o{mix@obj\int_use:N\g_mix_obj_int}O + M9D~begin~o\l_mix_usenum_tl O } }{ - \special{ps:~mark~/_objdef~{mix@obj\int_use:N\g_mix_obj_int}~/type + \special{ps:~mark~/_objdef~\l_mix_usenum_tl\space/type \str_case:nnn{#2}{ {dict}{/dict} {array}{/array} @@ -851,12 +860,6 @@ /OBJ~pdfmark~ } } - \tl_set:Nx\l_mix_usenum_tl{{mix@obj\int_use:N\g_mix_obj_int}} - \int_gincr:N\g_mix_obj_int - }{ - \tl_set:Nx\l_mix_usenum_tl{#1} - } - \tl_if_blank:oF{#3}{ \str_case:nnn{#2}{ {dict}{\special{ps:~mark~\l_mix_usenum_tl~<<#3>>/PUT~pdfmark~}} {array}{ @@ -902,7 +905,7 @@ } }{} } - \tl_gset:Nx\g_mix_pdflastobj_tl{\l_mix_usenum_tl} + \tl_gset_eq:NN\g_mix_pdflastobj_tl\l_mix_usenum_tl } \cs_new:Nn\mix_pdfannot:nnnn{ @@ -927,7 +930,7 @@ mark~ /_objdef~{mix@obj\int_use:N\g_mix_obj_int} /Rect~[mix@llx~mix@lly~mix@urx~mix@ury] - #4~ + #4\cs_if_exist_use:N\fxocg@insert@OC /ANN~pdfmark~ } \tl_gset:Nx\g_mix_pdflastann_tl{{mix@obj\int_use:N\g_mix_obj_int}} @@ -936,14 +939,18 @@ \cs_new:Nn\mix_pdflink:nn{% #1:dict, #2:text \cs_if_exist:NTF\pdfmark{ - \pdfmark[#2]{pdfmark=/ANN,Raw={#1}} + \pdfmark[#2]{pdfmark=/ANN,Raw={ + #1\cs_if_exist_use:N\fxocg@insert@OC + }} }{ \hbox_set:Nn\l_tmpb_box{#2} \mix_pdfannot:nnnn{ \box_wd:N\l_tmpb_box}{ \box_ht:N\l_tmpb_box}{ \box_dp:N\l_tmpb_box - }{#1} + }{ + #1\cs_if_exist_use:N\fxocg@insert@OC + } \box_use_clear:N\l_tmpb_box } } @@ -1078,33 +1085,7 @@ } \filename@parse{#1} \tl_set:Nx\l_mix_base_tl{\filename@base} - \tl_set:Nx\l_mix_ext_tl{\filename@ext} - \tl_replace_all:Nnn\l_mix_ext_tl{A}{a} - \tl_replace_all:Nnn\l_mix_ext_tl{B}{b} - \tl_replace_all:Nnn\l_mix_ext_tl{C}{c} - \tl_replace_all:Nnn\l_mix_ext_tl{D}{d} - \tl_replace_all:Nnn\l_mix_ext_tl{E}{e} - \tl_replace_all:Nnn\l_mix_ext_tl{F}{f} - \tl_replace_all:Nnn\l_mix_ext_tl{G}{g} - \tl_replace_all:Nnn\l_mix_ext_tl{H}{h} - \tl_replace_all:Nnn\l_mix_ext_tl{I}{i} - \tl_replace_all:Nnn\l_mix_ext_tl{J}{j} - \tl_replace_all:Nnn\l_mix_ext_tl{K}{k} - \tl_replace_all:Nnn\l_mix_ext_tl{L}{l} - \tl_replace_all:Nnn\l_mix_ext_tl{M}{m} - \tl_replace_all:Nnn\l_mix_ext_tl{N}{n} - \tl_replace_all:Nnn\l_mix_ext_tl{O}{o} - \tl_replace_all:Nnn\l_mix_ext_tl{P}{p} - \tl_replace_all:Nnn\l_mix_ext_tl{Q}{q} - \tl_replace_all:Nnn\l_mix_ext_tl{R}{r} - \tl_replace_all:Nnn\l_mix_ext_tl{S}{s} - \tl_replace_all:Nnn\l_mix_ext_tl{T}{t} - \tl_replace_all:Nnn\l_mix_ext_tl{U}{u} - \tl_replace_all:Nnn\l_mix_ext_tl{V}{v} - \tl_replace_all:Nnn\l_mix_ext_tl{W}{w} - \tl_replace_all:Nnn\l_mix_ext_tl{X}{x} - \tl_replace_all:Nnn\l_mix_ext_tl{Y}{y} - \tl_replace_all:Nnn\l_mix_ext_tl{Z}{z} + \tl_set:Nx\l_mix_ext_tl{\tl_lower_case:n{\filename@ext}} \bool_if:NTF\l_mix_url_bool{ \cs_if_exist:cF{url_#1}{ \mix_pdfobj:nnn{}{dict}{/FS/URL/F(#1)} @@ -1300,7 +1281,7 @@ }{ %\hbox_set:Nn#1{ % \resizebox*{\g_mix_wd_tl}{\g_mix_tt_tl}{\box_use_clear:N#1}} - \box_resize:Nnn#1{\g_mix_wd_tl}{\g_mix_tt_tl} + \box_resize:Nnn#1{\g_mix_wd_tl}{\g_mix_tt_tl} } } {\c_six}{ |