Pointers are strictly "more powerful" than references; anything you can do with references you can do with pointers, but not vice versa. I imagine that's why there are no references in C -- it's a deliberately austere and powerful language.
http://blogs.msdn.com/b/ericlippert/archive/2009/02/17/references-are-not-addresses.aspx
Thursday, January 19, 2012
Gstreamer Plugin Development(Android)
A simple gst plugin can be developed from the below links
http://lca2007.linux.org.au/talk/272.html
http://gstreamer.freedesktop.org/data/doc/gstreamer/head/pwg/html/part-building.html
once we are able to develop plugins for linux, we should also able to develop for android...
I managed to develop plugin for android by writing Android.mk and was able to see the boilerplate details... but still stuck up with my element registration with the plugin...
Tried to debug using remote gdb and found some memory access violation errors. Since I am using emulator... there are differences between the shared objects in emulator and in NDK.. so have to try in dev...
http://lca2007.linux.org.au/talk/272.html
http://gstreamer.freedesktop.org/data/doc/gstreamer/head/pwg/html/part-building.html
once we are able to develop plugins for linux, we should also able to develop for android...
I managed to develop plugin for android by writing Android.mk and was able to see the boilerplate details... but still stuck up with my element registration with the plugin...
Tried to debug using remote gdb and found some memory access violation errors. Since I am using emulator... there are differences between the shared objects in emulator and in NDK.. so have to try in dev...
Wednesday, January 18, 2012
using gdbserver on android emulator
modify your Android.mk add below command "LOCAL_CPPFLAGS += -g" for C++ files and "LOCAL_CFLAGS += -G" FOR C files.
rebuild your library and system image(if necessary)
2. in your local system redirect the debug port
$ telnet localhost 5554
redir add tcp:1234:1234
exit
3.you can start emulator by below command with debug port redirected.
./emulator -avd avdname -qemu -redir udp:1234::1234
4. push gdbserver to emulator
adb push ./out/target/product/generic/obj/EXECUTABLES/gdbserver_intermediates/gdbserver /system/bin/
5. run # gdbserver :1234 --attach your-desired-pid or gdbserver :1234 desired_process
6. run ./prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin/arm-eabi-gdb ./out/target/product/generic/symbols/system/bin/app_process
7. in gdb-terminal
gdb>set solib-search-path out/target/product/generic/symbols/system/lib
In case there are multiple library paths to be searched, use ':' to concatenate the paths
gdb>target remote localhost:1234
8. Now you can see the Errors .... Happy remote Debugging!!!!
Common Error:
Malformed packet(b) (missing colon): re:0;
Packet: 'T050b:00000000;0d:c03ecebe;0f:b0070040;thread:4ab;core:0;'
This means the gdbserver and gdb in localhost are not compatible!!
Sunday, January 15, 2012
linux-android cross-compiling EGL surafce
Here is a simple HelloWorld EGL prog tat creates android window and displays openGL ES Surface
Here is a Android.mk file for cross compiling this with NDK
LOCAL_PATH:=$(call my-dir)
include $(CLEAR_VARS)
LOCAL_ARM_MODE:=arm
LOCAL_MODULE:=mini
LOCAL_SRC_FILES:=main.c
LOCAL_MODULE_TAGS:=eng debug
LD_LIBRARY_PATH:=/home/shivram/android-ndk-r6b/platforms/android-14/arch-arm/usr/lib
LOCAL_LDLIBS:=\
-L/home/shivram/android-ndk-r6b/platforms/android-14/arch-arm/usr/lib \
-lEGL \
-ldl \
-lsurfaceflinger \
-lhardware \
-lhardware_legacy \
-lpixelflinger \
-lwpa_client \
-lemoji \
-lnetutils \
-ljpeg \
-lc \
-llog \
-lexpat \
-lskia \
-lui \
-lcutils \
-lutils \
-lbinder \
-lsurfaceflinger_client \
-lGLESv1_CM
LD:=/home/shivram/android-ndk-r6b/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-ld
LOCAL_SHARED_LIBRARIES:=\
EGL \
GLESv1_CM
LOCAL_CFLAGS := \
-DHAVE_CONFIG_H \
-I/home/shivram/android-ndk-r6b/platforms/android-14/arch-arm/usr/include \
-I/home/shivram/android-ndk-r6b/platforms/android-14/arch-arm/usr/include/EGL \
-I/home/shivram/android-ndk-r6b/platforms/android-14/arch-arm/usr/include/GLES \
-DG_THREADS_MANDATORY \
-DG_DISABLE_DEPRECATED \
-Wall \
-Wdeclaration-after-statement \
-Wvla \
-Wpointer-arith \
-Wmissing-declarations \
-Wmissing-prototypes \
-Wredundant-decls \
-Wundef \
-Wwrite-strings \
-Wformat-nonliteral \
-Wformat-security \
-Wold-style-definition \
-Winit-self \
-Wmissing-include-dirs \
-Waddress \
-Waggregate-return \
-Wno-multichar \
-Wnested-externs \
-g \
-nostdlib \
-Bdynamic \
-Wl,-dynamic-linker,/system/bin/linker \
-Wl,--gc-sections \
-Wl,-z,nocopyreloc \
-DGST_DISABLE_DEPRECATED
include $(BUILD_EXECUTABLE)
When we try to compile this.. we get... undefined reference to some pthread functions
http://jiggawatt.org/badc0de/android/
(main.c)
Here is a Android.mk file for cross compiling this with NDK
LOCAL_PATH:=$(call my-dir)
include $(CLEAR_VARS)
LOCAL_ARM_MODE:=arm
LOCAL_MODULE:=mini
LOCAL_SRC_FILES:=main.c
LOCAL_MODULE_TAGS:=eng debug
LD_LIBRARY_PATH:=/home/shivram/android-ndk-r6b/platforms/android-14/arch-arm/usr/lib
LOCAL_LDLIBS:=\
-L/home/shivram/android-ndk-r6b/platforms/android-14/arch-arm/usr/lib \
-lEGL \
-ldl \
-lsurfaceflinger \
-lhardware \
-lhardware_legacy \
-lpixelflinger \
-lwpa_client \
-lemoji \
-lnetutils \
-ljpeg \
-lc \
-llog \
-lexpat \
-lskia \
-lui \
-lcutils \
-lutils \
-lbinder \
-lsurfaceflinger_client \
-lGLESv1_CM
LD:=/home/shivram/android-ndk-r6b/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-ld
LOCAL_SHARED_LIBRARIES:=\
EGL \
GLESv1_CM
LOCAL_CFLAGS := \
-DHAVE_CONFIG_H \
-I/home/shivram/android-ndk-r6b/platforms/android-14/arch-arm/usr/include \
-I/home/shivram/android-ndk-r6b/platforms/android-14/arch-arm/usr/include/EGL \
-I/home/shivram/android-ndk-r6b/platforms/android-14/arch-arm/usr/include/GLES \
-DG_THREADS_MANDATORY \
-DG_DISABLE_DEPRECATED \
-Wall \
-Wdeclaration-after-statement \
-Wvla \
-Wpointer-arith \
-Wmissing-declarations \
-Wmissing-prototypes \
-Wredundant-decls \
-Wundef \
-Wwrite-strings \
-Wformat-nonliteral \
-Wformat-security \
-Wold-style-definition \
-Winit-self \
-Wmissing-include-dirs \
-Waddress \
-Waggregate-return \
-Wno-multichar \
-Wnested-externs \
-g \
-nostdlib \
-Bdynamic \
-Wl,-dynamic-linker,/system/bin/linker \
-Wl,--gc-sections \
-Wl,-z,nocopyreloc \
-DGST_DISABLE_DEPRECATED
include $(BUILD_EXECUTABLE)
When we try to compile this.. we get... undefined reference to some pthread functions

To resolve this, the key is to write a wrapper or define those missing functions in ur (main.c) code ;)
Friday, January 13, 2012
Building GStreamer for Android
http://gstreamer.freedesktop.org/wiki/GstreamerAndroid_InstallInstructions
1)Best use NDKr6b(copy the platform[android-14])
2) ICS-src/bionic/linker/linker.c --> SO_MAX 128 --> +62 needed --> Maximum number of shared objects tat can be loaded at a time should be increased and Android Src must be recompiled
3)GST_REGISTRY_UPDATE=yes
4)GST_REGISTRY=/data/data/com.android.freedesktop.gstreamer/cache/registry.bin
5)GST_PLUGIN_PATH=/data/data/com.android.freedesktop.gstreamer/lib
6)GST_PLUGIN_SCANNER=/data/data/com.android.freedesktop.gstreamer/bin/gst-plugin-scanner
7) Better Copy the bins in the application to /system/bin/ with 777 permissions
After Building GST for ICS(android-14), I was able to play audio files on the device and also tried to ndk-build with proper JNI[Key: LDFLAGS:=-lX --> means load libX.so from LD_LIBRARY_PATH].....then I realised that there is no proper video sink for android in GST as it uses X-Overlay. so.....
https://wiki.linaro.org/WorkingGroups/Middleware/Multimedia/Specs/1105/GstreamerEglSink
1)Best use NDKr6b(copy the platform[android-14])
2) ICS-src/bionic/linker/linker.c --> SO_MAX 128 --> +62 needed --> Maximum number of shared objects tat can be loaded at a time should be increased and Android Src must be recompiled
3)GST_REGISTRY_UPDATE=yes
4)GST_REGISTRY=/data/data/com.android.freedesktop.gstreamer/cache/registry.bin
5)GST_PLUGIN_PATH=/data/data/com.android.freedesktop.gstreamer/lib
6)GST_PLUGIN_SCANNER=/data/data/com.android.freedesktop.gstreamer/bin/gst-plugin-scanner
7) Better Copy the bins in the application to /system/bin/ with 777 permissions
After Building GST for ICS(android-14), I was able to play audio files on the device and also tried to ndk-build with proper JNI[Key: LDFLAGS:=-lX --> means load libX.so from LD_LIBRARY_PATH].....then I realised that there is no proper video sink for android in GST as it uses X-Overlay. so.....
https://wiki.linaro.org/WorkingGroups/Middleware/Multimedia/Specs/1105/GstreamerEglSink
Android NDK Build - Tutorial
http://marakana.com/forums/android/examples/49.html
http://earlence.blogspot.com/2009/07/writing-applications-using-android-ndk.html
http://earlence.blogspot.com/2009/07/writing-applications-using-android-ndk.html
Subscribe to:
Posts (Atom)