-rw-r--r-- | noncore/multimedia/opieplayer2/lib.cpp | 4 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.cpp | 12 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.h | 6 |
3 files changed, 20 insertions, 2 deletions
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp index 299239b..8896cfe 100644 --- a/noncore/multimedia/opieplayer2/lib.cpp +++ b/noncore/multimedia/opieplayer2/lib.cpp | |||
@@ -49,103 +49,105 @@ | |||
49 | #include "frame.h" | 49 | #include "frame.h" |
50 | #include "lib.h" | 50 | #include "lib.h" |
51 | 51 | ||
52 | 52 | ||
53 | typedef void (*display_xine_frame_t) (void *user_data, uint8_t* frame, | 53 | typedef void (*display_xine_frame_t) (void *user_data, uint8_t* frame, |
54 | int width, int height,int bytes ); | 54 | int width, int height,int bytes ); |
55 | 55 | ||
56 | extern "C" { | 56 | extern "C" { |
57 | xine_vo_driver_t* init_video_out_plugin( xine_t *xine, void* video, display_xine_frame_t, void * ); | 57 | xine_vo_driver_t* init_video_out_plugin( xine_t *xine, void* video, display_xine_frame_t, void * ); |
58 | int null_is_showing_video( const xine_vo_driver_t* self ); | 58 | int null_is_showing_video( const xine_vo_driver_t* self ); |
59 | void null_set_show_video( const xine_vo_driver_t* self, int show ); | 59 | void null_set_show_video( const xine_vo_driver_t* self, int show ); |
60 | int null_is_fullscreen( const xine_vo_driver_t* self ); | 60 | int null_is_fullscreen( const xine_vo_driver_t* self ); |
61 | void null_set_fullscreen( const xine_vo_driver_t* self, int screen ); | 61 | void null_set_fullscreen( const xine_vo_driver_t* self, int screen ); |
62 | int null_is_scaling( const xine_vo_driver_t* self ); | 62 | int null_is_scaling( const xine_vo_driver_t* self ); |
63 | void null_set_scaling( const xine_vo_driver_t* self, int scale ); | 63 | void null_set_scaling( const xine_vo_driver_t* self, int scale ); |
64 | void null_set_gui_width( const xine_vo_driver_t* self, int width ); | 64 | void null_set_gui_width( const xine_vo_driver_t* self, int width ); |
65 | void null_set_gui_height( const xine_vo_driver_t* self, int height ); | 65 | void null_set_gui_height( const xine_vo_driver_t* self, int height ); |
66 | void null_set_mode( const xine_vo_driver_t* self, int depth, int rgb ); | 66 | void null_set_mode( const xine_vo_driver_t* self, int depth, int rgb ); |
67 | void null_set_videoGamma( const xine_vo_driver_t* self , int value ); | 67 | void null_set_videoGamma( const xine_vo_driver_t* self , int value ); |
68 | void null_display_handler( const xine_vo_driver_t* self, display_xine_frame_t t, void* user_data ); | 68 | void null_display_handler( const xine_vo_driver_t* self, display_xine_frame_t t, void* user_data ); |
69 | } | 69 | } |
70 | 70 | ||
71 | using namespace XINE; | 71 | using namespace XINE; |
72 | 72 | ||
73 | Lib::Lib( InitializationMode initMode, XineVideoWidget* widget ) | 73 | Lib::Lib( InitializationMode initMode, XineVideoWidget* widget ) |
74 | { | 74 | { |
75 | m_initialized = false; | 75 | m_initialized = false; |
76 | m_duringInitialization = false; | 76 | m_duringInitialization = false; |
77 | m_video = false; | 77 | m_video = false; |
78 | m_wid = widget; | 78 | m_wid = widget; |
79 | printf("Lib"); | 79 | printf("Lib"); |
80 | QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf"; | 80 | QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf"; |
81 | // get the configuration | 81 | // get the configuration |
82 | 82 | ||
83 | // not really OO, should be an extra class, later | 83 | // not really OO, should be an extra class, later |
84 | if ( !QFile::exists(configPath) ) { | 84 | if ( !QFile::exists(configPath) ) { |
85 | QFile f(configPath); | 85 | QFile f(configPath); |
86 | f.open(IO_WriteOnly); | 86 | f.open(IO_WriteOnly); |
87 | QTextStream ts( &f ); | 87 | QTextStream ts( &f ); |
88 | ts << "misc.memcpy_method:glibc\n"; | 88 | ts << "misc.memcpy_method:glibc\n"; |
89 | f.close(); | 89 | f.close(); |
90 | } | 90 | } |
91 | 91 | ||
92 | if ( initMode == InitializeImmediately ) { | 92 | if ( initMode == InitializeImmediately ) { |
93 | initialize(); | 93 | initialize(); |
94 | m_initialized = true; | 94 | m_initialized = true; |
95 | } | 95 | } |
96 | else | 96 | else |
97 | assert( false ); | 97 | start(); |
98 | } | 98 | } |
99 | 99 | ||
100 | void Lib::run() | 100 | void Lib::run() |
101 | { | 101 | { |
102 | qDebug( "Lib::run() started" ); | ||
102 | initialize(); | 103 | initialize(); |
103 | m_initialized = true; | 104 | m_initialized = true; |
105 | qDebug( "Lib::run() finished" ); | ||
104 | } | 106 | } |
105 | 107 | ||
106 | void Lib::initialize() | 108 | void Lib::initialize() |
107 | { | 109 | { |
108 | m_duringInitialization = true; | 110 | m_duringInitialization = true; |
109 | m_xine = xine_new( ); | 111 | m_xine = xine_new( ); |
110 | 112 | ||
111 | QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf"; | 113 | QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf"; |
112 | xine_config_load( m_xine, QFile::encodeName( configPath ) ); | 114 | xine_config_load( m_xine, QFile::encodeName( configPath ) ); |
113 | 115 | ||
114 | xine_init( m_xine ); | 116 | xine_init( m_xine ); |
115 | 117 | ||
116 | // allocate oss for sound | 118 | // allocate oss for sound |
117 | // and fb for framebuffer | 119 | // and fb for framebuffer |
118 | m_audioOutput = xine_open_audio_driver( m_xine, "oss", NULL ); | 120 | m_audioOutput = xine_open_audio_driver( m_xine, "oss", NULL ); |
119 | m_videoOutput = ::init_video_out_plugin( m_xine, NULL, xine_display_frame, this ); | 121 | m_videoOutput = ::init_video_out_plugin( m_xine, NULL, xine_display_frame, this ); |
120 | 122 | ||
121 | 123 | ||
122 | //xine_open_video_driver( m_xine, NULL, XINE_VISUAL_TYPE_FB, NULL); | 124 | //xine_open_video_driver( m_xine, NULL, XINE_VISUAL_TYPE_FB, NULL); |
123 | 125 | ||
124 | 126 | ||
125 | // null_display_handler( m_videoOutput, xine_display_frame, this ); | 127 | // null_display_handler( m_videoOutput, xine_display_frame, this ); |
126 | 128 | ||
127 | m_stream = xine_stream_new (m_xine, m_audioOutput, m_videoOutput ); | 129 | m_stream = xine_stream_new (m_xine, m_audioOutput, m_videoOutput ); |
128 | 130 | ||
129 | if (m_wid != 0 ) { | 131 | if (m_wid != 0 ) { |
130 | printf( "!0\n" ); | 132 | printf( "!0\n" ); |
131 | setWidget( m_wid ); | 133 | setWidget( m_wid ); |
132 | } | 134 | } |
133 | 135 | ||
134 | m_queue = xine_event_new_queue (m_stream); | 136 | m_queue = xine_event_new_queue (m_stream); |
135 | 137 | ||
136 | xine_event_create_listener_thread (m_queue, xine_event_handler, this); | 138 | xine_event_create_listener_thread (m_queue, xine_event_handler, this); |
137 | m_duringInitialization = false; | 139 | m_duringInitialization = false; |
138 | } | 140 | } |
139 | 141 | ||
140 | Lib::~Lib() { | 142 | Lib::~Lib() { |
141 | assert( isRunning() == false ); | 143 | assert( isRunning() == false ); |
142 | assert( m_initialized ); | 144 | assert( m_initialized ); |
143 | 145 | ||
144 | // free( m_config ); | 146 | // free( m_config ); |
145 | 147 | ||
146 | xine_close( m_stream ); | 148 | xine_close( m_stream ); |
147 | 149 | ||
148 | xine_event_dispose_queue( m_queue ); | 150 | xine_event_dispose_queue( m_queue ); |
149 | 151 | ||
150 | xine_dispose( m_stream ); | 152 | xine_dispose( m_stream ); |
151 | 153 | ||
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp index d6fbb53..0ec6fad 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp | |||
@@ -1,115 +1,121 @@ | |||
1 | #include <qpe/qpeapplication.h> | 1 | #include <qpe/qpeapplication.h> |
2 | #include <qpe/qlibrary.h> | 2 | #include <qpe/qlibrary.h> |
3 | #include <qpe/resource.h> | 3 | #include <qpe/resource.h> |
4 | #include <qpe/config.h> | 4 | #include <qpe/config.h> |
5 | #include <qpe/qcopenvelope_qws.h> | 5 | #include <qpe/qcopenvelope_qws.h> |
6 | #include <qfileinfo.h> | 6 | #include <qfileinfo.h> |
7 | 7 | ||
8 | #include <qmainwindow.h> | 8 | #include <qmainwindow.h> |
9 | #include <qmessagebox.h> | 9 | #include <qmessagebox.h> |
10 | #include <qwidgetstack.h> | 10 | #include <qwidgetstack.h> |
11 | #include <qfile.h> | 11 | #include <qfile.h> |
12 | 12 | ||
13 | #include "mediaplayer.h" | 13 | #include "mediaplayer.h" |
14 | #include "playlistwidget.h" | 14 | #include "playlistwidget.h" |
15 | #include "audiowidget.h" | 15 | #include "audiowidget.h" |
16 | #include "videowidget.h" | 16 | #include "videowidget.h" |
17 | #include "volumecontrol.h" | 17 | #include "volumecontrol.h" |
18 | #include "lib.h" | 18 | #include "lib.h" |
19 | 19 | ||
20 | #include "mediaplayerstate.h" | 20 | #include "mediaplayerstate.h" |
21 | 21 | ||
22 | // for setBacklight() | 22 | // for setBacklight() |
23 | #include <linux/fb.h> | 23 | #include <linux/fb.h> |
24 | #include <sys/file.h> | 24 | #include <sys/file.h> |
25 | #include <sys/ioctl.h> | 25 | #include <sys/ioctl.h> |
26 | 26 | ||
27 | 27 | ||
28 | 28 | ||
29 | 29 | ||
30 | #define FBIOBLANK 0x4611 | 30 | #define FBIOBLANK 0x4611 |
31 | 31 | ||
32 | MediaPlayer::MediaPlayer( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name ) | 32 | MediaPlayer::MediaPlayer( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name ) |
33 | : QObject( parent, name ), volumeDirection( 0 ), mediaPlayerState( _mediaPlayerState ), playList( _playList ) { | 33 | : QObject( parent, name ), volumeDirection( 0 ), mediaPlayerState( _mediaPlayerState ), playList( _playList ) { |
34 | 34 | ||
35 | m_audioUI = 0; | 35 | m_audioUI = 0; |
36 | m_videoUI = 0; | 36 | m_videoUI = 0; |
37 | m_xineControl = 0; | 37 | m_xineControl = 0; |
38 | xine = new XINE::Lib( XINE::Lib::InitializeInThread ); | ||
38 | 39 | ||
39 | fd=-1;fl=-1; | 40 | fd=-1;fl=-1; |
40 | playList.setCaption( tr( "OpiePlayer: Initializating" ) ); | 41 | playList.setCaption( tr( "OpiePlayer: Initializating" ) ); |
41 | 42 | ||
42 | qApp->processEvents(); | 43 | qApp->processEvents(); |
43 | // QPEApplication::grabKeyboard(); // EVIL | 44 | // QPEApplication::grabKeyboard(); // EVIL |
44 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 45 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
45 | 46 | ||
46 | connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) ); | 47 | connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) ); |
47 | 48 | ||
48 | // What is pauseCheck good for? (Simon) | 49 | // What is pauseCheck good for? (Simon) |
49 | // connect( &mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) ); | 50 | // connect( &mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) ); |
50 | 51 | ||
51 | connect( &mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) ); | 52 | connect( &mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) ); |
52 | connect( &mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) ); | 53 | connect( &mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) ); |
53 | connect( &mediaPlayerState, SIGNAL( blankToggled( bool ) ), this, SLOT ( blank( bool ) ) ); | 54 | connect( &mediaPlayerState, SIGNAL( blankToggled( bool ) ), this, SLOT ( blank( bool ) ) ); |
54 | 55 | ||
55 | volControl = new VolumeControl; | 56 | volControl = new VolumeControl; |
56 | Config cfg( "OpiePlayer" ); | 57 | Config cfg( "OpiePlayer" ); |
57 | cfg.setGroup("PlayList"); | 58 | cfg.setGroup("PlayList"); |
58 | QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default"); | 59 | QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default"); |
59 | playList.setCaption( tr( "OpiePlayer: " ) + QFileInfo(currentPlaylist).baseName() ); | 60 | playList.setCaption( tr( "OpiePlayer: " ) + QFileInfo(currentPlaylist).baseName() ); |
60 | 61 | ||
61 | m_skinLoader = new SkinLoader; | 62 | m_skinLoader = new SkinLoader; |
62 | m_skinLoader->schedule( AudioWidget::guiInfo() ); | 63 | m_skinLoader->schedule( AudioWidget::guiInfo() ); |
63 | m_skinLoader->schedule( VideoWidget::guiInfo() ); | 64 | m_skinLoader->schedule( VideoWidget::guiInfo() ); |
64 | m_skinLoader->start(); | 65 | m_skinLoader->start(); |
65 | } | 66 | } |
66 | 67 | ||
67 | MediaPlayer::~MediaPlayer() { | 68 | MediaPlayer::~MediaPlayer() { |
69 | // this shold never happen, but one never knows... | ||
70 | if ( xine ) { | ||
71 | xine->ensureInitialized(); | ||
72 | delete xine; | ||
73 | } | ||
68 | delete m_xineControl; | 74 | delete m_xineControl; |
69 | delete m_audioUI; | 75 | delete m_audioUI; |
70 | delete m_videoUI; | 76 | delete m_videoUI; |
71 | delete volControl; | 77 | delete volControl; |
72 | } | 78 | } |
73 | 79 | ||
74 | void MediaPlayer::pauseCheck( bool b ) { | 80 | void MediaPlayer::pauseCheck( bool b ) { |
75 | if ( b && !mediaPlayerState.isPlaying() ) { | 81 | if ( b && !mediaPlayerState.isPlaying() ) { |
76 | mediaPlayerState.setPaused( FALSE ); | 82 | mediaPlayerState.setPaused( FALSE ); |
77 | } | 83 | } |
78 | } | 84 | } |
79 | 85 | ||
80 | void MediaPlayer::play() { | 86 | void MediaPlayer::play() { |
81 | mediaPlayerState.setPlaying( FALSE ); | 87 | mediaPlayerState.setPlaying( FALSE ); |
82 | mediaPlayerState.setPlaying( TRUE ); | 88 | mediaPlayerState.setPlaying( TRUE ); |
83 | } | 89 | } |
84 | 90 | ||
85 | void MediaPlayer::setPlaying( bool play ) { | 91 | void MediaPlayer::setPlaying( bool play ) { |
86 | if ( !play ) { | 92 | if ( !play ) { |
87 | return; | 93 | return; |
88 | } | 94 | } |
89 | 95 | ||
90 | if ( mediaPlayerState.isPaused() ) { | 96 | if ( mediaPlayerState.isPaused() ) { |
91 | mediaPlayerState.setPaused( FALSE ); | 97 | mediaPlayerState.setPaused( FALSE ); |
92 | return; | 98 | return; |
93 | } | 99 | } |
94 | 100 | ||
95 | QString tickerText, time, fileName; | 101 | QString tickerText, time, fileName; |
96 | if ( playList.currentTab() != PlayListWidget::CurrentPlayList ) { | 102 | if ( playList.currentTab() != PlayListWidget::CurrentPlayList ) { |
97 | //if playing in file list.. play in a different way | 103 | //if playing in file list.. play in a different way |
98 | // random and looping settings enabled causes problems here, | 104 | // random and looping settings enabled causes problems here, |
99 | // since there is no selected file in the playlist, but a selected file in the file list, | 105 | // since there is no selected file in the playlist, but a selected file in the file list, |
100 | // so we remember and shutoff | 106 | // so we remember and shutoff |
101 | l = mediaPlayerState.isLooping(); | 107 | l = mediaPlayerState.isLooping(); |
102 | if(l) { | 108 | if(l) { |
103 | mediaPlayerState.setLooping( false ); | 109 | mediaPlayerState.setLooping( false ); |
104 | } | 110 | } |
105 | r = mediaPlayerState.isShuffled(); | 111 | r = mediaPlayerState.isShuffled(); |
106 | mediaPlayerState.setShuffled( false ); | 112 | mediaPlayerState.setShuffled( false ); |
107 | } | 113 | } |
108 | 114 | ||
109 | PlayListWidget::Entry playListEntry = playList.currentEntry(); | 115 | PlayListWidget::Entry playListEntry = playList.currentEntry(); |
110 | fileName = playListEntry.name; | 116 | fileName = playListEntry.name; |
111 | xineControl()->play( playListEntry.file ); | 117 | xineControl()->play( playListEntry.file ); |
112 | 118 | ||
113 | long seconds = mediaPlayerState.length(); | 119 | long seconds = mediaPlayerState.length(); |
114 | time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); | 120 | time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); |
115 | 121 | ||
@@ -326,79 +332,83 @@ void MediaPlayer::keyReleaseEvent( QKeyEvent *e) { | |||
326 | case Key_Home: | 332 | case Key_Home: |
327 | break; | 333 | break; |
328 | case Key_F9: //activity | 334 | case Key_F9: //activity |
329 | break; | 335 | break; |
330 | case Key_F10: //contacts | 336 | case Key_F10: //contacts |
331 | break; | 337 | break; |
332 | case Key_F11: //menu | 338 | case Key_F11: //menu |
333 | break; | 339 | break; |
334 | case Key_F12: //home | 340 | case Key_F12: //home |
335 | qDebug("Blank here"); | 341 | qDebug("Blank here"); |
336 | // mediaPlayerState->toggleBlank(); | 342 | // mediaPlayerState->toggleBlank(); |
337 | break; | 343 | break; |
338 | case Key_F13: //mail | 344 | case Key_F13: //mail |
339 | qDebug("Blank here"); | 345 | qDebug("Blank here"); |
340 | // mediaPlayerState->toggleBlank(); | 346 | // mediaPlayerState->toggleBlank(); |
341 | break; | 347 | break; |
342 | } | 348 | } |
343 | } | 349 | } |
344 | 350 | ||
345 | void MediaPlayer::cleanUp() {// this happens on closing | 351 | void MediaPlayer::cleanUp() {// this happens on closing |
346 | Config cfg( "OpiePlayer" ); | 352 | Config cfg( "OpiePlayer" ); |
347 | mediaPlayerState.writeConfig( cfg ); | 353 | mediaPlayerState.writeConfig( cfg ); |
348 | playList.writeDefaultPlaylist( ); | 354 | playList.writeDefaultPlaylist( ); |
349 | 355 | ||
350 | // QPEApplication::grabKeyboard(); | 356 | // QPEApplication::grabKeyboard(); |
351 | // QPEApplication::ungrabKeyboard(); | 357 | // QPEApplication::ungrabKeyboard(); |
352 | } | 358 | } |
353 | 359 | ||
354 | void MediaPlayer::recreateAudioAndVideoWidgets() const | 360 | void MediaPlayer::recreateAudioAndVideoWidgets() const |
355 | { | 361 | { |
356 | delete m_skinLoader; | 362 | delete m_skinLoader; |
357 | 363 | ||
358 | delete m_xineControl; | 364 | delete m_xineControl; |
359 | delete m_audioUI; | 365 | delete m_audioUI; |
360 | delete m_videoUI; | 366 | delete m_videoUI; |
361 | m_audioUI = new AudioWidget( playList, mediaPlayerState, 0, "audioUI" ); | 367 | m_audioUI = new AudioWidget( playList, mediaPlayerState, 0, "audioUI" ); |
362 | m_videoUI = new VideoWidget( playList, mediaPlayerState, 0, "videoUI" ); | 368 | m_videoUI = new VideoWidget( playList, mediaPlayerState, 0, "videoUI" ); |
363 | 369 | ||
364 | connect( m_audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); | 370 | connect( m_audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); |
365 | connect( m_audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); | 371 | connect( m_audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); |
366 | connect( m_audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); | 372 | connect( m_audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); |
367 | connect( m_audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); | 373 | connect( m_audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); |
368 | 374 | ||
369 | connect( m_videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); | 375 | connect( m_videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); |
370 | connect( m_videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); | 376 | connect( m_videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); |
371 | connect( m_videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); | 377 | connect( m_videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); |
372 | connect( m_videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); | 378 | connect( m_videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); |
373 | 379 | ||
374 | XINE::Lib *xine = new XINE::Lib( XINE::Lib::InitializeImmediately ); | 380 | if ( !xine ) |
381 | xine = new XINE::Lib( XINE::Lib::InitializeImmediately ); | ||
382 | |||
375 | m_xineControl = new XineControl( xine, m_videoUI->vidWidget(), mediaPlayerState ); | 383 | m_xineControl = new XineControl( xine, m_videoUI->vidWidget(), mediaPlayerState ); |
384 | |||
385 | xine = 0; | ||
376 | } | 386 | } |
377 | 387 | ||
378 | AudioWidget *MediaPlayer::audioUI() const | 388 | AudioWidget *MediaPlayer::audioUI() const |
379 | { | 389 | { |
380 | if ( !m_audioUI ) | 390 | if ( !m_audioUI ) |
381 | recreateAudioAndVideoWidgets(); | 391 | recreateAudioAndVideoWidgets(); |
382 | return m_audioUI; | 392 | return m_audioUI; |
383 | } | 393 | } |
384 | 394 | ||
385 | VideoWidget *MediaPlayer::videoUI() const | 395 | VideoWidget *MediaPlayer::videoUI() const |
386 | { | 396 | { |
387 | if ( !m_videoUI ) | 397 | if ( !m_videoUI ) |
388 | recreateAudioAndVideoWidgets(); | 398 | recreateAudioAndVideoWidgets(); |
389 | return m_videoUI; | 399 | return m_videoUI; |
390 | } | 400 | } |
391 | 401 | ||
392 | XineControl *MediaPlayer::xineControl() const | 402 | XineControl *MediaPlayer::xineControl() const |
393 | { | 403 | { |
394 | if ( !m_xineControl ) | 404 | if ( !m_xineControl ) |
395 | recreateAudioAndVideoWidgets(); | 405 | recreateAudioAndVideoWidgets(); |
396 | return m_xineControl; | 406 | return m_xineControl; |
397 | } | 407 | } |
398 | 408 | ||
399 | void MediaPlayer::reloadSkins() | 409 | void MediaPlayer::reloadSkins() |
400 | { | 410 | { |
401 | audioUI()->loadSkin(); | 411 | audioUI()->loadSkin(); |
402 | videoUI()->loadSkin(); | 412 | videoUI()->loadSkin(); |
403 | } | 413 | } |
404 | 414 | ||
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.h b/noncore/multimedia/opieplayer2/mediaplayer.h index 351c884..cbe4d86 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.h +++ b/noncore/multimedia/opieplayer2/mediaplayer.h | |||
@@ -3,97 +3,103 @@ | |||
3 | 3 | ||
4 | Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> | 4 | Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> |
5 | Copyright (c) 2002 LJP <> | 5 | Copyright (c) 2002 LJP <> |
6 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> | 6 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> |
7 | =. | 7 | =. |
8 | .=l. | 8 | .=l. |
9 | .>+-= | 9 | .>+-= |
10 | _;:, .> :=|. This program is free software; you can | 10 | _;:, .> :=|. This program is free software; you can |
11 | .> <`_, > . <= redistribute it and/or modify it under | 11 | .> <`_, > . <= redistribute it and/or modify it under |
12 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 12 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
13 | .="- .-=="i, .._ License as published by the Free Software | 13 | .="- .-=="i, .._ License as published by the Free Software |
14 | - . .-<_> .<> Foundation; either version 2 of the License, | 14 | - . .-<_> .<> Foundation; either version 2 of the License, |
15 | ._= =} : or (at your option) any later version. | 15 | ._= =} : or (at your option) any later version. |
16 | .%`+i> _;_. | 16 | .%`+i> _;_. |
17 | .i_,=:_. -<s. This program is distributed in the hope that | 17 | .i_,=:_. -<s. This program is distributed in the hope that |
18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
19 | : .. .:, . . . without even the implied warranty of | 19 | : .. .:, . . . without even the implied warranty of |
20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
22 | ..}^=.= = ; Library General Public License for more | 22 | ..}^=.= = ; Library General Public License for more |
23 | ++= -. .` .: details. | 23 | ++= -. .` .: details. |
24 | : = ...= . :.=- | 24 | : = ...= . :.=- |
25 | -. .:....=;==+<; You should have received a copy of the GNU | 25 | -. .:....=;==+<; You should have received a copy of the GNU |
26 | -_. . . )=. = Library General Public License along with | 26 | -_. . . )=. = Library General Public License along with |
27 | -- :-=` this library; see the file COPYING.LIB. | 27 | -- :-=` this library; see the file COPYING.LIB. |
28 | If not, write to the Free Software Foundation, | 28 | If not, write to the Free Software Foundation, |
29 | Inc., 59 Temple Place - Suite 330, | 29 | Inc., 59 Temple Place - Suite 330, |
30 | Boston, MA 02111-1307, USA. | 30 | Boston, MA 02111-1307, USA. |
31 | 31 | ||
32 | */ | 32 | */ |
33 | 33 | ||
34 | #ifndef MEDIA_PLAYER_H | 34 | #ifndef MEDIA_PLAYER_H |
35 | #define MEDIA_PLAYER_H | 35 | #define MEDIA_PLAYER_H |
36 | 36 | ||
37 | #include <qmainwindow.h> | 37 | #include <qmainwindow.h> |
38 | #include <qframe.h> | 38 | #include <qframe.h> |
39 | 39 | ||
40 | #include "xinecontrol.h" | 40 | #include "xinecontrol.h" |
41 | 41 | ||
42 | #include "playlistwidget.h" | 42 | #include "playlistwidget.h" |
43 | #include "skin.h" | 43 | #include "skin.h" |
44 | 44 | ||
45 | class DocLnk; | 45 | class DocLnk; |
46 | class VolumeControl; | 46 | class VolumeControl; |
47 | class MediaPlayerState; | 47 | class MediaPlayerState; |
48 | class AudioWidget; | 48 | class AudioWidget; |
49 | class VideoWidget; | 49 | class VideoWidget; |
50 | 50 | ||
51 | namespace XINE | ||
52 | { | ||
53 | class Lib; | ||
54 | }; | ||
55 | |||
51 | class MediaPlayer : public QObject { | 56 | class MediaPlayer : public QObject { |
52 | Q_OBJECT | 57 | Q_OBJECT |
53 | public: | 58 | public: |
54 | MediaPlayer( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name ); | 59 | MediaPlayer( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name ); |
55 | ~MediaPlayer(); | 60 | ~MediaPlayer(); |
56 | 61 | ||
57 | public slots: | 62 | public slots: |
58 | void reloadSkins(); | 63 | void reloadSkins(); |
59 | 64 | ||
60 | private slots: | 65 | private slots: |
61 | void setPlaying( bool ); | 66 | void setPlaying( bool ); |
62 | void pauseCheck( bool ); | 67 | void pauseCheck( bool ); |
63 | void play(); | 68 | void play(); |
64 | void next(); | 69 | void next(); |
65 | void prev(); | 70 | void prev(); |
66 | void startIncreasingVolume(); | 71 | void startIncreasingVolume(); |
67 | void startDecreasingVolume(); | 72 | void startDecreasingVolume(); |
68 | void stopChangingVolume(); | 73 | void stopChangingVolume(); |
69 | void cleanUp(); | 74 | void cleanUp(); |
70 | void blank( bool ); | 75 | void blank( bool ); |
71 | 76 | ||
72 | protected: | 77 | protected: |
73 | void timerEvent( QTimerEvent *e ); | 78 | void timerEvent( QTimerEvent *e ); |
74 | void keyReleaseEvent( QKeyEvent *e); | 79 | void keyReleaseEvent( QKeyEvent *e); |
75 | 80 | ||
76 | private: | 81 | private: |
77 | AudioWidget *audioUI() const; | 82 | AudioWidget *audioUI() const; |
78 | VideoWidget *videoUI() const; | 83 | VideoWidget *videoUI() const; |
79 | XineControl *xineControl() const; | 84 | XineControl *xineControl() const; |
80 | 85 | ||
81 | bool isBlanked, l, r; | 86 | bool isBlanked, l, r; |
82 | int fd, fl; | 87 | int fd, fl; |
83 | int volumeDirection; | 88 | int volumeDirection; |
84 | VolumeControl *volControl; | 89 | VolumeControl *volControl; |
85 | MediaPlayerState &mediaPlayerState; | 90 | MediaPlayerState &mediaPlayerState; |
86 | PlayListWidget &playList; | 91 | PlayListWidget &playList; |
87 | 92 | ||
88 | void recreateAudioAndVideoWidgets() const; | 93 | void recreateAudioAndVideoWidgets() const; |
89 | 94 | ||
90 | mutable XineControl *m_xineControl; | 95 | mutable XineControl *m_xineControl; |
91 | mutable AudioWidget *m_audioUI; | 96 | mutable AudioWidget *m_audioUI; |
92 | mutable VideoWidget *m_videoUI; | 97 | mutable VideoWidget *m_videoUI; |
98 | mutable XINE::Lib *xine; | ||
93 | 99 | ||
94 | QGuardedPtr<SkinLoader> m_skinLoader; | 100 | QGuardedPtr<SkinLoader> m_skinLoader; |
95 | }; | 101 | }; |
96 | 102 | ||
97 | 103 | ||
98 | #endif // MEDIA_PLAYER_H | 104 | #endif // MEDIA_PLAYER_H |
99 | 105 | ||