summaryrefslogtreecommitdiff
path: root/core/multimedia
Side-by-side diff
Diffstat (limited to 'core/multimedia') (more/less context) (show whitespace changes)
-rw-r--r--core/multimedia/opieplayer/mediaplayerstate.cpp2
-rw-r--r--core/multimedia/opieplayer/playlistwidget.cpp2
-rw-r--r--core/multimedia/opieplayer/videowidget.cpp2
3 files changed, 3 insertions, 3 deletions
diff --git a/core/multimedia/opieplayer/mediaplayerstate.cpp b/core/multimedia/opieplayer/mediaplayerstate.cpp
index b700cd1..8b0fbbc 100644
--- a/core/multimedia/opieplayer/mediaplayerstate.cpp
+++ b/core/multimedia/opieplayer/mediaplayerstate.cpp
@@ -46,152 +46,152 @@ MediaPlayerState::MediaPlayerState( QObject *parent, const char *name )
: QObject( parent, name ), decoder( NULL ), libmpeg3decoder( NULL ) {
Config cfg( "OpiePlayer" );
readConfig( cfg );
loadPlugins();
}
MediaPlayerState::~MediaPlayerState() {
Config cfg( "OpiePlayer" );
writeConfig( cfg );
}
void MediaPlayerState::readConfig( Config& cfg ) {
cfg.setGroup("Options");
isFullscreen = cfg.readBoolEntry( "FullScreen" );
isScaled = cfg.readBoolEntry( "Scaling" );
isLooping = cfg.readBoolEntry( "Looping" );
isShuffled = cfg.readBoolEntry( "Shuffle" );
usePlaylist = cfg.readBoolEntry( "UsePlayList" );
usePlaylist = TRUE;
isPlaying = FALSE;
isPaused = FALSE;
curPosition = 0;
curLength = 0;
curView = 'l';
}
void MediaPlayerState::writeConfig( Config& cfg ) const {
cfg.setGroup("Options");
cfg.writeEntry("FullScreen", isFullscreen );
cfg.writeEntry("Scaling", isScaled );
cfg.writeEntry("Looping", isLooping );
cfg.writeEntry("Shuffle", isShuffled );
cfg.writeEntry("UsePlayList", usePlaylist );
}
struct MediaPlayerPlugin {
#ifndef QT_NO_COMPONENT
QLibrary *library;
#endif
MediaPlayerPluginInterface *iface;
MediaPlayerDecoder *decoder;
MediaPlayerEncoder *encoder;
};
static QValueList<MediaPlayerPlugin> pluginList;
// Find the first decoder which supports this type of file
MediaPlayerDecoder *MediaPlayerState::newDecoder( const QString& file ) {
MediaPlayerDecoder *tmpDecoder = NULL;
QValueList<MediaPlayerPlugin>::Iterator it;
for ( it = pluginList.begin(); it != pluginList.end(); ++it ) {
if ( (*it).decoder->isFileSupported( file ) ) {
tmpDecoder = (*it).decoder;
break;
}
}
if(file.left(4)=="http")
isStreaming = TRUE;
else
isStreaming = FALSE;
return decoder = tmpDecoder;
}
MediaPlayerDecoder *MediaPlayerState::curDecoder() {
return decoder;
}
// ### hack to get true sample count
MediaPlayerDecoder *MediaPlayerState::libMpeg3Decoder() {
return libmpeg3decoder;
}
// ### hack to get true sample count
// MediaPlayerDecoder *MediaPlayerState::libWavDecoder() {
// return libwavdecoder;
// }
void MediaPlayerState::loadPlugins() {
// odebug << "load plugins" << oendl;
#ifndef QT_NO_COMPONENT
QValueList<MediaPlayerPlugin>::Iterator mit;
for ( mit = pluginList.begin(); mit != pluginList.end(); ++mit ) {
(*mit).iface->release();
(*mit).library->unload();
delete (*mit).library;
}
pluginList.clear();
- QString path = QPEApplication::qpeDir() + "/plugins/codecs";
+ QString path = QPEApplication::qpeDir() + "plugins/codecs";
QDir dir( path, "lib*.so" );
QStringList list = dir.entryList();
QStringList::Iterator it;
for ( it = list.begin(); it != list.end(); ++it ) {
MediaPlayerPluginInterface *iface = 0;
QLibrary *lib = new QLibrary( path + "/" + *it );
// odebug << "querying: " << QString( path + "/" + *it ) << "" << oendl;
if ( lib->queryInterface( IID_MediaPlayerPlugin, (QUnknownInterface**)&iface ) == QS_OK ) {
// odebug << "loading: " << QString( path + "/" + *it ) << "" << oendl;
MediaPlayerPlugin plugin;
plugin.library = lib;
plugin.iface = iface;
plugin.decoder = plugin.iface->decoder();
plugin.encoder = plugin.iface->encoder();
pluginList.append( plugin );
// ### hack to get true sample count
if ( plugin.decoder->pluginName() == QString("LibMpeg3Plugin") )
libmpeg3decoder = plugin.decoder;
} else {
delete lib;
}
}
#else
pluginList.clear();
MediaPlayerPlugin plugin0;
plugin0.iface = new LibMpeg3PluginImpl;
plugin0.decoder = plugin0.iface->decoder();
plugin0.encoder = plugin0.iface->encoder();
pluginList.append( plugin0 );
MediaPlayerPlugin plugin1;
plugin1.iface = new LibMadPluginImpl;
plugin1.decoder = plugin1.iface->decoder();
plugin1.encoder = plugin1.iface->encoder();
pluginList.append( plugin1 );
MediaPlayerPlugin plugin2;
plugin2.iface = new WavPluginImpl;
plugin2.decoder = plugin2.iface->decoder();
plugin2.encoder = plugin2.iface->encoder();
pluginList.append( plugin2 );
#endif
if ( pluginList.count() )
MediaPlayerDebug(( "%i decoders found", pluginList.count() ));
else
MediaPlayerDebug(( "No decoders found" ));
}
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp
index 46aeff2..db2bf1b 100644
--- a/core/multimedia/opieplayer/playlistwidget.cpp
+++ b/core/multimedia/opieplayer/playlistwidget.cpp
@@ -1289,171 +1289,171 @@ void PlayListWidget::keyReleaseEvent( QKeyEvent *e)
case Key_Q: //add to playlist
addSelected();
break;
case Key_R: //remove from playlist
removeSelected();
break;
// case Key_P: //play
// odebug << "Play" << oendl;
// playSelected();
// break;
case Key_Space:
// playSelected(); puh
break;
case Key_1:
tabWidget->setCurrentPage(0);
break;
case Key_2:
tabWidget->setCurrentPage(1);
break;
case Key_3:
tabWidget->setCurrentPage(2);
break;
case Key_4:
tabWidget->setCurrentPage(3);
break;
case Key_Down:
if ( !d->selectedFiles->next() )
d->selectedFiles->first();
break;
case Key_Up:
if ( !d->selectedFiles->prev() )
// d->selectedFiles->last();
break;
}
}
void PlayListWidget::keyPressEvent( QKeyEvent *)
{
// odebug << "Key press" << oendl;
// switch ( e->key() ) {
// ////////////////////////////// Zaurus keys
// case Key_A: //add to playlist
// odebug << "Add" << oendl;
// addSelected();
// break;
// case Key_R: //remove from playlist
// removeSelected();
// break;
// case Key_P: //play
// odebug << "Play" << oendl;
// playSelected();
// break;
// case Key_Space:
// odebug << "Play" << oendl;
// playSelected();
// break;
// }
}
void PlayListWidget::doBlank() {
// odebug << "do blanking" << oendl;
#ifdef QT_QWS_DEVFS
fd=open("/dev/fb/0",O_RDWR);
#else
fd=open("/dev/fb0",O_RDWR);
#endif
if (fd != -1) {
ioctl(fd,FBIOBLANK,1);
// close(fd);
}
}
void PlayListWidget::doUnblank() {
// this crashes opieplayer with a segfault
// int fd;
// fd=open("/dev/fb0",O_RDWR);
// odebug << "do unblanking" << oendl;
if (fd != -1) {
ioctl(fd,FBIOBLANK,0);
close(fd);
}
QCopEnvelope h("QPE/System", "setBacklight(int)");
h <<-3;// v[1]; // -3 Force on
}
void PlayListWidget::populateSkinsMenu() {
int item = 0;
defaultSkinIndex = 0;
QString skinName;
Config cfg( "OpiePlayer" );
cfg.setGroup("Options" );
QString skin = cfg.readEntry( "Skin", "default" );
- QDir skinsDir( QPEApplication::qpeDir() + "/pics/opieplayer2/skins" );
+ QDir skinsDir( QPEApplication::qpeDir() + "pics/opieplayer2/skins" );
skinsDir.setFilter( QDir::Dirs );
skinsDir.setSorting(QDir::Name );
const QFileInfoList *skinslist = skinsDir.entryInfoList();
QFileInfoListIterator it( *skinslist );
QFileInfo *fi;
while ( ( fi = it.current() ) ) {
skinName = fi->fileName();
// odebug << fi->fileName() << oendl;
if( skinName != "." && skinName != ".." && skinName !="CVS" ) {
item = skinsMenu->insertItem( fi->fileName() ) ;
}
if( skinName == "default" ) {
defaultSkinIndex = item;
}
if( skinName == skin ) {
skinsMenu->setItemChecked( item, TRUE );
}
++it;
}
}
void PlayListWidget::skinsMenuActivated( int item ) {
for( int i = defaultSkinIndex; i > defaultSkinIndex - static_cast<int>(skinsMenu->count()); i-- ) {
skinsMenu->setItemChecked( i, FALSE );
}
skinsMenu->setItemChecked( item, TRUE );
Config cfg( "OpiePlayer" );
cfg.setGroup("Options");
cfg.writeEntry("Skin", skinsMenu->text( item ) );
}
void PlayListWidget::qcopReceive(const QCString &msg, const QByteArray &data) {
// odebug << "qcop message "+msg << oendl;
QDataStream stream ( data, IO_ReadOnly );
if ( msg == "play()" ) { //plays current selection
btnPlay( true);
} else if ( msg == "stop()" ) {
mediaPlayerState->setPlaying( false);
} else if ( msg == "togglePause()" ) {
mediaPlayerState->togglePaused();
} else if ( msg == "next()" ) { //select next in lis
mediaPlayerState->setNext();
} else if ( msg == "prev()" ) { //select previous in list
mediaPlayerState->setPrev();
} else if ( msg == "toggleLooping()" ) { //loop or not loop
mediaPlayerState->toggleLooping();
} else if ( msg == "toggleShuffled()" ) { //shuffled or not shuffled
mediaPlayerState->toggleShuffled();
} else if ( msg == "volUp()" ) { //volume more
// emit moreClicked();
// emit moreReleased();
} else if ( msg == "volDown()" ) { //volume less
// emit lessClicked();
// emit lessReleased();
} else if ( msg == "play(QString)" ) { //play this now
QString file;
stream >> file;
setDocumentEx( (const QString &) file);
} else if ( msg == "add(QString)" ) { //add to playlist
QString file;
stream >> file;
QFileInfo fileInfo(file);
DocLnk lnk;
lnk.setName( fileInfo.baseName() ); //sets name
lnk.setFile( file ); //sets file name
addToSelection( lnk );
} else if ( msg == "rem(QString)" ) { //remove from playlist
QString file;
stream >> file;
} else if ( msg == "setDocument(QString)" ) { //loop or not loop
QCopEnvelope h("QPE/Application/opieplayer", "raise()");
}
}
diff --git a/core/multimedia/opieplayer/videowidget.cpp b/core/multimedia/opieplayer/videowidget.cpp
index 2396ed5..c545511 100644
--- a/core/multimedia/opieplayer/videowidget.cpp
+++ b/core/multimedia/opieplayer/videowidget.cpp
@@ -5,193 +5,193 @@
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include "videowidget.h"
#include "mediaplayerstate.h"
/* OPIE */
#include <qpe/resource.h>
#include <qpe/mediaplayerplugininterface.h>
#include <qpe/config.h>
#include <qpe/qpeapplication.h>
#include <opie2/odebug.h>
/* QT */
#include <qdir.h>
#include <qslider.h>
#ifdef Q_WS_QWS
# define USE_DIRECT_PAINTER
# include <qdirectpainter_qws.h>
# include <qgfxraster_qws.h>
#endif
extern MediaPlayerState *mediaPlayerState;
static const int xo = 2; // movable x offset
static const int yo = 0; // movable y offset
struct MediaButton {
// int xPos, yPos;
bool isToggle, isHeld, isDown;
// int controlType;
};
// Layout information for the videoButtons (and if it is a toggle button or not)
MediaButton videoButtons[] = {
{ FALSE, FALSE, FALSE }, // stop
{ FALSE, FALSE, FALSE }, // play
{ FALSE, FALSE, FALSE }, // previous
{ FALSE, FALSE, FALSE }, // next
{ FALSE, FALSE, FALSE }, // volUp
{ FALSE, FALSE, FALSE }, // volDown
{ TRUE, FALSE, FALSE } // fullscreen
};
//static const int numButtons = (sizeof(videoButtons)/sizeof(MediaButton));
const char *skinV_mask_file_names[7] = {
"stop","play","back","fwd","up","down","full"
};
static const int numVButtons = (sizeof(videoButtons)/sizeof(MediaButton));
VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) :
QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 )
{
setCaption( tr("OpiePlayer") );
Config cfg("OpiePlayer");
cfg.setGroup("Options");
skin = cfg.readEntry("Skin","default");
QString skinPath;
skinPath = "opieplayer2/skins/" + skin;
if(!QDir(QString(getenv("OPIEDIR")) +"/pics/"+skinPath).exists())
skinPath = "opieplayer2/skins/default";
// QString skinPath = "opieplayer2/skins/" + skin;
pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) );
imgUp = new QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) );
imgDn = new QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) );
imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 );
imgButtonMask->fill( 0 );
for ( int i = 0; i < 7; i++ ) {
- QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath +
+ QString filename = QString( QPEApplication::qpeDir() + "pics/" + skinPath +
"/skinV_mask_" + skinV_mask_file_names[i] + ".png" );
// odebug << "loading "+filename << oendl;
masks[i] = new QBitmap( filename );
if ( !masks[i]->isNull() ) {
QImage imgMask = masks[i]->convertToImage();
uchar **dest = imgButtonMask->jumpTable();
for ( int y = 0; y < imgUp->height(); y++ ) {
uchar *line = dest[y];
for ( int x = 0; x < imgUp->width(); x++ ) {
if ( !qRed( imgMask.pixel( x, y ) ) )
line[x] = i + 1;
}
}
}
}
for ( int i = 0; i < 7; i++ ) {
buttonPixUp[i] = NULL;
buttonPixDown[i] = NULL;
}
QWidget *d = QApplication::desktop();
int width = d->width();
int height = d->height();
if( (width != pixBg->width() ) || (height != pixBg->height() ) ) {
QImage img;
img = pixBg->convertToImage();
pixBg->convertFromImage( img.smoothScale( width, height));
}
setBackgroundPixmap( *pixBg );
currentFrame = new QImage( 220 + 2, 160, (QPixmap::defaultDepth() == 16) ? 16 : 32 );
slider = new QSlider( Qt::Horizontal, this );
slider->setMinValue( 0 );
slider->setMaxValue( 1 );
slider->setBackgroundPixmap( *pixBg );
slider->setFocusPolicy( QWidget::NoFocus );
// slider->setGeometry( QRect( 7, 250, 220, 20 ) );
connect(slider,SIGNAL(sliderPressed()),this,SLOT(sliderPressed()));
connect(slider,SIGNAL(sliderReleased()),this,SLOT(sliderReleased()));
connect(mediaPlayerState,SIGNAL(lengthChanged(long)),this,SLOT(setLength(long)));
connect(mediaPlayerState,SIGNAL(positionChanged(long)),this,SLOT(setPosition(long)));
connect(mediaPlayerState,SIGNAL(positionUpdated(long)),this,SLOT(setPosition(long)));
connect(mediaPlayerState,SIGNAL(viewChanged(char)),this,SLOT(setView(char)));
// connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) );
connect(mediaPlayerState,SIGNAL(playingToggled(bool)),this,SLOT(setPlaying(bool)));
// Intialise state
setLength( mediaPlayerState->length() );
setPosition( mediaPlayerState->position() );
setFullscreen( mediaPlayerState->fullscreen() );
// setPlaying( mediaPlayerState->playing() );
// if(this->x() < 0 || this->y() < 0)
// this->move(0,0);
}
VideoWidget::~VideoWidget() {
for ( int i = 0; i < 7; i++ )
{
delete buttonPixUp[i];
delete buttonPixDown[i];
}
delete pixBg;
delete imgUp;
delete imgDn;
delete imgButtonMask;
for ( int i = 0; i < 7; i++ )
{
delete masks[i];
}
// for ( int i = 0; i < 3; i++ )
// delete pixmaps[i];
// delete currentFrame;
}
static bool videoSliderBeingMoved = FALSE;
QPixmap *combineVImageWithBackground( QImage img, QPixmap bg, QPoint offset ) {
QPixmap pix( img.width(), img.height() );
QPainter p( &pix );
p.drawTiledPixmap( pix.rect(), bg, offset );
p.drawImage( 0, 0, img );
return new QPixmap( pix );
}
QPixmap *maskVPixToMask( QPixmap pix, QBitmap mask ) {
QPixmap *pixmap = new QPixmap( pix );