forked from Tribler/tribler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vlc-1.0.5-swarmplugin-switch-kcc-src-aug2010-renum110-r16968.patch
7177 lines (7060 loc) · 233 KB
/
vlc-1.0.5-swarmplugin-switch-kcc-src-aug2010-renum110-r16968.patch
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
diff -rbNU 3 vlc-1.0.5/bindings/python/arno-compile-mingw32.sh d10-02-02-tstreamplaylist-p10/bindings/python/arno-compile-mingw32.sh
--- vlc-1.0.5/bindings/python/arno-compile-mingw32.sh 1970-01-01 01:00:00.000000000 +0100
+++ d10-02-02-tstreamplaylist-p10/bindings/python/arno-compile-mingw32.sh 2009-08-26 16:02:21.000000000 +0200
@@ -0,0 +1,20 @@
+#
+# VLC docs (http://wiki.videolan.org/Python_bindings) say that
+# python setup.py build --compiler=mingw32
+#
+# will compile the bindings. This currently doesn't work for me.
+# Instead:
+# 1. Obtain Python 2.5.4 source, extract in one dir above vlc source
+# dir.
+# 2. Remove test for cross-compilation from test %zd printf() format
+# support from Python's configure script.
+# 3. Configure Python for cross-compile:
+# $ ./configure --host=mingw32 --with-gcc=i586-mingw32msvc-gcc --with-cxx=i586-mingw32msvc-g++ --enable-shared --with-threads
+# 4. Obtain python25.dll for Python 2.5.4 from \windows\system32 after
+# Python 2.5.4 binary installer was run on a Windows box, put in
+# one dir above vlc source dir.
+# 5. Run below commands:
+#
+
+i586-mingw32msvc-gcc -mthreads -fno-strict-aliasing -g -O3 -Wall -Wstrict-prototypes -I../.. -I./../../include -I/usr/win32/include -I../../../Python-2.5.4 -I../../../Python-2.5.4/Include -c ./vlc_module.c -o ../../bindings/python/./vlc_module.o -D_FILE_OFFSET_BITS=64 -D__USE_UNIX98 -D_LARGEFILE64_SOURCE -D_REENTRANT -D_THREAD_SAFE -D_GNU_SOURCE -O3 -ffast-math -funroll-loops -mtune=pentium2 -g
+i586-mingw32msvc-g++ -Wsign-compare -Wall -mms-bitfields -pipe -shared ../../bindings/python/./vlc_module.o ../../src/.libs/libvlc.dll.a ../../../python25.dll -o ../../bindings/python/vlc.pyd -g -lkernel32 -L/usr/win32/lib -liconv /usr/win32/lib/libintl.a /usr/win32/lib/libiconv.a -lws2_32 -lnetapi32 -lwinmm -mwindows
diff -rbNU 3 vlc-1.0.5/bindings/python/debian/control d10-02-02-tstreamplaylist-p10/bindings/python/debian/control
--- vlc-1.0.5/bindings/python/debian/control 1970-01-01 01:00:00.000000000 +0100
+++ d10-02-02-tstreamplaylist-p10/bindings/python/debian/control 2009-08-25 14:23:17.000000000 +0200
@@ -0,0 +1,15 @@
+Source: python-vlc
+Section: contrib/libs
+Priority: optional
+Maintainer: Jason Scheunemann <[email protected]>
+Build-Depends: cdbs, debhelper (>= 7), python-central (>=0.5.6), python-setuptools, python-dev, libvlc-dev (>= 1.0.0)
+XS-Python-Version: 2.5
+Standards-Version: 3.8.0
+Homepage: http://wiki.videolan.org/PythonBinding
+
+Package: python-vlc
+Architecture: any
+XB-Python-Version: ${python:Versions}
+Depends: ${python:Depends}, ${misc:Depends}, vlc (>= 1.0.0)
+Description: VLC bindings for python.
+ VLC bindings for python.
diff -rbNU 3 vlc-1.0.5/bindings/python/debian/rules d10-02-02-tstreamplaylist-p10/bindings/python/debian/rules
--- vlc-1.0.5/bindings/python/debian/rules 1970-01-01 01:00:00.000000000 +0100
+++ d10-02-02-tstreamplaylist-p10/bindings/python/debian/rules 2009-08-25 14:23:17.000000000 +0200
@@ -0,0 +1,8 @@
+#!/usr/bin/make -f
+
+DEB_PYTHON_SYSTEM=pycentral
+
+include /usr/share/cdbs/1/rules/debhelper.mk
+include /usr/share/cdbs/1/class/python-distutils.mk
+
+# Add here any variable or target overrides you need.
diff -rbNU 3 vlc-1.0.5/bindings/python/GIT-VERSION d10-02-02-tstreamplaylist-p10/bindings/python/GIT-VERSION
--- vlc-1.0.5/bindings/python/GIT-VERSION 1970-01-01 01:00:00.000000000 +0100
+++ d10-02-02-tstreamplaylist-p10/bindings/python/GIT-VERSION 2009-08-25 14:23:17.000000000 +0200
@@ -0,0 +1,3 @@
+commit 2eeddcf4ae267ad5b2bbac5d518a69c51104cf68
+Author: Rémi Duraffort <[email protected]>
+Date: Tue Aug 25 12:28:49 2009 +0200
diff -rbNU 3 vlc-1.0.5/bindings/python/MANIFEST.in d10-02-02-tstreamplaylist-p10/bindings/python/MANIFEST.in
--- vlc-1.0.5/bindings/python/MANIFEST.in 1970-01-01 01:00:00.000000000 +0100
+++ d10-02-02-tstreamplaylist-p10/bindings/python/MANIFEST.in 2009-08-25 14:23:17.000000000 +0200
@@ -0,0 +1,7 @@
+include vlcglue.h
+include vlc_mediacontrol.c
+include vlc_position.c
+include vlc_instance.c
+include vlc_mediaplayer.c
+include vlc_media.c
+include vlcwidget.py
diff -rbNU 3 vlc-1.0.5/bindings/python/python-vlc.spec d10-02-02-tstreamplaylist-p10/bindings/python/python-vlc.spec
--- vlc-1.0.5/bindings/python/python-vlc.spec 1970-01-01 01:00:00.000000000 +0100
+++ d10-02-02-tstreamplaylist-p10/bindings/python/python-vlc.spec 2009-08-25 14:23:17.000000000 +0200
@@ -0,0 +1,71 @@
+%define name python-vlc
+%define version 1.0.0.90
+%define unmangled_version 1.0.0.90
+%define release 1
+%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
+
+Summary: VLC bindings for python.
+Name: %{name}
+Version: %{version}
+Release: %{release}
+Source0: %{name}-%{unmangled_version}.tar.gz
+License: GPL
+Group: Development/Libraries
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
+Prefix: %{_prefix}
+Vendor: Olivier Aubert <[email protected]>
+Url: http://wiki.videolan.org/PythonBinding
+
+%description
+VLC bindings for python.
+
+This module provides bindings for the native libvlc API of the VLC
+video player. Documentation can be found on the VLC wiki :
+http://wiki.videolan.org/ExternalAPI
+
+This module also provides a MediaControl object, which implements an
+API inspired from the OMG Audio/Video Stream 1.0 specification.
+Documentation can be found on the VLC wiki :
+http://wiki.videolan.org/PythonBinding
+
+Example session (for the MediaControl API):
+
+import vlc
+mc=vlc.MediaControl(['--verbose', '1'])
+mc.playlist_add_item('movie.mpg')
+
+# Start the movie at 2000ms
+p=vlc.Position()
+p.origin=vlc.RelativePosition
+p.key=vlc.MediaTime
+p.value=2000
+mc.start(p)
+# which could be abbreviated as
+# mc.start(2000)
+# for the default conversion from int is to make a RelativePosition in MediaTime
+
+# Display some text during 2000ms
+mc.display_text('Some useless information', 0, 2000)
+
+# Pause the video
+mc.pause(0)
+
+# Get status information
+mc.get_stream_information()
+
+
+%prep
+%setup -n %{name}-%{unmangled_version}
+
+%build
+env CFLAGS="$RPM_OPT_FLAGS" python setup.py build
+
+%install
+python setup.py install --root=$RPM_BUILD_ROOT --record=INSTALLED_FILES
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files -f INSTALLED_FILES
+%defattr(-,root,root)
+%{python_sitelib}/vlcwidget.pyo
diff -rbNU 3 vlc-1.0.5/bindings/python/README d10-02-02-tstreamplaylist-p10/bindings/python/README
--- vlc-1.0.5/bindings/python/README 1970-01-01 01:00:00.000000000 +0100
+++ d10-02-02-tstreamplaylist-p10/bindings/python/README 2009-08-25 14:23:17.000000000 +0200
@@ -0,0 +1,21 @@
+* Testing
+
+If you try to compile the bindings from a development tree, you will
+have to specify the path for VLC modules, which cannot be guessed by
+the extension module (and are hardcoded for a standard installation,
+i.e. /usr/lib/vlc on *NIX)
+
+For vlc.MediaControl:
+mc=vlc.MediaControl('--plugin-path /path/to/vlc/directory'.split())
+
+For vlc.Instance:
+i=vlc.Instance('--plugin-path /path/to/vlc/directory'.split())
+
+* Skeleton generation (for developers of the module):
+
+** For method bindings:
+
+perl -n -e 'print "static PyObject *\nvlcInput_$2( PyObject *self, PyObject *args )\n{\n libvlc_exception_t ex;\n LIBVLC_TRY;\n $1_$2( self->p_input, &ex); LIBVLC_EXCEPT;\n Py_INCREF( Py_None );\n return Py_None;\n}\n\n" if /(libvlc_input)_(\w+)/ and ($2 ne "t")' ../../include/vlc/libvlc.h
+
+** For method table:
+perl -n -e 'print " { \"$2\", $1_$2, METH_VARARGS,\n \"$2()\" },\n" if /^(vlcInstance)_(\w+)/' vlc_instance.c
diff -rbNU 3 vlc-1.0.5/bindings/python/setup.py d10-02-02-tstreamplaylist-p10/bindings/python/setup.py
--- vlc-1.0.5/bindings/python/setup.py 1970-01-01 01:00:00.000000000 +0100
+++ d10-02-02-tstreamplaylist-p10/bindings/python/setup.py 2009-08-26 10:29:01.000000000 +0200
@@ -0,0 +1,134 @@
+from distutils.core import setup, Extension
+import os
+import commands
+
+# Get build variables (buildir, srcdir)
+top_builddir = os.path.join( '..', '..' )
+os.environ['top_builddir'] = top_builddir
+
+# Determine the extra link args. Normally, vlc-config should take care
+# of this and return the right path values, from a development tree or
+# an installed version.
+libtool=False
+linkargs=[]
+d=os.path.join(top_builddir, 'src', '.libs')
+if os.path.exists(d):
+ # We are in a development tree, which was compiled with libtool
+ libtool=True
+ linkargs=[ '-L' + d ]
+else:
+ d=os.path.join(top_builddir, 'src')
+ # We are in a development tree, which was compiled without libtool
+ if os.path.exists(d):
+ linkargs=[ '-L' + d ]
+
+# For out-of-tree compilations
+srcdir = '.'
+
+def get_vlcconfig():
+ vlcconfig=None
+ for n in ( 'vlc-config',
+ os.path.join( top_builddir, 'vlc-config' )):
+ if os.path.exists(n):
+ vlcconfig=n
+ break
+ status, output = commands.getstatusoutput('pkg-config libvlc --exists')
+ if status == 0:
+ vlcconfig="pkg-config libvlc"
+ if vlcconfig is None:
+ print "*** Warning *** Cannot find vlc-config. Will try sane defaults."
+ elif os.sys.platform == 'win32':
+ # Win32 does not know how to invoke the shell itself.
+ vlcconfig="sh %s" % vlcconfig
+ return vlcconfig
+
+def get_vlc_version():
+ vlcconfig=get_vlcconfig()
+ if vlcconfig is None:
+ return ""
+ else:
+ version=os.popen('%s --modversion' % vlcconfig, 'r').readline().strip()
+ return version
+
+def get_cflags():
+ vlcconfig=get_vlcconfig()
+ if vlcconfig is None:
+ return []
+ else:
+ cflags=os.popen('%s --cflags ' % vlcconfig, 'r').readline().strip()
+ return cflags
+
+def get_ldflags():
+ vlcconfig=get_vlcconfig()
+ if vlcconfig is None:
+ return [ '-lvlc' ]
+ else:
+ ldflags = []
+ if os.sys.platform == 'darwin':
+ ldflags = "-read_only_relocs warning".split()
+ ldflags.extend(os.popen('%s --libs ' % vlcconfig,
+ 'r').readline().rstrip().split())
+ if os.sys.platform == 'darwin':
+ ldflags.append('-lstdc++')
+ return ldflags
+
+#source_files = [ 'vlc_module.c', 'vlc_mediacontrol.c',
+# 'vlc_position.c', 'vlc_instance.c', 'vlc_input.c' ]
+source_files = [ 'vlc_module.c' ]
+
+# To compile in a local vlc tree
+vlclocal = Extension('vlc',
+ sources = [ os.path.join( srcdir, f ) for f in source_files ],
+ include_dirs = [ top_builddir, os.path.join(top_builddir,"include"),
+ srcdir ],
+ extra_objects = [ ],
+ extra_compile_args = get_cflags(),
+ extra_link_args = linkargs + get_ldflags(),
+ )
+
+setup (name = 'python-vlc',
+ version = '1.0.0.90',
+ author='Olivier Aubert',
+ author_email='[email protected]',
+ url='http://wiki.videolan.org/PythonBinding',
+ py_modules=['vlcwidget'],
+ keywords = [ 'vlc', 'video' ],
+ license = "GPL",
+ description = "VLC bindings for python.",
+ long_description = """VLC bindings for python.
+
+This module provides bindings for the native libvlc API of the VLC
+video player. Documentation can be found on the VLC wiki :
+http://wiki.videolan.org/ExternalAPI
+
+This module also provides a MediaControl object, which implements an
+API inspired from the OMG Audio/Video Stream 1.0 specification.
+Documentation can be found on the VLC wiki :
+http://wiki.videolan.org/PythonBinding
+
+Example session (for the MediaControl API):
+
+import vlc
+mc=vlc.MediaControl(['--verbose', '1'])
+mc.playlist_add_item('movie.mpg')
+
+# Start the movie at 2000ms
+p=vlc.Position()
+p.origin=vlc.RelativePosition
+p.key=vlc.MediaTime
+p.value=2000
+mc.start(p)
+# which could be abbreviated as
+# mc.start(2000)
+# for the default conversion from int is to make a RelativePosition in MediaTime
+
+# Display some text during 2000ms
+mc.display_text('Some useless information', 0, 2000)
+
+# Pause the video
+mc.pause(0)
+
+# Get status information
+mc.get_stream_information()
+ """,
+ ext_modules = [ vlclocal ])
diff -rbNU 3 vlc-1.0.5/bindings/python/vlcglue.h d10-02-02-tstreamplaylist-p10/bindings/python/vlcglue.h
--- vlc-1.0.5/bindings/python/vlcglue.h 1970-01-01 01:00:00.000000000 +0100
+++ d10-02-02-tstreamplaylist-p10/bindings/python/vlcglue.h 2009-08-25 14:23:17.000000000 +0200
@@ -0,0 +1,162 @@
+/*****************************************************************************
+ * vlcglue.h: Main header for the Python binding
+ *****************************************************************************
+ * Copyright (C) 1998-2004 the VideoLAN team
+ * $Id$
+ *
+ * Authors: Olivier Aubert <olivier.aubert at liris.cnrs.fr>
+ * Clément Stenac <[email protected]>
+ *
+ * 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 Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+#ifndef _VLCGLUE_H
+#define _VLCGLUE_H 1
+
+#include <Python.h>
+#include "structmember.h"
+
+#include <stdio.h>
+#include <vlc/vlc.h>
+#include <vlc/libvlc.h>
+#include <vlc/mediacontrol_structures.h>
+#include <vlc/mediacontrol.h>
+
+/* Python 2.5 64-bit support compatibility define */
+#if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN)
+typedef int Py_ssize_t;
+#define PY_SSIZE_T_MAX INT_MAX
+#define PY_SSIZE_T_MIN INT_MIN
+#endif
+
+
+/**********************************************************************
+ * Exceptions handling
+ **********************************************************************/
+
+#define MC_TRY exception=mediacontrol_exception_create( )
+
+#define MC_EXCEPT \
+ if( exception && exception->code ) { \
+ PyObject *py_exc = MediaControl_InternalException; \
+ switch( exception->code ) { \
+ case mediacontrol_InternalException: \
+ py_exc = MediaControl_InternalException; \
+ break; \
+ case mediacontrol_PlaylistException: \
+ py_exc = MediaControl_PlaylistException; \
+ break; \
+ case mediacontrol_InvalidPosition: \
+ py_exc = MediaControl_InvalidPosition; \
+ break; \
+ case mediacontrol_PositionKeyNotSupported: \
+ py_exc = MediaControl_PositionKeyNotSupported; \
+ break; \
+ case mediacontrol_PositionOriginNotSupported: \
+ py_exc = MediaControl_PositionOriginNotSupported; \
+ break; \
+ } \
+ PyErr_SetString( py_exc, exception->message ); \
+ mediacontrol_exception_free( exception ); \
+ return NULL; \
+ } else if( exception ) { mediacontrol_exception_free( exception ); }
+
+PyObject *MediaControl_InternalException;
+PyObject *MediaControl_PositionKeyNotSupported;
+PyObject *MediaControl_PositionOriginNotSupported;
+PyObject *MediaControl_InvalidPosition;
+PyObject *MediaControl_PlaylistException;
+PyObject *vlc_Exception;
+
+/**********************************************************************
+ * vlc.Instance Object
+ **********************************************************************/
+typedef struct
+{
+ PyObject_HEAD
+ libvlc_instance_t* p_instance;
+} vlcInstance;
+
+/**********************************************************************
+ * MediaControl Object
+ **********************************************************************/
+typedef struct
+{
+ PyObject_HEAD
+ mediacontrol_Instance* mc;
+ vlcInstance *vlc_instance;
+} MediaControl;
+
+/**********************************************************************
+ * Position Object
+ **********************************************************************/
+typedef struct
+{
+ PyObject_HEAD
+ int origin;
+ int key;
+ PY_LONG_LONG value;
+} PyPosition;
+
+/**********************************************************************
+ * vlc.MediaPlayer Object
+ **********************************************************************/
+typedef struct
+{
+ PyObject_HEAD
+ libvlc_media_player_t* p_mp;
+} vlcMediaPlayer;
+
+/**********************************************************************
+ * vlc.Media Object
+ **********************************************************************/
+typedef struct
+{
+ PyObject_HEAD
+ libvlc_media_t* p_media;
+} vlcMedia;
+
+/* Forward declarations */
+staticforward PyTypeObject MediaControl_Type;
+staticforward PyTypeObject PyPosition_Type;
+staticforward PyTypeObject vlcInstance_Type;
+staticforward PyTypeObject vlcMediaPlayer_Type;
+staticforward PyTypeObject vlcMedia_Type;
+
+#define LIBVLC_INSTANCE(self) (((vlcInstance*)self)->p_instance)
+#define LIBVLC_MEDIAPLAYER(self) (((vlcMediaPlayer*)self)->p_mp)
+#define LIBVLC_MEDIA(self) (((vlcMedia*)self)->p_media)
+#define LIBVLC_MC(self) (((MediaControl*)self)->mc)
+
+#define LIBVLC_TRY libvlc_exception_init( &ex );
+
+#define LIBVLC_EXCEPT if( libvlc_exception_raised( &ex ) ) { \
+ PyObject *py_exc = vlc_Exception; \
+ PyErr_SetString( py_exc, libvlc_exception_get_message( &ex ) ); \
+ return NULL; \
+ }
+
+mediacontrol_PositionKey positionKey_py_to_c( PyObject * py_key );
+mediacontrol_PositionOrigin positionOrigin_py_to_c( PyObject * py_origin );
+mediacontrol_Position * position_py_to_c( PyObject * py_position );
+PyPosition * position_c_to_py( mediacontrol_Position * position );
+
+/* Long long conversion on Mac os X/ppc */
+#if defined (__ppc__) || defined(__ppc64__)
+#define ntohll(x) ((long long) x >> 64)
+#else
+#define ntohll(x) (x)
+#endif
+
+#endif
diff -rbNU 3 vlc-1.0.5/bindings/python/vlc_instance.c d10-02-02-tstreamplaylist-p10/bindings/python/vlc_instance.c
--- vlc-1.0.5/bindings/python/vlc_instance.c 1970-01-01 01:00:00.000000000 +0100
+++ d10-02-02-tstreamplaylist-p10/bindings/python/vlc_instance.c 2009-08-25 14:23:17.000000000 +0200
@@ -0,0 +1,611 @@
+/*****************************************************************************
+ * vlc_instance.c: vlc.Instance binding
+ *****************************************************************************
+ * Copyright (C) 2006,2007,2008,2009 the VideoLAN team
+ * $Id$
+ *
+ * Authors: Olivier Aubert <olivier.aubert at liris.cnrs.fr>
+ *
+ * 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 Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+#include "vlcglue.h"
+
+/* Helper functions */
+static Py_ssize_t
+pyoptions_to_args(PyObject *py_options, char*** pppsz_args)
+{
+ Py_ssize_t i_size;
+ Py_ssize_t i_index;
+
+ Py_INCREF( py_options );
+ if( ! PySequence_Check( py_options ) )
+ {
+ PyErr_SetString( PyExc_TypeError, "Parameter must be a sequence." );
+ return -1;
+ }
+ i_size = PySequence_Size( py_options );
+
+ char **ppsz_args = *pppsz_args = malloc( ( i_size + 1 ) * sizeof( char * ) );
+
+ if( ! ppsz_args )
+ {
+ PyErr_SetString( PyExc_MemoryError, "Out of memory" );
+ return -1;
+ }
+
+ for ( i_index = 0; i_index < i_size; i_index++ )
+ {
+ ppsz_args[i_index] =
+ strdup( PyString_AsString( PyObject_Str(
+ PySequence_GetItem( py_options,
+ i_index ) ) ) );
+ }
+ ppsz_args[i_size] = NULL;
+ Py_DECREF( py_options );
+ return i_size;
+}
+
+static void
+free_args(int i_size, char** ppsz_args)
+{
+ int i_index;
+
+ for ( i_index = 0; i_index < i_size; i_index++ )
+ free( ppsz_args[i_index] );
+ free( ppsz_args );
+}
+
+/*****************************************************************************
+ * Instance object implementation
+ *****************************************************************************/
+
+static PyObject *
+vlcInstance_new( PyTypeObject *type, PyObject *args, PyObject *kwds )
+{
+ vlcInstance *self;
+ libvlc_exception_t ex;
+ PyObject* py_list = NULL;
+ char** ppsz_args = NULL;
+ int i_size = 0;
+
+ fprintf(stderr, "Instantiating\n");
+ if( PyArg_ParseTuple( args, "|O", &py_list ) )
+ {
+ i_size = pyoptions_to_args( py_list, &ppsz_args );
+ if( i_size < 0 )
+ return NULL;
+ }
+ else
+ {
+ /* No arguments were given. Clear the exception raised
+ by PyArg_ParseTuple. */
+ PyErr_Clear( );
+ }
+
+ self = PyObject_New( vlcInstance, &vlcInstance_Type );
+
+ Py_BEGIN_ALLOW_THREADS
+ LIBVLC_TRY
+ LIBVLC_INSTANCE(self) = libvlc_new( i_size, ppsz_args, &ex );
+ free_args( i_size, ppsz_args );
+ LIBVLC_EXCEPT
+ Py_END_ALLOW_THREADS
+
+ Py_INCREF( self );
+ return ( PyObject * )self;
+}
+
+static void
+vlcInstance_dealloc( PyObject *self )
+{
+ libvlc_release( LIBVLC_INSTANCE(self) );
+ PyObject_DEL( self );
+}
+
+static PyObject *
+vlcInstance_get_vlc_id( PyObject *self, PyObject *args )
+{
+ return Py_BuildValue( "i", libvlc_get_vlc_id( LIBVLC_INSTANCE(self) ) );
+}
+
+static PyObject *
+vlcInstance_new_media_player( PyObject *self, PyObject *args )
+{
+ libvlc_exception_t ex;
+ libvlc_media_player_t *p_mp;
+ vlcMediaPlayer *p_ret;
+
+ LIBVLC_TRY;
+ p_mp = libvlc_media_player_new( LIBVLC_INSTANCE(self), &ex );
+ LIBVLC_EXCEPT;
+
+ p_ret = PyObject_New( vlcMediaPlayer, &vlcMediaPlayer_Type );
+ p_ret->p_mp = p_mp;
+ Py_INCREF( p_ret ); /* Ah bon ? */
+ return ( PyObject * )p_ret;
+}
+
+static PyObject *
+vlcInstance_audio_toggle_mute( PyObject *self, PyObject *args )
+{
+ libvlc_exception_t ex;
+ LIBVLC_TRY;
+ libvlc_audio_toggle_mute( LIBVLC_INSTANCE(self), &ex );
+ LIBVLC_EXCEPT;
+ Py_INCREF( Py_None );
+ return Py_None;
+}
+
+static PyObject *
+vlcInstance_audio_get_mute( PyObject *self, PyObject *args )
+{
+ libvlc_exception_t ex;
+ int i_ret;
+
+ LIBVLC_TRY;
+ i_ret = libvlc_audio_get_mute( LIBVLC_INSTANCE(self), &ex );
+ LIBVLC_EXCEPT;
+ return Py_BuildValue( "i", i_ret );
+}
+
+static PyObject *
+vlcInstance_audio_set_mute( PyObject *self, PyObject *args )
+{
+ libvlc_exception_t ex;
+ int i_mute;
+
+ if( !PyArg_ParseTuple( args, "i", &i_mute ) )
+ return NULL;
+
+ LIBVLC_TRY;
+ libvlc_audio_set_mute( LIBVLC_INSTANCE(self), i_mute, &ex );
+ LIBVLC_EXCEPT;
+ Py_INCREF( Py_None );
+ return Py_None;
+}
+
+static PyObject *
+vlcInstance_audio_get_volume( PyObject *self, PyObject *args )
+{
+ libvlc_exception_t ex;
+ int i_ret;
+
+ LIBVLC_TRY;
+ i_ret = libvlc_audio_get_volume( LIBVLC_INSTANCE(self), &ex );
+ LIBVLC_EXCEPT;
+ return Py_BuildValue( "i", i_ret );
+}
+
+static PyObject *
+vlcInstance_audio_set_volume( PyObject *self, PyObject *args )
+{
+ libvlc_exception_t ex;
+ int i_volume;
+
+ if( !PyArg_ParseTuple( args, "i", &i_volume ) )
+ return NULL;
+
+ LIBVLC_TRY;
+ libvlc_audio_set_volume( LIBVLC_INSTANCE(self), i_volume, &ex );
+ LIBVLC_EXCEPT;
+ Py_INCREF( Py_None );
+ return Py_None;
+}
+
+static PyObject *
+vlcInstance_audio_get_channel( PyObject *self, PyObject *args )
+{
+ libvlc_exception_t ex;
+ int i_ret;
+
+ LIBVLC_TRY;
+ i_ret = libvlc_audio_get_channel( LIBVLC_INSTANCE(self), &ex );
+ LIBVLC_EXCEPT;
+ return Py_BuildValue( "i", i_ret );
+}
+
+static PyObject *
+vlcInstance_audio_set_channel( PyObject *self, PyObject *args )
+{
+ libvlc_exception_t ex;
+ int i_channel;
+
+ if( !PyArg_ParseTuple( args, "i", &i_channel ) )
+ return NULL;
+
+ LIBVLC_TRY;
+ libvlc_audio_set_channel( LIBVLC_INSTANCE(self), i_channel, &ex );
+ LIBVLC_EXCEPT;
+ Py_INCREF( Py_None );
+ return Py_None;
+}
+
+/* vlm_add_broadcast : name, input MRL, output MRL
+ Keywords: options, enable, loop */
+static PyObject *
+vlcInstance_vlm_add_broadcast( PyObject *self, PyObject *args, PyObject *kwds )
+{
+ libvlc_exception_t ex;
+ static char *kwlist[] = { "name", "input", "output",
+ "options", "enable", "loop", NULL};
+ char* psz_name = NULL;
+ char* psz_input = NULL;
+ char* psz_output = NULL;
+ PyObject* py_options = NULL;
+ int i_enable = 1;
+ int i_loop = 0;
+ int i_size = 0;
+ char** ppsz_args = NULL;
+
+ if( !PyArg_ParseTupleAndKeywords( args, kwds, "sss|Oii", kwlist,
+ &psz_name,
+ &psz_input, &psz_output,
+ &py_options, &i_enable, &i_loop ) )
+ return NULL;
+
+ if( py_options )
+ {
+ i_size = pyoptions_to_args( py_options, &ppsz_args );
+ }
+
+ LIBVLC_TRY;
+ libvlc_vlm_add_broadcast( LIBVLC_INSTANCE(self),
+ psz_name, psz_input, psz_output,
+ i_size, ppsz_args, i_enable, i_loop, &ex);
+ free_args( i_size, ppsz_args );
+ LIBVLC_EXCEPT;
+ Py_INCREF( Py_None );
+ return Py_None;
+}
+
+static PyObject *
+vlcInstance_vlm_del_media( PyObject *self, PyObject *args )
+{
+ libvlc_exception_t ex;
+ char* psz_name;
+
+ if( !PyArg_ParseTuple( args, "s", &psz_name ) )
+ return NULL;
+
+ LIBVLC_TRY;
+ libvlc_vlm_del_media( LIBVLC_INSTANCE(self), psz_name, &ex);
+ LIBVLC_EXCEPT;
+ Py_INCREF( Py_None );
+ return Py_None;
+}
+
+static PyObject *
+vlcInstance_vlm_set_enabled( PyObject *self, PyObject *args )
+{
+ libvlc_exception_t ex;
+ char* psz_name;
+ int i_enabled;
+
+ if( !PyArg_ParseTuple( args, "si", &psz_name, &i_enabled ) )
+ return NULL;
+
+ LIBVLC_TRY;
+ libvlc_vlm_set_enabled( LIBVLC_INSTANCE(self), psz_name, i_enabled, &ex);
+ LIBVLC_EXCEPT;
+ Py_INCREF( Py_None );
+ return Py_None;
+}
+
+static PyObject *
+vlcInstance_vlm_set_output( PyObject *self, PyObject *args )
+{
+ libvlc_exception_t ex;
+ char* psz_name;
+ char* psz_output;
+
+ if( !PyArg_ParseTuple( args, "ss", &psz_name, &psz_output ) )
+ return NULL;
+
+ LIBVLC_TRY;
+ libvlc_vlm_set_output( LIBVLC_INSTANCE(self), psz_name, psz_output, &ex);
+ LIBVLC_EXCEPT;
+ Py_INCREF( Py_None );
+ return Py_None;
+}
+
+static PyObject *
+vlcInstance_vlm_set_input( PyObject *self, PyObject *args )
+{
+ libvlc_exception_t ex;
+ char* psz_name;
+ char* psz_input;
+
+ if( !PyArg_ParseTuple( args, "ss", &psz_name, &psz_input ) )
+ return NULL;
+
+ LIBVLC_TRY;
+ libvlc_vlm_set_input( LIBVLC_INSTANCE(self), psz_name, psz_input, &ex);
+ LIBVLC_EXCEPT;
+ Py_INCREF( Py_None );
+ return Py_None;
+}
+
+static PyObject *
+vlcInstance_vlm_add_input( PyObject *self, PyObject *args )
+{
+ libvlc_exception_t ex;
+ char* psz_name;
+ char* psz_input;
+
+ if( !PyArg_ParseTuple( args, "ss", &psz_name, &psz_input ) )
+ return NULL;
+
+ LIBVLC_TRY;
+ libvlc_vlm_add_input( LIBVLC_INSTANCE(self), psz_name, psz_input, &ex);
+ LIBVLC_EXCEPT;
+ Py_INCREF( Py_None );
+ return Py_None;
+}
+
+static PyObject *
+vlcInstance_vlm_set_loop( PyObject *self, PyObject *args )
+{
+ libvlc_exception_t ex;
+ char* psz_name;
+ int i_loop;
+
+ if( !PyArg_ParseTuple( args, "si", &psz_name, &i_loop ) )
+ return NULL;
+
+ LIBVLC_TRY;
+ libvlc_vlm_set_loop( LIBVLC_INSTANCE(self), psz_name, i_loop, &ex);
+ LIBVLC_EXCEPT;
+ Py_INCREF( Py_None );
+ return Py_None;
+}
+
+static PyObject *
+vlcInstance_vlm_change_media( PyObject *self, PyObject *args, PyObject *kwds )
+{
+ libvlc_exception_t ex;
+ static char *kwlist[] = { "name", "input", "output",
+ "options", "enable", "loop", NULL};
+ char* psz_name = NULL;
+ char* psz_input = NULL;
+ char* psz_output = NULL;
+ PyObject* py_options = NULL;
+ int i_enable = 1;
+ int i_loop = 0;
+ int i_size = 0;
+ char** ppsz_args = NULL;
+
+ if( !PyArg_ParseTupleAndKeywords( args, kwds, "sss|Oii", kwlist,
+ &psz_name,
+ &psz_input, &psz_output,
+ &py_options, &i_enable, &i_loop ) )
+ return NULL;
+
+ if( py_options )
+ {
+ i_size = pyoptions_to_args( py_options, &ppsz_args );
+ }
+
+ LIBVLC_TRY;
+ libvlc_vlm_change_media( LIBVLC_INSTANCE(self),
+ psz_name, psz_input, psz_output,
+ i_size, ppsz_args, i_enable, i_loop, &ex);
+ free_args( i_size, ppsz_args );
+ LIBVLC_EXCEPT;
+ Py_INCREF( Py_None );
+ return Py_None;
+}
+
+static PyObject *
+vlcInstance_vlm_play_media( PyObject *self, PyObject *args )
+{
+ libvlc_exception_t ex;
+ char* psz_name;
+
+ if( !PyArg_ParseTuple( args, "s", &psz_name ) )
+ return NULL;
+
+ LIBVLC_TRY;
+ libvlc_vlm_play_media( LIBVLC_INSTANCE(self), psz_name, &ex);
+ LIBVLC_EXCEPT;
+ Py_INCREF( Py_None );
+ return Py_None;
+}
+
+static PyObject *
+vlcInstance_vlm_stop_media( PyObject *self, PyObject *args )
+{
+ libvlc_exception_t ex;
+ char* psz_name;
+
+ if( !PyArg_ParseTuple( args, "s", &psz_name ) )
+ return NULL;
+
+ LIBVLC_TRY;
+ libvlc_vlm_stop_media( LIBVLC_INSTANCE(self), psz_name, &ex);
+ LIBVLC_EXCEPT;
+ Py_INCREF( Py_None );
+ return Py_None;
+}
+
+static PyObject *
+vlcInstance_vlm_pause_media( PyObject *self, PyObject *args )
+{
+ libvlc_exception_t ex;
+ char* psz_name;
+
+ if( !PyArg_ParseTuple( args, "s", &psz_name ) )
+ return NULL;
+
+ LIBVLC_TRY;
+ libvlc_vlm_pause_media( LIBVLC_INSTANCE(self), psz_name, &ex);
+ LIBVLC_EXCEPT;
+ Py_INCREF( Py_None );
+ return Py_None;
+}
+
+static PyObject *
+vlcInstance_vlm_seek_media( PyObject *self, PyObject *args )
+{
+ libvlc_exception_t ex;
+ char* psz_name;
+ float f_percentage;
+
+ if( !PyArg_ParseTuple( args, "sf", &psz_name, &f_percentage ) )
+ return NULL;
+
+ LIBVLC_TRY;
+ libvlc_vlm_seek_media( LIBVLC_INSTANCE(self), psz_name, f_percentage, &ex);
+ LIBVLC_EXCEPT;
+ Py_INCREF( Py_None );
+ return Py_None;
+}
+
+static PyObject *
+vlcInstance_vlm_show_media( PyObject *self, PyObject *args )
+{
+ libvlc_exception_t ex;
+ char* psz_name;
+ char* psz_ret;
+ PyObject* o_ret;
+
+ if( !PyArg_ParseTuple( args, "s", &psz_name ) )
+ return NULL;
+ LIBVLC_TRY;
+ psz_ret = libvlc_vlm_show_media( LIBVLC_INSTANCE(self), psz_name, &ex );
+ LIBVLC_EXCEPT;
+ o_ret = Py_BuildValue( "s", psz_ret );
+ free( psz_ret );
+ return o_ret;
+}
+
+static PyObject *
+vlcInstance_media_new( PyObject *self, PyObject *args )
+{
+ libvlc_exception_t ex;
+ libvlc_media_t *p_media;
+ char* psz_mrl = NULL;
+ vlcMedia *p_ret;
+
+ if( !PyArg_ParseTuple( args, "s", &psz_mrl ) )
+ return NULL;
+
+ LIBVLC_TRY;
+ p_media = libvlc_media_new( LIBVLC_INSTANCE(self), psz_mrl, &ex );
+ LIBVLC_EXCEPT;
+
+ p_ret = PyObject_New( vlcMedia, &vlcMedia_Type );
+ p_ret->p_media = p_media;
+ Py_INCREF( p_ret ); /* Ah bon ? */
+ return ( PyObject * )p_ret;
+}
+
+/* Method table */
+static PyMethodDef vlcInstance_methods[] =
+{
+ { "get_vlc_id", vlcInstance_get_vlc_id, METH_NOARGS,
+ "get_vlc_id( ) -> int Get the instance id."},
+ { "audio_toggle_mute", vlcInstance_audio_toggle_mute, METH_NOARGS,