]> git.sesse.net Git - vlc/blob - modules/gui/beos/VlcWrapper.cpp
Disabled DVD menus by default for 0.5.0
[vlc] / modules / gui / beos / VlcWrapper.cpp
1 /*****************************************************************************
2  * VlcWrapper.cpp: BeOS plugin for vlc (derived from MacOS X port)
3  *****************************************************************************
4  * Copyright (C) 2001 VideoLAN
5  * $Id: VlcWrapper.cpp,v 1.22 2003/01/27 10:29: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 #include <AppKit.h>
28 #include <InterfaceKit.h>
29 #include <SupportKit.h>
30
31 #include <vlc/vlc.h>
32 #include <vlc/intf.h>
33 extern "C" {
34 #include <audio_output.h>
35 #include <aout_internal.h>
36 }
37
38 #include "VlcWrapper.h"
39 #include "MsgVals.h"
40
41 /* constructor */
42 VlcWrapper::VlcWrapper( intf_thread_t *p_interface )
43 {
44     p_intf = p_interface;
45     p_input = NULL;
46     p_aout = NULL;
47     p_playlist = (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
48                                                 FIND_ANYWHERE );
49 }
50
51 /* destructor */
52 VlcWrapper::~VlcWrapper()
53 {
54     if( p_input )
55     {
56         vlc_object_release( p_input );
57     }
58     if( p_playlist )
59     {
60         vlc_object_release( p_playlist );
61     }
62     if( p_aout )
63     {
64         vlc_object_release( p_aout );
65     }
66 }
67
68 /* UpdateInputAndAOut: updates p_input and p_aout, returns true if the
69    interface needs to be updated */
70 bool VlcWrapper::UpdateInputAndAOut()
71 {
72     if( p_input == NULL )
73     {
74         p_input = (input_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_INPUT,
75                                                      FIND_ANYWHERE );
76     }
77     if( p_aout == NULL )
78     {
79         p_aout = (aout_instance_t*)vlc_object_find( p_intf, VLC_OBJECT_AOUT,
80                                                     FIND_ANYWHERE );
81     }
82         
83     if( p_input != NULL )
84     {
85         if( p_input->b_dead )
86         {
87             vlc_object_release( p_input );
88             p_input = NULL;
89             
90             if( p_aout )
91             {
92                 vlc_object_release( p_aout );
93                 p_aout = NULL;
94             }
95         }
96         return true;
97     }
98     return false;
99 }
100
101
102 /***************************
103  * input infos and control *
104  ***************************/
105
106 bool VlcWrapper::HasInput()
107 {
108     return ( p_input != NULL );
109 }
110
111 int VlcWrapper::InputStatus()
112 {
113     if( !p_input )
114     {
115         return UNDEF_S;
116     }
117     return p_input->stream.control.i_status;
118 }
119
120 int VlcWrapper::InputRate()
121 {
122     if( !p_input )
123     {
124         return DEFAULT_RATE;
125     }
126     return p_input->stream.control.i_rate;
127 }
128
129 void VlcWrapper::InputSlower()
130 {
131     if( p_input != NULL )
132     {
133         input_SetStatus( p_input, INPUT_STATUS_SLOWER );
134     }
135 }
136
137 void VlcWrapper::InputFaster()
138 {
139     if( p_input != NULL )
140     {
141         input_SetStatus( p_input, INPUT_STATUS_FASTER );
142     }
143 }
144
145 BList * VlcWrapper::GetChannels( int i_cat )
146 {
147     if( p_input )
148     {
149         unsigned int i;
150         uint32 what;
151         const char* fieldName;
152
153         switch( i_cat )
154         {
155             case AUDIO_ES:
156             {
157                 what = SELECT_CHANNEL;
158                 fieldName = "channel";
159                 break;
160             }
161             case SPU_ES:
162             {
163                 what = SELECT_SUBTITLE;
164                 fieldName = "subtitle";
165                 break;
166             }
167             default:
168             return NULL;
169        }
170
171         vlc_mutex_lock( &p_input->stream.stream_lock );
172       
173         /* find which track is currently playing */
174         es_descriptor_t *p_es = NULL;
175         for( i = 0; i < p_input->stream.i_selected_es_number; i++ )
176         {
177             if( p_input->stream.pp_selected_es[i]->i_cat == i_cat )
178                 p_es = p_input->stream.pp_selected_es[i];
179         }
180         
181         /* build a list of all tracks */
182         BList *list = new BList( p_input->stream.i_es_number );
183         BMenuItem *menuItem;
184         BMessage *message;
185         char *trackName;
186         
187         /* "None" */
188         message = new BMessage( what );
189         message->AddInt32( fieldName, -1 );
190         menuItem = new BMenuItem( "None", message );
191         if( !p_es )
192             menuItem->SetMarked( true );
193         list->AddItem( menuItem );
194         
195         for( i = 0; i < p_input->stream.i_es_number; i++ )
196         {
197             if( p_input->stream.pp_es[i]->i_cat == i_cat )
198             {
199                 message = new BMessage( what );
200                 message->AddInt32( fieldName, i );
201                 if( strlen( p_input->stream.pp_es[i]->psz_desc ) )
202                     trackName = strdup( p_input->stream.pp_es[i]->psz_desc );
203                 else
204                     trackName = "<unknown>";
205                 menuItem = new BMenuItem( trackName, message );
206                 if( p_input->stream.pp_es[i] == p_es )
207                     menuItem->SetMarked( true );
208                 list->AddItem( menuItem );
209             }
210         }
211         
212         vlc_mutex_unlock( &p_input->stream.stream_lock );
213
214         return list;
215     }
216     return NULL;
217 }
218
219 void VlcWrapper::ToggleLanguage( int i_language )
220 {
221     es_descriptor_t * p_es = NULL;
222     es_descriptor_t * p_es_old = NULL;
223
224     vlc_mutex_lock( &p_input->stream.stream_lock );
225     for( unsigned int i = 0; i < p_input->stream.i_selected_es_number ; i++ )
226     {
227         if( p_input->stream.pp_selected_es[i]->i_cat == AUDIO_ES )
228         {
229             p_es_old = p_input->stream.pp_selected_es[i];
230             break;
231         }
232     }
233     vlc_mutex_unlock( &p_input->stream.stream_lock );
234     
235     if( i_language != -1 )
236     {
237         p_es = p_input->stream.pp_es[i_language];
238     }
239     if( p_es == p_es_old )
240     {
241         return;
242     }
243     if( p_es_old )
244     {
245         input_ToggleES( p_input, p_es_old, VLC_FALSE );
246     }
247     if( p_es )
248     {
249         input_ToggleES( p_input, p_es, VLC_TRUE );
250     }
251 }
252
253 void VlcWrapper::ToggleSubtitle( int i_subtitle )
254 {
255     es_descriptor_t * p_es = NULL;
256     es_descriptor_t * p_es_old = NULL;
257
258     vlc_mutex_lock( &p_input->stream.stream_lock );
259     for( unsigned int i = 0; i < p_input->stream.i_selected_es_number ; i++ )
260     {
261         if( p_input->stream.pp_selected_es[i]->i_cat == SPU_ES )
262         {
263             p_es_old = p_input->stream.pp_selected_es[i];
264             break;
265         }
266     }
267     vlc_mutex_unlock( &p_input->stream.stream_lock );
268     
269     if( i_subtitle != -1 )
270     {
271         p_es = p_input->stream.pp_es[i_subtitle];
272     }
273     if( p_es == p_es_old )
274     {
275         return;
276     }
277     if( p_es_old )
278     {
279         input_ToggleES( p_input, p_es_old, VLC_FALSE );
280     }
281     if( p_es )
282     {
283         input_ToggleES( p_input, p_es, VLC_TRUE );
284     }
285 }
286
287 const char * VlcWrapper::GetTimeAsString()
288 {
289     static char psz_currenttime[ OFFSETTOTIME_MAX_SIZE ];
290         
291     if( p_input == NULL )
292     {
293         return ("-:--:--");
294     }     
295    
296     input_OffsetToTime( p_input, 
297                         psz_currenttime, 
298                         p_input->stream.p_selected_area->i_tell );        
299
300     return(psz_currenttime);
301 }
302
303 float VlcWrapper::GetTimeAsFloat()
304 {
305     float f_time = 0.0;
306
307     if( p_input != NULL )
308     {
309         f_time = (float)p_input->stream.p_selected_area->i_tell / 
310                  (float)p_input->stream.p_selected_area->i_size;
311     }    
312     else
313     {
314         f_time = 0.0;
315     }
316     return( f_time );
317 }
318
319 void VlcWrapper::SetTimeAsFloat( float f_position )
320 {
321     if( p_input != NULL )
322     {
323         input_Seek( p_input, 
324                    (long long int)(p_input->stream.p_selected_area->i_size
325                        * f_position / SEEKSLIDER_RANGE ), 
326                    INPUT_SEEK_SET);
327     }
328 }
329
330 bool VlcWrapper::IsPlaying()
331 {
332
333         bool playing = false;
334         if ( p_input )
335         {
336                 switch ( p_input->stream.control.i_status )
337                 {
338                         case PLAYING_S:
339                         case FORWARD_S:
340                         case BACKWARD_S:
341                         case START_S:
342                                 playing = true;
343                     break;
344                         case PAUSE_S:
345                         case UNDEF_S:
346                         case NOT_STARTED_S:
347                         default:
348                                 break;
349                 }
350         }
351         return playing;
352
353 }
354
355 /************
356  * playlist *
357  ************/
358
359 void VlcWrapper::OpenFiles( BList* o_files, bool replace )
360 {
361     BString *o_file;
362     int size = PlaylistSize();
363         bool wasEmpty = ( size < 1 );
364
365     /* delete current playlist */
366     if( replace )
367     {
368         for( int i = 0; i < size; i++ )
369         {
370             playlist_Delete( p_playlist, 0 );
371         }
372     }
373
374     /* append files */
375     while( ( o_file = (BString *)o_files->LastItem() ) )
376     {
377         playlist_Add( p_playlist, o_file->String(),
378                       PLAYLIST_APPEND, PLAYLIST_END );
379         o_files->RemoveItem(o_files->CountItems() - 1);
380     }
381     
382     /* eventually restart playing */
383     if( replace || wasEmpty )
384     {
385         playlist_Stop( p_playlist );
386         playlist_Play( p_playlist );
387     }
388 }
389  
390 void VlcWrapper::OpenDisc(BString o_type, BString o_device, int i_title, int i_chapter)
391 {
392     if( p_intf->p_sys->b_dvdmenus )
393         o_device.Prepend( "dvd:" );
394     else
395         o_device.Prepend( "dvdold:" );
396     playlist_Add( p_playlist, o_device.String(),
397                   PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END );
398 }
399
400 int VlcWrapper::PlaylistSize()
401 {
402     vlc_mutex_lock( &p_playlist->object_lock );
403     int i_size = p_playlist->i_size;
404     vlc_mutex_unlock( &p_playlist->object_lock );
405     return i_size;
406 }
407
408 char * VlcWrapper::PlaylistItemName( int i )
409 {
410    return p_playlist->pp_items[i]->psz_name;
411 }
412
413 int VlcWrapper::PlaylistCurrent()
414 {
415     return p_playlist->i_index;
416 }
417
418 bool VlcWrapper::PlaylistPlay()
419 {
420     if( PlaylistSize() )
421     {
422         playlist_Play( p_playlist );
423     }
424     return( true );
425 }
426
427 void VlcWrapper::PlaylistPause()
428 {
429     if( p_input )
430     {
431         input_SetStatus( p_input, INPUT_STATUS_PAUSE );
432     }
433 }
434
435 void VlcWrapper::PlaylistStop()
436 {
437     playlist_Stop( p_playlist );
438 }
439
440 void VlcWrapper::PlaylistNext()
441 {
442     playlist_Next( p_playlist );
443 }
444
445 void VlcWrapper::PlaylistPrev()
446 {
447     playlist_Prev( p_playlist );
448 }
449
450 void VlcWrapper::GetPlaylistInfo( int32& currentIndex, int32& maxIndex )
451 {
452         currentIndex = -1;
453         maxIndex = -1;
454         if ( p_playlist )
455         {
456                 maxIndex = p_playlist->i_size;
457                 if ( maxIndex > 0 )
458                         currentIndex = p_playlist->i_index + 1;
459                 else
460                         maxIndex = -1;
461         }
462 }
463
464 void VlcWrapper::PlaylistJumpTo( int pos )
465 {
466     playlist_Goto( p_playlist, pos );
467 }
468
469 void VlcWrapper::GetNavCapabilities( bool *canSkipPrev, bool *canSkipNext )
470 {
471         if ( canSkipPrev && canSkipNext )
472         {
473                 // init the parameters
474                 *canSkipPrev = false;
475                 *canSkipNext = false;
476                 // get playlist info
477                 int pos = PlaylistCurrent();
478                 int size = PlaylistSize();
479
480                 // see if we have got a stream going            
481                 if ( p_input )
482                 {
483                         vlc_mutex_lock( &p_input->stream.stream_lock );
484
485                         bool hasTitles = p_input->stream.i_area_nb > 1;
486                         int numChapters = p_input->stream.p_selected_area->i_part_nb;
487                         bool hasChapters = numChapters > 1;
488                         // first, look for chapters
489                         if ( hasChapters )
490                         {
491                                 *canSkipPrev = p_input->stream.p_selected_area->i_part > 0;
492                                 *canSkipNext = p_input->stream.p_selected_area->i_part <
493                                                                          p_input->stream.p_selected_area->i_part_nb - 1;
494                         }
495                         // if one of the skip capabilities is false,
496                         // make it depend on titles instead
497                         if ( !*canSkipPrev && hasTitles )
498                                 *canSkipPrev = p_input->stream.p_selected_area->i_id > 1;
499                         if ( !*canSkipNext && hasTitles )
500                                 *canSkipNext = p_input->stream.p_selected_area->i_id <
501                                                    p_input->stream.i_area_nb - 1;
502
503                         vlc_mutex_unlock( &p_input->stream.stream_lock );
504                 }
505                 // last but not least, make capabilities depend on playlist
506                 if ( !*canSkipPrev )
507                         *canSkipPrev = pos > 0;
508                 if ( !*canSkipNext )
509                         *canSkipNext = pos < size - 1;
510         }
511 }
512
513 void VlcWrapper::NavigatePrev()
514 {
515         bool hasSkiped = false;
516
517         // see if we have got a stream going            
518         if ( p_input )
519         {
520                 // get information from stream (lock it while looking at it)
521                 vlc_mutex_lock( &p_input->stream.stream_lock );
522
523                 int currentTitle = p_input->stream.p_selected_area->i_id;
524                 int currentChapter = p_input->stream.p_selected_area->i_part;
525                 int numTitles = p_input->stream.i_area_nb;
526                 bool hasTitles = numTitles > 1;
527                 int numChapters = p_input->stream.p_selected_area->i_part_nb;
528                 bool hasChapters = numChapters > 1;
529
530                 vlc_mutex_unlock( &p_input->stream.stream_lock );
531
532                 // first, look for chapters
533                 if ( hasChapters )
534                 {
535                         // skip to the previous chapter
536                         currentChapter--;
537
538                         if ( currentChapter >= 0 )
539                         {
540                                 ToggleChapter( currentChapter );
541                                 hasSkiped = true;
542                         }
543                 }
544                 // if we couldn't skip chapters, try titles instead
545                 if ( !hasSkiped && hasTitles )
546                 {
547                         // skip to the previous title
548                         currentTitle--;
549                         // disallow area 0 since it is used for video_ts.vob
550                         if( currentTitle > 0 )
551                         {
552                                 ToggleTitle(currentTitle);
553                                 hasSkiped = true;
554                         }
555                 }
556
557         }
558         // last but not least, skip to previous file
559         if ( !hasSkiped )
560                 PlaylistPrev();
561 }
562
563 void VlcWrapper::NavigateNext()
564 {
565         bool hasSkiped = false;
566
567         // see if we have got a stream going            
568         if ( p_input )
569         {
570                 // get information from stream (lock it while looking at it)
571                 vlc_mutex_lock( &p_input->stream.stream_lock );
572
573                 int currentTitle = p_input->stream.p_selected_area->i_id;
574                 int currentChapter = p_input->stream.p_selected_area->i_part;
575                 int numTitles = p_input->stream.i_area_nb;
576                 bool hasTitles = numTitles > 1;
577                 int numChapters = p_input->stream.p_selected_area->i_part_nb;
578                 bool hasChapters = numChapters > 1;
579
580                 vlc_mutex_unlock( &p_input->stream.stream_lock );
581
582                 // first, look for chapters
583                 if ( hasChapters )
584                 {
585                         // skip to the next chapter
586                         currentChapter++;
587                         if ( currentChapter < numChapters )
588                         {
589                                 ToggleChapter( currentChapter );
590                                 hasSkiped = true;
591                         }
592                 }
593                 // if we couldn't skip chapters, try titles instead
594                 if ( !hasSkiped && hasTitles )
595                 {
596                         // skip to the next title
597                         currentTitle++;
598                         // disallow area 0 since it is used for video_ts.vob
599                         if ( currentTitle < numTitles - 1 )
600                         {
601                                 ToggleTitle(currentTitle);
602                                 hasSkiped = true;
603                         }
604                 }
605
606         }
607         // last but not least, skip to next file
608         if ( !hasSkiped )
609                 PlaylistNext();
610 }
611
612
613 /*********
614  * audio *
615  *********/
616
617 bool VlcWrapper::HasAudio()
618 {
619     return( p_aout != NULL );
620 }
621
622 unsigned short VlcWrapper::GetVolume()
623 {
624     if( p_aout != NULL )
625     {
626         unsigned short i_volume;
627         aout_VolumeGet( p_aout, (audio_volume_t*)&i_volume );
628         return i_volume;
629     }
630     return 0;
631 }
632
633 void VlcWrapper::SetVolume(int value)
634 {
635     if( p_aout != NULL )
636     {
637                 if ( p_intf->p_sys->b_mute )
638                 {
639                         p_intf->p_sys->b_mute = 0;
640                 }
641         aout_VolumeSet( p_aout, value );
642     }
643 }
644
645 void VlcWrapper::VolumeMute()
646 {
647     if( p_aout != NULL )
648         {
649             aout_VolumeGet( p_aout, &p_intf->p_sys->i_saved_volume );
650             aout_VolumeMute( p_aout, NULL );
651             p_intf->p_sys->b_mute = 1;
652         }
653 }
654
655 void VlcWrapper::VolumeRestore()
656 {
657     if( p_aout != NULL )
658         {
659         aout_VolumeSet( p_aout, p_intf->p_sys->i_saved_volume );
660         p_intf->p_sys->b_mute = 0;
661         }
662 }
663
664 bool VlcWrapper::IsMuted()
665 {
666     return p_intf->p_sys->b_mute;
667 }
668
669 /*******
670  * DVD *
671  *******/
672
673 bool VlcWrapper::HasTitles()
674 {
675     if( !p_input )
676     {
677         return false;
678     }
679     return ( p_input->stream.i_area_nb > 1 );
680 }
681
682 BList * VlcWrapper::GetTitles()
683 {
684     if( p_input )
685     {
686         vlc_mutex_lock( &p_input->stream.stream_lock );
687       
688         BList *list = new BList( p_input->stream.i_area_nb );
689         BMenuItem *menuItem;
690         BMessage *message;
691         
692         for( unsigned int i = 1; i < p_input->stream.i_area_nb; i++ )
693         {
694             message = new BMessage( TOGGLE_TITLE );
695             message->AddInt32( "index", i );
696             BString helper( "" );
697             helper << i;
698             menuItem = new BMenuItem( helper.String(), message );
699             menuItem->SetMarked( p_input->stream.p_selected_area->i_id == i );
700             list->AddItem( menuItem );
701         }
702         
703         vlc_mutex_unlock( &p_input->stream.stream_lock );
704
705         return list;
706     }
707     return NULL;
708 }
709
710 void VlcWrapper::PrevTitle()
711 {
712     int i_id;
713     i_id = p_input->stream.p_selected_area->i_id - 1;
714     if( i_id > 0 )
715     {
716         ToggleTitle(i_id);
717     }
718 }
719
720 void VlcWrapper::NextTitle()
721 {
722     unsigned int i_id;
723     i_id = p_input->stream.p_selected_area->i_id + 1;
724     if( i_id < p_input->stream.i_area_nb )
725     {
726         ToggleTitle(i_id);
727     }
728 }
729
730 void VlcWrapper::ToggleTitle(int i_title)
731 {
732     if( p_input != NULL )
733     {
734         input_ChangeArea( p_input,
735                           p_input->stream.pp_areas[i_title] );
736
737         vlc_mutex_lock( &p_input->stream.stream_lock );
738
739         vlc_mutex_unlock( &p_input->stream.stream_lock );
740     }
741 }
742
743 void VlcWrapper::TitleInfo( int32 &currentIndex, int32 &maxIndex )
744 {
745         currentIndex = -1;
746         maxIndex = -1;
747         if ( p_input )
748         {
749                 vlc_mutex_lock( &p_input->stream.stream_lock );
750
751                 maxIndex = p_input->stream.i_area_nb - 1;
752                 if ( maxIndex > 0)
753                         currentIndex = p_input->stream.p_selected_area->i_id;
754                 else
755                         maxIndex = -1;
756
757                 vlc_mutex_unlock( &p_input->stream.stream_lock );
758         }
759 }
760
761 bool VlcWrapper::HasChapters()
762 {
763     if( !p_input )
764     {
765         return false;
766     }
767     return ( p_input->stream.p_selected_area->i_part_nb > 1 );
768 }
769
770 BList * VlcWrapper::GetChapters()
771 {
772     if( p_input )
773     {
774         vlc_mutex_lock( &p_input->stream.stream_lock );
775       
776         BList *list = new BList( p_input->stream.p_selected_area->i_part_nb );
777         BMenuItem *menuItem;
778         BMessage *message;
779         
780         for( unsigned int i = 1;
781              i < p_input->stream.p_selected_area->i_part_nb + 1; i++ )
782         {
783             message = new BMessage( TOGGLE_CHAPTER );
784             message->AddInt32( "index", i );
785             BString helper( "" );
786             helper << i;
787             menuItem = new BMenuItem( helper.String(), message );
788             menuItem->SetMarked( p_input->stream.p_selected_area->i_part == i );
789             list->AddItem( menuItem );
790         }
791         
792         vlc_mutex_unlock( &p_input->stream.stream_lock );
793
794         return list;
795     }
796     return NULL;
797 }
798
799 void VlcWrapper::PrevChapter()
800 {
801     int i_id;
802     i_id = p_input->stream.p_selected_area->i_part - 1;
803     if( i_id >= 0 )
804     {
805         ToggleChapter(i_id);
806     }
807 }
808
809 void VlcWrapper::NextChapter()
810 {
811     int i_id;
812     i_id = p_input->stream.p_selected_area->i_part + 1;
813     if( i_id >= 0 )
814     {
815         ToggleChapter(i_id);
816     }
817 }
818
819 void VlcWrapper::ToggleChapter(int i_chapter)
820 {
821     if( p_input != NULL )
822     {
823         p_input->stream.p_selected_area->i_part = i_chapter;
824         input_ChangeArea( p_input,
825                           p_input->stream.p_selected_area );
826
827         vlc_mutex_lock( &p_input->stream.stream_lock );
828         vlc_mutex_unlock( &p_input->stream.stream_lock );
829     }
830 }
831
832 void VlcWrapper::ChapterInfo( int32 &currentIndex, int32 &maxIndex )
833 {
834         currentIndex = -1;
835         maxIndex = -1;
836         if ( p_input )
837         {
838                 vlc_mutex_lock( &p_input->stream.stream_lock );
839
840                 maxIndex = p_input->stream.p_selected_area->i_part_nb - 1;
841                 if ( maxIndex > 0)
842                         currentIndex = p_input->stream.p_selected_area->i_part;
843                 else
844                         maxIndex = -1;
845
846                 vlc_mutex_unlock( &p_input->stream.stream_lock );
847         }
848 }
849
850 /****************
851  * Miscellanous *
852  ****************/
853  
854 void VlcWrapper::LoadSubFile( char * psz_file )
855 {
856     config_PutPsz( p_intf, "sub-file", strdup( psz_file ) );
857 }