Pages: [1] 2 3 Next   Go Down
  Print  
Author Topic: Question for devs: How to find out if movie recording in progress?  (Read 2946 times)
0 Members and 1 Guest are viewing this topic.
PhyrePhoX
Global Moderator
Hero Member
*****

Karma: +139/-37
Offline Offline

Posts: 1818


Coders Humiliate DSLR Kiddies


« on: 04 / April / 2008, 23:21:08 »

Hi,

to make things short: how do i find out if a movie recording is in progress? i already tried property cases, no luck (you only find either playback or record mode or moviemode, but not the actual recording). i tried memory browser (for a620 for example there is the value @ 0x73CF4 changed when recording is in progress but it doesnt get reset to 0 when it is over - got the value from ewavr).

i need to find it out for two reasons: a) the fixing of the bug on s3is (shooting raw pic while recording film interrupts recording) b) one of my previous projects requires this value, in order to finish it

here is the text by ewavr, maybe that will give you ida ASM pros a headstart:
Quote
in memory browser I can find many variables concerning current record time.
For example, in your A620 int variable at 0x73CF4 is current number of captured frames (and if interesting 0x73D0C is limit of frames for current video mode). If this variable changes, video record is in progress.

You can find this variables at top of sub_FFD2E0D8_my() in movie_rec.c for a620.
i guess in sub_FFD2E0D8_my() are more interesting variables, however i have yet to master ASM Sad

thanks in advance, PhoX
Logged

ewavr
Developers
Hero Member
****

Karma: +138/-1
Offline Offline

Posts: 652

A710IS


« Reply #1 on: 04 / April / 2008, 23:40:42 »

Watch 0x739A4 variable for your A620 in memory browser.
In A710 this variable (0x715BC):
0 - before first movie record
4 - during movie record
5 - during movie record finishing
1 - after movie record (standby)
other values - in other short-term stages

p.s 0x6115C for S3IS.
« Last Edit: 04 / April / 2008, 23:42:44 by ewavr » Logged
PhyrePhoX
Global Moderator
Hero Member
*****

Karma: +139/-37
Offline Offline

Posts: 1818


Coders Humiliate DSLR Kiddies


« Reply #2 on: 05 / April / 2008, 00:26:04 »

thanks! i can verifiy your finding in memory browser.
however when i try to access the content of the variable, i kinda fail.
Code
GeSHi (c):
      sprintf(osd_buf, "value: %u", atoi((char*)0x739A4));
      draw_string(100, 100, osd_buf, conf.osd_color);
 
Created by GeSHI 1.0.7.20
this normally should work (it works with 0x7F6F8 to find out jpg string), but it doesnt.
hm, come to think of it, string is the wrong type. argh, me stupid. i guess?

edit:
Code
GeSHi (c):
     sprintf(osd_buf, "value: %u", (void*)(*(int*)0x739A4));
Created by GeSHI 1.0.7.20
does the trick Smiley
« Last Edit: 05 / April / 2008, 00:35:51 by PhyrePhoX » Logged

PhyrePhoX
Global Moderator
Hero Member
*****

Karma: +139/-37
Offline Offline

Posts: 1818


Coders Humiliate DSLR Kiddies


« Reply #3 on: 05 / April / 2008, 00:54:28 »

Watch 0x739A4 variable for your A620 in memory browser.
In A710 this variable (0x715BC):
0 - before first movie record
4 - during movie record
5 - during movie record finishing
1 - after movie record (standby)
other values - in other short-term stages

p.s 0x6115C for S3IS.
the output of the values are the same on a620 and s3is. so i can safely assume that these shall be the same for the other cams as well.
can i safely assume that the address always is in the second line of the second "function" in each movie_rec.c? by second function i mean the one after movie_record_task.
like                 "LDR     R5, =0x739A4\n".
so i will add a new "function" to each lib.c like
Quote
void *movie_get_state()
{
    return (void*)(*(int*)0x739A4);
}
so i can use this function on every cam.

please correct me if i'm wrong. i'm still learning Wink

thanks so far!

edit:
small question again:
Code
GeSHi (c):
if (conf.save_raw && (!((*movie_get_state() > 1) && conf.save_raw_in_video   ))) {
Created by GeSHI 1.0.7.20
throws a warning when i compile it:
Quote
warning: comparison between pointer and integer
i feel like such a noob (which i am Big Grin). i'm sure this is just a small issue for you guys, it's just that google doesnt help me in this case.
« Last Edit: 05 / April / 2008, 02:40:45 by PhyrePhoX » Logged

GrAnd
Developers
Hero Member
****

Karma: +76/-2
Offline Offline

Posts: 917


[A610, S3IS]


« Reply #4 on: 05 / April / 2008, 08:12:13 »

small question again:
Code
GeSHi (c):
if (conf.save_raw && (!((*movie_get_state() > 1) && conf.save_raw_in_video   ))) {
Created by GeSHI 1.0.7.20
throws a warning when i compile it:
Quote
warning: comparison between pointer and integer

Just modify your function to return the int:
Code
GeSHi (c):
int movie_get_state()
{
   return *((int*)0x739A4);
}
 
Created by GeSHI 1.0.7.20

The another way, which does not require creation of function, is to add this address to stubs_min.S file and declare the appropriate integer variable in lolevel.h or platform.h, depends on access level required.
« Last Edit: 05 / April / 2008, 08:16:11 by GrAnd » Logged

CHDK Developer.
PhyrePhoX
Global Moderator
Hero Member
*****

Karma: +139/-37
Offline Offline

Posts: 1818


Coders Humiliate DSLR Kiddies


« Reply #5 on: 05 / April / 2008, 08:32:50 »



Just modify your function to return the int:
Code
GeSHi (c):
int movie_get_state()
{
   return *((int*)0x739A4);
}
 
Created by GeSHI 1.0.7.20

The another way, which does not require creation of function, is to add this address to stubs_min.S file and declare the appropriate integer variable in lolevel.h or platform.h, depends on access level required.

that worked, thanks!
i think i'm gonna go with lib.c. what are the advantages/disadvantages? what do you mean by access level required?


edit: my previous assumption on how to find out the address in movie_rec.c was wrong, i already fail at finding the address in the a460 movie_rec.c Sad
« Last Edit: 05 / April / 2008, 08:45:19 by PhyrePhoX » Logged

GrAnd
Developers
Hero Member
****

Karma: +76/-2
Offline Offline

Posts: 917


[A610, S3IS]


« Reply #6 on: 05 / April / 2008, 08:45:01 »

i think i'm gonna go with lib.c. what are the advantages/disadvantages?
Extra function just for returning the variable... Extra code...
The stubs_min.S file was intended the exactly for declaring such variables.

what do you mean by access level required?
Declare in lolevel.h - if this variable needed only for platfom/ located functions.
Declare in platform.h - if you need to access this variable from core/ code.
« Last Edit: 05 / April / 2008, 09:01:55 by GrAnd » Logged

CHDK Developer.
ewavr
Developers
Hero Member
****

Karma: +138/-1
Offline Offline

Posts: 652

A710IS


« Reply #7 on: 05 / April / 2008, 08:52:50 »

And after declaration via DEF(...) we can write in this variable:

movie_state=1; // pause movie recording (at least on A710)
....
movie_state=4; // resume movie recording (sorry, after resume sound not synchronized with video)
Logged
GrAnd
Developers
Hero Member
****

Karma: +76/-2
Offline Offline

Posts: 917


[A610, S3IS]


« Reply #8 on: 05 / April / 2008, 08:54:35 »

edit: my previous assumption on how to find out the address in movie_rec.c was wrong, i already fail at finding the address in the a460 movie_rec.c Sad

0x91D54 ?


A620:
Code:
void __attribute__((naked,noinline)) movie_record_task(){
 asm volatile(
                "STMFD   SP!, {R4,LR}\n"
                "SUB     SP, SP, #4\n"
                "MOV     R4, SP\n"
                "B       loc_FFD2C1D4\n"
"loc_FFD2C124:\n"                           
                "LDR     R3, =0x73988\n"
                "LDR     R2, [R3]\n"
                "CMP     R2, #0\n"
                "BNE     loc_FFD2C1C0\n"
                "SUB     R3, R12, #1\n"
                "CMP     R3, #0xA\n"
                "LDRLS   PC, [PC,R3,LSL#2]\n"
                "B       loc_FFD2C1C0\n"
                ".long loc_FFD2C170\n"
                ".long loc_FFD2C178\n"
                ".long loc_FFD2C190\n"
                ".long loc_FFD2C198\n"
                ".long loc_FFD2C1A0\n"
                ".long loc_FFD2C180\n"
                ".long loc_FFD2C1A8\n"
                ".long loc_FFD2C188\n"
                ".long loc_FFD2C1C0\n"
                ".long loc_FFD2C1B8\n"
                ".long loc_FFD2C1B0\n"
"loc_FFD2C170:\n"                           
                                       
                "BL      sub_FFD2C254\n"
                "B       loc_FFD2C1BC\n"
"loc_FFD2C178:\n"                           

                "BL      unlock_optical_zoom\n"                       
                "BL      sub_FFD2C488\n" 
                "B       loc_FFD2C1BC\n"
"loc_FFD2C180:\n"                           
                                       
                "BL      sub_FFD2C918_my\n"  //------------>
...

void __attribute__((naked,noinline)) sub_FFD2C918_my(){
 asm volatile(
                "STMFD   SP!, {R4-R11,LR}\n"
                "LDR     R5, =0x739A4\n"
                "SUB     SP, SP, #0x34\n"
...


A460, the same:
Code:
void __attribute__((naked,noinline)) movie_record_task(){

 asm volatile(
                "STMFD   SP!, {R4,LR}\n"   
                "SUB     SP, SP, #4\n"     
                "MOV     R4, SP\n"         
                "B       loc_FFEEA4C8\n"   

"loc_FFEEA424:\n"                           
                "LDR     R3, =0x91D38\n"   
                "LDR     R2, [R3]\n"       
                "CMP     R2, #0\n"         
                "BNE     loc_FFEEA4B4\n"   
                "SUB     R3, R12, #2\n"     
                "CMP     R3, #9\n"         
                "LDRLS   PC, [PC,R3,LSL#2]\n"
                "B       loc_FFEEA4B4\n"   

                ".long loc_FFEEA474\n"
                ".long loc_FFEEA48C\n"
                ".long loc_FFEEA494\n"
                ".long loc_FFEEA49C\n"
                ".long loc_FFEEA47C\n"
                ".long loc_FFEEA4A4\n"
                ".long loc_FFEEA484\n"
                ".long loc_FFEEA4B4\n"
                ".long loc_FFEEA4AC\n"
                ".long loc_FFEEA46C\n"

"loc_FFEEA46C:\n"                           
                                       
                "BL      sub_FFEEA564\n"   
                "B       loc_FFEEA4B0\n"   

"loc_FFEEA474:\n"
                           
                "BL      unlock_optical_zoom\n"                       
                "BL      sub_FFEEA718\n"   
                "B       loc_FFEEA4B0\n"   

"loc_FFEEA47C:\n"                           
                                       
                "BL      sub_FFEEAB9C_my\n"   //---------------->
...

void __attribute__((naked,noinline)) sub_FFEEAB9C_my(){
 asm volatile(
                "STMFD   SP!, {R4-R11,LR}\n"
                "LDR     R5, =0x91D54\n"   
                "SUB     SP, SP, #0x3C\n"   
...

Just another functions order in the file. Smiley
« Last Edit: 05 / April / 2008, 09:00:15 by GrAnd » Logged

CHDK Developer.
PhyrePhoX
Global Moderator
Hero Member
*****

Karma: +139/-37
Offline Offline

Posts: 1818


Coders Humiliate DSLR Kiddies


« Reply #9 on: 05 / April / 2008, 09:05:27 »

thanks guys, i now added an entry like this to stubs_min.S
Quote
DEF (movie_state,0x6115C)
and in platform.h
Quote
extern int movie_state;
this seems to does the trick. i renamed it from movie_get_state to movie_state, as i understand ewavr he also wants to write to that address. pausing the movie recording will sure be a nice feature. maybe we also have to find something like audio_rec_get_state so we can then pause that as well.

edit: my previous assumption on how to find out the address in movie_rec.c was wrong, i already fail at finding the address in the a460 movie_rec.c Sad

0x91D54 ?


...

Just another functions order in the file. Smiley

hm, sometimes i should scroll down a little bit more Big Grin
thanks! will add this value to all the stubs_min.S files, if i fail finding all of them i will let you know Big Grin
is there an automated way of finding out, perhaps? Big Grin

next question: what about cams that dont have movie_record_task (like a650)? if they dont have the variable declared in their stubs_min.S, what happens if i make the check like
Quote
    if (!((movie_get_state > 1) && conf.save_raw_in_video   ))
hm i will just test with my s3is Big Grin
« Last Edit: 05 / April / 2008, 09:25:03 by PhyrePhoX » Logged

GrAnd
Developers
Hero Member
****

Karma: +76/-2
Offline Offline

Posts: 917


[A610, S3IS]


« Reply #10 on: 05 / April / 2008, 09:21:45 »

is there an automated way of finding out, perhaps? Big Grin


May be... Big Grin
> grep -r -E -A3 "LDR[ ]+R5,[ ]+=0x" */sub/*/movie_rec.c | grep -B3 "CMP" | grep -E "LDR[ ]+R5,[ ]+=0x"
Quote
a460/sub/100d/movie_rec.c:                "LDR     R5, =0x91D54\n"   
a530/sub/100a/movie_rec.c:                "LDR     R5, =0x64704\n"
a540/sub/100b/movie_rec.c:                "LDR     R5, =0x64794\n"   
a550/sub/100c/movie_rec.c:                "LDR     R5, =0x9BAFC\n"
a560/sub/100a/movie_rec.c:                 "LDR     R5, =0xA2778\n"
a570/sub/100e/movie_rec.c:                "LDR     R5, =0xA30C0\n"   
a570/sub/101a/movie_rec.c:                "LDR     R5, =0xA30C0\n"   
a610/sub/100e/movie_rec.c:                "LDR     R5, =0x73634\n"
a610/sub/100f/movie_rec.c:                "LDR     R5, =0x73634\n"             
a620/sub/100f/movie_rec.c:                "LDR     R5, =0x739A4\n"
a630/sub/100c/movie_rec.c:                "LDR     R5, =0x666CC\n"             
a640/sub/100b/movie_rec.c:                "LDR     R5, =0x66894\n"
a700/sub/100b/movie_rec.c:                "LDR     R5, =0x6E47C\n"             
a710/sub/100a/movie_rec.c:                "LDR     R5, =0x715BC\n"   
g7/sub/100e/movie_rec.c:                "LDR     R5, =0x771E0\n"
g7/sub/100g/movie_rec.c:                "LDR     R5, =0x771E0\n"   
g7/sub/100i/movie_rec.c:                "LDR     R5, =0x771E0\n"   
g7/sub/100j/movie_rec.c:                "LDR     R5, =0x771E0\n"   
ixus55_sd450/sub/100b/movie_rec.c:                "LDR     R5, =0x7CDBC\n"
ixus55_sd450/sub/100c/movie_rec.c:                "LDR     R5, =0x7CDBC\n"
ixus700_sd500/sub/101a/movie_rec.c:                "LDR     R5, =0x6F684\n"   
ixus700_sd500/sub/101b/movie_rec.c:                "LDR     R5, =0x6F684\n"
ixus70_sd1000/sub/100c/movie_rec.c:                 "LDR     R5, =0xBB550\n"
ixus70_sd1000/sub/101b/movie_rec.c:                "LDR     R5, =0xBB550\n"
ixus70_sd1000/sub/102a/movie_rec.c:                 "LDR     R5, =0xBB550\n"
ixus800_sd700/sub/100b/movie_rec.c:                "LDR     R5, =0x6ECA4\n"
ixus800_sd700/sub/101b/movie_rec.c:                 "LDR     R5, =0x6ECA4\n"
ixus850_sd800/sub/100e/movie_rec.c:                 "LDR     R5, =0x8BBF8\n"
ixus950_sd850/sub/100c/movie_rec.c:"                LDR     R5, =0xA8638\n"
s2is/sub/100e/movie_rec.c:                "LDR     R5, =0x5C95C\n"                       
s2is/sub/100f/movie_rec.c:                "LDR     R5, =0x5C95C\n"             
s2is/sub/100g/movie_rec.c:                "LDR     R5, =0x5C97C\n"             
s3is/sub/100a/movie_rec.c:                "LDR     R5, =0x6115C\n"   
« Last Edit: 05 / April / 2008, 09:24:07 by GrAnd » Logged

CHDK Developer.
PhyrePhoX
Global Moderator
Hero Member
*****

Karma: +139/-37
Offline Offline

Posts: 1818


Coders Humiliate DSLR Kiddies


« Reply #11 on: 05 / April / 2008, 09:27:13 »

you truly do know your environment well. asm, c and even shell. thanks!
have you read my last question in my last post too?
good thing with me being so stupid is that other people too scared to ask the same questions get their answers Wink
Logged

GrAnd
Developers
Hero Member
****

Karma: +76/-2
Offline Offline

Posts: 917


[A610, S3IS]


« Reply #12 on: 05 / April / 2008, 09:43:41 »

you truly do know your environment well. asm, c and even shell. thanks!
Even more Big Grin
> grep -r -E -A3 "LDR[ ]+R5,[ ]+=0x" */sub/*/movie_rec.c | grep -B3 "CMP" | grep -E "LDR[ ]+R5,[ ]+=0x" | sed "s/ *\" *LDR *R5, *=/  DEF\(movie_state, /;s/\\\n\"/\)/"
Quote
a460/sub/100d/movie_rec.c:  DEF(movie_state, 0x91D54)   
a530/sub/100a/movie_rec.c:  DEF(movie_state, 0x64704)
a540/sub/100b/movie_rec.c:  DEF(movie_state, 0x64794)   
a550/sub/100c/movie_rec.c:  DEF(movie_state, 0x9BAFC)
a560/sub/100a/movie_rec.c:  DEF(movie_state, 0xA2778)
a570/sub/100e/movie_rec.c:  DEF(movie_state, 0xA30C0)   
a570/sub/101a/movie_rec.c:  DEF(movie_state, 0xA30C0)   
a610/sub/100e/movie_rec.c:  DEF(movie_state, 0x73634)
a610/sub/100f/movie_rec.c:  DEF(movie_state, 0x73634)             
a620/sub/100f/movie_rec.c:  DEF(movie_state, 0x739A4)
a630/sub/100c/movie_rec.c:  DEF(movie_state, 0x666CC)             
a640/sub/100b/movie_rec.c:  DEF(movie_state, 0x66894)
a700/sub/100b/movie_rec.c:  DEF(movie_state, 0x6E47C)             
a710/sub/100a/movie_rec.c:  DEF(movie_state, 0x715BC)   
g7/sub/100e/movie_rec.c:  DEF(movie_state, 0x771E0)
g7/sub/100g/movie_rec.c:  DEF(movie_state, 0x771E0)   
g7/sub/100i/movie_rec.c:  DEF(movie_state, 0x771E0)   
g7/sub/100j/movie_rec.c:  DEF(movie_state, 0x771E0)   
ixus55_sd450/sub/100b/movie_rec.c:  DEF(movie_state, 0x7CDBC)
ixus55_sd450/sub/100c/movie_rec.c:  DEF(movie_state, 0x7CDBC)
ixus700_sd500/sub/101a/movie_rec.c:  DEF(movie_state, 0x6F684)   
ixus700_sd500/sub/101b/movie_rec.c:  DEF(movie_state, 0x6F684)
ixus70_sd1000/sub/100c/movie_rec.c:  DEF(movie_state, 0xBB550)
ixus70_sd1000/sub/101b/movie_rec.c:  DEF(movie_state, 0xBB550)
ixus70_sd1000/sub/102a/movie_rec.c:  DEF(movie_state, 0xBB550)
ixus800_sd700/sub/100b/movie_rec.c:  DEF(movie_state, 0x6ECA4)
ixus800_sd700/sub/101b/movie_rec.c:  DEF(movie_state, 0x6ECA4)
ixus850_sd800/sub/100e/movie_rec.c:  DEF(movie_state, 0x8BBF8)
ixus950_sd850/sub/100c/movie_rec.c:  DEF(movie_state, 0xA8638)
s2is/sub/100e/movie_rec.c:  DEF(movie_state, 0x5C95C)                       
s2is/sub/100f/movie_rec.c:  DEF(movie_state, 0x5C95C)             
s2is/sub/100g/movie_rec.c:  DEF(movie_state, 0x5C97C)             
s3is/sub/100a/movie_rec.c:  DEF(movie_state, 0x6115C)   

next question: what about cams that dont have movie_record_task (like a650)?
if they dont have the variable declared in their stubs_min.S, what happens if i make the check like
In that case you should declare this variable in other way (i.e. as int variable in C-file and assign it with 0). Otherwise, it will not compile.
Logged

CHDK Developer.
PhyrePhoX
Global Moderator
Hero Member
*****

Karma: +139/-37
Offline Offline

Posts: 1818


Coders Humiliate DSLR Kiddies


« Reply #13 on: 05 / April / 2008, 09:50:30 »

you truly do know your environment well. asm, c and even shell. thanks!
Even more Big Grin
> grep -r -E -A3 "LDR[ ]+R5,[ ]+=0x" */sub/*/movie_rec.c | grep -B3 "CMP" | grep -E "LDR[ ]+R5,[ ]+=0x" | sed "s/ *\" *LDR *R5, *=/  DEF\(movie_state, /;s/\\\n\"/\)/"
Quote
...
darn, about 10 minutes too late Big Grin thanks anyways, will help me doing these "batch-jobs" in future.
Quote
next question: what about cams that dont have movie_record_task (like a650)?
if they dont have the variable declared in their stubs_min.S, what happens if i make the check like
In that case you should declare this variable in other way (i.e. as int variable in C-file and assign it with 0). Otherwise, it will not compile.
okay, that makes sense. but in which file should i declare this?
Logged

GrAnd
Developers
Hero Member
****

Karma: +76/-2
Offline Offline

Posts: 917


[A610, S3IS]


« Reply #14 on: 05 / April / 2008, 10:03:40 »

okay, that makes sense. but in which file should i declare this?
lib.c ? Big Grin
Logged

CHDK Developer.
Pages: [1] 2 3 Next   Go Up
  Print  
 
Jump to: