]> git.sesse.net Git - vlc/blob - modules/gui/beos/VlcWrapper.cpp
Attempt to port new BeOS features from the stable branch.
[vlc] / modules / gui / beos / VlcWrapper.cpp
1 /*****************************************************************************
2  * intf_vlc_wrapper.h: BeOS plugin for vlc (derived from MacOS X port )
3  *****************************************************************************
4  * Copyright (C) 2001 VideoLAN
5  * $Id: VlcWrapper.cpp,v 1.4 2002/09/30 18:30:27 titer Exp $
6  *
7  * Authors: Florian G. Pflug <fgp@phlo.org>
8  *          Jon Lech Johansen <jon-vl@nanocrew.net>
9  *          Tony Casltey <tony@castley.net>
10  *          Stephan Aßmus <stippi@yellowbites.com>
11  *
12  * This program is free software{} you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation{} either version 2 of the License, or
15  * (at your option) any later version.
16  * 
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY{} without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program{} if not, write to the Free Software
24  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
25  *****************************************************************************/
26 /* VLC headers */
27 #include <SupportKit.h>
28
29 #include <vlc/vlc.h>
30 #include <vlc/intf.h>
31
32 #include "VlcWrapper.h"
33
34 Intf_VLCWrapper *Intf_VLCWrapper::getVLCWrapper(intf_thread_t *p_if)
35 {
36     static Intf_VLCWrapper *one_wrapper;
37     if (one_wrapper == NULL )
38     {
39        one_wrapper = new Intf_VLCWrapper(p_if);
40     }
41     return one_wrapper;
42 }
43
44 Intf_VLCWrapper::Intf_VLCWrapper(intf_thread_t *p_if)
45 {
46     p_intf = p_if;
47 }
48
49 Intf_VLCWrapper::~Intf_VLCWrapper()
50 {
51 }
52
53 #if 0
54 bool Intf_VLCWrapper::manage()
55 {
56    p_main->p_intf->pf_manage( p_main->p_intf );
57    
58    if ( p_main->p_intf->b_die )
59    {
60        // exit the lot
61        return( 1 );
62    }
63    
64    if ( p_input_bank->pp_input[0] != NULL )
65    {
66        vlc_mutex_lock( &p_input_bank->pp_input[0]->stream.stream_lock );
67         if( !p_input_bank->pp_input[0]->b_die )
68         {
69             /* New input or stream map change */
70             if( p_input_bank->pp_input[0]->stream.b_changed ||
71                 p_main->p_intf->p_sys->i_part !=
72                 p_input_bank->pp_input[0]->stream.p_selected_area->i_part )
73             {
74                 setupMenus();
75                 p_main->p_intf->p_sys->b_disabled_menus = 0;
76             }
77         }
78         vlc_mutex_unlock( &p_input_bank->pp_input[0]->stream.stream_lock );
79     }
80     else if ( !p_main->p_intf->p_sys->b_disabled_menus )
81     {
82         setupMenus();
83         p_main->p_intf->p_sys->b_disabled_menus = 1;
84     }
85     return( 0 );
86 }
87 #endif
88
89 void Intf_VLCWrapper::quit()
90 {
91     p_intf->b_die = 1;
92 }
93     
94 /* playlist control */
95 bool Intf_VLCWrapper::playlistPlay()
96 {
97     playlist_t *p_playlist = 
98                 (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
99                                                        FIND_ANYWHERE );
100
101     vlc_mutex_lock( &p_playlist->object_lock );
102     if( p_playlist->i_size )
103     {
104         vlc_mutex_unlock( &p_playlist->object_lock );
105         playlist_Play( p_playlist );
106         vlc_object_release( p_playlist );
107     }
108     else
109     {
110         vlc_mutex_unlock( &p_playlist->object_lock );
111         vlc_object_release( p_playlist );
112     }
113
114     return( true );
115 }
116
117 void Intf_VLCWrapper::playlistPause()
118 {
119     toggle_mute(  );
120     playlist_t *p_playlist = 
121                 (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
122                                                        FIND_ANYWHERE );
123     playlist_Pause( p_playlist );
124     vlc_object_release( p_playlist );
125 }
126
127 void Intf_VLCWrapper::playlistStop()
128 {
129     playlist_t *p_playlist = 
130                 (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
131                                                        FIND_ANYWHERE );
132
133     playlist_Stop( p_playlist );
134     vlc_object_release( p_playlist );
135 }
136
137 void Intf_VLCWrapper::playlistNext()
138 {
139     playlist_t *p_playlist = 
140                 (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
141                                                        FIND_ANYWHERE );
142
143     playlist_Next( p_playlist );
144     vlc_object_release( p_playlist );
145 }
146
147 void Intf_VLCWrapper::playlistPrev()
148 {
149     playlist_t *p_playlist = 
150                 (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
151                                                        FIND_ANYWHERE );
152
153     playlist_Prev( p_playlist );
154     vlc_object_release( p_playlist );
155 }
156
157 void Intf_VLCWrapper::playlistSkip(int i)
158 {
159     playlist_t *p_playlist = 
160                 (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
161                                                        FIND_ANYWHERE );
162
163     playlist_Skip( p_playlist, i );
164     vlc_object_release( p_playlist );
165 }
166
167 void Intf_VLCWrapper::playlistGoto(int i)
168 {
169     playlist_t *p_playlist = 
170                 (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
171                                                        FIND_ANYWHERE );
172
173     playlist_Goto( p_playlist, i );
174     vlc_object_release( p_playlist );
175 }
176
177 void Intf_VLCWrapper::playlistJumpTo( int pos )
178 {
179 #if 0
180         // sanity checks
181         if ( pos < 0 )
182                 pos = 0;
183         int size = playlistSize();
184         if (pos >= size)
185                 pos = size - 1;
186         // weird hack
187     if( p_input_bank->pp_input[0] != NULL )
188                 pos--;
189         // stop current stream
190         playlistStop();
191         // modify current position in playlist
192         playlistLock();
193         p_main->p_playlist->i_index = pos;
194         playlistUnlock();
195         // start playing
196         playlistPlay();
197 #endif
198 }
199
200 int Intf_VLCWrapper::playlistCurrentPos()
201 {
202         /*playlistLock();
203         int pos = p_main->p_playlist->i_index;
204         playlistUnlock();
205         return pos;*/
206 }
207
208 int Intf_VLCWrapper::playlistSize()
209 {
210         /*playlistLock();
211         int size = p_main->p_playlist->i_size;
212         playlistUnlock();
213         return size;*/
214 }
215
216 void Intf_VLCWrapper::playlistLock()
217 {
218         /*vlc_mutex_lock( &p_main->p_playlist->change_lock );*/
219 }
220
221 void Intf_VLCWrapper::playlistUnlock()
222 {
223         /*vlc_mutex_unlock( &p_main->p_playlist->change_lock );*/
224 }
225
226 void Intf_VLCWrapper::getNavCapabilities( bool* canSkipPrev,
227                                                                                   bool* canSkipNext )
228 {
229 #if 0
230         if ( canSkipPrev && canSkipNext )
231         {
232                 // init the parameters
233                 *canSkipPrev = false;
234                 *canSkipNext = false;
235                 // get playlist info
236                 playlistLock();
237                 int pos = p_main->p_playlist->i_index;
238                 int size = p_main->p_playlist->i_size;
239                 playlistUnlock();
240
241                 input_thread_t* input = p_input_bank->pp_input[0];
242                 // see if we have got a stream going            
243                 if ( input )
244                 {
245                         vlc_mutex_lock( &input->stream.stream_lock );
246
247                         bool hasTitles = input->stream.i_area_nb > 1;
248                         int numChapters = input->stream.p_selected_area->i_part_nb;
249                         bool hasChapters = numChapters > 1;
250                         // first, look for chapters
251                         if ( hasChapters )
252                         {
253                                 *canSkipPrev = input->stream.p_selected_area->i_part > 0;
254                                 *canSkipNext = input->stream.p_selected_area->i_part <
255                                                                          input->stream.p_selected_area->i_part_nb - 1;
256                         }
257                         // if one of the skip capabilities is false,
258                         // make it depend on titles instead
259                         if ( !*canSkipPrev && hasTitles )
260                                 *canSkipPrev = input->stream.p_selected_area->i_id > 1;
261                         if ( !*canSkipNext && hasTitles )
262                                 *canSkipNext = input->stream.p_selected_area->i_id < input->stream.i_area_nb - 1;
263
264                         vlc_mutex_unlock( &input->stream.stream_lock );
265                 }
266                 // last but not least, make capabilities depend on playlist
267                 if ( !*canSkipPrev )
268                         *canSkipPrev = pos > 0;
269                 if ( !*canSkipNext )
270                         *canSkipNext = pos < size - 1;
271         }
272 #endif
273 }
274
275 void Intf_VLCWrapper::navigatePrev()
276 {
277 #if 0
278         bool hasSkiped = false;
279
280         input_thread_t* input = p_input_bank->pp_input[0];
281         // see if we have got a stream going            
282         if ( input )
283         {
284                 // get information from stream (lock it while looking at it)
285                 vlc_mutex_lock( &input->stream.stream_lock );
286
287                 int currentTitle = input->stream.p_selected_area->i_id;
288                 int currentChapter = input->stream.p_selected_area->i_part;
289                 int numTitles = input->stream.i_area_nb;
290                 bool hasTitles = numTitles > 1;
291                 int numChapters = input->stream.p_selected_area->i_part_nb;
292                 bool hasChapters = numChapters > 1;
293
294                 vlc_mutex_unlock( &input->stream.stream_lock );
295
296                 // first, look for chapters
297                 if ( hasChapters )
298                 {
299                         // skip to the previous chapter
300                         currentChapter--;
301
302                         if ( currentChapter >= 0 )
303                         {
304                                 toggleChapter( currentChapter );
305                                 hasSkiped = true;
306                         }
307                 }
308                 // if we couldn't skip chapters, try titles instead
309                 if ( !hasSkiped && hasTitles )
310                 {
311                         // skip to the previous title
312                         currentTitle--;
313                         // disallow area 0 since it is used for video_ts.vob
314                         if( currentTitle > 0 )
315                         {
316                                 toggleTitle(currentTitle);
317                                 hasSkiped = true;
318                         }
319                 }
320
321         }
322         // last but not least, skip to previous file
323         if ( !hasSkiped )
324                 playlistPrev();
325 #endif
326 }
327
328 void Intf_VLCWrapper::navigateNext()
329 {
330 #if 0
331         bool hasSkiped = false;
332
333         input_thread_t* input = p_input_bank->pp_input[0];
334         // see if we have got a stream going            
335         if ( input )
336         {
337                 // get information from stream (lock it while looking at it)
338                 vlc_mutex_lock( &input->stream.stream_lock );
339
340                 int currentTitle = input->stream.p_selected_area->i_id;
341                 int currentChapter = input->stream.p_selected_area->i_part;
342                 int numTitles = input->stream.i_area_nb;
343                 bool hasTitles = numTitles > 1;
344                 int numChapters = input->stream.p_selected_area->i_part_nb;
345                 bool hasChapters = numChapters > 1;
346
347                 vlc_mutex_unlock( &input->stream.stream_lock );
348
349                 // first, look for chapters
350                 if ( hasChapters )
351                 {
352                         // skip to the next chapter
353                         currentChapter++;
354                         if ( currentChapter < numChapters )
355                         {
356                                 toggleChapter( currentChapter );
357                                 hasSkiped = true;
358                         }
359                 }
360                 // if we couldn't skip chapters, try titles instead
361                 if ( !hasSkiped && hasTitles )
362                 {
363                         // skip to the next title
364                         currentTitle++;
365                         // disallow area 0 since it is used for video_ts.vob
366                         if ( currentTitle < numTitles - 1 )
367                         {
368                                 toggleTitle(currentTitle);
369                                 hasSkiped = true;
370                         }
371                 }
372
373         }
374         // last but not least, skip to next file
375         if ( !hasSkiped )
376                 playlistNext();
377 #endif
378 }
379
380
381 //void Intf_VLCWrapper::channelNext()
382 //{
383 //    intf_thread_t * p_intf = p_main->p_intf;
384 //
385 //    p_intf->p_sys->i_channel++;
386 //
387 //    intf_WarnMsg( 3, "intf info: joining channel %d", p_intf->p_sys->i_channel );
388 //
389 //    vlc_mutex_lock( &p_intf->change_lock );
390 //
391 //    network_ChannelJoin( p_intf->p_sys->i_channel );
392 //    p_intf->pf_manage( p_intf );
393 //
394 //    vlc_mutex_unlock( &p_intf->change_lock );
395 //}
396 //
397 //void Intf_VLCWrapper::channelPrev()
398 //{
399 //    intf_thread_t * p_intf = p_main->p_intf;
400 //
401 //    if ( p_intf->p_sys->i_channel )
402 //    {
403 //        p_intf->p_sys->i_channel--;
404 //    }
405 //
406 //    intf_WarnMsg( 3, "intf info: joining channel %d", p_intf->p_sys->i_channel );
407 //
408 //    vlc_mutex_lock( &p_intf->change_lock );
409 //
410 //    network_ChannelJoin( p_intf->p_sys->i_channel );
411 //    p_intf->pf_manage( p_intf );
412 //
413 //    vlc_mutex_unlock( &p_intf->change_lock );
414 //
415 //}
416
417 void Intf_VLCWrapper::loop()
418 {
419 #if 0
420     intf_thread_t * p_intf = p_main->p_intf;
421
422     if ( p_intf->p_sys->b_loop )
423     {
424         intf_PlaylistDelete( p_main->p_playlist,
425                              p_main->p_playlist->i_size - 1 );
426     }
427     else
428     {
429         intf_PlaylistAdd( p_main->p_playlist, PLAYLIST_END, 
430                           "vlc:loop" );
431     }
432     p_intf->p_sys->b_loop = !p_intf->p_sys->b_loop;
433 #endif
434 }
435
436
437     /* playback control */
438 void Intf_VLCWrapper::playSlower()
439 {
440     if( p_intf->p_sys->p_input != NULL )
441     {
442         input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_SLOWER );
443     }
444     if (p_intf->p_sys->p_input->stream.control.i_rate == DEFAULT_RATE)
445     {
446         toggle_mute(  );
447     }
448     else
449     {
450         toggle_mute ( );
451     }
452 }
453
454 void Intf_VLCWrapper::playFaster()
455 {
456     if( p_intf->p_sys->p_input != NULL )
457     {
458         input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_FASTER );
459     }
460     if (p_intf->p_sys->p_input->stream.control.i_rate == DEFAULT_RATE)
461     {
462         toggle_mute(  );
463     }
464     else
465     {
466         toggle_mute ( );
467     }
468 }
469
470 void Intf_VLCWrapper::volume_mute()
471 {
472 /*
473     if( p_aout_bank->i_count > 0
474         && p_aout_bank->pp_aout[0] != NULL )
475     {
476             if( !p_main->p_intf->p_sys->b_mute )
477                 {
478                     p_main->p_intf->p_sys->i_saved_volume = 
479                                         p_aout_bank->pp_aout[0]->i_volume;
480                     p_aout_bank->pp_aout[0]->i_volume = 0;
481                     p_main->p_intf->p_sys->b_mute = 1;
482                 }
483     }
484 */
485 }
486
487 void Intf_VLCWrapper::volume_restore()
488 {
489 /*
490     if( p_aout_bank->i_count > 0
491         && p_aout_bank->pp_aout[0] != NULL )
492     {
493             p_aout_bank->pp_aout[0]->i_volume = 
494                               p_main->p_intf->p_sys->i_saved_volume;
495                 p_main->p_intf->p_sys->i_saved_volume = 0;
496             p_main->p_intf->p_sys->b_mute = 0;
497     }
498 */
499 }
500
501 void Intf_VLCWrapper::set_volume(int value)
502 {
503 #if 0
504     if( p_aout_bank->i_count > 0
505         && p_aout_bank->pp_aout[0] != NULL )
506     {
507                 // make sure value is within bounds
508                 if (value < 0)
509                         value = 0;
510                 if (value > AOUT_VOLUME_MAX)
511                         value = AOUT_VOLUME_MAX;
512                 vlc_mutex_lock( &p_aout_bank->lock );
513                         // unmute volume if muted
514                         if ( p_main->p_intf->p_sys->b_mute )
515                                 p_main->p_intf->p_sys->b_mute = 0;
516                         // set every stream to the given value
517                         for ( int i = 0 ; i < p_aout_bank->i_count ; i++ )
518                         {
519                                 if ( p_aout_bank->pp_aout[i] )
520                                         p_aout_bank->pp_aout[i]->i_volume = value;
521                         }
522                 vlc_mutex_unlock( &p_aout_bank->lock );
523     }
524 #endif
525 }
526
527 void Intf_VLCWrapper::toggle_mute()
528 {
529 /*
530     if( p_aout_bank->i_count > 0
531         && p_aout_bank->pp_aout[0] != NULL )
532         {
533             if ( p_main->p_intf->p_sys->b_mute )
534             {
535                 Intf_VLCWrapper::volume_restore();
536             }
537             else
538             {
539                 Intf_VLCWrapper::volume_mute();
540             }
541         }
542 */
543 }
544
545 bool Intf_VLCWrapper::is_muted()
546 {
547 #if 0
548         bool muted = true;
549         if ( p_aout_bank->i_count > 0 )
550         {
551                 vlc_mutex_lock( &p_aout_bank->lock );
552                         for ( int i = 0 ; i < p_aout_bank->i_count ; i++ )
553                         {
554                                 if ( p_aout_bank->pp_aout[i]
555                                          && p_aout_bank->pp_aout[i]->i_volume > 0 )
556                                 {
557                                         muted = false;
558                                         break;
559                                 }
560                         }
561                 vlc_mutex_unlock( &p_aout_bank->lock );
562 // unfortunately, this is not reliable!
563 //              return p_main->p_intf->p_sys->b_mute;
564         }
565         return muted;
566 #endif
567 }
568
569 bool Intf_VLCWrapper::is_playing()
570 {
571 /*
572         bool playing = false;
573         if ( p_input_bank->pp_input[0] )
574         {
575                 switch ( p_input_bank->pp_input[0]->stream.control.i_status )
576                 {
577                         case PLAYING_S:
578                         case FORWARD_S:
579                         case BACKWARD_S:
580                         case START_S:
581                                 playing = true;
582                     break;
583                         case PAUSE_S:
584                         case UNDEF_S:
585                         case NOT_STARTED_S:
586                         default:
587                                 break;
588                 }
589         }
590         return playing;
591 */
592 }
593
594 void Intf_VLCWrapper::maxvolume()
595 {
596 /*
597     if( p_aout_bank->i_count > 0
598         && p_aout_bank->pp_aout[0] != NULL )
599     {
600             if( p_main->p_intf->p_sys->b_mute )
601             {
602                 p_main->p_intf->p_sys->i_saved_volume = VOLUME_MAX;
603             }
604             else
605             {
606                 p_aout_bank->pp_aout[0]->i_volume = VOLUME_MAX;
607             }
608     }
609 */
610 }
611
612 bool Intf_VLCWrapper::has_audio()
613 {
614     /* return (p_aout_bank->i_count > 0); */
615 }
616
617 //void Intf_VLCWrapper::fullscreen()
618 //{
619 //    if( p_vout_bank->pp_vout[0] != NULL )
620 //    {
621 //        p_vout_bank->pp_vout[0]->i_changes |= VOUT_FULLSCREEN_CHANGE;
622 //    }
623 //}
624
625 void Intf_VLCWrapper::eject(){}
626
627     /* playback info */
628
629 BString*  Intf_VLCWrapper::getTimeAsString()
630 {
631     static char psz_currenttime[ OFFSETTOTIME_MAX_SIZE ];
632         
633     if( p_intf->p_sys->p_input == NULL )
634     {
635         return (new BString("00:00:00"));
636     }     
637    
638     input_OffsetToTime( p_intf->p_sys->p_input, 
639                         psz_currenttime, 
640                         p_intf->p_sys->p_input->stream.p_selected_area->i_tell );        
641
642     return(new BString(psz_currenttime));
643 }
644
645 float  Intf_VLCWrapper::getTimeAsFloat()
646 {
647     float f_time = 0.0;
648
649     if( p_intf->p_sys->p_input != NULL )
650     {
651         f_time = (float)p_intf->p_sys->p_input->stream.p_selected_area->i_tell / 
652                  (float)p_intf->p_sys->p_input->stream.p_selected_area->i_size;
653     }    
654     else
655     {
656         f_time = 0.0;
657     }
658     return( f_time );
659 }
660
661 void   Intf_VLCWrapper::setTimeAsFloat(float f_position)
662 {
663     if( p_intf->p_sys->p_input != NULL )
664     {
665         input_Seek( p_intf->p_sys->p_input, 
666                    (long long int)(p_intf->p_sys->p_input->stream.p_selected_area->i_size * f_position / 100), 
667                    INPUT_SEEK_SET);
668     }
669 }
670
671 bool   Intf_VLCWrapper::playlistPlaying()
672
673     /* return( !p_main->p_playlist->b_stopped ); */
674 }
675
676 BList  *Intf_VLCWrapper::playlistAsArray()
677
678     int i;
679     playlist_t *p_playlist = 
680                 (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
681                                                        FIND_ANYWHERE );
682
683     BList* p_list = new BList(p_playlist->i_size);
684     
685     vlc_mutex_lock( &p_playlist->object_lock );
686
687     for( i = 0; i < p_playlist->i_size; i++ )
688     {
689         p_list->AddItem(new BString(p_playlist->pp_items[i]->psz_name));
690     }
691
692     vlc_mutex_unlock( &p_playlist->object_lock );
693     vlc_object_release( p_playlist );
694     return( p_list );
695 }
696
697     /* open file/disc/network */
698 void Intf_VLCWrapper::openFiles( BList* o_files, bool replace )
699 {
700     BString *o_file;
701     playlist_t *p_playlist = 
702                (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
703                                                       FIND_ANYWHERE );
704
705     while( ( o_file = (BString *)o_files->LastItem() ) )
706     {
707         o_files->RemoveItem(o_files->CountItems() - 1);
708         playlist_Add( p_playlist, o_file->String(),
709                   PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END );
710         delete o_file;
711     }
712
713     vlc_object_release( p_playlist );
714 }
715
716 void Intf_VLCWrapper::openDisc(BString o_type, BString o_device, int i_title, int i_chapter)
717 {
718     BString o_source("");
719     o_source << o_type << ":" << o_device ;
720
721     playlist_t *p_playlist = 
722                (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
723                                                       FIND_ANYWHERE );
724     playlist_Add( p_playlist, o_source.String(),
725                   PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END );
726     vlc_object_release( p_playlist );
727 }
728
729 void Intf_VLCWrapper::openNet(BString o_addr, int i_port)
730 {
731 }
732
733 void Intf_VLCWrapper::openNetChannel(BString o_addr, int i_port)
734 {
735 }
736
737 void Intf_VLCWrapper::openNetHTTP(BString o_addr)
738 {
739 }
740
741
742     /* menus management */
743 void Intf_VLCWrapper::toggleProgram(int i_program){}
744
745 void Intf_VLCWrapper::toggleTitle(int i_title)
746 {
747     if( p_intf->p_sys->p_input != NULL )
748     {
749         input_ChangeArea( p_intf->p_sys->p_input,
750                           p_intf->p_sys->p_input->stream.pp_areas[i_title] );
751
752         vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock );
753         //setupMenus();
754
755         vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock );
756     }
757 }
758
759 void Intf_VLCWrapper::toggleChapter(int i_chapter)
760 {
761     if( p_intf->p_sys->p_input != NULL )
762     {
763         p_intf->p_sys->p_input->stream.p_selected_area->i_part = i_chapter;
764         input_ChangeArea( p_intf->p_sys->p_input,
765                           p_intf->p_sys->p_input->stream.p_selected_area );
766
767         vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock );
768 //        setupMenus();
769         vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock );
770     }
771 }
772
773 void Intf_VLCWrapper::toggleLanguage(int i_language)
774 {
775
776     int32 i_old = -1;
777     int i_cat = AUDIO_ES;
778
779     vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock );
780     for( int i = 0; i < p_intf->p_sys->p_input->stream.i_selected_es_number ; i++ )
781     {
782         if( p_intf->p_sys->p_input->stream.pp_selected_es[i]->i_cat == i_cat )
783         {
784             i_old = i;
785             break;
786         }
787     }
788     vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock );
789
790     msg_Info( p_intf, "Old: %d,  New: %d", i_old, i_language);
791     if( i_language != -1 )
792     {
793         input_ToggleES( p_intf->p_sys->p_input, 
794                         p_intf->p_sys->p_input->stream.pp_selected_es[i_language],
795                         VLC_TRUE );
796     }
797
798     if( (i_old != -1) && (i_old != i_language) )
799     {
800         input_ToggleES( p_intf->p_sys->p_input, 
801                         p_intf->p_sys->p_input->stream.pp_selected_es[i_old],
802                         VLC_FALSE );
803     }
804 }
805
806 void Intf_VLCWrapper::toggleSubtitle(int i_subtitle)
807 {
808     int32 i_old = -1;
809     int i_cat = SPU_ES;
810
811     vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock );
812     for( int i = 0; i < p_intf->p_sys->p_input->stream.i_selected_es_number ; i++ )
813     {
814         if( p_intf->p_sys->p_input->stream.pp_selected_es[i]->i_cat == i_cat )
815         {
816             i_old = i;
817             break;
818         }
819     }
820     vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock );
821     
822     msg_Info( p_intf, "Old: %d,  New: %d", i_old, i_subtitle);
823     if( i_subtitle != -1 )
824     {
825         input_ToggleES( p_intf->p_sys->p_input, 
826                         p_intf->p_sys->p_input->stream.pp_selected_es[i_subtitle],
827                         VLC_TRUE );
828     }
829
830     if( (i_old != -1) && (i_old != i_subtitle) )
831     {
832         input_ToggleES( p_intf->p_sys->p_input, 
833                         p_intf->p_sys->p_input->stream.pp_selected_es[i_old],
834                         VLC_FALSE );
835     }
836 }
837
838
839 void Intf_VLCWrapper::setupMenus(){}
840 int  Intf_VLCWrapper::inputGetStatus() {}