/* */ package quicktime.app.view;
/* */
/* */ import java.awt.Dimension;
/* */ import java.util.Vector;
/* */ import quicktime.QTException;
/* */ import quicktime.QTRuntimeException;
/* */ import quicktime.app.time.TaskAllMovies;
/* */ import quicktime.app.time.Timeable;
/* */ import quicktime.qd.QDDimension;
/* */ 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.Matrix;
/* */ import quicktime.std.movies.Movie;
/* */ import quicktime.std.movies.MovieDrawingComplete;
/* */ import quicktime.std.movies.MoviePrePreroll;
/* */
/* */ public class MoviePlayer
/* */ implements Presentable, Timeable, DrawingNotifier
/* */ {
/* */ private Movie mMovie;
/* */ private Vector listenerList;
/* */ private MovieComplete mComplete;
/* 257 */ private float lastRate = 0.0F;
/* */
/* */ public MoviePlayer(Movie paramMovie)
/* */ throws StdQTException
/* */ {
/* 41 */ this.mMovie = paramMovie;
/* 42 */ paramMovie.setPlayHints(256, 256);
/* */ }
/* */
/* */ public Movie getMovie()
/* */ {
/* 53 */ return this.mMovie;
/* */ }
/* */
/* */ public void addedTo(Object paramObject)
/* */ {
/* */ }
/* */
/* */ public void removedFrom(Object paramObject)
/* */ {
/* */ }
/* */
/* */ public QDGraphics getGWorld()
/* */ throws StdQTException
/* */ {
/* 78 */ return this.mMovie.getGWorld();
/* */ }
/* */
/* */ public synchronized void setGWorld(QDGraphics paramQDGraphics)
/* */ throws StdQTException
/* */ {
/* 90 */ if (getGWorld().equals(paramQDGraphics))
/* 91 */ return;
/* 92 */ this.mMovie.setGWorld(paramQDGraphics, null);
/* 93 */ if (QDGraphics.scratch.equals(paramQDGraphics)) {
/* 94 */ TaskAllMovies.removeMovie();
/* 95 */ setRate(0.0F);
/* 96 */ this.mMovie.setActive(false);
/* */ }
/* */ else {
/* 99 */ TaskAllMovies.addMovieAndStart();
/* 100 */ this.mMovie.setActive(true);
/* */ }
/* */ }
/* */
/* */ /** @deprecated */
/* */ public Dimension getInitialSize()
/* */ throws QTException
/* */ {
/* 111 */ QDRect localQDRect = this.mMovie.getNaturalBoundsRect();
/* 112 */ return new Dimension(localQDRect.getWidth(), localQDRect.getHeight());
/* */ }
/* */
/* */ public QDDimension getOriginalSize()
/* */ throws QTException
/* */ {
/* 121 */ QDRect localQDRect = this.mMovie.getNaturalBoundsRect();
/* 122 */ return new QDDimension(localQDRect.getWidth(), localQDRect.getHeight());
/* */ }
/* */
/* */ public Matrix getMatrix()
/* */ throws StdQTException
/* */ {
/* 131 */ return this.mMovie.getMatrix();
/* */ }
/* */
/* */ public void setMatrix(Matrix paramMatrix)
/* */ throws QTException
/* */ {
/* 139 */ this.mMovie.setMatrix(paramMatrix);
/* 140 */ this.mMovie.task(0);
/* */ }
/* */
/* */ public final void redraw(Region paramRegion)
/* */ throws QTException
/* */ {
/* 152 */ if (paramRegion != null)
/* 153 */ this.mMovie.invalidateRegion(paramRegion);
/* */ else
/* 155 */ this.mMovie.invalidateRegion(new Region(this.mMovie.getBounds()));
/* 156 */ this.mMovie.task(0);
/* */ }
/* */
/* */ public synchronized void setDisplayBounds(QDRect paramQDRect)
/* */ throws StdQTException
/* */ {
/* 166 */ this.mMovie.setBounds(paramQDRect);
/* */ }
/* */
/* */ public void setLocation(int paramInt1, int paramInt2)
/* */ throws QTException
/* */ {
/* 175 */ QDRect localQDRect = getDisplayBounds();
/* 176 */ localQDRect.setX(paramInt1);
/* 177 */ localQDRect.setY(paramInt2);
/* 178 */ setDisplayBounds(localQDRect);
/* */ }
/* */
/* */ public QDRect getDisplayBounds()
/* */ throws StdQTException
/* */ {
/* 188 */ return this.mMovie.getBounds();
/* */ }
/* */
/* */ public void setClip(Region paramRegion)
/* */ throws QTException
/* */ {
/* 197 */ this.mMovie.setDisplayClipRgn(paramRegion);
/* */ }
/* */
/* */ public Region getClip()
/* */ throws QTException
/* */ {
/* 206 */ return this.mMovie.getDisplayClipRgn();
/* */ }
/* */
/* */ public void setTime(int paramInt)
/* */ throws StdQTException
/* */ {
/* 216 */ this.mMovie.setTimeValue(paramInt);
/* */ }
/* */
/* */ public int getTime()
/* */ throws StdQTException
/* */ {
/* 222 */ return this.mMovie.getTime();
/* */ }
/* */
/* */ public int getDuration()
/* */ throws StdQTException
/* */ {
/* 230 */ return this.mMovie.getDuration();
/* */ }
/* */
/* */ public TimeBase getTimeBase()
/* */ throws QTException
/* */ {
/* 238 */ return this.mMovie.getTimeBase();
/* */ }
/* */
/* */ public void setRate(float paramFloat)
/* */ throws StdQTException
/* */ {
/* 248 */ synchronized (this) {
/* 249 */ this.lastRate = paramFloat;
/* */ }
/* 251 */ if (paramFloat == 0.0F)
/* 252 */ this.mMovie.stop();
/* */ else
/* 254 */ this.mMovie.prePreroll(this.mMovie.getTime(), paramFloat, new PrerollCallback(paramFloat));
/* */ }
/* */
/* */ public synchronized void addDrawingListener(DrawingListener paramDrawingListener)
/* */ {
/* 297 */ if (this.listenerList == null) {
/* 298 */ this.listenerList = new Vector();
/* */ }
/* 300 */ if (this.listenerList.contains(paramDrawingListener)) {
/* 301 */ return;
/* */ }
/* 303 */ this.listenerList.addElement(paramDrawingListener);
/* */
/* 305 */ if (this.mComplete == null)
/* */ try {
/* 307 */ this.mComplete = new MovieComplete();
/* 308 */ this.mMovie.setDrawingCompleteProc(0, this.mComplete);
/* */ } catch (StdQTException localStdQTException) {
/* 310 */ this.mComplete = null;
/* */ }
/* */ }
/* */
/* */ public synchronized void removeDrawingListener(DrawingListener paramDrawingListener)
/* */ {
/* 319 */ if (this.listenerList != null) {
/* 320 */ this.listenerList.removeElement(paramDrawingListener);
/* */
/* 322 */ if (this.listenerList.isEmpty()) {
/* */ try {
/* 324 */ this.mMovie.removeDrawingCompleteProc(); } catch (StdQTException localStdQTException) {
/* */ }
/* 326 */ this.mComplete = null;
/* 327 */ this.listenerList = null;
/* */ }
/* */ }
/* */ }
/* */
/* */ public float getRate()
/* */ throws StdQTException
/* */ {
/* 336 */ return this.mMovie.getRate();
/* */ }
/* */
/* */ public int getScale()
/* */ throws QTException
/* */ {
/* 342 */ return this.mMovie.getTimeScale();
/* */ }
/* */
/* */ public float getVolume()
/* */ throws QTException
/* */ {
/* 349 */ float f = this.mMovie.getVolume();
/* 350 */ return Math.abs(f);
/* */ }
/* */
/* */ public void setVolume(float paramFloat)
/* */ throws QTException
/* */ {
/* 357 */ float f = Math.abs(paramFloat);
/* 358 */ if (isMuted())
/* 359 */ this.mMovie.setVolume(f * -1.0F);
/* */ else
/* 361 */ this.mMovie.setVolume(f);
/* */ }
/* */
/* */ public boolean isMuted()
/* */ throws QTException
/* */ {
/* 368 */ return this.mMovie.getVolume() < 0.0F;
/* */ }
/* */
/* */ public boolean isSingleFrame() {
/* 372 */ return false;
/* */ }
/* */
/* */ public void setMuted(boolean paramBoolean)
/* */ throws QTException
/* */ {
/* 381 */ float f = Math.abs(this.mMovie.getVolume());
/* 382 */ if (paramBoolean)
/* 383 */ this.mMovie.setVolume(f * -1.0F);
/* */ else
/* 385 */ this.mMovie.setVolume(f);
/* */ }
/* */
/* */ class MovieComplete
/* */ implements MovieDrawingComplete
/* */ {
/* */ MovieComplete()
/* */ {
/* */ }
/* */
/* */ public int execute(Movie paramMovie)
/* */ {
/* 285 */ synchronized (MoviePlayer.this) {
/* 286 */ for (int i = 0; i < MoviePlayer.this.listenerList.size(); i++)
/* 287 */ ((DrawingListener)MoviePlayer.this.listenerList.elementAt(i)).drawingComplete(MoviePlayer.this);
/* */ }
/* 289 */ return 0;
/* */ }
/* */ }
/* */
/* */ class PrerollCallback
/* */ implements MoviePrePreroll
/* */ {
/* */ private float r;
/* */
/* */ PrerollCallback(float arg2)
/* */ {
/* */ Object localObject;
/* 261 */ this.r = localObject;
/* */ }
/* */
/* */ public void execute(Movie paramMovie, int paramInt)
/* */ {
/* 266 */ synchronized (MoviePlayer.this) {
/* 267 */ if (MoviePlayer.this.lastRate == 0.0F) {
/* 268 */ return;
/* */ }
/* 270 */ if (paramInt == 0)
/* */ try {
/* 272 */ paramMovie.preroll(paramMovie.getTime(), this.r);
/* 273 */ paramMovie.setRate(this.r);
/* */ } catch (QTException localQTException) {
/* 275 */ QTRuntimeException.handleOrThrow(new QTRuntimeException(localQTException), paramMovie, "preroll");
/* */ }
/* */ else
/* 278 */ QTRuntimeException.handleOrThrow(new QTRuntimeException(paramInt), paramMovie, "prePreroll");
/* */ }
/* */ }
/* */ }
/* */ }
/* Location: Z:\System\Library\Java\Extensions\QTJava.zip
* Qualified Name: quicktime.app.view.MoviePlayer
* JD-Core Version: 0.6.2
*/