obs1dium / BetterManual

An app for manual mode on Sony Alpha 5100 cameras
MIT License
38 stars 20 forks source link

Development Questions #8

Open KillerInk opened 7 years ago

KillerInk commented 7 years ago

Hi what I still miss is bulb shooting to start with the EnterKey. Play with it now for two days but it does not get to run. With the touchlessRemote it seem to trigger the s2Key

public int pushedS2Key()
  {
    ExecutorCreator.getInstance().getSequence().inquireKey(518);
    return 1;
  }

BaseShootingExecutor public abstract void inquireKey(int paramInt);

but that inquireKey() is not implemented and just an abstract stub. So i tryed to inject keys with Instrumentation() and Activity.dispatchKeyEvent() but non works. The injected event gets called inside the activity, but does not lock the s2 key down.

Maybe you have an idea. greets

KillerInk commented 7 years ago

I finaly understood. with bulb active, the onShutter callback is repeating called . i had there a cancelTakePicture() inside wich stopped it.

obs1dium commented 7 years ago

Sorry, hadn't tried bulb shooting yet. I think you must call cancelTakePicture for "normal" shutter speeds, though.

KillerInk commented 7 years ago

Yes cancelTakePicture must be called after each capture. And for Bulb only when it should finish. Thx for your work sofar.

obs1dium commented 7 years ago

I see you're working on some much-needed refactoring and code cleanup :)

KillerInk commented 7 years ago

Yes the code has it urgently necessary 👍 But with adb the development flow has total changed. @ma1co is a hero

I'm just hanging out at the ImagePreview. Direct loading of bitmaps is slow. Sony uses the OptimizedImageView and OptimizedImageFactory to load it. The _data collumn from ContentProvider seems to be the wrong one. Its return an empty OptimizedImage. But works with the BitmapFactory.... The AvIndexStore contains a Folder Object, maybe that returns the direct path. No idea why they have made this so complicated.

path from _data: avindex://1000/00000001-default/00000001-00000925

end in:

I/StillPlayHAL: decodeImage() target:0x0036bcf0 imageType:2 uri:1000/00000001-default/00000001-00000925 colorType:1
I/StillPlayHAL: decodeImage() ticket:0xf0000000 errCd:0x00001004

thats from base app, i miss something

D/FACTORY_CLASS: Start: decodeImage(String uri, Options options)
D/FACTORY_CLASS: JNI call
I/StillPlayHAL: decodeImage() target:0x000bd480 imageType:2 uri:1000/00000001-default/00000019-000009E0 colorType:1
I/StillPlayHAL: decodeImage() ticket:0x10000801 errCd:0x00000000
I/SDCom: [A:1773] SDCom: 05:01:37 May 26 2016
I/SDCom: [A:1773] msgqId(RX): 0x1586100
I/MetaUtil: CreatePlayContentInfo() CopyBuffer [912]
D/FACTORY_CLASS: JNI called
D/FACTORY_CLASS: 1000/00000001-default/00000019-000009E0
AVIndexProvider: decode time : 111
KillerInk commented 7 years ago

have it working. the camera need to get closed...^^

KillerInk commented 7 years ago

Stupid question, but where did you find that TextView Image Strings?

("\uE4CD to set timelapse interval, \uE04C to confirm");

KillerInk commented 7 years ago

Found them inside framework-res.

obs1dium commented 7 years ago

The default font is Sony_DI_Icons.ttf, I used a font viewer to look for useful characters.

Didn't realize adb was working now, I'll have to take a look at that once I have some time to spare.

KillerInk commented 7 years ago

With opening the Camera in Background a new problem happened. All Callbacks from Camera run now in that Thread. Due that, after a Capture the AvIndexUpdate seems to stuck somehow, and the red light turn only off with closing the app. Then you see in Log that it get updated.....

01-01 00:22:59.746 497-848/? I/_AvindexOsalReceiver_: onReceiveOsal# start
01-01 00:22:59.746 497-848/? I/_AvindexOsalReceiver_: RecvObjMsg messageId = 0x20003
01-01 00:22:59.746 497-848/? I/_AvindexOsalReceiver_:   send cond_signal.
01-01 00:22:59.746 497-848/? I/_AvindexOsalReceiver_: onReceiveOsal# end
01-01 00:22:59.746 497-847/? I/_AvindexOsalReceiver_:   waitEventAndCallJavaMethod() received cond signal.
01-01 00:22:59.746 497-847/? I/_AvindexOsalReceiver_:   Call InfraScalarMprEventReceiver.onEvent().
01-01 00:22:59.748 497-847/? I/_AvindexOsalReceiver_:   waitEventAndCallJavaMethod() start waiting...
01-01 00:22:59.767 497-848/? I/_AvindexOsalReceiver_: onReceiveOsal# start
01-01 00:22:59.768 497-848/? I/_AvindexOsalReceiver_: RecvObjMsg messageId = 0x20001
01-01 00:22:59.768 497-848/? I/_AvindexOsalReceiver_:   send cond_signal.
01-01 00:22:59.768 497-848/? I/_AvindexOsalReceiver_: onReceiveOsal# end
01-01 00:22:59.768 497-848/? I/_AvindexOsalReceiver_: onReceiveOsal# start
01-01 00:22:59.768 497-848/? I/_AvindexOsalReceiver_: RecvObjMsg messageId = 0x20003
01-01 00:22:59.768 497-848/? I/_AvindexOsalReceiver_:   send cond_signal.
01-01 00:22:59.768 497-848/? I/_AvindexOsalReceiver_: onReceiveOsal# end
01-01 00:22:59.768 497-847/? I/_AvindexOsalReceiver_:   waitEventAndCallJavaMethod() received cond signal.
01-01 00:22:59.768 497-847/? I/_AvindexOsalReceiver_:   Call InfraScalarMprEventReceiver.onEvent().
01-01 00:22:59.773 497-497/? D/AvindexProvider: onReceive()# action = com.sony.scalar.database.avindex.action.AVINDEX_DATABASE_UPDATED
01-01 00:22:59.830 497-847/? I/_AvindexOsalReceiver_:   Call InfraScalarMprEventReceiver.onEvent().
01-01 00:22:59.832 497-847/? I/_AvindexOsalReceiver_:   waitEventAndCallJavaMethod() start waiting...

That dont happen with camera opening in MainLooper. In log you see that it gets updated direct after a capture. And red light turn off. Funny is that you can capture one by one without problems. But it freez the app when you open the imageviewer. But the viewer opens fine aslong you dont capture and the red light is on. Its crazy 🐰

obs1dium commented 7 years ago

I wouldn't be surprised if some things can only be done on the main thread.

You're looking at the Sony apps as well, right? If I'm reading the code correctly, they're always opening the camera on the main thread (ExecutorCreator).

KillerInk commented 7 years ago

hm you're right, thx. yes i look into sony apps too. well then i have to rework some stuff.

KillerInk commented 7 years ago

I created now a small app wich just opens the camera and handel the onShutter callback, Code runs on MainThread and have same behavior as running in Background. So threading seems not to be a problem. Im out of ideas, that's not the behavior i expected.

https://github.com/KillerInk/OpenMemoriesCam/blob/master/app/src/main/java/openmemories/com/opencamera/MainActivity.java

obs1dium commented 7 years ago

The test app seems to work fine, can you add code to reproduce the bad behavior there?

KillerInk commented 7 years ago

Thats the code that cause it. maybe its a problem with the a6000. When i commit out all stuff from a BetterManual, that only the camera get open and the onShutter gets set, it works. Using the sample app, red light keep on till i close the app. It makes no sense. I also tryed to update the avindex manual without success. database gets updated but red light keep on. I thought that the support lib is causing it. but after removing it, its the same behavior.

obs1dium commented 7 years ago

I recently upgraded to an A6000 myself and used it to run the test app, the red light turned off shortly after taking a picture. Maybe the problem is caused by a particular camera setting?

KillerInk commented 7 years ago

I have no idea what it cause. Looks like mine is special. But good to know that it works for you. It stopped working for me after i added the fragment stuff. When i switch to your last commit its working. Its total crazy.

obs1dium commented 7 years ago

Looks like the problem occurs when image quality is set to RAW & JPEG. I usually shoot RAW only, so it didn't happen before.

KillerInk commented 7 years ago

I'm not at home and don't remember what picture format is set. Check it tomorrow.

KillerInk commented 7 years ago

With raw only it works. But with jpeg or raw/jpeg not. Big thx. Now i have something i can work with.

Nebuleusesetcacao commented 6 years ago

Hi, thank you a lot for this app. I use it on a A7sii, and it works great ! My question is concerning the BulbMode. How can we use it ? When i want to take a picture with it, i don"t know how i can select a time for the picture... Do you have an issue ? I'm just looking for an app who can used the Bulb mode without the Noise Reduction, do you know an equivalent ? Thank you so much !

obs1dium commented 6 years ago

Exposure time in bulb mode simply depends on how long you press the shutter button. I don't know if long exposure noise reduction is disabled on the A7sii.

Nebuleusesetcacao commented 6 years ago

Yes, but the bulb mode is available in your App, is it a way to do a timelapse in bulb mode ?

Nebuleusesetcacao commented 6 years ago

I see that KillerInk make a update of Better Manual here : https://github.com/KillerInk/BetterManual But, and i'm sorry about that, i'm not a coder... I used the pmcgui to install your App, and i don't know how i can install the KillerInk version...

KillerInk commented 6 years ago

Its only the source. I have not uploaded a release to my github. But its sofar stable and i use it to capture stars. its not much left from the orginal code but @obs1dium is the owner of the repo. And what i read this repo is linked to the openmemories store. so its the best place for releases. When he want i can open a pull request.

obs1dium commented 6 years ago

I wouldn't mind your app replacing this in OpenMemories or merging your code. However, I'd like to be sure that it still works properly with the a5100, which it was originally meant to be used with. I upgraded to an a6000 a while back and can't test it myself.

lh8511 commented 6 years ago

I tried the code from @KillerInk on Android studio and after installing I had big issues on a6300... The app keeps crashing! Maybe I was doing something wrong at some point. BTW, the repo from @obs1dium was working (stable) on nex6 and a6300, but I did not test all features.

@obs1dium: I am developing a new app which your bettermanual code is the MOST of it... It takes your app main struture as interface but for another purpose. Can I publish as new repo and refering your work?

Thanks

obs1dium commented 6 years ago

Sure, go ahead, the code's under MIT license after all. If you think the app's useful to other people, open a pull request at OpenMemories-AppList.

lh8511 commented 6 years ago

@obs1dium Thank you Martin. After run some more tests, I will publish the repository. Will also wait to get some feedback from people with other camera models (I can only test the app at nex6 and a6300), so then pull request at OpenMemories-Applist.

KillerInk commented 6 years ago

@lh8511 the only things that could cause a crash is that imageview stuff. There seems to be two ways. one use OptimizedImageFactory(gingerbread?) and other decode it to a bitmap(froyo?). Or liveSlowShutter or longexposure noise reduction. i dont think its a big problem to get it working. Need only the crash log.

One thing i missed, was to change easy the layout without opening a new activity. With using different activitys the camera must get closed and reopen on the new activity if used. also i wanted a preview for the taken images.

when you have questions or need help just ask. i will try my best

lh8511 commented 6 years ago

@KillerInk,

You are probably correct about what is causing the crashs using your code, because they realy are two diferent android versions... I will check during the weekend! Also, need check my android studio, because signed apks was causing troubles: I kept using debug versions when compiling the code into apk!!! (Sorry, I am just learning java/android).

Regarding preview of taken image - are ou refering the review of n seconds just after shoot or a new activity to display the "Media gallery"?

KillerInk commented 6 years ago

You are probably correct about what is causing the crashs using your code, because they realy are two diferent android versions... I will check during the weekend!

It could be also the AvIndexManager, maico has there a class wich sort it out. But it was not able to get a optimized image with it.

Also, need check my android studio, because signed apks was causing troubles: I kept using debug versions when compiling the code into apk!!! (Sorry, I am just learning java/android).

Aslong you are on the same pc the debug signed apk works. But a other pc creates a different debug key. In that case you have to uninstall the app from the camera to install a different signed apk. I have more places to code, thats why i add by default a signed key.

Regarding preview of taken image - are ou refering the review of n seconds just after shoot or a new activity to display the "Media gallery"?

I mean a "Media Gallery" where you can look through the last shoots.

lh8511 commented 6 years ago

I mean a "Media Gallery" where you can look through the last shoots.

Maybe you can use the one from PMCADemo

KillerInk commented 6 years ago

Not on a6000. There the info.getPreviewImage returns null from pmca code. It was my first try, after that it looked how sony does it. Also im not sure if that works with raw images.

KillerInk commented 6 years ago

@lh8511 i changed the code, that it now checks with reflection if ithe AvIndexStore is supported. if not it disable the Gallery. Hope that fix the crash

lh8511 commented 6 years ago

Thanks @KillerInk.

galactoid commented 5 years ago

Have small questions about the application. How app turns red AF illumination, I didn't find anything in the code. Why this feature is used, and do you know how to avoid it?

obs1dium commented 5 years ago

That's a camera setting, you can turn it off in the menu (Camera Settings / AF Illuminator)

galactoid commented 5 years ago

I thought about this, but it's turned off on my camera all the time. Double checked - it turned off in the menu. Happens only in timelapse and bracketing mode. Something different here. Using on A7M2.

Thinking now its a self-timer indicator, but didn't see a way why it's fired on.

m-kostrzewa commented 3 years ago

Looks like the problem occurs when image quality is set to RAW & JPEG. I usually shoot RAW only, so it didn't happen before.

With raw only it works. But with jpeg or raw/jpeg not. Big thx. Now i have something i can work with.

Hi, I've been debugging an issue with cameraEx.cancelTakePicture(); on a5000 and I found your comments helpful... however, it's the other way around for me. It works only with JPG and RAW+JPG. Just RAW crashes the app I've been debugging. App uses takePicture and cancelTakePicture to capture long exposures (bulb). Just FYI.

KillerInk commented 3 years ago

Hi, I've been debugging an issue with cameraEx.cancelTakePicture(); on a5000 and I found your comments helpful... however, it's the other way around for me. It works only with JPG and RAW+JPG. Just RAW crashes the app I've been debugging. App uses takePicture and cancelTakePicture to capture long exposures (bulb). Just FYI.

that problem went away on a6000 with updating the fw to 3.21

m-kostrzewa commented 3 years ago

My a5000 fw is 1.10 (I think it's the newest). I also have a7ii and no issue there.

It is mentioned in this thread that it worked for a5100 in the past. That's how I made the logical jump that it should probably work similarly for my a5000. Not sure if it still works for a5100 or not.

In any case, should I just assume that "only RAW" not working is a firmware issue?

KillerInk commented 3 years ago

My a5000 fw is 1.10 (I think it's the newest). I also have a7ii and no issue there.

It is mentioned in this thread that it worked for a5100 in the past. That's how I made the logical jump that it should probably work similarly for my a5000. Not sure if it still works for a5100 or not.

In any case, should I just assume that "only RAW" not working is a firmware issue?

you should not assume that. on orginal code it worked, with my changes not. i was not able to figure out whats causing it. still think its somekind of settings combination wich breaks it.

m-kostrzewa commented 3 years ago

on orginal code it worked, with my changes not.(..) still think its somekind of settings combination wich breaks it.

I assume you mean settings set by your code then? I set RAW+JPG outside of the app I'm testing (so, manually). Note, I'm not a user of BetterManual, so I'm not familiar with how it works.

Because JPG and RAW+JPG work, I have a suspicion it has something to do with previews.. Maybe a5000 does something weird when trying to prepare/show preview when ony RAW is available, but prefers JPG or something.

In the app I'm debugging there is the following snippet:

            cameraEx.cancelTakePicture();
            cameraEx.getNormalCamera().stopPreview();

but commenting out stopPreview() doesn't affect the application (i.e. it still crashes in the same way), so it's not the fault of showing the preview.

I think the app crashes inside cameraEx.cancelTakePicture(). Shutter close sound is heard, but then it crashes. I'm not familiar with internals of cancelTakePicture though but I suspect there is some special handling of only RAW (or rather, lack of JPG).

KillerInk commented 3 years ago

stopping preview is not needed. at least on a6000 something locked up the avosal. but i dont know what it caused. https://github.com/obs1dium/BetterManual/issues/8#issuecomment-331713511

m-kostrzewa commented 3 years ago

I wouldn't be surprised if some things can only be done on the main thread.

Maybe this is the culprit. TakePicture and CancelTakePicture are both called in different Runnables, outside of main thread.

m-kostrzewa commented 3 years ago

It was fixed by calling TakePicture and CancelTakePicture in the same Runnable (not even in any of the activity handlers).

Why does it work? No idea. I didn't see any race conditions in previous code. Anyways, thanks for help.

KillerInk commented 3 years ago

great you found it^^ think the race condition happen on native side and the native camera is threaded.

thenickdude commented 2 years ago

I get the hang with JPEG+RAW even if I put takePicture and cancelTakePicture in the same Runnable, works fine with just RAW though... Same thing if I use @KillerInk's fork. (A7R)

I really wish I could figure this out

thenickdude commented 2 years ago

Ahh it was hanging because I was setting the aspect ratio to 1:1, works fine with 3:2!

Edit: And in KillerInk's branch I had to remove this setColorDepth method in BaseActivity, or otherwise switching to RAW+JPEG made it hang forever after taking a pic:

  protected void setColorDepth(boolean highQuality) {
      Gpelibrary.GS_FRAMEBUFFER_TYPE type = highQuality ? Gpelibrary.GS_FRAMEBUFFER_TYPE.ABGR8888 : Gpelibrary.GS_FRAMEBUFFER_TYPE.RGBA4444;
      Gpelibrary.changeFrameBufferPixel(type);
  }