]> git.sesse.net Git - vlc/blob - modules/gui/qt4/input_manager.cpp
Update qt4 interface to use new "teletex-es". It fixes the unwanted display
[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 #ifdef HAVE_CONFIG_H
26 # include "config.h"
27 #endif
28
29 #include "qt4.hpp"
30 #include "input_manager.hpp"
31 #include "dialogs_provider.hpp"
32
33 static int ChangeSPU( vlc_object_t *p_this, const char *var, vlc_value_t o,
34                       vlc_value_t n, void *param );
35
36 static int ChangeTeletext( vlc_object_t *p_this, const char *var, vlc_value_t o,
37                            vlc_value_t n, void *param );
38
39 static int ItemChanged( vlc_object_t *, const char *,
40                         vlc_value_t, vlc_value_t, void * );
41 static int PLItemChanged( vlc_object_t *, const char *,
42                         vlc_value_t, vlc_value_t, void * );
43 static int InterfaceChanged( vlc_object_t *, const char *,
44                             vlc_value_t, vlc_value_t, void * );
45 static int ItemStateChanged( vlc_object_t *, const char *,
46                         vlc_value_t, vlc_value_t, void * );
47 static int ItemRateChanged( vlc_object_t *, const char *,
48                         vlc_value_t, vlc_value_t, void * );
49 static int ItemTitleChanged( vlc_object_t *, const char *,
50                         vlc_value_t, vlc_value_t, void * );
51 static int VolumeChanged( vlc_object_t *, const char *,
52                         vlc_value_t, vlc_value_t, void * );
53
54 /**********************************************************************
55  * InputManager implementation
56  **********************************************************************
57  * The Input Manager can be the main one around the playlist
58  * But can also be used for VLM dialog or similar
59  **********************************************************************/
60
61 InputManager::InputManager( QObject *parent, intf_thread_t *_p_intf) :
62                            QObject( parent ), p_intf( _p_intf )
63 {
64     i_old_playing_status = END_S;
65     old_name     = "";
66     artUrl       = "";
67     p_input      = NULL;
68     i_rate       = 0;
69     i_input_id   = 0;
70     b_transparentTelextext = false;
71 }
72
73 InputManager::~InputManager()
74 {
75     delInput();
76 }
77
78 /* Define the Input used.
79    Add the callbacks on input
80    p_input is yield once here */
81 void InputManager::setInput( input_thread_t *_p_input )
82 {
83     delInput();
84     p_input = _p_input;
85     if( p_input && !( p_input->b_dead || !vlc_object_alive (p_input) ) )
86     {
87         vlc_object_yield( p_input );
88         emit statusChanged( PLAYING_S );
89         UpdateMeta();
90         UpdateArt();
91         UpdateSPU();
92         UpdateTeletext();
93         UpdateNavigation();
94         addCallbacks();
95         i_input_id = input_GetItem( p_input )->i_id;
96     }
97     else
98     {
99         p_input = NULL;
100         i_input_id = 0;
101         emit rateChanged( INPUT_RATE_DEFAULT );
102         emit inputUnset();
103     }
104 }
105
106 /* delete Input if it ever existed.
107    Delete the callbacls on input
108    p_input is released once here */
109 void InputManager::delInput()
110 {
111     if( p_input )
112     {
113         delCallbacks();
114         i_old_playing_status = END_S;
115         i_input_id = 0;
116         old_name   = "";
117         artUrl     = "";
118         emit positionUpdated( 0.0, 0 ,0 );
119         emit statusChanged( END_S );
120         emit nameChanged( "" );
121         emit artChanged( "" );
122         emit rateChanged( INPUT_RATE_DEFAULT );
123         vlc_object_release( p_input );
124         p_input = NULL;
125         UpdateSPU();
126         UpdateTeletext();
127     }
128 }
129
130 /* Add the callbacks on Input. Self explanatory */
131 void InputManager::addCallbacks()
132 {
133     /* We don't care about:
134        - chapter
135        - programs
136        - audio-delay
137        - spu-delay
138        - bookmark
139        - position, time, length, because they are included in intf-change
140      */
141     /* src/input/input.c:1629 */
142     var_AddCallback( p_input, "state", ItemStateChanged, this );
143     /* src/input/es-out.c:552 */
144     var_AddCallback( p_input, "spu-es", ChangeSPU, this );
145     /* src/input/es-out.c: */
146     var_AddCallback( p_input, "teletext-es", ChangeTeletext, this );
147     /* src/input/input.c:1765 */
148     var_AddCallback( p_input, "rate-change", ItemRateChanged, this );
149     /* src/input/input.c:2003 */
150     var_AddCallback( p_input, "title", ItemTitleChanged, this );
151     /* src/input/input.c:734 for timers update*/
152     var_AddCallback( p_input, "intf-change", InterfaceChanged, this );
153 }
154
155 /* Delete the callbacks on Input. Self explanatory */
156 void InputManager::delCallbacks()
157 {
158     var_DelCallback( p_input, "spu-es", ChangeSPU, this );
159     var_DelCallback( p_input, "teletext-es", ChangeTeletext, this );
160     var_DelCallback( p_input, "state", ItemStateChanged, this );
161     var_DelCallback( p_input, "rate-change", ItemRateChanged, this );
162     var_DelCallback( p_input, "title", ItemTitleChanged, this );
163     var_DelCallback( p_input, "intf-change", InterfaceChanged, this );
164 }
165
166 /* Convert the event from the callbacks in actions */
167 void InputManager::customEvent( QEvent *event )
168 {
169     int type = event->type();
170     IMEvent *ple = static_cast<IMEvent *>(event);
171
172     if ( type != PositionUpdate_Type &&
173          type != ItemChanged_Type &&
174          type != ItemRateChanged_Type &&
175          type != ItemTitleChanged_Type &&
176          type != ItemSpuChanged_Type &&
177          type != ItemTeletextChanged_Type &&
178          type != ItemStateChanged_Type )
179         return;
180
181     if( !hasInput() ) return;
182
183     if( ( type != PositionUpdate_Type  &&
184           type != ItemRateChanged_Type &&
185           type != ItemSpuChanged_Type &&
186           type != ItemTeletextChanged_Type &&
187           type != ItemStateChanged_Type
188         )
189         && ( i_input_id != ple->i_id ) )
190         return;
191
192     if( type != PositionUpdate_Type )
193         msg_Dbg( p_intf, "New Event: type %i", type );
194
195     /* Actions */
196     switch( type )
197     {
198     case PositionUpdate_Type:
199         UpdatePosition();
200         break;
201     case ItemChanged_Type:
202         UpdateMeta();
203         UpdateStatus();
204         UpdateArt();
205         break;
206     case ItemStateChanged_Type:
207         UpdateStatus();
208         UpdateNavigation();
209         UpdateMeta();
210         break;
211     case ItemTitleChanged_Type:
212         UpdateNavigation();
213         UpdateMeta();
214         break;
215     case ItemRateChanged_Type:
216         UpdateRate();
217         break;
218     case ItemSpuChanged_Type:
219         UpdateSPU();
220         break;
221     case ItemTeletextChanged_Type:
222         UpdateTeletext();
223         break;
224     }
225 }
226
227 void InputManager::UpdatePosition()
228 {
229     /* Update position */
230     int i_length, i_time; /* Int is enough, since we store seconds */
231     float f_pos;
232     i_length = var_GetTime(  p_input , "length" ) / 1000000;
233     i_time = var_GetTime(  p_input , "time") / 1000000;
234     f_pos = var_GetFloat(  p_input , "position" );
235     emit positionUpdated( f_pos, i_time, i_length );
236 }
237
238 void InputManager::UpdateNavigation()
239 {
240     /* Update navigation status */
241     vlc_value_t val; val.i_int = 0;
242     var_Change( p_input, "title", VLC_VAR_CHOICESCOUNT, &val, NULL );
243     if( val.i_int > 0 )
244     {
245         val.i_int = 0;
246         var_Change( p_input, "chapter", VLC_VAR_CHOICESCOUNT, &val, NULL );
247         emit navigationChanged( (val.i_int > 0) ? 1 : 2 );
248     }
249     else
250     {
251         emit navigationChanged( 0 );
252     }
253 }
254
255 void InputManager::UpdateStatus()
256 {
257     /* Update playing status */
258     vlc_value_t val; val.i_int = 0;
259     var_Get( p_input, "state", &val );
260     if( i_old_playing_status != val.i_int )
261     {
262         i_old_playing_status = val.i_int;
263         emit statusChanged( val.i_int );
264     }
265 }
266
267 void InputManager::UpdateRate()
268 {
269     /* Update Rate */
270     int i_new_rate = var_GetInteger( p_input, "rate");
271     if( i_new_rate != i_rate )
272     {
273         i_rate = i_new_rate;
274         /* Update rate */
275         emit rateChanged( i_rate );
276     }
277 }
278
279 void InputManager::UpdateMeta()
280 {
281     /* Update text, name and nowplaying */
282     QString text;
283
284     char *psz_name = input_item_GetTitle( input_GetItem( p_input ) );
285     if( EMPTY_STR( psz_name ) )
286     {
287         free( psz_name );
288         psz_name = input_item_GetName( input_GetItem( p_input ) );
289     }
290
291     char *psz_nowplaying =
292         input_item_GetNowPlaying( input_GetItem( p_input ) );
293     if( !EMPTY_STR( psz_nowplaying ) )
294     {
295         text.sprintf( "%s - %s", psz_nowplaying, psz_name );
296     }
297     else
298     {
299         char *psz_artist = input_item_GetArtist( input_GetItem( p_input ) );
300         if( !EMPTY_STR( psz_artist ) )
301         {
302             text.sprintf( "%s - %s", psz_artist, psz_name );
303         }
304         else
305         {
306             text.sprintf( "%s", psz_name );
307         }
308         free( psz_artist );
309     }
310     free( psz_name );
311     free( psz_nowplaying );
312
313     if( old_name != text )
314     {
315         emit nameChanged( text );
316         old_name=text;
317     }
318 }
319
320 bool InputManager::hasAudio()
321 {
322     if( hasInput() )
323     {
324         vlc_value_t val;
325         var_Change( p_input, "audio-es", VLC_VAR_CHOICESCOUNT, &val, NULL );
326         return val.i_int > 0;
327     }
328     return false;
329 }
330
331 bool InputManager::hasVideo()
332 {
333     if( hasInput() )
334     {
335         vlc_value_t val;
336         var_Change( p_input, "video-es", VLC_VAR_CHOICESCOUNT, &val, NULL );
337         return val.i_int > 0;
338     }
339     return false;
340
341 }
342
343 void InputManager::UpdateSPU()
344 {
345     UpdateTeletext();
346 }
347
348 void InputManager::UpdateTeletext()
349 {
350     if( hasInput() )
351         telexToggle( var_GetInteger( p_input, "teletext-es" ) >= 0 );
352     else
353         telexToggle( false );
354 }
355
356
357
358 void InputManager::UpdateArt()
359 {
360     /* Update Art meta */
361     QString url;
362     char *psz_art = input_item_GetArtURL( input_GetItem( p_input ) );
363     url.sprintf("%s", psz_art );
364     free( psz_art );
365     if( artUrl != url )
366     {
367         artUrl = url.replace( "file://",QString("" ) );
368         /* Taglib seems to define a attachment://, It won't work yet */
369         artUrl = url.replace( "attachment://",QString("" ) );
370         emit artChanged( artUrl );
371         msg_Dbg( p_intf, "Art:  %s", qtu( artUrl ) );
372     }
373 }
374
375 /* User update of the slider */
376 void InputManager::sliderUpdate( float new_pos )
377 {
378     if( hasInput() )
379         var_SetFloat( p_input, "position", new_pos );
380 }
381
382 /* User togglePlayPause */
383 void InputManager::togglePlayPause()
384 {
385     vlc_value_t state;
386     var_Get( p_input, "state", &state );
387     state.i_int = ( state.i_int != PLAYING_S ) ? PLAYING_S : PAUSE_S;
388     var_Set( p_input, "state", state );
389     emit statusChanged( state.i_int );
390 }
391
392 void InputManager::sectionPrev()
393 {
394     if( hasInput() )
395     {
396         int i_type = var_Type( p_input, "next-chapter" );
397         vlc_value_t val; val.b_bool = true;
398         var_Set( p_input, (i_type & VLC_VAR_TYPE) != 0 ?
399                             "prev-chapter":"prev-title", val );
400     }
401 }
402
403 void InputManager::sectionNext()
404 {
405     if( hasInput() )
406     {
407         int i_type = var_Type( p_input, "next-chapter" );
408         vlc_value_t val; val.b_bool = true;
409         var_Set( p_input, (i_type & VLC_VAR_TYPE) != 0 ?
410                             "next-chapter":"next-title", val );
411     }
412 }
413
414 void InputManager::sectionMenu()
415 {
416     if( hasInput() )
417     {
418         vlc_value_t val; val.i_int = 2;
419         var_Set( p_input, "title  0", val );
420     }
421 }
422
423 void InputManager::telexGotoPage( int page )
424 {
425     if( hasInput() )
426     {
427         const int i_teletext_es = var_GetInteger( p_input, "teletext-es" );
428         const int i_spu_es = var_GetInteger( p_input, "spu-es" );
429
430         if( i_teletext_es >= 0 && i_teletext_es == i_spu_es )
431         {
432             vlc_object_t *p_vbi;
433             p_vbi = (vlc_object_t *) vlc_object_find_name( p_input,
434                         "zvbi", FIND_ANYWHERE );
435             if( p_vbi )
436             {
437                 var_SetInteger( p_vbi, "vbi-page", page );
438                 vlc_object_release( p_vbi );
439             }
440         }
441     }
442     emit setNewTelexPage( page );
443 }
444
445 void InputManager::telexToggle( bool b_enabled )
446 {
447     int i_page = 100;
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         b_enabled = i_teletext_es >= 0;
455         if( b_enabled && i_teletext_es == i_spu_es )
456         {
457             vlc_object_t *p_vbi;
458             p_vbi = (vlc_object_t *) vlc_object_find_name( p_input,
459                         "zvbi", FIND_ANYWHERE );
460             if( p_vbi )
461             {
462                 i_page = var_GetInteger( p_vbi, "vbi-page" );
463                 vlc_object_release( p_vbi );
464                 i_page = b_enabled ? i_page : 0;
465                 telexGotoPage( i_page );
466             }
467         }
468     }
469     emit teletextEnabled( b_enabled );
470 }
471
472 void InputManager::telexToggleButtons()
473 {
474     if( hasInput() )
475     {
476         const int i_teletext_es = var_GetInteger( p_input, "teletext-es" );
477         if( i_teletext_es >= 0 )
478         {
479             const int i_spu_es = var_GetInteger( p_input, "spu-es" );
480
481             if( i_teletext_es == i_spu_es )
482                 var_SetInteger( p_input, "spu-es", -1 );
483             else
484                 var_SetInteger( p_input, "spu-es", i_teletext_es );
485
486             emit toggleTelexButtons();
487         }
488     }
489 }
490
491 void InputManager::telexSetTransparency()
492 {
493     if( hasInput() )
494     {
495         vlc_object_t *p_vbi;
496         p_vbi = (vlc_object_t *) vlc_object_find_name( p_input,
497                     "zvbi", FIND_ANYWHERE );
498         if( p_vbi )
499         {
500             var_SetBool( p_vbi, "vbi-opaque", b_transparentTelextext );
501             b_transparentTelextext = !b_transparentTelextext;
502             vlc_object_release( p_vbi );
503         }
504     }
505     emit toggleTelexTransparency();
506 }
507
508 void InputManager::slower()
509 {
510     if( hasInput() )
511         var_SetVoid( p_input, "rate-slower" );
512 }
513
514 void InputManager::faster()
515 {
516     if( hasInput() )
517         var_SetVoid( p_input, "rate-faster" );
518 }
519
520 void InputManager::normalRate()
521 {
522     if( hasInput() )
523         var_SetInteger( p_input, "rate", INPUT_RATE_DEFAULT );
524 }
525
526 void InputManager::setRate( int new_rate )
527 {
528     if( hasInput() )
529         var_SetInteger( p_input, "rate", new_rate );
530 }
531
532 /**********************************************************************
533  * MainInputManager implementation. Wrap an input manager and
534  * take care of updating the main playlist input.
535  * Used in the main playlist Dialog
536  **********************************************************************/
537 MainInputManager * MainInputManager::instance = NULL;
538
539 MainInputManager::MainInputManager( intf_thread_t *_p_intf )
540                  : QObject(NULL), p_intf( _p_intf )
541 {
542     p_input = NULL;
543     im = new InputManager( this, p_intf );
544
545 //    var_AddCallback( THEPL, "item-change", PLItemChanged, this );
546     var_AddCallback( THEPL, "item-change", ItemChanged, im );
547     var_AddCallback( THEPL, "playlist-current", PLItemChanged, this );
548     var_AddCallback( THEPL, "activity", PLItemChanged, this );
549
550     var_AddCallback( p_intf->p_libvlc, "volume-change", VolumeChanged, this );
551
552     // No necessary, I think TODO REMOVE ME at the end
553     //var_AddCallback( THEPL, "intf-change", ItemChanged, im );
554
555     /* Warn our embedded IM about input changes */
556     CONNECT( this, inputChanged( input_thread_t * ),
557              im, setInput( input_thread_t * ) );
558
559     /* emit check if playlist has allready started playing */
560     vlc_value_t val;
561     var_Change( THEPL, "playlist-current", VLC_VAR_CHOICESCOUNT, &val, NULL );
562     IMEvent *event = new IMEvent( ItemChanged_Type, val.i_int);
563     QApplication::postEvent( this, static_cast<QEvent*>(event) );
564
565 }
566
567 MainInputManager::~MainInputManager()
568 {
569     if( p_input )
570     {
571        var_DelCallback( p_input, "state", PLItemChanged, this );
572        vlc_object_release( p_input );
573        emit inputChanged( NULL );
574     }
575
576     var_DelCallback( p_intf->p_libvlc, "volume-change", VolumeChanged, this );
577
578     var_DelCallback( THEPL, "activity", PLItemChanged, this );
579     var_DelCallback( THEPL, "item-change", ItemChanged, im );
580 //    var_DelCallback( THEPL, "item-change", PLItemChanged, this );
581
582     var_DelCallback( THEPL, "playlist-current", PLItemChanged, this );
583 }
584
585 void MainInputManager::customEvent( QEvent *event )
586 {
587     int type = event->type();
588     if ( type != ItemChanged_Type && type != VolumeChanged_Type )
589         return;
590
591     // msg_Dbg( p_intf, "New MainIM Event of type: %i", type );
592     if( type == VolumeChanged_Type )
593     {
594         emit volumeChanged();
595         return;
596     }
597
598     /* Should be PLItemChanged Event */
599     if( VLC_OBJECT_INTF == p_intf->i_object_type ) /* FIXME: don't use object type */
600     {
601         vlc_mutex_lock( &p_intf->change_lock );
602         if( p_input && ( p_input->b_dead || !vlc_object_alive (p_input) ) )
603         {
604             var_DelCallback( p_input, "state", PLItemChanged, this );
605             vlc_object_release( p_input );
606             emit inputChanged( NULL );
607             p_input = NULL;
608             vlc_mutex_unlock( &p_intf->change_lock );
609             return;
610         }
611
612         if( !p_input )
613         {
614             QPL_LOCK;
615             p_input = THEPL->p_input;
616             if( p_input && !( !vlc_object_alive (p_input) || p_input->b_dead) )
617             {
618                 vlc_object_yield( p_input );
619                 var_AddCallback( p_input, "state", PLItemChanged, this );
620                 emit inputChanged( p_input );
621             }
622             else
623                 p_input = NULL;
624             QPL_UNLOCK;
625         }
626         vlc_mutex_unlock( &p_intf->change_lock );
627     }
628     else
629     {
630         /* we are working as a dialogs provider */
631         playlist_t *p_playlist = pl_Yield( p_intf );
632         p_input = playlist_CurrentInput( p_playlist );
633         emit inputChanged( p_input );
634         vlc_object_release( p_input );
635         pl_Release( p_intf );
636     }
637 }
638
639 /* Playlist Control functions */
640 void MainInputManager::stop()
641 {
642    playlist_Stop( THEPL );
643 }
644
645 void MainInputManager::next()
646 {
647    playlist_Next( THEPL );
648 }
649
650 void MainInputManager::prev()
651 {
652    playlist_Prev( THEPL );
653 }
654
655 void MainInputManager::togglePlayPause()
656 {
657     if( p_input == NULL )
658     {
659         playlist_Play( THEPL );
660         return;
661     }
662     getIM()->togglePlayPause();
663 }
664
665 bool MainInputManager::teletextState()
666 {
667     im = getIM();
668     if( im->hasInput() )
669     {
670         const int i_teletext_es = var_GetInteger( getInput(), "teletext-es" );
671         const int i_spu_es = var_GetInteger( getInput(), "spu-es" );
672
673         return i_teletext_es >= 0 && i_teletext_es == i_spu_es;
674     }
675     return false;
676 }
677
678 /* Static callbacks */
679
680 /* IM */
681 static int InterfaceChanged( vlc_object_t *p_this, const char *psz_var,
682                            vlc_value_t oldval, vlc_value_t newval, void *param )
683 {
684     static int counter = 0;
685     InputManager *im = (InputManager*)param;
686
687     counter = ++counter % 4;
688     if(!counter)
689         return VLC_SUCCESS;
690     IMEvent *event = new IMEvent( PositionUpdate_Type, 0 );
691     QApplication::postEvent( im, static_cast<QEvent*>(event) );
692     return VLC_SUCCESS;
693 }
694
695 static int ItemStateChanged( vlc_object_t *p_this, const char *psz_var,
696                            vlc_value_t oldval, vlc_value_t newval, void *param )
697 {
698     InputManager *im = (InputManager*)param;
699
700     IMEvent *event = new IMEvent( ItemStateChanged_Type, 0 );
701     QApplication::postEvent( im, static_cast<QEvent*>(event) );
702     return VLC_SUCCESS;
703 }
704
705 static int ItemRateChanged( vlc_object_t *p_this, const char *psz_var,
706                            vlc_value_t oldval, vlc_value_t newval, void *param )
707 {
708     InputManager *im = (InputManager*)param;
709
710     IMEvent *event = new IMEvent( ItemRateChanged_Type, 0 );
711     QApplication::postEvent( im, static_cast<QEvent*>(event) );
712     return VLC_SUCCESS;
713 }
714
715 static int ItemTitleChanged( vlc_object_t *p_this, const char *psz_var,
716                            vlc_value_t oldval, vlc_value_t newval, void *param )
717 {
718     InputManager *im = (InputManager*)param;
719
720     IMEvent *event = new IMEvent( ItemTitleChanged_Type, 0 );
721     QApplication::postEvent( im, static_cast<QEvent*>(event) );
722     return VLC_SUCCESS;
723 }
724
725 static int ItemChanged( vlc_object_t *p_this, const char *psz_var,
726                         vlc_value_t oldval, vlc_value_t newval, void *param )
727 {
728     InputManager *im = (InputManager*)param;
729
730     IMEvent *event = new IMEvent( ItemChanged_Type, newval.i_int );
731     QApplication::postEvent( im, static_cast<QEvent*>(event) );
732     return VLC_SUCCESS;
733 }
734
735 static int ChangeSPU( vlc_object_t *p_this, const char *var, vlc_value_t o,
736                         vlc_value_t n, void *param )
737 {
738     InputManager *im = (InputManager*)param;
739     IMEvent *event = new IMEvent( ItemSpuChanged_Type, 0 );
740     QApplication::postEvent( im, static_cast<QEvent*>(event) );
741     return VLC_SUCCESS;
742 }
743
744 static int ChangeTeletext( vlc_object_t *p_this, const char *var, vlc_value_t o,
745                            vlc_value_t n, void *param )
746 {
747
748     InputManager *im = (InputManager*)param;
749     IMEvent *event = new IMEvent( ItemTeletextChanged_Type, 0 );
750     QApplication::postEvent( im, static_cast<QEvent*>(event) );
751     return VLC_SUCCESS;
752 }
753
754 /* MIM */
755 static int PLItemChanged( vlc_object_t *p_this, const char *psz_var,
756                         vlc_value_t oldval, vlc_value_t newval, void *param )
757 {
758     MainInputManager *mim = (MainInputManager*)param;
759
760     IMEvent *event = new IMEvent( ItemChanged_Type, newval.i_int );
761     QApplication::postEvent( mim, static_cast<QEvent*>(event) );
762     return VLC_SUCCESS;
763 }
764
765 static int VolumeChanged( vlc_object_t *p_this, const char *psz_var,
766                         vlc_value_t oldval, vlc_value_t newval, void *param )
767 {
768     MainInputManager *mim = (MainInputManager*)param;
769
770     IMEvent *event = new IMEvent( VolumeChanged_Type, newval.i_int );
771     QApplication::postEvent( mim, static_cast<QEvent*>(event) );
772     return VLC_SUCCESS;
773 }
774