Author Topic: Question for devs: How to find out if movie recording in progress?  (Read 4979 times)

Offline PhyrePhoX

  • Global Moderator
  • Guru Member
  • *****
  • Posts: 2254
  • make RAW not WAR
    • PhyreWorX
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 :(

thanks in advance, PhoX

Offline ewavr

  • Developers
  • Hero Member
  • ****
  • Posts: 1057
  • A710IS
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: 05 / April / 2008, 03:42:44 by ewavr »

Offline PhyrePhoX

  • Global Moderator
  • Guru Member
  • *****
  • Posts: 2254
  • make RAW not WAR
    • PhyreWorX
thanks! i can verifiy your finding in memory browser.
however when i try to access the content of the variable, i kinda fail.
Code: C
  1.        sprintf(osd_buf, "value: %u", atoi((char*)0x739A4));
  2.        draw_string(100, 100, osd_buf, conf.osd_color);
  3.  
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: C
  1.       sprintf(osd_buf, "value: %u", (void*)(*(int*)0x739A4));
does the trick :)
« Last Edit: 05 / April / 2008, 04:35:51 by PhyrePhoX »

Offline PhyrePhoX

  • Global Moderator
  • Guru Member
  • *****
  • Posts: 2254
  • make RAW not WAR
    • PhyreWorX
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 ;)

thanks so far!

edit:
small question again:
Code: C
  1.  if (conf.save_raw && (!((*movie_get_state() > 1) && conf.save_raw_in_video   ))) {
throws a warning when i compile it:
Quote
warning: comparison between pointer and integer
i feel like such a noob (which i am :D). 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, 06:40:45 by PhyrePhoX »

Offline GrAnd

  • Developers
  • Hero Member
  • ****
  • Posts: 916
  • [A610, S3IS]
    • CHDK
small question again:
Code: C
  1.  if (conf.save_raw && (!((*movie_get_state() > 1) && conf.save_raw_in_video   ))) {
throws a warning when i compile it:
Quote
warning: comparison between pointer and integer

Just modify your function to return the int:
Code: C
  1. int movie_get_state()
  2. {
  3.     return *((int*)0x739A4);
  4. }
  5.  

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, 12:16:11 by GrAnd »
CHDK Developer.

Offline PhyrePhoX

  • Global Moderator
  • Guru Member
  • *****
  • Posts: 2254
  • make RAW not WAR
    • PhyreWorX


Just modify your function to return the int:
Code: C
  1. int movie_get_state()
  2. {
  3.     return *((int*)0x739A4);
  4. }
  5.  

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 :(
« Last Edit: 05 / April / 2008, 12:45:19 by PhyrePhoX »

Offline GrAnd

  • Developers
  • Hero Member
  • ****
  • Posts: 916
  • [A610, S3IS]
    • CHDK
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, 13:01:55 by GrAnd »
CHDK Developer.

Offline ewavr

  • Developers
  • Hero Member
  • ****
  • Posts: 1057
  • A710IS
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)

Offline GrAnd

  • Developers
  • Hero Member
  • ****
  • Posts: 916
  • [A610, S3IS]
    • CHDK
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 :(

0x91D54 ?


A620:
Code: [Select]
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: [Select]
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. :)
« Last Edit: 05 / April / 2008, 13:00:15 by GrAnd »
CHDK Developer.

CHDK Forum

Re: Question for devs: How to find out if movie recording in progress?
« Reply #8 on: 05 / April / 2008, 12:54:35 »

Offline PhyrePhoX

  • Global Moderator
  • Guru Member
  • *****
  • Posts: 2254
  • make RAW not WAR
    • PhyreWorX
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 :(

0x91D54 ?


...

Just another functions order in the file. :)

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

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 :D
« Last Edit: 05 / April / 2008, 13:25:03 by PhyrePhoX »

Offline GrAnd

  • Developers
  • Hero Member
  • ****
  • Posts: 916
  • [A610, S3IS]
    • CHDK
is there an automated way of finding out, perhaps? :D


May be... :D
> 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, 13:24:07 by GrAnd »
CHDK Developer.

Offline PhyrePhoX

  • Global Moderator
  • Guru Member
  • *****
  • Posts: 2254
  • make RAW not WAR
    • PhyreWorX
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 ;)

Offline GrAnd

  • Developers
  • Hero Member
  • ****
  • Posts: 916
  • [A610, S3IS]
    • CHDK
you truly do know your environment well. asm, c and even shell. thanks!
Even more :D
> 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.
CHDK Developer.

Offline PhyrePhoX

  • Global Moderator
  • Guru Member
  • *****
  • Posts: 2254
  • make RAW not WAR
    • PhyreWorX
you truly do know your environment well. asm, c and even shell. thanks!
Even more :D
> 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 :D 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?

Offline GrAnd

  • Developers
  • Hero Member
  • ****
  • Posts: 916
  • [A610, S3IS]
    • CHDK
okay, that makes sense. but in which file should i declare this?
lib.c ? :D
CHDK Developer.

 


SimplePortal 2.3.3 © 2008-2010, SimplePortal