forked from RSATom/fbvlc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
FBVLCAPI.cpp
1205 lines (946 loc) · 25.7 KB
/
FBVLCAPI.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
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
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
119
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
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
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
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
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
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
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
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
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
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
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/**********************************************************\
Auto-generated FBVLCAPI.cpp
\**********************************************************/
#include "JSObject.h"
#include "variant_list.h"
#include "DOM/Document.h"
#include "global/config.h"
#include "FBVLCAPI.h"
////////////////////////////////////////////////////////////////////////////
/// FBVLCAudioAPI
////////////////////////////////////////////////////////////////////////////
FBVLCPtr FBVLCAudioAPI::getPlugin()
{
FBVLCPtr plugin(m_plugin.lock());
if (!plugin) {
throw FB::script_error("The plugin is invalid");
}
return plugin;
}
unsigned FBVLCAudioAPI::get_trackCount()
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
return p.audio().track_count();
}
bool FBVLCAudioAPI::get_mute()
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
return p.audio().is_muted();
}
void FBVLCAudioAPI::set_mute(bool m)
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
p.audio().set_mute(m);
}
unsigned int FBVLCAudioAPI::get_volume()
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
return p.audio().get_volume();
}
void FBVLCAudioAPI::set_volume(unsigned int vol)
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
p.audio().set_volume(vol);
}
int FBVLCAudioAPI::get_track()
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
return p.audio().get_track();
}
void FBVLCAudioAPI::set_track( int idx )
{
if( idx < 0 )
return;
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
p.audio().set_track( idx );
}
unsigned int FBVLCAudioAPI::get_channel()
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
return p.audio().get_channel();
}
void FBVLCAudioAPI::set_channel(unsigned int ch)
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
p.audio().set_channel( (libvlc_audio_output_channel_t) ch );
}
void FBVLCAudioAPI::toggleMute()
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
p.audio().toggle_mute();
}
std::string FBVLCAudioAPI::description(unsigned int trackID)
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
std::string track_name;
libvlc_track_description_t* root_track_desc =
libvlc_audio_get_track_description(p.get_mp());
if( !root_track_desc )
return track_name;
unsigned int tc = p.audio().track_count();
if( tc && trackID < tc ) {
libvlc_track_description_t* track_desc = root_track_desc;
for(; trackID && track_desc ; --trackID ){
track_desc = track_desc->p_next;
}
if ( track_desc && track_desc->psz_name ) {
track_name = track_desc->psz_name;
}
}
libvlc_track_description_list_release(root_track_desc);
return track_name;
}
////////////////////////////////////////////////////////////////////////////
/// FBVLCInputAPI
////////////////////////////////////////////////////////////////////////////
FBVLCPtr FBVLCInputAPI::getPlugin()
{
FBVLCPtr plugin(m_plugin.lock());
if (!plugin) {
throw FB::script_error("The plugin is invalid");
}
return plugin;
}
double FBVLCInputAPI::get_length()
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
return static_cast<double>(p.current_media().get_length());
}
double FBVLCInputAPI::get_fps()
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
return p.current_media().get_fps();
}
bool FBVLCInputAPI::get_hasVout()
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
return p.video().has_vout();
}
unsigned int FBVLCInputAPI::get_state()
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
return p.get_state();
}
double FBVLCInputAPI::get_position()
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
return p.get_position();
}
void FBVLCInputAPI::set_position(double pos)
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
p.set_position(static_cast<float>(pos));
}
double FBVLCInputAPI::get_time()
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
return static_cast<double>(p.get_time());
}
void FBVLCInputAPI::set_time(double t)
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
return p.set_time(static_cast<libvlc_time_t>(t));
}
double FBVLCInputAPI::get_rate()
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
return p.get_rate();
}
void FBVLCInputAPI::set_rate(double r)
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
p.set_rate(static_cast<float>(r));
}
////////////////////////////////////////////////////////////////////////////
/// FBVLCPlaylistItemsAPI
////////////////////////////////////////////////////////////////////////////
FBVLCPtr FBVLCPlaylistItemsAPI::getPlugin()
{
FBVLCPtr plugin(m_plugin.lock());
if (!plugin) {
throw FB::script_error("The plugin is invalid");
}
return plugin;
}
unsigned int FBVLCPlaylistItemsAPI::get_count()
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
return p.item_count();
}
void FBVLCPlaylistItemsAPI::clear()
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
return p.clear_items();
}
bool FBVLCPlaylistItemsAPI::remove(unsigned int idx)
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
return p.delete_item(idx);
}
////////////////////////////////////////////////////////////////////////////
/// FBVLCPlaylistAPI
////////////////////////////////////////////////////////////////////////////
FBVLCPtr FBVLCPlaylistAPI::getPlugin()
{
FBVLCPtr plugin(m_plugin.lock());
if (!plugin) {
throw FB::script_error("The plugin is invalid");
}
return plugin;
}
unsigned int FBVLCPlaylistAPI::get_itemCount()
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
return p.item_count();
}
bool FBVLCPlaylistAPI::get_isPlaying()
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
return p.is_playing();
}
int FBVLCPlaylistAPI::get_current()
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
return p.current_item();
}
int FBVLCPlaylistAPI::add(const std::string& mrl)
{
FBVLCPtr plg = getPlugin();
return plg->add_playlist_item(mrl.c_str());
}
int FBVLCPlaylistAPI::addWithOptions(const std::string& mrl,
const std::vector<std::string>& options)
{
if( options.empty() )
return add(mrl);
FBVLCPtr plg = getPlugin();
return plg->add_playlist_item( mrl, options );
}
void FBVLCPlaylistAPI::play()
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
p.play();
}
bool FBVLCPlaylistAPI::playItem(unsigned int idx)
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
return p.play(idx);
}
void FBVLCPlaylistAPI::setCurrentItem(unsigned int idx)
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
p.set_current(idx);
}
void FBVLCPlaylistAPI::pause()
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
p.pause();
}
void FBVLCPlaylistAPI::togglePause()
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
if ( p.is_playing() ) p.pause();
else p.play();
}
void FBVLCPlaylistAPI::stop()
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
//use async stop to avoid freeze (on network timeout for example).
p.stop( true );
}
void FBVLCPlaylistAPI::next()
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
p.next();
}
void FBVLCPlaylistAPI::prev()
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
p.prev();
}
void FBVLCPlaylistAPI::clear()
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
p.clear_items();
}
bool FBVLCPlaylistAPI::removeItem(unsigned int idx)
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
return p.delete_item(idx);
}
////////////////////////////////////////////////////////////////////////////
/// FBVLCSubtitleAPI
////////////////////////////////////////////////////////////////////////////
FBVLCPtr FBVLCSubtitleAPI::getPlugin()
{
FBVLCPtr plugin(m_plugin.lock());
if (!plugin) {
throw FB::script_error("The plugin is invalid");
}
return plugin;
}
unsigned FBVLCSubtitleAPI::get_trackCount()
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
return p.subtitles().track_count();
}
int FBVLCSubtitleAPI::get_track()
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
return p.subtitles().get_track();
}
void FBVLCSubtitleAPI::set_track( int idx )
{
if( idx < 0 )
return;
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
return p.subtitles().set_track( idx );
}
std::string FBVLCSubtitleAPI::description(unsigned int sID)
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
std::string s_name;
libvlc_track_description_t* root_s_desc =
libvlc_video_get_spu_description(p.get_mp());
if( !root_s_desc )
return s_name;
unsigned int sc = libvlc_video_get_spu_count(p.get_mp());
if( sc && sID < sc ) {
libvlc_track_description_t* s_desc = root_s_desc;
for(; sID && s_desc ; --sID ){
s_desc = s_desc->p_next;
}
if ( s_desc && s_desc->psz_name ) {
s_name = s_desc->psz_name;
}
}
libvlc_track_description_list_release(root_s_desc);
return s_name;
}
////////////////////////////////////////////////////////////////////////////
/// positions
////////////////////////////////////////////////////////////////////////////
const char* positions [] = {
"center", // 0
"left", // 1
"right", // 2
0, // 3
"top", // 4
"top-left", // 5
"top-right", // 6
0, // 7
"bottom", // 8
"bottom-left", // 9
"bottom-right", //10
};
inline std::string get_position_by_id(unsigned int id)
{
unsigned int p_size = sizeof(positions)/sizeof(positions[0]);
if( id < p_size && positions[id] ) {
return positions[id];
}
else return std::string();
}
int get_id_by_position(const std::string& pos)
{
int p_size = sizeof(positions)/sizeof(positions[0]);
for(int i=0; i<p_size; ++i) {
if( positions[i] && pos == positions[i] )
return i;
}
return -1;
}
////////////////////////////////////////////////////////////////////////////
/// FBVLCMarqueeAPI
////////////////////////////////////////////////////////////////////////////
FBVLCPtr FBVLCMarqueeAPI::getPlugin()
{
FBVLCPtr plugin(m_plugin.lock());
if (!plugin) {
throw FB::script_error("The plugin is invalid");
}
return plugin;
}
std::string FBVLCMarqueeAPI::get_text()
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
std::string text;
char* t = libvlc_video_get_marquee_string(p.get_mp(), libvlc_marquee_Text);
if ( t )
text = t;
return text;
}
void FBVLCMarqueeAPI::set_text(const std::string& t)
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
libvlc_video_set_marquee_string(p.get_mp(), libvlc_marquee_Text, t.c_str());
}
std::string FBVLCMarqueeAPI::get_position()
{
int p = get_marquee_int(libvlc_marquee_Position);
return get_position_by_id(p);
}
void FBVLCMarqueeAPI::set_position(const std::string& position)
{
int p = get_id_by_position(position);
set_marquee_int(libvlc_marquee_Position, p);
}
int FBVLCMarqueeAPI::get_marquee_int(libvlc_video_marquee_option_t o)
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
return libvlc_video_get_marquee_int(p.get_mp(), o);
}
void FBVLCMarqueeAPI::set_marquee_int(libvlc_video_marquee_option_t o, int i)
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
libvlc_video_set_marquee_int(p.get_mp(), o, i);
}
////////////////////////////////////////////////////////////////////////////
/// FBVLCLogoAPI
////////////////////////////////////////////////////////////////////////////
FBVLCPtr FBVLCLogoAPI::getPlugin()
{
FBVLCPtr plugin(m_plugin.lock());
if (!plugin) {
throw FB::script_error("The plugin is invalid");
}
return plugin;
}
std::string FBVLCLogoAPI::get_position()
{
int p = get_logo_int(libvlc_logo_position);
return get_position_by_id(p);
}
void FBVLCLogoAPI::set_position(const std::string& position)
{
int p = get_id_by_position(position);
set_logo_int(libvlc_logo_position, p);
}
void FBVLCLogoAPI::file(const std::string& f)
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
libvlc_video_set_logo_string(p.get_mp(), libvlc_logo_file, f.c_str());
}
int FBVLCLogoAPI::get_logo_int(libvlc_video_logo_option_t o)
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
return libvlc_video_get_logo_int(p.get_mp(), o);
}
void FBVLCLogoAPI::set_logo_int(libvlc_video_logo_option_t o, int i)
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
libvlc_video_set_logo_int(p.get_mp(), o, i);
}
////////////////////////////////////////////////////////////////////////////
/// FBVLCDeinterlaceAPI
////////////////////////////////////////////////////////////////////////////
FBVLCPtr FBVLCDeinterlaceAPI::getPlugin()
{
FBVLCPtr plugin(m_plugin.lock());
if (!plugin) {
throw FB::script_error("The plugin is invalid");
}
return plugin;
}
void FBVLCDeinterlaceAPI::enable(const std::string& mode)
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
libvlc_video_set_deinterlace(p.get_mp(), mode.c_str());
}
void FBVLCDeinterlaceAPI::disable()
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
libvlc_video_set_deinterlace(p.get_mp(), "");
}
////////////////////////////////////////////////////////////////////////////
/// FBVLCVideoAPI
////////////////////////////////////////////////////////////////////////////
FBVLCPtr FBVLCVideoAPI::getPlugin()
{
FBVLCPtr plugin(m_plugin.lock());
if (!plugin) {
throw FB::script_error("The plugin is invalid");
}
return plugin;
}
void FBVLCVideoAPI::getVideoSize( unsigned* width, unsigned* height )
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
libvlc_media_t* media = libvlc_media_player_get_media( p.get_mp() );
if( media && !libvlc_media_is_parsed( media ) )
libvlc_media_parse( media );
*width = *height = 0;
libvlc_video_get_size( p.get_mp(), 0, width, height );
if( media && ( !*width || !*height ) ) {
/*FIXME: It's not absolutely correct way to detect media dimensions,
since now will be returned dimensions of first track with not zero demensions,
and there are no any guarantee it will be be current playing track.
But we nothing can do with it, since there are no way to match current
playing track and track info received from libvlc_media_get_tracks_info for now.*/
libvlc_media_track_info_t* info;
int infoCount = libvlc_media_get_tracks_info( media, &info );
for( int i = 0; i < infoCount; ++i ) {
if( libvlc_track_video == info[i].i_type &&
info[i].u.video.i_width &&
info[i].u.video.i_height )
{
*width = info[i].u.video.i_width;
*height = info[i].u.video.i_height;
break;
}
}
libvlc_free( info );
}
}
unsigned int FBVLCVideoAPI::get_width()
{
unsigned x = 0, y = 0;
getVideoSize( &x, &y );
return x;
}
unsigned int FBVLCVideoAPI::get_height()
{
unsigned x = 0, y = 0;
getVideoSize( &x, &y );
return y;
}
unsigned FBVLCVideoAPI::get_trackCount()
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
return p.video().track_count();
}
int FBVLCVideoAPI::get_track()
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
return p.video().get_track();
}
void FBVLCVideoAPI::set_track( int idx )
{
if( idx < 0 )
return;
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
p.video().set_track( idx );
}
bool FBVLCVideoAPI::get_fullscreen()
{
FBVLCPtr plg = getPlugin();
return plg->is_fullscreen();
}
void FBVLCVideoAPI::set_fullscreen(bool fs)
{
FBVLCPtr plg = getPlugin();
return plg->set_fullscreen(fs);
}
void FBVLCVideoAPI::toggleFullscreen()
{
FBVLCPtr plg = getPlugin();
plg->toggle_fullscreen();
}
std::string FBVLCVideoAPI::get_aspectRatio()
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
std::string aspectRatio;
char* ar = libvlc_video_get_aspect_ratio(p.get_mp());
if ( ar )
aspectRatio = ar;
libvlc_free(ar);
return aspectRatio;
}
void FBVLCVideoAPI::set_aspectRatio(const std::string& ar)
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
libvlc_video_set_aspect_ratio(p.get_mp(), ar.c_str());
}
int FBVLCVideoAPI::get_subtitle()
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
return libvlc_video_get_spu(p.get_mp());
}
void FBVLCVideoAPI::set_subtitle(unsigned int t)
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
libvlc_video_set_spu(p.get_mp(), t);
}
std::string FBVLCVideoAPI::get_crop()
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
std::string crop;
char* c = libvlc_video_get_crop_geometry(p.get_mp());
if ( c )
crop = c;
libvlc_free(c);
return crop;
}
void FBVLCVideoAPI::set_crop(const std::string& c)
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
libvlc_video_set_crop_geometry(p.get_mp(), c.c_str());
}
int FBVLCVideoAPI::get_teletext()
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
return libvlc_video_get_teletext(p.get_mp());
}
void FBVLCVideoAPI::set_teletext(unsigned int t)
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
return libvlc_video_set_teletext(p.get_mp(), t);
}
void FBVLCVideoAPI::toggleTeletext()
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
libvlc_toggle_teletext(p.get_mp());
}
float FBVLCVideoAPI::get_contrast()
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
return p.video().get_contrast();
}
void FBVLCVideoAPI::set_contrast(float v)
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
return p.video().set_contrast(v);
}
float FBVLCVideoAPI::get_brightness()
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
return p.video().get_brightness();
}
void FBVLCVideoAPI::set_brightness(float v)
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
return p.video().set_brightness(v);
}
float FBVLCVideoAPI::get_hue()
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
return p.video().get_hue();
}
void FBVLCVideoAPI::set_hue(float v)
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
return p.video().set_hue(v);
}
float FBVLCVideoAPI::get_saturation()
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
return p.video().get_saturation();
}
void FBVLCVideoAPI::set_saturation(float v)
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
return p.video().set_saturation(v);
}
float FBVLCVideoAPI::get_gamma()
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
return p.video().get_gamma();
}
void FBVLCVideoAPI::set_gamma(float v)
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
return p.video().set_gamma(v);
}
////////////////////////////////////////////////////////////////////////////
/// FBVLCMediaDescAPI
////////////////////////////////////////////////////////////////////////////
FBVLCPtr FBVLCMediaDescAPI::getPlugin()
{
FBVLCPtr plugin(m_plugin.lock());
if (!plugin) {
throw FB::script_error("The plugin is invalid");
}
return plugin;
}
std::string FBVLCMediaDescAPI::get_meta(libvlc_meta_t e_meta)
{
FBVLCPtr plg = getPlugin();
vlc_player& p = plg->get_player();
libvlc_media_t * p_media = libvlc_media_player_get_media(p.get_mp());
const char* info = p_media ? libvlc_media_get_meta(p_media, e_meta) : 0;
return info ? std::string(info) : std::string();
}
std::string FBVLCMediaDescAPI::get_title()
{
return get_meta(libvlc_meta_Title);
}
std::string FBVLCMediaDescAPI::get_artist()
{
return get_meta(libvlc_meta_Artist);
}
std::string FBVLCMediaDescAPI::get_genre()
{
return get_meta(libvlc_meta_Genre);
}
std::string FBVLCMediaDescAPI::get_copyright()
{
return get_meta(libvlc_meta_Copyright);
}
std::string FBVLCMediaDescAPI::get_album()
{
return get_meta(libvlc_meta_Album);
}
std::string FBVLCMediaDescAPI::get_trackNumber()
{
return get_meta(libvlc_meta_TrackNumber);
}
std::string FBVLCMediaDescAPI::get_description()
{
return get_meta(libvlc_meta_Description);
}
std::string FBVLCMediaDescAPI::get_rating()
{
return get_meta(libvlc_meta_Rating);
}
std::string FBVLCMediaDescAPI::get_date()
{
return get_meta(libvlc_meta_Date);
}
std::string FBVLCMediaDescAPI::get_setting()
{
return get_meta(libvlc_meta_Setting);
}
std::string FBVLCMediaDescAPI::get_URL()
{
return get_meta(libvlc_meta_URL);
}
std::string FBVLCMediaDescAPI::get_language()
{
return get_meta(libvlc_meta_Language);
}
std::string FBVLCMediaDescAPI::get_nowPlaying()
{
return get_meta(libvlc_meta_NowPlaying);
}