Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

[6b8ec8]: src / player.c Maximize Restore History

Download this file

player.c    1289 lines (1090 with data), 35.8 kB

   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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
/*
* Copyright (C) 2004-2007 the xine-project
*
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
* USA
*
* player object
*/
#include "globals.h"
#include <pthread.h>
#include <xine.h>
#include <string.h>
#include <stdlib.h>
#include <gtk/gtkradiomenuitem.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include "globals.h"
#include "menu.h"
#include "ui.h"
#include "utils.h"
#include "preferences.h"
#include "playlist.h"
#include "gtkvideo.h"
#include "snapshot.h"
#include "engine.h"
#include "player.h"
#define GXINE_VO_ZOOM_MIN (XINE_VO_ZOOM_MIN < 0 ? 0 : XINE_VO_ZOOM_MIN)
#define GXINE_MAX_SPU_CHANNEL (31)
xine_stream_t *stream; /* global stream */
xine_audio_port_t *audio_port;
xine_video_port_t *video_port;
/*
* async play machanism
*
* always start xine engine from a seperate thread so the gui stays responsive
*/
static int goto_pos, goto_time, end_time;
static pthread_t play_thread;
static char *cur_mrl = NULL, *cur_title = NULL;
static gboolean demuxer_for_logo = TRUE;
static int play_exec_error_suppress = 0;
void play_exec_error_suppress_next (void)
{
++play_exec_error_suppress;
}
static void play_exec_error (void)
{
if (play_exec_error_suppress)
{
#ifdef XINE_PARAM_GAPLESS_SWITCH
xine_set_param (stream, XINE_PARAM_GAPLESS_SWITCH, 0);
#endif
--play_exec_error_suppress;
return;
}
int error;
switch (error = xine_get_error (stream))
{
case XINE_ERROR_NO_INPUT_PLUGIN:
display_error (FROM_XINE_COMBINABLE, _("The xine engine failed to start."),
_("No input plugin was found.\n"
"Maybe the file does not exist or cannot be accessed, "
"or there is an error in the URL."));
break;
case XINE_ERROR_NO_DEMUX_PLUGIN:
if (playlist_showing_logo ())
{
g_idle_add ((GSourceFunc)infobar_show_metadata, infobars);
if (demuxer_for_logo)
{
demuxer_for_logo = FALSE;
display_error (FROM_XINE,
_("Whoops. You seem to have a broken xine-lib."),
_("No demuxer found - stream format not recognised."));
}
}
else
display_error (FROM_XINE, _("The xine engine failed to start."),
_("No demuxer found - stream format not recognised."));
break;
case XINE_ERROR_DEMUX_FAILED:
display_error (FROM_XINE, _("The xine engine failed to start."),
_("Demuxing failed.\n"
"Maybe the stream is corrupt or of an unexpected type."));
break;
case XINE_ERROR_MALFORMED_MRL:
display_error (FROM_XINE, _("The xine engine failed to start."),
_("The MRL is malformed."));
break;
case XINE_ERROR_INPUT_FAILED:
display_error (FROM_XINE_COMBINABLE, _("The xine engine failed to start."),
_("The stream could not be opened."));
break;
default:
display_error (FROM_XINE, _("The xine engine failed to start."),
_("Unknown error (code %d)"), error);
}
#ifdef XINE_PARAM_GAPLESS_SWITCH
xine_set_param (stream, XINE_PARAM_GAPLESS_SWITCH, 0);
#endif
if (!playlist_showing_logo ())
g_idle_add ((GSourceFunc)playlist_logo, NULL);
}
static __attribute__ ((noreturn)) void *play_exec (void *data)
{
xine_cfg_entry_t entry;
char *hash, *mrl = NULL;
pthread_setcancelstate (PTHREAD_CANCEL_ENABLE, NULL);
pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
/*pthread_mutex_lock (&engine_lock);*/
pthread_mutex_lock (&widgets_update_lock);
pthread_cleanup_push (pthread_mutex_unlock, &widgets_update_lock);
gdk_threads_enter();
pthread_cleanup_push (gdk_threads_leave, NULL);
gxineinfo_clear (infobars);
gxineinfo_update_line (infobars, 0, "%s", _("opening..."));
gxineinfo_update_line (infobars, 1, "%s", cur_mrl);
if ((!xine_config_lookup_entry (xine, "gui.subtitle_autoload", &entry)
|| entry.num_value)
&& !strncmp (cur_mrl, "file:", 5)
&& ((hash = strchr (cur_mrl, '#')) == NULL
|| (strncmp (hash, "#subtitle:", 10)
&& !strstr (hash, ";subtitle:"))))
{
char *name = cur_mrl + 5;
if (name)
{
unsigned int length = (strchr (name, '#') ? : name + strlen (name)) - name;
char file[length + 5]; /* allow for ".ext" + NUL */
unsigned int i = UINT_MAX, ext = 0;
/* URL decode (can't simply use g_filename_from_uri()...) */
while (++i < length)
{
if (name[i] == '%')
{
char c[3] = { name[i+1], name[i+2], 0 };
i += 2;
file[ext] = (char) strtol (c, NULL, 16);
}
else
file[ext] = name[i];
++ext;
}
/* find last '.' in leaf */
i = ext;
if (ext)
while (--ext && file[ext] != '.' && file[ext] != '/')
/**/;
if (file[ext] == '/') /* if no '.' */
ext = i;
name = strrchr (name, '.');
static const char subs[][4] = { "sub", "srt", "asc", "smi", "ssa", "txt" };
for (i = 0; i < G_N_ELEMENTS (subs); ++i)
if (!name || strcmp (name + 1, subs[i]))
{
struct stat st;
sprintf (file + ext, ".%s", subs[i]);
if (stat (file, &st) > -1 && S_ISREG (st.st_mode))
break;
}
if (i < G_N_ELEMENTS (subs))
{
char *tmp = g_filename_to_uri (file, NULL, NULL);
mrl = g_strconcat (cur_mrl, hash ? ";subtitle:" : "#subtitle:", tmp + 7, NULL);
free (tmp);
}
}
}
pthread_cleanup_pop (TRUE);
int ret = xine_open (stream, mrl ? : cur_mrl);
if (ret)
{
gdk_threads_enter ();
pthread_cleanup_push (gdk_threads_leave, NULL);
ui_set_status (playlist_showing_logo () ? UI_STOP : UI_PLAY);
infobar_show_metadata (infobars);
pthread_cleanup_pop (TRUE);
// xine_play (stream, 0, 0);
xine_play (stream, goto_pos, goto_time);
gtk_video_set_end_time ((GtkVideo *)gtv, end_time);
goto_pos = 0;
goto_time = 0;
end_time = 0;
/* correct for possible stream changes */
gdk_threads_enter ();
pthread_cleanup_push (gdk_threads_leave, NULL);
ui_set_status (playlist_showing_logo () ? UI_STOP : UI_PLAY);
infobar_show_metadata (infobars);
playlist_check_set_title ();
pthread_cleanup_pop (TRUE);
}
else
{
gdk_threads_enter ();
pthread_cleanup_push (gdk_threads_leave, NULL);
play_exec_error ();
pthread_cleanup_pop (TRUE);
}
free (mrl);
pthread_cleanup_pop (TRUE);
/*pthread_mutex_unlock (&engine_lock);*/
pthread_exit (NULL);
}
void player_launch (const char *title, const char *mrl,
int pos, int pos_time, int duration)
{
int err;
pthread_attr_t attr;
goto_pos = pos < 0 ? 0 : pos;
goto_time = pos_time < 0 ? 0 : pos_time;
end_time = duration <= 0 ? 0: pos_time + duration;
free (cur_title);
free (cur_mrl);
cur_title = title && !playlist_showing_logo () ? strdup (title) : NULL;
cur_mrl = strdup (mrl);
gtk_video_unblank_screen ((GtkVideo *)gtv);
if (!demuxer_for_logo && playlist_showing_logo ())
return;
/* start separate thread, so xine_open will not block ui */
pthread_attr_init (&attr);
pthread_attr_setstacksize (&attr, 256 * 1024); /* probably overkill */
if ((err = pthread_create (&play_thread, &attr, play_exec, NULL)) != 0)
{
display_error_modal (FROM_GXINE, _("Player failure"),
_("Can't create new thread: %s\n"), strerror(err));
abort();
}
if (!playlist_showing_logo ())
pthread_detach (play_thread);
pthread_attr_destroy (&attr);
}
void player_wait (void)
{
pthread_join (play_thread, NULL);
play_thread = 0;
}
void player_stop (void)
{
pthread_cancel (play_thread);
play_thread = 0;
xine_stop (stream);
}
static void set_mute (int mute)
{
ui_set_status (mute ? UI_AUDIO_MUTE : UI_AUDIO_UNMUTE);
xine_set_param (stream, XINE_PARAM_AUDIO_MUTE, mute);
}
static inline int calc_speed (int i)
{
return i ? (1 << (i - 1)) : 0;
}
static void set_speed (int speed)
{
xine_set_param (stream, XINE_PARAM_SPEED, speed);
if (speed == XINE_SPEED_NORMAL)
ui_set_status (UI_PLAY);
else if (speed > XINE_SPEED_NORMAL)
ui_set_status (UI_FAST_FORWARD);
else if (speed)
ui_set_status (UI_PLAY_SLOW);
else
ui_set_status (UI_PAUSE);
}
static int listen_speed (void *se, se_t *se_t, se_o_t *o, se_prop_t *prop,
se_prop_read_t r)
{
set_speed (calc_speed (r.i));
return FALSE;
}
static void get_speed (se_prop_t *prop, se_prop_read_t *value)
{
int speed = xine_get_param (stream, XINE_PARAM_SPEED);
int bit = 0;
if (speed)
while (++bit, speed >>= 1);
value->i = bit;
}
static void set_zoom (int zoom)
{
if (zoom < GXINE_VO_ZOOM_MIN)
zoom = GXINE_VO_ZOOM_MIN;
else if (zoom > XINE_VO_ZOOM_MAX)
zoom = XINE_VO_ZOOM_MAX;
xine_set_param (stream, XINE_PARAM_VO_ZOOM_X, zoom);
xine_set_param (stream, XINE_PARAM_VO_ZOOM_Y, zoom);
}
static void set_subtitles (int sub)
{
if (sub >= -2 && sub <= GXINE_MAX_SPU_CHANNEL)
{
GSList *menuitem = action_items.subtitles;
int count = g_slist_length (menuitem);
/* last three menu items (in definition order, not menu display order):
* None (-2), Auto (-1), Other (>= 16, hidden)
*/
if (count > sub + 3)
{
if (sub < 0)
count = 1; /* for None, Auto */
while (menuitem && --count > sub)
menuitem = menuitem->next;
if (menuitem)
{
gtk_action_activate (menuitem->data);
return;
}
}
/* not in menu */
gtk_action_activate (action_items.subtitles->data);
xine_set_param (stream, XINE_PARAM_SPU_CHANNEL, sub);
}
}
static void set_aspect (int aspect)
{
GSList *menuitem = action_items.aspect;
int count = g_slist_length (menuitem);
if (aspect >= XINE_VO_ASPECT_NUM_RATIOS)
aspect = XINE_VO_ASPECT_AUTO;
else if (aspect < 0)
aspect = XINE_VO_ASPECT_NUM_RATIOS - 1;
while (--count > aspect && menuitem->next)
menuitem = menuitem->next;
if (menuitem)
gtk_action_activate (menuitem->data);
}
static void update_postproc_chain (const char *pref, const char *value)
{
xine_cfg_entry_t entry;
xine_config_lookup_entry (xine, pref, &entry);
entry.str_value = (char *)value;
preferences_update_entry (&entry);
}
static JSBool set_postproc_chain (const char *func, const char *pref,
JSContext *cx, JSObject *obj,
uintN argc, jsval *argv, jsval *rval)
{
se_log_fncall (func);
se_argc_check (1, func);
se_arg_is_string (0, func);
update_postproc_chain (pref,
JS_GetStringBytes (JS_ValueToString (cx, argv[0])));
return JS_TRUE;
}
static JSBool set_vo_postproc_chain (JSContext *cx, JSObject *obj,
uintN argc, jsval *argv, jsval *rval)
{
return set_postproc_chain ("vo_postproc.set_chain", "gui.post_plugins.video",
cx, obj, argc, argv, rval);
}
static JSBool set_deint_postproc_chain (JSContext *cx, JSObject *obj,
uintN argc, jsval *argv, jsval *rval)
{
return set_postproc_chain ("vo_deinterlace.set_chain", "gui.post_plugins.deinterlace",
cx, obj, argc, argv, rval);
}
static JSBool set_ao_postproc_chain (JSContext *cx, JSObject *obj,
uintN argc, jsval *argv, jsval *rval)
{
return set_postproc_chain ("ao_postproc.set_chain", "gui.post_plugins.audio",
cx, obj, argc, argv, rval);
}
static int listen_postproc_chain (void *pref, se_t *se, se_o_t *obj,
se_prop_t *prop, se_prop_read_t value)
{
update_postproc_chain (pref, value.s);
return 0;
}
static JSBool get_time (JSContext *cx, JSObject *obj, uintN argc,
jsval *argv, jsval *rval)
{
int pos, pos_time, len;
se_log_fncall ("get_time");
xine_get_pos_length (stream, &pos, &pos_time, &len);
*rval = INT_TO_JSVAL (pos_time);
return JS_TRUE;
}
static JSBool get_pos (JSContext *cx, JSObject *obj, uintN argc,
jsval *argv, jsval *rval)
{
int pos, pos_time, len;
se_log_fncall ("get_pos");
xine_get_pos_length (stream, &pos, &pos_time, &len);
jsdouble *pos_percent = JS_NewDouble (cx, pos / 655.35);
*rval = DOUBLE_TO_JSVAL (pos_percent);
return JS_TRUE;
}
static JSBool has_time (JSContext *cx, JSObject *obj, uintN argc,
jsval *argv, jsval *rval)
{
int pos, pos_time, len;
se_log_fncall ("has_time");
xine_get_pos_length (stream, &pos, &pos_time, &len);
*rval = BOOLEAN_TO_JSVAL (len != 0);
return JS_TRUE;
}
#ifdef WITH_OBSOLETE
static JSBool js_get_speed (JSContext *cx, JSObject *obj, uintN argc,
jsval *argv, jsval *rval)
{
se_prop_read_t speed;
se_log_fncall_obsolete ("get_speed");
get_speed (NULL, &speed);
*rval = INT_TO_JSVAL (speed.i);
return JS_TRUE;
}
static JSBool js_get_volume (JSContext *cx, JSObject *obj, uintN argc,
jsval *argv, jsval *rval)
{
/* se_t *se = (se_t *) JS_GetContextPrivate(cx); */
int volume;
se_log_fncall_obsolete ("get_volume");
volume = xine_get_param (stream, XINE_PARAM_AUDIO_VOLUME);
*rval = INT_TO_JSVAL (volume);
return JS_TRUE;
}
static JSBool js_get_mute (JSContext *cx, JSObject *obj, uintN argc,
jsval *argv, jsval *rval)
{
/* se_t *se = (se_t *) JS_GetContextPrivate(cx); */
int mute;
se_log_fncall_obsolete ("get_mute");
mute = xine_get_param (stream, XINE_PARAM_AUDIO_MUTE);
*rval = BOOLEAN_TO_JSVAL (mute);
return JS_TRUE;
}
static JSBool js_get_zoom (JSContext *cx, JSObject *obj, uintN argc,
jsval *argv, jsval *rval)
{
/* se_t *se = (se_t *) JS_GetContextPrivate(cx); */
int zoom;
se_log_fncall_obsolete ("get_zoom");
zoom = xine_get_param (stream, XINE_PARAM_VO_ZOOM_X);
*rval = INT_TO_JSVAL (zoom);
return JS_TRUE;
}
#endif /* WITH_OBSOLETE */
static JSBool controls_pause (JSContext *cx, JSObject *obj, uintN argc,
jsval *argv, jsval *rval)
{
int32 pause_state=-1;
se_log_fncall_checkinit ("pause");
se_argc_check_max (1, "pause");
if (argc == 1)
{
se_arg_is_int_or_bool (0, "pause");
JS_ValueToInt32 (cx, argv[0], &pause_state);
}
switch (pause_state)
{
case 0: /* pause off */
set_speed (XINE_SPEED_NORMAL);
break;
case 1: /* pause on */
set_speed (XINE_SPEED_PAUSE);
break;
default: /* toggle */
if (xine_get_param (stream, XINE_PARAM_SPEED) != XINE_SPEED_PAUSE)
set_speed (XINE_SPEED_PAUSE);
else
set_speed (XINE_SPEED_NORMAL);
}
return JS_TRUE;
}
static JSBool controls_stop (JSContext *cx, JSObject *obj, uintN argc,
jsval *argv, jsval *rval)
{
se_log_fncall_checkinit ("stop");
player_stop ();
playlist_logo (NULL);
ui_set_control_adjustment (Control_SEEKER, 0);
return JS_TRUE;
}
static JSBool controls_eject (JSContext *cx, JSObject *obj, uintN argc,
jsval *argv, jsval *rval)
{
se_log_fncall_checkinit ("eject");
if (xine_get_status (stream) == XINE_STATUS_PLAY)
player_stop ();
gdk_threads_leave (); /* need to do this to allow play_exec() to proceed */
playlist_logo (cx); /* doesn't matter so long as it's not NULL */
gdk_threads_enter ();
ui_set_control_adjustment (Control_SEEKER, 0);
int ret = xine_eject (stream);
*rval = BOOLEAN_TO_JSVAL (ret);
return JS_TRUE;
}
#ifdef WITH_OBSOLETE
static JSBool js_set_speed (JSContext *cx, JSObject *obj, uintN argc,
jsval *argv, jsval *rval)
{
int32 speed;
se_log_fncall_obsolete ("set_speed");
se_argc_check (1, "set_speed");
se_arg_is_int (0, "set_speed");
JS_ValueToInt32 (cx, argv[0], &speed);
if (speed<0)
speed = 0;
set_speed (calc_speed (speed));
return JS_TRUE;
}
static JSBool js_set_volume (JSContext *cx, JSObject *obj, uintN argc,
jsval *argv, jsval *rval)
{
int32 volume;
se_log_fncall_obsolete ("set_volume");
se_argc_check (1, "set_volume");
se_arg_is_int (0, "set_volume");
JS_ValueToInt32 (cx, argv[0], &volume);
if (volume<0)
volume = 0;
ui_set_control_adjustment (Control_VOLUME, volume);
ui_xine_set_param_from_adjustment (Control_VOLUME);
return JS_TRUE;
}
static JSBool js_set_mute (JSContext *cx, JSObject *obj, uintN argc,
jsval *argv, jsval *rval)
{
JSBool mute;
se_log_fncall_obsolete ("set_mute");
se_argc_check_max (1, "set_mute");
if (argc == 1)
{
se_arg_is_int_or_bool (0, "set_mute");
JS_ValueToBoolean (cx, argv[0], &mute);
}
else
mute = !xine_get_param (stream, XINE_PARAM_AUDIO_MUTE);
set_mute (mute);
return JS_TRUE;
}
static JSBool js_set_zoom (JSContext *cx, JSObject *obj, uintN argc,
jsval *argv, jsval *rval)
{
int32 zoom;
se_log_fncall_obsolete ("set_zoom");
se_argc_check (1, "set_zoom");
se_arg_is_int (0, "set_zoom");
JS_ValueToInt32 (cx, argv[0], &zoom);
set_zoom (zoom);
return JS_TRUE;
}
#endif /* WITH_OBSOLETE */
static int zoomcb, zoomcb_id = 0;
static gboolean video_rescale_cb (gpointer unused)
{
gtk_video_rescale ((GtkVideo *) gtv, zoomcb);
zoomcb_id = 0;
return FALSE;
}
static gboolean set_video_size_cb (gpointer unused)
{
gdk_threads_enter ();
/* find & activate an action item which corresponds to the requested scale */
GtkAction *action = (zoomcb == -1) ? NULL : find_video_size_action (zoomcb);
if (action)
gtk_action_activate (action);
else
{
scale_changed_cb (NULL, zoomcb, NULL);
zoomcb_id = g_idle_add ((GSourceFunc) video_rescale_cb, NULL);
}
gdk_threads_leave ();
return FALSE;
}
static JSBool js_set_video_size (JSContext *cx, JSObject *obj, uintN argc,
jsval *argv, jsval *rval)
{
se_log_fncall ("set_video_size");
se_argc_check (1, "set_video_size");
se_arg_is_int (0, "set_video_size");
int32 zoom;
JS_ValueToInt32 (cx, argv[0], &zoom);
if (zoom < GXINE_VO_ZOOM_MIN && zoom != -1)
zoom = GXINE_VO_ZOOM_MIN;
else if (zoom > XINE_VO_ZOOM_MAX)
zoom = XINE_VO_ZOOM_MAX;
zoomcb = zoom;
if (zoomcb_id)
g_source_remove (zoomcb_id);
zoomcb_id = g_idle_add ((GSourceFunc) set_video_size_cb, NULL);
return JS_TRUE;
}
#ifdef WITH_DEPRECATED
static JSBool js_set_fullscreen (JSContext *cx, JSObject *obj, uintN argc,
jsval *argv, jsval *rval)
{
int32 fs;
se_log_fncall_deprecated ("set_fullscreen");
se_argc_check_max (1, "set_fullscreen");
if (argc == 1)
{
se_arg_is_int_or_bool (0, "set_fullscreen");
JS_ValueToInt32 (cx, argv[0], &fs);
}
else
fs = !gtk_video_is_fullscreen ((GtkVideo *)gtv);
if (gtk_toggle_action_get_active (action_items.fullscreen) != fs)
gtk_action_activate (GTK_ACTION (action_items.fullscreen));
return JS_TRUE;
}
#ifdef WITH_OBSOLETE
static JSBool js_set_deinterlace (JSContext *cx, JSObject *obj, uintN argc,
jsval *argv, jsval *rval)
{
int32 di;
se_log_fncall_obsolete ("set_deinterlace");
se_argc_check_max (1, "set_deinterlace");
if (argc == 1)
{
se_arg_is_int_or_bool (0, "set_deinterlace");
JS_ValueToInt32 (cx, argv[0], &di);
}
else
di = !gtk_video_get_use_post_plugins_deinterlace ((GtkVideo *)gtv);
set_deinterlace (di);
return JS_TRUE;
}
static JSBool js_set_postproc_video (JSContext *cx, JSObject *obj,
uintN argc, jsval *argv, jsval *rval)
{
se_t *se = (se_t *) JS_GetContextPrivate(cx);
int32 di;
se_log_fncall_obsolete ("set_postproc_video");
se_argc_check_max (1, "set_postproc_video");
if (argc == 1)
{
if (JSVAL_IS_INT (argv[0]))
JS_ValueToInt32 (cx, argv[0], &di);
else if (JSVAL_IS_STRING (argv[0]))
return set_vo_postproc_chain (cx, obj, argc, argv, rval);
else
{
se->print_cb (se->print_cb_data,
_("error: %s() argument %d is neither int nor string\n"),
"set_postproc_video", 1);
return JS_TRUE;
}
} else
di = !gtk_video_get_use_post_plugins_video ((GtkVideo *)gtv);
set_vo_postproc (di);
return JS_TRUE;
}
static JSBool js_set_postproc_audio (JSContext *cx, JSObject *obj,
uintN argc, jsval *argv, jsval *rval)
{
se_t *se = (se_t *) JS_GetContextPrivate(cx);
int32 di;
se_log_fncall_obsolete ("set_postproc_audio");
se_argc_check_max (1, "set_postproc_audio");
if (argc == 1)
{
if (JSVAL_IS_INT (argv[0]))
JS_ValueToInt32 (cx, argv[0], &di);
else if (JSVAL_IS_STRING (argv[0]))
return set_ao_postproc_chain (cx, obj, argc, argv, rval);
else
{
se->print_cb (se->print_cb_data,
_("error: %s() argument %d is neither int nor string\n"),
"set_postproc_audio", 1);
return JS_TRUE;
}
} else
di = !gtk_video_get_use_post_plugins_audio ((GtkVideo *)gtv);
set_ao_postproc (di);
return JS_TRUE;
}
static JSBool js_set_auto_resize (JSContext *cx, JSObject *obj, uintN argc,
jsval *argv, jsval *rval)
{
int32 ar;
se_log_fncall_obsolete ("set_auto_resize");
se_argc_check_max (1, "set_auto_resize");
if (argc == 1)
{
se_arg_is_int_or_bool (0, "set_auto_resize");
JS_ValueToInt32 (cx, argv[0], &ar);
}
else
ar = !gtk_video_get_auto_resize ((GtkVideo *)gtv);
set_auto_resize (ar);
return JS_TRUE;
}
static JSBool js_set_auto_rescale (JSContext *cx, JSObject *obj, uintN argc,
jsval *argv, jsval *rval)
{
int32 ar;
se_log_fncall_obsolete ("set_auto_rescale");
se_argc_check_max (1, "set_auto_rescale");
if (argc == 1)
{
se_arg_is_int_or_bool (0, "set_auto_rescale");
JS_ValueToInt32 (cx, argv[0], &ar);
}
else
ar = !gtk_video_get_auto_rescale ((GtkVideo *)gtv);
set_auto_rescale (ar);
return JS_TRUE;
}
static JSBool js_set_aspect (JSContext *cx, JSObject *obj, uintN argc,
jsval *argv, jsval *rval)
{
int32 aspect;
se_log_fncall_obsolete ("set_aspect");
se_argc_check_max (1, "set_aspect");
if (argc==1)
{
se_arg_is_int (0, "set_aspect");
JS_ValueToInt32 (cx, argv[0], &aspect);
}
else
aspect = xine_get_param (stream, XINE_PARAM_VO_ASPECT_RATIO) + 1;
set_aspect (aspect);
return JS_TRUE;
}
#endif /* WITH_OBSOLETE */
#endif /* WITH_DEPRECATED */
static JSBool js_snapshot (JSContext *cx, JSObject *obj, uintN argc,
jsval *argv, jsval *rval)
{
JSString *str;
char *fname = NULL;
int32 scale = -1, blend = -1;
se_log_fncall_checkinit ("snapshot");
se_argc_check_range (0, 3, "snapshot");
switch (argc) /* note fall-through */
{
case 3:
se_arg_is_int (2, "snapshot");
JS_ValueToInt32 (cx, argv[2], &blend);
case 2:
se_arg_is_int (1, "snapshot");
JS_ValueToInt32 (cx, argv[1], &scale);
case 1:
se_arg_is_string (0, "snapshot");
str = JS_ValueToString (cx, argv[0]);
fname = JS_GetStringBytes (str);
}
make_snapshot (fname, scale, blend);
return JS_TRUE;
}
static JSBool controls_play (JSContext *cx, JSObject *obj, uintN argc,
jsval *argv, jsval *rval)
{
se_log_fncall_checkinit ("play");
se_argc_check_max (3, "play");
char *mrl = NULL;
int32 pos = -1, pos_time = -1;
switch (argc)
{
case 0:
break;
case 1:
{
JSString *str;
se_arg_is_string (0, "play");
str = JS_ValueToString (cx, argv[0]);
mrl = JS_GetStringBytes (str);
se_log ("playing '%s' from start\n", mrl);
}
break;
case 2:
{
se_arg_is_number (0, "play");
se_arg_is_int (1, "play");
jsdouble *posv = JS_NewDouble (cx, 0); /* when is this freed? */
JS_ValueToNumber (cx, argv[0], posv);
pos = (*posv >= 0 && *posv < 100) ? *posv * 655.35 : -1;
JS_ValueToInt32 (cx, argv[1], &pos_time);
mrl = NULL;
se_log ("playing from %d, %d\n", pos, pos_time);
}
break;
case 3:
{
se_arg_is_string (0, "play");
se_arg_is_number (1, "play");
se_arg_is_int (2, "play");
JSString *str = JS_ValueToString (cx, argv[0]);
jsdouble *posv = JS_NewDouble (cx, 0); /* when is this freed? */
JS_ValueToNumber (cx, argv[1], posv);
pos = (*posv >= 0 && *posv < 100) ? *posv * 655.35 : -1;
JS_ValueToInt32 (cx, argv[2], &pos_time);
mrl = JS_GetStringBytes (str);
se_log ("playing '%s' from %d, %d\n", mrl, pos, pos_time);
}
break;
}
if (mrl)
playlist_play_from (playlist_add_mrl (mrl, -1), pos, pos_time);
else
{
play_item_t *item = playlist_get_current_item ();
if (item)
{
switch (playlist_showing_logo () ? XINE_STATUS_IDLE : xine_get_status (stream))
{
case XINE_STATUS_STOP:
case XINE_STATUS_IDLE:
playlist_play_from (playlist_get_list_pos (), pos,
pos_time < 0 ? item->start_time : pos_time);
break;
default:
if (pos >= 0 || pos_time >= 0)
{
gtk_video_unblank_screen ((GtkVideo *)gtv);
xine_play (stream, pos < 0 ? 0 : pos, pos_time < 0 ? 0 : pos_time);
}
break;
}
play_item_dispose (item);
} else
logprintf (_("script_engine: error: no valid play item available\n"));
}
set_speed (XINE_SPEED_NORMAL);
return JS_TRUE;
}
/* Crude hack to allow combined play/pause function.
* (Useful on some keyboards with CD/DVD control keys.)
*/
static JSBool controls_play_pause (JSContext *cx, JSObject *obj, uintN argc,
jsval *argv, jsval *rval)
{
se_log_fncall_checkinit ("play_pause");
se_argc_check_max (1, "play_pause");
if (argc == 1)
se_arg_is_int_or_bool (0, "play_pause");
switch (xine_get_status (stream))
{
case XINE_STATUS_STOP:
case XINE_STATUS_IDLE:
return controls_play (cx, obj, 0, 0, rval);
default:
return controls_pause (cx, obj, argc, argv, rval);
}
}
static JSBool js_is_live_stream (JSContext *cx, JSObject *obj, uintN argc,
jsval *argv, jsval *rval)
{
*rval = JSVAL_FALSE;
se_log_fncall ("is_live_stream");
se_argc_check_max (0, "is_live_stream");
if (player_live_stream ())
*rval = JSVAL_TRUE;
return JS_TRUE;
}
int player_live_stream (void)
{
gint pos_stream, pos_time, length_time;
return (xine_get_status (stream) == XINE_STATUS_PLAY) &&
(xine_get_pos_length (stream, &pos_stream, &pos_time, &length_time)) &&
length_time == 0 &&
!xine_get_stream_info (stream, XINE_STREAM_INFO_SEEKABLE);
}
const char *player_get_cur_title (void)
{
return cur_title;
}
const char *player_get_cur_mrl (void)
{
return cur_mrl;
}
static xine_audio_port_t *load_audio_out_driver (void)
{
xine_audio_port_t *audio_port;
char **choices = get_driver_ids (xine_list_audio_output_plugins (xine));
/* try to init audio with stored information */
int i = xine_config_register_enum (xine,
"audio.driver", 0, choices,
_("audio driver to use"),
NULL, 10, GXINE_TRUE, NULL);
if (!audio_driver_id)
audio_driver_id = choices[i];
if (!strcmp (audio_driver_id, "null"))
return NULL;
if (strcmp (audio_driver_id, "auto"))
{
audio_port = xine_open_audio_driver (xine, audio_driver_id, NULL);
if (audio_port)
return audio_port;
g_printerr (_("audio driver %s failed\n"), audio_driver_id);
}
/* autoprobe */
audio_port = xine_open_audio_driver (xine, NULL, NULL);
if (audio_port)
return audio_port;
g_printerr (_("audio driver %s failed\n"), "auto");
return xine_open_audio_driver (xine, "none", NULL);
}
/* Properties */
static void add_chain_funcs (const char *prop, const char *config,
JSBool (*set_chain) (JSContext *, JSObject *,
uintN, jsval *, jsval *))
{
se_o_t *obj = se_find_object (gse, NULL, prop);
if (set_chain)
se_defun (gse, obj, "set_chain", set_chain, 0, 0, SE_GROUP_HIDDEN, NULL, NULL);
se_prop_create_xine_id (gse, obj, "chain", config);
se_prop_add_listener (gse, obj, "chain",
listen_postproc_chain, (void *)config);
}
void player_init (void)
{
/*
se_o_t *controls_obj;
*/
cur_mrl = NULL;
/* load drivers, create xine stream */
audio_port = load_audio_out_driver ();
if (!audio_port)
{
display_error_modal (FROM_GXINE, _("Fatal error"),
_("No audio output driver could be loaded."));
exit (2);
}
video_port = xine_open_video_driver (xine, "none", 0, NULL);
stream = xine_stream_new (xine, audio_port, video_port);
#ifdef XINE_PARAM_EARLY_FINISHED_EVENT
xine_set_param (stream, XINE_PARAM_EARLY_FINISHED_EVENT, 1);
#endif
/*
* set up script engine objects and functions
*/
/*
controls_obj = se_create_object (gse, NULL, "controls", NULL);
se_defun (gse, controls_obj, "play", controls_play, 0, 0,
SE_GROUP_HIDDEN, NULL, NULL);
*/
{
static const ui_property_t int_props[] = {
/* Text is help for the commands. Format is:
* To the left of the semicolon, a comma-separated list of
* VARIABLE[=TYPE] or METHOD([PARAMETER TYPE,...])
* To the right, descriptive text
*/
{ "av_speed", N_("v=int, min, max; playback speed"),
UI_CUSTOM (get_speed, set_speed),
XINE_SPEED_PAUSE,
XINE_SPEED_FAST_4,
FALSE,
{ listen_speed } },
{ "vo_aspect", N_("v=int; aspect ratio"), UI_XINE_PARAM (XINE_PARAM_VO_ASPECT_RATIO, set_aspect), 0, XINE_VO_ASPECT_NUM_RATIOS - 1, TRUE },
{ "vo_subtitle", N_("v=int, min, max; subtitle channel"), UI_XINE_PARAM (XINE_PARAM_SPU_CHANNEL, set_subtitles), -2, GXINE_MAX_SPU_CHANNEL },
{ "vo_zoom", N_("v=int, min, max; video zoom (within window)"), UI_XINE_PARAM (XINE_PARAM_VO_ZOOM_X, set_zoom), XINE_VO_ZOOM_MIN, XINE_VO_ZOOM_MAX },
{ NULL }
};
static const ui_property_t bool_props[] = {
{ "ao_mute", N_("v=bool, toggle(): audio mute"), UI_XINE_PARAM (XINE_PARAM_AUDIO_MUTE, set_mute) },
{ "vo_auto_resize", N_("v=bool, toggle(): auto-resize video on frame shape change"), UI_GTK_VIDEO (auto_resize, gtk_video_get_auto_resize) },
{ "vo_auto_rescale", N_("v=bool, toggle(): double size of low-resolution video"), UI_GTK_VIDEO (auto_rescale, gtk_video_get_auto_rescale) },
{ "vo_fullscreen", N_("v=bool, toggle(): full-screen mode"), UI_GTK_VIDEO (fullscreen, gtk_video_is_fullscreen) },
{ "vo_deinterlace", N_("v=bool, toggle(): enable deinterlacing"), UI_GTK_VIDEO (deinterlace, gtk_video_get_use_post_plugins_deinterlace) },
{ "ao_postproc", N_("v=bool, toggle(): audio post-processing; chain=string: plugin chain"), UI_GTK_VIDEO (ao_postproc, gtk_video_get_use_post_plugins_audio) },
{ "vo_postproc", N_("v=bool, toggle(): video post-processing; chain=string: plugin chain"), UI_GTK_VIDEO (vo_postproc, gtk_video_get_use_post_plugins_video) },
{ "wm_unblank", N_("v=bool, toggle(): unblanking in windowed mode"), UI_GTK_VIDEO (wm_unblank, gtk_video_get_windowed_unblank) },
{ NULL }
};
static const ui_property_t zoom_subprops[] = {
{ "x", N_("v=int, min, max; video zoom (within window)"), UI_XINE_PARAM (XINE_PARAM_VO_ZOOM_X, NULL), XINE_VO_ZOOM_MIN, XINE_VO_ZOOM_MAX },
{ "y", N_("v=int, min, max; video zoom (within window)"), UI_XINE_PARAM (XINE_PARAM_VO_ZOOM_Y, NULL), XINE_VO_ZOOM_MIN, XINE_VO_ZOOM_MAX },
{ NULL }
};
static const ui_property_t fs_subprops[] = {
{ "sticky", NULL, UI_BOOL (fs_sticky, fs_always_sticky, NULL) },
/* ��� deprecated; it's really just gui.fullscreen_mode.always_sticky */
{ "is_sticky", N_("v=bool, toggle(); forced stickiness in full-screen mode"), UI_BOOL (fs_sticky, fs_is_sticky, window_fs_stickiness_update) },
{ NULL }
};
ui_create_properties (int_props, NULL, SE_TYPE_INT);
ui_create_properties (bool_props, NULL, SE_TYPE_BOOL);
ui_create_properties (zoom_subprops, se_find_object (gse, NULL, "vo_zoom"),
SE_TYPE_INT);
ui_create_properties (fs_subprops, se_find_object (gse, NULL, "vo_fullscreen"),
SE_TYPE_BOOL);
}
/* a few extras - chain definition should be done via the GUI */
add_chain_funcs ("ao_postproc", "gui.post_plugins.audio", set_ao_postproc_chain);
add_chain_funcs ("vo_postproc", "gui.post_plugins.video", set_vo_postproc_chain);
add_chain_funcs ("vo_deinterlace", "gui.post_plugins.deinterlace", set_deint_postproc_chain);
/*
* hook up global xine functions for convenience
*/
{
static const se_f_def_t defs[] = {
{ "play", controls_play, 0, 0,
/* help text describes function parameters */
SE_GROUP_ENGINE, N_("[mrl] [, pos, time]"),
N_("time in milliseconds") },
{ "get_time", get_time, 0, 0,
SE_GROUP_ENGINE, NULL, N_("stream time index") },
{ "get_pos", get_pos, 0, 0,
SE_GROUP_ENGINE, NULL, N_("stream position (%)") },
{ "has_time", has_time, 0, 0,
SE_GROUP_ENGINE, NULL, N_("whether the stream has a time index") },
{ "pause", controls_pause, 0, 0,
SE_GROUP_ENGINE, N_("[bool]"), NULL },
{ "stop", controls_stop, 0, 0,
SE_GROUP_ENGINE, NULL, NULL },
{ "eject", controls_eject, 0, 0,
SE_GROUP_ENGINE, NULL, NULL },
{ "play_pause", controls_play_pause, 0, 0,
SE_GROUP_ENGINE, N_("[bool]"), NULL },
{ "snapshot", js_snapshot, 0, 0,
/* these correspond to the options in the snapshot-save dialogue box */
SE_GROUP_ENGINE, N_("[file name [, scale, blend]]"), NULL },
{ "set_video_size", js_set_video_size, 0, 0,
SE_GROUP_PROPERTIES, N_("int"), NULL },
#ifdef WITH_DEPRECATED
#ifdef WITH_OBSOLETE
{ "set_speed", js_set_speed, 0, 0,
SE_GROUP_HIDDEN, NULL, NULL },
{ "get_speed", js_get_speed, 0, 0,
SE_GROUP_HIDDEN, NULL, NULL },
{ "set_volume", js_set_volume, 0, 0,
SE_GROUP_HIDDEN, NULL, NULL },
{ "get_volume", js_get_volume, 0, 0,
SE_GROUP_HIDDEN, NULL, NULL },
{ "set_mute", js_set_mute, 0, 0,
SE_GROUP_HIDDEN, NULL, NULL },
{ "get_mute", js_get_mute, 0, 0,
SE_GROUP_HIDDEN, NULL, NULL },
{ "set_zoom", js_set_zoom, 0, 0,
SE_GROUP_HIDDEN, NULL, NULL },
{ "get_zoom", js_get_zoom, 0, 0,
SE_GROUP_HIDDEN, NULL, NULL },
#endif /* WITH_OBSOLETE */
{ "set_fullscreen", js_set_fullscreen, 0, 0,
SE_GROUP_HIDDEN, NULL, NULL },
#ifdef WITH_OBSOLETE
{ "set_aspect", js_set_aspect, 0, 0,
SE_GROUP_HIDDEN, NULL, NULL },
{ "set_deinterlace", js_set_deinterlace, 0, 0,
SE_GROUP_HIDDEN, NULL, NULL },
{ "set_postproc_video", js_set_postproc_video, 0, 0,
SE_GROUP_HIDDEN, NULL, NULL },
{ "set_postproc_audio", js_set_postproc_audio, 0, 0,
SE_GROUP_HIDDEN, NULL, NULL },
{ "set_auto_resize", js_set_auto_resize, 0, 0,
SE_GROUP_HIDDEN, NULL, NULL },
{ "set_auto_rescale", js_set_auto_rescale, 0, 0,
SE_GROUP_HIDDEN, NULL, NULL },
#endif /* WITH_OBSOLETE */
#endif /* WITH_DEPRECATED */
{ "is_live_stream", js_is_live_stream, 0, 0,
SE_GROUP_PROPERTIES, NULL, NULL },
{ NULL }
};
se_defuns (gse, NULL, defs);
}
{
static char *window_size_labels[] = {
N_("50%"), N_("75%"), N_("100%"), N_("150%"), N_("200%"),
NULL
};
xine_config_register_enum
(xine, "gui.window_size", 0, window_size_labels,
_("The main window's default size"),
NULL, 0, NULL, NULL);
xine_config_register_bool
(xine, "gui.windowed_mode.magnify_lowres_video", CONFIG_VERSION_ATLEAST (0, 6, 0),
_("Double the size of small video streams"),
_("This affects video streams whose dimensions are at most ��� "
"of those of the display."),
0, GXINE_TRUE, NULL);
config_update_default ("gui.windowed_mode.magnify_lowres_video", 1);
xine_config_register_bool
(xine, "gui.windowed_mode.auto_resize", 1,
_("Automatic video window resizing"),
_("Whether the window is automatically resized on a stream format change."),
0, NULL, NULL);
xine_config_register_bool
(xine, "gui.subtitle_autoload", 1,
_("Subtitle autoloading"),
_("Automatically load subtitles if they exist."),
0, GXINE_TRUE, NULL);
}
}