/* */ package quicktime.app.players;
/* */
/* */ import java.util.Vector;
/* */ import quicktime.QTException;
/* */ import quicktime.QTRuntimeException;
/* */ import quicktime.QTSession;
/* */ import quicktime.app.actions.Invalidator;
/* */ import quicktime.app.anim.SWCompositor;
/* */ import quicktime.app.anim.TwoDSprite;
/* */ import quicktime.app.audio.AudioSpec;
/* */ import quicktime.app.display.DrawingListener;
/* */ import quicktime.app.display.DrawingNotifier;
/* */ import quicktime.app.image.DynamicImage;
/* */ import quicktime.app.image.ImagePresenter;
/* */ import quicktime.app.time.TaskAllMovies;
/* */ import quicktime.qd.PixMap;
/* */ import quicktime.qd.QDGraphics;
/* */ import quicktime.qd.QDRect;
/* */ import quicktime.qd.Region;
/* */ import quicktime.std.StdQTException;
/* */ import quicktime.std.clocks.TimeBase;
/* */ import quicktime.std.image.ImageDescription;
/* */ import quicktime.std.movies.Movie;
/* */ import quicktime.std.movies.MovieDrawingComplete;
/* */ import quicktime.std.movies.MoviePrePreroll;
/* */
/* */ /** @deprecated */
/* */ public class MoviePresenter extends ImagePresenter
/* */ implements AudioSpec, Playable, DynamicImage, MovieDrawingComplete, DrawingNotifier
/* */ {
/* */ private QDGraphics g;
/* */ private Movie m;
/* */ private boolean gModeOpaque;
/* */ protected TwoDSprite spritePresenter;
/* 114 */ private boolean mChanged = false;
/* 115 */ private boolean isPres = false;
/* */
/* 254 */ private float lastRate = 0.0F;
/* */ private Vector listenerList;
/* 432 */ private boolean drawCompleteListening = false;
/* */
/* */ private static QDRect moveToZero(QDRect paramQDRect)
/* */ {
/* 73 */ paramQDRect.move(0, 0);
/* 74 */ return paramQDRect;
/* */ }
/* */
/* */ /** @deprecated */
/* */ public MoviePresenter(Movie paramMovie)
/* */ throws QTException
/* */ {
/* 86 */ this(paramMovie, new QDGraphics(32, paramMovie.getBounds(), 4096));
/* */ }
/* */
/* */ /** @deprecated */
/* */ public MoviePresenter(Movie paramMovie, QDGraphics paramQDGraphics)
/* */ throws QTException
/* */ {
/* 99 */ super(moveToZero(paramMovie.getBounds()));
/* 100 */ this.m = paramMovie;
/* 101 */ this.g = paramQDGraphics;
/* 102 */ paramMovie.setGWorld(paramQDGraphics, null);
/* 103 */ PixMap localPixMap = paramQDGraphics.getPixMap();
/* 104 */ setImageData(localPixMap.getPixelData(), new ImageDescription(localPixMap));
/* 105 */ this.gModeOpaque = true;
/* 106 */ paramMovie.task(0);
/* */ }
/* */
/* */ /** @deprecated */
/* */ public void setGWorld(QDGraphics paramQDGraphics)
/* */ throws QTException
/* */ {
/* 128 */ if (getGWorld().equals(paramQDGraphics))
/* 129 */ return;
/* 130 */ super.setGWorld(paramQDGraphics);
/* 131 */ if (QDGraphics.scratch.equals(paramQDGraphics)) {
/* 132 */ TaskAllMovies.removeMovie();
/* 133 */ this.isPres = false;
/* 134 */ this.m.removeDrawingCompleteProc();
/* 135 */ this.m.setActive(false);
/* */ } else {
/* 137 */ if (QDGraphics.validScratch.equals(paramQDGraphics))
/* 138 */ this.isPres = false;
/* */ else
/* 140 */ this.isPres = true;
/* 141 */ this.m.setDrawingCompleteProc(0, this);
/* 142 */ TaskAllMovies.addMovieAndStart();
/* 143 */ this.m.setActive(true);
/* */ }
/* */ }
/* */
/* */ /** @deprecated */
/* */ public boolean isPresenting()
/* */ {
/* 154 */ return this.isPres;
/* */ }
/* */
/* */ /** @deprecated */
/* */ public int execute(Movie paramMovie)
/* */ {
/* */ try
/* */ {
/* 173 */ if (this.isPres)
/* 174 */ doDraw();
/* 175 */ this.mChanged = true;
/* 176 */ if (this.listenerList != null)
/* 177 */ synchronized (this) {
/* 178 */ for (int i = 0; i < this.listenerList.size(); i++)
/* 179 */ ((DrawingListener)this.listenerList.elementAt(i)).drawingComplete(this);
/* */ }
/* */ }
/* */ catch (QTException localQTException) {
/* 183 */ return localQTException.errorCode();
/* */ }
/* 185 */ return 0;
/* */ }
/* */
/* */ /** @deprecated */
/* */ public Movie getMovie()
/* */ {
/* 194 */ return this.m;
/* */ }
/* */
/* */ /** @deprecated */
/* */ public QDGraphics getOffscreenBuffer()
/* */ {
/* 203 */ return this.g;
/* */ }
/* */
/* */ /** @deprecated */
/* */ public void redraw(Region paramRegion)
/* */ throws QTException
/* */ {
/* 216 */ if (paramRegion != null)
/* 217 */ this.m.invalidateRegion(paramRegion);
/* */ else
/* 219 */ this.m.invalidateRegion(new Region(this.m.getBounds()));
/* 220 */ this.m.task(0);
/* 221 */ if ((this.spritePresenter != null) && (this.spritePresenter.isValid())) {
/* 222 */ this.spritePresenter.invalidate();
/* */ }
/* 224 */ super.redraw(paramRegion);
/* */ }
/* */
/* */ /** @deprecated */
/* */ public TimeBase getTimeBase()
/* */ throws QTException
/* */ {
/* 234 */ return this.m.getTimeBase();
/* */ }
/* */
/* */ /** @deprecated */
/* */ public void setRate(float paramFloat)
/* */ throws QTException
/* */ {
/* 245 */ synchronized (this) {
/* 246 */ this.lastRate = paramFloat;
/* */ }
/* 248 */ if (paramFloat == 0.0F)
/* 249 */ this.m.stop();
/* */ else
/* 251 */ this.m.prePreroll(this.m.getTime(), paramFloat, new PrerollCallback(paramFloat));
/* */ }
/* */
/* */ /** @deprecated */
/* */ public float getRate()
/* */ throws QTException
/* */ {
/* 286 */ return this.m.getRate();
/* */ }
/* */
/* */ /** @deprecated */
/* */ public void setTime(int paramInt)
/* */ throws QTException
/* */ {
/* 297 */ this.m.setTimeValue(paramInt);
/* */ }
/* */
/* */ /** @deprecated */
/* */ public int getTime()
/* */ throws QTException
/* */ {
/* 304 */ return this.m.getTime();
/* */ }
/* */
/* */ /** @deprecated */
/* */ public int getDuration()
/* */ throws QTException
/* */ {
/* 313 */ return this.m.getDuration();
/* */ }
/* */
/* */ /** @deprecated */
/* */ public int getScale()
/* */ throws QTException
/* */ {
/* 320 */ return this.m.getTimeScale();
/* */ }
/* */
/* */ /** @deprecated */
/* */ public float getVolume()
/* */ throws QTException
/* */ {
/* 327 */ float f = this.m.getVolume();
/* 328 */ return Math.abs(f);
/* */ }
/* */
/* */ /** @deprecated */
/* */ public void setVolume(float paramFloat)
/* */ throws QTException
/* */ {
/* 336 */ float f = Math.abs(paramFloat);
/* 337 */ if (isMuted())
/* 338 */ this.m.setVolume(f * -1.0F);
/* */ else
/* 340 */ this.m.setVolume(f);
/* */ }
/* */
/* */ /** @deprecated */
/* */ public boolean isMuted()
/* */ throws QTException
/* */ {
/* 348 */ return this.m.getVolume() < 0.0F;
/* */ }
/* */
/* */ /** @deprecated */
/* */ public void setMuted(boolean paramBoolean)
/* */ throws QTException
/* */ {
/* 358 */ float f = Math.abs(this.m.getVolume());
/* 359 */ if (paramBoolean)
/* 360 */ this.m.setVolume(f * -1.0F);
/* */ else
/* 362 */ this.m.setVolume(f);
/* */ }
/* */
/* */ /** @deprecated */
/* */ public void movieChanged()
/* */ {
/* 381 */ this.mChanged = true;
/* */ }
/* */
/* */ /** @deprecated */
/* */ public Invalidator addedToCompositor(SWCompositor paramSWCompositor, TwoDSprite paramTwoDSprite)
/* */ throws QTException
/* */ {
/* 405 */ this.spritePresenter = paramTwoDSprite;
/* 406 */ this.m.setActive(true);
/* 407 */ if (!this.drawCompleteListening) {
/* 408 */ this.m.setDrawingCompleteProc(0, this);
/* 409 */ this.drawCompleteListening = true;
/* */ }
/* 411 */ return new MPInvalidator(this.spritePresenter);
/* */ }
/* */
/* */ /** @deprecated */
/* */ public void removedFromCompositor(SWCompositor paramSWCompositor)
/* */ throws QTException
/* */ {
/* 422 */ if (this.listenerList == null) {
/* 423 */ this.m.removeDrawingCompleteProc();
/* 424 */ this.drawCompleteListening = false;
/* */ }
/* 426 */ this.spritePresenter = null;
/* 427 */ if (QDGraphics.scratch.equals(getGWorld()))
/* 428 */ this.m.setActive(false);
/* */ }
/* */
/* */ /** @deprecated */
/* */ public synchronized void addDrawingListener(DrawingListener paramDrawingListener)
/* */ {
/* 439 */ if (this.listenerList == null) {
/* 440 */ this.listenerList = new Vector();
/* */ }
/* 442 */ if (this.listenerList.contains(paramDrawingListener)) {
/* 443 */ return;
/* */ }
/* 445 */ this.listenerList.addElement(paramDrawingListener);
/* */
/* 447 */ if (!this.drawCompleteListening)
/* */ try {
/* 449 */ this.m.setDrawingCompleteProc(0, this);
/* 450 */ this.drawCompleteListening = true;
/* */ }
/* */ catch (StdQTException localStdQTException)
/* */ {
/* */ }
/* */ }
/* */
/* */ /** @deprecated */
/* */ public synchronized void removeDrawingListener(DrawingListener paramDrawingListener)
/* */ {
/* 460 */ this.listenerList.removeElement(paramDrawingListener);
/* */
/* 462 */ if (this.listenerList.isEmpty()) {
/* 463 */ if (this.spritePresenter == null)
/* */ try {
/* 465 */ this.m.removeDrawingCompleteProc();
/* 466 */ this.drawCompleteListening = false;
/* */ } catch (StdQTException localStdQTException) {
/* */ }
/* 469 */ this.listenerList = null;
/* */ }
/* */ }
/* */
/* */ static
/* */ {
/* 52 */ if ((QTSession.isCurrentOS(4)) && (QTSession.getJavaVersion() >= 65540))
/* 53 */ throw new QTRuntimeException("Unsupported on Mac OS X and Java 1.4 and higher.");
/* */ }
/* */
/* */ class PrerollCallback
/* */ implements MoviePrePreroll
/* */ {
/* */ private float r;
/* */
/* */ PrerollCallback(float arg2)
/* */ {
/* */ Object localObject;
/* 258 */ this.r = localObject;
/* */ }
/* */
/* */ public void execute(Movie paramMovie, int paramInt)
/* */ {
/* 263 */ synchronized (MoviePresenter.this) {
/* 264 */ if (MoviePresenter.this.lastRate == 0.0F) {
/* 265 */ return;
/* */ }
/* 267 */ if (paramInt == 0)
/* */ try {
/* 269 */ paramMovie.preroll(paramMovie.getTime(), this.r);
/* 270 */ paramMovie.setRate(this.r);
/* */ } catch (QTException localQTException) {
/* 272 */ QTRuntimeException.handleOrThrow(new QTRuntimeException(localQTException), paramMovie, "preroll");
/* */ }
/* */ else
/* 275 */ QTRuntimeException.handleOrThrow(new QTRuntimeException(paramInt), paramMovie, "prePreroll");
/* */ }
/* */ }
/* */ }
/* */
/* */ class MPInvalidator extends Invalidator
/* */ {
/* */ MPInvalidator(TwoDSprite arg2)
/* */ {
/* 59 */ super();
/* */ }
/* */
/* */ public boolean tickle(float paramFloat, int paramInt) throws QTException {
/* 63 */ MoviePresenter.this.m.task(0);
/* 64 */ if (MoviePresenter.this.mChanged) {
/* 65 */ MoviePresenter.this.spritePresenter.invalidate();
/* 66 */ MoviePresenter.this.mChanged = false;
/* */ }
/* 68 */ return true;
/* */ }
/* */ }
/* */ }
/* Location: Z:\System\Library\Java\Extensions\QTJava.zip
* Qualified Name: quicktime.app.players.MoviePresenter
* JD-Core Version: 0.6.2
*/