DirectShow Camera Control On TMobile Shadow - General Topics

Hi All,
I am using DirectShow API for fetching camera contents on T-Mobile Shadow phone (manufacturer is HTC). I am having problem with the default Camera Zoom factor on this phone (when opened using DirectShow). I am trying to control the Zoom factor using IAMCameraControl interface. But I don't get any valid pointer for IAMCameraControl Inteface by using following code =>
$$$$$$$$$$$$$$$$$$$$$$$$$$$
long camera_flags = 0;
long zoom_val = 0;
IAMCameraControl* pCameraControl = NULL;
pVideoCaptureFilter->QueryInterface(IID_IAMCameraControl,(void**)&pCameraControl);
if(NULL == pCameraControl)
{
result = E_NOTIMPL;
goto error_handler;
}
$$$$$$$$$$$$$$$$$$$$$$$$$$$
Looks like IAMCameraControl has not been implemented on this particular phone. Is there any other way to change default Camera Zoom factor on HTC phones?
I came to know about HTC Camera DLL using this forum. How should I go about getting the Camera DLL and the documentation?
Thanks,
Shashi

Related

Screen rotation on Tornado WM6??

The question was: Is the screen rotation possible on Tornado devices (for example for better Internet browsing).
Many efforts were done to gain this possibility. We have not fully received what we need, but we're on good way. We know now that the standard Tornado DDI.DLL driver is uncapable of screen rotation, so we (partially) replaced it with one taken from HTC Vox ROM. There is one serious disadvantage we're still working about: the joystick doesn't follow orientation for now, so using the phone in landscape mode is seriously difficult. We will be trying to adopt the Vox's keybddr.dll into Tornados.
I have collected all these things in an application, that you can install to skip manual registry editing.
Here is the application:
http://www.mediadrain.com/TDM_1.0.0.cab
You MUST install the following certificates! If not, a hard reset will be required!
http://www.mediadrain.com/WMtequan.cab
To rotate the screen select Change Driver option from the Display Driver option, and change to a VOX one.
i don't think it will be supported on this alpha version...!!!
qtek_metanol said:
i don't think it will be supported on this alpha version...!!!
Click to expand...
Click to collapse
this isn't connected
OS either supports screen rotation or not
WM6 supports screen rotation, like on the vox, so surely we could do the same for tornado but add some start menu shortcuts or a home screen plugin to make it rotate?
Phil
i tried writing an app in .net compact framework. While it worked and rotated a PPC WM5, it didn't work in my SP WM6.
maybe .net is hard-coded and disallows screen rotation on smartphone, what doesn't mean it's impossible
WM6 supports screen rotation, like on the vox, so surely we could do the same for tornado but add some start menu shortcuts or a home screen plugin to make it rotate
Click to expand...
Click to collapse
may you need the dll file from VOX which enable the screen rotation by opening the keyboard
i think we should write a list with Q&A, and other with Bugs, Do have somebody a list with a resume of troubles...??
i build a .NET project that allow to rotate the screen, but for me it works ONLY on emulator SDK only in both WM5 and WM6 why? i post the exe and the source.. give me some answer..
Code:
#include <windows.h>
#include <stdafx.h>
int
WINAPI
WinMain(
HINSTANCE,
HINSTANCE,
#ifdef UNDER_CE
LPWSTR,
#else
LPSTR,
#endif
int
)
{
DEVMODE DevMode;
int RotationAngles;
int CurrentAngle;
int NewAngle;
//
// Check for rotation support by getting the rotation angles supported.
//
memset (&DevMode, 0, sizeof (DevMode));
DevMode.dmSize = sizeof (DevMode);
DevMode.dmFields = DM_DISPLAYQUERYORIENTATION;
if (DISP_CHANGE_SUCCESSFUL == ChangeDisplaySettingsEx(NULL, &DevMode, NULL, CDS_TEST, NULL))
{
RotationAngles = DevMode.dmDisplayOrientation;
RETAILMSG(1, (L"ChangeDisplaySettingsEx supports these rotation angles %d", RotationAngles));
}
else
{
RETAILMSG(1, (L"ChangeDisplaySettingsEx failed to get the supported rotation angles."));
RotationAngles = -1;
}
//
// Get the current rotation angle.
//
memset(&DevMode, 0, sizeof (DevMode));
DevMode.dmSize = sizeof (DevMode);
DevMode.dmFields = DM_DISPLAYORIENTATION;
if (DISP_CHANGE_SUCCESSFUL == ChangeDisplaySettingsEx(NULL, &DevMode, NULL, CDS_TEST, NULL))
{
CurrentAngle = DevMode.dmDisplayOrientation;
RETAILMSG(1, (L"ChangeDisplaySettingsEx reports the current rotation as %d", CurrentAngle));
}
else
{
RETAILMSG(1, (L"ChangeDisplaySettingsEx failed to get the current rotation angle."));
CurrentAngle = -1;
}
//
// Rotate to the "next" angle.
//
if (CurrentAngle >= 0 && RotationAngles >= 0)
{
NewAngle = CurrentAngle;
do
{
NewAngle <<= 1;
if (NewAngle == DMDO_0)
{
NewAngle = DMDO_90;
}
if (NewAngle > DMDO_270)
{
NewAngle = DMDO_0;
}
} while (!(NewAngle & RotationAngles) && (NewAngle != DMDO_0));
memset(&DevMode, 0, sizeof (DevMode));
DevMode.dmSize = sizeof (DevMode);
DevMode.dmFields = DM_DISPLAYORIENTATION;
DevMode.dmDisplayOrientation = NewAngle;
if (DISP_CHANGE_SUCCESSFUL == ChangeDisplaySettingsEx(NULL, &DevMode, NULL, CDS_RESET, NULL))
{
RETAILMSG(1, (L"ChangeDisplaySettingsEx changed rotation angle to %d", NewAngle));
}
else
{
RETAILMSG(1, (L"ChangeDisplaySettingsEx failed to change the rotation angle to %d", NewAngle));
}
}
return 0;
}
giuseppebitonti said:
i build a .NET project that allow to rotate the screen, but for me it works ONLY on emulator SDK only in both WM5 and WM6 why? i post the exe and the source.. give me some answer..
Click to expand...
Click to collapse
Hey, I have a Vox (s710) for a few days so I could search which application is used by this phone to rotate the screen.
kartam said:
Hey, I have a Vox (s710) for a few days so I could search which application is used by this phone to rotate the screen.
Click to expand...
Click to collapse
that would be great mate. we'll be waiting for it.
bad news...
i found this somewhere in eMbedded VC++ documentation:
Screen rotation requires support from the display driver, which maintains information regarding rotation. Screen rotation is currently supported only on devices that use a single screen and is not supported on multiple screen devices.
An application calls the ChangeDisplaySettingsEx function to determine the screen orientation modes that the system supports, to set the angle by which the screen is rotated, and to query the current angle of rotation
Click to expand...
Click to collapse
I've written small utility (C++, native code just to be sure that no funny hardcode in compact framework is messing) and i've tested it on SPV C600 and TYTNII. On TYTN all was OK (screen rotated), on C600 (WM6) error was 'DISP_CHANGE_BADMODE' - exactly like described in docs...
so (IMHO): display driver (heh.. I suspected that there is sth like display driver ) just does not support screen rotation, so no matter that WM6 supports it...
we got two choices:
- find better one (heh... i do not even know the name of the file... but this i can find - i think i saw it once where i was plaing with regedit )
- live with 0 degrees rotation
It is necessary patch driver from vox. It approaches, but incorrectly turnoff screen. Illumination does not die away, and after that the image is displaced on 15 pixels to the right. With the all perfectly rotates. Except for joystick...
kmz said:
It is necessary patch driver from vox. It approaches, but incorrectly turnoff screen. Illumination does not die away, and after that the image is displaced on 15 pixels to the right. With the all perfectly rotates. Except for joystick...
Click to expand...
Click to collapse
could you uploader the driver plz
How can I find the driver in the ROM?
http://kmz.ho.com.ua/dispdriver.vox.zip
Here the driver and the certificate by which is signed the driver.
so we got POC done, now time for hard reset
driver supports screen rotation, but it got problems with display time out - when backlight should be off it is on, but screen becomes white and it's premament (until reboot).
Just for info - U can use MyMobiler to operate - no matter that screen is dead, phone itself is still doing his job
Hey, that is great
Good job guys, i'm sure you guys can improve it.
Just some suggestion, perhaps you can make some application which will toggle landscape/potrait and map it to one of the shortcut keys such as long_volup
driver supports screen rotation, but it got problems with display time out - when backlight should be off it is on, but screen becomes white and it's premament (until reboot).
Just for info - U can use MyMobiler to operate - no matter that screen is dead, phone itself is still doing his job
Click to expand...
Click to collapse
Excelent work Qlphn, what about the joystick control? It changes the way to control the Joystick when you switch to Panorama Modus?
THX
Has anyone got the Tornado display driver? I could probably check differences with windiff and hexedit it .
Hey!
I managed to do this with DDI driver you've attached.
Well, the joy doesn't follow orientation, screen rotation works. After some time my display takes weird colours. I hope this can be fixed anyway, well I will try to work it
Maybe only registry edit is required? I will compare vox registry with tornado one and say what I noticed.
Greetings

[Q] Gallery3D Only support Portrait Mode phone?

Hi All,
we are now developing Android phone on mmp2 board which is of landscape mode. We found Galley3D works perfectly on portrait mode phone while has a problem on landscape one. As you know Gallery3D can tilt pictures/videos according to values of Gsensor. But the Gsensor’s coordinator on landscape mode phone is different from that of portrait. This difference make Galley3D’s not working well on our mmp2 board, i.e., Gallery3D only supports portrait mode phone. Below is for the details:
Let’s take a look at onSensoChanged function in file GridInputProcessor.java, Gallery3D calculates the tilt value from X-axis value (values [0]) / Y-axis value (values [1]) depends on the compare of current display’s width and height.
public void onSensorChanged(RenderView view, SensorEvent event, int state) {
…..
switch (event.sensor.getType()) {
case Sensor.TYPE_ACCELEROMETER:
float[] values = event.values;
/*tilt value is calculated from X-axis value (values [0]) / Y-axis value (values [1]) */
float valueToUse = (mCamera.mWidth < mCamera.mHeight) ? values[0] : -values[1];
float tiltValue = 0.8f * mPrevTiltValueLowPass + 0.2f * valueToUse;
…… }
break;
}
}
For Portrait mode phone:
(1) When Gallery3D is in Portrait mode, tiltValue uses value of X axis since mWidth < mHeight, Galley3D would tilt the pictures when X value of Gsensor changes, this behavior is expected.
(2) When Gallery3D is in Landscape mode, tiltValue uses value of Y axis since mWidth > mHeight, Galley3D would tilt the pictures when Y value of Gsenso changes, this behavior is expected.
/samba/PortraitMode.bmp
For Landscape mode phone:
(3) When Gallery3D is in Portrait mode, tiltValue uses value of Y axis since mWidth < mHeight, Galley3D would tilt the pictures when Y value of Gsensor changes changes, this behavior is unexpected.
(4) When Gallery3D is in Landscape mode, tiltValue uses value of X axis since mWidth > mHeight, Galley3D would tilt the pictures when value of X value of Gsensor changes, this behavior is unexpected.
/samba/LandscapeMode.bmp
Questions:
(1) Do we have solution to fix this issue? Is that in APP?
(2) There are some other Gsensor games in the market has the same issue, i.e., only support Portrait mode phone, e.g., the Teeter Game, is there any idea for the workaround in framework/SensorHAL so that those games can still be used in Landscape mode phone?
Hope above is clear; we are looking forward to your kindly reply and many thanks in advance.
it definitely supports landscape, I'm using it on my Dell streak using leaked eclair firm ware, quick is forced/ locked landscape.
unless Dell have altered the code, which can't tell because they won't release the source, can't really help much more than that. just to let you know that it works
Landscape works perfect on 3D gallery for my Evo with Froyo.
Can someone post an appbrain/androlib link or a QR code? I cannot find this app
It's a stock application...
Oh, mine is not called that. It's just "Gallery"

Camera mod for 2D gallery - CM6 Froyo roms?

Would anyone be able to modify the Camera apk so when you click on the image in the lower right corner of the last taken photo to open it in the gallery?
Right now a workaround to get to the gallery from the camera app is to hit Menu, Gallery.
Wondering if anyone can get the button working?
+1 I would like to see this too.
Tried myself a little. I believe the command for launching the review of the phone is
Code:
com.cooliris.media.action.REVIEW
The problem is that only the 3D Gallery is called, com.cooliris.media
The 2D Gallery is known has, com.android.camera.Camera
I tried swapping them out, but it just results in the camera app now showing up.
Maybe the 2D Gallery doesn't have a review command and this isn't even possible.
OK so a little more digging and trying and no success.
It appears that the 2D Gallery and 3D Gallery seem to appear to handle the "Reviewing of images differently"
2D:
Code:
com.android.camera.ReviewImage
and that seems to be it's own separate activity
whereas
3D:
Code:
com.cooliris.media.action.REVIEW
and is a action inside of the Gallery activity
It appears that there is no equivalent review action with the 2D Gallery, so it can easily be swapped out in the Camera.apk via a hex editor or the like. I would assume a change in the source code for the Camera.apk would be needed.
Would be nice to have it coded so it looks for 3D gallery 1st and if that fails falls back on 2D.
More digging found me this:
http://ip208-100-42-21.static.xda-developers.com/showthread.php?t=731659&page=96
Seems to exactly what you are looking for Jedis.
To get the Camera thumbnail to stop calling Gallery3D, I made the following change in the Camera source.
diff --git a/src/com/android/camera/Util.java b/src/com/android/camera/Util.java
index 44d5681..52a6639 100644
--- a/src/com/android/camera/Util.java
+++ b/src/com/android/camera/Util.java
@@ -42,7 +42,7 @@ public class Util {
public static final int DIRECTION_UP = 2;
public static final int DIRECTION_DOWN = 3;
- public static final String REVIEW_ACTION = "com.cooliris.media.action.REVIEW";
+ public static final String REVIEW_ACTION = "android.intent.action.VIEW";
private Util() {
}
There may be a better way, but this is working for me.

[Q] glReadPixels() Problem in Android to reconstruct the frame

I am working on a project on Augmented Reality with Android. The code captures the camera video, finds the marker and displays a cube on top of it. After this a motion vector (in the form of pixels moved in the x and y direction) is found. What I need to do is read the pixels from the GL layer and draw them again after moving them by the distance specified by the motion vector.
The GL layer is specified using the GLSurfaceView class which is a transparent layer. The problem I am facing is that when I use glReadPixels() to read the pixels and convert it into a 480x800 array (nexus one screen resolution), I get 3 different portions of the cube instead of one.
I intend to move the pixels by the motion vector after this and use glDrawPixels() to put the pixels back into the frame buffer
Please help me with the interpretation of the same. Is there something I am missing while using glReadPixels and also if there is some other function that will help me achieve the same. I was thinking of using glBlitFrameBuffer() but this is not supported by the android GL10 class.
I have attached the part of the code where I am reading the pixels and changing them to a 2D matrix along with the image of the pixels I reconstructed using MatLab.
Any help will be greatly appreciated.
Code:
gl.glPixelStorei(GL10.GL_PACK_ALIGNMENT, 1);
IntBuffer pixels = IntBuffer.allocate(384000);
gl.glReadPixels(0, 0, 800, 480, GL10.GL_RGBA, GL10.GL_UNSIGNED_BYTE ,pixels);
File f = new File ("./mnt/sdcard/Sahiba_PixelData_" + flag + ".txt");
if(!f.exists())
f.createNewFile();
FileWriter fw = new FileWriter(f);
int pixelsArr [][] = new int [480][800];
//int temp[] = pixels.array();
int n=0;
for(int i=0; i<480; i++){
for(int j=0; j<800; j++){
pixelsArr[i][j] = pixels.get(n);
//temp[n + pixels.arrayOffset()];
fw.write(pixelsArr[i][j] + " ");
//fw.write(pixels.get(n) + " ");
n++;
}
//fw.write("\n");
}
Log.i("GLLayer", "Pixels reading and storing finished !!!");
}catch(Exception e){
Log.i("GLLayer","Exception = " +e);
}

[Q] Simple translate animation, not working on Android 4.4.2

The following code, is a simple example of programmatically "WITHOUT XML" translate animation, that works perfect on all versión bellow Android 4.4.2, but does nothing on Android 4.4.2. It's really making me crazy!
Any ideas why?
Tested and working OK on: EMULATOR AVD with 4.1.2 (API 16), EMULATOR AVD with 4.2.2 (API 17), EMULATOR AVD with 4.3.1 (API 18), Galaxy Tab 3 (4.1.2), Surprice, surprice.....works on my Galaxy NOTE with Omnirom 4.4.4
Not Working on: EMULATOR AVD with 4.4.2 (API 19), Galaxy S4 (4.4.2), Galaxy Note 3 (4.4.2)
Code:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
int myWidth = 1280;
int myHeight = 800;
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
boolean isPortrait = getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT;
int frameBufferWidth = isPortrait ? myHeight : myWidth;
int frameBufferHeight = isPortrait ? myWidth : myHeight;
Bitmap frameBuffer = Bitmap.createBitmap(frameBufferWidth, frameBufferHeight, Config.RGB_565);
graphics = new AndroidGraphics(getAssets(), frameBuffer);
fl = new FrameLayout(this);
ImageView mons= new ImageView(this);
mons.setImageBitmap(graphics.newImage("mons/mons01.png", ImageFormat.ARGB8888).getBitmap());
mons.setX(400);
mons.setY(200);
TranslateAnimation aniTrans = new TranslateAnimation(0, 0, 0, -200);
aniTrans.setDuration(5000);
mons.setAnimation(aniTrans);
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT);
fl.addView(mons, params);
FrameLayout.LayoutParams flp = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT);
this.setContentView(fl, flp);
mons.startAnimation(aniTrans);
aniTrans.startNow();
}
Issue Found!
HAVE FOUND THE PROBLEM, but NEED HELP TO SOLVED IT!
(NOTE: This only occurs in full java code. It doesn’t happened using XML file, what is not the case)
Now I should call this topic like:
ANDROID 4.4.2 CREATES A BLACK MASK OUTSIDE VIEW OBJECT BOUNDARY, ONLY DURING FULL JAVA CODE ANIMATIONS?
Why?:
Take a look to this new example code:
Code:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
common = new Common(this, this);
FrameLayout.LayoutParams framelayoutparameter = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT);
/* I think that this is the line code (imageviewparamenter) were Android 4.4.2 FAILS during animation.*/
LayoutParams imageviewparamenter = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
/* No matter the size of the screen, Android 4.4.2 creates a black hole outside the image size,
* just during animation (see attached picture). Thats why animation dont show up, if the
* initial position (setX or setY) of the image, is outside the image boundary.*/
fl = new FrameLayout(this);
ImageView iv = new ImageView(this);
/* Image is located in the ASSET and is 100x100 pixels (non dpi dependable)
* "common" method use AssetManager to read the image file */
iv.setImageBitmap(common.newImage("iv_image.png", ImageFormat.RGB565).getBitmap());
iv.setX(50); // position show in the example
iv.setY(0);
fl.addView(iv, imageviewparamenter);
this.setContentView(fl, framelayoutparameter);
AlphaAnimation animation = new AlphaAnimation(0,1);
animation.setDuration(5000);
animation.setAnimationListener(this);
/* Also, "setAnimation(animation)" must be present, in order that
* Android 4.4.2 animates without skipping frames*/
iv.setAnimation(animation);
iv.startAnimation(animation);
}
Create a frame layout with a ImageView and alpha animation using pure java code. During animation, Android 4.4.2 (API19) is creating a black mask outside the ImageView size boundary, starting at x/y coordinates (0 + imageWidth / 0 + imageHeight), so if you initially place the image outside that coordinate, you don’t see any animation, just the original image at the end of the animation....
To recreate the issue, i have place the image in x = 50 . You would see that the half right side of the image is BLACK during Android 4.4.2 animation. You can recreate using emulator with any size of screen setup that you prefer. Using API 16,17,18, have no problem, but using API19, the black mask will make you crazy!
NOW, ANY IDEAS? or is a big bug on Android 4.4.2? or I just don’t see it?
Anyone?
SOLVED
! SOLVED !
For some reason, API19 programmatically pure java animations doesnt play very well with absolut settings, like setX() or setY(). Experts may take a look on this. API19 preffers to work with margins on the layout parameter side.
The following procedure, apply's to android 4.4.2. Of cource, it works on the others versions down and up, but you must change your way of thinking. You must place a imagen programmatically using layout parameters, so change:
Code:
iv.setX(50);
iv.setY(0);
to
Code:
lparam.setMargins(50, 0, 0, 0);
iv.setLayoutParams(lparam);
iv.requestLayout();
You must call "requestLayout()" to ensure that the new changes on the layout, will be commited when adding the view to the parent (fl).
Finnally, by mistake, I use "LayoutParams" instead of "FrameLayout.LayoutParams". This nothing have to do with the issue and was not affecting it, but is the correct way to define it, so change:
Code:
LayoutParams lparam = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
to
Code:
FrameLayout.LayoutParams lparam = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT);
The complete working code for any API is:
Code:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Common common = new Common(this, this);
FrameLayout fl = new FrameLayout(this);
ImageView iv = new ImageView(this);
FrameLayout.LayoutParams flparam = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT);
FrameLayout.LayoutParams lparam = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT);
iv.setImageBitmap(common.newImage("100x100.png", ImageFormat.RGB565).getBitmap());
lparam.setMargins(50, 0, 0, 0);
iv.setLayoutParams(lparam);
iv.requestLayout();
fl.addView(iv);
this.setContentView(fl, flparam);
AlphaAnimation animation = new AlphaAnimation(0, 1);
animation.setDuration(3000);
iv.setAnimation(animation);
iv.startAnimation(animation);
}

Categories

Resources