Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | Related Pages

video.h

00001 /*
00002   libwftk - Worldforge Toolkit - a widget library
00003   Copyright (C) 2002 Malcolm Walker <malcolm@worldforge.org>
00004   Based on code copyright  (C) 1999-2002  Karsten Laux 
00005 
00006   This library is free software; you can redistribute it and/or
00007   modify it under the terms of the GNU Lesser General Public
00008   License as published by the Free Software Foundation; either
00009   version 2.1 of the License, or (at your option) any later version.
00010   
00011   This library is distributed in the hope that it will be useful,
00012   but WITHOUT ANY WARRANTY; without even the implied warranty of
00013   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014   Lesser General Public License for more details.
00015   
00016   You should have received a copy of the GNU Lesser General Public
00017   License along with this library; if not, write to the
00018   Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00019   Boston, MA  02111-1307, SA.
00020 */
00021 
00022 // writtten May 1999
00023 
00024 
00025 
00026 #ifndef _VIDEO_H
00027 #define _VIDEO_H
00028 
00029 #include <wftk/sound.h>
00030 #include <wftk/point.h>
00031 #include <wftk/region.h>
00032 #include <wftk/mutex.h>
00033 #include <wftk/surface.h>
00034 
00035 #include <string>
00036 #include <map>
00037 
00038 namespace wftk {
00039 
00040 class ScreenSurface;
00041 
00043 class Video : public Sound, public Surface
00044 {
00045  public:
00046 
00048   Video(const Point& screen_loc = Point(0, 0), ScreenSurface* screen = 0);
00050   ~Video();
00051 
00052   // Don't call any of these three when screen_->mutex is locked
00053   // (i.e., in any draw() or drawAfter() widget function)
00054 
00056   void setMask(const Region& r);
00058   void clearMask();
00060   void move(const Point&);
00061 
00063   virtual bool load(const std::string& file) {return load(file, 1);}
00065   virtual bool load(const std::string&, double scale);  
00067   virtual bool play(int loops = 0) const;
00068 
00070   virtual int setVolume(int vol);  
00072   virtual void stop() const;
00074   virtual bool playing() const;
00076   virtual bool paused() const {return paused_;}
00078   virtual void pause();
00080   virtual void rewind() const; 
00082   virtual void resume();
00083 
00084  private:
00086   static void screenUpdate(SDL_Surface* surf, int x, int y, unsigned w, unsigned h);
00088   void update(const Rect&);
00089 
00091   typedef std::map<SDL_Surface*,Video*> SurfaceMap;
00093   static SurfaceMap map_;
00095   static Mutex map_mutex_;
00096 
00098   Mutex mutex_;
00100   bool use_mask_;
00102   Region mask_;
00104   Point loc_;
00105 
00107   ScreenSurface* screen_;
00108 
00110   void* mpeg; // SMPEG*
00112   bool paused_;
00113 };
00114 
00115 } // namespace
00116 
00117 #endif

Generated Fri Mar 5 08:11:00 2004.
Copyright © 1998-2003 by the respective authors.

This document is licensed under the terms of the GNU Free Documentation License and may be freely distributed under the conditions given by this license.