VlcWrapper.cpp 20.8 KB
Newer Older
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
8
9
 *
 * Authors: Florian G. Pflug <fgp@phlo.org>
 *          Jon Lech Johansen <jon-vl@nanocrew.net>
 *          Tony Casltey <tony@castley.net>
10
 *          Stephan Aßmus <stippi@yellowbites.com>
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
 *
 * This program is free software{} you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation{} either version 2 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY{} without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program{} if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
 *****************************************************************************/
/* VLC headers */
#include <SupportKit.h>

#include <vlc/vlc.h>
#include <vlc/intf.h>

32
#include "VlcWrapper.h"
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52

Intf_VLCWrapper *Intf_VLCWrapper::getVLCWrapper(intf_thread_t *p_if)
{
    static Intf_VLCWrapper *one_wrapper;
    if (one_wrapper == NULL )
    {
       one_wrapper = new Intf_VLCWrapper(p_if);
    }
    return one_wrapper;
}

Intf_VLCWrapper::Intf_VLCWrapper(intf_thread_t *p_if)
{
    p_intf = p_if;
}

Intf_VLCWrapper::~Intf_VLCWrapper()
{
}

53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#if 0
bool Intf_VLCWrapper::manage()
{
   p_main->p_intf->pf_manage( p_main->p_intf );
   
   if ( p_main->p_intf->b_die )
   {
       // exit the lot
       return( 1 );
   }
   
   if ( p_input_bank->pp_input[0] != NULL )
   {
       vlc_mutex_lock( &p_input_bank->pp_input[0]->stream.stream_lock );
        if( !p_input_bank->pp_input[0]->b_die )
        {
            /* New input or stream map change */
            if( p_input_bank->pp_input[0]->stream.b_changed ||
                p_main->p_intf->p_sys->i_part !=
                p_input_bank->pp_input[0]->stream.p_selected_area->i_part )
            {
                setupMenus();
                p_main->p_intf->p_sys->b_disabled_menus = 0;
            }
        }
        vlc_mutex_unlock( &p_input_bank->pp_input[0]->stream.stream_lock );
    }
    else if ( !p_main->p_intf->p_sys->b_disabled_menus )
    {
        setupMenus();
        p_main->p_intf->p_sys->b_disabled_menus = 1;
    }
    return( 0 );
}
#endif
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118

void Intf_VLCWrapper::quit()
{
    p_intf->b_die = 1;
}
    
/* playlist control */
bool Intf_VLCWrapper::playlistPlay()
{
    playlist_t *p_playlist = 
                (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
                                                       FIND_ANYWHERE );

    vlc_mutex_lock( &p_playlist->object_lock );
    if( p_playlist->i_size )
    {
        vlc_mutex_unlock( &p_playlist->object_lock );
        playlist_Play( p_playlist );
        vlc_object_release( p_playlist );
    }
    else
    {
        vlc_mutex_unlock( &p_playlist->object_lock );
        vlc_object_release( p_playlist );
    }

    return( true );
}

void Intf_VLCWrapper::playlistPause()
{
119
    toggle_mute(  );
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
    playlist_t *p_playlist = 
                (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
                                                       FIND_ANYWHERE );
    playlist_Pause( p_playlist );
    vlc_object_release( p_playlist );
}

void Intf_VLCWrapper::playlistStop()
{
    playlist_t *p_playlist = 
                (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
                                                       FIND_ANYWHERE );

    playlist_Stop( p_playlist );
    vlc_object_release( p_playlist );
}

void Intf_VLCWrapper::playlistNext()
{
    playlist_t *p_playlist = 
                (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
                                                       FIND_ANYWHERE );

    playlist_Next( p_playlist );
    vlc_object_release( p_playlist );
}

void Intf_VLCWrapper::playlistPrev()
{
    playlist_t *p_playlist = 
                (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
                                                       FIND_ANYWHERE );

    playlist_Prev( p_playlist );
    vlc_object_release( p_playlist );
}

void Intf_VLCWrapper::playlistSkip(int i)
{
    playlist_t *p_playlist = 
                (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
                                                       FIND_ANYWHERE );

    playlist_Skip( p_playlist, i );
    vlc_object_release( p_playlist );
}

void Intf_VLCWrapper::playlistGoto(int i)
{
    playlist_t *p_playlist = 
                (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
                                                       FIND_ANYWHERE );

    playlist_Goto( p_playlist, i );
    vlc_object_release( p_playlist );
}

177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
void Intf_VLCWrapper::playlistJumpTo( int pos )
{
#if 0
	// sanity checks
	if ( pos < 0 )
		pos = 0;
	int size = playlistSize();
	if (pos >= size)
		pos = size - 1;
	// weird hack
    if( p_input_bank->pp_input[0] != NULL )
		pos--;
	// stop current stream
	playlistStop();
	// modify current position in playlist
	playlistLock();
	p_main->p_playlist->i_index = pos;
	playlistUnlock();
	// start playing
	playlistPlay();
#endif
}

int Intf_VLCWrapper::playlistCurrentPos()
{
	/*playlistLock();
	int pos = p_main->p_playlist->i_index;
	playlistUnlock();
	return pos;*/
}

int Intf_VLCWrapper::playlistSize()
{
	/*playlistLock();
	int size = p_main->p_playlist->i_size;
	playlistUnlock();
	return size;*/
}

void Intf_VLCWrapper::playlistLock()
{
	/*vlc_mutex_lock( &p_main->p_playlist->change_lock );*/
}

void Intf_VLCWrapper::playlistUnlock()
{
	/*vlc_mutex_unlock( &p_main->p_playlist->change_lock );*/
}

void Intf_VLCWrapper::getNavCapabilities( bool* canSkipPrev,
										  bool* canSkipNext )
{
#if 0
	if ( canSkipPrev && canSkipNext )
	{
		// init the parameters
		*canSkipPrev = false;
		*canSkipNext = false;
		// get playlist info
		playlistLock();
		int pos = p_main->p_playlist->i_index;
		int size = p_main->p_playlist->i_size;
		playlistUnlock();

		input_thread_t* input = p_input_bank->pp_input[0];
		// see if we have got a stream going		
		if ( input )
		{
			vlc_mutex_lock( &input->stream.stream_lock );

			bool hasTitles = input->stream.i_area_nb > 1;
			int numChapters = input->stream.p_selected_area->i_part_nb;
			bool hasChapters = numChapters > 1;
			// first, look for chapters
			if ( hasChapters )
			{
				*canSkipPrev = input->stream.p_selected_area->i_part > 0;
				*canSkipNext = input->stream.p_selected_area->i_part <
									 input->stream.p_selected_area->i_part_nb - 1;
			}
			// if one of the skip capabilities is false,
			// make it depend on titles instead
			if ( !*canSkipPrev && hasTitles )
				*canSkipPrev = input->stream.p_selected_area->i_id > 1;
			if ( !*canSkipNext && hasTitles )
				*canSkipNext = input->stream.p_selected_area->i_id < input->stream.i_area_nb - 1;

			vlc_mutex_unlock( &input->stream.stream_lock );
		}
		// last but not least, make capabilities depend on playlist
		if ( !*canSkipPrev )
			*canSkipPrev = pos > 0;
		if ( !*canSkipNext )
			*canSkipNext = pos < size - 1;
	}
#endif
}

void Intf_VLCWrapper::navigatePrev()
{
#if 0
	bool hasSkiped = false;

	input_thread_t* input = p_input_bank->pp_input[0];
	// see if we have got a stream going		
	if ( input )
	{
		// get information from stream (lock it while looking at it)
		vlc_mutex_lock( &input->stream.stream_lock );

		int currentTitle = input->stream.p_selected_area->i_id;
		int currentChapter = input->stream.p_selected_area->i_part;
		int numTitles = input->stream.i_area_nb;
		bool hasTitles = numTitles > 1;
		int numChapters = input->stream.p_selected_area->i_part_nb;
		bool hasChapters = numChapters > 1;

		vlc_mutex_unlock( &input->stream.stream_lock );

		// first, look for chapters
		if ( hasChapters )
		{
			// skip to the previous chapter
			currentChapter--;

			if ( currentChapter >= 0 )
			{
				toggleChapter( currentChapter );
				hasSkiped = true;
			}
		}
		// if we couldn't skip chapters, try titles instead
		if ( !hasSkiped && hasTitles )
		{
			// skip to the previous title
			currentTitle--;
			// disallow area 0 since it is used for video_ts.vob
			if( currentTitle > 0 )
			{
				toggleTitle(currentTitle);
				hasSkiped = true;
			}
		}

	}
	// last but not least, skip to previous file
	if ( !hasSkiped )
		playlistPrev();
#endif
}

void Intf_VLCWrapper::navigateNext()
{
#if 0
	bool hasSkiped = false;

	input_thread_t* input = p_input_bank->pp_input[0];
	// see if we have got a stream going		
	if ( input )
	{
		// get information from stream (lock it while looking at it)
		vlc_mutex_lock( &input->stream.stream_lock );

		int currentTitle = input->stream.p_selected_area->i_id;
		int currentChapter = input->stream.p_selected_area->i_part;
		int numTitles = input->stream.i_area_nb;
		bool hasTitles = numTitles > 1;
		int numChapters = input->stream.p_selected_area->i_part_nb;
		bool hasChapters = numChapters > 1;

		vlc_mutex_unlock( &input->stream.stream_lock );

		// first, look for chapters
		if ( hasChapters )
		{
			// skip to the next chapter
			currentChapter++;
			if ( currentChapter < numChapters )
			{
				toggleChapter( currentChapter );
				hasSkiped = true;
			}
		}
		// if we couldn't skip chapters, try titles instead
		if ( !hasSkiped && hasTitles )
		{
			// skip to the next title
			currentTitle++;
			// disallow area 0 since it is used for video_ts.vob
			if ( currentTitle < numTitles - 1 )
			{
				toggleTitle(currentTitle);
				hasSkiped = true;
			}
		}

	}
	// last but not least, skip to next file
	if ( !hasSkiped )
		playlistNext();
#endif
}


//void Intf_VLCWrapper::channelNext()
//{
//    intf_thread_t * p_intf = p_main->p_intf;
//
//    p_intf->p_sys->i_channel++;
//
//    intf_WarnMsg( 3, "intf info: joining channel %d", p_intf->p_sys->i_channel );
//
//    vlc_mutex_lock( &p_intf->change_lock );
//
//    network_ChannelJoin( p_intf->p_sys->i_channel );
//    p_intf->pf_manage( p_intf );
//
//    vlc_mutex_unlock( &p_intf->change_lock );
//}
//
//void Intf_VLCWrapper::channelPrev()
//{
//    intf_thread_t * p_intf = p_main->p_intf;
//
//    if ( p_intf->p_sys->i_channel )
//    {
//        p_intf->p_sys->i_channel--;
//    }
//
//    intf_WarnMsg( 3, "intf info: joining channel %d", p_intf->p_sys->i_channel );
//
//    vlc_mutex_lock( &p_intf->change_lock );
//
//    network_ChannelJoin( p_intf->p_sys->i_channel );
//    p_intf->pf_manage( p_intf );
//
//    vlc_mutex_unlock( &p_intf->change_lock );
//
//}

void Intf_VLCWrapper::loop()
{
#if 0
    intf_thread_t * p_intf = p_main->p_intf;

    if ( p_intf->p_sys->b_loop )
    {
        intf_PlaylistDelete( p_main->p_playlist,
                             p_main->p_playlist->i_size - 1 );
    }
    else
    {
        intf_PlaylistAdd( p_main->p_playlist, PLAYLIST_END, 
                          "vlc:loop" );
    }
    p_intf->p_sys->b_loop = !p_intf->p_sys->b_loop;
#endif
}


437
438
439
440
441
442
443
444
445
    /* playback control */
void Intf_VLCWrapper::playSlower()
{
    if( p_intf->p_sys->p_input != NULL )
    {
        input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_SLOWER );
    }
    if (p_intf->p_sys->p_input->stream.control.i_rate == DEFAULT_RATE)
    {
446
        toggle_mute(  );
447
448
449
    }
    else
    {
450
        toggle_mute ( );
451
452
453
454
455
456
457
458
459
460
461
    }
}

void Intf_VLCWrapper::playFaster()
{
    if( p_intf->p_sys->p_input != NULL )
    {
        input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_FASTER );
    }
    if (p_intf->p_sys->p_input->stream.control.i_rate == DEFAULT_RATE)
    {
462
        toggle_mute(  );
463
464
465
    }
    else
    {
466
        toggle_mute ( );
467
468
469
    }
}

470
void Intf_VLCWrapper::volume_mute()
471
{
472
473
474
/*
    if( p_aout_bank->i_count > 0
    	&& p_aout_bank->pp_aout[0] != NULL )
475
    {
476
477
478
479
480
481
482
	    if( !p_main->p_intf->p_sys->b_mute )
		{
		    p_main->p_intf->p_sys->i_saved_volume = 
		                        p_aout_bank->pp_aout[0]->i_volume;
		    p_aout_bank->pp_aout[0]->i_volume = 0;
		    p_main->p_intf->p_sys->b_mute = 1;
		}
483
    }
484
*/
485
486
}

487
void Intf_VLCWrapper::volume_restore()
488
{
489
490
491
/*
    if( p_aout_bank->i_count > 0
    	&& p_aout_bank->pp_aout[0] != NULL )
492
    {
493
494
495
496
	    p_aout_bank->pp_aout[0]->i_volume = 
	                      p_main->p_intf->p_sys->i_saved_volume;
		p_main->p_intf->p_sys->i_saved_volume = 0;
	    p_main->p_intf->p_sys->b_mute = 0;
497
    }
498
*/
499
500
}

501
void Intf_VLCWrapper::set_volume(int value)
502
{
503
504
505
#if 0
    if( p_aout_bank->i_count > 0
    	&& p_aout_bank->pp_aout[0] != NULL )
506
    {
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
		// make sure value is within bounds
		if (value < 0)
			value = 0;
		if (value > AOUT_VOLUME_MAX)
			value = AOUT_VOLUME_MAX;
		vlc_mutex_lock( &p_aout_bank->lock );
			// unmute volume if muted
			if ( p_main->p_intf->p_sys->b_mute )
				p_main->p_intf->p_sys->b_mute = 0;
			// set every stream to the given value
			for ( int i = 0 ; i < p_aout_bank->i_count ; i++ )
			{
				if ( p_aout_bank->pp_aout[i] )
					p_aout_bank->pp_aout[i]->i_volume = value;
			}
		vlc_mutex_unlock( &p_aout_bank->lock );
523
    }
524
525
#endif
}
526

527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
void Intf_VLCWrapper::toggle_mute()
{
/*
    if( p_aout_bank->i_count > 0
    	&& p_aout_bank->pp_aout[0] != NULL )
   	{
	    if ( p_main->p_intf->p_sys->b_mute )
	    {
	        Intf_VLCWrapper::volume_restore();
	    }
	    else
	    {
	        Intf_VLCWrapper::volume_mute();
	    }
	}
*/
543
544
}

545
bool Intf_VLCWrapper::is_muted()
546
{
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
#if 0
	bool muted = true;
	if ( p_aout_bank->i_count > 0 )
	{
		vlc_mutex_lock( &p_aout_bank->lock );
			for ( int i = 0 ; i < p_aout_bank->i_count ; i++ )
			{
				if ( p_aout_bank->pp_aout[i]
					 && p_aout_bank->pp_aout[i]->i_volume > 0 )
				{
					muted = false;
					break;
				}
			}
		vlc_mutex_unlock( &p_aout_bank->lock );
// unfortunately, this is not reliable!
//		return p_main->p_intf->p_sys->b_mute;
	}
	return muted;
#endif
}
568

569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
bool Intf_VLCWrapper::is_playing()
{
/*
	bool playing = false;
	if ( p_input_bank->pp_input[0] )
	{
		switch ( p_input_bank->pp_input[0]->stream.control.i_status )
		{
			case PLAYING_S:
			case FORWARD_S:
			case BACKWARD_S:
			case START_S:
				playing = true;
	            break;
			case PAUSE_S:
			case UNDEF_S:
			case NOT_STARTED_S:
			default:
				break;
		}
	}
	return playing;
*/
}
593

594
595
596
597
598
void Intf_VLCWrapper::maxvolume()
{
/*
    if( p_aout_bank->i_count > 0
    	&& p_aout_bank->pp_aout[0] != NULL )
599
    {
600
601
602
603
604
605
606
607
	    if( p_main->p_intf->p_sys->b_mute )
	    {
	        p_main->p_intf->p_sys->i_saved_volume = VOLUME_MAX;
	    }
	    else
	    {
	        p_aout_bank->pp_aout[0]->i_volume = VOLUME_MAX;
	    }
608
    }
609
*/
610
611
}

612
bool Intf_VLCWrapper::has_audio()
613
{
614
    /* return (p_aout_bank->i_count > 0); */
615
616
}

617
618
619
620
621
622
623
//void Intf_VLCWrapper::fullscreen()
//{
//    if( p_vout_bank->pp_vout[0] != NULL )
//    {
//        p_vout_bank->pp_vout[0]->i_changes |= VOUT_FULLSCREEN_CHANGE;
//    }
//}
624
625
626

void Intf_VLCWrapper::eject(){}

627
    /* playback info */
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670

BString*  Intf_VLCWrapper::getTimeAsString()
{
    static char psz_currenttime[ OFFSETTOTIME_MAX_SIZE ];
        
    if( p_intf->p_sys->p_input == NULL )
    {
        return (new BString("00:00:00"));
    }     
   
    input_OffsetToTime( p_intf->p_sys->p_input, 
                        psz_currenttime, 
                        p_intf->p_sys->p_input->stream.p_selected_area->i_tell );        

    return(new BString(psz_currenttime));
}

float  Intf_VLCWrapper::getTimeAsFloat()
{
    float f_time = 0.0;

    if( p_intf->p_sys->p_input != NULL )
    {
        f_time = (float)p_intf->p_sys->p_input->stream.p_selected_area->i_tell / 
                 (float)p_intf->p_sys->p_input->stream.p_selected_area->i_size;
    }    
    else
    {
        f_time = 0.0;
    }
    return( f_time );
}

void   Intf_VLCWrapper::setTimeAsFloat(float f_position)
{
    if( p_intf->p_sys->p_input != NULL )
    {
        input_Seek( p_intf->p_sys->p_input, 
                   (long long int)(p_intf->p_sys->p_input->stream.p_selected_area->i_size * f_position / 100), 
                   INPUT_SEEK_SET);
    }
}

671
672
673
674
675
bool   Intf_VLCWrapper::playlistPlaying()
{ 
    /* return( !p_main->p_playlist->b_stopped ); */
}

676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
BList  *Intf_VLCWrapper::playlistAsArray()
{ 
    int i;
    playlist_t *p_playlist = 
                (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
                                                       FIND_ANYWHERE );

    BList* p_list = new BList(p_playlist->i_size);
    
    vlc_mutex_lock( &p_playlist->object_lock );

    for( i = 0; i < p_playlist->i_size; i++ )
    {
        p_list->AddItem(new BString(p_playlist->pp_items[i]->psz_name));
    }

    vlc_mutex_unlock( &p_playlist->object_lock );
    vlc_object_release( p_playlist );
    return( p_list );
}

    /* open file/disc/network */
698
void Intf_VLCWrapper::openFiles( BList* o_files, bool replace )
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
{
    BString *o_file;
    playlist_t *p_playlist = 
               (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
                                                      FIND_ANYWHERE );

    while( ( o_file = (BString *)o_files->LastItem() ) )
    {
        o_files->RemoveItem(o_files->CountItems() - 1);
        playlist_Add( p_playlist, o_file->String(),
                  PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END );
        delete o_file;
    }

    vlc_object_release( p_playlist );
}

void Intf_VLCWrapper::openDisc(BString o_type, BString o_device, int i_title, int i_chapter)
{
    BString o_source("");
    o_source << o_type << ":" << o_device ;

    playlist_t *p_playlist = 
               (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
                                                      FIND_ANYWHERE );
    playlist_Add( p_playlist, o_source.String(),
                  PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END );
    vlc_object_release( p_playlist );
}

void Intf_VLCWrapper::openNet(BString o_addr, int i_port)
{
}

void Intf_VLCWrapper::openNetChannel(BString o_addr, int i_port)
{
}

void Intf_VLCWrapper::openNetHTTP(BString o_addr)
{
}

741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773

    /* menus management */
void Intf_VLCWrapper::toggleProgram(int i_program){}

void Intf_VLCWrapper::toggleTitle(int i_title)
{
    if( p_intf->p_sys->p_input != NULL )
    {
        input_ChangeArea( p_intf->p_sys->p_input,
                          p_intf->p_sys->p_input->stream.pp_areas[i_title] );

        vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock );
        //setupMenus();

        vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock );
    }
}

void Intf_VLCWrapper::toggleChapter(int i_chapter)
{
    if( p_intf->p_sys->p_input != NULL )
    {
        p_intf->p_sys->p_input->stream.p_selected_area->i_part = i_chapter;
        input_ChangeArea( p_intf->p_sys->p_input,
                          p_intf->p_sys->p_input->stream.p_selected_area );

        vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock );
//        setupMenus();
        vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock );
    }
}

void Intf_VLCWrapper::toggleLanguage(int i_language)
774
{
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803

    int32 i_old = -1;
    int i_cat = AUDIO_ES;

    vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock );
    for( int i = 0; i < p_intf->p_sys->p_input->stream.i_selected_es_number ; i++ )
    {
        if( p_intf->p_sys->p_input->stream.pp_selected_es[i]->i_cat == i_cat )
        {
            i_old = i;
            break;
        }
    }
    vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock );

    msg_Info( p_intf, "Old: %d,  New: %d", i_old, i_language);
    if( i_language != -1 )
    {
        input_ToggleES( p_intf->p_sys->p_input, 
                        p_intf->p_sys->p_input->stream.pp_selected_es[i_language],
                        VLC_TRUE );
    }

    if( (i_old != -1) && (i_old != i_language) )
    {
        input_ToggleES( p_intf->p_sys->p_input, 
                        p_intf->p_sys->p_input->stream.pp_selected_es[i_old],
                        VLC_FALSE );
    }
804
805
}

806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
void Intf_VLCWrapper::toggleSubtitle(int i_subtitle)
{
    int32 i_old = -1;
    int i_cat = SPU_ES;

    vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock );
    for( int i = 0; i < p_intf->p_sys->p_input->stream.i_selected_es_number ; i++ )
    {
        if( p_intf->p_sys->p_input->stream.pp_selected_es[i]->i_cat == i_cat )
        {
            i_old = i;
            break;
        }
    }
    vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock );
821
    
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
    msg_Info( p_intf, "Old: %d,  New: %d", i_old, i_subtitle);
    if( i_subtitle != -1 )
    {
        input_ToggleES( p_intf->p_sys->p_input, 
                        p_intf->p_sys->p_input->stream.pp_selected_es[i_subtitle],
                        VLC_TRUE );
    }

    if( (i_old != -1) && (i_old != i_subtitle) )
    {
        input_ToggleES( p_intf->p_sys->p_input, 
                        p_intf->p_sys->p_input->stream.pp_selected_es[i_old],
                        VLC_FALSE );
    }
}


void Intf_VLCWrapper::setupMenus(){}
int  Intf_VLCWrapper::inputGetStatus() {}