]> git.sesse.net Git - vlc/blob - modules/gui/beos/VlcWrapper.cpp
* Fixed title / chapter menus
[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.21 2003/01/22 01:13: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_dvdold )
393         o_device.Prepend( "dvdold:" );
394     playlist_Add( p_playlist, o_device.String(),
395                   PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END );
396 }
397
398 int VlcWrapper::PlaylistSize()
399 {
400     vlc_mutex_lock( &p_playlist->object_lock );
401     int i_size = p_playlist->i_size;
402     vlc_mutex_unlock( &p_playlist->object_lock );
403     return i_size;
404 }
405
406 char * VlcWrapper::PlaylistItemName( int i )
407 {
408    return p_playlist->pp_items[i]->psz_name;
409 }
410
411 int VlcWrapper::PlaylistCurrent()
412 {
413     return p_playlist->i_index;
414 }
415
416 bool VlcWrapper::PlaylistPlay()
417 {
418     if( PlaylistSize() )
419     {
420         playlist_Play( p_playlist );
421     }
422     return( true );
423 }
424
425 void VlcWrapper::PlaylistPause()
426 {
427     if( p_input )
428     {
429         input_SetStatus( p_input, INPUT_STATUS_PAUSE );
430     }
431 }
432
433 void VlcWrapper::PlaylistStop()
434 {
435     playlist_Stop( p_playlist );
436 }
437
438 void VlcWrapper::PlaylistNext()
439 {
440     playlist_Next( p_playlist );
441 }
442
443 void VlcWrapper::PlaylistPrev()
444 {
445     playlist_Prev( p_playlist );
446 }
447
448 void VlcWrapper::GetPlaylistInfo( int32& currentIndex, int32& maxIndex )
449 {
450         currentIndex = -1;
451         maxIndex = -1;
452         if ( p_playlist )
453         {
454                 maxIndex = p_playlist->i_size;
455                 if ( maxIndex > 0 )
456                         currentIndex = p_playlist->i_index + 1;
457                 else
458                         maxIndex = -1;
459         }
460 }
461
462 void VlcWrapper::PlaylistJumpTo( int pos )
463 {
464     playlist_Goto( p_playlist, pos );
465 }
466
467 void VlcWrapper::GetNavCapabilities( bool *canSkipPrev, bool *canSkipNext )
468 {
469         if ( canSkipPrev && canSkipNext )
470         {
471                 // init the parameters
472                 *canSkipPrev = false;
473                 *canSkipNext = false;
474                 // get playlist info
475                 int pos = PlaylistCurrent();
476                 int size = PlaylistSize();
477
478                 // see if we have got a stream going            
479                 if ( p_input )
480                 {
481                         vlc_mutex_lock( &p_input->stream.stream_lock );
482
483                         bool hasTitles = p_input->stream.i_area_nb > 1;
484                         int numChapters = p_input->stream.p_selected_area->i_part_nb;
485                         bool hasChapters = numChapters > 1;
486                         // first, look for chapters
487                         if ( hasChapters )
488                         {
489                                 *canSkipPrev = p_input->stream.p_selected_area->i_part > 0;
490                                 *canSkipNext = p_input->stream.p_selected_area->i_part <
491                                                                          p_input->stream.p_selected_area->i_part_nb - 1;
492                         }
493                         // if one of the skip capabilities is false,
494                         // make it depend on titles instead
495                         if ( !*canSkipPrev && hasTitles )
496                                 *canSkipPrev = p_input->stream.p_selected_area->i_id > 1;
497                         if ( !*canSkipNext && hasTitles )
498                                 *canSkipNext = p_input->stream.p_selected_area->i_id <
499                                                    p_input->stream.i_area_nb - 1;
500
501                         vlc_mutex_unlock( &p_input->stream.stream_lock );
502                 }
503                 // last but not least, make capabilities depend on playlist
504                 if ( !*canSkipPrev )
505                         *canSkipPrev = pos > 0;
506                 if ( !*canSkipNext )
507                         *canSkipNext = pos < size - 1;
508         }
509 }
510
511 void VlcWrapper::NavigatePrev()
512 {
513         bool hasSkiped = false;
514
515         // see if we have got a stream going            
516         if ( p_input )
517         {
518                 // get information from stream (lock it while looking at it)
519                 vlc_mutex_lock( &p_input->stream.stream_lock );
520
521                 int currentTitle = p_input->stream.p_selected_area->i_id;
522                 int currentChapter = p_input->stream.p_selected_area->i_part;
523                 int numTitles = p_input->stream.i_area_nb;
524                 bool hasTitles = numTitles > 1;
525                 int numChapters = p_input->stream.p_selected_area->i_part_nb;
526                 bool hasChapters = numChapters > 1;
527
528                 vlc_mutex_unlock( &p_input->stream.stream_lock );
529
530                 // first, look for chapters
531                 if ( hasChapters )
532                 {
533                         // skip to the previous chapter
534                         currentChapter--;
535
536                         if ( currentChapter >= 0 )
537                         {
538                                 ToggleChapter( currentChapter );
539                                 hasSkiped = true;
540                         }
541                 }
542                 // if we couldn't skip chapters, try titles instead
543                 if ( !hasSkiped && hasTitles )
544                 {
545                         // skip to the previous title
546                         currentTitle--;
547                         // disallow area 0 since it is used for video_ts.vob
548                         if( currentTitle > 0 )
549                         {
550                                 ToggleTitle(currentTitle);
551                                 hasSkiped = true;
552                         }
553                 }
554
555         }
556         // last but not least, skip to previous file
557         if ( !hasSkiped )
558                 PlaylistPrev();
559 }
560
561 void VlcWrapper::NavigateNext()
562 {
563         bool hasSkiped = false;
564
565         // see if we have got a stream going            
566         if ( p_input )
567         {
568                 // get information from stream (lock it while looking at it)
569                 vlc_mutex_lock( &p_input->stream.stream_lock );
570
571                 int currentTitle = p_input->stream.p_selected_area->i_id;
572                 int currentChapter = p_input->stream.p_selected_area->i_part;
573                 int numTitles = p_input->stream.i_area_nb;
574                 bool hasTitles = numTitles > 1;
575                 int numChapters = p_input->stream.p_selected_area->i_part_nb;
576                 bool hasChapters = numChapters > 1;
577
578                 vlc_mutex_unlock( &p_input->stream.stream_lock );
579
580                 // first, look for chapters
581                 if ( hasChapters )
582                 {
583                         // skip to the next chapter
584                         currentChapter++;
585                         if ( currentChapter < numChapters )
586                         {
587                                 ToggleChapter( currentChapter );
588                                 hasSkiped = true;
589                         }
590                 }
591                 // if we couldn't skip chapters, try titles instead
592                 if ( !hasSkiped && hasTitles )
593                 {
594                         // skip to the next title
595                         currentTitle++;
596                         // disallow area 0 since it is used for video_ts.vob
597                         if ( currentTitle < numTitles - 1 )
598                         {
599                                 ToggleTitle(currentTitle);
600                                 hasSkiped = true;
601                         }
602                 }
603
604         }
605         // last but not least, skip to next file
606         if ( !hasSkiped )
607                 PlaylistNext();
608 }
609
610
611 /*********
612  * audio *
613  *********/
614
615 bool VlcWrapper::HasAudio()
616 {
617     return( p_aout != NULL );
618 }
619
620 unsigned short VlcWrapper::GetVolume()
621 {
622     if( p_aout != NULL )
623     {
624         unsigned short i_volume;
625         aout_VolumeGet( p_aout, (audio_volume_t*)&i_volume );
626         return i_volume;
627     }
628     return 0;
629 }
630
631 void VlcWrapper::SetVolume(int value)
632 {
633     if( p_aout != NULL )
634     {
635                 if ( p_intf->p_sys->b_mute )
636                 {
637                         p_intf->p_sys->b_mute = 0;
638                 }
639         aout_VolumeSet( p_aout, value );
640     }
641 }
642
643 void VlcWrapper::VolumeMute()
644 {
645     if( p_aout != NULL )
646         {
647             aout_VolumeGet( p_aout, &p_intf->p_sys->i_saved_volume );
648             aout_VolumeMute( p_aout, NULL );
649             p_intf->p_sys->b_mute = 1;
650         }
651 }
652
653 void VlcWrapper::VolumeRestore()
654 {
655     if( p_aout != NULL )
656         {
657         aout_VolumeSet( p_aout, p_intf->p_sys->i_saved_volume );
658         p_intf->p_sys->b_mute = 0;
659         }
660 }
661
662 bool VlcWrapper::IsMuted()
663 {
664     return p_intf->p_sys->b_mute;
665 }
666
667 /*******
668  * DVD *
669  *******/
670
671 bool VlcWrapper::HasTitles()
672 {
673     if( !p_input )
674     {
675         return false;
676     }
677     return ( p_input->stream.i_area_nb > 1 );
678 }
679
680 BList * VlcWrapper::GetTitles()
681 {
682     if( p_input )
683     {
684         vlc_mutex_lock( &p_input->stream.stream_lock );
685       
686         BList *list = new BList( p_input->stream.i_area_nb );
687         BMenuItem *menuItem;
688         BMessage *message;
689         
690         for( unsigned int i = 1; i < p_input->stream.i_area_nb; i++ )
691         {
692             message = new BMessage( TOGGLE_TITLE );
693             message->AddInt32( "index", i );
694             BString helper( "" );
695             helper << i;
696             menuItem = new BMenuItem( helper.String(), message );
697             menuItem->SetMarked( p_input->stream.p_selected_area->i_id == i );
698             list->AddItem( menuItem );
699         }
700         
701         vlc_mutex_unlock( &p_input->stream.stream_lock );
702
703         return list;
704     }
705     return NULL;
706 }
707
708 void VlcWrapper::PrevTitle()
709 {
710     int i_id;
711     i_id = p_input->stream.p_selected_area->i_id - 1;
712     if( i_id > 0 )
713     {
714         ToggleTitle(i_id);
715     }
716 }
717
718 void VlcWrapper::NextTitle()
719 {
720     unsigned int i_id;
721     i_id = p_input->stream.p_selected_area->i_id + 1;
722     if( i_id < p_input->stream.i_area_nb )
723     {
724         ToggleTitle(i_id);
725     }
726 }
727
728 void VlcWrapper::ToggleTitle(int i_title)
729 {
730     if( p_input != NULL )
731     {
732         input_ChangeArea( p_input,
733                           p_input->stream.pp_areas[i_title] );
734
735         vlc_mutex_lock( &p_input->stream.stream_lock );
736
737         vlc_mutex_unlock( &p_input->stream.stream_lock );
738     }
739 }
740
741 void VlcWrapper::TitleInfo( int32 &currentIndex, int32 &maxIndex )
742 {
743         currentIndex = -1;
744         maxIndex = -1;
745         if ( p_input )
746         {
747                 vlc_mutex_lock( &p_input->stream.stream_lock );
748
749                 maxIndex = p_input->stream.i_area_nb - 1;
750                 if ( maxIndex > 0)
751                         currentIndex = p_input->stream.p_selected_area->i_id;
752                 else
753                         maxIndex = -1;
754
755                 vlc_mutex_unlock( &p_input->stream.stream_lock );
756         }
757 }
758
759 bool VlcWrapper::HasChapters()
760 {
761     if( !p_input )
762     {
763         return false;
764     }
765     return ( p_input->stream.p_selected_area->i_part_nb > 1 );
766 }
767
768 BList * VlcWrapper::GetChapters()
769 {
770     if( p_input )
771     {
772         vlc_mutex_lock( &p_input->stream.stream_lock );
773       
774         BList *list = new BList( p_input->stream.p_selected_area->i_part_nb );
775         BMenuItem *menuItem;
776         BMessage *message;
777         
778         for( unsigned int i = 1;
779              i < p_input->stream.p_selected_area->i_part_nb + 1; i++ )
780         {
781             message = new BMessage( TOGGLE_CHAPTER );
782             message->AddInt32( "index", i );
783             BString helper( "" );
784             helper << i;
785             menuItem = new BMenuItem( helper.String(), message );
786             menuItem->SetMarked( p_input->stream.p_selected_area->i_part == i );
787             list->AddItem( menuItem );
788         }
789         
790         vlc_mutex_unlock( &p_input->stream.stream_lock );
791
792         return list;
793     }
794     return NULL;
795 }
796
797 void VlcWrapper::PrevChapter()
798 {
799     int i_id;
800     i_id = p_input->stream.p_selected_area->i_part - 1;
801     if( i_id >= 0 )
802     {
803         ToggleChapter(i_id);
804     }
805 }
806
807 void VlcWrapper::NextChapter()
808 {
809     int i_id;
810     i_id = p_input->stream.p_selected_area->i_part + 1;
811     if( i_id >= 0 )
812     {
813         ToggleChapter(i_id);
814     }
815 }
816
817 void VlcWrapper::ToggleChapter(int i_chapter)
818 {
819     if( p_input != NULL )
820     {
821         p_input->stream.p_selected_area->i_part = i_chapter;
822         input_ChangeArea( p_input,
823                           p_input->stream.p_selected_area );
824
825         vlc_mutex_lock( &p_input->stream.stream_lock );
826         vlc_mutex_unlock( &p_input->stream.stream_lock );
827     }
828 }
829
830 void VlcWrapper::ChapterInfo( int32 &currentIndex, int32 &maxIndex )
831 {
832         currentIndex = -1;
833         maxIndex = -1;
834         if ( p_input )
835         {
836                 vlc_mutex_lock( &p_input->stream.stream_lock );
837
838                 maxIndex = p_input->stream.p_selected_area->i_part_nb - 1;
839                 if ( maxIndex > 0)
840                         currentIndex = p_input->stream.p_selected_area->i_part;
841                 else
842                         maxIndex = -1;
843
844                 vlc_mutex_unlock( &p_input->stream.stream_lock );
845         }
846 }
847
848 /****************
849  * Miscellanous *
850  ****************/
851  
852 void VlcWrapper::LoadSubFile( char * psz_file )
853 {
854     config_PutPsz( p_intf, "sub-file", strdup( psz_file ) );
855 }