| 1 |
/* dvbcut |
| 2 |
Copyright (c) 2005 Sven Over <[email protected]> |
| 3 |
|
| 4 |
This program is free software; you can redistribute it and/or modify |
| 5 |
it under the terms of the GNU General Public License as published by |
| 6 |
the Free Software Foundation; either version 2 of the License, or |
| 7 |
(at your option) any later version. |
| 8 |
|
| 9 |
This program is distributed in the hope that it will be useful, |
| 10 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 |
GNU General Public License for more details. |
| 13 |
|
| 14 |
You should have received a copy of the GNU General Public License |
| 15 |
along with this program; if not, write to the Free Software |
| 16 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 17 |
*/ |
| 18 |
|
| 19 |
/* $Id$ */ |
| 20 |
|
| 21 |
#ifndef _DVBCUT_IMAGEPROVIDER_H |
| 22 |
#define _DVBCUT_IMAGEPROVIDER_H |
| 23 |
|
| 24 |
#include <utility> |
| 25 |
#include <qimage.h> |
| 26 |
class mpgfile; |
| 27 |
class busyindicator; |
| 28 |
|
| 29 |
#define IMAGEPROVIDER_STANDARD 1 |
| 30 |
#define IMAGEPROVIDER_UNSCALED 2 |
| 31 |
#define IMAGEPROVIDER_DIFFERENCE 3 |
| 32 |
#define IMAGEPROVIDER_DIFFERENCE_UNSCALED 4 |
| 33 |
|
| 34 |
/** |
| 35 |
@author Sven Over |
| 36 |
*/ |
| 37 |
class imageprovider |
| 38 |
{ |
| 39 |
protected: |
| 40 |
int RTTI; |
| 41 |
mpgfile &m; |
| 42 |
int maxcachedframes; |
| 43 |
double viewscalefactor; |
| 44 |
typedef std::pair<int,QImage> framecacheitem; |
| 45 |
std::list<framecacheitem> framecache; |
| 46 |
busyindicator *busyind; |
| 47 |
|
| 48 |
void shrinkcache(int free=0); |
| 49 |
virtual void decodepicture(int picture, bool decodeallgop=false); |
| 50 |
|
| 51 |
public: |
| 52 |
imageprovider(mpgfile &mpg, busyindicator *bi=0, bool unscaled=false, double factor=1.0, int cachesize=50); |
| 53 |
virtual ~imageprovider(); |
| 54 |
int rtti() const |
| 55 |
{ |
| 56 |
return RTTI; |
| 57 |
} |
| 58 |
QImage getimage(int picture, bool decodeallgop=false); |
| 59 |
void clearcache() |
| 60 |
{ |
| 61 |
framecache.clear(); |
| 62 |
} |
| 63 |
void setviewscalefactor(double factor) |
| 64 |
{ |
| 65 |
if (factor<=0.0) factor=1.0; |
| 66 |
if (factor==viewscalefactor) return; |
| 67 |
clearcache(); |
| 68 |
viewscalefactor=factor; |
| 69 |
} |
| 70 |
|
| 71 |
}; |
| 72 |
|
| 73 |
#endif |