summaryrefslogtreecommitdiffstats
path: root/src/videopreview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/videopreview.cpp')
-rw-r--r--src/videopreview.cpp72
1 files changed, 36 insertions, 36 deletions
diff --git a/src/videopreview.cpp b/src/videopreview.cpp
index bf779e6..26e9055 100644
--- a/src/videopreview.cpp
+++ b/src/videopreview.cpp
@@ -20,24 +20,24 @@
#include "videopreview.h"
-#include <qfile.h>
-#include <qpixmap.h>
-#include <qimage.h>
+#include <ntqfile.h>
+#include <ntqpixmap.h>
+#include <ntqimage.h>
#include <kstandarddirs.h>
#include <kpixmapsplitter.h>
#include <kmimetype.h>
-#include <qpainter.h>
+#include <ntqpainter.h>
#include <krandomsequence.h>
-#include <qdatetime.h>
-#include <qregexp.h>
+#include <ntqdatetime.h>
+#include <ntqregexp.h>
#include "videopreview.h"
-#include <qprocess.h>
+#include <ntqprocess.h>
#include <kdebug.h>
#include <ktempdir.h>
#include <kurl.h>
#include <math.h>
-#include <qfileinfo.h>
+#include <ntqfileinfo.h>
#include "mplayerthumbs.h"
@@ -66,10 +66,10 @@ VideoPreview::~VideoPreview()
delete mplayerprocess;
}
-bool VideoPreview::create(const QString &path, int width, int height, QImage &img)
+bool VideoPreview::create(const TQString &path, int width, int height, TQImage &img)
{
MPlayerThumbsCfg *cfg=new MPlayerThumbsCfg();
- QFileInfo fi(path);
+ TQFileInfo fi(path);
kdDebug() << "videopreview: file extension=\"" << fi.extension().stripWhiteSpace() << "\"\n";
if( fi.extension().stripWhiteSpace().length() && !cfg->noextensions().grep(fi.extension().stripWhiteSpace(), false)
.isEmpty() )
@@ -79,7 +79,7 @@ bool VideoPreview::create(const QString &path, int width, int height, QImage &im
return false;
}
playerBin=cfg->mplayerbin();
- customargs=QStringList::split(" ", cfg->customargs() );
+ customargs=TQStringList::split(" ", cfg->customargs() );
kdDebug() << "videopreview: customargs=" << cfg->customargs() << " ;;;; " << customargs << endl;
delete cfg;
if(playerBin.length()) kdDebug() << "videopreview: found playerbin from config: " << playerBin << endl;
@@ -99,26 +99,26 @@ bool VideoPreview::create(const QString &path, int width, int height, QImage &im
tmpdir=new KTempDir();
if(tmpdir->name().isNull() ) return false;
- rand=new KRandomSequence(QDateTime::currentDateTime().toTime_t());
- mplayerprocess=new QProcess();
+ rand=new KRandomSequence(TQDateTime::currentDateTime().toTime_t());
+ mplayerprocess=new TQProcess();
int flags=0;
KURL furl(path);
kdDebug() << "videopreview: url=" << furl << "; local:" << furl.isLocalFile() << endl;
fileinfo.towidth=width;
fileinfo.toheight=height;
- QPixmap pix;
+ TQPixmap pix;
// if(furl.isLocalFile())
// {
flags=framerandom;
- QStringList args;
+ TQStringList args;
args << playerBin << path << "-nocache" << "-identify" << "-vo" << "null" << "-frames" << "0"/* << "-nosound" */<< "-ao" << "null";
args+= customargs;
mplayerprocess->setArguments(args);
- mplayerprocess->setCommunication( QProcess::Stdout );
+ mplayerprocess->setCommunication( TQProcess::Stdout );
mplayerprocess->start();
- QString lineout;
- QRegExp findsecs("^ID_LENGTH=([\\d]*)");
- QRegExp findfps("^ID_VIDEO_FPS=([\\d]*)");
+ TQString lineout;
+ TQRegExp findsecs("^ID_LENGTH=([\\d]*)");
+ TQRegExp findfps("^ID_VIDEO_FPS=([\\d]*)");
while (mplayerprocess->isRunning() ) usleep (10);
do {
lineout=mplayerprocess->readLineStdout();
@@ -127,7 +127,7 @@ bool VideoPreview::create(const QString &path, int width, int height, QImage &im
if(findfps.search( lineout) != -1)
fileinfo.fps=findfps.cap(1).toInt();
if( fileinfo.fps!=0 && fileinfo.seconds!=0 ) break;
- } while (lineout != QString::null );
+ } while (lineout != TQString::null );
kdDebug() << "videopreview: find length=" << fileinfo.seconds << ", fps=" << fileinfo.fps << endl;
/* } else
{
@@ -140,7 +140,7 @@ bool VideoPreview::create(const QString &path, int width, int height, QImage &im
pix=getFrame(path, ((i<LASTTRY) ? flags : framestart ) );
if(!pix.isNull()) {
uint variance=imageVariance(pix.convertToImage()/*.bits(),( (width+ 7) & ~0x7), width, height, 1 */);
- kdDebug() << "videopreview: " << QFileInfo(path).fileName() << " frame variance: " << variance << "; " <<
+ kdDebug() << "videopreview: " << TQFileInfo(path).fileName() << " frame variance: " << variance << "; " <<
((variance<=40 && ( i!=LASTTRY-1))? "!!!DROPPING!!!" : "GOOD :-)" ) << endl;
if(variance>40 || i==LASTTRY-1 ) break;
}
@@ -154,17 +154,17 @@ bool VideoPreview::create(const QString &path, int width, int height, QImage &im
Copyright (C) 2002 Simon MacMullen
Copyright (C) 2003 Ewald Snel <[email protected]>
* */
-// QPixmap pix( createThumbnail( &frame, width, height ) );
+// TQPixmap pix( createThumbnail( &frame, width, height ) );
#ifdef STRIPS_SUPPORT
- QPainter painter( &pix );
- QPixmap sprocket;
+ TQPainter painter( &pix );
+ TQPixmap sprocket;
if (pix.height() < 60)
- sprocket = QPixmap(locate( "data", "videothumbnail/sprocket-small.png" ));
+ sprocket = TQPixmap(locate( "data", "videothumbnail/sprocket-small.png" ));
else if (pix.height() < 90)
- sprocket = QPixmap(locate( "data", "videothumbnail/sprocket-medium.png" ));
+ sprocket = TQPixmap(locate( "data", "videothumbnail/sprocket-medium.png" ));
else
- sprocket = QPixmap(locate( "data", "videothumbnail/sprocket-large.png" ));
+ sprocket = TQPixmap(locate( "data", "videothumbnail/sprocket-large.png" ));
for (int y = 0; y < pix.height() + sprocket.height(); y += sprocket.height()) {
painter.drawPixmap( 0, y, sprocket );
@@ -178,9 +178,9 @@ bool VideoPreview::create(const QString &path, int width, int height, QImage &im
return true;
}
-QPixmap VideoPreview::getFrame(const QString &path, int flags)
+TQPixmap VideoPreview::getFrame(const TQString &path, int flags)
{
- QStringList args;
+ TQStringList args;
kdDebug() << "videopreview: using flags " << flags << endl;
#define START ((fileinfo.seconds*15)/100)
#define END ((fileinfo.seconds*70)/100)
@@ -196,22 +196,22 @@ QPixmap VideoPreview::getFrame(const QString &path, int flags)
{
kdDebug() << "videopreview: framerandom\n";
unsigned long start=(unsigned long)(START+(rand->getDouble() * (END - START) ) );
- args << "-ss" << QString::number( start )
+ args << "-ss" << TQString::number( start )
<< "-frames" << "4";
} else if (flags & frameend )
{
kdDebug() << "videopreview: frameend\n";
- args << "-ss" << QString::number( fileinfo.seconds - 10 )
+ args << "-ss" << TQString::number( fileinfo.seconds - 10 )
<< "-frames" << "4";
} else if (flags & framestart)
{
kdDebug() << "videopreview: framestart\n";
if(!fileinfo.fps) fileinfo.fps=25; // if we've not autodetected a fps rate, let's assume 25fps.. even if it's wrong it shouldn't hurt.
// If we can't skip to a random frame, let's try playing 10 seconds.
- args << "-frames" << QString::number( fileinfo.fps*10 );
+ args << "-frames" << TQString::number( fileinfo.fps*10 );
}
args << "-nocache" << "-idx" /*@TODO check if it's too slow..*/ << "-ao" << "null"/*"-nosound" << */<< "-speed" << "99" /*<< "-sstep" << "5"*/
- << "-vo" << QString("jpeg:outdir=%1").arg(tmpdir->name() ) << "-vf" << QString("scale=%1:%2").arg(fileinfo.towidth).arg(fileinfo.toheight);
+ << "-vo" << TQString("jpeg:outdir=%1").arg(tmpdir->name() ) << "-vf" << TQString("scale=%1:%2").arg(fileinfo.towidth).arg(fileinfo.toheight);
args+=customargs;
kdDebug() << "videopreview: Starting MPlayer with" << args.join( " ") << endl;
// return false;
@@ -220,9 +220,9 @@ QPixmap VideoPreview::getFrame(const QString &path, int flags)
while (mplayerprocess->isRunning() ) usleep (10);
if (tmpdir->qDir()->entryList( "*.jpg" ).isEmpty() ) return false;
- QString lastframe=tmpdir->qDir()->entryList( "*.jpg" ).last();
+ TQString lastframe=tmpdir->qDir()->entryList( "*.jpg" ).last();
kdDebug() << "videopreview: LastFrame==" << lastframe << endl;
- QPixmap retpix(tmpdir->name().append( lastframe ));
+ TQPixmap retpix(tmpdir->name().append( lastframe ));
return retpix;
}
@@ -232,7 +232,7 @@ ThumbCreator::Flags VideoPreview::flags() const
}
-uint VideoPreview::imageVariance(QImage image )
+uint VideoPreview::imageVariance(TQImage image )
{
uint delta=0;
uint avg=0;