Skip to content
Browse files

Merge remote-tracking branch 'opdenkamp/master'

Conflicts solved:
	xbmc/pvr/windows/GUIWindowPVR.cpp
  • Loading branch information...
2 parents e19496c + ac66c2c commit 2de1989d46c0a481c1627bee8ffb5681670432ca @margro committed Nov 5, 2011
Showing with 1,952 additions and 554 deletions.
  1. +3 −1 configure.in
  2. +1 −0 language/Dutch/strings.xml
  3. +3 −1 language/English/strings.xml
  4. +43 −2 language/German/strings.xml
  5. +1 −1 lib/cmyth/include/cmyth/cmyth.h
  6. +3 −3 lib/cmyth/include/refmem/atomic.h
  7. +1 −1 lib/cmyth/libcmyth/debug.c
  8. +4 −4 lib/cmyth/libcmyth/mythtv_mysql.c
  9. +2 −1 lib/cmyth/librefmem/alloc.c
  10. +60 −13 lib/ffmpeg/libavcodec/arm/fft_neon.S
  11. +14 −14 lib/ffmpeg/libavcodec/arm/h264idct_neon.S
  12. +2 −3 lib/ffmpeg/libavcodec/arm/h264pred_neon.S
  13. +1 −2 lib/ffmpeg/libavcodec/arm/simple_idct_neon.S
  14. +6 −7 lib/ffmpeg/libavcodec/arm/vp3dsp_neon.S
  15. +47 −6 lib/ffmpeg/libavformat/mmsh.c
  16. +307 −0 lib/ffmpeg/patches/0057-Fixes-neon-usage-under-iOS5.patch
  17. +124 −0 lib/ffmpeg/patches/0058-fixed-seeks-in-mmsh.patch
  18. +1 −1 lib/libexif/IptcParse.cpp
  19. +1 −1 project/BuildDependencies/scripts/libcec_d.txt
  20. +43 −0 system/Lircmap.xml
  21. +34 −22 system/keymaps/keyboard.nyxboard.xml
  22. +5 −0 system/keymaps/keyboard.xml
  23. +5 −0 system/keymaps/remote.xml
  24. +1 −0 system/peripherals.xml
  25. +42 −89 tools/EventClients/Clients/PS3 Sixaxis Controller/ps3d.py
  26. +10 −0 tools/EventClients/lib/python/bt/hid.py
  27. +0 −54 tools/EventClients/lib/python/ps3/keymaps.py
  28. +182 −50 tools/EventClients/lib/python/ps3/sixaxis.py
  29. +114 −0 tools/EventClients/lib/python/ps3/sixpair.py
  30. +31 −0 tools/EventClients/lib/python/ps3/sixwatch.py
  31. +6 −2 tools/Linux/xbmc-standalone.sh.in
  32. +2 −1 tools/darwin/depends/config.site_ios.mk.in
  33. +1 −1 tools/darwin/depends/config.site_osx.in
  34. +2 −1 tools/darwin/depends/config.site_osx.mk.in
  35. +1 −1 tools/darwin/depends/fontconfig/Makefile
  36. +1 −1 tools/darwin/depends/freetype2/Makefile
  37. +2 −2 tools/darwin/depends/libass/Makefile
  38. +5 −0 tools/darwin/packaging/xbmc-atv2/mkdeb-xbmc-atv2.sh
  39. +23 −5 xbmc/Application.cpp
  40. +34 −0 xbmc/ApplicationMessenger.cpp
  41. +5 −0 xbmc/ApplicationMessenger.h
  42. +5 −4 xbmc/FileItem.cpp
  43. +1 −1 xbmc/FileItem.h
  44. +13 −3 xbmc/addons/AddonManager.cpp
  45. +2 −1 xbmc/addons/AddonManager.h
  46. +28 −0 xbmc/addons/GUIDialogAddonSettings.cpp
  47. +1 −0 xbmc/addons/GUIDialogAddonSettings.h
  48. +1 −1 xbmc/addons/Scraper.cpp
  49. +2 −1 xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitlesLibass.cpp
  50. +2 −3 xbmc/cores/paplayer/CodecFactory.cpp
  51. +11 −0 xbmc/dialogs/GUIDialogContextMenu.cpp
  52. +1 −0 xbmc/dialogs/GUIDialogContextMenu.h
  53. +2 −0 xbmc/filesystem/AFPDirectory.cpp
  54. +72 −13 xbmc/filesystem/FileAFP.cpp
  55. +7 −1 xbmc/filesystem/FileAFP.h
  56. +3 −3 xbmc/filesystem/FileCurl.cpp
  57. +46 −29 xbmc/filesystem/FileNFS.cpp
  58. +5 −2 xbmc/filesystem/FileNFS.h
  59. +7 −1 xbmc/guilib/DirtyRegionSolvers.cpp
  60. +7 −1 xbmc/guilib/DirtyRegionSolvers.h
  61. +10 −6 xbmc/guilib/DirtyRegionTracker.cpp
  62. +0 −2 xbmc/guilib/GUIShader.cpp
  63. +9 −1 xbmc/guilib/GUIWindowManager.cpp
  64. +1 −1 xbmc/guilib/GUIWrappingListContainer.cpp
  65. +4 −0 xbmc/guilib/GraphicContext.cpp
  66. +2 −1 xbmc/guilib/IDirtyRegionSolver.h
  67. +45 −0 xbmc/guilib/MatrixGLES.cpp
  68. +1 −0 xbmc/guilib/MatrixGLES.h
  69. +1 −0 xbmc/interfaces/Builtins.cpp
  70. +16 −1 xbmc/interfaces/json-rpc/FileItemHandler.cpp
  71. +4 −1 xbmc/interfaces/json-rpc/PlayerOperations.cpp
  72. +6 −1 xbmc/interfaces/python/xbmcmodule/pyrendercapture.cpp
  73. +8 −1 xbmc/interfaces/python/xbmcmodule/pyrendercapture.h
  74. +15 −3 xbmc/interfaces/python/xbmcmodule/xbmcmodule.cpp
  75. +125 −50 xbmc/peripherals/devices/PeripheralCecAdapter.cpp
  76. +19 −10 xbmc/peripherals/devices/PeripheralCecAdapter.h
  77. +7 −6 xbmc/peripherals/devices/PeripheralNyxboard.cpp
  78. +14 −5 xbmc/pvr/PVRDatabase.cpp
  79. +1 −1 xbmc/pvr/PVRDatabase.h
  80. +4 −8 xbmc/pvr/addons/PVRClient.cpp
  81. +2 −4 xbmc/pvr/addons/PVRClient.h
  82. +48 −26 xbmc/pvr/addons/PVRClients.cpp
  83. +10 −0 xbmc/pvr/addons/PVRClients.h
  84. +32 −11 xbmc/pvr/channels/PVRChannelGroup.cpp
  85. +8 −0 xbmc/pvr/channels/PVRChannelGroup.h
  86. +18 −27 xbmc/pvr/windows/GUIWindowPVR.cpp
  87. +1 −0 xbmc/pvr/windows/GUIWindowPVR.h
  88. +5 −0 xbmc/rendering/RenderSystem.h
  89. +16 −0 xbmc/rendering/dx/RenderSystemDX.cpp
  90. +7 −0 xbmc/rendering/dx/RenderSystemDX.h
  91. +16 −3 xbmc/rendering/gl/RenderSystemGL.cpp
  92. +9 −0 xbmc/rendering/gl/RenderSystemGL.h
  93. +18 −0 xbmc/rendering/gles/RenderSystemGLES.cpp
  94. +6 −0 xbmc/rendering/gles/RenderSystemGLES.h
  95. +1 −0 xbmc/settings/GUISettings.cpp
  96. +1 −1 xbmc/storage/MediaManager.cpp
  97. +46 −6 xbmc/utils/Splash.cpp
  98. +8 −0 xbmc/utils/Splash.h
  99. +4 −2 xbmc/video/VideoDatabase.cpp
  100. +1 −1 xbmc/video/VideoInfoTag.cpp
  101. +3 −0 xbmc/video/windows/GUIWindowFullScreen.cpp
  102. +2 −2 xbmc/video/windows/GUIWindowVideoNav.cpp
  103. +9 −0 xbmc/win32/WIN32Util.cpp
  104. +0 −19 xbmc/xbmc.cpp
View
4 configure.in
@@ -455,6 +455,8 @@ case $host in
;;
arm-apple-darwin*)
use_joystick=no
+ use_neon=yes
+ use_libcec=no
use_crystalhd=no
use_vdadecoder=no
use_vtbdecoder=yes
@@ -1159,7 +1161,7 @@ if test "x$use_libcec" != "xno"; then
# libcec is dyloaded, so we need to check for its headers and link any depends.
if test "x$use_libcec" != "xno"; then
- PKG_CHECK_MODULES([CEC],[libcec = 0.7.0],,[use_libcec="no";AC_MSG_RESULT($libcec_disabled)])
+ PKG_CHECK_MODULES([CEC],[libcec >= 1.0.0],,[use_libcec="no";AC_MSG_RESULT($libcec_disabled)])
if test "x$use_libcec" != "xno"; then
INCLUDES="$INCLUDES $CEC_CFLAGS"
View
1 language/Dutch/strings.xml
@@ -2891,5 +2891,6 @@
<string id="36015">HDMI poort nummer</string>
<string id="36016">XBMC verbonden</string>
<string id="36017">Adapter gevonden, maar libcec is niet beschikbaar</string>
+ <string id="36018">Gebruik de taalinstelling van de TV</string>
</strings>
View
4 language/English/strings.xml
@@ -2364,7 +2364,8 @@
<string id="21365">Remove media share</string>
<string id="21366">Subtitle folder</string>
<string id="21367">Movie &amp; alternate subtitle directory</string>
-
+ <string id="21368">Override ASS/SSA subtitles fonts</string>
+
<string id="21369">Enable mouse and Touch Screen support</string>
<string id="21370">Play navigation sounds during media playback</string>
<string id="21371">Thumbnail</string>
@@ -2830,4 +2831,5 @@
<string id="36015">HDMI port number</string>
<string id="36016">XBMC connected</string>
<string id="36017">Adapter found, but libcec is not available</string>
+ <string id="36018">Use the TV's language setting</string>
</strings>
View
45 language/German/strings.xml
@@ -848,7 +848,7 @@
<string id="1422">Windig</string>
<string id="1423">Dunst</string>
- <string id="1450">Aktiviere Energiesparmodus bei Leerlauf</string>
+ <string id="1450">Energiesparmodus des Bildschirms aktivieren</string>
<string id="2050">Länge</string>
@@ -2378,7 +2378,8 @@
<string id="21366">Alternatives Untertitel-Verzeichnis</string>
<string id="21367">Video- &amp; alternatives Untertitel-Verzeichnis</string>
- <string id="21369">Maus aktivieren</string>
+ <string id="21368">ASS/SSA Untertitel Schriftarten ignorieren</string>
+ <string id="21369">Maus und Touchscreen Unterstützung aktivieren</string>
<string id="21370">Navigations-Sounds während Medienwiedergabe aktivieren</string>
<string id="21371">Thumbnail</string>
<string id="21372">Erzwungene DVD-Player Region</string>
@@ -2776,4 +2777,44 @@
<string id="33100">Start fehlgeschlagen</string>
<string id="34100">Lautsprecherkonfiguration</string>
+
+ <string id="34201">Nächstes Element konnte nicht gefunden werden</string>
+ <string id="34202">Vorheriges Element konnte nich gefunden werden</string>
+
+ <string id="35000">Geräte</string>
+
+ <string id="35001">HID-Gerät</string>
+ <string id="35002">Netzwerkadapter</string>
+ <string id="35003">Festplatte</string>
+ <string id="35004">Für dieses Gerät sind keine Einstellungen verfügbar</string>
+ <string id="35005">Neues Gerät konfiguriert</string>
+ <string id="35006">Gerät entfernt</string>
+ <string id="35007">Tastenbelegung für dieses Gerät</string>
+ <string id="35008">Tastenbelegung aktiviert</string>
+
+ <string id="35500">Ort</string>
+ <string id="35501">Klasse</string>
+ <string id="35502">Name</string>
+ <string id="35503">Hersteller</string>
+ <string id="35504">Produkt ID</string>
+
+ <string id="36000">Pulse-Eight CEC Adapter</string>
+ <string id="36001">Pulse-Eight Nyxboard</string>
+ <string id="36002">Befehl beim Wechsel zur Tastatur-Seite</string>
+ <string id="36003">Befehl beim Wechsel zur Fernbedienungs-Seite</string>
+ <string id="36004">Befehl der benutzerdefinierten Taste (USER)</string>
+ <string id="36005">Seitenwechsel Befehle aktivieren</string>
+ <string id="36006">Der Adapter konnte nicht geöffnet werden</string>
+ <string id="36007">Geräte anschalten wenn XBMC startet</string>
+ <string id="36008">Geräe ausschalten wenn XBMC beendet wird</string>
+ <string id="36009">Geräte in den Standby versetzen wenn der Bilschirmschoner aktiviert wird</string>
+ <string id="36010">Als inaktiv markieren wenn XBMC beendet wird</string>
+ <string id="36011">Der CEC Port konnte nicht gefunden werden. Manuell einstellen.</string>
+ <string id="36012">Der CEC Adapter konnte nicht gefunden werden.</string>
+ <string id="36013">Nicht unterstützte libcec Version. %d ist größer als die von XBMC unterstützte Version (%d)</string>
+ <string id="36014">PC in den Standby versetzen wenn der Fernseher ausgeschaltet wird</string>
+ <string id="36015">HDMI Port Nummer</string>
+ <string id="36016">XBMC verbunden</string>
+ <string id="36017">CEC Adapter gefunden, aber libcec ist nicht verfügbar</string>
+ <string id="36018">Spracheinstellung des Fernsehers in XBMC nutzen</string>
</strings>
View
2 lib/cmyth/include/cmyth/cmyth.h
@@ -201,7 +201,7 @@ extern void cmyth_dbg(int level, char *fmt, ...);
* Define a callback to use to send messages rather than using stderr
* \param msgcb function pointer to pass a string to
*/
-extern void cmyth_set_dbg_msgcallback(void (*msgcb)(char *));
+extern void cmyth_set_dbg_msgcallback(void (*msgcb)(int level,char *));
/*
* -----------------------------------------------------------------
View
6 lib/cmyth/include/refmem/atomic.h
@@ -63,7 +63,7 @@ __mvp_atomic_increment(mvp_atomic_t *valp)
/**
* Atomically decrement a reference count variable.
* \param valp address of atomic variable
- * \return incremented reference count
+ * \return decremented reference count
*/
static inline unsigned
__mvp_atomic_decrement(mvp_atomic_t *valp)
@@ -72,7 +72,7 @@ __mvp_atomic_decrement(mvp_atomic_t *valp)
#if defined __i486__ || defined __i586__ || defined __i686__
__asm__ __volatile__(
"lock xaddl %0, (%1);"
- " inc %0;"
+ " dec %0;"
: "=r" (__val)
: "r" (valp), "0" (0x1)
: "cc", "memory"
@@ -113,7 +113,7 @@ __mvp_atomic_decrement(mvp_atomic_t *valp)
* Don't know how to atomic decrement for a generic architecture
* so punt and just decrement the value.
*/
-//#warning unknown architecture, atomic deccrement is not...
+//#warning unknown architecture, atomic decrement is not...
__val = --(*valp);
#endif
return __val;
View
2 lib/cmyth/libcmyth/debug.c
@@ -116,7 +116,7 @@ cmyth_dbg(int level, char *fmt, ...)
}
void
-cmyth_set_dbg_msgcallback(void (*msgcb)(char *))
+cmyth_set_dbg_msgcallback(void (*msgcb)(int level,char *))
{
cmyth_debug_ctx.msg_callback = msgcb;
}
View
8 lib/cmyth/libcmyth/mythtv_mysql.c
@@ -936,7 +936,7 @@ cmyth_mythtv_remove_previos_recorded(cmyth_database_t db,char *query)
int
cmyth_mysql_testdb_connection(cmyth_database_t db,char **message) {
- char buf[1000];
+ char *buf=malloc(sizeof(char)*1001);
int new_conn = 0;
if (db->mysql != NULL) {
if (mysql_stat(db->mysql) == NULL) {
@@ -949,21 +949,21 @@ cmyth_mysql_testdb_connection(cmyth_database_t db,char **message) {
new_conn = 1;
if(db->mysql == NULL) {
fprintf(stderr,"%s: mysql_init() failed, insufficient memory?", __FUNCTION__);
- snprintf(buf, sizeof(buf), "mysql_init() failed, insufficient memory?");
+ snprintf(buf, 1000, "mysql_init() failed, insufficient memory?");
*message=buf;
return -1;
}
if (NULL == mysql_real_connect(db->mysql, db->db_host,db->db_user,db->db_pass,db->db_name,0,NULL,0)) {
fprintf(stderr,"%s: mysql_connect() failed: %s\n", __FUNCTION__,
mysql_error(db->mysql));
- snprintf(buf, sizeof(buf), "%s",mysql_error(db->mysql));
+ snprintf(buf, 1000, "%s",mysql_error(db->mysql));
fprintf (stderr,"buf = %s\n",buf);
*message=buf;
cmyth_database_close(db);
return -1;
}
}
- snprintf(buf, sizeof(buf), "All Test Successful\n");
+ snprintf(buf, 1000, "All Test Successful\n");
*message=buf;
return 1;
}
View
3 lib/cmyth/librefmem/alloc.c
@@ -283,7 +283,8 @@ ref_realloc(void *p, size_t len)
refmem_dbg(REF_DBG_DEBUG, "%s(%d, ret = %p, ref = %p) {\n",
__FUNCTION__, len, ret, ref);
#ifdef DEBUG
- assert(ref->magic == ALLOC_MAGIC);
+ if(p)
+ assert(ref->magic == ALLOC_MAGIC);
#endif /* DEBUG */
if (p && ret) {
memcpy(ret, p, ref->length);
View
73 lib/ffmpeg/libavcodec/arm/fft_neon.S
@@ -101,8 +101,12 @@ function fft8_neon
bx lr
endfunc
+ .align 4
+pmmp: .float +1.0, -1.0, -1.0, +1.0
+mppm: .float -M_SQRT1_2, M_SQRT1_2, M_SQRT1_2, -M_SQRT1_2
+
function fft16_neon
- movrel r1, mppm
+ adr r1, mppm
vld1.32 {d16-d19}, [r0,:128]! @ q8{r0,i0,r1,i1} q9{r2,i2,r3,i3}
pld [r0, #32]
vld1.32 {d2-d3}, [r1,:128]
@@ -144,12 +148,16 @@ function fft16_neon
vswp d29, d30 @ q14{r12,i12,i14,r15} q15{r13,i13,i15,r14}
vadd.f32 q0, q12, q13 @ {t1,t2,t5,t6}
vadd.f32 q1, q14, q15 @ {t1a,t2a,t5a,t6a}
- movrel r2, X(ff_cos_16)
+ ldr r2, _neon_label
+ ldr r3, L$diff1
+ add r2, r3
+local_label1:
+ ldr r2, [pc, r2]
vsub.f32 q13, q12, q13 @ {t3,t4,t7,t8}
vrev64.32 d1, d1
vsub.f32 q15, q14, q15 @ {t3a,t4a,t7a,t8a}
vrev64.32 d3, d3
- movrel r3, pmmp
+ adr r3, pmmp
vswp d1, d26 @ q0{t1,t2,t3,t4} q13{t6,t5,t7,t8}
vswp d3, d30 @ q1{t1a,t2a,t3a,t4a} q15{t6a,t5a,t7a,t8a}
vadd.f32 q12, q0, q13 @ {r8,i8,r9,i9}
@@ -214,7 +222,7 @@ function fft_pass_neon
add r2, r2, r0 @ &z[o2]
add r3, r3, r0 @ &z[o3]
vld1.32 {d20-d21},[r2,:128] @ {z[o2],z[o2+1]}
- movrel r12, pmmp
+ adr r12, pmmp
vld1.32 {d22-d23},[r3,:128] @ {z[o3],z[o3+1]}
add r5, r5, r1 @ wim
vld1.32 {d6-d7}, [r12,:128] @ pmmp
@@ -279,6 +287,11 @@ function fft_pass_neon
pop {r4-r6,pc}
endfunc
+.set L$offs16, 0
+.macro setTabOffs n, n2
+.set L$offs\n, L$offs\n2 + 4
+.endm
+
.macro def_fft n, n2, n4
.align 6
function fft\n\()_neon
@@ -291,10 +304,15 @@ function fft\n\()_neon
bl fft\n4\()_neon
mov r0, r4
pop {r4, lr}
- movrel r1, X(ff_cos_\n)
+ ldr r1, _neon_label
+ add r1, #L$diff\n
+local_label\n:
+ ldr r1, [pc, r1]
mov r2, #\n4/2
b fft_pass_neon
endfunc
+setTabOffs \n, \n2
+.set L$diff\n, _neon_label - local_label\n + L$offs\n - 8
.endm
def_fft 32, 16, 8
@@ -310,10 +328,14 @@ endfunc
def_fft 32768, 16384, 8192
def_fft 65536, 32768, 16384
+.set L$diffTab, fft_tab_neon_offs - local_label_tab - 8
function ff_fft_calc_neon, export=1
ldr r2, [r0]
sub r2, r2, #2
- movrel r3, fft_tab_neon
+ ldr r3, fft_tab_neon_offs
+ add r3, #L$diffTab
+local_label_tab:
+ add r3, pc
ldr r3, [r3, r2, lsl #2]
mov r0, r1
bx r3
@@ -349,9 +371,22 @@ function ff_fft_permute_neon, export=1
pop {r4,pc}
endfunc
- .section .rodata
+
+.global _neon_label
+_neon_label:
+.word _neon_cos_tab - .
+
+L$diff1:
+.word _neon_label - local_label1 - 8
+
+fft_tab_neon_offs:
+.word _fft_tab_neon - .
+
+
+.section .rodata
+
.align 4
-fft_tab_neon:
+_fft_tab_neon:
.word fft4_neon
.word fft8_neon
.word fft16_neon
@@ -367,8 +402,20 @@ fft_tab_neon:
.word fft16384_neon
.word fft32768_neon
.word fft65536_neon
-ELF .size fft_tab_neon, . - fft_tab_neon
-
- .align 4
-pmmp: .float +1.0, -1.0, -1.0, +1.0
-mppm: .float -M_SQRT1_2, M_SQRT1_2, M_SQRT1_2, -M_SQRT1_2
+ELF .size _fft_tab_neon, . - _fft_tab_neon
+
+ .align 4
+_neon_cos_tab:
+ .word X(ff_cos_16)
+ .word X(ff_cos_32)
+ .word X(ff_cos_64)
+ .word X(ff_cos_128)
+ .word X(ff_cos_256)
+ .word X(ff_cos_512)
+ .word X(ff_cos_1024)
+ .word X(ff_cos_2048)
+ .word X(ff_cos_4096)
+ .word X(ff_cos_8192)
+ .word X(ff_cos_16384)
+ .word X(ff_cos_32768)
+ .word X(ff_cos_65536)
View
28 lib/ffmpeg/libavcodec/arm/h264idct_neon.S
@@ -97,7 +97,7 @@ function ff_h264_idct_add16_neon, export=1
mov r1, r2
mov r2, r3
ldr r6, [sp, #24]
- movrel r7, scan8
+ adr r7, scan8
mov ip, #16
1: ldrb r8, [r7], #1
ldr r0, [r5], #4
@@ -117,14 +117,24 @@ function ff_h264_idct_add16_neon, export=1
pop {r4-r8,pc}
endfunc
+ .align
+scan8: .byte 4+1*8, 5+1*8, 4+2*8, 5+2*8
+ .byte 6+1*8, 7+1*8, 6+2*8, 7+2*8
+ .byte 4+3*8, 5+3*8, 4+4*8, 5+4*8
+ .byte 6+3*8, 7+3*8, 6+4*8, 7+4*8
+ .byte 1+1*8, 2+1*8
+ .byte 1+2*8, 2+2*8
+ .byte 1+4*8, 2+4*8
+ .byte 1+5*8, 2+5*8
+
function ff_h264_idct_add16intra_neon, export=1
push {r4-r8,lr}
mov r4, r0
mov r5, r1
mov r1, r2
mov r2, r3
ldr r6, [sp, #24]
- movrel r7, scan8
+ adr r7, scan8
mov ip, #16
1: ldrb r8, [r7], #1
ldr r0, [r5], #4
@@ -149,7 +159,7 @@ function ff_h264_idct_add8_neon, export=1
add r1, r2, #16*32
mov r2, r3
ldr r6, [sp, #32]
- movrel r7, scan8+16
+ adr r7, scan8+16
mov ip, #7
1: ldrb r8, [r7], #1
ldr r0, [r5], #4
@@ -353,7 +363,7 @@ function ff_h264_idct8_add4_neon, export=1
mov r1, r2
mov r2, r3
ldr r6, [sp, #24]
- movrel r7, scan8
+ adr r7, scan8
mov r12, #16
1: ldrb r8, [r7], #4
ldr r0, [r5], #16
@@ -372,13 +382,3 @@ function ff_h264_idct8_add4_neon, export=1
bne 1b
pop {r4-r8,pc}
endfunc
-
- .section .rodata
-scan8: .byte 4+1*8, 5+1*8, 4+2*8, 5+2*8
- .byte 6+1*8, 7+1*8, 6+2*8, 7+2*8
- .byte 4+3*8, 5+3*8, 4+4*8, 5+4*8
- .byte 6+3*8, 7+3*8, 6+4*8, 7+4*8
- .byte 1+1*8, 2+1*8
- .byte 1+2*8, 2+2*8
- .byte 1+4*8, 2+4*8
- .byte 1+5*8, 2+5*8
View
5 lib/ffmpeg/libavcodec/arm/h264pred_neon.S
@@ -123,7 +123,7 @@ function ff_pred16x16_plane_neon, export=1
vaddl.u8 q8, d2, d3
vsubl.u8 q2, d2, d0
vsubl.u8 q3, d3, d1
- movrel r3, p16weight
+ adr r3, p16weight
vld1.8 {q0}, [r3,:128]
vmul.s16 q2, q2, q0
vmul.s16 q3, q3, q0
@@ -166,7 +166,6 @@ function ff_pred16x16_plane_neon, export=1
bx lr
endfunc
- .section .rodata
.align 4
p16weight:
.short 1,2,3,4,5,6,7,8
@@ -207,7 +206,7 @@ function ff_pred8x8_plane_neon, export=1
vrev32.8 d0, d0
vtrn.32 d2, d3
vsubl.u8 q2, d2, d0
- movrel r3, p16weight
+ adr r3, p16weight
vld1.16 {q0}, [r3,:128]
vmul.s16 d4, d4, d0
vmul.s16 d5, d5, d0
View
3 lib/ffmpeg/libavcodec/arm/simple_idct_neon.S
@@ -239,7 +239,6 @@ function idct_col4_st8_neon
bx lr
endfunc
- .section .rodata
.align 4
idct_coeff_neon:
.short W1, W2, W3, W4, W5, W6, W7, W4c
@@ -249,7 +248,7 @@ idct_coeff_neon:
pld [\data]
pld [\data, #64]
vpush {d8-d15}
- movrel r3, idct_coeff_neon
+ adr r3, idct_coeff_neon
vld1.64 {d0,d1}, [r3,:128]
.endm
View
13 lib/ffmpeg/libavcodec/arm/vp3dsp_neon.S
@@ -20,12 +20,9 @@
#include "asm.S"
-.section .rodata
+.text
.align 4
-vp3_idct_constants:
-.short 64277, 60547, 54491, 46341, 36410, 25080, 12785
-
#define xC1S7 d0[0]
#define xC2S6 d0[1]
#define xC3S5 d0[2]
@@ -34,8 +31,6 @@ vp3_idct_constants:
#define xC6S2 d1[1]
#define xC7S1 d1[2]
-.text
-
.macro vp3_loop_filter
vsubl.u8 q3, d18, d17
vsubl.u8 q2, d16, d19
@@ -109,10 +104,14 @@ function ff_vp3_h_loop_filter_neon, export=1
bx lr
endfunc
+.align 4
+vp3_idct_constants:
+.short 64277, 60547, 54491, 46341, 36410, 25080, 12785
+.align 4
function vp3_idct_start_neon
vpush {d8-d15}
- movrel r3, vp3_idct_constants
+ adr r3, vp3_idct_constants
vld1.64 {d0-d1}, [r3,:128]
vld1.64 {d16-d19}, [r2,:128]!
vld1.64 {d20-d23}, [r2,:128]!
View
53 lib/ffmpeg/libavformat/mmsh.c
@@ -54,6 +54,7 @@ typedef enum {
typedef struct {
MMSContext mms;
+ uint8_t location[1024];
int request_seq; ///< request packet sequence
int chunk_seq; ///< data packet sequence
} MMSHContext;
@@ -210,10 +211,10 @@ static int get_http_header_data(MMSHContext *mmsh)
return 0;
}
-static int mmsh_open(URLContext *h, const char *uri, int flags)
+static int mmsh_open_internal(URLContext *h, const char *uri, int flags, int timestamp, int64_t pos)
{
int i, port, err;
- char httpname[256], path[256], host[128], location[1024];
+ char httpname[256], path[256], host[128];
char *stream_selection = NULL;
char headers[1024];
MMSHContext *mmsh;
@@ -224,10 +225,10 @@ static int mmsh_open(URLContext *h, const char *uri, int flags)
return AVERROR(ENOMEM);
mmsh->request_seq = h->is_streamed = 1;
mms = &mmsh->mms;
- av_strlcpy(location, uri, sizeof(location));
+ av_strlcpy(mmsh->location, uri, sizeof(mmsh->location));
av_url_split(NULL, 0, NULL, 0,
- host, sizeof(host), &port, path, sizeof(path), location);
+ host, sizeof(host), &port, path, sizeof(path), mmsh->location);
if (port<0)
port = 80; // default mmsh protocol port
ff_url_join(httpname, sizeof(httpname), "http", NULL, host, port, path);
@@ -283,8 +284,9 @@ static int mmsh_open(URLContext *h, const char *uri, int flags)
CLIENTGUID
"Pragma: stream-switch-count=%d\r\n"
"Pragma: stream-switch-entry=%s\r\n"
+ "Pragma: no-cache,rate)1.000000,stream-time=%u"
"Connection: Close\r\n\r\n",
- host, port, mmsh->request_seq++, mms->stream_num, stream_selection);
+ host, port, mmsh->request_seq++, mms->stream_num, stream_selection, timestamp);
av_freep(&stream_selection);
if (err < 0) {
av_log(NULL, AV_LOG_ERROR, "Build play request failed!\n");
@@ -313,6 +315,11 @@ static int mmsh_open(URLContext *h, const char *uri, int flags)
return err;
}
+static int mmsh_open(URLContext *h, const char *uri, int flags)
+{
+ return mmsh_open_internal(h, uri, flags, 0, 0);
+}
+
static int handle_chunk_type(MMSHContext *mmsh)
{
MMSContext *mms = &mmsh->mms;
@@ -359,11 +366,45 @@ static int mmsh_read(URLContext *h, uint8_t *buf, int size)
return res;
}
+static int64_t mmsh_read_seek(URLContext *h, int stream_index,
+ int64_t timestamp, int flags)
+{
+ MMSHContext *mmsh = h->priv_data;
+ MMSContext *mms = &mmsh->mms;
+ int ret;
+
+ ret= mmsh_open_internal(h, mmsh->location, 0, FFMAX(timestamp, 0), 0);
+
+ if(ret>=0){
+ if (mms->mms_hd)
+ url_close(mms->mms_hd);
+ av_freep(&mms->streams);
+ av_freep(&mms->asf_header);
+ av_free(mmsh);
+ mmsh = h->priv_data;
+ mms = &mmsh->mms;
+ mms->asf_header_read_size= mms->asf_header_size;
+ }else
+ h->priv_data= mmsh;
+ return ret;
+}
+
+static int64_t mmsh_seek(URLContext *h, int64_t pos, int whence)
+{
+ MMSHContext *mmsh = h->priv_data;
+ MMSContext *mms = &mmsh->mms;
+
+ if(pos == 0 && whence == SEEK_CUR)
+ return mms->asf_header_read_size + mms->remaining_in_len + mmsh->chunk_seq * mms->asf_packet_len;
+ return AVERROR(ENOSYS);
+}
+
URLProtocol ff_mmsh_protocol = {
.name = "mmsh",
.url_open = mmsh_open,
.url_read = mmsh_read,
.url_write = NULL,
- .url_seek = NULL,
+ .url_seek = mmsh_seek,
.url_close = mmsh_close,
+ .url_read_seek = mmsh_read_seek,
};
View
307 lib/ffmpeg/patches/0057-Fixes-neon-usage-under-iOS5.patch
@@ -0,0 +1,307 @@
+diff --git a/lib/ffmpeg/libavcodec/arm/fft_neon.S b/lib/ffmpeg/libavcodec/arm/fft_neon.S
+index 1db7abd..6390065 100644
+--- a/lib/ffmpeg/libavcodec/arm/fft_neon.S
++++ b/lib/ffmpeg/libavcodec/arm/fft_neon.S
+@@ -101,8 +101,12 @@ function fft8_neon
+ bx lr
+ endfunc
+
++ .align 4
++pmmp: .float +1.0, -1.0, -1.0, +1.0
++mppm: .float -M_SQRT1_2, M_SQRT1_2, M_SQRT1_2, -M_SQRT1_2
++
+ function fft16_neon
+- movrel r1, mppm
++ adr r1, mppm
+ vld1.32 {d16-d19}, [r0,:128]! @ q8{r0,i0,r1,i1} q9{r2,i2,r3,i3}
+ pld [r0, #32]
+ vld1.32 {d2-d3}, [r1,:128]
+@@ -144,12 +148,16 @@ function fft16_neon
+ vswp d29, d30 @ q14{r12,i12,i14,r15} q15{r13,i13,i15,r14}
+ vadd.f32 q0, q12, q13 @ {t1,t2,t5,t6}
+ vadd.f32 q1, q14, q15 @ {t1a,t2a,t5a,t6a}
+- movrel r2, X(ff_cos_16)
++ ldr r2, _neon_label
++ ldr r3, L$diff1
++ add r2, r3
++local_label1:
++ ldr r2, [pc, r2]
+ vsub.f32 q13, q12, q13 @ {t3,t4,t7,t8}
+ vrev64.32 d1, d1
+ vsub.f32 q15, q14, q15 @ {t3a,t4a,t7a,t8a}
+ vrev64.32 d3, d3
+- movrel r3, pmmp
++ adr r3, pmmp
+ vswp d1, d26 @ q0{t1,t2,t3,t4} q13{t6,t5,t7,t8}
+ vswp d3, d30 @ q1{t1a,t2a,t3a,t4a} q15{t6a,t5a,t7a,t8a}
+ vadd.f32 q12, q0, q13 @ {r8,i8,r9,i9}
+@@ -214,7 +222,7 @@ function fft_pass_neon
+ add r2, r2, r0 @ &z[o2]
+ add r3, r3, r0 @ &z[o3]
+ vld1.32 {d20-d21},[r2,:128] @ {z[o2],z[o2+1]}
+- movrel r12, pmmp
++ adr r12, pmmp
+ vld1.32 {d22-d23},[r3,:128] @ {z[o3],z[o3+1]}
+ add r5, r5, r1 @ wim
+ vld1.32 {d6-d7}, [r12,:128] @ pmmp
+@@ -279,6 +287,11 @@ function fft_pass_neon
+ pop {r4-r6,pc}
+ endfunc
+
++.set L$offs16, 0
++.macro setTabOffs n, n2
++.set L$offs\n, L$offs\n2 + 4
++.endm
++
+ .macro def_fft n, n2, n4
+ .align 6
+ function fft\n\()_neon
+@@ -291,10 +304,15 @@ function fft\n\()_neon
+ bl fft\n4\()_neon
+ mov r0, r4
+ pop {r4, lr}
+- movrel r1, X(ff_cos_\n)
++ ldr r1, _neon_label
++ add r1, #L$diff\n
++local_label\n:
++ ldr r1, [pc, r1]
+ mov r2, #\n4/2
+ b fft_pass_neon
+ endfunc
++setTabOffs \n, \n2
++.set L$diff\n, _neon_label - local_label\n + L$offs\n - 8
+ .endm
+
+ def_fft 32, 16, 8
+@@ -310,10 +328,14 @@ endfunc
+ def_fft 32768, 16384, 8192
+ def_fft 65536, 32768, 16384
+
++.set L$diffTab, fft_tab_neon_offs - local_label_tab - 8
+ function ff_fft_calc_neon, export=1
+ ldr r2, [r0]
+ sub r2, r2, #2
+- movrel r3, fft_tab_neon
++ ldr r3, fft_tab_neon_offs
++ add r3, #L$diffTab
++local_label_tab:
++ add r3, pc
+ ldr r3, [r3, r2, lsl #2]
+ mov r0, r1
+ bx r3
+@@ -349,9 +371,22 @@ function ff_fft_permute_neon, export=1
+ pop {r4,pc}
+ endfunc
+
+- .section .rodata
++
++.global _neon_label
++_neon_label:
++.word _neon_cos_tab - .
++
++L$diff1:
++.word _neon_label - local_label1 - 8
++
++fft_tab_neon_offs:
++.word _fft_tab_neon - .
++
++
++.section .rodata
++
+ .align 4
+-fft_tab_neon:
++_fft_tab_neon:
+ .word fft4_neon
+ .word fft8_neon
+ .word fft16_neon
+@@ -367,8 +402,20 @@ fft_tab_neon:
+ .word fft16384_neon
+ .word fft32768_neon
+ .word fft65536_neon
+-ELF .size fft_tab_neon, . - fft_tab_neon
+-
+- .align 4
+-pmmp: .float +1.0, -1.0, -1.0, +1.0
+-mppm: .float -M_SQRT1_2, M_SQRT1_2, M_SQRT1_2, -M_SQRT1_2
++ELF .size _fft_tab_neon, . - _fft_tab_neon
++
++ .align 4
++_neon_cos_tab:
++ .word X(ff_cos_16)
++ .word X(ff_cos_32)
++ .word X(ff_cos_64)
++ .word X(ff_cos_128)
++ .word X(ff_cos_256)
++ .word X(ff_cos_512)
++ .word X(ff_cos_1024)
++ .word X(ff_cos_2048)
++ .word X(ff_cos_4096)
++ .word X(ff_cos_8192)
++ .word X(ff_cos_16384)
++ .word X(ff_cos_32768)
++ .word X(ff_cos_65536)
+diff --git a/lib/ffmpeg/libavcodec/arm/h264idct_neon.S b/lib/ffmpeg/libavcodec/arm/h264idct_neon.S
+index 6b6a669..8111975 100644
+--- a/lib/ffmpeg/libavcodec/arm/h264idct_neon.S
++++ b/lib/ffmpeg/libavcodec/arm/h264idct_neon.S
+@@ -97,7 +97,7 @@ function ff_h264_idct_add16_neon, export=1
+ mov r1, r2
+ mov r2, r3
+ ldr r6, [sp, #24]
+- movrel r7, scan8
++ adr r7, scan8
+ mov ip, #16
+ 1: ldrb r8, [r7], #1
+ ldr r0, [r5], #4
+@@ -117,6 +117,16 @@ function ff_h264_idct_add16_neon, export=1
+ pop {r4-r8,pc}
+ endfunc
+
++ .align
++scan8: .byte 4+1*8, 5+1*8, 4+2*8, 5+2*8
++ .byte 6+1*8, 7+1*8, 6+2*8, 7+2*8
++ .byte 4+3*8, 5+3*8, 4+4*8, 5+4*8
++ .byte 6+3*8, 7+3*8, 6+4*8, 7+4*8
++ .byte 1+1*8, 2+1*8
++ .byte 1+2*8, 2+2*8
++ .byte 1+4*8, 2+4*8
++ .byte 1+5*8, 2+5*8
++
+ function ff_h264_idct_add16intra_neon, export=1
+ push {r4-r8,lr}
+ mov r4, r0
+@@ -124,7 +134,7 @@ function ff_h264_idct_add16intra_neon, export=1
+ mov r1, r2
+ mov r2, r3
+ ldr r6, [sp, #24]
+- movrel r7, scan8
++ adr r7, scan8
+ mov ip, #16
+ 1: ldrb r8, [r7], #1
+ ldr r0, [r5], #4
+@@ -149,7 +159,7 @@ function ff_h264_idct_add8_neon, export=1
+ add r1, r2, #16*32
+ mov r2, r3
+ ldr r6, [sp, #32]
+- movrel r7, scan8+16
++ adr r7, scan8+16
+ mov ip, #7
+ 1: ldrb r8, [r7], #1
+ ldr r0, [r5], #4
+@@ -353,7 +363,7 @@ function ff_h264_idct8_add4_neon, export=1
+ mov r1, r2
+ mov r2, r3
+ ldr r6, [sp, #24]
+- movrel r7, scan8
++ adr r7, scan8
+ mov r12, #16
+ 1: ldrb r8, [r7], #4
+ ldr r0, [r5], #16
+@@ -372,13 +382,3 @@ function ff_h264_idct8_add4_neon, export=1
+ bne 1b
+ pop {r4-r8,pc}
+ endfunc
+-
+- .section .rodata
+-scan8: .byte 4+1*8, 5+1*8, 4+2*8, 5+2*8
+- .byte 6+1*8, 7+1*8, 6+2*8, 7+2*8
+- .byte 4+3*8, 5+3*8, 4+4*8, 5+4*8
+- .byte 6+3*8, 7+3*8, 6+4*8, 7+4*8
+- .byte 1+1*8, 2+1*8
+- .byte 1+2*8, 2+2*8
+- .byte 1+4*8, 2+4*8
+- .byte 1+5*8, 2+5*8
+diff --git a/lib/ffmpeg/libavcodec/arm/h264pred_neon.S b/lib/ffmpeg/libavcodec/arm/h264pred_neon.S
+index 63c96ee..357c10a 100644
+--- a/lib/ffmpeg/libavcodec/arm/h264pred_neon.S
++++ b/lib/ffmpeg/libavcodec/arm/h264pred_neon.S
+@@ -123,7 +123,7 @@ function ff_pred16x16_plane_neon, export=1
+ vaddl.u8 q8, d2, d3
+ vsubl.u8 q2, d2, d0
+ vsubl.u8 q3, d3, d1
+- movrel r3, p16weight
++ adr r3, p16weight
+ vld1.8 {q0}, [r3,:128]
+ vmul.s16 q2, q2, q0
+ vmul.s16 q3, q3, q0
+@@ -166,7 +166,6 @@ function ff_pred16x16_plane_neon, export=1
+ bx lr
+ endfunc
+
+- .section .rodata
+ .align 4
+ p16weight:
+ .short 1,2,3,4,5,6,7,8
+@@ -207,7 +206,7 @@ function ff_pred8x8_plane_neon, export=1
+ vrev32.8 d0, d0
+ vtrn.32 d2, d3
+ vsubl.u8 q2, d2, d0
+- movrel r3, p16weight
++ adr r3, p16weight
+ vld1.16 {q0}, [r3,:128]
+ vmul.s16 d4, d4, d0
+ vmul.s16 d5, d5, d0
+diff --git a/lib/ffmpeg/libavcodec/arm/simple_idct_neon.S b/lib/ffmpeg/libavcodec/arm/simple_idct_neon.S
+index 17cde58..e61414e 100644
+--- a/lib/ffmpeg/libavcodec/arm/simple_idct_neon.S
++++ b/lib/ffmpeg/libavcodec/arm/simple_idct_neon.S
+@@ -239,7 +239,6 @@ function idct_col4_st8_neon
+ bx lr
+ endfunc
+
+- .section .rodata
+ .align 4
+ idct_coeff_neon:
+ .short W1, W2, W3, W4, W5, W6, W7, W4c
+@@ -249,7 +248,7 @@ idct_coeff_neon:
+ pld [\data]
+ pld [\data, #64]
+ vpush {d8-d15}
+- movrel r3, idct_coeff_neon
++ adr r3, idct_coeff_neon
+ vld1.64 {d0,d1}, [r3,:128]
+ .endm
+
+diff --git a/lib/ffmpeg/libavcodec/arm/vp3dsp_neon.S b/lib/ffmpeg/libavcodec/arm/vp3dsp_neon.S
+index d97ed3d..74bf7ba 100644
+--- a/lib/ffmpeg/libavcodec/arm/vp3dsp_neon.S
++++ b/lib/ffmpeg/libavcodec/arm/vp3dsp_neon.S
+@@ -20,12 +20,9 @@
+
+ #include "asm.S"
+
+-.section .rodata
++.text
+ .align 4
+
+-vp3_idct_constants:
+-.short 64277, 60547, 54491, 46341, 36410, 25080, 12785
+-
+ #define xC1S7 d0[0]
+ #define xC2S6 d0[1]
+ #define xC3S5 d0[2]
+@@ -34,8 +31,6 @@ vp3_idct_constants:
+ #define xC6S2 d1[1]
+ #define xC7S1 d1[2]
+
+-.text
+-
+ .macro vp3_loop_filter
+ vsubl.u8 q3, d18, d17
+ vsubl.u8 q2, d16, d19
+@@ -109,10 +104,14 @@ function ff_vp3_h_loop_filter_neon, export=1
+ bx lr
+ endfunc
+
++.align 4
++vp3_idct_constants:
++.short 64277, 60547, 54491, 46341, 36410, 25080, 12785
++.align 4
+
+ function vp3_idct_start_neon
+ vpush {d8-d15}
+- movrel r3, vp3_idct_constants
++ adr r3, vp3_idct_constants
+ vld1.64 {d0-d1}, [r3,:128]
+ vld1.64 {d16-d19}, [r2,:128]!
+ vld1.64 {d20-d23}, [r2,:128]!
View
124 lib/ffmpeg/patches/0058-fixed-seeks-in-mmsh.patch
@@ -0,0 +1,124 @@
+From 4e8274d070a598e60a953c6aed2dd9f4710cd2b4 Mon Sep 17 00:00:00 2001
+From: spiff <spiff@xbmc.org>
+Date: Tue, 1 Nov 2011 13:14:09 +0100
+Subject: [PATCH] fixed: seeks in mmsh
+
+this backports upstream commits aedb87c57, 86a4e55e6, 8475ec190,
+60fcc19bff (partially), 237bcaa27518, 33789862, 8af4ac5272, 26b64550d6
+
+thanks a million to michael niedermayer for giving this priority!
+---
+ lib/ffmpeg/libavformat/mmsh.c | 53 ++++++++++++++++++++++++++++++++++++----
+ 1 files changed, 47 insertions(+), 6 deletions(-)
+
+diff --git a/lib/ffmpeg/libavformat/mmsh.c b/lib/ffmpeg/libavformat/mmsh.c
+index 257b973..3ae886f 100644
+--- a/lib/ffmpeg/libavformat/mmsh.c
++++ b/lib/ffmpeg/libavformat/mmsh.c
+@@ -54,6 +54,7 @@ typedef enum {
+
+ typedef struct {
+ MMSContext mms;
++ uint8_t location[1024];
+ int request_seq; ///< request packet sequence
+ int chunk_seq; ///< data packet sequence
+ } MMSHContext;
+@@ -210,10 +211,10 @@ static int get_http_header_data(MMSHContext *mmsh)
+ return 0;
+ }
+
+-static int mmsh_open(URLContext *h, const char *uri, int flags)
++static int mmsh_open_internal(URLContext *h, const char *uri, int flags, int timestamp, int64_t pos)
+ {
+ int i, port, err;
+- char httpname[256], path[256], host[128], location[1024];
++ char httpname[256], path[256], host[128];
+ char *stream_selection = NULL;
+ char headers[1024];
+ MMSHContext *mmsh;
+@@ -224,10 +225,10 @@ static int mmsh_open(URLContext *h, const char *uri, int flags)
+ return AVERROR(ENOMEM);
+ mmsh->request_seq = h->is_streamed = 1;
+ mms = &mmsh->mms;
+- av_strlcpy(location, uri, sizeof(location));
++ av_strlcpy(mmsh->location, uri, sizeof(mmsh->location));
+
+ av_url_split(NULL, 0, NULL, 0,
+- host, sizeof(host), &port, path, sizeof(path), location);
++ host, sizeof(host), &port, path, sizeof(path), mmsh->location);
+ if (port<0)
+ port = 80; // default mmsh protocol port
+ ff_url_join(httpname, sizeof(httpname), "http", NULL, host, port, path);
+@@ -283,8 +284,9 @@ static int mmsh_open(URLContext *h, const char *uri, int flags)
+ CLIENTGUID
+ "Pragma: stream-switch-count=%d\r\n"
+ "Pragma: stream-switch-entry=%s\r\n"
++ "Pragma: no-cache,rate)1.000000,stream-time=%u"
+ "Connection: Close\r\n\r\n",
+- host, port, mmsh->request_seq++, mms->stream_num, stream_selection);
++ host, port, mmsh->request_seq++, mms->stream_num, stream_selection, timestamp);
+ av_freep(&stream_selection);
+ if (err < 0) {
+ av_log(NULL, AV_LOG_ERROR, "Build play request failed!\n");
+@@ -313,6 +315,11 @@ fail:
+ return err;
+ }
+
++static int mmsh_open(URLContext *h, const char *uri, int flags)
++{
++ return mmsh_open_internal(h, uri, flags, 0, 0);
++}
++
+ static int handle_chunk_type(MMSHContext *mmsh)
+ {
+ MMSContext *mms = &mmsh->mms;
+@@ -359,11 +366,45 @@ static int mmsh_read(URLContext *h, uint8_t *buf, int size)
+ return res;
+ }
+
++static int64_t mmsh_read_seek(URLContext *h, int stream_index,
++ int64_t timestamp, int flags)
++{
++ MMSHContext *mmsh = h->priv_data;
++ MMSContext *mms = &mmsh->mms;
++ int ret;
++
++ ret= mmsh_open_internal(h, mmsh->location, 0, FFMAX(timestamp, 0), 0);
++
++ if(ret>=0){
++ if (mms->mms_hd)
++ url_close(mms->mms_hd);
++ av_freep(&mms->streams);
++ av_freep(&mms->asf_header);
++ av_free(mmsh);
++ mmsh = h->priv_data;
++ mms = &mmsh->mms;
++ mms->asf_header_read_size= mms->asf_header_size;
++ }else
++ h->priv_data= mmsh;
++ return ret;
++}
++
++static int64_t mmsh_seek(URLContext *h, int64_t pos, int whence)
++{
++ MMSHContext *mmsh = h->priv_data;
++ MMSContext *mms = &mmsh->mms;
++
++ if(pos == 0 && whence == SEEK_CUR)
++ return mms->asf_header_read_size + mms->remaining_in_len + mmsh->chunk_seq * mms->asf_packet_len;
++ return AVERROR(ENOSYS);
++}
++
+ URLProtocol ff_mmsh_protocol = {
+ .name = "mmsh",
+ .url_open = mmsh_open,
+ .url_read = mmsh_read,
+ .url_write = NULL,
+- .url_seek = NULL,
++ .url_seek = mmsh_seek,
+ .url_close = mmsh_close,
++ .url_read_seek = mmsh_read_seek,
+ };
+--
+1.7.5
+
View
2 lib/libexif/IptcParse.cpp
@@ -107,7 +107,7 @@ bool CIptcParse::Process (const unsigned char* const Data, const unsigned short
// Get length (Motorola format)
unsigned long length = CExifParse::Get32(pos);
- pos += sizeof(long); // move data pointer to the next field
+ pos += 4; // move data pointer to the next field
// Now read IPTC data
while (pos < (char*)(Data + itemlen-5))
View
2 project/BuildDependencies/scripts/libcec_d.txt
@@ -1,3 +1,3 @@
; filename mirror source of the file
-libcec7.zip http://xbmc.opdenkamp.eu/ http://packages.pulse-eight.net/
+libcec1.0.zip http://xbmc.opdenkamp.eu/ http://packages.pulse-eight.net/
View
43 system/Lircmap.xml
@@ -58,6 +58,49 @@
<yellow>Yellow</yellow>
<blue>Blue</blue>
<teletext>Teletext</teletext>
+
+ <!-- new kernel-based lirc button names -->
+ <left>KEY_LEFT</left>
+ <right>KEY_RIGHT</right>
+ <up>KEY_UP</up>
+ <down>KEY_DOWN</down>
+ <select>KEY_OK</select>
+ <start>KEY_HOME</start>
+ <back>KEY_BACK</back>
+ <record>KEY_RECORD</record>
+ <play>KEY_PLAY</play>
+ <pause>KEY_PAUSE</pause>
+ <stop>KEY_STOP</stop>
+ <forward>KEY_FORWARD</forward>
+ <reverse>KEY_REWIND</reverse>
+ <volumeplus>KEY_VOLUMEUP</volumeplus>
+ <volumeminus>KEY_VOLUMEDOWN</volumeminus>
+ <pageplus>KEY_CHANNELUP</pageplus>
+ <pageminus>KEY_CHANNELDOWN</pageminus>
+ <skipplus>KEY_NEXT</skipplus>
+ <skipminus>KEY_AGAIN</skipminus>
+ <mute>KEY_MUTE</mute>
+ <power>KEY_POWER</power>
+ <myvideo>KEY_VIDEO</myvideo>
+ <mymusic>KEY_AUDIO</mymusic>
+ <mytv>LiveTV</mytv>
+ <one>KEY_1</one>
+ <two>KEY_2</two>
+ <three>KEY_3</three>
+ <four>KEY_4</four>
+ <five>KEY_5</five>
+ <six>KEY_6</six>
+ <seven>KEY_7</seven>
+ <eight>KEY_8</eight>
+ <nine>KEY_9</nine>
+ <zero>KEY_0</zero>
+ <red>KEY_RED</red>
+ <green>KEY_GREEN</green>
+ <yellow>KEY_YELLOW</yellow>
+ <blue>KEY_BLUE</blue>
+ <menu>KEY_DVD</menu>
+ <clear>KEY_CLEAR</clear>
+ <enter>KEY_ENTER</enter>
</remote>
<remote device="XboxDVDDongle">
View
56 system/keymaps/keyboard.nyxboard.xml
@@ -1,18 +1,19 @@
+<?xml version="1.0"?>
<keymap>
<global>
- <appcommand name="Motorola Nyxboard Hybrid">
- <volume_mute>Mute</volume_mute>
- <volume_down>VolumeDown</volume_down>
+ <appcommand name="Motorola Nyxboard Hybrid">
+ <volume_mute>Mute</volume_mute>
+ <volume_down>VolumeDown</volume_down>
<volume_up>VolumeUp</volume_up>
- <next_track>SkipNext</next_track>
- <prev_track>SkipPrevious</prev_track>
- <stop>Stop</stop>
- <play_pause>Play</play_pause>
- <play>Play</play>
- <pause>Pause</pause>
- <fastforward>FastForward</fastforward>
- <rewind>Rewind</rewind>
- </appcommand>
+ <next_track>SkipNext</next_track>
+ <prev_track>SkipPrevious</prev_track>
+ <stop>Stop</stop>
+ <play_pause>Play</play_pause>
+ <play>Play</play>
+ <pause>Pause</pause>
+ <fastforward>FastForward</fastforward>
+ <rewind>Rewind</rewind>
+ </appcommand>
<mouse name="Motorola Nyxboard Hybrid">
<leftclick>leftclick</leftclick>
<middleclick>middleclick</middleclick>
@@ -23,7 +24,7 @@
<mousedrag>mousedrag</mousedrag>
<mousemove>mousemove</mousemove>
</mouse>
- <keyboard name="Motorola Nyxboard Hybrid">
+ <keyboard name="Motorola Nyxboard Hybrid">
<p>Play</p>
<q>Queue</q>
<f mod="ctrl,shift">FastForward</f>
@@ -39,12 +40,13 @@
<return>Select</return>
<enter>Select</enter>
<backspace>Back</backspace>
- <key id='65446'>Back</key>
+ <key id="65446">Back</key>
<m>ActivateWindow(PlayerControls)</m>
<s>ActivateWindow(shutdownmenu)</s>
<escape>PreviousMenu</escape>
<i>Info</i>
- <f9>Info</f9>
+ <d mod="ctrl">Info</d>
+ <f9>Info</f9>
<menu>ContextMenu</menu>
<c>ContextMenu</c>
<space>Pause</space>
@@ -87,7 +89,7 @@
<prev_track>SkipPrevious</prev_track>
<stop>Stop</stop>
<play_pause>Pause</play_pause>
- <!--
+ <!--
<f3>RED</f3>
<f4>GREEN</f4>
<f5>YELLOW</f5>
@@ -96,7 +98,7 @@
<f12>ActivateSearch</f12>
<f11>CloseSearch</f11>
-->
- <f10>ContextMenu</f10>
+ <f10>ContextMenu</f10>
</keyboard>
</global>
<LoginScreen>
@@ -107,7 +109,7 @@
<Home>
<keyboard name="Motorola Nyxboard Hybrid">
<i>info</i>
- <home>noop</home>
+ <home>noop</home>
<end>XBMC.ShutDown()</end>
</keyboard>
</Home>
@@ -217,7 +219,8 @@
<left>SkipPrevious</left>
<right>SkipNext</right>
<up>IncreaseRating</up>
- <down>DecreaseRating</down> <!--<back>NextPreset</back>!-->
+ <down>DecreaseRating</down>
+ <!--<back>NextPreset</back>!-->
<o>CodecInfo</o>
<l>LockPreset</l>
<escape>FullScreen</escape>
@@ -304,7 +307,8 @@
<VideoOSD>
<keyboard name="Motorola Nyxboard Hybrid">
<m>Back</m>
- <g mod="ctrl">Back</g> <!-- MCE Guide button -->
+ <g mod="ctrl">Back</g>
+ <!-- MCE Guide button -->
<i>Info</i>
<o>CodecInfo</o>
</keyboard>
@@ -322,7 +326,8 @@
<a>AudioDelay</a>
<escape>Fullscreen</escape>
<return>Select</return>
- <enter>Select</enter> <!-- backspace>Fullscreen</backspace -->
+ <enter>Select</enter>
+ <!-- backspace>Fullscreen</backspace -->
</keyboard>
</VideoMenu>
<OSDVideoSettings>
@@ -382,7 +387,7 @@
</Scripts>
<shutdownmenu>
<keyboard name="Motorola Nyxboard Hybrid">
- <s>Back</s>
+ <s>Back</s>
</keyboard>
</shutdownmenu>
<MusicInformation>
@@ -394,6 +399,7 @@
<MovieInformation>
<keyboard name="Motorola Nyxboard Hybrid">
<i>Back</i>
+ <d mod="ctrl">Back</d>
</keyboard>
</MovieInformation>
<PictureInfo>
@@ -406,6 +412,12 @@
<space>Pause</space>
</keyboard>
</PictureInfo>
+ <AddonInformation>
+ <keyboard>
+ <i>Back</i>
+ <d mod="ctrl">Back</d>
+ </keyboard>
+ </AddonInformation>
<Teletext>
<keyboard name="Motorola Nyxboard Hybrid">
<v>Back</v>
View
5 system/keymaps/keyboard.xml
@@ -523,4 +523,9 @@
<i>Back</i>
</keyboard>
</AddonInformation>
+ <AddonSettings>
+ <keyboard>
+ <delete>Delete</delete>
+ </keyboard>
+ </AddonSettings>
</keymap>
View
5 system/keymaps/remote.xml
@@ -538,4 +538,9 @@
<back>PreviousMenu</back>
</remote>
</MyTVSettings>
+ <AddonSettings>
+ <remote>
+ <clear>Delete</clear>
+ </remote>
+ </AddonSettings>
</keymap>
View
1 system/peripherals.xml
@@ -26,5 +26,6 @@
<setting key="cec_mark_inactive_shutdown" type="bool" value="0" label="36010" />
<setting key="standby_pc_on_tv_standby" type="bool" value="1" label="36014" />
<setting key="cec_debug_logging" type="bool" value="0" label="20191" />
+ <setting key="use_tv_menu_language" type="bool" value="1" label="36018" />
</peripheral>
</peripherals>
View
131 tools/EventClients/Clients/PS3 Sixaxis Controller/ps3d.py
@@ -22,33 +22,41 @@
import time
import struct
import threading
+import os
-sys.path.append("../PS3 BD Remote")
-
-try:
- # try loading modules from source directory
+if os.path.exists("../../lib/python"):
+ sys.path.append("../PS3 BD Remote")
sys.path.append("../../lib/python")
from bt.hid import HID
from bt.bt import bt_lookup_name
from xbmcclient import XBMCClient
from ps3 import sixaxis
- from ps3.keymaps import keymap_sixaxis
from ps3_remote import process_keys as process_remote
try:
+ from ps3 import sixwatch
+ except Exception, e:
+ print "Failed to import sixwatch now disabled: " + str(e)
+ sixwatch = None
+
+ try:
import zeroconf
except:
zeroconf = None
ICON_PATH = "../../icons/"
-except:
+else:
# fallback to system wide modules
from xbmc.bt.hid import HID
from xbmc.bt.bt import bt_lookup_name
from xbmc.xbmcclient import XBMCClient
from xbmc.ps3 import sixaxis
- from xbmc.ps3.keymaps import keymap_sixaxis
from xbmc.ps3_remote import process_keys as process_remote
from xbmc.defs import *
try:
+ from xbmc.ps3 import sixwatch
+ except Exception, e:
+ print "Failed to import sixwatch now disabled: " + str(e)
+ sixwatch = None
+ try:
import xbmc.zeroconf as zeroconf
except:
zeroconf = None
@@ -110,21 +118,6 @@ def timed_out(self):
else:
return False
-# to make sure all combination keys are checked first
-# we sort the keymap's button codes in reverse order
-# this guranties that any bit combined button code
-# will be processed first
-keymap_sixaxis_keys = keymap_sixaxis.keys()
-keymap_sixaxis_keys.sort()
-keymap_sixaxis_keys.reverse()
-
-def getkeys(bflags):
- keys = [];
- for k in keymap_sixaxis_keys:
- if (k & bflags) == k:
- keys.append(k)
- bflags = bflags & ~k
- return keys;
class PS3SixaxisThread ( StoppableThread ):
def __init__(self, csock, isock, ipaddr="127.0.0.1"):
@@ -135,86 +128,26 @@ def __init__(self, csock, isock, ipaddr="127.0.0.1"):
self.set_timeout(600)
def run(self):
- sixaxis.initialize(self.csock, self.isock)
+ six = sixaxis.sixaxis(self.xbmc, self.csock, self.isock)
self.xbmc.connect()
- bflags = 0
- released = set()
- pressed = set()
- pending = set()
- held = set()
- psflags = 0
- psdown = 0
- toggle_mouse = 0
self.reset_timeout()
try:
while not self.stop():
- if self.timed_out():
-
- for key in (held | pressed):
- (mapname, action, amount, axis) = keymap_sixaxis[key]
- self.xbmc.send_button_state(map=mapname, button=action, amount=0, down=0, axis=axis)
+ if self.timed_out():
raise Exception("PS3 Sixaxis powering off, timed out")
if self.idle_time() > 50:
self.xbmc.connect()
try:
- data = sixaxis.read_input(self.isock)
+ if six.process_socket(self.isock):
+ self.reset_timeout()
except Exception, e:
- print str(e)
+ print e
break
- if not data:
- continue
-
- (bflags, psflags, pressure, analog) = sixaxis.process_input(data, self.xbmc, toggle_mouse)
-
- if analog:
- self.reset_timeout()
-
- if psflags:
- self.reset_timeout()
- if psdown:
- if (time.time() - psdown) > 5:
-
- for key in (held | pressed):
- (mapname, action, amount, axis) = keymap_sixaxis[key]
- self.xbmc.send_button_state(map=mapname, button=action, amount=0, down=0, axis=axis)
-
- raise Exception("PS3 Sixaxis powering off, user request")
- else:
- psdown = time.time()
- else:
- if psdown:
- toggle_mouse = 1 - toggle_mouse
- psdown = 0
-
- keys = set(getkeys(bflags))
- released = (pressed | held) - keys
- held = (pressed | held) - released
- pressed = (keys - held) & pending
- pending = (keys - held)
-
- for key in released:
- (mapname, action, amount, axis) = keymap_sixaxis[key]
- self.xbmc.send_button_state(map=mapname, button=action, amount=0, down=0, axis=axis)
-
- for key in held:
- (mapname, action, amount, axis) = keymap_sixaxis[key]
- if amount > 0:
- amount = pressure[amount-1] * 256
- self.xbmc.send_button_state(map=mapname, button=action, amount=amount, down=1, axis=axis)
-
- for key in pressed:
- (mapname, action, amount, axis) = keymap_sixaxis[key]
- if amount > 0:
- amount = pressure[amount-1] * 256
- self.xbmc.send_button_state(map=mapname, button=action, amount=amount, down=1, axis=axis)
-
- if keys:
- self.reset_timeout()
-
except Exception, e:
printerr()
+ six.close()
self.close_sockets()
@@ -229,7 +162,6 @@ def __init__(self, csock, isock, ipaddr="127.0.0.1"):
self.current_xbmc = 0
def run(self):
- sixaxis.initialize(self.csock, self.isock)
self.xbmc.connect()
try:
# start the zeroconf thread if possible
@@ -314,6 +246,18 @@ def zeroconf_service_handler(self, event, service):
pass
return
+class SixWatch(threading.Thread):
+ def __init__(self, mac):
+ threading.Thread.__init__(self)
+ self.mac = mac
+ self.daemon = True
+ self.start()
+ def run(self):
+ try:
+ sixwatch.main(self.mac)
+ except Exception, e:
+ print "Exception caught in sixwatch, aborting: " + str(e)
+ pass
class ZeroconfThread ( threading.Thread ):
"""
@@ -373,6 +317,15 @@ def start_hidd(bdaddr=None, ipaddr="127.0.0.1"):
devices = [ 'PLAYSTATION(R)3 Controller',
'BD Remote Control' ]
hid = HID(bdaddr)
+ watch = None
+ if sixwatch:
+ try:
+ print "Starting USB sixwatch"
+ watch = SixWatch(hid.get_local_address())
+ except Exception, e:
+ print "Failed to initialize sixwatch" + str(e)
+ pass
+
while True:
if hid.listen():
(csock, addr) = hid.get_control_socket()
View
10 tools/EventClients/lib/python/bt/hid.py
@@ -16,6 +16,9 @@
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from bluetooth import *
+import fcntl
+import bluetooth._bluetooth as _bt
+import array
class HID:
def __init__(self, bdaddress=None):
@@ -56,6 +59,13 @@ def listen(self):
self.connected = False
return False
+ def get_local_address(self):
+ hci = BluetoothSocket( HCI )
+ fd = hci.fileno()
+ buf = array.array('B', [0] * 96)
+ fcntl.ioctl(fd, _bt.HCIGETDEVINFO, buf, 1)
+ data = struct.unpack_from("H8s6B", buf.tostring())
+ return data[2:8][::-1]
def get_control_socket(self):
if self.connected:
View
54 tools/EventClients/lib/python/ps3/keymaps.py
@@ -79,57 +79,3 @@
"39": 'pause' ,#PAUSE
}
-
-SX_SQUARE = 32768
-SX_X = 16384
-SX_CIRCLE = 8192
-SX_TRIANGLE = 4096
-SX_R1 = 2048
-SX_R2 = 512
-SX_R3 = 4
-SX_L1 = 1024
-SX_L2 = 256
-SX_L3 = 2
-SX_DUP = 16
-SX_DDOWN = 64
-SX_DLEFT = 128
-SX_DRIGHT = 32
-SX_SELECT = 1
-SX_START = 8
-
-SX_LSTICK_X = 0
-SX_LSTICK_Y = 1
-SX_RSTICK_X = 2
-SX_RSTICK_Y = 3
-
-# (map, key, amount index, axis)
-keymap_sixaxis = {
- SX_X : ('XG', 'A', 0, 0),
- SX_CIRCLE : ('XG', 'B', 0, 0),
- SX_SQUARE : ('XG', 'X', 0, 0),
- SX_TRIANGLE : ('XG', 'Y', 0, 0),
-
- SX_DUP : ('XG', 'dpadup', 0, 0),
- SX_DDOWN : ('XG', 'dpaddown', 0, 0),
- SX_DLEFT : ('XG', 'dpadleft', 0, 0),
- SX_DRIGHT : ('XG', 'dpadright', 0, 0),
-
- SX_START : ('XG', 'start', 0, 0),
- SX_SELECT : ('XG', 'back', 0, 0),
-
- SX_R1 : ('XG', 'white', 0, 0),
- SX_R2 : ('XG', 'rightanalogtrigger', 6, 1),
- SX_L2 : ('XG', 'leftanalogtrigger', 5, 1),
- SX_L1 : ('XG', 'black', 0, 0),
-
- SX_L3 : ('XG', 'leftthumbbutton', 0, 0),
- SX_R3 : ('XG', 'rightthumbbutton', 0, 0),
-}
-
-# (data index, left map, left action, right map, right action)
-axismap_sixaxis = {
- SX_LSTICK_X : ('XG', 'leftthumbstickleft' , 'leftthumbstickright'),
- SX_LSTICK_Y : ('XG', 'leftthumbstickup' , 'leftthumbstickdown'),
- SX_RSTICK_X : ('XG', 'rightthumbstickleft', 'rightthumbstickright'),
- SX_RSTICK_Y : ('XG', 'rightthumbstickup' , 'rightthumbstickdown'),
-}
View
232 tools/EventClients/lib/python/ps3/sixaxis.py
@@ -23,16 +23,78 @@
import math
import binascii
from bluetooth import set_l2cap_mtu
-from keymaps import keymap_sixaxis
-from keymaps import axismap_sixaxis
-xval = 0
-yval = 0
-num_samples = 16
-sumx = [0] * num_samples
-sumy = [0] * num_samples
-sumr = [0] * num_samples
-axis_amount = [0, 0, 0, 0]
+SX_SELECT = 1 << 0
+SX_L3 = 1 << 1
+SX_R3 = 1 << 2
+SX_START = 1 << 3
+SX_DUP = 1 << 4
+SX_DRIGHT = 1 << 5
+SX_DDOWN = 1 << 6
+SX_DLEFT = 1 << 7
+SX_L2 = 1 << 8
+SX_R2 = 1 << 9
+SX_L1 = 1 << 10
+SX_R1 = 1 << 11
+SX_TRIANGLE = 1 << 12
+SX_CIRCLE = 1 << 13
+SX_X = 1 << 14
+SX_SQUARE = 1 << 15
+SX_POWER = 1 << 16
+
+SX_LSTICK_X = 0
+SX_LSTICK_Y = 1
+SX_RSTICK_X = 2
+SX_RSTICK_Y = 3
+
+# (map, key, amount index, axis)
+keymap_sixaxis = {
+ SX_X : ('XG', 'A', 0, 0),
+ SX_CIRCLE : ('XG', 'B', 0, 0),
+ SX_SQUARE : ('XG', 'X', 0, 0),
+ SX_TRIANGLE : ('XG', 'Y', 0, 0),
+
+ SX_DUP : ('XG', 'dpadup', 0, 0),
+ SX_DDOWN : ('XG', 'dpaddown', 0, 0),
+ SX_DLEFT : ('XG', 'dpadleft', 0, 0),
+ SX_DRIGHT : ('XG', 'dpadright', 0, 0),
+
+ SX_START : ('XG', 'start', 0, 0),
+ SX_SELECT : ('XG', 'back', 0, 0),
+
+ SX_R1 : ('XG', 'white', 0, 0),
+ SX_R2 : ('XG', 'rightanalogtrigger', 6, 1),
+ SX_L2 : ('XG', 'leftanalogtrigger', 5, 1),
+ SX_L1 : ('XG', 'black', 0, 0),
+
+ SX_L3 : ('XG', 'leftthumbbutton', 0, 0),
+ SX_R3 : ('XG', 'rightthumbbutton', 0, 0),
+}
+
+# (data index, left map, left action, right map, right action)
+axismap_sixaxis = {
+ SX_LSTICK_X : ('XG', 'leftthumbstickleft' , 'leftthumbstickright'),
+ SX_LSTICK_Y : ('XG', 'leftthumbstickup' , 'leftthumbstickdown'),
+ SX_RSTICK_X : ('XG', 'rightthumbstickleft', 'rightthumbstickright'),
+ SX_RSTICK_Y : ('XG', 'rightthumbstickup' , 'rightthumbstickdown'),
+}
+
+# to make sure all combination keys are checked first
+# we sort the keymap's button codes in reverse order
+# this guranties that any bit combined button code
+# will be processed first
+keymap_sixaxis_keys = keymap_sixaxis.keys()
+keymap_sixaxis_keys.sort()
+keymap_sixaxis_keys.reverse()
+
+def getkeys(bflags):
+ keys = [];
+ for k in keymap_sixaxis_keys:
+ if (k & bflags) == k:
+ keys.append(k)
+ bflags = bflags & ~k
+ return keys;
+
def normalize(val):
upperlimit = 65281
@@ -80,16 +142,44 @@ def normalize_angle(val, valrange):
val = -1.0
return (val + 0.5) * 65535.0
-def initialize(control_sock, interrupt_sock):
+def average(array):
+ val = 0
+ for i in array:
+ val += i
+ return val / len(array)
+
+def smooth(arr, val):
+ cnt = len(arr)
+ arr.insert(0, val)
+ arr.pop(cnt)
+ return average(arr)
+
+class sixaxis():
+ def __init__(self, xbmc, control_sock, interrupt_sock):
+
+ self.xbmc = xbmc
+ self.num_samples = 16
+ self.sumx = [0] * self.num_samples
+ self.sumy = [0] * self.num_samples
+ self.sumr = [0] * self.num_samples
+ self.axis_amount = [0, 0, 0, 0]
+
+ self.released = set()
+ self.pressed = set()
+ self.pending = set()
+ self.held = set()
+ self.psflags = 0
+ self.psdown = 0
+ self.mouse_enabled = 0
+
+ set_l2cap_mtu(control_sock, 64)
+ set_l2cap_mtu(interrupt_sock, 64)
+ time.sleep(0.25) # If we ask to quickly here, it sometimes doesn't start
+
# sixaxis needs this to enable it
# 0x53 => HIDP_TRANS_SET_REPORT | HIDP_DATA_RTYPE_FEATURE
control_sock.send("\x53\xf4\x42\x03\x00\x00")
- time.sleep(0.25)
data = control_sock.recv(1)
-
- set_l2cap_mtu(control_sock, 64)
- set_l2cap_mtu(interrupt_sock, 64)
-
# This command will turn on the gyro and set the leds
# I wonder if turning on the gyro makes it draw more current??
# it's probably a flag somewhere in the following command
@@ -116,24 +206,34 @@ def initialize(control_sock, interrupt_sock):
bytes.extend([0x00, 0x00, 0x00, 0x00, 0x00])
control_sock.send(struct.pack("42B", *bytes))
- time.sleep(0.25)
data = control_sock.recv(1)
+ def __del__(self):
+ self.close()
- return data
+ def close(self):
+ for key in (self.held | self.pressed):
+ (mapname, action, amount, axis) = keymap_sixaxis[key]
+ self.xbmc.send_button_state(map=mapname, button=action, amount=0, down=0, axis=axis)
+ self.held = set()
+ self.pressed = set()
-def read_input(isock):
- return isock.recv(50)
+ def process_socket(self, isock):
+ data = isock.recv(50)
+ if data == None:
+ return False
+ return self.process_data(data)
-def process_input(data, xbmc=None, mouse_enabled=0):
+
+ def process_data(self, data):
if len(data) < 3:
- return (0, 0, 0, False)
+ return False
# make sure this is the correct report
if struct.unpack("BBB", data[0:3]) != (0xa1, 0x01, 0x00):
- return (0, 0, 0, False)
+ return False
if len(data) >= 48:
v1 = struct.unpack("h", data[42:44])
@@ -155,8 +255,7 @@ def process_input(data, xbmc=None, mouse_enabled=0):
rz = float(v4[0])
at = math.sqrt(ax*ax + ay*ay + az*az)
- bflags = struct.unpack("H", data[3:5])[0]
- psflags = struct.unpack("B", data[5:6])[0]
+ bflags = struct.unpack("<I", data[3:7])[0]
if len(data) > 27:
pressure = struct.unpack("BBBBBBBBBBBB", data[15:27])
else:
@@ -169,39 +268,72 @@ def process_input(data, xbmc=None, mouse_enabled=0):
xpos = normalize_angle(roll, math.radians(30))
ypos = normalize_angle(pitch, math.radians(30))
+
- # update our sliding window array
- sumx.insert(0, xpos)
- sumy.insert(0, ypos)
- sumx.pop(num_samples)
- sumy.pop(num_samples)
+ axis = struct.unpack("BBBB", data[7:11])
+ return self.process_input(bflags, pressure, axis, xpos, ypos)
- # reset average
- xval = 0
- yval = 0
+ def process_input(self, bflags, pressure, axis, xpos, ypos):
- # do a sliding window average to remove high frequency
- # noise in accelerometer sampling
- for i in range(0, num_samples):
- xval += sumx[i]
- yval += sumy[i]
+ xval = smooth(self.sumx, xpos)
+ yval = smooth(self.sumy, ypos)
analog = False
- axis = struct.unpack("BBBB", data[7:11])
- if xbmc:
- for i in range(4):
+ for i in range(4):
config = axismap_sixaxis[i]
- axis_amount[i] = send_singleaxis(xbmc, axis[i], axis_amount[i], config[0], config[1], config[2])
- if axis_amount[i] != 0:
- analog = True
+ self.axis_amount[i] = self.send_singleaxis(axis[i], self.axis_amount[i], config[0], config[1], config[2])
+ if self.axis_amount[i] != 0:
+ analog = True
+
+ # send the mouse position to xbmc
+ if self.mouse_enabled == 1:
+ self.xbmc.send_mouse_position(xval, yval)
- # send the mouse position to xbmc
- if mouse_enabled == 1:
- xbmc.send_mouse_position(xval/num_samples, yval/num_samples)
+ if (bflags & SX_POWER) == SX_POWER:
+ if self.psdown:
+ if (time.time() - self.psdown) > 5:
+
+ for key in (self.held | self.pressed):
+ (mapname, action, amount, axis) = keymap_sixaxis[key]
+ self.xbmc.send_button_state(map=mapname, button=action, amount=0, down=0, axis=axis)
+
+ raise Exception("PS3 Sixaxis powering off, user request")
+ else:
+ self.psdown = time.time()
+ else:
+ if self.psdown:
+ self.mouse_enabled = 1 - self.mouse_enabled
+ self.psdown = 0
+
+ keys = set(getkeys(bflags))
+ self.released = (self.pressed | self.held) - keys
+ self.held = (self.pressed | self.held) - self.released
+ self.pressed = (keys - self.held) & self.pending
+ self.pending = (keys - self.held)
+
+ for key in self.released:
+ (mapname, action, amount, axis) = keymap_sixaxis[key]
+ self.xbmc.send_button_state(map=mapname, button=action, amount=0, down=0, axis=axis)
+
+ for key in self.held:
+ (mapname, action, amount, axis) = keymap_sixaxis[key]
+ if amount > 0:
+ amount = pressure[amount-1] * 256
+ self.xbmc.send_button_state(map=mapname, button=action, amount=amount, down=1, axis=axis)
+
+ for key in self.pressed:
+ (mapname, action, amount, axis) = keymap_sixaxis[key]
+ if amount > 0:
+ amount = pressure[amount-1] * 256
+ self.xbmc.send_button_state(map=mapname, button=action, amount=amount, down=1, axis=axis)
+
+ if analog or keys or self.mouse_enabled:
+ return True
+ else:
+ return False
- return (bflags, psflags, pressure, analog)
-def send_singleaxis(xbmc, axis, last_amount, mapname, action_min, action_pos):
+ def send_singleaxis(self, axis, last_amount, mapname, action_min, action_pos):
amount = normalize_axis(axis, 0.30)
if last_amount < 0:
last_action = action_min
@@ -218,9 +350,9 @@ def send_singleaxis(xbmc, axis, last_amount, mapname, action_min, action_pos):
new_action = None
if last_action and new_action != last_action:
- xbmc.send_button_state(map=mapname, button=last_action, amount=0, axis=1)
+ self.xbmc.send_button_state(map=mapname, button=last_action, amount=0, axis=1)
if new_action and amount != last_amount:
- xbmc.send_button_state(map=mapname, button=new_action, amount=abs(amount), axis=1)
+ self.xbmc.send_button_state(map=mapname, button=new_action, amount=abs(amount), axis=1)
return amount
View
114 tools/EventClients/lib/python/ps3/sixpair.py
@@ -0,0 +1,114 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+import sys
+import usb
+
+vendor = 0x054c
+product = 0x0268
+timeout = 5000
+passed_value = 0x03f5