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