Diffstat (limited to 'noncore/multimedia/opieplayer2') (more/less context) (ignore whitespace changes)
23 files changed, 976 insertions, 214 deletions
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 @@ -30,22 +30,8 @@ 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" @@ -189,9 +175,9 @@ void AudioWidget::loadSkin() // QColor backgroundcolor = QColor( cofg.readEntry( "Background", "#E5E1D5" ) ); time.setFocusPolicy( QWidget::NoFocus ); time.setAlignment( Qt::AlignCenter ); - + // time.setFrame(FALSE); // changeTextColor( &time ); resizeEvent( 0 ); 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 @@ -33,16 +33,9 @@ #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" 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 @@ -30,15 +30,11 @@ 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> @@ -71,9 +67,9 @@ extern "C" { } using namespace XINE; -Lib::Lib( InitializationMode initMode, XineVideoWidget* widget ) +Lib::Lib( InitializationMode initMode, XineVideoWidget* widget ) { m_initialized = false; m_duringInitialization = false; m_video = false; @@ -87,8 +83,18 @@ Lib::Lib( InitializationMode initMode, XineVideoWidget* widget ) 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 ) { @@ -138,9 +144,9 @@ void Lib::initialize() 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; } @@ -190,10 +196,18 @@ int Lib::subVersion() { } 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); @@ -242,17 +256,38 @@ 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 ); @@ -365,11 +400,9 @@ void Lib::setScaling( bool 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 ); 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 @@ -33,14 +33,9 @@ #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; 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,16 +1,9 @@ #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" @@ -18,16 +11,14 @@ #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 ) { 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 @@ -33,11 +33,8 @@ #ifndef MEDIA_PLAYER_H #define MEDIA_PLAYER_H -#include <qmainwindow.h> -#include <qframe.h> - #include "xinecontrol.h" #include "playlistwidget.h" #include "skin.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 @@ -19,8 +19,10 @@ 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" 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 @@ -73,17 +73,11 @@ void Om3u::readM3u() { 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); } } } } @@ -146,9 +140,9 @@ void Om3u::remove(const QString &filePath) { //removes from m3u list 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() ); 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 @@ -3,9 +3,9 @@ Files: bin/opieplayer2 apps/Applications/mediaplayer.desktop pics/opieplayer2/a 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 @@ -10,9 +10,9 @@ 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 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 @@ -30,23 +30,13 @@ 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" @@ -54,9 +44,8 @@ #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 ) @@ -666,8 +655,9 @@ void PlayListWidget::openFile() { MimeTypes types; QStringList audio, video, all; audio << "audio/*"; audio << "playlist/plain"; + audio << "application/ogg"; audio << "audio/x-mpegurl"; video << "video/*"; video << "playlist/plain"; @@ -678,29 +668,30 @@ void PlayListWidget::openFile() { 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() ); } } } 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 @@ -33,20 +33,15 @@ #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; 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 @@ -30,33 +30,21 @@ 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 ) { @@ -67,16 +55,16 @@ PlayListWidgetGui::PlayListWidgetGui( MediaPlayerState &_mediaPlayerState, QWidg 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 ); @@ -147,9 +135,9 @@ PlayListWidgetGui::PlayListWidgetGui( MediaPlayerState &_mediaPlayerState, QWidg 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 ); 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 @@ -34,17 +34,14 @@ #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; @@ -52,9 +49,9 @@ class PlayListSelection; class MediaPlayerState; class PlayListFileView; class Config; -class QPEToolBar; +class QToolBar; class QListViewItem; class QListView; class QPoint; class QAction; @@ -79,9 +76,8 @@ public: 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 { @@ -120,9 +116,9 @@ protected: 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 ); 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 @@ -30,18 +30,8 @@ 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" @@ -73,9 +63,9 @@ const MediaWidget::SkinButtonInfo skinInfo[] = 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") ); @@ -94,9 +84,9 @@ VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye setPlaying( mediaPlayerState.isPlaying() ); } -VideoWidget::~VideoWidget() +VideoWidget::~VideoWidget() { } MediaWidget::GUIInfo VideoWidget::guiInfo() 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 @@ -33,13 +33,9 @@ #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; 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 @@ -35,24 +35,25 @@ #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(); @@ -87,8 +88,9 @@ XineControl::~XineControl() { delete libXine; } void XineControl::play( const QString& fileName ) { + hasVideoChannel = FALSE; hasAudioChannel = FALSE; m_fileName = fileName; @@ -102,9 +104,8 @@ void XineControl::play( const QString& fileName ) { } 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 ); @@ -196,9 +197,8 @@ long XineControl::position() { 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; } /** 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 @@ -34,9 +34,8 @@ #ifndef XINECONTROL_H #define XINECONTROL_H #include "lib.h" -#include <qobject.h> #include "mediaplayerstate.h" class XineControl : public QObject { 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 |