File indexing completed on 2024-04-14 15:00:58
0001 /* This file is part of the KDE project 0002 * 0003 * Copyright (C) 2006-2007 Koos Vriezen <koos.vriezen@gmail.com> 0004 * 0005 * This library is free software; you can redistribute it and/or 0006 * modify it under the terms of the GNU Library General Public 0007 * License as published by the Free Software Foundation; either 0008 * version 2 of the License, or (at your option) any later version. 0009 * 0010 * This library is distributed in the hope that it will be useful, 0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0013 * Library General Public License for more details. 0014 * 0015 * You should have received a copy of the GNU Library General Public License 0016 * along with this library; see the file COPYING.LIB. If not, write to 0017 * the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, 0018 * Boston, MA 02110-1301, USA. 0019 */ 0020 0021 #ifndef _KMPLAYER_RP_H_ 0022 #define _KMPLAYER_RP_H_ 0023 0024 #include <qobject.h> 0025 #include <qstring.h> 0026 0027 #include "kmplayerplaylist.h" 0028 #include "surface.h" 0029 0030 namespace KMPlayer { 0031 0032 /** 0033 * RealPix support classes 0034 */ 0035 namespace RP { 0036 0037 const short id_node_imfl = 150; 0038 const short id_node_head = 151; 0039 const short id_node_image = 152; 0040 const short id_node_crossfade = 153; 0041 const short id_node_fill = 154; 0042 const short id_node_wipe = 155; 0043 const short id_node_fadein = 156; 0044 const short id_node_fadeout = 157; 0045 const short id_node_viewchange = 158; 0046 const short id_node_animate = 159; 0047 const short id_node_first = id_node_imfl; 0048 const short id_node_last = 160; 0049 0050 class KMPLAYER_NO_EXPORT Imfl : public Mrl { 0051 public: 0052 Imfl (NodePtr & d); 0053 ~Imfl (); 0054 KDE_NO_EXPORT virtual const char * nodeName () const { return "imfl"; } 0055 virtual Node *childFromTag (const QString & tag); 0056 virtual void closed (); 0057 virtual void defer (); // start loading the images if not yet done 0058 virtual void activate (); // start timings, handle paint events 0059 virtual void finish (); // end the timings 0060 virtual void deactivate (); // stop handling paint events 0061 KDE_NO_EXPORT virtual PlayType playType () { return play_type_image; } 0062 virtual void message (MessageType msg, void *content=NULL); 0063 virtual void accept (Visitor *); 0064 Surface *surface (); 0065 void repaint (); // called whenever something changes on image 0066 Fit fit; // how to layout images 0067 unsigned int duration; // cached attributes of head 0068 Posting *duration_timer; 0069 SurfacePtrW rp_surface; 0070 int needs_scene_img; 0071 }; 0072 0073 class KMPLAYER_NO_EXPORT TimingsBase : public Element { 0074 public: 0075 TimingsBase (NodePtr & d, const short id); 0076 KDE_NO_CDTOR_EXPORT ~TimingsBase () {} 0077 virtual void activate (); // start the 'start_timer' 0078 virtual void begin (); // start_timer has expired 0079 virtual void finish (); // ?duration_timer has expired? 0080 virtual void deactivate (); // disabled 0081 virtual void message (MessageType msg, void *content=NULL); 0082 int progress; 0083 Single x, y, w, h; 0084 Single srcx, srcy, srcw, srch; 0085 NodePtrW target; 0086 protected: 0087 void update (int percentage); 0088 void cancelTimers (); 0089 unsigned int start, duration; 0090 int steps, curr_step; 0091 Posting *start_timer; 0092 Posting *duration_timer; 0093 Posting *update_timer; 0094 ConnectionLink document_postponed; 0095 }; 0096 0097 class KMPLAYER_NO_EXPORT Crossfade : public TimingsBase { 0098 public: 0099 KDE_NO_CDTOR_EXPORT Crossfade (NodePtr & d) 0100 : TimingsBase (d, id_node_crossfade) {} 0101 KDE_NO_CDTOR_EXPORT ~Crossfade () {} 0102 KDE_NO_EXPORT virtual const char * nodeName () const { return "crossfade"; } 0103 virtual void activate (); 0104 virtual void begin (); 0105 virtual void accept (Visitor *); 0106 }; 0107 0108 class KMPLAYER_NO_EXPORT Fadein : public TimingsBase { 0109 public: 0110 KDE_NO_CDTOR_EXPORT Fadein (NodePtr & d) : TimingsBase(d, id_node_fadein) {} 0111 KDE_NO_CDTOR_EXPORT ~Fadein () {} 0112 KDE_NO_EXPORT virtual const char * nodeName () const { return "fadein"; } 0113 virtual void activate (); 0114 virtual void begin (); 0115 virtual void accept (Visitor *); 0116 unsigned int from_color; 0117 }; 0118 0119 class KMPLAYER_NO_EXPORT Fadeout : public TimingsBase { 0120 public: 0121 KDE_NO_CDTOR_EXPORT Fadeout(NodePtr &d) : TimingsBase(d, id_node_fadeout) {} 0122 KDE_NO_CDTOR_EXPORT ~Fadeout () {} 0123 KDE_NO_EXPORT virtual const char * nodeName () const { return "fadeout"; } 0124 virtual void activate (); 0125 virtual void begin (); 0126 virtual void accept (Visitor *); 0127 unsigned int to_color; 0128 }; 0129 0130 class KMPLAYER_NO_EXPORT Fill : public TimingsBase { 0131 public: 0132 KDE_NO_CDTOR_EXPORT Fill (NodePtr & d) : TimingsBase (d, id_node_fill) {} 0133 KDE_NO_CDTOR_EXPORT ~Fill () {} 0134 KDE_NO_EXPORT virtual const char * nodeName () const { return "fill"; } 0135 virtual void activate (); 0136 virtual void begin (); 0137 unsigned int fillColor () const { return color; } 0138 virtual void accept (Visitor *); 0139 unsigned int color; 0140 }; 0141 0142 class KMPLAYER_NO_EXPORT Wipe : public TimingsBase { 0143 public: 0144 KDE_NO_CDTOR_EXPORT Wipe (NodePtr & d) : TimingsBase (d, id_node_wipe) {} 0145 KDE_NO_CDTOR_EXPORT ~Wipe () {} 0146 KDE_NO_EXPORT virtual const char * nodeName () const { return "wipe"; } 0147 virtual void activate (); 0148 virtual void begin (); 0149 virtual void accept (Visitor *); 0150 enum { dir_right, dir_left, dir_up, dir_down } direction; 0151 }; 0152 0153 class KMPLAYER_NO_EXPORT ViewChange : public TimingsBase { 0154 public: 0155 KDE_NO_CDTOR_EXPORT ViewChange (NodePtr & d) 0156 : TimingsBase (d, id_node_viewchange) {} 0157 KDE_NO_CDTOR_EXPORT ~ViewChange () {} 0158 KDE_NO_EXPORT virtual const char * nodeName() const { return "viewchange"; } 0159 virtual void activate (); 0160 virtual void begin (); 0161 virtual void finish (); 0162 virtual void accept (Visitor *); 0163 }; 0164 0165 class KMPLAYER_NO_EXPORT Image : public Mrl { 0166 PostponePtr postpone_lock; 0167 public: 0168 Image (NodePtr & d); 0169 ~Image (); 0170 KDE_NO_EXPORT virtual const char * nodeName () const { return "image"; } 0171 virtual void activate (); 0172 virtual void begin (); 0173 virtual void deactivate (); 0174 virtual void closed (); 0175 virtual void message (MessageType msg, void *content=NULL); 0176 bool isReady (bool postpone_if_not = false); // is downloading ready 0177 Surface *surface (); 0178 SurfacePtrW img_surface; 0179 protected: 0180 void dataArrived (); 0181 }; 0182 0183 } // RP namespace 0184 0185 } // KMPlayer namespace 0186 0187 #endif //_KMPLAYER_RP_H_ 0188