01-31-2011, 06:06 AM | #1 |
Junior Member
Posts: 8
Karma: 10
Join Date: Jan 2011
Device: kindle 3
|
cross-compiling gstreamer for the kindle3
hi all,
I'm interested in playing mp3/asf streams over the network (for streaming live bbc and various mp3 podcasts for example). After toying with mplayer, vlc, deadbeef and being slightly overwhelmed by their dependencies (ok, deadbeef is not so bad) I came acrosss gstreamer and its crazy modular pipeline, which is already on the kindle. great! Predictably the kindle's playbin module only supports playing from files. Code:
gst-launch playbin uri=file:///path/to/file.mp3 No URI handler for http I used NiLuJe's invaluable x-compile logs to get a working cross compile toolchain (managed to compile and run netcat with the -e option so it seems to work--more on that in another post). Thanks NiLuJe!!. I have my build environment installed in a vbox guest running ubuntu maverick. I downloaded amazon's sources to make sure I had the right versions and set about compiling gstreamer-0.10.17. After some battling I managed to get alsa-lib-1.0.13, glib-2.22, libxml2-2.7.8 (NOT an amazon source but gstreamer complained it needed it before configure would complete to I obliged). Whether any of these will actually work on the kindle remains to be seen At some point in the gstreamer build process it dies with this error: Code:
arm-kindle-linux-gnueabi-gcc -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -fno-stack-protector -U_FORTIFY_SOURCE -o .libs/gst-xmllaunch-0.10 -pthread gst_xmllaunch_0.10-gst-launch.o -L/home/kindle/lib ../gst/.libs/libgstreamer-0.10.so /home/kindle/lib/libgobject-2.0.so /home/kindle/lib/libgthread-2.0.so /home/kindle/lib/libgmodule-2.0.so /home/kindle/lib/libglib-2.0.so -lrt -Wl,--rpath -Wl,/home/kindle/lib gst_xmllaunch_0.10-gst-launch.o: In function `main': /home/dent/build/gstreamer/gstreamer-0.10.17/tools/gst-launch.c:662: undefined reference to `g_malloc0_n' ../gst/.libs/libgstreamer-0.10.so: undefined reference to `g_realloc_n' ../gst/.libs/libgstreamer-0.10.so: undefined reference to `g_malloc_n' collect2: ld returned 1 exit status make[2]: *** [gst-xmllaunch-0.10] Error 1 make[2]: Leaving directory `/home/dent/build/gstreamer/gstreamer-0.10.17/tools' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/home/dent/build/gstreamer/gstreamer-0.10.17' make: *** [all] Error 2 It looks like gstreamer-0.10.17/tools/gst-launch.c is using g_malloc0_n in a few places. Looking at glib's docs though I see that that function (and g_realloc_n and g_malloc_n) were introduced in glib-2.24. So it seems reasonable my cross compiled glib-2.22 doesn't define them as confirmed by: Code:
nm /home/kindle/lib/libglib-2.0.so.0 | grep g_malloc 0003e750 t IA__g_malloc 0003e6b0 t IA__g_malloc0 0003e750 T g_malloc 0003e6b0 T g_malloc0 Does this mean:
For reference, i configured gstreamer with: Code:
CFLAGS="-fno-stack-protector -U_FORTIFY_SOURCE" CXXFLAGS="-fno-stack-protector -U_FORTIFY_SOURCE" CPPFLAGS=-I/home/kindle/include LDFLAGS=-L/home/kindle/lib ./configure --prefix=/home/kindle --build=i686-linux-gnu --host=arm-kindle-linux-gnueabi --disable-nls --disable-examples --disable-valgrind --disable-failing-tests --without-libiconv-prefix --without-libintl-prefix dent Last edited by dent; 01-31-2011 at 01:42 PM. Reason: fix typo |
01-31-2011, 10:51 PM | #2 |
Junior Member
Posts: 5
Karma: 12
Join Date: Nov 2010
Location: Aberystwyth, UK
Device: Kindle 3 (3G)
|
Someone else ran into this problem in ##kindle (on irc.freenode.net) a few days ago, as I recall the issue was that it was picking up the host environment's include files because pkg-config was still looking in the normal places for its configuration files. The fix was simply to point PKG_CONFIG_PATH and PKG_CONFIG_LIBDIR to the pkgconfig directory in the cross-compilation environment.
Last edited by Elleo; 01-31-2011 at 11:29 PM. Reason: Added detail for ##kindle |
Advert | |
|
02-01-2011, 03:05 PM | #3 |
Junior Member
Posts: 8
Karma: 10
Join Date: Jan 2011
Device: kindle 3
|
Thanks a lot for the pointer Elleo, I'll have a look into it and report back
As a quick workaround, I managed to stream bbcworld using Code:
wget -O - http://mp32.bbc.streamuk.com | gst-launch playbin uri=fd://0 |
02-02-2011, 05:01 PM | #4 |
Member
Posts: 13
Karma: 13156
Join Date: Feb 2011
Device: Kindle Paperwhite
|
Out of curiosity, where do you get the Kindle cross-compiler? I haven't been able to find it elsewhere.
|
02-02-2011, 05:31 PM | #5 |
Connoisseur
Posts: 56
Karma: 74
Join Date: Oct 2010
Device: Kindle 3
|
|
Advert | |
|
02-02-2011, 06:17 PM | #6 |
Member
Posts: 13
Karma: 13156
Join Date: Feb 2011
Device: Kindle Paperwhite
|
That looks good, but it appears to be a compiler on the kindle rather than a cross-compiler on the desktop. I'm looking for the arm-kindle-linux-gnueabi-gcc in the OP.
|
02-03-2011, 09:44 AM | #7 |
Junior Member
Posts: 8
Karma: 10
Join Date: Jan 2011
Device: kindle 3
|
hey alethiophile,
see the downloads from NiLuJe in the jailbreak thread here. One of them (i think it's the last one, x-tc) contains a file called x-compile which is a log of his cross-compilation session including some small patches you have to apply to get the cross-compiler built. fwiw, i built crosstool-ng 1.9.3 (NiLuJe used 1.9.0). I see now that 1.10 was released a few days ago. |
02-03-2011, 07:40 PM | #8 |
Member
Posts: 13
Karma: 13156
Join Date: Feb 2011
Device: Kindle Paperwhite
|
Thanks.
|
02-03-2011, 08:45 PM | #9 |
Junior Member
Posts: 3
Karma: 27344
Join Date: Feb 2011
Device: Kindle 3
|
If you elevate permissions you can also play URLs from inside a Kindlet, using the reflection technique described here: https://www.mobileread.com/forums/sho...79&postcount=4
Here is a method that plays a mp3 from a URL. Setting up callbacks should be possible, although tedious, using reflection. Code:
private void playAudioFromUrlWrapper (final URL url) { setDescription("Initiating connection"); final ConnectivityHandler handler = new ConnectivityHandler() { public void connected() { try { playAudioFromUrl(url); } catch (IllegalStateException ise) { ise.printStackTrace(); } } public void disabled(NetworkDisabledDetails details) { ; } }; context.getConnectivity().submitSingleAttemptConnectivityRequest(handler, true); } private void playAudioFromUrl (URL url) { Class contextClass = context.getClass(); Method[] methods = contextClass.getDeclaredMethods(); Method audioMethod = methods[1]; Object audioManagerObject; Class audioManagerClass; try { audioManagerObject = audioMethod.invoke(context, new Object[0]); audioManagerClass = audioManagerObject.getClass(); Method[] audioManagerMethods = audioManagerClass.getDeclaredMethods(); Method createAudioPlayerMethod = audioManagerMethods[10]; Class mediaSourceClass = createAudioPlayerMethod.getParameterTypes()[0]; Constructor[] mediaSourceConstructors = mediaSourceClass.getConstructors(); //Constructor mediaSourceInputStreamConstructor = mediaSourceConstructors[3]; Constructor mediaSourceUrlConstructor = mediaSourceConstructors[1]; Object[] mediaSourceArgs = new Object[1]; mediaSourceArgs[0] = url; Object mediaSourceObject = mediaSourceUrlConstructor.newInstance(mediaSourceArgs); Object[] createAudioPlayerArgs = new Object[1]; createAudioPlayerArgs[0] = mediaSourceObject; Object audioObject = createAudioPlayerMethod.invoke(audioManagerObject, createAudioPlayerArgs); Class audioClass = audioObject.getClass(); Method[] audioMethods = audioClass.getDeclaredMethods(); Method playMethod = audioMethods[12]; playMethod.invoke(audioObject, new Object[0]); } catch (IllegalArgumentException e1) { e1.printStackTrace(); } catch (IllegalAccessException e1) { e1.printStackTrace(); } catch (InvocationTargetException e1) { e1.printStackTrace(); } catch (InstantiationException e1) { e1.printStackTrace(); } } |
02-04-2011, 08:39 AM | #10 |
Junior Member
Posts: 5
Karma: 10
Join Date: Jan 2011
Device: Kindle 3g
|
btw: i was also looking for gcc for kindle, I have found this post: http://www.linuxforums.org/forum/mis...ols-arm11.html , but i didnt managed to compile gcc for arm11...
|
Tags |
cross-compile, gstreamer, kindle 3g |
Thread Tools | Search this Thread |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
compiling fbreader for pocketbook | Almiel | PocketBook | 9 | 08-09-2010 06:18 PM |
Problems compiling | unkilbeeg | Sigil | 1 | 09-13-2009 01:49 PM |
iLiad Please, help me with simple compiling first steps | Sunn Sunn | iRex Developer's Corner | 7 | 07-22-2008 04:11 PM |
iLiad compiling Minimo | jtq | iRex Developer's Corner | 11 | 09-03-2007 05:33 AM |
PRS-500 Compiling for the Reader | alex_d | Sony Reader Dev Corner | 29 | 07-15-2007 12:29 PM |