30 files changed, 999 insertions, 237 deletions
diff --git a/noncore/multimedia/mediaplayerskins/opie-mediaplayer2-skin-Pod.control b/noncore/multimedia/mediaplayerskins/opie-mediaplayer2-skin-Pod.control index 2de15e9..faa041b 100644 --- a/noncore/multimedia/mediaplayerskins/opie-mediaplayer2-skin-Pod.control +++ b/noncore/multimedia/mediaplayerskins/opie-mediaplayer2-skin-Pod.control @@ -1,8 +1,8 @@ Package: opie-mediaplayer2-skin-Pod Files: pics/mediaplayer/skins/Pod Priority: optional Section: opie/applications Maintainer: ljp <llornkcor@handhelds.org> -Version: $QPE_VERSION-$SUB_VERSION Description: Opie Mediaplayer's skin. +Version: $QPE_VERSION$EXTRAVERSION diff --git a/noncore/multimedia/mediaplayerskins/opie-mediaplayer2-skin-default-landscape.control b/noncore/multimedia/mediaplayerskins/opie-mediaplayer2-skin-default-landscape.control index 570b25a..4bc3c60 100644 --- a/noncore/multimedia/mediaplayerskins/opie-mediaplayer2-skin-default-landscape.control +++ b/noncore/multimedia/mediaplayerskins/opie-mediaplayer2-skin-default-landscape.control @@ -1,9 +1,9 @@ Package: opie-mediaplayer2-skin-default-landscape Files: pics/opieplayer2/skins/default_landscape Priority: optional Section: opie/playerskins Maintainer: L.J.Potter <ljp@llornkcor.com> Architecture: arm -Version: $QPE_VERSION-$SUB_VERSION Depends: task-opie-minimal Description: Landscape skin for opie mediaplayer's +Version: $QPE_VERSION$EXTRAVERSION diff --git a/noncore/multimedia/mediaplayerskins/opie-mediaplayer2-skin-default.control b/noncore/multimedia/mediaplayerskins/opie-mediaplayer2-skin-default.control index 5cd7509..d076fab 100644 --- a/noncore/multimedia/mediaplayerskins/opie-mediaplayer2-skin-default.control +++ b/noncore/multimedia/mediaplayerskins/opie-mediaplayer2-skin-default.control @@ -1,9 +1,9 @@ Package: opie-mediaplayer2-skin-default Files: pics/opieplayer2/skins/default Priority: optional Section: opie/playerskins Maintainer: L.J.Potter <ljp@llornkcor.com> Architecture: arm -Version: $QPE_VERSION-$SUB_VERSION Depends: task-opie-minimal Description: Default skin for opie mediaplayer's +Version: $QPE_VERSION$EXTRAVERSION diff --git a/noncore/multimedia/mediaplayerskins/opie-mediaplayer2-skin-techno.control b/noncore/multimedia/mediaplayerskins/opie-mediaplayer2-skin-techno.control index 0ff1427..ad8c1f8 100644 --- a/noncore/multimedia/mediaplayerskins/opie-mediaplayer2-skin-techno.control +++ b/noncore/multimedia/mediaplayerskins/opie-mediaplayer2-skin-techno.control @@ -1,8 +1,8 @@ Package: opie-mediaplayer2-skin-techno Files: pics/mediaplayer/skins/techno Priority: optional Section: opie/applications Maintainer: ljp <llornkcor@handhelds.org> -Version: $QPE_VERSION-$SUB_VERSION Description: Techno Opie Mediaplayer's skin. Adapted from Qtopia +Version: $QPE_VERSION$EXTRAVERSION diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index 5d929cb..2c54ae6 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp @@ -1,289 +1,275 @@ /* This file is part of the Opie Project Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> Copyright (c) 2002 L. Potter <ljp@llornkcor.com> Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> =. .=l. .>+-= _;:, .> :=|. This program is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This program is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU ..}^=.= = ; Library General Public License for more ++= -. .` .: details. : = ...= . :.=- -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = Library General Public License along with -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include <qpe/qpeapplication.h> -#include <qpe/resource.h> -#include <qpe/config.h> -#include <opie/oticker.h> - -#include <qwidget.h> -#include <qpixmap.h> -#include <qbutton.h> -#include <qpainter.h> -#include <qframe.h> -#include <qlayout.h> -#include <qdir.h> -#include <stdlib.h> -#include <stdio.h> #include "audiowidget.h" #include "mediaplayerstate.h" #include "playlistwidget.h" namespace { const int xo = -2; // movable x offset const int yo = 22; // movable y offset const MediaWidget::SkinButtonInfo skinInfo[] = { { MediaWidget::Play, "play", MediaWidget::ToggleButton }, { MediaWidget::Stop, "stop", MediaWidget::NormalButton }, { MediaWidget::Next, "next", MediaWidget::NormalButton }, { MediaWidget::Previous, "prev", MediaWidget::NormalButton }, { MediaWidget::VolumeUp, "up", MediaWidget::NormalButton }, { MediaWidget::VolumeDown, "down", MediaWidget::NormalButton }, { MediaWidget::Loop, "loop", MediaWidget::ToggleButton }, { MediaWidget::PlayList, "playlist", MediaWidget::NormalButton }, { MediaWidget::Forward, "forward", MediaWidget::NormalButton }, { MediaWidget::Back, "back", MediaWidget::NormalButton } }; const uint buttonCount = sizeof( skinInfo ) / sizeof( skinInfo[ 0 ] ); void changeTextColor( QWidget * w) { QPalette p = w->palette(); p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) ); p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) ); w->setPalette( p ); } } AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name) : MediaWidget( playList, mediaPlayerState, parent, name ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ), audioSliderBeingMoved( false ) { setCaption( tr("OpiePlayer") ); loadSkin(); connect( &mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); connect( &mediaPlayerState, SIGNAL( isSeekableToggled( bool ) ), this, SLOT( setSeekable( bool ) ) ); connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) ); connect( this, SIGNAL( backClicked() ), this, SLOT( skipBack() ) ); connect( this, SIGNAL( forwardReleased() ), this, SLOT( stopSkip() ) ); connect( this, SIGNAL( backReleased() ), this, SLOT( stopSkip() ) ); // Intialise state setLength( mediaPlayerState.length() ); setPosition( mediaPlayerState.position() ); setLooping( mediaPlayerState.isFullscreen() ); // setPaused( mediaPlayerState->paused() ); setPlaying( mediaPlayerState.isPlaying() ); } AudioWidget::~AudioWidget() { // mediaPlayerState->setPlaying(false); } MediaWidget::GUIInfo AudioWidget::guiInfo() { return GUIInfo( QString::null /* infix */, ::skinInfo, ::buttonCount ); } void AudioWidget::resizeEvent( QResizeEvent *e ) { int h = height(); int w = width(); songInfo.setGeometry( QRect( 2, 2, w - 4, 20 ) ); slider.setFixedWidth( w - 110 ); slider.setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); slider.setBackgroundOrigin( QWidget::ParentOrigin ); time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) ); upperLeftOfButtonMask.rx() = ( w - buttonUpImage.width() ) / 2; upperLeftOfButtonMask.ry() = (( h - buttonUpImage.height() ) / 2) - 10; MediaWidget::resizeEvent( e ); } void AudioWidget::sliderPressed() { audioSliderBeingMoved = TRUE; } void AudioWidget::sliderReleased() { audioSliderBeingMoved = FALSE; if ( slider.width() == 0 ) return; long val = long((double)slider.value() * mediaPlayerState.length() / slider.width()); mediaPlayerState.setPosition( val ); } void AudioWidget::setPosition( long i ) { // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i); updateSlider( i, mediaPlayerState.length() ); } void AudioWidget::setLength( long max ) { updateSlider( mediaPlayerState.position(), max ); } void AudioWidget::setDisplayType( MediaPlayerState::DisplayType mediaType ) { if ( mediaType == MediaPlayerState::Audio ) { // startTimer( 150 ); showMaximized(); return; } killTimers(); hide(); } void AudioWidget::loadSkin() { loadDefaultSkin( guiInfo() ); songInfo.setFocusPolicy( QWidget::NoFocus ); // changeTextColor( &songInfo ); // songInfo.setBackgroundColor( QColor( 167, 212, 167 )); // songInfo.setFrameStyle( QFrame::NoFrame); songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken ); // songInfo.setForegroundColor(Qt::white); slider.setFixedHeight( 20 ); slider.setMinValue( 0 ); slider.setMaxValue( 1 ); slider.setFocusPolicy( QWidget::NoFocus ); slider.setBackgroundPixmap( backgroundPixmap ); // Config cofg("qpe"); // cofg.setGroup("Appearance"); // QColor backgroundcolor = QColor( cofg.readEntry( "Background", "#E5E1D5" ) ); time.setFocusPolicy( QWidget::NoFocus ); time.setAlignment( Qt::AlignCenter ); - + // time.setFrame(FALSE); // changeTextColor( &time ); resizeEvent( 0 ); } void AudioWidget::setSeekable( bool isSeekable ) { if ( !isSeekable ) { qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>"); if( !slider.isHidden()) { slider.hide(); } disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); disconnect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); disconnect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); } else { // this stops the slider from being moved, thus // does not stop stream when it reaches the end slider.show(); qDebug( " CONNECT SET POSTION " ); connect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); connect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); } } static QString timeAsString( long length ) { int minutes = length / 60; int seconds = length % 60; return QString("%1:%2%3").arg( minutes ).arg( seconds / 10 ).arg( seconds % 10 ); } void AudioWidget::updateSlider( long i, long max ) { time.setText( timeAsString( i ) + " / " + timeAsString( max ) ); // qDebug( timeAsString( i ) + " / " + timeAsString( max ) ) ; if ( max == 0 ) { return; } // Will flicker too much if we don't do this // Scale to something reasonable int width = slider.width(); int val = int((double)i * width / max); if ( !audioSliderBeingMoved ) { if ( slider.value() != val ) { slider.setValue( val ); } if ( slider.maxValue() != width ) { slider.setMaxValue( width ); } } } void AudioWidget::skipFor() { skipDirection = +1; startTimer( 50 ); mediaPlayerState.setPosition( mediaPlayerState.position() + 2 ); } void AudioWidget::skipBack() { skipDirection = -1; startTimer( 50 ); mediaPlayerState.setPosition( mediaPlayerState.position() - 2 ); } void AudioWidget::stopSkip() { killTimers(); } void AudioWidget::timerEvent( QTimerEvent * ) { if ( skipDirection == +1 ) { mediaPlayerState.setPosition( mediaPlayerState.position() + 2 ); } else if ( skipDirection == -1 ) { mediaPlayerState.setPosition( mediaPlayerState.position() - 2 ); } } void AudioWidget::keyReleaseEvent( QKeyEvent *e) { switch ( e->key() ) { ////////////////////////////// Zaurus keys case Key_Home: break; case Key_F9: //activity hide(); // qDebug("Audio F9"); e->accept(); break; diff --git a/noncore/multimedia/opieplayer2/audiowidget.h b/noncore/multimedia/opieplayer2/audiowidget.h index 53dbb88..b436239 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.h +++ b/noncore/multimedia/opieplayer2/audiowidget.h @@ -1,102 +1,95 @@ /* This file is part of the Opie Project Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> Copyright (c) 2002 L. Potter <ljp@llornkcor.com> Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> =. .=l. .>+-= _;:, .> :=|. This program is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This program is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU ..}^=.= = ; Library General Public License for more ++= -. .` .: details. : = ...= . :.=- -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = Library General Public License along with -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef AUDIO_WIDGET_H #define AUDIO_WIDGET_H -#include <qpainter.h> -#include <qdrawutil.h> -#include <qpixmap.h> -#include <qstring.h> -#include <qslider.h> -#include <qframe.h> #include <qlineedit.h> -#include <qimage.h> #include <opie/oticker.h> #include "mediawidget.h" class QPixmap; class AudioWidget : public MediaWidget { Q_OBJECT public: AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent=0, const char* name=0 ); ~AudioWidget(); void setTickerText( const QString &text ) { songInfo.setText( text ); } static MediaWidget::GUIInfo guiInfo(); public slots: void updateSlider( long, long ); void sliderPressed( ); void sliderReleased( ); void setLooping( bool b) { setToggleButton( Loop, b ); } void setPosition( long ); void setSeekable( bool ); public: virtual void setLength( long ); virtual void setPlaying( bool b) { setToggleButton( Play, b ); } virtual void setDisplayType( MediaPlayerState::DisplayType displayType ); virtual void loadSkin(); signals: void sliderMoved(long); protected: void doBlank(); void doUnblank(); void resizeEvent( QResizeEvent *re ); void timerEvent( QTimerEvent *event ); void keyReleaseEvent( QKeyEvent *e); private slots: void skipFor(); void skipBack(); void stopSkip(); private: int skipDirection; QString skin; OTicker songInfo; QSlider slider; QLineEdit time; bool isStreaming : 1; bool audioSliderBeingMoved : 1; }; #endif // AUDIO_WIDGET_H diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp index d04af08..11ad745 100644 --- a/noncore/multimedia/opieplayer2/lib.cpp +++ b/noncore/multimedia/opieplayer2/lib.cpp @@ -1,400 +1,433 @@ /* This file is part of the Opie Project Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> Copyright (c) 2002 LJP <> Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> =. .=l. .>+-= _;:, .> :=|. This program is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This program is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU ..}^=.= = ; Library General Public License for more ++= -. .` .: details. : = ...= . :.=- -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = Library General Public License along with -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include <stdio.h> -#include <stdlib.h> -#include <qimage.h> + #include <qtextstream.h> -#include <qpe/resource.h> -#include <qfile.h> #include <qdir.h> #include <qgfx_qws.h> #include <qdirectpainter_qws.h> #include <assert.h> #include "xinevideowidget.h" #include "frame.h" #include "lib.h" typedef void (*display_xine_frame_t) (void *user_data, uint8_t* frame, int width, int height,int bytes ); extern "C" { xine_vo_driver_t* init_video_out_plugin( xine_t *xine, void* video, display_xine_frame_t, void * ); int null_is_showing_video( const xine_vo_driver_t* self ); void null_set_show_video( const xine_vo_driver_t* self, int show ); int null_is_fullscreen( const xine_vo_driver_t* self ); void null_set_fullscreen( const xine_vo_driver_t* self, int screen ); int null_is_scaling( const xine_vo_driver_t* self ); void null_set_scaling( const xine_vo_driver_t* self, int scale ); void null_set_gui_width( const xine_vo_driver_t* self, int width ); void null_set_gui_height( const xine_vo_driver_t* self, int height ); void null_set_mode( const xine_vo_driver_t* self, int depth, int rgb ); void null_set_videoGamma( const xine_vo_driver_t* self , int value ); void null_display_handler( const xine_vo_driver_t* self, display_xine_frame_t t, void* user_data ); void null_preload_decoders( xine_stream_t *stream ); } using namespace XINE; -Lib::Lib( InitializationMode initMode, XineVideoWidget* widget ) +Lib::Lib( InitializationMode initMode, XineVideoWidget* widget ) { m_initialized = false; m_duringInitialization = false; m_video = false; m_wid = widget; printf("Lib"); QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf"; // get the configuration // not really OO, should be an extra class, later if ( !QFile::exists(configPath) ) { QFile f(configPath); f.open(IO_WriteOnly); QTextStream ts( &f ); ts << "misc.memcpy_method:glibc\n"; + ts << "# uncomment if you experience double speed audio \n #audio.oss_sync_method:softsync\n"; + ts << "codec.ffmpeg_pp_quality:3\n"; + ts << "audio.num_buffers:50\n"; + ts << "audio.size_buffers:4160\n"; + ts << "video.num_buffers:20\n"; + ts << "video.size_buffers:4096\n"; + ts << "audio.out_num_audio_buf:16\n"; + ts << "audio.out_size_audio_buf:8096\n"; + ts << "audio.out_size_zero_buf:1024\n"; + ts << "audio.passthrough_offset:0\n"; f.close(); } if ( initMode == InitializeImmediately ) { initialize(); m_initialized = true; } else start(); } void Lib::run() { qDebug( "Lib::run() started" ); initialize(); m_initialized = true; qDebug( "Lib::run() finished" ); } void Lib::initialize() { m_duringInitialization = true; m_xine = xine_new( ); QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf"; xine_config_load( m_xine, QFile::encodeName( configPath ) ); xine_init( m_xine ); // allocate oss for sound // and fb for framebuffer m_audioOutput = xine_open_audio_driver( m_xine, "oss", NULL ); m_videoOutput = ::init_video_out_plugin( m_xine, NULL, xine_display_frame, this ); //xine_open_video_driver( m_xine, NULL, XINE_VISUAL_TYPE_FB, NULL); // null_display_handler( m_videoOutput, xine_display_frame, this ); m_stream = xine_stream_new (m_xine, m_audioOutput, m_videoOutput ); if (m_wid != 0 ) { printf( "!0\n" ); setWidget( m_wid ); } m_queue = xine_event_new_queue (m_stream); xine_event_create_listener_thread (m_queue, xine_event_handler, this); - ::null_preload_decoders( m_stream ); + ::null_preload_decoders( m_stream ); m_duringInitialization = false; } Lib::~Lib() { assert( isRunning() == false ); assert( m_initialized ); // free( m_config ); xine_close( m_stream ); xine_event_dispose_queue( m_queue ); xine_dispose( m_stream ); xine_exit( m_xine ); /* FIXME either free or delete but valgrind bitches against both */ //free( m_videoOutput ); //delete m_audioOutput; } void Lib::resize ( const QSize &s ) { assert( m_initialized || m_duringInitialization ); if ( s. width ( ) && s. height ( ) ) { ::null_set_gui_width( m_videoOutput, s. width() ); ::null_set_gui_height( m_videoOutput, s. height() ); } } int Lib::majorVersion() { int major, minor, sub; xine_get_version ( &major, &minor, &sub ); return major; } int Lib::minorVersion() { int major, minor, sub; xine_get_version ( &major, &minor, &sub ); return minor; } int Lib::subVersion() { int major, minor, sub; xine_get_version ( &major, &minor, &sub ); return sub; } int Lib::play( const QString& fileName, int startPos, int start_time ) { assert( m_initialized ); + // FIXME actually a hack imho. Should not be needed to dispose the whole stream + // but without we get wrong media length reads from libxine for the second media + //xine_dispose ( m_stream ); QString str = fileName.stripWhiteSpace(); + + //m_stream = xine_stream_new (m_xine, m_audioOutput, m_videoOutput ); + //m_queue = xine_event_new_queue (m_stream); + //xine_event_create_listener_thread (m_queue, xine_event_handler, this); + if ( !xine_open( m_stream, QFile::encodeName(str.utf8() ).data() ) ) { return 0; } return xine_play( m_stream, startPos, start_time); } void Lib::stop() { assert( m_initialized ); qDebug("<<<<<<<< STOP IN LIB TRIGGERED >>>>>>>"); xine_stop( m_stream ); } void Lib::pause( bool toggle ) { assert( m_initialized ); xine_set_param( m_stream, XINE_PARAM_SPEED, toggle ? XINE_SPEED_PAUSE : XINE_SPEED_NORMAL ); } int Lib::speed() const { assert( m_initialized ); return xine_get_param ( m_stream, XINE_PARAM_SPEED ); } void Lib::setSpeed( int speed ) { assert( m_initialized ); xine_set_param ( m_stream, XINE_PARAM_SPEED, speed ); } int Lib::status() const { assert( m_initialized ); return xine_get_status( m_stream ); } int Lib::currentPosition() const { assert( m_initialized ); int pos, time, length; xine_get_pos_length( m_stream, &pos, &time, &length ); return pos; } int Lib::currentTime() const { assert( m_initialized ); int pos, time, length; xine_get_pos_length( m_stream, &pos, &time, &length ); - return time/1000; + if ( time > 0 ) { + return time/1000; + } else { + return 0; + } } int Lib::length() const { assert( m_initialized ); int pos, time, length; - xine_get_pos_length( m_stream, &pos, &time, &length ); - return length/1000; +/* dilb: patch to solve the wrong stream length reported to the GUI*/ + int iRetVal=0, iTestLoop=0; + + do + { + iRetVal = xine_get_pos_length( m_stream, &pos, &time, &length ); + if (iRetVal) + {/* if the function didn't return 0, then pos, time and length are valid.*/ + return length/1000; + } + /*don't poll too much*/ + usleep(100000); + iTestLoop++; + } + while ( iTestLoop < 10 ); /* if after 1s, we still don't have any +valid stream, then return -1 (this value could be used to make the stream +unseekable, but it should never occur!! Mr. Murphy ? :) ) */ + + return -1; } bool Lib::isSeekable() const { assert( m_initialized ); return xine_get_stream_info( m_stream, XINE_STREAM_INFO_SEEKABLE ); } void Lib::seekTo( int time ) { assert( m_initialized ); //xine_trick_mode ( m_stream, XINE_TRICK_MODE_SEEK_TO_TIME, time ); NOT IMPLEMENTED YET IN XINE :_( // since its now milliseconds we need *1000 xine_play( m_stream, 0, time*1000 ); } Frame Lib::currentFrame() const { assert( m_initialized ); Frame frame; return frame; }; QString Lib::metaInfo( int number) const { assert( m_initialized ); return xine_get_meta_info( m_stream, number ); } int Lib::error() const { assert( m_initialized ); return xine_get_error( m_stream ); }; void Lib::ensureInitialized() { if ( m_initialized ) return; qDebug( "waiting for initialization thread to finish" ); wait(); qDebug( "initialization thread finished!" ); } void Lib::setWidget( XineVideoWidget *widget ) { m_wid = widget; resize ( m_wid-> size ( ) ); ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() ); m_wid->repaint(); } void Lib::receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType ) { assert( sendType == ThreadUtil::Channel::OneWay ); handleXineEvent( msg->type() ); delete msg; } void Lib::handleXineEvent( const xine_event_t* t ) { send( new ThreadUtil::ChannelMessage( t->type ), OneWay ); } void Lib::handleXineEvent( int type ) { assert( m_initialized ); if ( type == XINE_EVENT_UI_PLAYBACK_FINISHED ) { emit stopped(); } } void Lib::setShowVideo( bool video ) { assert( m_initialized ); m_video = video; ::null_set_show_video( m_videoOutput, video ); } bool Lib::isShowingVideo() const { assert( m_initialized ); return ::null_is_showing_video( m_videoOutput ); } bool Lib::hasVideo() const { assert( m_initialized ); return xine_get_stream_info( m_stream, 18 ); } void Lib::showVideoFullScreen( bool fullScreen ) { assert( m_initialized ); ::null_set_fullscreen( m_videoOutput, fullScreen ); } bool Lib::isVideoFullScreen() const { assert( m_initialized ); return ::null_is_fullscreen( m_videoOutput ); } void Lib::setScaling( bool scale ) { assert( m_initialized ); ::null_set_scaling( m_videoOutput, scale ); } void Lib::setGamma( int value ) { assert( m_initialized ); - //qDebug( QString( "%1").arg(value) ); - /* int gammaValue = ( 100 + value ); */ - ::null_set_videoGamma( m_videoOutput, value ); + ::null_set_videoGamma( m_videoOutput, value ); } bool Lib::isScaling() const { assert( m_initialized ); return ::null_is_scaling( m_videoOutput ); } void Lib::xine_event_handler( void* user_data, const xine_event_t* t ) { ( (Lib*)user_data)->handleXineEvent( t ); } void Lib::xine_display_frame( void* user_data, uint8_t *frame, int width, int height, int bytes ) { ( (Lib*)user_data)->drawFrame( frame, width, height, bytes ); } void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) { assert( m_initialized ); if ( !m_video ) { qWarning("not showing video now"); return; } assert( m_wid ); m_wid-> setVideoFrame ( frame, width, height, bytes ); } diff --git a/noncore/multimedia/opieplayer2/lib.h b/noncore/multimedia/opieplayer2/lib.h index 181735c..0ff14d0 100644 --- a/noncore/multimedia/opieplayer2/lib.h +++ b/noncore/multimedia/opieplayer2/lib.h @@ -1,138 +1,133 @@ /* This file is part of the Opie Project Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> Copyright (c) 2002 LJP <> Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> =. .=l. .>+-= _;:, .> :=|. This program is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This program is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU ..}^=.= = ; Library General Public License for more ++= -. .` .: details. : = ...= . :.=- -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = Library General Public License along with -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef ZECKEXINELIB_H #define ZECKEXINELIB_H -#include <qcstring.h> -#include <qstring.h> -#include <qobject.h> - #include <xine.h> -//#include "xine.h" #include "threadutil.h" class XineVideoWidget; namespace XINE { /** * Lib wrapps the simple interface * of libxine for easy every day use * This will become a full C++ Wrapper * It supports playing, pausing, info, * stooping, seeking. */ class Frame; class Lib : public ThreadUtil::Channel, private ThreadUtil::Thread { Q_OBJECT public: enum InitializationMode { InitializeImmediately, InitializeInThread }; Lib( InitializationMode initMode, XineVideoWidget* = 0); ~Lib(); static int majorVersion(); static int minorVersion(); static int subVersion(); void resize ( const QSize &s ); int play( const QString& fileName, int startPos = 0, int start_time = 0 ); void stop(); void pause( bool toggle ); int speed() const; /** * Set the speed of the stream, if codec supports it * XINE_SPEED_PAUSE 0 * XINE_SPEED_SLOW_4 1 * XINE_SPEED_SLOW_2 2 * XINE_SPEED_NORMAL 4 * XINE_SPEED_FAST_2 8 *XINE_SPEED_FAST_4 16 */ void setSpeed( int speed = XINE_SPEED_PAUSE ); int status() const; int currentPosition()const; //in seconds int currentTime()const; int length() const; bool isSeekable()const; /** * Whether or not to show video output */ void setShowVideo(bool video); /** * is we show video */ bool isShowingVideo() const; /** * */ void showVideoFullScreen( bool fullScreen ); /** * */ bool isVideoFullScreen() const; /** * Get the meta info (like author etc) from the stream * XINE_META_INFO_TITLE 0 * XINE_META_INFO_COMMENT 1 * XINE_META_INFO_ARTIST 2 * XINE_META_INFO_GENRE 3 * XINE_META_INFO_ALBUM 4 * XINE_META_INFO_YEAR 5 * XINE_META_INFO_VIDEOCODEC 6 * XINE_META_INFO_AUDIOCODEC 7 * XINE_META_INFO_SYSTEMLAYER 8 * XINE_META_INFO_INPUT_PLUGIN 9 */ QString metaInfo( int number ) const; diff --git a/noncore/multimedia/opieplayer2/mediadetect.cpp b/noncore/multimedia/opieplayer2/mediadetect.cpp deleted file mode 100644 index 91137db..0000000 --- a/noncore/multimedia/opieplayer2/mediadetect.cpp +++ b/dev/null @@ -1,43 +0,0 @@ -#include <qstring.h> -#include "mediadetect.h" - - -MediaDetect::MediaDetect() { -} - -MediaDetect::~MediaDetect() { -} - -char MediaDetect::videoOrAudio( const QString& fileName ) { - if( (fileName.lower()).right(4) == ".avi" || - (fileName.lower()).right(4) == ".mpg" || - (fileName.lower()).right(4) == ".asf" || - (fileName.lower()).right(4) == ".mov" || - (fileName.lower()).right(5) == ".mpeg" ) { - qDebug("Video out taken"); - return 'v'; - } else if ( (fileName.lower()).right(4) == "·mp1" || - (fileName.lower()).right(4) == ".mp3" || - (fileName.lower()).right(4) == ".ogg" || - (fileName.lower()).right(4) == ".wav" ) { - qDebug("AUDIO out taken"); - return 'a'; - } else if ( (fileName.lower()).left(7) == "http://" && - (fileName.lower()).right(1) == "/" ) { - return 'a'; - } else { - return 'f'; - } -} - -bool MediaDetect::isStreaming( const QString& fileName ) { - // ugly - if( (fileName.lower()).left(4) == "http" ) { - return true; - } else if ( (fileName.lower()).left(3) == "ftp" ) { - return true; - } else { - return false; - } -} - diff --git a/noncore/multimedia/opieplayer2/mediadetect.h b/noncore/multimedia/opieplayer2/mediadetect.h deleted file mode 100644 index bd5ea1d..0000000 --- a/noncore/multimedia/opieplayer2/mediadetect.h +++ b/dev/null @@ -1,31 +0,0 @@ - -#ifndef MEDIADETECT_H -#define MEDIADETECT_H - - -class QString; -class MediaDetect { - -public: - MediaDetect(); - ~MediaDetect(); - - /** - * Look at the filename and decide which gui is to be used - * - * @param filename the filename - * @return the char - a for audio gui, v for video, f for error - */ - char videoOrAudio( const QString& fileName ); - - /** - * Find out if it is a streaming media file - * - * @param filename the filename - * @return if it is a streaming url or not - */ - bool isStreaming( const QString& fileName ); - -}; - -#endif diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp index d4396d2..9f51006 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp @@ -1,125 +1,116 @@ #include <qpe/qpeapplication.h> -#include <qpe/qlibrary.h> -#include <qpe/resource.h> #include <qpe/config.h> #include <qpe/qcopenvelope_qws.h> #include <qfileinfo.h> -#include <qmainwindow.h> -#include <qmessagebox.h> -#include <qwidgetstack.h> -#include <qfile.h> - #include "mediaplayer.h" #include "playlistwidget.h" #include "audiowidget.h" #include "videowidget.h" #include "volumecontrol.h" #include "lib.h" #include "mediaplayerstate.h" -// for setBacklight() + // for setBacklight() #include <linux/fb.h> #include <sys/file.h> #include <sys/ioctl.h> - - #define FBIOBLANK 0x4611 MediaPlayer::MediaPlayer( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name ) : QObject( parent, name ), volumeDirection( 0 ), mediaPlayerState( _mediaPlayerState ), playList( _playList ) { m_audioUI = 0; m_videoUI = 0; m_xineControl = 0; xine = new XINE::Lib( XINE::Lib::InitializeInThread ); fd=-1;fl=-1; playList.setCaption( tr( "OpiePlayer: Initializating" ) ); qApp->processEvents(); // QPEApplication::grabKeyboard(); // EVIL connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) ); // What is pauseCheck good for? (Simon) // connect( &mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) ); connect( &mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) ); connect( &mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) ); connect( &mediaPlayerState, SIGNAL( blankToggled( bool ) ), this, SLOT ( blank( bool ) ) ); volControl = new VolumeControl; Config cfg( "OpiePlayer" ); cfg.setGroup("PlayList"); QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default"); playList.setCaption( tr( "OpiePlayer: " ) + QFileInfo(currentPlaylist).baseName() ); m_skinLoader = new SkinLoader; m_skinLoader->schedule( AudioWidget::guiInfo() ); m_skinLoader->schedule( VideoWidget::guiInfo() ); m_skinLoader->start(); } MediaPlayer::~MediaPlayer() { // this shold never happen, but one never knows... if ( xine ) { xine->ensureInitialized(); delete xine; } delete m_xineControl; delete m_audioUI; delete m_videoUI; delete volControl; } void MediaPlayer::pauseCheck( bool b ) { if ( b && !mediaPlayerState.isPlaying() ) { mediaPlayerState.setPaused( FALSE ); } } void MediaPlayer::play() { mediaPlayerState.setPlaying( FALSE ); mediaPlayerState.setPlaying( TRUE ); } void MediaPlayer::setPlaying( bool play ) { if ( !play ) { return; } if ( mediaPlayerState.isPaused() ) { mediaPlayerState.setPaused( FALSE ); return; } QString tickerText, time, fileName; if ( playList.currentTab() != PlayListWidget::CurrentPlayList ) { //if playing in file list.. play in a different way // random and looping settings enabled causes problems here, // since there is no selected file in the playlist, but a selected file in the file list, // so we remember and shutoff l = mediaPlayerState.isLooping(); if(l) { mediaPlayerState.setLooping( false ); } r = mediaPlayerState.isShuffled(); mediaPlayerState.setShuffled( false ); } PlayListWidget::Entry playListEntry = playList.currentEntry(); fileName = playListEntry.name; xineControl()->play( playListEntry.file ); long seconds = mediaPlayerState.length(); time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); if( fileName.left(4) == "http" ) { fileName = QFileInfo( fileName ).baseName(); if ( xineControl()->getMetaInfo().isEmpty() ) { tickerText = tr( " File: " ) + fileName; diff --git a/noncore/multimedia/opieplayer2/mediaplayer.h b/noncore/multimedia/opieplayer2/mediaplayer.h index cbe4d86..34ff064 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.h +++ b/noncore/multimedia/opieplayer2/mediaplayer.h @@ -1,105 +1,102 @@ /* This file is part of the Opie Project Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> Copyright (c) 2002 LJP <> Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> =. .=l. .>+-= _;:, .> :=|. This program is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This program is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU ..}^=.= = ; Library General Public License for more ++= -. .` .: details. : = ...= . :.=- -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = Library General Public License along with -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef MEDIA_PLAYER_H #define MEDIA_PLAYER_H -#include <qmainwindow.h> -#include <qframe.h> - #include "xinecontrol.h" #include "playlistwidget.h" #include "skin.h" class DocLnk; class VolumeControl; class MediaPlayerState; class AudioWidget; class VideoWidget; namespace XINE { class Lib; }; class MediaPlayer : public QObject { Q_OBJECT public: MediaPlayer( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name ); ~MediaPlayer(); public slots: void reloadSkins(); private slots: void setPlaying( bool ); void pauseCheck( bool ); void play(); void next(); void prev(); void startIncreasingVolume(); void startDecreasingVolume(); void stopChangingVolume(); void cleanUp(); void blank( bool ); protected: void timerEvent( QTimerEvent *e ); void keyReleaseEvent( QKeyEvent *e); private: AudioWidget *audioUI() const; VideoWidget *videoUI() const; XineControl *xineControl() const; bool isBlanked, l, r; int fd, fl; int volumeDirection; VolumeControl *volControl; MediaPlayerState &mediaPlayerState; PlayListWidget &playList; void recreateAudioAndVideoWidgets() const; mutable XineControl *m_xineControl; mutable AudioWidget *m_audioUI; mutable VideoWidget *m_videoUI; mutable XINE::Lib *xine; QGuardedPtr<SkinLoader> m_skinLoader; }; #endif // MEDIA_PLAYER_H diff --git a/noncore/multimedia/opieplayer2/mediawidget.cpp b/noncore/multimedia/opieplayer2/mediawidget.cpp index 3953d92..b1f88c9 100644 --- a/noncore/multimedia/opieplayer2/mediawidget.cpp +++ b/noncore/multimedia/opieplayer2/mediawidget.cpp @@ -1,118 +1,120 @@ /* Copyright (C) 2002 Simon Hausmann <simon@lst.de> (C) 2002 Max Reiss <harlekin@handhelds.org> (C) 2002 L. Potter <ljp@llornkcor.com> (C) 2002 Holger Freyther <zecke@handhelds.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include <assert.h> + #include "mediawidget.h" #include "playlistwidget.h" #include "skin.h" #include <assert.h> MediaWidget::MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent, const char *name ) : QWidget( parent, name ), mediaPlayerState( _mediaPlayerState ), playList( _playList ) { connect( &mediaPlayerState, SIGNAL( displayTypeChanged( MediaPlayerState::DisplayType ) ), this, SLOT( setDisplayType( MediaPlayerState::DisplayType ) ) ); connect( &mediaPlayerState, SIGNAL( lengthChanged( long ) ), this, SLOT( setLength( long ) ) ); connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) ); setBackgroundMode( NoBackground ); } MediaWidget::~MediaWidget() { } void MediaWidget::setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount, const Skin &skin ) { buttonMask = skin.buttonMask( skinInfo, buttonCount ); buttons.clear(); buttons.reserve( buttonCount ); for ( uint i = 0; i < buttonCount; ++i ) { Button button = setupButton( skinInfo[ i ], skin ); buttons.push_back( button ); } } MediaWidget::Button MediaWidget::setupButton( const SkinButtonInfo &buttonInfo, const Skin &skin ) { Button button; button.command = buttonInfo.command; button.type = buttonInfo.type; button.mask = skin.buttonMaskImage( buttonInfo.fileName ); return button; } void MediaWidget::loadDefaultSkin( const GUIInfo &guiInfo ) { Skin skin( guiInfo.fileNameInfix ); skin.setCachable( false ); loadSkin( guiInfo.buttonInfo, guiInfo.buttonCount, skin ); } void MediaWidget::loadSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const Skin &skin ) { backgroundPixmap = skin.backgroundPixmap(); buttonUpImage = skin.buttonUpImage(); buttonDownImage = skin.buttonDownImage(); setupButtons( skinInfo, buttonCount, skin ); } void MediaWidget::closeEvent( QCloseEvent * ) { mediaPlayerState.setList(); } void MediaWidget::paintEvent( QPaintEvent *pe ) { QPainter p( this ); if ( mediaPlayerState.isFullscreen() ) { // Clear the background p.setBrush( QBrush( Qt::black ) ); return; } QPixmap buffer( size() ); QPainter bufferedPainter( &buffer ); bufferedPainter.drawTiledPixmap( rect(), backgroundPixmap, QPoint( 0, 0 ) ); paintAllButtons( bufferedPainter ); p.drawPixmap( 0, 0, buffer ); } void MediaWidget::resizeEvent( QResizeEvent *e ) { QPixmap pixUp = combineImageWithBackground( buttonUpImage, backgroundPixmap, upperLeftOfButtonMask ); QPixmap pixDn = combineImageWithBackground( buttonDownImage, backgroundPixmap, upperLeftOfButtonMask ); for ( ButtonVector::iterator it = buttons.begin(); it != buttons.end(); ++it ) { Button &button = *it; if ( button.mask.isNull() ) continue; button.pixUp = addMaskToPixmap( pixUp, button.mask ); diff --git a/noncore/multimedia/opieplayer2/om3u.cpp b/noncore/multimedia/opieplayer2/om3u.cpp index 841d950..7183fb4 100644 --- a/noncore/multimedia/opieplayer2/om3u.cpp +++ b/noncore/multimedia/opieplayer2/om3u.cpp @@ -1,166 +1,160 @@ /* This file is part of the Opie Project Copyright (c) 2002 L. Potter <ljp@llornkcor.com> =. .=l. .>+-= _;:, .> :=|. This program is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This program is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU ..}^=.= = ; General Public License for more ++= -. .` .: details. : = ...= . :.=- -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = General Public License along with -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "playlistwidget.h" #include "om3u.h" #include <qpe/applnk.h> #include <qpe/qpeapplication.h> #include <qpe/storage.h> #include <qpe/mimetype.h> #include <qpe/global.h> #include <qpe/resource.h> #include <qdir.h> #include <qregexp.h> #include <qstring.h> #include <qtextstream.h> #include <qstringlist.h> #include <qcstring.h> //extern PlayListWidget *playList; Om3u::Om3u( const QString &filePath, int mode) : QStringList (){ qDebug("<<<<<<<new m3u "+filePath); f.setName(filePath); f.open(mode); } Om3u::~Om3u(){} void Om3u::readM3u() { // qDebug("<<<<<<reading m3u "+f.name()); QTextStream t(&f); QString s; while ( !t.atEnd() ) { s=t.readLine(); // qDebug(s); if( s.find( "#", 0, TRUE) == -1 ) { if( s.left(2) == "E:" || s.left(2) == "P:" ) { s = s.right( s.length() -2 ); QFileInfo f( s ); QString name = f.baseName(); name = name.right( name.length() - name.findRev( "\\", -1, TRUE ) -1 ); s=s.replace( QRegExp( "\\" ), "/" ); append(s); // qDebug(s); } else { // is url - s.replace( QRegExp( "%20" )," " ); QString name; -// if( name.left( 4 ) == "http" ) { -// name = s.right( s.length() - 7 ); -// } else { - name = s; -// } + name = s; append(name); -// qDebug(name); } } } } void Om3u::readPls() { //it's a pls file QTextStream t( &f ); QString s; while ( !t.atEnd() ) { s = t.readLine(); if( s.left(4) == "File" ) { s = s.right( s.length() - s.find("=",0,true)-1 ); s = s.stripWhiteSpace(); s.replace( QRegExp( "%20" )," "); // qDebug( "adding " + s + " to playlist" ); // numberofentries=2 // File1=http // Title // Length // Version // File2=http s = s.replace( QRegExp( "\\" ), "/" ); QFileInfo f( s ); QString name = f.baseName(); if( name.left( 4 ) == "http" ) { name = s.right( s.length() - 7); } else { name = s; } name = name.right( name.length() - name.findRev( "\\", -1, TRUE) - 1 ); if( s.at( s.length() - 4) == '.') // if this is probably a file append(s); else { //if its a url // if( name.right( 1 ).find( '/' ) == -1) { // s += "/"; // } append(s); } } } } void Om3u::write() { //writes list to m3u file QString list; if(count()>0) { for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) { // qDebug(*it); list += *it+"\n"; } f.writeBlock( list, list.length() ); } // f.close(); } void Om3u::add(const QString &filePath) { //adds to m3u file append(filePath); } void Om3u::remove(const QString &filePath) { //removes from m3u list QString list, currentFile; if(count()>0) { for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) { currentFile=*it; // qDebug(*it); - + if( filePath != currentFile) list += currentFile+"\n"; } f.writeBlock( list, list.length() ); } } void Om3u::deleteFile(const QString &/*filePath*/) {//deletes m3u file f.close(); f.remove(); } void Om3u::close() { //closes m3u file f.close(); } diff --git a/noncore/multimedia/opieplayer2/opie-mediaplayer2-codecs.control b/noncore/multimedia/opieplayer2/opie-mediaplayer2-codecs.control new file mode 100644 index 0000000..0e71fc5 --- a/dev/null +++ b/noncore/multimedia/opieplayer2/opie-mediaplayer2-codecs.control @@ -0,0 +1,10 @@ +Package: opie-mediaplayer2-codecs +Files: root/usr/lib/libao.so* root/usr/lib/libogg* root/usr/lib/libvorbisidec.so* root/usr/lib/libxine.so* root/usr/lib/xine/* +Section: opie/multimedia +Essential: no +Priority: optional +Version: 0.7-$SUB_VERSION.3 +Architecture: arm +Maintainer: Maximilian Reiss <harlekin@handhelds.org> +Depends: libc6 (>= 2.1), opie-mediaplayer2 +Description: Codecs for opieplayer 2 diff --git a/noncore/multimedia/opieplayer2/opie-mediaplayer2-codecs.postinst b/noncore/multimedia/opieplayer2/opie-mediaplayer2-codecs.postinst new file mode 100755 index 0000000..8e60212 --- a/dev/null +++ b/noncore/multimedia/opieplayer2/opie-mediaplayer2-codecs.postinst @@ -0,0 +1,5 @@ +#!/bin/sh + +[ "$1" = "configure" ] || exit 1 + +ldconfig
\ No newline at end of file diff --git a/noncore/multimedia/opieplayer2/opie-mediaplayer2.control b/noncore/multimedia/opieplayer2/opie-mediaplayer2.control index c072308..10c5d19 100644 --- a/noncore/multimedia/opieplayer2/opie-mediaplayer2.control +++ b/noncore/multimedia/opieplayer2/opie-mediaplayer2.control @@ -1,11 +1,11 @@ Package: opie-mediaplayer2 Files: bin/opieplayer2 apps/Applications/mediaplayer.desktop pics/opieplayer2/add_to_playlist.png pics/opieplayer2/cut.png pics/opieplayer2/delete.png pics/opieplayer2/down.png pics/opieplayer2/loop.png pics/opieplayer2/MPEGPlayer.png pics/opieplayer2/musicfile.png pics/opieplayer2/playlist2.png pics/opieplayer2/play.png pics/opieplayer2/remove_from_playlist.png pics/opieplayer2/shuffle.png pics/opieplayer2/up.png pics/opieplayer2/videofile.png Priority: optional Section: opie/applications Maintainer: L.J.Potter <ljp@llornkcor.com>, Maximilian Reiss <harlekin@handhelds.org> Architecture: arm -Version: $QPE_VERSION-$SUB_VERSION -Depends: task-opie-minimal, libopie1, zlib1g, opie-mediaplayer2-skin-default | opie-mediaplayer2-skin-default-landscape , libxine1 | opie-mediaplayer-codecs +Depends: task-opie-minimal, libopie1, zlib1g, libstdc++2.10-glibc2.2, opie-mediaplayer2-skin-default | opie-mediaplayer2-skin-default-landscape , libxine1 | opie-mediaplayer2-codecs Description: The Opie media player The mediaplayer for Opie. It plays mp3, mpeg, wav, ogg, quicktime, divx and more. Also it is streaming capable. +Version: $QPE_VERSION$EXTRAVERSION diff --git a/noncore/multimedia/opieplayer2/opieplayer2.pro b/noncore/multimedia/opieplayer2/opieplayer2.pro index 57cd18f..5dabbab 100644 --- a/noncore/multimedia/opieplayer2/opieplayer2.pro +++ b/noncore/multimedia/opieplayer2/opieplayer2.pro @@ -1,48 +1,48 @@ TEMPLATE = app CONFIG = qt warn_on release DESTDIR = $(OPIEDIR)/bin HEADERS = playlistselection.h mediaplayerstate.h xinecontrol.h \ videowidget.h audiowidget.h playlistwidget.h om3u.h mediaplayer.h inputDialog.h \ frame.h lib.h xinevideowidget.h volumecontrol.h playlistwidgetgui.h\ alphablend.h yuv2rgb.h threadutil.h mediawidget.h playlistview.h playlistfileview.h \ skin.h SOURCES = main.cpp \ playlistselection.cpp mediaplayerstate.cpp xinecontrol.cpp \ videowidget.cpp audiowidget.cpp playlistwidget.cpp om3u.cpp mediaplayer.cpp inputDialog.cpp \ frame.cpp lib.cpp nullvideo.c xinevideowidget.cpp volumecontrol.cpp \ playlistwidgetgui.cpp\ - alphablend.c yuv2rgb.c yuv2rgb_arm.c yuv2rgb_arm4l.S \ + alphablend.c yuv2rgb.c yuv2rgb_arm2.c yuv2rgb_arm4l.S \ threadutil.cpp mediawidget.cpp playlistview.cpp playlistfileview.cpp \ skin.cpp TARGET = opieplayer2 INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe -lpthread -lopie -lxine -lstdc++ MOC_DIR = qpeobj OBJECTS_DIR = qpeobj #INCLUDEPATH += $(OPIEDIR)/include #DEPENDPATH += $(OPIEDIR)/include TRANSLATIONS = ../../../i18n/de/opieplayer2.ts \ ../../../i18n/nl/opieplayer2.ts \ ../../../i18n/da/opieplayer2.ts \ ../../../i18n/xx/opieplayer2.ts \ ../../../i18n/en/opieplayer2.ts \ ../../../i18n/es/opieplayer2.ts \ ../../../i18n/fr/opieplayer2.ts \ ../../../i18n/hu/opieplayer2.ts \ ../../../i18n/ja/opieplayer2.ts \ ../../../i18n/ko/opieplayer2.ts \ ../../../i18n/no/opieplayer2.ts \ ../../../i18n/pl/opieplayer2.ts \ ../../../i18n/pt/opieplayer2.ts \ ../../../i18n/pt_BR/opieplayer2.ts \ ../../../i18n/sl/opieplayer2.ts \ ../../../i18n/zh_CN/opieplayer2.ts \ ../../../i18n/zh_TW/opieplayer2.ts include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index 5f750ba..a1a1016 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp @@ -1,154 +1,143 @@ /* This file is part of the Opie Project Copyright (c) 2002,2003 Max Reiss <harlekin@handhelds.org> Copyright (c) 2002 L. Potter <ljp@llornkcor.com> Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> =. .=l. .>+-= _;:, .> :=|. This program is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This program is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU ..}^=.= = ; General Public License for more ++= -. .` .: details. : = ...= . :.=- -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = General Public License along with -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include <qpe/qpetoolbar.h> -#include <qpe/qpeapplication.h> -#include <qpe/storage.h> -#include <qpe/mimetype.h> -#include <qpe/global.h> -#include <qpe/resource.h> -#include <qpe/config.h> +#include <qtoolbar.h> #include <opie/ofiledialog.h> -#include <qdatetime.h> -#include <qdir.h> #include <qmessagebox.h> -#include <qregexp.h> -#include <qtextstream.h> #include "playlistselection.h" #include "playlistwidget.h" #include "mediaplayerstate.h" #include "inputDialog.h" #include "om3u.h" #include "playlistfileview.h" //only needed for the random play -#include <stdlib.h> #include <assert.h> PlayListWidget::PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name ) : PlayListWidgetGui( mediaPlayerState, parent, name ) , currentFileListView( 0 ) { d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "opieplayer2/add_to_playlist", this , SLOT(addSelected() ) ); d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "opieplayer2/remove_from_playlist", this , SLOT(removeSelected() ) ); d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer2/play", this , SLOT( btnPlay( bool) ), TRUE ); d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer2/shuffle", &mediaPlayerState, SLOT( setShuffled( bool ) ), TRUE ); d->tbLoop = new ToolButton( bar, tr( "Loop" ), "opieplayer2/loop", &mediaPlayerState, SLOT( setLooping( bool ) ), TRUE ); (void)new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); (void)new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) ); (void)new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) ); (void)new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) ); pmPlayList->insertSeparator(-1); (void)new MenuItem( pmPlayList, tr( "Add File" ), this,SLOT( openFile() ) ); (void)new MenuItem( pmPlayList, tr("Add URL"), this,SLOT( openURL() ) ); pmPlayList->insertSeparator(-1); (void)new MenuItem( pmPlayList, tr( "Save Playlist" ), this, SLOT(writem3u() ) ); pmPlayList->insertSeparator(-1); (void)new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), audioView, SLOT( scanFiles() ) ); (void)new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), videoView, SLOT( scanFiles() ) ); pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"), &mediaPlayerState, SLOT( toggleFullscreen() ) ); Config cfg( "OpiePlayer" ); bool b= cfg.readBoolEntry("FullScreen", 0); mediaPlayerState.setFullscreen( b ); pmView->setItemChecked( -16, b ); (void)new ToolButton( vbox1, tr( "Move Up" ), "opieplayer2/up", d->selectedFiles, SLOT(moveSelectedUp() ) ); (void)new ToolButton( vbox1, tr( "Remove" ), "opieplayer2/cut", d->selectedFiles, SLOT(removeSelected() ) ); (void)new ToolButton( vbox1, tr( "Move Down" ), "opieplayer2/down", d->selectedFiles, SLOT(moveSelectedDown() ) ); QVBox *stretch2 = new QVBox( vbox1 ); connect( tbDeletePlaylist, ( SIGNAL( released() ) ), SLOT( deletePlaylist() ) ); connect( pmView, SIGNAL( activated( int ) ), this, SLOT( pmViewActivated( int ) ) ); connect( skinsMenu, SIGNAL( activated( int ) ) , this, SLOT( skinsMenuActivated( int ) ) ); connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ), this,SLOT( playlistViewPressed( int, QListViewItem *, const QPoint&, int ) ) ); connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int ) ), this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int ) ) ); connect( audioView, SIGNAL( returnPressed( QListViewItem *) ), this,SLOT( playIt( QListViewItem *) ) ); connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ), this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int) ) ); connect( videoView, SIGNAL( returnPressed( QListViewItem *) ), this,SLOT( playIt( QListViewItem *) ) ); connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) ); connect( tabWidget, SIGNAL ( currentChanged(QWidget*) ), this, SLOT( tabChanged( QWidget* ) ) ); connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) ); connect( &mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) ); connect( &mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) ); connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); connect ( gammaSlider, SIGNAL( valueChanged( int ) ), &mediaPlayerState, SLOT( setVideoGamma( int ) ) ); // see which skins are installed populateSkinsMenu(); initializeStates(); channel = new QCopChannel( "QPE/Application/opieplayer2", this ); @@ -574,225 +563,227 @@ void PlayListWidget::tabChanged(QWidget *) { } void PlayListWidget::btnPlay(bool b) { // mediaPlayerState->setPlaying(false); mediaPlayerState.setPlaying(b); insanityBool=FALSE; } void PlayListWidget::deletePlaylist() { switch( QMessageBox::information( this, (tr("Remove Playlist?")), (tr("You really want to delete\nthis playlist?")), (tr("Yes")), (tr("No")), 0 )){ case 0: // Yes clicked, QFile().remove(playLists->selectedDocument().file()); QFile().remove(playLists->selectedDocument().linkFile()); playLists->reread(); break; case 1: // Cancel break; }; } void PlayListWidget::playSelected() { btnPlay( TRUE); } bool PlayListWidget::inFileListMode() const { TabType tab = currentTab(); return tab == AudioFiles || tab == VideoFiles; } void PlayListWidget::openURL() { // http://66.28.164.33:2080 // http://somafm.com/star0242.m3u QString filename, name; InputDialog *fileDlg; fileDlg = new InputDialog(this,tr("Add URL"),TRUE, 0); fileDlg->exec(); if( fileDlg->result() == 1 ) { filename = fileDlg->text(); qDebug( "Selected filename is " + filename ); // Om3u *m3uList; DocLnk lnk; Config cfg( "OpiePlayer" ); cfg.setGroup("PlayList"); if(filename.left(4) == "http") { QString m3uFile, m3uFilePath; if(filename.find(":",8,TRUE) != -1) { //found a port m3uFile = filename.left( filename.find( ":",8,TRUE)); m3uFile = m3uFile.right( 7); } else if(filename.left(4) == "http"){ m3uFile=filename; m3uFile = m3uFile.right( m3uFile.length() - 7); } else{ m3uFile=filename; } lnk.setName( filename ); //sets name lnk.setFile( filename ); //sets file name // lnk.setIcon("opieplayer2/musicfile"); d->selectedFiles->addToSelection( lnk ); writeCurrentM3u(); d->selectedFiles->setSelectedItem( lnk.name()); } else if( filename.right( 3) == "m3u" || filename.right(3) == "pls" ) { readListFromFile( filename ); } else { lnk.setName( QFileInfo(filename).baseName() ); //sets name lnk.setFile( filename ); //sets file name d->selectedFiles->addToSelection( lnk); writeCurrentM3u(); d->selectedFiles->setSelectedItem( lnk.name()); } } delete fileDlg; } void PlayListWidget::openFile() { QString filename, name; Config cfg( "OpiePlayer" ); cfg.setGroup("Dialog"); MimeTypes types; QStringList audio, video, all; audio << "audio/*"; audio << "playlist/plain"; + audio << "application/ogg"; audio << "audio/x-mpegurl"; video << "video/*"; video << "playlist/plain"; all += audio; all += video; types.insert("All Media Files", all ); types.insert("Audio", audio ); types.insert("Video", video ); QString str = OFileDialog::getOpenFileName( 1, - cfg.readEntry("LastDirectory",QPEApplication::documentDir()),"", - types, 0 ); - if(str.left(2) == "//") str=str.right(str.length()-1); - cfg.writeEntry("LastDirectory" ,QFileInfo(str).dirPath()); + cfg.readEntry("LastDirectory",QPEApplication::documentDir()),"", + types, 0 ); + if(str.left(2) == "//") { + str=str.right(str.length()-1); + } + cfg.writeEntry( "LastDirectory" ,QFileInfo( str ).dirPath() ); if( !str.isEmpty() ) { + qDebug( "Selected filename is " + str ); filename = str; DocLnk lnk; - Config cfg( "OpiePlayer" ); - cfg.setGroup("PlayList"); if( filename.right( 3) == "m3u" || filename.right(3) == "pls" ) { readListFromFile( filename ); } else { lnk.setName( QFileInfo(filename).baseName() ); //sets name lnk.setFile( filename ); //sets file name - d->selectedFiles->addToSelection( lnk); + d->selectedFiles->addToSelection( lnk ); writeCurrentM3u(); - d->selectedFiles->setSelectedItem( lnk.name()); + d->selectedFiles->setSelectedItem( lnk.name() ); } } } void PlayListWidget::readListFromFile( const QString &filename ) { qDebug( "read list filename " + filename ); QFileInfo fi(filename); Om3u *m3uList; QString s, name; m3uList = new Om3u( filename, IO_ReadOnly ); if(fi.extension(false).find("m3u",0,false) != -1 ) m3uList->readM3u(); else if(fi.extension(false).find("pls",0,false) != -1 ) m3uList->readPls(); DocLnk lnk; for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { s = *it; // qDebug(s); if(s.left(4)=="http") { lnk.setName( s ); //sets file name lnk.setIcon("opieplayer2/musicfile"); lnk.setFile( s ); //sets file name } else { //is file lnk.setName( QFileInfo(s).baseName()); if(s.left(1) != "/") { lnk.setFile( QFileInfo(filename).dirPath()+"/"+s); } else { lnk.setFile( s); } } d->selectedFiles->addToSelection( lnk ); } Config config( "OpiePlayer" ); config.setGroup( "PlayList" ); config.writeEntry("CurrentPlaylist",filename); config.write(); currentPlayList=filename; m3uList->close(); delete m3uList; d->selectedFiles->setSelectedItem( s); setCaption(tr("OpiePlayer: ")+ QFileInfo(filename).baseName()); } // writes current playlist to current m3u file */ void PlayListWidget::writeCurrentM3u() { qDebug("writing to current m3u"); Config cfg( "OpiePlayer" ); cfg.setGroup("PlayList"); QString currentPlaylist = cfg.readEntry("CurrentPlaylist","default"); Om3u *m3uList; m3uList = new Om3u( currentPlaylist, IO_ReadWrite | IO_Truncate ); if( d->selectedFiles->first()) { do { // qDebug( "add writeCurrentM3u " +d->selectedFiles->current()->file()); m3uList->add( d->selectedFiles->current()->file() ); } while ( d->selectedFiles->next() ); // qDebug( "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" ); m3uList->write(); m3uList->close(); } delete m3uList; } /* writes current playlist to m3u file */ void PlayListWidget::writem3u() { //InputDilog *fileDlg; //fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0); //fileDlg->exec(); Config cfg( "OpiePlayer" ); cfg.setGroup("Dialog"); MimeTypes types; QStringList audio, video, all; audio << "audio/*"; audio << "playlist/plain"; audio << "audio/x-mpegurl"; video << "video/*"; video << "playlist/plain"; all += audio; all += video; types.insert("All Media Files", all ); diff --git a/noncore/multimedia/opieplayer2/playlistwidget.h b/noncore/multimedia/opieplayer2/playlistwidget.h index 5230b03..fc305cd 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.h +++ b/noncore/multimedia/opieplayer2/playlistwidget.h @@ -1,143 +1,138 @@ /* This file is part of the Opie Project Copyright (c) 2002,2003 Max Reiss <harlekin@handhelds.org> Copyright (c) 2002 L. Potter <ljp@llornkcor.com> Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> =. .=l. .>+-= _;:, .> :=|. This program is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This program is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU ..}^=.= = ; General Public License for more ++= -. .` .: details. : = ...= . :.=- -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = General Public License along with -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef PLAY_LIST_WIDGET_H #define PLAY_LIST_WIDGET_H -#include <qmainwindow.h> -#include <qpe/applnk.h> -#include <qtabwidget.h> -#include <qpe/fileselector.h> + #include <qpushbutton.h> #include <qpopupmenu.h> #include <qpe/qcopenvelope_qws.h> #include "playlistwidgetgui.h" - -//class PlayListWidgetPrivate; class Config; class QListViewItem; class QListView; class QPoint; class QAction; class QLabel; class PlayListWidget : public PlayListWidgetGui { Q_OBJECT public: enum TabType { CurrentPlayList, AudioFiles, VideoFiles, PlayLists }; enum { TabTypeCount = 4 }; struct Entry { Entry( const QString &_name, const QString &_fileName ) : name( _name ), file( _fileName ) {} Entry( const QString &_fileName ) : name( _fileName ), file( _fileName ) {} QString name; QString file; }; PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* parent=0, const char* name=0 ); ~PlayListWidget(); // retrieve the current playlist entry (media file link) const DocLnk *current() const; void useSelectedDocument(); TabType currentTab() const; Entry currentEntry() const; public slots: bool first(); bool last(); bool next(); bool prev(); void writeDefaultPlaylist( ); QString currentFileListPathName() const; protected: QCopChannel * channel; void keyReleaseEvent( QKeyEvent *e); signals: void skinSelected(); private: int defaultSkinIndex; /* void readm3u(const QString &); */ /* void readPls(const QString &); */ void readListFromFile(const QString &); void initializeStates(); bool inFileListMode() const; private slots: void qcopReceive(const QCString&, const QByteArray&); void populateSkinsMenu(); void skinsMenuActivated(int); void pmViewActivated(int); void writem3u(); void writeCurrentM3u(); void openFile(); void openURL(); void setDocument( const QString& fileref ); void addToSelection( const DocLnk& ); // Add a media file to the playlist void addToSelection( QListViewItem* ); // Add a media file to the playlist void clearList(); void addAllToList(); void addAllMusicToList(); void addAllVideoToList(); void saveList(); // Save the playlist void loadList( const DocLnk &); // Load a playlist void playIt( QListViewItem *); void btnPlay(bool); void deletePlaylist(); void addSelected(); void removeSelected(); void tabChanged(QWidget*); void viewPressed( int, QListViewItem *, const QPoint&, int); void playlistViewPressed( int, QListViewItem *, const QPoint&, int); void playSelected(); private: bool fromSetDocument; bool insanityBool; QString setDocFileRef, currentPlayList; int selected; QListView *currentFileListView; }; #endif // PLAY_LIST_WIDGET_H diff --git a/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp b/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp index 5fc0c39..293bf45 100644 --- a/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp @@ -1,206 +1,194 @@ /* This file is part of the Opie Project Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> Copyright (c) 2002 L. Potter <ljp@llornkcor.com> Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> =. .=l. .>+-= _;:, .> :=|. This program is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This program is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU ..}^=.= = ; General Public License for more ++= -. .` .: details. : = ...= . :.=- -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = General Public License along with -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include <qpe/qpemenubar.h> -#include <qpe/qpetoolbar.h> -#include <qpe/fileselector.h> + +#include <qtoolbar.h> #include <qpe/qpeapplication.h> -#include <qpe/storage.h> -#include <qpe/mimetype.h> -#include <qpe/config.h> -#include <qpe/global.h> -#include <qpe/resource.h> - -#include <qpopupmenu.h> -#include <qaction.h> -#include <qcursor.h> -#include <qdir.h> + #include <qlayout.h> +#include <qmenubar.h> #include "playlistselection.h" #include "playlistwidget.h" #include "mediaplayerstate.h" #include "inputDialog.h" #include "playlistfileview.h" -//only needed for the random play -#include <stdlib.h> - #include "mediaplayerstate.h" PlayListWidgetGui::PlayListWidgetGui( MediaPlayerState &_mediaPlayerState, QWidget* parent, const char* name ) : QMainWindow( parent, name ), mediaPlayerState( _mediaPlayerState ) { d = new PlayListWidgetPrivate; d->setDocumentUsed = FALSE; setBackgroundMode( PaletteButton ); setToolBarsMovable( FALSE ); // Create Toolbar - QPEToolBar *toolbar = new QPEToolBar( this ); + QToolBar *toolbar = new QToolBar( this ); toolbar->setHorizontalStretchable( TRUE ); // Create Menubar - QPEMenuBar *menu = new QPEMenuBar( toolbar ); + QMenuBar *menu = new QMenuBar( toolbar ); menu->setMargin( 0 ); - bar = new QPEToolBar( this ); + bar = new QToolBar( this ); bar->setLabel( tr( "Play Operations" ) ); tbDeletePlaylist = new QPushButton( Resource::loadIconSet( "trash" ), "", bar, "close" ); tbDeletePlaylist->setFlat( TRUE ); tbDeletePlaylist->setFixedSize( 20, 20 ); tbDeletePlaylist->hide(); pmPlayList = new QPopupMenu( this ); menu->insertItem( tr( "File" ), pmPlayList ); pmView = new QPopupMenu( this ); menu->insertItem( tr( "View" ), pmView ); pmView->isCheckable(); skinsMenu = new QPopupMenu( this ); pmView->insertItem( tr( "Skins" ), skinsMenu ); skinsMenu->isCheckable(); gammaMenu = new QPopupMenu( this ); pmView->insertItem( tr( "Gamma (Video)" ), gammaMenu ); gammaSlider = new QSlider( QSlider::Vertical, gammaMenu ); gammaSlider->setRange( -40, 40 ); gammaSlider->setTickmarks( QSlider::Left ); gammaSlider->setTickInterval( 20 ); gammaSlider->setFocusPolicy( QWidget::StrongFocus ); gammaSlider->setValue( 0 ); gammaSlider->setMinimumHeight( 50 ); gammaLCD = new QLCDNumber( 3, gammaMenu ); gammaLCD-> setFrameShape ( QFrame::NoFrame ); gammaLCD-> setSegmentStyle ( QLCDNumber::Flat ); gammaMenu->insertItem( gammaSlider ); gammaMenu->insertItem( gammaLCD ); connect( gammaSlider, SIGNAL( valueChanged( int ) ), gammaLCD, SLOT( display( int ) ) ); vbox5 = new QVBox( this ); QVBox *vbox4 = new QVBox( vbox5 ); QHBox *hbox6 = new QHBox( vbox4 ); tabWidget = new QTabWidget( hbox6, "tabWidget" ); playListTab = new QWidget( tabWidget, "PlayListTab" ); tabWidget->insertTab( playListTab, "Playlist"); QGridLayout *Playout = new QGridLayout( playListTab ); Playout->setSpacing( 2); Playout->setMargin( 2); // Add the playlist area QVBox *vbox3 = new QVBox( playListTab ); d->playListFrame = vbox3; QHBox *hbox2 = new QHBox( vbox3 ); d->selectedFiles = new PlayListSelection( hbox2 ); vbox1 = new QVBox( hbox2 ); QPEApplication::setStylusOperation( d->selectedFiles->viewport(), QPEApplication::RightOnHold ); QVBox *stretch1 = new QVBox( vbox1 ); // add stretch Playout->addMultiCellWidget( vbox3, 0, 0, 0, 1 ); QWidget *aTab; aTab = new QWidget( tabWidget, "aTab" ); QGridLayout *Alayout = new QGridLayout( aTab ); Alayout->setSpacing( 2 ); Alayout->setMargin( 2 ); // no m3u's here please - audioView = new PlayListFileView( "audio/mpeg;audio/x-wav;audio/x-ogg", "opieplayer2/musicfile", aTab, "Audioview" ); + audioView = new PlayListFileView( "audio/mpeg;audio/x-wav;application/ogg", "opieplayer2/musicfile", aTab, "Audioview" ); Alayout->addMultiCellWidget( audioView, 0, 0, 0, 1 ); tabWidget->insertTab( aTab, tr( "Audio" ) ); QPEApplication::setStylusOperation( audioView->viewport(), QPEApplication::RightOnHold ); QWidget *vTab; vTab = new QWidget( tabWidget, "vTab" ); QGridLayout *Vlayout = new QGridLayout( vTab ); Vlayout->setSpacing( 2 ); Vlayout->setMargin( 2 ); videoView = new PlayListFileView( "video/*", "opieplayer2/videofile", vTab, "Videoview" ); Vlayout->addMultiCellWidget( videoView, 0, 0, 0, 1 ); QPEApplication::setStylusOperation( videoView->viewport(), QPEApplication::RightOnHold ); tabWidget->insertTab( vTab, tr( "Video" ) ); //playlists list QWidget *LTab; LTab = new QWidget( tabWidget, "LTab" ); QGridLayout *Llayout = new QGridLayout( LTab ); Llayout->setSpacing( 2 ); Llayout->setMargin( 2 ); playLists = new FileSelector( "playlist/plain;audio/x-mpegurl", LTab, "fileselector" , FALSE, FALSE ); Llayout->addMultiCellWidget( playLists, 0, 0, 0, 1 ); tabWidget->insertTab( LTab, tr( "Lists" ) ); setCentralWidget( vbox5 ); } PlayListWidgetGui::~PlayListWidgetGui() { } void PlayListWidgetGui::setView( char view ) { if ( view == 'l' ) showMaximized(); else hide(); } void PlayListWidgetGui::setActiveWindow() { // qDebug("SETTING active window"); // When we get raised we need to ensure that it switches views MediaPlayerState::DisplayType origDisplayType = mediaPlayerState.displayType(); mediaPlayerState.setDisplayType( MediaPlayerState::MediaSelection ); // invalidate mediaPlayerState.setDisplayType( origDisplayType ); // now switch back } diff --git a/noncore/multimedia/opieplayer2/playlistwidgetgui.h b/noncore/multimedia/opieplayer2/playlistwidgetgui.h index c965b0d..c0cd37a 100644 --- a/noncore/multimedia/opieplayer2/playlistwidgetgui.h +++ b/noncore/multimedia/opieplayer2/playlistwidgetgui.h @@ -1,133 +1,129 @@ /* This file is part of the Opie Project Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> Copyright (c) 2002 L. Potter <ljp@llornkcor.com> Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> =. .=l. .>+-= _;:, .> :=|. This program is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This program is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU ..}^=.= = ; General Public License for more ++= -. .` .: details. : = ...= . :.=- -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = General Public License along with -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef PLAY_LIST_WIDGET_GUI_H #define PLAY_LIST_WIDGET_GUI_H #include <qmainwindow.h> -#include <qpe/applnk.h> #include <qpe/resource.h> -#include <qpe/qpemenubar.h> #include <qtabwidget.h> #include <qpe/fileselector.h> -#include <qpushbutton.h> -#include <qpopupmenu.h> #include <qaction.h> +#include <qtoolbutton.h> #include <qslider.h> #include <qlcdnumber.h> class PlayListWidgetPrivate; class PlayListSelection; class MediaPlayerState; class PlayListFileView; class Config; -class QPEToolBar; +class QToolBar; class QListViewItem; class QListView; class QPoint; class QAction; class QLabel; class PlayListWidgetPrivate { public: QToolButton *tbPlay, *tbFull, *tbLoop, *tbShuffle, *tbAddToList, *tbRemoveFromList, *tbMoveUp, *tbMoveDown, *tbRemove; QFrame *playListFrame; PlayListSelection *selectedFiles; bool setDocumentUsed; }; class ToolButton : public QToolButton { Q_OBJECT public: ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE ) : QToolButton( parent, name ) { setTextLabel( name ); setPixmap( Resource::loadPixmap( icon ) ); setAutoRaise( TRUE ); setFocusPolicy( QWidget::NoFocus ); setToggleButton( t ); connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot ); - QPEMenuToolFocusManager::manager()->addWidget( this ); } }; class MenuItem : public QAction { public: MenuItem( QWidget *parent, const QString& text, QObject *handler, const QString& slot ) : QAction( text, QString::null, 0, 0 ) { connect( this, SIGNAL( activated() ), handler, slot ); addTo( parent ); } }; class PlayListWidgetGui : public QMainWindow { Q_OBJECT public: PlayListWidgetGui( MediaPlayerState &_mediaPlayerState, QWidget* parent=0, const char* name=0 ); ~PlayListWidgetGui(); protected: QTabWidget * tabWidget; PlayListFileView *audioView, *videoView; QListView *playlistView; QLabel *libString; QPopupMenu *pmView ; QPopupMenu *gammaMenu; QSlider *gammaSlider; QLCDNumber *gammaLCD; bool fromSetDocument; bool insanityBool; QString setDocFileRef; // retrieve the current playlist entry (media file link) QPushButton *tbDeletePlaylist; int selected; QPopupMenu *pmPlayList; FileSelector* playLists; QPopupMenu *skinsMenu; PlayListWidgetPrivate *d; // Private implementation data QVBox *vbox1; QVBox *vbox5; - QPEToolBar *bar; + QToolBar *bar; QWidget *playListTab; void setActiveWindow(); // need to handle this to show the right view void setView( char ); MediaPlayerState &mediaPlayerState; }; #endif diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp index 755cd22..c829e03 100644 --- a/noncore/multimedia/opieplayer2/videowidget.cpp +++ b/noncore/multimedia/opieplayer2/videowidget.cpp @@ -1,194 +1,184 @@ /* This file is part of the Opie Project Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> Copyright (c) 2002 L. Potter <ljp@llornkcor.com> Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> =. .=l. .>+-= _;:, .> :=|. This program is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This program is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU ..}^=.= = ; Library General Public License for more ++= -. .` .: details. : = ...= . :.=- -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = Library General Public License along with -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include <qpe/qpeapplication.h> -#include <qpe/resource.h> -#include <qpe/config.h> - - -#include <qwidget.h> -#include <qpainter.h> -#include <qpixmap.h> -#include <qslider.h> -#include <qdrawutil.h> #include "videowidget.h" #include "mediaplayerstate.h" #include "playlistwidget.h" #ifdef Q_WS_QWS # define USE_DIRECT_PAINTER # include <qdirectpainter_qws.h> # include <qgfxraster_qws.h> #endif namespace { const int xo = 2; // movable x offset const int yo = 0; // movable y offset const MediaWidget::SkinButtonInfo skinInfo[] = { { MediaWidget::Play, "play", MediaWidget::ToggleButton }, { MediaWidget::Stop, "stop", MediaWidget::NormalButton }, { MediaWidget::Next, "fwd", MediaWidget::NormalButton }, { MediaWidget::Previous, "back", MediaWidget::NormalButton }, { MediaWidget::VolumeUp, "up", MediaWidget::NormalButton }, { MediaWidget::VolumeDown, "down", MediaWidget::NormalButton }, { MediaWidget::FullScreen, "full", MediaWidget::ToggleButton } }; const uint buttonCount = sizeof( skinInfo ) / sizeof( skinInfo[ 0 ] ); } -VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name ) +VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name ) : MediaWidget( playList, mediaPlayerState, parent, name ), scaledWidth( 0 ), scaledHeight( 0 ), videoSliderBeingMoved( false ) { setCaption( tr("OpiePlayer - Video") ); videoFrame = new XineVideoWidget ( this, "Video frame" ); connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & ))); connect ( videoFrame, SIGNAL( clicked () ), this, SLOT ( backToNormal() ) ); slider = 0; loadSkin(); setLength( mediaPlayerState.length() ); setPosition( mediaPlayerState.position() ); setFullscreen( mediaPlayerState.isFullscreen() ); setPlaying( mediaPlayerState.isPlaying() ); } -VideoWidget::~VideoWidget() +VideoWidget::~VideoWidget() { } MediaWidget::GUIInfo VideoWidget::guiInfo() { return GUIInfo( "V" /* infix */, ::skinInfo, ::buttonCount ); } void VideoWidget::resizeEvent( QResizeEvent *e ) { int h = height(); int w = width(); //int Vh = 160; //int Vw = 220; slider->setFixedWidth( w - 20 ); slider->setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); slider->setBackgroundOrigin( QWidget::ParentOrigin ); slider->setFocusPolicy( QWidget::NoFocus ); slider->setBackgroundPixmap( backgroundPixmap ); upperLeftOfButtonMask.rx() = 0;// ( imgUp->width() ) / 2; if(w>h) upperLeftOfButtonMask.ry() = 0; else upperLeftOfButtonMask.ry() = 185;//(( Vh - imgUp->height() ) / 2) - 10; MediaWidget::resizeEvent( e ); } void VideoWidget::sliderPressed() { videoSliderBeingMoved = TRUE; } void VideoWidget::sliderReleased() { videoSliderBeingMoved = FALSE; if ( slider->width() == 0 ) { return; } long val = long((double)slider->value() * mediaPlayerState.length() / slider->width()); mediaPlayerState.setPosition( val ); } void VideoWidget::setPosition( long i ) { updateSlider( i, mediaPlayerState.length() ); } void VideoWidget::setLength( long max ) { updateSlider( mediaPlayerState.position(), max ); } void VideoWidget::setDisplayType( MediaPlayerState::DisplayType displayType ) { if ( displayType == MediaPlayerState::Video ) { makeVisible(); return; } // Effectively blank the view next time we show it so it looks nicer scaledWidth = 0; scaledHeight = 0; hide(); } void VideoWidget::loadSkin() { loadDefaultSkin( guiInfo() ); delete slider; slider = new QSlider( Qt::Horizontal, this ); slider->setMinValue( 0 ); slider->setMaxValue( 1 ); slider->setBackgroundPixmap( backgroundPixmap ); //slider->setFocusPolicy( QWidget::NoFocus ); resizeEvent( 0 ); } void VideoWidget::updateSlider( long i, long max ) { // Will flicker too much if we don't do this if ( max == 0 ) { return; } int width = slider->width(); int val = int((double)i * width / max); if ( !mediaPlayerState.isFullscreen() && !videoSliderBeingMoved ) { if ( slider->value() != val ) { slider->setValue( val ); } if ( slider->maxValue() != width ) { slider->setMaxValue( width ); } } } void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { diff --git a/noncore/multimedia/opieplayer2/videowidget.h b/noncore/multimedia/opieplayer2/videowidget.h index 84bc964..8c6896b 100644 --- a/noncore/multimedia/opieplayer2/videowidget.h +++ b/noncore/multimedia/opieplayer2/videowidget.h @@ -1,99 +1,95 @@ /* This file is part of the Opie Project Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> Copyright (c) 2002 L. Potter <ljp@llornkcor.com> Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> =. .=l. .>+-= _;:, .> :=|. This program is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This program is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU ..}^=.= = ; Library General Public License for more ++= -. .` .: details. : = ...= . :.=- -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = Library General Public License along with -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef VIDEO_WIDGET_H #define VIDEO_WIDGET_H -#include <qwidget.h> -#include <qimage.h> -#include <qpixmap.h> #include "xinevideowidget.h" - #include "mediawidget.h" class QPixmap; class QSlider; class VideoWidget : public MediaWidget { Q_OBJECT public: VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent=0, const char* name=0 ); ~VideoWidget(); static MediaWidget::GUIInfo guiInfo(); XineVideoWidget* vidWidget(); public slots: void updateSlider( long, long ); void sliderPressed( ); void sliderReleased( ); void setFullscreen( bool b ); virtual void makeVisible(); void backToNormal(); void setPosition( long ); public: virtual void setPlaying( bool b); virtual void setLength( long ); virtual void setDisplayType( MediaPlayerState::DisplayType displayType ); virtual void loadSkin(); signals: void moreClicked(); void lessClicked(); void sliderMoved( long ); void videoResized ( const QSize &s ); protected: void resizeEvent( QResizeEvent * ); void mouseReleaseEvent( QMouseEvent *event ); void keyReleaseEvent( QKeyEvent *e); private: // Ticker songInfo; QSlider *slider; QImage *currentFrame; int scaledWidth; int scaledHeight; XineVideoWidget* videoFrame; bool videoSliderBeingMoved; }; #endif // VIDEO_WIDGET_H diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp index 1c489e3..a392f4a 100644 --- a/noncore/multimedia/opieplayer2/xinecontrol.cpp +++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp @@ -1,272 +1,272 @@ /* This file is part of the Opie Project Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> Copyright (c) 2002 L. Potter <ljp@llornkcor.com> Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> =. .=l. .>+-= _;:, .> :=|. This program is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This program is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU ..}^=.= = ; General Public License for more ++= -. .` .: details. : = ...= . :.=- -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = General Public License along with -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <qtimer.h> #include <qmessagebox.h> #include <qpe/qcopenvelope_qws.h> #include <qpe/qpeapplication.h> + #include "xinecontrol.h" #include "mediaplayerstate.h" #include "xinevideowidget.h" -XineControl::XineControl( XineVideoWidget *xineWidget, - MediaPlayerState &_mediaPlayerState, +XineControl::XineControl( XineVideoWidget *xineWidget, + MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name ) : QObject( parent, name ), mediaPlayerState( _mediaPlayerState ), xineVideoWidget( xineWidget ) { libXine = new XINE::Lib( XINE::Lib::InitializeImmediately, xineWidget ); init(); } -XineControl::XineControl( XINE::Lib *xine, XineVideoWidget *xineWidget, - MediaPlayerState &_mediaPlayerState, +XineControl::XineControl( XINE::Lib *xine, XineVideoWidget *xineWidget, + MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name ) : QObject( parent, name ), libXine( xine ), mediaPlayerState( _mediaPlayerState ), xineVideoWidget( xineWidget ) { xine->ensureInitialized(); xine->setWidget( xineWidget ); init(); } void XineControl::init() { connect( &mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pause( bool ) ) ); connect( this, SIGNAL( positionChanged( long ) ), &mediaPlayerState, SLOT( updatePosition( long ) ) ); connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) ); connect( &mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) ); connect( &mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) ); connect( &mediaPlayerState, SIGNAL( videoGammaChanged( int ) ), this, SLOT( setGamma( int ) ) ); connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) ); connect( xineVideoWidget, SIGNAL( videoResized( const QSize & ) ), this, SLOT( videoResized ( const QSize & ) ) ); disabledSuspendScreenSaver = FALSE; } XineControl::~XineControl() { #if defined(Q_WS_QWS) && !defined(QT_NO_COP) if ( disabledSuspendScreenSaver ) { disabledSuspendScreenSaver = FALSE; // Re-enable the suspend mode QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; } #endif delete libXine; } void XineControl::play( const QString& fileName ) { + hasVideoChannel = FALSE; hasAudioChannel = FALSE; m_fileName = fileName; qDebug("<<FILENAME: " + fileName + ">>>>"); if ( !libXine->play( fileName, 0, 0 ) ) { QMessageBox::warning( 0l , tr( "Failure" ), getErrorCode() ); // toggle stop so the the play button is reset mediaPlayerState.setPlaying( false ); return; } mediaPlayerState.setPlaying( true ); MediaPlayerState::DisplayType displayType; - // qDebug( QString( "libXine->hasVideo() return : %1 ").arg( libXine->hasVideo() ) ); if ( !libXine->hasVideo() ) { displayType = MediaPlayerState::Audio; qDebug("HAS AUDIO"); libXine->setShowVideo( false ); hasAudioChannel = TRUE; } else { displayType = MediaPlayerState::Video; qDebug("HAS VIDEO"); libXine->setShowVideo( true ); hasVideoChannel = TRUE; } // determine if slider is shown mediaPlayerState.setIsSeekable( libXine->isSeekable() ); // which gui (video / audio) mediaPlayerState.setDisplayType( displayType ); #if defined(Q_WS_QWS) && !defined(QT_NO_COP) if ( !disabledSuspendScreenSaver ) { disabledSuspendScreenSaver = TRUE; // Stop the screen from blanking and power saving state QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << ( displayType == MediaPlayerState::Video ? QPEApplication::Disable : QPEApplication::DisableSuspend ); } #endif length(); position(); } void XineControl::nextMedia() { mediaPlayerState.setNext(); } void XineControl::setGamma( int value ) { libXine->setGamma( value ); } void XineControl::stop( bool isSet ) { if ( !isSet ) { libXine->stop(); #if defined(Q_WS_QWS) && !defined(QT_NO_COP) if ( disabledSuspendScreenSaver ) { disabledSuspendScreenSaver = FALSE; // Re-enable the suspend mode QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; } #endif } } /** * Pause playback * @isSet */ void XineControl::pause( bool isSet) { libXine->pause( isSet ); } /** * get current time in playback */ long XineControl::currentTime() { // todo: jede sekunde überprüfen m_currentTime = libXine->currentTime(); return m_currentTime; QTimer::singleShot( 1000, this, SLOT( currentTime() ) ); } /** * Set the length of the media file */ void XineControl::length() { m_length = libXine->length(); mediaPlayerState.setLength( m_length ); } /** * Reports the position the xine backend is at right now * @return long the postion in seconds */ long XineControl::position() { m_position = ( currentTime() ); mediaPlayerState.updatePosition( m_position ); long emitPos = (long)m_position; emit positionChanged( emitPos ); if( mediaPlayerState.isPlaying() ) { // needs to be stopped the media is stopped QTimer::singleShot( 1000, this, SLOT( position() ) ); } - // qDebug("POSITION : %d", m_position); return m_position; } /** * Set videoplayback to fullscreen * @param isSet */ void XineControl::setFullscreen( bool isSet ) { libXine->showVideoFullScreen( isSet ); } QString XineControl::getMetaInfo() { QString returnString; if ( !libXine->metaInfo( 0 ).isEmpty() ) { returnString += tr( " Title: " + libXine->metaInfo( 0 ) ); } if ( !libXine->metaInfo( 1 ).isEmpty() ) { returnString += tr( " Comment: " + libXine->metaInfo( 1 ) ); } if ( !libXine->metaInfo( 2 ).isEmpty() ) { returnString += tr( " Artist: " + libXine->metaInfo( 2 ) ); } if ( !libXine->metaInfo( 3 ).isEmpty() ) { returnString += tr( " Genre: " + libXine->metaInfo( 3 ) ); } if ( !libXine->metaInfo( 4 ).isEmpty() ) { returnString += tr( " Album: " + libXine->metaInfo( 4 ) ); } if ( !libXine->metaInfo( 5 ).isEmpty() ) { returnString += tr( " Year: " + libXine->metaInfo( 5 ) ); } return returnString; } QString XineControl::getErrorCode() { int errorCode = libXine->error(); qDebug( QString("ERRORCODE: %1 ").arg(errorCode) ); if ( errorCode == 1 ) { return tr( "No input plugin found for this media type" ); } else if ( errorCode == 2 ) { return tr( "No demux plugin found for this media type" ); } else if ( errorCode == 3 ) { return tr( "Demuxing failed for this media type" ); } else if ( errorCode == 4 ) { return tr( "Malformed MRL" ); } else { return tr( "Some other error" ); } } /** * Seek to a position in the track * @param second the second to jump to */ void XineControl::seekTo( long second ) { libXine->seekTo( (int)second ); } void XineControl::videoResized ( const QSize &s ) { libXine->resize( s ); } diff --git a/noncore/multimedia/opieplayer2/xinecontrol.h b/noncore/multimedia/opieplayer2/xinecontrol.h index 0e985d6..3f44f2e 100644 --- a/noncore/multimedia/opieplayer2/xinecontrol.h +++ b/noncore/multimedia/opieplayer2/xinecontrol.h @@ -1,127 +1,126 @@ /* This file is part of the Opie Project Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> Copyright (c) 2002 L. Potter <ljp@llornkcor.com> Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> =. .=l. .>+-= _;:, .> :=|. This program is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This program is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU ..}^=.= = ; General Public License for more ++= -. .` .: details. : = ...= . :.=- -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = General Public License along with -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef XINECONTROL_H #define XINECONTROL_H #include "lib.h" -#include <qobject.h> #include "mediaplayerstate.h" class XineControl : public QObject { Q_OBJECT public: XineControl( XineVideoWidget *xineWidget, MediaPlayerState &_mediaPlayerState, QObject *parent = 0, const char *name =0 ); // note that this constructor takes over ownership of the passed // XINE::Lib object. XineControl( XINE::Lib *xine, XineVideoWidget *xineWidget, MediaPlayerState &_mediaPlayerState, QObject *parent = 0, const char *name =0 ); ~XineControl(); bool hasVideo() const { return hasVideoChannel; } bool hasAudio() const { return hasAudioChannel; } public slots: void play( const QString& fileName ); void stop( bool ); /** * Pause the media stream * @param if pause or not */ void pause( bool ); /** * Set videos fullscreen * @param yes or no */ void setFullscreen( bool ); /** * */ long currentTime(); void seekTo( long ); // get length of media file and set it void length(); long position(); /** * Proceed to the next media file in playlist */ void nextMedia(); /** * Get as much info about the stream from xine as possible */ QString getMetaInfo(); /** * get the error code and "translate" it for the user * */ QString getErrorCode(); void videoResized ( const QSize &s ); /** * Set the gamma value of the video output * @param int value between -100 and 100, 0 is original */ void setGamma( int ); private: void init(); XINE::Lib *libXine; long m_currentTime; long m_position; int m_length; QString m_fileName; bool disabledSuspendScreenSaver : 1; bool hasVideoChannel : 1; bool hasAudioChannel : 1; MediaPlayerState &mediaPlayerState; XineVideoWidget *xineVideoWidget; signals: void positionChanged( long ); }; #endif diff --git a/noncore/multimedia/opieplayer2/yuv2rgb_arm2.c b/noncore/multimedia/opieplayer2/yuv2rgb_arm2.c new file mode 100644 index 0000000..cbd32e8 --- a/dev/null +++ b/noncore/multimedia/opieplayer2/yuv2rgb_arm2.c @@ -0,0 +1,875 @@ +/* + * yuv2rgb_arm2.c + * Copyright (C) 2002 Frederic 'dilb' Boulay. + * All Rights Reserved. + * + * Author: Frederic Boulay <dilb@handhelds.org> + * + * you can redistribute this file and/or modify + * it under the terms of the GNU General Public License (version 2) + * as published by the Free Software Foundation. + * + * This file is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * + * The function defined in this file, are derived from work done in the xine + * project. + * In order to improve performance, by strongly reducing memory bandwidth + * needed, the scaling functions are merged with the yuv2rgb function. + */ + +#ifdef __arm__ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <inttypes.h> + +#include "yuv2rgb.h" +#include <xine/xineutils.h> + +/* Prototypes of the "local" functions available here: */ +/* first prototype, function called when no scaling is needed: */ +static void arm_rgb16_noscale(yuv2rgb_t*, uint8_t*, uint8_t*, uint8_t*, uint8_t*); +/* second prototype, function called when no horizontal scaling is needed: */ +static void arm_rgb16_step_dx_32768(yuv2rgb_t*, uint8_t*, uint8_t*, uint8_t*, uint8_t*); +/* third prototype, function called when scaling is needed for zooming in: */ +static void arm_rgb16_step_dx_inf_32768(yuv2rgb_t*, uint8_t*, uint8_t*, uint8_t*, uint8_t*); +/* fourth prototype, function called when scaling is needed for zooming out (between 1x and 2x): */ +static void arm_rgb16_step_dx_bet_32768_65536(yuv2rgb_t*, uint8_t*, uint8_t*, uint8_t*, uint8_t*); +/* fifth prototype, function called when scaling is needed for zooming out (greater than 2x): */ +static void arm_rgb16_step_dx_sup_65536(yuv2rgb_t*, uint8_t*, uint8_t*, uint8_t*, uint8_t*); +/* sixth prototype, function where the decision of the scaling function to use is made.*/ +static void arm_rgb16_2 (yuv2rgb_t*, uint8_t*, uint8_t*, uint8_t*, uint8_t*); + + + + +/* extern function: */ + +/* Function: */ +void yuv2rgb_init_arm (yuv2rgb_factory_t *this) +/* This function initialise the member yuv2rgb_fun, if everything is right +the function optimised for the arm target should be used.*/ + { + if (this->swapped) + return; /*no swapped pixel output upto now*/ + + switch (this->mode) + { + case MODE_16_RGB: + this->yuv2rgb_fun = arm_rgb16_2; + break; + default: + } + } + + + +/* local functions: */ + +/* Function: */ +static void arm_rgb16_2 (yuv2rgb_t *this, uint8_t * _dst, uint8_t * _py, uint8_t * _pu, uint8_t * _pv) +/* This function takes care of applying the right scaling conversion +(yuv2rgb is included in each scaling function!)*/ + { + if (!this->do_scale) + { + arm_rgb16_noscale(this, _dst, _py, _pu, _pv); + return; + } + if (this->step_dx<32768) + { + arm_rgb16_step_dx_inf_32768(this, _dst, _py, _pu, _pv); + return; + } + if (this->step_dx==32768) + { + arm_rgb16_step_dx_32768(this, _dst, _py, _pu, _pv); + return; + } + if (this->step_dx<65536) + { + arm_rgb16_step_dx_bet_32768_65536(this, _dst, _py, _pu, _pv); + return; + } + arm_rgb16_step_dx_sup_65536(this, _dst, _py, _pu, _pv); + return; + } + + +/* Function: */ +static void arm_rgb16_noscale(yuv2rgb_t *this, uint8_t * _dst, uint8_t * _py, uint8_t * _pu, uint8_t * _pv) +/* This function is called when the source and the destination pictures have the same size. + In this case, scaling part is not needed. + (This code is probably far from being optimised, in particular, the asm + generated is not the most efficient, a pure asm version will probably + emerge sooner or later). But at least, this version is faster than what + was used before.*/ + { + int height; + + height=this->dest_height; + + while (height>0) + { + uint16_t *r, *g, *b; + uint8_t *py, *py2, *pu, *pv; + uint16_t *dst, *dst2; + int width; + register uint8_t p1y, p1u, p1v; + + height-=2; + width=this->dest_width; + dst = _dst; + dst2 = _dst + this->rgb_stride; + py = _py; + py2 = _py + this->y_stride; + pu = _pu; + pv = _pv; + + while (width>0) + { + width-=2; + p1y=*py++; + p1u=*pu++; + p1v=*pv++; + + r = this->table_rV[p1v]; + g = (void *) (((uint8_t *)this->table_gU[p1u]) + this->table_gV[p1v]); + b = this->table_bU[p1u]; + + *dst++ = r[p1y] + g[p1y] + b[p1y]; + p1y=*py++; + *dst++ = r[p1y] + g[p1y] + b[p1y]; + + p1y=*py2++; + + *dst2++ = r[p1y] + g[p1y] + b[p1y]; + p1y=*py2++; + *dst2++ = r[p1y] + g[p1y] + b[p1y]; + } + _dst += (this->rgb_stride)<<1; + _py += (this->y_stride)<<1; + _pu += this->uv_stride; + _pv += this->uv_stride; + } + } + + +/* Function: */ +static void arm_rgb16_step_dx_inf_32768(yuv2rgb_t *this, uint8_t * _dst, uint8_t * _py, uint8_t * _pu, uint8_t * _pv) +/* This function is called when the destination picture is bigger than the size + of the source picture. +*/ + { + int recal_uv, height; /* Note about recal_uv: bit0 is for +applying scale on u and v, bit1 is for increments of u and v pointers.*/ + int dy; + + dy = 0; + height = this->dest_height; + recal_uv=1; // 1 for evaluation of scale_line, needed the first time + + while(1) + { + register int dxy; + register int dxuv; + register uint8_t p1y, p2y; + uint8_t dest1y, dest2y; + register uint8_t p1u, p2u; + register uint8_t p1v, p2v; + uint8_t dest1u; + uint8_t dest1v; + int width; + uint8_t *u_buffer; + uint8_t *v_buffer; + uint16_t *r, *g, *b; + uint8_t *py, *pu, *pv; + uint16_t *dst; + + dxy = 0; + dxuv = 0; + width = this->dest_width; + u_buffer=this->u_buffer; + v_buffer=this->v_buffer; + dst = (uint16_t*)_dst; + py = _py; + pu = _pu; + pv = _pv; + + //proceed with line scaling/conversion + if ((recal_uv&1)!=0) + { + recal_uv^=1; //reset bit0. + // init values: + p1u = *pu++; + p2u = *pu++; + p1v = *pv++; + p2v = *pv++; + p1y = *py++; + p2y = *py++; + + //width loop (compute all data for a line). + while (width>0) + { + // proceed with u and v first (ok, and y too finally :)) [scaling part]: + // evaluate 1u, 1v, and 2y + //block1_uvy + dest1u=p1u + ((dxuv*(p2u-p1u))>>15); + dest1v=p1v + ((dxuv*(p2v-p1v))>>15); + // as u and v are evaluated, better save them now + *u_buffer++ = (uint8_t)dest1u; + *v_buffer++ = (uint8_t)dest1v; + + dest1y=p1y + ((dxy*(p2y-p1y))>>15); + + dxuv += this->step_dx; + dxy += this->step_dx; + if (dxuv > 32768) + { + dxuv -= 32768; + p1u = p2u; + p2u = *pu++; //idee pour asm, cf cas then, un merge est possible!!! + p1v = p2v; + p2v = *pv++; + } + if (dxy > 32768) + { + dxy -= 32768; + p1y = p2y; + p2y = *py++; + } + //end block1_uvy + + //block2_y + dest2y=p1y + ((dxy*(p2y-p1y))>>15); + + dxy += this->step_dx; + if (dxy > 32768) + { + dxy -= 32768; + p1y = p2y; + p2y = *py++; // idee pour asm, cf cas then, un merge est possible!!! + } + //end block2_y + + // proceed now with YUV2RGB [conversion part]: + // u and v are currently in dest1u and dest1v + // the 2 y are in dest1y and dest2y. + // RGB(0),DST1(0), RGB(1), DST1(1) + r = this->table_rV[dest1v]; + g = (void *) (((uint8_t *)this->table_gU[dest1u]) + this->table_gV[dest1v]); + b = this->table_bU[dest1u]; + + *dst++ = r[dest1y] + g[dest1y] + b[dest1y]; + *dst++ = r[dest2y] + g[dest2y] + b[dest2y]; + + width -=2; + } + } + else + { + // this case is simple, u and v are already evaluated, + // Note pour moi: r, g et b pourraient etre reutilises!! + + // init values: + p1y = *py++; + p2y = *py++; + + //width loop (compute all data for a line). + while (width>0) + { + // proceed with y [scaling part]: + // evaluate 2y + //block1_y + dest1y=p1y + ((dxy*(p2y-p1y))>>15); + + dxy += this->step_dx; + if (dxy > 32768) + { + dxy -= 32768; + p1y = p2y; + p2y = *py++; + } + //end block1_uvy + + //block2_y + dest2y=p1y + ((dxy*(p2y-p1y))>>15); + + dxy += this->step_dx; + if (dxy > 32768) + { + dxy -= 32768; + p1y = p2y; + p2y = *py++; // idee pour asm, cf cas then, un merge est possible!!! + } + //end block2_y + + // proceed now with YUV2RGB [conversion part]: + // u and v are currently in dest1u and dest1v + // the 2 y are in dest1y and dest2y. + // RGB(0),DST1(0) + dest1u=*u_buffer++; + dest1v=*v_buffer++; + r = this->table_rV[dest1v]; + g = (void *) (((uint8_t *)this->table_gU[dest1u]) + this->table_gV[dest1v]); + b = this->table_bU[dest1u]; + + *dst++ = r[dest1y] + g[dest1y] + b[dest1y]; + *dst++ = r[dest2y] + g[dest2y] + b[dest2y]; + + width -=2; + } + } + // end of line scaling/conversion + dy += this->step_dy; + _dst += this->rgb_stride; + + while (--height > 0 && dy < 32768) + { + xine_fast_memcpy (_dst, (uint8_t*)_dst-this->rgb_stride, this->dest_width*2); // *2 because of int8 cast! + dy += this->step_dy; + _dst += this->rgb_stride; + } + + + if (height <= 0) + break; + + do + { + dy -= 32768; + _py += this->y_stride; + + recal_uv^=2; /*bit 0 for reevaluation of scanline, bit 1 for offset.*/ + + if ((recal_uv&2)==0) + { + _pu += this->uv_stride; + _pv += this->uv_stride; + recal_uv|=1; // if update, then reevaluate scanline! + } + } + while( dy>=32768); + } + } + + + +/* Function: */ +static void arm_rgb16_step_dx_32768(yuv2rgb_t *this, uint8_t * _dst, uint8_t * _py, uint8_t * _pu, uint8_t * _pv) +/* This function is called when the widht of the destination picture is the + same as the size of the source picture. +*/ + { + int recal_uv, height; + int dy; + + dy = 0; + height=this->dest_height; + recal_uv=0; + + while (1) + { + uint16_t *r, *g, *b; + uint8_t *py, *pu, *pv; + uint16_t *dst; + int width; + register uint8_t p1y, p1u, p1v; + + width=this->dest_width; + dst = (uint16_t*)_dst; + py = _py; + pu = _pu; + pv = _pv; + + while (width>0) + { + width-=2; + p1y=*py++; + p1u=*pu++; + p1v=*pv++; + + r = this->table_rV[p1v]; + g = (void *) (((uint8_t *)this->table_gU[p1u]) + this->table_gV[p1v]); + b = this->table_bU[p1u]; + + *dst++ = r[p1y] + g[p1y] + b[p1y]; + p1y=*py++; + *dst++ = r[p1y] + g[p1y] + b[p1y]; + } + + + + // end of line scaling/conversion + dy += this->step_dy; + _dst += this->rgb_stride; + + while (--height > 0 && dy < 32768) + { + xine_fast_memcpy (_dst, (uint8_t*)_dst-this->rgb_stride, this->dest_width*2); // *2 because of int8 cast! + dy += this->step_dy; + _dst += this->rgb_stride; + } + + + if (height <= 0) + break; + + do + { + dy -= 32768; + _py += this->y_stride; + + recal_uv^=2; /*bit 0 for reevaluation of scanline, bit 1 for offset.*/ + + if ((recal_uv&2)==0) + { + _pu += this->uv_stride; + _pv += this->uv_stride; + recal_uv|=1; // if update, then reevaluate scanline! + } + } + while( dy>=32768); + } + } + + + +/* Function: */ +static void arm_rgb16_step_dx_bet_32768_65536(yuv2rgb_t *this, uint8_t * _dst, uint8_t * _py, uint8_t * _pu, uint8_t * _pv) +/* This function is called when the destination picture is between the size + of the source picture, and half its size. +*/ + { + int recal_uv, height; /* Note about recal_uv: bit0 is for +applying scale on u and v, bit1 is for increments of u and v pointers.*/ + int dy; + + dy = 0; + height = this->dest_height; + recal_uv=1; // 1 for evaluation of scale_line, needed the first time + + while(1) + { + register int dxy; + register int dxuv; + register uint8_t p1y, p2y; + uint8_t dest1y, dest2y; + register uint8_t p1u, p2u; + register uint8_t p1v, p2v; + uint8_t dest1u; + uint8_t dest1v; + int width; + uint8_t *u_buffer; + uint8_t *v_buffer; + uint16_t *r, *g, *b; + uint8_t *py, *pu, *pv; + uint16_t *dst; + + dxy = 0; + dxuv = 0; + width = this->dest_width; + u_buffer=this->u_buffer; + v_buffer=this->v_buffer; + dst = (uint16_t*)_dst; + py = _py; + pu = _pu; + pv = _pv; + + //proceed with line scaling/conversion + if ((recal_uv&1)!=0) + { + recal_uv^=1; //reset bit0. + // init values: + p1u = *pu++; + p2u = *pu++; + p1v = *pv++; + p2v = *pv++; + p1y = *py++; + p2y = *py++; + + //width loop (compute all data for a line). + while (width>0) + { + // proceed with u and v first (ok, and y too finally :)) [scaling part]: + // evaluate 1u, 1v, and 2y + //block1_uvy + dest1u=p1u + ((dxuv*(p2u-p1u))>>15); + dest1v=p1v + ((dxuv*(p2v-p1v))>>15); + // as u and v are evaluated, better save them now + *u_buffer++ = (uint8_t)dest1u; + *v_buffer++ = (uint8_t)dest1v; + + dest1y=p1y + ((dxy*(p2y-p1y))>>15); + + dxuv += this->step_dx; + dxy += this->step_dx; + if (dxuv > 65536) + { + dxuv -= 65536; + p1u = *pu++; + p2u = *pu++; + p1v = *pv++; + p2v = *pv++; + } + else + { + dxuv -= 32768; + p1u = p2u; + p2u = *pu++; //idee pour asm, cf cas then, un merge est possible!!! + p1v = p2v; + p2v = *pv++; + } + if (dxy > 65536) + { + dxy -= 65536; + p1y = *py++; + p2y = *py++; + } + else + { + dxy -= 32768; + p1y = p2y; + p2y = *py++; + } + //end block1_uvy + + //block2_y + dest2y=p1y + ((dxy*(p2y-p1y))>>15); + + dxy += this->step_dx; + if (dxy > 65536) + { + dxy -= 65536; + p1y = *py++; + p2y = *py++; + } + else + { + dxy -= 32768; + p1y = p2y; + p2y = *py++; // idee pour asm, cf cas then, un merge est possible!!! + } + //end block2_y + + // proceed now with YUV2RGB [conversion part]: + // u and v are currently in dest1u and dest1v + // the 2 y are in dest1y and dest2y. + // RGB(0),DST1(0), RGB(1), DST1(1) + r = this->table_rV[dest1v]; + g = (void *) (((uint8_t *)this->table_gU[dest1u]) + this->table_gV[dest1v]); + b = this->table_bU[dest1u]; + + *dst++ = r[dest1y] + g[dest1y] + b[dest1y]; + *dst++ = r[dest2y] + g[dest2y] + b[dest2y]; + + width -=2; + } + } + else + { + // this case is simple, u and v are already evaluated, + // Note pour moi: r, g et b pourraient etre reutilises!! + + // init values: + p1y = *py++; + p2y = *py++; + + //width loop (compute all data for a line). + while (width>0) + { + // proceed with y [scaling part]: + // evaluate 2y + //block1_y + dest1y=p1y + ((dxy*(p2y-p1y))>>15); + + dxy += this->step_dx; + if (dxy > 65536) + { + dxy -= 65536; + p1y = *py++; + p2y = *py++; + } + else + { + dxy -= 32768; + p1y = p2y; + p2y = *py++; + } + //end block1_uvy + + //block2_y + dest2y=p1y + ((dxy*(p2y-p1y))>>15); + + dxy += this->step_dx; + if (dxy > 65536) + { + dxy -= 65536; + p1y = *py++; + p2y = *py++; + } + else + { + dxy -= 32768; + p1y = p2y; + p2y = *py++; // idee pour asm, cf cas then, un merge est possible!!! + } + //end block2_y + + // proceed now with YUV2RGB [conversion part]: + // u and v are currently in dest1u and dest1v + // the 2 y are in dest1y and dest2y. + // RGB(0),DST1(0) + dest1u=*u_buffer++; + dest1v=*v_buffer++; + r = this->table_rV[dest1v]; + g = (void *) (((uint8_t *)this->table_gU[dest1u]) + this->table_gV[dest1v]); + b = this->table_bU[dest1u]; + + *dst++ = r[dest1y] + g[dest1y] + b[dest1y]; + *dst++ = r[dest2y] + g[dest2y] + b[dest2y]; + + width -=2; + } + } + // end of line scaling/conversion + dy += this->step_dy; + _dst += this->rgb_stride; + + while (--height > 0 && dy < 32768) + { + xine_fast_memcpy (_dst, (uint8_t*)_dst-this->rgb_stride, this->dest_width*2); // *2 because of int8 cast! + dy += this->step_dy; + _dst += this->rgb_stride; + } + + + if (height <= 0) + break; + + do + { + dy -= 32768; + _py += this->y_stride; + + recal_uv^=2; /*bit 0 for reevaluation of scanline, bit 1 for offset.*/ + + if ((recal_uv&2)==0) + { + _pu += this->uv_stride; + _pv += this->uv_stride; + recal_uv|=1; // if update, then reevaluate scanline! + } + } + while( dy>=32768); + } + } + + + +/* Function: */ +static void arm_rgb16_step_dx_sup_65536(yuv2rgb_t *this, uint8_t * _dst, uint8_t * _py, uint8_t * _pu, uint8_t * _pv) +/* This function is called when the destination picture is smaller than half + the size of the source picture, and half its size. +*/ + { + int recal_uv, height; /* Note about recal_uv: bit0 is for +applying scale on u and v, bit1 is for increments of u and v pointers.*/ + int dy; + + dy = 0; + height = this->dest_height; + recal_uv=1; // 1 for evaluation of scale_line, needed the first time + + while(1) + { + register int dxy; + register int dxuv; + int offdxy, offdxuv; + register uint8_t p1y, p2y; + uint8_t dest1y, dest2y; + register uint8_t p1u, p2u; + register uint8_t p1v, p2v; + uint8_t dest1u; + uint8_t dest1v; + int width; + uint8_t *u_buffer; + uint8_t *v_buffer; + uint16_t *r, *g, *b; + uint8_t *py, *pu, *pv; + uint16_t *dst; + + dxy = 0; + dxuv = 0; + width = this->dest_width; + u_buffer=this->u_buffer; + v_buffer=this->v_buffer; + dst = (uint16_t*)_dst; + py = _py; + pu = _pu; + pv = _pv; + + //proceed with line scaling/conversion + if ((recal_uv&1)!=0) + { + recal_uv^=1; //reset bit0. + // init values: + p1u = *pu++; + p2u = *pu++; + p1v = *pv++; + p2v = *pv++; + p1y = *py++; + p2y = *py++; + + //width loop (compute all data for a line). + while (width>0) + { + // proceed with u and v first (ok, and y too finally :)) [scaling part]: + // evaluate 1u, 1v, and 2y + //block1_uvy + dest1u=p1u + ((dxuv*(p2u-p1u))>>15); + dest1v=p1v + ((dxuv*(p2v-p1v))>>15); + // as u and v are evaluated, better save them now + *u_buffer++ = (uint8_t)dest1u; + *v_buffer++ = (uint8_t)dest1v; + + dest1y=p1y + ((dxy*(p2y-p1y))>>15); + + dxuv += this->step_dx; + dxy += this->step_dx; + + offdxuv=((dxuv-1)>>15); + dxuv-=offdxuv<<15; + pu+=offdxuv-2; + pv+=offdxuv-2; + p1u = *pu++; + p2u = *pu++; + p1v = *pv++; + p2v = *pv++; + offdxy=((dxy-1)>>15); + dxy-=offdxy<<15; + py+=offdxy-2; + p1y = *py++; + p2y = *py++; + + //block2_y + dest2y=p1y + ((dxy*(p2y-p1y))>>15); + + dxy += this->step_dx; + offdxy=((dxy-1)>>15); + dxy-=offdxy<<15; + py+=offdxy-2; + p1y = *py++; + p2y = *py++; + + // proceed now with YUV2RGB [conversion part]: + // u and v are currently in dest1u and dest1v + // the 2 y are in dest1y and dest2y. + // RGB(0),DST1(0), RGB(1), DST1(1) + r = this->table_rV[dest1v]; + g = (void *) (((uint8_t *)this->table_gU[dest1u]) + this->table_gV[dest1v]); + b = this->table_bU[dest1u]; + + *dst++ = r[dest1y] + g[dest1y] + b[dest1y]; + *dst++ = r[dest2y] + g[dest2y] + b[dest2y]; + + width -=2; + } + } + else + { + // this case is simple, u and v are already evaluated, + // Note pour moi: r, g et b pourraient etre reutilises!! + + // init values: + p1y = *py++; + p2y = *py++; + + //width loop (compute all data for a line). + while (width>0) + { + // proceed with y [scaling part]: + // evaluate 2y + //block1_y + dest1y=p1y + ((dxy*(p2y-p1y))>>15); + + dxy += this->step_dx; + offdxy=((dxy-1)>>15); + dxy-=offdxy<<15; + py+=offdxy-2; + p1y = *py++; + p2y = *py++; + + //end block1_uvy + + //block2_y + dest2y=p1y + ((dxy*(p2y-p1y))>>15); + + dxy += this->step_dx; + offdxy=((dxy-1)>>15); + dxy-=offdxy<<15; + py+=offdxy-2; + p1y = *py++; + p2y = *py++; + //end block2_y + + // proceed now with YUV2RGB [conversion part]: + // u and v are currently in dest1u and dest1v + // the 2 y are in dest1y and dest2y. + // RGB(0),DST1(0) + dest1u=*u_buffer++; + dest1v=*v_buffer++; + r = this->table_rV[dest1v]; + g = (void *) (((uint8_t *)this->table_gU[dest1u]) + this->table_gV[dest1v]); + b = this->table_bU[dest1u]; + + *dst++ = r[dest1y] + g[dest1y] + b[dest1y]; + *dst++ = r[dest2y] + g[dest2y] + b[dest2y]; + + width -=2; + } + } + // end of line scaling/conversion + dy += this->step_dy; + _dst += this->rgb_stride; + + while (--height > 0 && dy < 32768) + { + xine_fast_memcpy (_dst, (uint8_t*)_dst-this->rgb_stride, this->dest_width*2); // *2 because of int8 cast! + dy += this->step_dy; + _dst += this->rgb_stride; + } + + + if (height <= 0) + break; + + do + { + dy -= 32768; + _py += this->y_stride; + + recal_uv^=2; /*bit 0 for reevaluation of scanline, bit 1 for offset.*/ + + if ((recal_uv&2)==0) + { + _pu += this->uv_stride; + _pv += this->uv_stride; + recal_uv|=1; // if update, then reevaluate scanline! + } + } + while( dy>=32768); + } + } + + +#endif diff --git a/noncore/multimedia/opierec/opierec.control b/noncore/multimedia/opierec/opierec.control index 96c1b69..a1a2b7e 100644 --- a/noncore/multimedia/opierec/opierec.control +++ b/noncore/multimedia/opierec/opierec.control @@ -1,10 +1,10 @@ -Package: opie-rec +Package: opierec Files: bin/opierec pics/opierec apps/Applications/opierec.desktop Priority: optional Section: multimedia/applications Maintainer: L.J. Potter <ljp@llornkcor.com> Architecture: arm -Version: 1.5-2 -Depends: task-opie-minimal +Depends: opie ($QPE_VERSION) Description: audio sampling recorder A simple audio recording/playing application. +Version: $QPE_VERSION$EXTRAVERSION diff --git a/noncore/multimedia/opierec/qtrec.cpp b/noncore/multimedia/opierec/qtrec.cpp index 0307d99..147f63d 100644 --- a/noncore/multimedia/opierec/qtrec.cpp +++ b/noncore/multimedia/opierec/qtrec.cpp @@ -356,654 +356,654 @@ void playIt() { QtRec::QtRec( QWidget* parent, const char* name, WFlags fl ) : QWidget( parent, name, fl ) { // QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << true; // mute device // autoMute=TRUE; // QPEApplication::grabKeyboard(); // signal(SIGPIPE, SIG_IGN); if ( !name ) setName( "OpieRec" ); init(); initConfig(); initConnections(); renameBox = 0; // open sound device to get volumes soundDevice = new Device( this, DSPSTROUT, DSPSTRMIXEROUT, false); // soundDevice->setDeviceFormat(AFMT_S16_LE); // soundDevice->setDeviceChannels(1); // soundDevice->setDeviceRate( 22050); getInVol(); getOutVol(); soundDevice->closeDevice( true); soundDevice->sd=-1; soundDevice=0; wavFile=0; if(soundDevice) delete soundDevice; initIconView(); if(autoMute) doMute(true); ListView1->setFocus(); playing=false; } QtRec::~QtRec() { } void QtRec::cleanUp() { if(!stopped) { stopped=true; endRecording(); } ListView1->clear(); if(autoMute) doMute(false); if(wavFile) delete wavFile; // if(soundDevice) delete soundDevice; // QPEApplication::grabKeyboard(); // QPEApplication::ungrabKeyboard(); } void QtRec::init() { needsStereoOut=false; QPixmap image3( ( const char** ) image3_data ); QPixmap image4( ( const char** ) image4_data ); QPixmap image6( ( const char** ) image6_data ); stopped=true; setCaption( tr( "OpieRecord " ) + QString::number(VERSION) ); QGridLayout *layout = new QGridLayout( this ); layout->setSpacing( 2); layout->setMargin( 2); TabWidget = new QTabWidget( this, "TabWidget" ); layout->addMultiCellWidget(TabWidget, 0, 7, 0, 7); // TabWidget->setTabShape(QTabWidget::Triangular); ///**********<<<<<<<<<<<<>>>>>>>>>>>>*************** tab = new QWidget( TabWidget, "tab" ); QGridLayout *layout1 = new QGridLayout( tab); layout1->setSpacing( 2); layout1->setMargin( 2); timeSlider = new QSlider( 0,100,10,0, QSlider::Horizontal, tab, (const char *) "timeSlider" ); // timeSlider->setFixedWidth(150); layout1->addMultiCellWidget( timeSlider, 1, 1, 0, 3); // timeSlider->setTickmarks(QSlider::Above); timeLabel = new QLabel( tab, "TimeLabel" ); layout1->addMultiCellWidget( timeLabel, 0, 0, 0, 3); playLabel2 = new QLabel(tab, "PlayLabel2" ); - playLabel2->setText("Play"); + playLabel2->setText(tr("Play") ); playLabel2->setFixedHeight(18); layout1->addMultiCellWidget( playLabel2, 0, 0, 4, 4); Stop_PushButton = new QPushButton( tab, "Stop_PushButton" ); layout1->addMultiCellWidget( Stop_PushButton, 1, 1, 4, 4); Stop_PushButton->setFixedSize(22,22); Stop_PushButton->setPixmap( image4 ); toBeginningButton = new QPushButton( tab, "Beginning_PushButton" ); layout1->addMultiCellWidget(toBeginningButton, 1, 1, 5, 5); toBeginningButton->setFixedSize(22,22); toBeginningButton->setPixmap( Resource::loadPixmap("fastback") ); toEndButton = new QPushButton( tab, "End_PushButton" ); layout1->addMultiCellWidget( toEndButton, 1, 1, 6, 6); toEndButton->setFixedSize(22,22); toEndButton->setPixmap( Resource::loadPixmap( "fastforward" ) ); QLabel *recLabel2; recLabel2 = new QLabel( tab, "recLabel2" ); - recLabel2->setText("Rec"); + recLabel2->setText(tr("Rec")); recLabel2->setFixedHeight(18); layout1->addMultiCellWidget( recLabel2, 0, 0, 7, 7); Rec_PushButton = new QPushButton( tab, "Rec_PushButton" ); layout1->addMultiCellWidget( Rec_PushButton, 1, 1, 7, 7); Rec_PushButton->setFixedSize(22,22); Rec_PushButton->setPixmap( image6 ); t = new QTimer( this ); connect( t, SIGNAL( timeout() ), SLOT( timerBreak() ) ); rewindTimer = new QTimer( this ); connect( rewindTimer, SIGNAL( timeout() ), SLOT( rewindTimerTimeout() ) ); forwardTimer = new QTimer( this ); connect( forwardTimer, SIGNAL( timeout() ), SLOT( forwardTimerTimeout() ) ); deleteSoundButton = new QPushButton( tab, "deleteSoundButton" ); layout1->addMultiCellWidget( deleteSoundButton, 1, 1, 8, 8); deleteSoundButton->setText( tr( "Delete" ) ); ListView1 = new QListView( tab, "IconView1" ); layout1->addMultiCellWidget( ListView1, 2, 2, 0, 8); ListView1->addColumn( tr( "Name" ) ); ListView1->setColumnWidth(0,140); ListView1->setSorting( 1, false); ListView1->addColumn( tr( "Time" ) ); //in seconds ListView1->setColumnWidth(1,50); - ListView1->addColumn( "Location"); + ListView1->addColumn( tr("Location") ); ListView1->setColumnWidth(2,50); - ListView1->addColumn( "Date"); + ListView1->addColumn( tr("Date") ); ListView1->setColumnWidth(3,63); ListView1->setColumnWidthMode(0,QListView::Manual); ListView1->setColumnAlignment(1,QListView::AlignCenter); ListView1->setColumnAlignment(2,QListView::AlignRight); ListView1->setColumnAlignment(3,QListView::AlignLeft); ListView1->setAllColumnsShowFocus( true ); QPEApplication::setStylusOperation( ListView1->viewport(),QPEApplication::RightOnHold); TabWidget->insertTab( tab, tr( "Files" ) ); ///**********<<<<<<<<<<<<>>>>>>>>>>>>*************** tab_3 = new QWidget( TabWidget, "tab_3" ); //////////////////////////////////// Layout19 = new QHBoxLayout( tab_3); Layout19->setSpacing( 2 ); Layout19->setMargin( 0 ); Layout18 = new QVBoxLayout(this); Layout18->setSpacing( 2 ); Layout18->setMargin( 0 ); Layout17 = new QHBoxLayout(this); Layout17->setSpacing( 2 ); Layout17->setMargin( 0 ); sampleGroup = new QGroupBox( tab_3, "samplegroup" ); sampleGroup->setTitle( tr( "Sample Rate" ) ); sampleGroup->setFixedSize( 95,50); sampleRateComboBox = new QComboBox( false, sampleGroup, "SampleRateComboBox" ); sampleRateComboBox->setGeometry( QRect( 10, 20, 80, 25 ) ); //#ifndef QT_QWS_EBX sampleRateComboBox->insertItem( tr( "44100")); sampleRateComboBox->insertItem( tr( "32000")); //#endif sampleRateComboBox->insertItem( tr( "22050")); //#ifndef QT_QWS_VERCEL_IDR sampleRateComboBox->insertItem( tr( "16000")); sampleRateComboBox->insertItem( tr( "11025")); sampleRateComboBox->insertItem( tr( "8000")); //#endif Layout17->addWidget( sampleGroup ); sizeGroup= new QGroupBox( tab_3, "sizeGroup" ); sizeGroup->setTitle( tr( "Limit Size" ) ); sizeGroup->setFixedSize(80,50); sizeLimitCombo = new QComboBox( false, sizeGroup, "sizeLimitCombo" ); sizeLimitCombo ->setGeometry( QRect( 5, 20, 70, 25 ) ); sizeLimitCombo->insertItem(tr("Unlimited")); for(int i=1;i<13; i++) { sizeLimitCombo->insertItem( QString::number(i*5)); } // sizeLimitCombo->insertItem(tr("5 secs")); // sizeLimitCombo->insertItem(tr("10 secs")); // sizeLimitCombo->insertItem(tr("15 secs")); // sizeLimitCombo->insertItem(tr("20 secs")); // Layout18->addWidget( sizeGroup ); Layout17->addWidget( sizeGroup ); Layout18->addLayout( Layout17 ); Layout16 = new QHBoxLayout(this); Layout16->setSpacing( 2 ); Layout16->setMargin( 0 ); dirGroup = new QGroupBox( tab_3, "dirGroup" ); dirGroup->setTitle( tr( "File Directory" ) ); dirGroup->setFixedSize(130,50); directoryComboBox = new QComboBox( false, dirGroup, "dirGroup" ); directoryComboBox->setGeometry( QRect( 10, 15, 115, 25 ) ); Layout18->addWidget( dirGroup ); bitGroup = new QGroupBox( tab_3, "bitGroup" ); bitGroup->setTitle( tr( "Bit Depth" ) ); bitGroup->setFixedSize(65,50); bitRateComboBox = new QComboBox( false, bitGroup, "BitRateComboBox" ); bitRateComboBox->insertItem( tr( "16" ) ); bitRateComboBox->insertItem( tr( "8" ) ); bitRateComboBox->setGeometry( QRect( 5, 20, 50, 25 ) ); Layout18->addWidget( bitGroup ); - compressionCheckBox = new QCheckBox ( "Wave Compression (smaller files)", tab_3 ); + compressionCheckBox = new QCheckBox ( tr("Wave Compression (smaller files)"), tab_3 ); Layout18->addWidget( compressionCheckBox ); - autoMuteCheckBox= new QCheckBox ( "auto Mute", tab_3 ); + autoMuteCheckBox= new QCheckBox ( tr("auto Mute"), tab_3 ); Layout18->addWidget( autoMuteCheckBox ); Layout19->addLayout( Layout18 ); QWidget *d = QApplication::desktop(); int width=d->width(); int height=d->height(); if( width < height) { tab_5 = new QWidget( TabWidget, "tab_5" ); QHBoxLayout *Layout19a; Layout19a = new QHBoxLayout( tab_5); Layout19a->setSpacing( 2 ); Layout19a->setMargin( 0 ); Layout15 = new QVBoxLayout(this); Layout15->setSpacing( 2 ); Layout15->setMargin( 0 ); Layout15b = new QVBoxLayout(this); Layout15b->setSpacing( 2 ); Layout15b->setMargin( 0 ); TextLabel2 = new QLabel( tab_5, "InputLabel" ); TextLabel2->setText( tr( "In")); TextLabel2->setFixedWidth(35); Layout15->addWidget( TextLabel2 ); TextLabel3 = new QLabel( tab_5, "OutputLabel" ); TextLabel3->setText( tr( "Out" ) ); Layout15b->addWidget( TextLabel3 ); InputSlider = new QSlider( -100, 0, 10, 0, QSlider::Vertical, tab_5, (const char *) "InputSlider" ); InputSlider->setTickmarks(QSlider::Both); Layout15->addWidget( InputSlider); OutputSlider = new QSlider( -100,0,10,0, QSlider::Vertical,tab_5,(const char *) "OutputSlider" ); OutputSlider->setTickmarks(QSlider::Both); Layout15b->addWidget( OutputSlider ); - outMuteCheckBox = new QCheckBox ( "mute", tab_5 ); + outMuteCheckBox = new QCheckBox ( tr("mute"), tab_5 ); Layout15->addWidget( outMuteCheckBox ); - inMuteCheckBox = new QCheckBox ( "mute", tab_5 ); + inMuteCheckBox = new QCheckBox ( tr("mute"), tab_5 ); inMuteCheckBox-> setFocusPolicy ( QWidget::NoFocus ); Layout15b->addWidget( inMuteCheckBox ); Layout19a->addLayout( Layout15 ); Layout19a->addLayout( Layout15b ); fillDirectoryCombo(); TabWidget->insertTab( tab_3, tr( "Options" ) ); TabWidget->insertTab( tab_5, tr( "Volume" ) ); } else {// landscape // Layout16->addWidget( dirGroup ); // Layout18->addLayout( Layout16 ); Layout15 = new QVBoxLayout(this); Layout15->setSpacing( 2 ); Layout15->setMargin( 0 ); Layout15b = new QVBoxLayout(this); Layout15b->setSpacing( 2 ); Layout15b->setMargin( 0 ); TextLabel2 = new QLabel( tab_3, "InputLabel" ); TextLabel2->setText( tr( "In")); TextLabel2->setFixedWidth(35); Layout15->addWidget( TextLabel2 ); TextLabel3 = new QLabel( tab_3, "OutputLabel" ); TextLabel3->setText( tr( "Out" ) ); Layout15b->addWidget( TextLabel3 ); InputSlider = new QSlider( -100, 0, 10, 0, QSlider::Vertical, tab_3, (const char *) "InputSlider" ); // InputSlider->setTickmarks(QSlider::Both); Layout15->addWidget( InputSlider); OutputSlider = new QSlider( -100,0,10,0, QSlider::Vertical,tab_3,(const char *) "OutputSlider" ); // OutputSlider->setTickmarks(QSlider::Both); Layout15b->addWidget( OutputSlider ); - outMuteCheckBox = new QCheckBox ( "mute", tab_3 ); + outMuteCheckBox = new QCheckBox ( tr("mute"), tab_3 ); Layout15->addWidget( outMuteCheckBox ); - inMuteCheckBox = new QCheckBox ( "mute", tab_3 ); + inMuteCheckBox = new QCheckBox ( tr("mute"), tab_3 ); inMuteCheckBox-> setFocusPolicy ( QWidget::NoFocus ); Layout15b->addWidget( inMuteCheckBox ); Layout19->addLayout( Layout15 ); Layout19->addLayout( Layout15b ); fillDirectoryCombo(); TabWidget->insertTab( tab_3, tr( "Options" ) ); } ///**********<<<<<<<<<<<<>>>>>>>>>>>>*************** // tab_4 = new QWidget( TabWidget, "tab_4" ); // QGridLayout *layout4 = new QGridLayout( tab_4); // layout4->setSpacing( 2); // layout4->setMargin( 2); // TabWidget->insertTab( tab_4, tr( "Help")); // ///////////////////////////////////////////// FIXME change to a real helpfile path // QString url="/index.html"; // HelpWindow *help = new HelpWindow( url, ".", tab_4, "opierec_help"); // layout4->addMultiCellWidget( help, 0, 1, 0, 1); // if( !QFile(url).exists()) { // help->hide(); // //help->showMaximized(); // QLabel *helpLabel; // helpLabel = new QLabel( tab_4, "TimeLabel" ); // layout4->addMultiCellWidget( helpLabel, 0, 3, 0, 4 ); // helpLabel->setText( "<B>OpieRec</B><br>" // "Records files in standard wav format<br>" // "or a compressed version<br>" // "For help, please email the author<br>" // "<B>OpieRec</B> is copyright© 2002 by" // " L.J. Potter<br>llornkcor@handhelds.org<BR>" // "and is licensed under the <B>QPL</B>"); // } ///**********<<<<<<<<<<<<>>>>>>>>>>>>*************** } void QtRec::initIconView() { ListView1->clear(); Config cfg("OpieRec"); cfg.setGroup("Sounds"); QString temp; QPixmap image0( ( const char** ) image0_data ); int nFiles = cfg.readNumEntry("NumberofFiles",0); for(int i=1;i<= nFiles;i++) { QListViewItem * item; QString fileS, mediaLocation, fileDate, filePath; // temp.sprintf("%d",i); temp=cfg.readEntry(temp,""); //reads currentFile filePath = cfg.readEntry(temp,""); //currentFileName QFileInfo info(filePath); fileDate = info.lastModified().toString(); fileS = cfg.readEntry( filePath, "0" );// file length in seconds mediaLocation=getStorage( filePath); if(info.exists()) { item = new QListViewItem( ListView1, temp, fileS, mediaLocation, fileDate); item->setPixmap( 0, image0); if(currentFileName == filePath) ListView1->setSelected( item, true); } } } void QtRec::initConnections() { connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); connect( toBeginningButton, SIGNAL( pressed()), this, SLOT( rewindPressed() )); connect( toBeginningButton, SIGNAL( released()), this, SLOT( rewindReleased() )); connect( toEndButton, SIGNAL( pressed()), this, SLOT( FastforwardPressed() )); connect( toEndButton, SIGNAL( released()), this, SLOT( FastforwardReleased() )); connect( deleteSoundButton, SIGNAL(released()), this, SLOT( deleteSound() )); connect( Stop_PushButton, SIGNAL(released()), this, SLOT( doPlayBtn() )); connect( Rec_PushButton, SIGNAL(released()), this, SLOT( newSound() ) ); connect( TabWidget, SIGNAL( currentChanged( QWidget*)),this, SLOT(thisTab(QWidget*) )); connect( OutputSlider, SIGNAL(sliderReleased()), this, SLOT( changedOutVolume()) ); connect( InputSlider, SIGNAL(sliderReleased()), this, SLOT( changedInVolume()) ); // connect( OutputSlider, SIGNAL(valueChanged( int)), this, SLOT(changedOutVolume(int)) ); // connect( InputSlider, SIGNAL(valueChanged( int)), this, SLOT(changedInVolume(int)) ); connect( sampleRateComboBox, SIGNAL(activated( int)), this, SLOT( changesamplerateCombo(int)) ); connect( bitRateComboBox, SIGNAL(activated( int)), this, SLOT( changebitrateCombo(int)) ); connect( directoryComboBox, SIGNAL(activated( int)), this, SLOT( changeDirCombo(int)) ); connect( sizeLimitCombo, SIGNAL(activated( int)), this, SLOT( changeSizeLimitCombo(int)) ); connect( outMuteCheckBox, SIGNAL(toggled( bool)), this, SLOT( doVolMuting(bool)) ); connect( inMuteCheckBox , SIGNAL(toggled( bool)), this, SLOT( doMicMuting(bool)) ); connect( ListView1,SIGNAL(doubleClicked( QListViewItem*)),this,SLOT( itClick(QListViewItem*))); connect( ListView1, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), this,SLOT( listPressed(int, QListViewItem *, const QPoint&, int)) ); connect( timeSlider, SIGNAL( sliderMoved( int)), this, SLOT( changeTimeSlider(int) )); connect( timeSlider, SIGNAL( sliderPressed( )), this, SLOT( timeSliderPressed() )); connect( timeSlider, SIGNAL( sliderReleased( )), this, SLOT( timeSliderReleased() )); connect( compressionCheckBox, SIGNAL( toggled(bool)),this, SLOT( compressionSelected(bool))); connect( autoMuteCheckBox, SIGNAL( toggled(bool)),this, SLOT( slotAutoMute(bool))); } void QtRec::initConfig() { int index, fred, i; Config cfg("OpieRec"); cfg.setGroup("Settings"); index = cfg.readNumEntry("samplerate",22050); bool ok; for(int ws=0;ws<sampleRateComboBox->count();ws++) { fred = sampleRateComboBox->text(ws).toInt(&ok, 10); if(index == fred) { filePara.sampleRate = fred; sampleRateComboBox->setCurrentItem(ws); } } i=cfg.readNumEntry("bitrate",16); if(i == 16) bitRateComboBox->setCurrentItem( 0); else bitRateComboBox->setCurrentItem( 1); filePara.resolution = i; i=cfg.readNumEntry("sizeLimit", 5 ); QString temp; // for(int i=1;i<13; i++) { // temp = sizeLimitCombo->text(i); // sizeLimitCombo->insertItem( QString::number(i*5)+tr(" secs")); // } sizeLimitCombo->setCurrentItem((i/5)); compressionCheckBox->setChecked( cfg.readBoolEntry("wavCompression",1)); if( compressionCheckBox->isChecked()) { bitRateComboBox->setEnabled(false); bitRateComboBox->setCurrentItem(0); filePara.resolution=16; } autoMuteCheckBox->setChecked( cfg.readBoolEntry("useAutoMute",0)); if( autoMuteCheckBox->isChecked()) slotAutoMute(true); else slotAutoMute(false); Config cofg( "qpe"); cofg.setGroup( "Volume"); outMuteCheckBox->setChecked( cofg.readBoolEntry( "Mute",0)); inMuteCheckBox->setChecked( cofg.readBoolEntry( "MicMute",0)); } //================ void QtRec::stop() { qDebug("<<<<<<<<<stop()"); setRecordButton(false); monitoring=false; stopped=true; if( !recording) endPlaying(); else endRecording(); timeSlider->setValue(0); // QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << true; // mute device } void QtRec::doPlayBtn() { if(!stopped) { - playLabel2->setText("Play"); + playLabel2->setText(tr("Play")); stop(); } else { if(ListView1->currentItem() == 0) return; - playLabel2->setText("Stop"); + playLabel2->setText(tr("Stop")); currentFile = ListView1->currentItem()->text(0); start(); } } void QtRec::start() { //play if(stopped) { qDebug("start::"); QPixmap image3( ( const char** ) image3_data ); Stop_PushButton->setPixmap( image3 ); Stop_PushButton->setDown(true); stopped=false; paused=false; secCount=1; if( openPlayFile()) if( setupAudio( false)) //recording is false doPlay(); } } bool QtRec::rec() { //record qDebug("rec()"); if(!stopped) { qDebug("rec:: !stopped"); monitoring=true; return false; } else { qDebug("go ahead and record"); secCount=1; - playLabel2->setText("Stop"); + playLabel2->setText(tr("Stop")); monitoring=false; setRecordButton(true); stopped=false; if( setupAudio( true)) if(setUpFile()) { qDebug("Ok to start recording"); int fileSize=0; Config cfg("OpieRec"); cfg.setGroup("Settings"); qDebug( "<<<<<<<Device bits %d, device rate %d, device channels %d", soundDevice->getDeviceBits(), soundDevice->getDeviceRate(), soundDevice->getDeviceChannels()); //filePara.sampleRate = cfg.readNumEntry("samplerate", 22050); qDebug("sample rate is %d", filePara.sampleRate); filePara.SecondsToRecord = getCurrentSizeLimit(); qDebug("size limit %d sec", filePara.SecondsToRecord); int diskSize = checkDiskSpace( (const QString &) wavFile->trackName()); if( filePara.SecondsToRecord == 0) { fileSize = diskSize; } else if( filePara.format==WAVE_FORMAT_PCM) { qDebug("WAVE_FORMAT_PCM"); fileSize = (filePara.SecondsToRecord ) * filePara.channels * filePara.sampleRate *(filePara.resolution/8)+1000; } else { qDebug("WAVE_FORMAT_DVI_ADPCM"); fileSize = ((filePara.SecondsToRecord) * filePara.channels * filePara.sampleRate *(filePara.resolution/8) )/4+250; } filePara.samplesToRecord = fileSize; qDebug("filesize should be %d, bits %d, rate %d", filePara.samplesToRecord, filePara.resolution, filePara.sampleRate); if(paused) { paused = false; } // else { qDebug("Setting timeslider %d", filePara.samplesToRecord); // if(fileSize != 0) timeSlider->setRange(0, filePara.samplesToRecord); // } if( diskSize < fileSize/1024) { QMessageBox::warning(this, tr("Low Disk Space"), tr("You are running low of\nrecording space\n" "or a card isn't being recognized")); stopped = true; //we need to be stopped stop(); } else { QString msg; msg.sprintf("%d, %d, %d", filePara.sampleRate, filePara.channels, filePara.resolution); #ifdef DEV_VERSION setCaption( msg); #endif filePara.fileName=currentFile.latin1(); qDebug("Start recording thread"); pthread_t thread1; pthread_create( &thread1, NULL, (void * (*)(void *))quickRec, NULL/* &*/); // quickRec(); toBeginningButton->setEnabled(false); toEndButton->setEnabled(false); startTimer(1000); } } //end setUpFile } //end setupAudio // _exit( 0); // ///* default: // // /* pid greater than zero is parent getting the child's pid */ // /* printf("Child's pid is %d\n",pid); // waitpid( pid, &status, 0); // printf("Child[%d] exited with status %d\n", pid, status);*/ // while (wait(NULL) != pid) // ; // printf("child %ld terminated normally, return status is zero\n", (long) pid); // endRecording(); /* else { //device was not opened qDebug("Audio device open failed"); return false; } }*/ // } //end fork // } // } return true; } /* This happens when a tab is selected*/ void QtRec::thisTab(QWidget* widg) { @@ -2066,189 +2066,189 @@ void QtRec::rewindTimerTimeout() { void QtRec::rewindReleased() { rewindTimer->stop(); if( wavFile->track.isOpen()) { sliderPos=timeSlider->value(); stopped = false; int newPos = lseek( filePara.fd, sliderPos, SEEK_SET); total = newPos*4; // qDebug("rewind released %d", total); startTimer(1000); doPlay(); } } void QtRec::FastforwardPressed() { if(ListView1->currentItem() == 0) return; if( !wavFile->track.isOpen()) if( !openPlayFile() ) return; else if( !setupAudio( false)) return; killTimers(); paused = true; stopped = true; forwardTimer->start(50, false); } void QtRec::forwardTimerTimeout() { int sliderValue = timeSlider->value(); sliderValue = sliderValue +(filePara.numberSamples/100); // if(toEndButton->isDown()) timeSlider->setValue(sliderValue); QString timeString; filePara.numberOfRecordedSeconds=(float)sliderValue/(float)filePara.sampleRate*(float)2; timeString.sprintf( "%.2f", filePara.numberOfRecordedSeconds); timeLabel->setText( timeString+ tr(" seconds")); } void QtRec::FastforwardReleased() { forwardTimer->stop(); if( wavFile->track.isOpen()) { sliderPos=timeSlider->value(); stopped = false; int newPos = lseek( filePara.fd, sliderPos, SEEK_SET); total = newPos*4; filePara.numberOfRecordedSeconds=(float)sliderPos/(float)filePara.sampleRate*(float)2; startTimer(1000); doPlay(); } } QString QtRec::getStorage(const QString &fileName) { StorageInfo storageInfo; const QList<FileSystem> &fs = storageInfo.fileSystems(); QListIterator<FileSystem> it ( fs ); QString storage; for( ; it.current(); ++it ){ const QString name = (*it)->name(); const QString path = (*it)->path(); const QString disk = (*it)->disk(); if( fileName.find(path,0,true) != -1) storage=name; // const QString options = (*it)->options(); // if( name.find( tr("Internal"),0,true) == -1) { // storageComboBox->insertItem( name +" -> "+disk); // qDebug(name); } return storage; // struct mntent *me; // // if(fileName == "/etc/mtab") { // FILE *mntfp = setmntent( fileName.latin1(), "r" ); // if ( mntfp ) { // while ( (me = getmntent( mntfp )) != 0 ) { // QString filesystemType = me->mnt_type; // } // } // endmntent( mntfp ); } void QtRec::setRecordButton(bool b) { if(b) { //about to record or play Rec_PushButton->setDown(true); QPixmap image3( ( const char** ) image3_data ); Stop_PushButton->setPixmap( image3 ); if(Stop_PushButton->isDown()) Stop_PushButton->setDown(true); - playLabel2->setText("Stop"); + playLabel2->setText(tr("Stop") ); } else { //about to stop QPixmap image4( ( const char** ) image4_data ); Stop_PushButton->setPixmap( image4); if(Stop_PushButton->isDown()) Stop_PushButton->setDown(false); - playLabel2->setText("Play"); + playLabel2->setText(tr("Play") ); if(Rec_PushButton->isDown()) Rec_PushButton->setDown( false); } } void QtRec::fillDirectoryCombo() { if( directoryComboBox->count() > 0) directoryComboBox->clear(); int index=0; Config cfg("OpieRec"); cfg.setGroup("Settings"); QString dir= cfg.readEntry("directory", "/"); StorageInfo storageInfo; const QList<FileSystem> &fs = storageInfo.fileSystems(); QListIterator<FileSystem> it ( fs ); QString storage; for( ; it.current(); ++it ){ const QString name = (*it)->name(); const QString path = (*it)->path(); // directoryComboBox->insertItem(name+" "+path); directoryComboBox->insertItem(name); if(path==dir) directoryComboBox->setCurrentItem(index); index++; } } void QtRec::errorStop() { stopped = true; wavFile->closeFile(); killTimers(); } void QtRec::doMute(bool b) { doVolMuting( b); doMicMuting( b); } void QtRec::slotAutoMute(bool b) { autoMute=b; Config cfg("OpieRec"); cfg.setGroup("Settings"); cfg.writeEntry("useAutoMute",b); doMute(b); outMuteCheckBox->setChecked( b); inMuteCheckBox->setChecked( b); } void QtRec::selectItemByName(const QString & name) { QListViewItemIterator it( ListView1 ); for ( ; it.current(); ++it ) if(name == it.current()->text(0)) ListView1->setCurrentItem(it.current()); } long findPeak(long input ) { // halfLife = time in seconds for output to decay to half value after an impulse static float output = 0.0; int halfLife = .25; float vsf = .0025; float scalar = pow( 0.5, 1.0/(halfLife * filePara.sampleRate )); if( input < 0.0 ) input = -input; // Absolute value. if ( input >= output ) { // When we hit a peak, ride the peak to the top. output = input; } else { // Exponential decay of output when signal is low. output = output * scalar; // // When current gets close to 0.0, set current to 0.0 to prevent FP underflow // which can cause a severe performance degradation due to a flood // of interrupts. // if( output < vsf ) output = 0.0; } return output; } diff --git a/noncore/multimedia/showimg/opie-showimg.control b/noncore/multimedia/showimg/opie-showimg.control index 9dacd94..c543335 100644 --- a/noncore/multimedia/showimg/opie-showimg.control +++ b/noncore/multimedia/showimg/opie-showimg.control @@ -1,11 +1,11 @@ Package: opie-showimg Files: bin/showimg apps/Applications/showimg.desktop pics/imageviewer Priority: optional Section: opie/applications Maintainer: Warwick Allison <warwick@trolltech.com> Architecture: arm -Version: $QPE_VERSION-$SUB_VERSION Depends: task-opie-minimal Description: Image Viewer The image viewer for the Opie environment. Supports Whichever formats are compiled into Qt/Embedded (eg. PNG). +Version: $QPE_VERSION$EXTRAVERSION |