]> git.sesse.net Git - vlc/blob - modules/gui/qt4/input_manager.cpp
Qt: Remove some dialogs_provider.hpp and input_manager.hpp dependencies.
[vlc] / modules / gui / qt4 / input_manager.cpp
1 /*****************************************************************************
2  * input_manager.cpp : Manage an input and interact with its GUI elements
3  ****************************************************************************
4  * Copyright (C) 2006-2008 the VideoLAN team
5  * $Id$
6  *
7  * Authors: ClĂ©ment Stenac <zorglub@videolan.org>
8  *          Ilkka Ollakka  <ileoo@videolan.org>
9  *          Jean-Baptiste <jb@videolan.org>
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
24  *****************************************************************************/
25
26 #ifdef HAVE_CONFIG_H
27 # include "config.h"
28 #endif
29
30 #include "qt4.hpp"
31 #include "input_manager.hpp"
32
33 #include <QApplication>
34
35 static int ItemChanged( vlc_object_t *, const char *,
36                         vlc_value_t, vlc_value_t, void * );
37 static int PLItemChanged( vlc_object_t *, const char *,
38                         vlc_value_t, vlc_value_t, void * );
39 static int VolumeChanged( vlc_object_t *, const char *,
40                         vlc_value_t, vlc_value_t, void * );
41
42 static int InputEvent( vlc_object_t *, const char *,
43                        vlc_value_t, vlc_value_t, void * );
44
45
46 /**********************************************************************
47  * InputManager implementation
48  **********************************************************************
49  * The Input Manager can be the main one around the playlist
50  * But can also be used for VLM dialog or similar
51  **********************************************************************/
52
53 InputManager::InputManager( QObject *parent, intf_thread_t *_p_intf) :
54                            QObject( parent ), p_intf( _p_intf )
55 {
56     i_old_playing_status = END_S;
57     oldName      = "";
58     artUrl       = "";
59     p_input      = NULL;
60     i_rate       = 0;
61     i_input_id   = 0;
62     b_video      = false;
63     timeA        = 0;
64     timeB        = 0;
65
66 }
67
68 InputManager::~InputManager()
69 {
70     delInput();
71 }
72
73 /* Define the Input used.
74    Add the callbacks on input
75    p_input is held once here */
76 void InputManager::setInput( input_thread_t *_p_input )
77 {
78     delInput();
79     p_input = _p_input;
80     if( p_input && !( p_input->b_dead || !vlc_object_alive (p_input) ) )
81     {
82         vlc_object_hold( p_input );
83         emit statusChanged( PLAYING_S );
84         UpdateMeta();
85         UpdateArt();
86         UpdateTeletext();
87         UpdateNavigation();
88         UpdateVout();
89         addCallbacks();
90         i_input_id = input_GetItem( p_input )->i_id;
91     }
92     else
93     {
94         p_input = NULL;
95         i_input_id = 0;
96         emit rateChanged( INPUT_RATE_DEFAULT );
97     }
98 }
99
100 /* delete Input if it ever existed.
101    Delete the callbacls on input
102    p_input is released once here */
103 void InputManager::delInput()
104 {
105     if( p_input )
106     {
107         delCallbacks();
108         i_old_playing_status = END_S;
109         i_input_id = 0;
110         oldName    = "";
111         artUrl     = "";
112         b_video    = false;
113         timeA      = 0;
114         timeB      = 0;
115         emit positionUpdated( -1.0, 0 ,0 );
116         emit statusChanged( END_S );
117         emit nameChanged( "" );
118         emit artChanged( NULL );
119         emit rateChanged( INPUT_RATE_DEFAULT );
120         emit voutChanged( false );
121         vlc_object_release( p_input );
122         p_input = NULL;
123         UpdateTeletext();
124     }
125 }
126
127 /* Add the callbacks on Input. Self explanatory */
128 void InputManager::addCallbacks()
129 {
130     var_AddCallback( p_input, "intf-event", InputEvent, this );
131 }
132
133 /* Delete the callbacks on Input. Self explanatory */
134 void InputManager::delCallbacks()
135 {
136     var_DelCallback( p_input, "intf-event", InputEvent, this );
137 }
138
139 /* Convert the event from the callbacks in actions */
140 void InputManager::customEvent( QEvent *event )
141 {
142     int i_type = event->type();
143     IMEvent *ple = static_cast<IMEvent *>(event);
144
145     if ( i_type != PositionUpdate_Type &&
146          i_type != ItemChanged_Type &&
147          i_type != ItemRateChanged_Type &&
148          i_type != ItemTitleChanged_Type &&
149          i_type != ItemEsChanged_Type &&
150          i_type != ItemTeletextChanged_Type &&
151          i_type != ItemStateChanged_Type &&
152          i_type != StatisticsUpdate_Type &&
153          i_type != InterfaceVoutUpdate_Type &&
154          i_type != MetaChanged_Type )
155         return;
156
157     if( !hasInput() ) return;
158
159     if( ( i_type != PositionUpdate_Type  &&
160           i_type != ItemRateChanged_Type &&
161           i_type != ItemEsChanged_Type &&
162           i_type != ItemTeletextChanged_Type &&
163           i_type != ItemStateChanged_Type &&
164           i_type != StatisticsUpdate_Type &&
165           i_type != InterfaceVoutUpdate_Type &&
166           i_type != MetaChanged_Type
167         )
168         && ( i_input_id != ple->i_id ) )
169         return;
170
171     if( i_type != PositionUpdate_Type &&
172         i_type != StatisticsUpdate_Type )
173         msg_Dbg( p_intf, "New Event: type %i", i_type );
174
175     /* Actions */
176     switch( i_type )
177     {
178     case PositionUpdate_Type:
179         UpdatePosition();
180         break;
181     case StatisticsUpdate_Type:
182         UpdateStats();
183         break;
184     case ItemChanged_Type:
185         UpdateMeta();
186         UpdateStatus();
187         UpdateArt();
188         break;
189     case MetaChanged_Type:
190         UpdateMeta();
191         UpdateArt();
192         break;
193     case ItemStateChanged_Type:
194         UpdateStatus();
195         UpdateNavigation();
196         UpdateMeta();
197         UpdateTeletext();
198         break;
199     case ItemTitleChanged_Type:
200         UpdateNavigation();
201         UpdateMeta();
202         break;
203     case ItemRateChanged_Type:
204         UpdateRate();
205         break;
206     case ItemEsChanged_Type:
207         UpdateSPU();
208         break;
209     case ItemTeletextChanged_Type:
210         UpdateTeletext();
211         break;
212     case InterfaceVoutUpdate_Type:
213         UpdateVout();
214         break;
215     default:
216         msg_Warn( p_intf, "This shouldn't happen: %i", i_type );
217     }
218 }
219
220 void InputManager::UpdateStats()
221 {
222     emit statisticsUpdated( input_GetItem( p_input ) );
223 }
224
225 void InputManager::UpdatePosition()
226 {
227     /* Update position */
228     int i_length, i_time; /* Int is enough, since we store seconds */
229     float f_pos;
230     i_length = var_GetTime(  p_input , "length" ) / 1000000;
231     i_time = var_GetTime(  p_input , "time") / 1000000;
232     f_pos = var_GetFloat(  p_input , "position" );
233     emit positionUpdated( f_pos, i_time, i_length );
234 }
235
236 void InputManager::UpdateNavigation()
237 {
238     /* Update navigation status */
239     vlc_value_t val; val.i_int = 0;
240
241     if( hasInput() )
242         var_Change( p_input, "title", VLC_VAR_CHOICESCOUNT, &val, NULL );
243
244     if( val.i_int > 0 )
245     {
246         emit titleChanged( true );
247         /* p_input != NULL since val.i_int != 0 */
248         val.i_int = 0;
249         var_Change( p_input, "chapter", VLC_VAR_CHOICESCOUNT, &val, NULL );
250         emit chapterChanged( (val.i_int > 0) );
251     }
252     else
253         emit titleChanged( false );
254 }
255
256 void InputManager::UpdateStatus()
257 {
258     /* Update playing status */
259     vlc_value_t val; val.i_int = 0;
260     var_Get( p_input, "state", &val );
261     if( i_old_playing_status != val.i_int )
262     {
263         i_old_playing_status = val.i_int;
264         emit statusChanged( val.i_int );
265     }
266 }
267
268 void InputManager::UpdateRate()
269 {
270     /* Update Rate */
271     int i_new_rate = var_GetInteger( p_input, "rate");
272     if( i_new_rate != i_rate )
273     {
274         i_rate = i_new_rate;
275         /* Update rate */
276         emit rateChanged( i_rate );
277     }
278 }
279
280 void InputManager::UpdateMeta()
281 {
282     /* Update text, name and nowplaying */
283     QString text;
284
285     /* Try to get the Title, then the Name */
286     char *psz_name = input_item_GetTitle( input_GetItem( p_input ) );
287     if( EMPTY_STR( psz_name ) )
288     {
289         free( psz_name );
290         psz_name = input_item_GetName( input_GetItem( p_input ) );
291     }
292
293     /* Try to get the nowplaying */
294     char *psz_nowplaying =
295         input_item_GetNowPlaying( input_GetItem( p_input ) );
296     if( !EMPTY_STR( psz_nowplaying ) )
297     {
298         text.sprintf( "%s - %s", psz_nowplaying, psz_name );
299     }
300     else  /* Do it ourself */
301     {
302         char *psz_artist = input_item_GetArtist( input_GetItem( p_input ) );
303
304         if( !EMPTY_STR( psz_artist ) )
305             text.sprintf( "%s - %s", psz_artist, psz_name );
306         else
307             text.sprintf( "%s", psz_name );
308
309         free( psz_artist );
310     }
311     /* Free everything */
312     free( psz_name );
313     free( psz_nowplaying );
314
315     /* If we have Nothing */
316     if( text.isEmpty() )
317     {
318         psz_name = input_item_GetURI( input_GetItem( p_input ) );
319         text.sprintf( "%s", psz_name );
320         text = text.remove( 0, text.lastIndexOf( DIR_SEP ) + 1 );
321         free( psz_name );
322     }
323
324     if( oldName != text )
325     {
326         emit nameChanged( text );
327         oldName=text;
328     }
329 }
330
331 bool InputManager::hasAudio()
332 {
333     if( hasInput() )
334     {
335         vlc_value_t val;
336         var_Change( p_input, "audio-es", VLC_VAR_CHOICESCOUNT, &val, NULL );
337         return val.i_int > 0;
338     }
339     return false;
340 }
341
342 void InputManager::UpdateSPU()
343 {
344     UpdateTeletext();
345 }
346
347 void InputManager::UpdateTeletext()
348 {
349     if( hasInput() )
350         telexActivation( var_GetInteger( p_input, "teletext-es" ) >= 0 );
351     else
352         telexActivation( false );
353 }
354
355 void InputManager::UpdateVout()
356 {
357     if( hasInput() )
358     {
359         bool b_old_video = b_video;
360
361         vlc_object_t *p_vout = (vlc_object_t*)vlc_object_find( p_input,
362                                          VLC_OBJECT_VOUT, FIND_CHILD );
363         b_video = p_vout != NULL;
364         if( p_vout )
365             vlc_object_release( p_vout );
366         if( !!b_old_video != !!b_video )
367             emit voutChanged( b_video );
368     }
369 }
370
371 void InputManager::UpdateArt()
372 {
373     /* Update Art meta */
374     emit artChanged( input_GetItem( p_input ) );
375 }
376
377 /* User update of the slider */
378 void InputManager::sliderUpdate( float new_pos )
379 {
380     if( hasInput() )
381         var_SetFloat( p_input, "position", new_pos );
382 }
383
384 /* User togglePlayPause */
385 void InputManager::togglePlayPause()
386 {
387     vlc_value_t state;
388     if( hasInput() )
389     {
390         var_Get( p_input, "state", &state );
391         state.i_int = ( state.i_int != PLAYING_S ) ? PLAYING_S : PAUSE_S;
392         var_Set( p_input, "state", state );
393         emit statusChanged( state.i_int );
394     }
395 }
396
397 void InputManager::sectionPrev()
398 {
399     if( hasInput() )
400     {
401         int i_type = var_Type( p_input, "next-chapter" );
402         vlc_value_t val; val.b_bool = true;
403         var_Set( p_input, (i_type & VLC_VAR_TYPE) != 0 ?
404                             "prev-chapter":"prev-title", val );
405     }
406 }
407
408 void InputManager::sectionNext()
409 {
410     if( hasInput() )
411     {
412         int i_type = var_Type( p_input, "next-chapter" );
413         vlc_value_t val; val.b_bool = true;
414         var_Set( p_input, (i_type & VLC_VAR_TYPE) != 0 ?
415                             "next-chapter":"next-title", val );
416     }
417 }
418
419 void InputManager::sectionMenu()
420 {
421     if( hasInput() )
422     {
423         vlc_value_t val, text;
424         vlc_value_t root;
425
426         if( var_Change( p_input, "title  0", VLC_VAR_GETLIST, &val, &text ) < 0 )
427             return;
428
429         /* XXX is it "Root" or "Title" we want here ?" (set 0 by default) */
430         root.i_int = 0;
431         for( int i = 0; i < val.p_list->i_count; i++ )
432         {
433             if( !strcmp( text.p_list->p_values[i].psz_string, "Title" ) )
434                 root.i_int = i;
435         }
436         var_Change( p_input, "title  0", VLC_VAR_FREELIST, &val, &text );
437
438         var_Set( p_input, "title  0", root );
439     }
440 }
441
442 /*
443  *  Teletext Functions
444  */
445
446 /* Set a new Teletext Page */
447 void InputManager::telexSetPage( int page )
448 {
449     if( hasInput() )
450     {
451         const int i_teletext_es = var_GetInteger( p_input, "teletext-es" );
452         const int i_spu_es = var_GetInteger( p_input, "spu-es" );
453
454         if( i_teletext_es >= 0 && i_teletext_es == i_spu_es )
455         {
456             vlc_object_t *p_vbi = (vlc_object_t *) vlc_object_find_name( p_input,
457                         "zvbi", FIND_ANYWHERE );
458             if( p_vbi )
459             {
460                 var_SetInteger( p_vbi, "vbi-page", page );
461                 vlc_object_release( p_vbi );
462                 emit newTelexPageSet( page );
463             }
464         }
465     }
466 }
467
468 /* Set the transparency on teletext */
469 void InputManager::telexSetTransparency( bool b_transparentTelextext )
470 {
471     if( hasInput() )
472     {
473         vlc_object_t *p_vbi = (vlc_object_t *) vlc_object_find_name( p_input,
474                     "zvbi", FIND_ANYWHERE );
475         if( p_vbi )
476         {
477             var_SetBool( p_vbi, "vbi-opaque", b_transparentTelextext );
478             vlc_object_release( p_vbi );
479             emit teletextTransparencyActivated( b_transparentTelextext );
480         }
481     }
482 }
483
484 void InputManager::telexActivation( bool b_enabled )
485 {
486     if( hasInput() )
487     {
488         const int i_teletext_es = var_GetInteger( p_input, "teletext-es" );
489         const int i_spu_es = var_GetInteger( p_input, "spu-es" );
490
491         /* Teletext is possible. Show the buttons */
492         b_enabled = (i_teletext_es >= 0);
493         emit teletextPossible( b_enabled );
494         if( !b_enabled ) return;
495
496         /* If Teletext is selected */
497         if( i_teletext_es == i_spu_es )
498         {
499             /* Activate the buttons */
500             teletextActivated( true );
501
502             /* Then, find the current page */
503             int i_page = 100;
504             vlc_object_t *p_vbi = (vlc_object_t *)
505                 vlc_object_find_name( p_input, "zvbi", FIND_ANYWHERE );
506             if( p_vbi )
507             {
508                 i_page = var_GetInteger( p_vbi, "vbi-page" );
509                 vlc_object_release( p_vbi );
510                 emit newTelexPageSet( i_page );
511             }
512         }
513     }
514     else
515         emit teletextPossible( b_enabled );
516 }
517
518 void InputManager::activateTeletext( bool b_enable )
519 {
520     if( hasInput() )
521     {
522         const int i_teletext_es = var_GetInteger( p_input, "teletext-es" );
523         if( i_teletext_es >= 0 )
524         {
525             var_SetInteger( p_input, "spu-es", b_enable ? i_teletext_es : -1 );
526         }
527     }
528 }
529
530 void InputManager::reverse()
531 {
532     if( hasInput() )
533     {
534         int i_rate = var_GetInteger( p_input, "rate" );
535         var_SetInteger( p_input, "rate", -i_rate );
536     }
537 }
538
539 void InputManager::slower()
540 {
541     if( hasInput() )
542         var_SetVoid( p_input, "rate-slower" );
543 }
544
545 void InputManager::faster()
546 {
547     if( hasInput() )
548         var_SetVoid( p_input, "rate-faster" );
549 }
550
551 void InputManager::normalRate()
552 {
553     if( hasInput() )
554         var_SetInteger( p_input, "rate", INPUT_RATE_DEFAULT );
555 }
556
557 void InputManager::setRate( int new_rate )
558 {
559     if( hasInput() )
560         var_SetInteger( p_input, "rate", new_rate );
561 }
562
563 void InputManager::setAtoB()
564 {
565     if( !timeA )
566     {
567         timeA = var_GetTime( THEMIM->getInput(), "time"  );
568     }
569     else if( !timeB )
570     {
571         timeB = var_GetTime( THEMIM->getInput(), "time"  );
572         var_SetTime( THEMIM->getInput(), "time" , timeA );
573     }
574     else
575     {
576         timeA = 0;
577         timeB = 0;
578     }
579     emit AtoBchanged( (timeA != 0 ), (timeB != 0 ) );
580 }
581
582 /* Function called regularly when in an AtoB loop */
583 void InputManager::AtoBLoop( int i_time )
584 {
585     if( timeB )
586     {
587         if( ( i_time >= (int)( timeB/1000000 ) )
588             || ( i_time < (int)( timeA/1000000 ) ) )
589             var_SetTime( THEMIM->getInput(), "time" , timeA );
590     }
591 }
592
593 /**********************************************************************
594  * MainInputManager implementation. Wrap an input manager and
595  * take care of updating the main playlist input.
596  * Used in the main playlist Dialog
597  **********************************************************************/
598 MainInputManager * MainInputManager::instance = NULL;
599
600 MainInputManager::MainInputManager( intf_thread_t *_p_intf )
601                  : QObject(NULL), p_intf( _p_intf )
602 {
603     p_input = NULL;
604     im = new InputManager( this, p_intf );
605
606     var_AddCallback( THEPL, "item-change", ItemChanged, im );
607     var_AddCallback( THEPL, "playlist-current", PLItemChanged, this );
608     var_AddCallback( THEPL, "activity", PLItemChanged, this );
609
610     var_AddCallback( p_intf->p_libvlc, "volume-change", VolumeChanged, this );
611
612     /* Warn our embedded IM about input changes */
613     CONNECT( this, inputChanged( input_thread_t * ),
614              im, setInput( input_thread_t * ) );
615
616     /* emit check if playlist has allready started playing */
617     vlc_value_t val;
618     var_Change( THEPL, "playlist-current", VLC_VAR_CHOICESCOUNT, &val, NULL );
619     IMEvent *event = new IMEvent( ItemChanged_Type, val.i_int);
620     QApplication::postEvent( this, static_cast<QEvent*>(event) );
621 }
622
623 MainInputManager::~MainInputManager()
624 {
625     if( p_input )
626     {
627        var_DelCallback( p_input, "state", PLItemChanged, this );
628        vlc_object_release( p_input );
629        emit inputChanged( NULL );
630     }
631
632     var_DelCallback( p_intf->p_libvlc, "volume-change", VolumeChanged, this );
633
634     var_DelCallback( THEPL, "activity", PLItemChanged, this );
635     var_DelCallback( THEPL, "item-change", ItemChanged, im );
636
637     var_DelCallback( THEPL, "playlist-current", PLItemChanged, this );
638 }
639
640 void MainInputManager::customEvent( QEvent *event )
641 {
642     int type = event->type();
643     if ( type != ItemChanged_Type && type != VolumeChanged_Type )
644         return;
645
646     // msg_Dbg( p_intf, "New MainIM Event of type: %i", type );
647     if( type == VolumeChanged_Type )
648     {
649         emit volumeChanged();
650         return;
651     }
652
653     /* Should be PLItemChanged Event */
654     if( !p_intf->p_sys->b_isDialogProvider )
655     {
656         vlc_mutex_lock( &p_intf->change_lock );
657         if( p_input && ( p_input->b_dead || !vlc_object_alive (p_input) ) )
658         {
659             var_DelCallback( p_input, "state", PLItemChanged, this );
660             vlc_object_release( p_input );
661             emit inputChanged( NULL );
662             p_input = NULL;
663             vlc_mutex_unlock( &p_intf->change_lock );
664             return;
665         }
666
667         if( !p_input )
668         {
669             p_input = playlist_CurrentInput(THEPL);
670             if( p_input )
671             {
672                 var_AddCallback( p_input, "state", PLItemChanged, this );
673                 emit inputChanged( p_input );
674             }
675         }
676         vlc_mutex_unlock( &p_intf->change_lock );
677     }
678     else
679     {
680         /* we are working as a dialogs provider */
681         playlist_t *p_playlist = pl_Hold( p_intf );
682         p_input = playlist_CurrentInput( p_playlist );
683         if( p_input )
684         {
685             emit inputChanged( p_input );
686             vlc_object_release( p_input );
687         }
688         pl_Release( p_intf );
689     }
690 }
691
692 /* Playlist Control functions */
693 void MainInputManager::stop()
694 {
695    playlist_Stop( THEPL );
696 }
697
698 void MainInputManager::next()
699 {
700    playlist_Next( THEPL );
701 }
702
703 void MainInputManager::prev()
704 {
705    playlist_Prev( THEPL );
706 }
707
708 void MainInputManager::togglePlayPause()
709 {
710     /* No input, play */
711     if( !p_input )
712         playlist_Play( THEPL );
713     else
714         getIM()->togglePlayPause();
715 }
716
717 /* Static callbacks */
718
719 /* IM */
720 static int ItemChanged( vlc_object_t *p_this, const char *psz_var,
721                         vlc_value_t oldval, vlc_value_t newval, void *param )
722 {
723     InputManager *im = (InputManager*)param;
724
725     IMEvent *event = new IMEvent( ItemChanged_Type, newval.i_int );
726     QApplication::postEvent( im, static_cast<QEvent*>(event) );
727     return VLC_SUCCESS;
728 }
729
730 static int InputEvent( vlc_object_t *p_this, const char *,
731                        vlc_value_t, vlc_value_t newval, void *param )
732 {
733     InputManager *im = (InputManager*)param;
734     IMEvent *event;
735
736     switch( newval.i_int )
737     {
738     case INPUT_EVENT_STATE:
739         event = new IMEvent( ItemStateChanged_Type, 0 );
740         break;
741     case INPUT_EVENT_RATE:
742         event = new IMEvent( ItemRateChanged_Type, 0 );
743         break;
744     case INPUT_EVENT_TIMES:
745         event = new IMEvent( PositionUpdate_Type, 0 );
746         break;
747
748     case INPUT_EVENT_TITLE:
749     case INPUT_EVENT_CHAPTER: /* TODO is that correct ? */
750         event = new IMEvent( ItemTitleChanged_Type, 0 );
751         break;
752
753     case INPUT_EVENT_ES:
754         event = new IMEvent( ItemEsChanged_Type, 0 );
755         break;
756     case INPUT_EVENT_TELETEXT:
757         event = new IMEvent( ItemTeletextChanged_Type, 0 );
758         break;
759
760     case INPUT_EVENT_VOUT:
761         event = new IMEvent( InterfaceVoutUpdate_Type, 0 );
762         break;
763
764     case INPUT_EVENT_STATISTICS:
765         event = new IMEvent( StatisticsUpdate_Type, 0 );
766         break;
767
768     case INPUT_EVENT_ITEM_META:
769     case INPUT_EVENT_ITEM_INFO:
770     case INPUT_EVENT_ITEM_NAME:
771         event = new IMEvent( MetaChanged_Type, 0 );
772         break;
773
774     case INPUT_EVENT_PROGRAM:
775     case INPUT_EVENT_RECORD:
776     case INPUT_EVENT_SIGNAL:
777     case INPUT_EVENT_AUDIO_DELAY:
778     case INPUT_EVENT_SUBTITLE_DELAY:
779     case INPUT_EVENT_BOOKMARK:
780     case INPUT_EVENT_CACHE:
781     default:
782         event = NULL;
783         break;
784     }
785
786     if( event )
787         QApplication::postEvent( im, static_cast<QEvent*>(event) );
788     return VLC_SUCCESS;
789 }
790
791 /* MIM */
792 static int PLItemChanged( vlc_object_t *p_this, const char *psz_var,
793                         vlc_value_t oldval, vlc_value_t newval, void *param )
794 {
795     MainInputManager *mim = (MainInputManager*)param;
796
797     IMEvent *event = new IMEvent( ItemChanged_Type, newval.i_int );
798     QApplication::postEvent( mim, static_cast<QEvent*>(event) );
799     return VLC_SUCCESS;
800 }
801
802 static int VolumeChanged( vlc_object_t *p_this, const char *psz_var,
803                         vlc_value_t oldval, vlc_value_t newval, void *param )
804 {
805     MainInputManager *mim = (MainInputManager*)param;
806
807     IMEvent *event = new IMEvent( VolumeChanged_Type, newval.i_int );
808     QApplication::postEvent( mim, static_cast<QEvent*>(event) );
809     return VLC_SUCCESS;
810 }
811
812