Wednesday, September 14, 2011

vlcj player with SWT


Find below the vlcj player embedding inside the eclipse plugin. It takes only few lines to get it embedded. The videocomposite below created should always be SWT.EMBEDDED, otherwise, it may give "Invalid Arugument" Error. For compiling and running add vlcj library and its dependecies JNA.jar and platform.jar libraries to the project. These libraries can be donwloaded from below reference.


/*VLC Player*/
org.eclipse.swt.widgets.Composite videoComposite = new org.eclipse.swt.widgets.Composite(parent, SWT.EMBEDDED | SWT.NO_BACKGROUND);
java.awt.Frame videoFrame = SWT_AWT.new_Frame(videoComposite);
java.awt.Canvas playerCanvas = new java.awt.Canvas();
playerCanvas.setBackground(java.awt.Color.black);
videoFrame.add(playerCanvas);
MediaPlayerFactory mpFactory = new MediaPlayerFactory();
EmbeddedMediaPlayer vlcPlayer = mpFactory.newMediaPlayer(null);
videoComposite.setBounds(5,5, 560,244);
videoComposite.setVisible(true);

ePlayer.setVideoSurface(playerCanvas);
/*end */


Additional reference
Java bindings for vlc media player
http://code.google.com/p/vlcj
http://code.google.com/p/vlcj/wiki/SwtExample
vlcj sources can be downloaded from
http://www.capricasoftware.co.uk/vlcj/downloads.php
vlcj tutorial
http://www.capricasoftware.co.uk/vlcj/tutorial.php

Tuesday, September 6, 2011

Exception in thread "main" java.lang.UnsatisfiedLinkError: Could not load library

Exception in thread "main" java.lang.UnsatisfiedLinkError: Can't find dependent libraries
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(Unknown Source)
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)



Scenario
The above is the error sometimes we get, when we try to load a DLL built using Microsoft Visual Studio. This error commonly happens when, one try to load a DLL built on his/her PC and distribute to others. In such situation, the library will be successfully loaded in the source machine in which the DLL is built, but will fail to get loaded in other machines causing the above error. This is due to the library dependencies that gets created when building DLL.

Reason
        This is due to the library dependencies as said above. Microsoft Visual Studio is highly sensitive on the Build configuration, due to which the generated DLL's dependencies may get affected. For example, the "sample.dll" built may have dependencies on some "XYZ.dll version a.b.c". This "XYZ.dll version a.b.c" may exist in multiple version on a machine due to various reasons, such as Visual Studio version installed, Internet explorer installed etc. Its responsibility of the System, or Application to find the dependencies correct version and load the required DLL. This responsibility factor is decided based on the RT_MANIFEST present in DLL generated.

Solution
Sol -1.There are various tools available for checking the dll dependencies. "Dependency Walker" is one of the common tool used to check such dependencies. Once you find the dll dependencies, try to copy these missing dll's in respective folders based on the dll category such as (System dll, application dll's). If all the dll's exist go for the next solution.

Sol -2. Build the DLL using "release" mode instead of "Debug". This avoids the Visual C++ Redistribution package DLL dependencies being getting added in the RT_MANIFEST. If still unable to load the library in java, go for the final solution below.

Sol -3. The Project Properties->Code Generation -> Runtime Library option play a crucial role in dll creation. Based on this many dependencies gets added or removed such as MSVCR80D.DLL, MSVCP80D.DLL, IESHIMS.DLL. One solution would be build the DLL as Multi threaded instead of Multi thread DLL as shown

Monday, June 27, 2011

Restore Default Ubuntu Panel

Restoring Default panel on ubuntu

Open gnome terminal type the below commands

gconftool-2 --shutdown


rm -rf ~/.gconf/apps/panel


pkill gnome-panel"

:) happy linuxing...

Sunday, June 5, 2011

To get Network Interface list in Android

The ifconfig command on android requires you specify an interface name
explicitly. Without argument, it doesn't show all interfaces.
To find out all interfaces on the device, you can use
#adb shell ls /sys/class/net
command.

Thursday, June 2, 2011

ANR keyDispatchingTimedOut

When developing android apps, we tend to use multithread architecture to improve the performance of our application. In such case, there is a high chance that we run in to ANR: keyDispatchingTimedOut error atleast initially. The below links may provide some help in resolving it.

"http://android-developers.blogspot.com/2009/05/painless-threading.html

http://stackoverflow.com/questions/704311/android-how-do-i-investigate-an-anr

http://developer.android.com/guide/appendix/faq/commontasks.html#threading"

Wednesday, January 12, 2011

Permission Denied "mount -t cifs"

On few occasions, while trying to mount a shared folder from windows to linux, using mount -t cifs options, we would have come across a common error that is, "error 13 Permission Denied". This problem is not anyway related to CIFS as most of them thought. This is the problem with the Windows shared folder access. If NETBIOS is disable in Network properties, the CIFS cannot mount the drive, since the permission would be denied while accessing. The solution is provided in microsoft support site. Please follow the below link for the solution 


http://support.microsoft.com/kb/318030


Happy mounting... :)

Wednesday, November 3, 2010

Google TV and DLNA



"One of the key features of Google TV is that the
Google TV Search also looks at local network sources for content. Say you search for Batman. It will display results from any configured DLNA server with the other results as well. It could be a great feature if it wasn’t dependent on DLNA servers.
Configuring DLNA server is for the dogs. They rarely work as well as advertised and often fail because of silly things like installed codecs, remote transcoding, supported file types, the server’s processing power, and so much more. Then when they work, good luck trying to change the displayed file structure on the client.
Instead, Google TV should have a bit of local storage and the ability to browse the local network as a computer rather than a media streamer. Installation would then be a non-issue. Plug it in and the Google TV would have access to the shared content rather than relying on haphazard DLNA servers.
Perhaps if either of the launch Google TV devices shipped with a DLNA server, it wouldn’t be as big of a deal. Instead, owners are forced to bring their own to the party, which requires a bunch of trial and error installing and Google’n until one that works is found. It’s a mess."
courtesy: crunchgear.
Adding to the above, in recent past the DLNA server has emerged as competitive home networking solution. In proof of that, Microsoft's recent breakthrough os Windows 7 have come with built in DLNA solution which is incorporated inside Windows Media player itself. Also Sony laptops, Samsung Galaxy S phone, LG optimus etc. These devices come with DLNA solution that can act as DLNA sever for Google TV. Many open source solutions also available for DLNA for example one like http://elinux.org/DLNA_Open_Source_Projects. So in the near future we can imagine homes becoming digitized with Google TV and DLNA solution.