Display (and position) video on top of other graphical content

by Daniel » Wed, 17 Mar 2010 01:08:15 GMT


Sponsored Links
 Hi,

I need to display video (using the MediaPlayer API) on top of other
graphical content. I currently do this the following way:

* Create one subclass of SurfaceView, and render graphics to it using
Canvas.drawBitmap.
* Create another subclass of SurfaceView, and associate a MediaPlayer
with it using MediaPlayer.setDisplay(holder), where holder is the
SurfaceHolder of the SurfaceView.
* Add both SurfaceViews to my Activity using addContentView.

This basically works; the video is displayed on top of the graphical
content and plays ok. Some problems though:

1) According to Google, multiple SurfaceViews are not supposed to be
used in a window. The fact that it works for me seems to be by chance,
and behaviour could change in future versions of Android.

2) The video is placed in the upper left corner, and I haven't found a
way to position it differently.

Any suggestions on a different approach to implement this, that would
not make use of multiple surface views, and also allow me to position
the video, would be much appreciated.

Thanks,
Daniel

--



Other Threads

1. IMPORTANT - display.getOrientation() does not work on all devices

I'll make this a little stronger -- the Display object is LOW LEVEL access
to the display.  Trying to use this in an application is almost guaranteed
to not do what you want.  The current orientation should be retrieved from
Configuration.  The width and height should be retrieved from the view
hierarchy.

I believe that Display.getOrientation actually returns the physical rotation
applied to the display...  I also notice that the documentation says nothing
about what it actually returns, so  how can you use it correctly? :)  (The
Display object clearly needs a lot more documentation...  but this is a
pretty low priority because, again, it really shouldn't be used by
applications.)






> 

2. crash in PowerManagerService

Hi all,

I am working with a Zoom2 board (OMAP 3430). I checkouted donut
repository on git.omapzoom.org I followed the wiki
http://omappedia.org/wiki/Android_Getting_Started I build one SDcard
that boot but after the shiny Android text logo I get a crash from
PowerManagerService

I already checked power management is supported by kernel, I tested
with the init.rc from the last prebuild image indicated on the wiki
and I still have the crash. Does anybody experienced and fixed the
problem? (see logcat below)

According the traces the crash occurs in

public void run() {
        mTid = Process.myTid();
        Looper.prepare();
        synchronized (this) {
            mLooper = Looper.myLooper();
            Process.setThreadPriority(mPriority);
            notifyAll();
        }
        onLooperPrepared();   <---- crash here
        Looper.loop();
        mTid = -1;
    }

I am not familiar with Java and I have no Java experience on Android.
Anyway I see that zam post a message "Lock up PackageManagerService"
and his problem is 5 lines above. Is there anything weird in
android.os.HandlerThread.java ?


you will see other error (No such file or directory, error=Cannot load
library) in the log but this is "normal" on this plateform. I
previously used another omap 3430 board, I had the same error but UI
was launched and also my program.

best regards,

Jean-Franois.

I/Zygote  ( 1098): ...preloaded 15 resources in 8ms.
D/dalvikvm( 1098): GC freed 113 objects / 8672 bytes in 29ms
D/dalvikvm( 1098): GC freed 207 objects / 8168 bytes in 29ms
D/dalvikvm( 1098): GC freed 24 objects / 936 bytes in 28ms
I/dalvikvm( 1098): Splitting out new zygote heap
I/dalvikvm( 1098): System server process 1102 has been created
I/Zygote  ( 1098): Accepting command socket connections
D/dalvikvm( 1102): Trying to load lib /system/lib/
libandroid_servers.so 0x0
D/dalvikvm( 1102): Added shared lib /system/lib/libandroid_servers.so
0x0
I/sysproc ( 1102): Entered system_init()
I/sysproc ( 1102): ServiceManager: 0x1a3f48
I/SurfaceFlinger( 1102): SurfaceFlinger is starting
I/SurfaceFlinger( 1102): SurfaceFlinger's main thread ready to run.
Initializing graphics H/W...
E/MemoryHeapBase( 1102): error opening /dev/pmem: No such file or
directory
E/libEGL  ( 1102): couldn't load <libhgl.so> library (Cannot load
library: load_library[984]: Library 'libhgl.so' not found)
I/SurfaceFlinger( 1102): EGL informations:
I/SurfaceFlinger( 1102): # of configs : 6
I/SurfaceFlinger( 1102): vendor    : Android
I/SurfaceFlinger( 1102): version   : 1.31 Android META-EGL
I/SurfaceFlinger( 1102): extensions:
I/SurfaceFlinger( 1102): Client API: OpenGL ES
W/EGLDisplaySurface( 1102): page flipping not supported
(yres_virtual=480, requested=960)
I/EGLDisplaySurface( 1102): using (fd=22)
I/EGLDisplaySurface( 1102): id           = omapfb
I/EGLDisplaySurface( 1102): xres         = 800 px
I/EGLDisplaySurface( 1102): yres         = 480 px
I/EGLDisplaySurface( 1102): xres_virtual = 800 px
I/EGLDisplaySurface( 1102): yres_virtual = 481 px
I/EGLDisplaySurface( 1102): bpp          = 16
I/EGLDisplaySurface( 1102): r            = 11:5
I/EGLDisplaySurface( 1102): g            =  5:6
I/EGLDisplaySurface( 1102): b            =  0:5
I/EGLDisplaySurface( 1102): width        = 127 mm (160.000000 dpi)
I/EGLDisplaySurface( 1102): height       = 76 mm (160.421051 dpi)
I/EGLDisplaySurface( 1102): refresh rate = 54.76 Hz
W/HAL     ( 1102): load: module=/system/lib/hw/copybit.omap.so
error=Cannot load library: load_library[984]: Library '/system/lib/hw/
copybit.omap.so' not found
W/HAL     ( 1102): load: module=/system/lib/hw/copybit.zoom2.so
error=Cannot load library: load_library[984]: Library '/system/lib/hw/
copybit.zoom2.so' not found
W/HAL     ( 1102): load: module=/system/lib/hw/copybit.default.so
error=Cannot load library: load_library[984]: Library '/system/lib/hw/
copybit.default.so' not found
W/SurfaceFlinger( 1102): ro.sf.lcd_density not defined, using 160 dpi
by default.
I/SurfaceFlinger( 1102): OpenGL informations:
I/SurfaceFlinger( 1102): vendor    : Android
I/SurfaceFlinger( 1102): renderer  : Android PixelFlinger 1.0
I/SurfaceFlinger( 1102): version   : OpenGL ES-CM 1.0
I/SurfaceFlinger( 1102): extensions: GL_OES_byte_coordinates
GL_OES_fixed_point GL_OES_single_precision GL_OES_read_format
GL_OES_compressed_paletted_texture GL_OES_draw_texture
GL_OES_matrix_get GL_OES_query_matrix GL_ARB_texture_compression
GL_ARB_texture_non_power_of_two GL_ANDROID_direct_texture
GL_ANDROID_user_clip_plane GL_ANDROID_vertex_buffer_object
GL_ANDROID_generate_mipmap
W/HAL     ( 1102): load: module=/system/lib/hw/copybit.omap.so
error=Cannot load library: load_library[984]: Library '/system/lib/hw/
copybit.omap.so' not found
W/HAL     ( 1102): load: module=/system/lib/hw/copybit.zoom2.so
error=Cannot load library: load_library[984]: Library '/system/lib/hw/
copybit.zoom2.so' not found
W/HAL     ( 1102): load: module=/system/lib/hw/copybit.default.so
error=Cannot load library: load_library[984]: Library '/system/lib/hw/
copybit.default.so' not found
W/HAL     ( 1102): load: module=/system/lib/hw/overlay.omap.so
error=Cannot load library: load_library[984]: Library '/system/lib/hw/
overlay.omap.so' not found
D/TIOverlay( 1102):  hardware/ti/omap3/liboverlay/overlay.cpp ######
Calling overlay_device_open() ######
I/sysproc ( 1102): System server: starting Android runtime.
I/sysproc ( 1102): System server: starting Android services.
I/SystemServer( 1102): Entered the Android system server!
I/sysproc ( 1102): System server: entering thread pool.
I/SystemServer( 1102): Starting Entropy Service.
V/RandomBlock( 1102): reading from file /data/system/entropy.dat
V/RandomBlock( 1102): writing to file /dev/urandom
V/RandomBlock( 1102): reading from file /dev/urandom
V/RandomBlock( 1102): writing to file /data/system/entropy.dat
W/SurfaceComposerClient(  928): lock_layer timed out (is the CPU
pegged?) layer=0, lcblk=0x40309020, state=00000043 (was 00000043)
I/SystemServer( 1102): Starting Power Manager.
I/SystemServer( 1102): Starting Activity Manager.
W/UsageStats( 1102): Usage stats version changed; dropping
I/SystemServer( 1102): Starting telephony registry
I/SystemServer( 1102): Starting Package Manager.
I/Installer( 1102): connecting...
I/installd(  896): new connection
I/PackageManager( 1102): Got library android.test.runner in /system/
framework/android.test.runner.jar
I/PackageManager( 1102): Got library com.android.im.plugin in /system/
framework/com.android.im.plugin.jar
W/PackageManager( 1102): Running ENG build: no pre-dexopt!
D/PackageManager( 1102): Scanning app dir /system/framework
V/PackageParser( 1102): android:backupAgent =
com.android.internal.backup.SystemBackupAgent from android
+com.android.internal.backup.SystemBackupAgent
D/PackageManager( 1102): Scanning app dir /system/app
D/dalvikvm( 1102): GC freed 5467 objects / 252896 bytes in 47ms
D/PackageManager( 1102): Scanning app dir /data/app
D/PackageManager( 1102): Scanning app dir /data/app-private
I/PackageManager( 1102): Time to scan packages: 0.148 seconds
W/PackageManager( 1102): Removing dangling permission:
android.permission.ACCESS_CACHE_FILESYSTEM from package null
W/PackageManager( 1102): Unknown permission
com.google.android.googleapps.permission.GOOGLE_AUTH in package
com.android.development
W/PackageManager( 1102): Unknown permission
com.google.android.googleapps.permission.GOOGLE_AUTH.ALL_SERVICES in
package com.android.development
W/PackageManager( 1102): Unknown permission
com.google.android.googleapps.permission.GOOGLE_AUTH.YouTubeUser in
package com.android.development
W/PackageManager( 1102): Unknown permission
com.google.android.googleapps.permission.ACCESS_GOOGLE_PASSWORD in
package com.android.development
D/dalvikvm( 1102): GC freed 1055 objects / 113768 bytes in 36ms
I/SystemServer( 1102): Starting Content Manager.
I/SyncManager( 1102): No initial accounts
I/SyncManager( 1102): No initial status
I/SyncManager( 1102): No initial pending operations
I/SyncManager( 1102): No initial statistics
W/ActivityManager( 1102): Unable to start service Intent
{ act=android.accounts.IAccountsService
cmp=com.google.android.googleapps/.GoogleLoginService }: not found
W/AccountMonitor( 1102): Couldn't connect to Intent
{ act=android.accounts.IAccountsService
cmp=com.google.android.googleapps/.GoogleLoginService } (Missing
service?)
I/SystemServer( 1102): Starting System Content Providers.
I/SystemServer( 1102): Starting Battery Service.
E/BatteryService( 1102): Could not open '/sys/class/power_supply/ac/
online'
E/BatteryService( 1102): Could not open '/sys/class/power_supply/usb/
online'
E/BatteryService( 1102): Could not open '/sys/class/power_supply/
battery/present'
E/BatteryService( 1102): Could not open '/sys/class/power_supply/
battery/capacity'
E/BatteryService( 1102): Could not open '/sys/class/power_supply/
battery/batt_vol'
E/BatteryService( 1102): Could not open '/sys/class/power_supply/
battery/batt_temp'
E/BatteryService( 1102): Could not open '/sys/class/power_supply/
battery/status'
E/BatteryService( 1102): Could not open '/sys/class/power_supply/
battery/health'
E/BatteryService( 1102): Could not open '/sys/class/power_supply/
battery/technology'
I/SystemServer( 1102): Starting Hardware Service.
W/HAL     ( 1102): load: module=/system/lib/hw/lights.omap.so
error=Cannot load library: load_library[984]: Library '/system/lib/hw/
lights.omap.so' not found
W/HAL     ( 1102): load: module=/system/lib/hw/lights.zoom2.so
error=Cannot load library: load_library[984]: Library '/system/lib/hw/
lights.zoom2.so' not found
W/HAL     ( 1102): load: module=/system/lib/hw/lights.default.so
error=Cannot load library: load_library[984]: Library '/system/lib/hw/
lights.default.so' not found
E/ActivityThread( 1102): Failed to find provider info for settings
W/dalvikvm( 1102): threadid=31: thread exiting with uncaught exception
(group=0x4001aa18)
E/AndroidRuntime( 1102): Uncaught handler: thread PowerManagerService
exiting due to uncaught exception
E/AndroidRuntime( 1102): *** EXCEPTION IN SYSTEM PROCESS.  System will
crash.
E/AndroidRuntime( 1102): java.lang.NullPointerException
E/AndroidRuntime( 1102):        at android.content.ContentQueryMap.<init>
(ContentQueryMap.java:65)
E/AndroidRuntime( 1102):        at
com.android.server.PowerManagerService.initInThread
(PowerManagerService.java:414)
E/AndroidRuntime( 1102):        at com.android.server.PowerManagerService
$1.onLooperPrepared(PowerManagerService.java:374)
E/AndroidRuntime( 1102):        at android.os.HandlerThread.run
(HandlerThread.java:59)
E/AndroidRuntime( 1102): Crash logging skipped, no checkin service
I/Process ( 1102): Sending signal. PID: 1102 SIG: 9
I/ServiceManager(  886): service 'batteryinfo' died
I/ServiceManager(  886): service 'usagestats' died
I/ServiceManager(  886): service 'telephony.registry' died
I/ServiceManager(  886): service 'meminfo' died
I/ServiceManager(  886): service 'activity.senders' died
I/ServiceManager(  886): service 'activity' died
I/ServiceManager(  886): service 'permission' died
I/ServiceManager(  886): service 'cpuinfo' died
I/ServiceManager(  886): service 'activity.broadcasts' died
I/ServiceManager(  886): service 'SurfaceFlinger' died
I/ServiceManager(  886): service 'entropy' died
I/ServiceManager(  886): service 'power' died
I/ServiceManager(  886): service 'hardware' died
I/ServiceManager(  886): service 'content' died
I/ServiceManager(  886): service 'package' died
I/ServiceManager(  886): service 'battery' died
I/ServiceManager(  886): service 'activity.services' died
I/ServiceManager(  886): service 'activity.providers' died
E/installd(  896): eof
E/installd(  896): failed to read size
I/installd(  896): closing connection
I/Zygote  ( 1098): Exit zygote because system server (1102) has
terminated
W/SurfaceComposerClient(  928): lock_layer timed out (is the CPU
pegged?) layer=0, lcblk=0x40309020, state=00000043 (was 00000043)




--~--~---------~--~----~------------~-------~--~----~
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: 

3. usb device absent from adb after Ubuntu Karmic upgrade

4. Problem installing Android 2.0 on Mac (Snow Leopard)

5. cyanogen 4.2.3.1

6. Sometimes the running emulator is not found from within Eclipse?!

7. A note on "scamming the market"