Question for devs: How to find out if movie recording in progress? - General Discussion and Assistance - CHDK Forum supplierdeeply

Question for devs: How to find out if movie recording in progress?

  • 39 Replies
  • 14809 Views
*

Offline PhyrePhoX

  • *****
  • 2254
  • make RAW not WAR
    • PhyreWorX
Advertisements
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

  • ****
  • 1057
  • A710IS
Re: Question for devs: How to find out if movie recording in progress?
« Reply #1 on: 04 / April / 2008, 18: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, 18:42:44 by ewavr »

*

Offline PhyrePhoX

  • *****
  • 2254
  • make RAW not WAR
    • PhyreWorX
Re: Question for devs: How to find out if movie recording in progress?
« Reply #2 on: 04 / April / 2008, 19: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: (c) [Select]
       sprintf(osd_buf, "value: %u", atoi((char*)0x739A4));
       draw_string(100, 100, osd_buf, conf.osd_color);
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) [Select]
      sprintf(osd_buf, "value: %u", (void*)(*(int*)0x739A4)); does the trick :)
« Last Edit: 04 / April / 2008, 19:35:51 by PhyrePhoX »

*

Offline PhyrePhoX

  • *****
  • 2254
  • make RAW not WAR
    • PhyreWorX
Re: Question for devs: How to find out if movie recording in progress?
« Reply #3 on: 04 / April / 2008, 19: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 ;)

thanks so far!

edit:
small question again:
Code: (c) [Select]
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: 04 / April / 2008, 21:40:45 by PhyrePhoX »


*

Offline GrAnd

  • ****
  • 916
  • [A610, S3IS]
    • CHDK
Re: Question for devs: How to find out if movie recording in progress?
« Reply #4 on: 05 / April / 2008, 03:12:13 »
small question again:
Code: (c) [Select]
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) [Select]
int movie_get_state()
{
    return *((int*)0x739A4);
}

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

*

Offline PhyrePhoX

  • *****
  • 2254
  • make RAW not WAR
    • PhyreWorX
Re: Question for devs: How to find out if movie recording in progress?
« Reply #5 on: 05 / April / 2008, 03:32:50 »


Just modify your function to return the int:
Code: (c) [Select]
int movie_get_state()
{
    return *((int*)0x739A4);
}

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, 03:45:19 by PhyrePhoX »

*

Offline GrAnd

  • ****
  • 916
  • [A610, S3IS]
    • CHDK
Re: Question for devs: How to find out if movie recording in progress?
« Reply #6 on: 05 / April / 2008, 03: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, 04:01:55 by GrAnd »
CHDK Developer.

*

Offline ewavr

  • ****
  • 1057
  • A710IS
Re: Question for devs: How to find out if movie recording in progress?
« Reply #7 on: 05 / April / 2008, 03: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)


*

Offline GrAnd

  • ****
  • 916
  • [A610, S3IS]
    • CHDK
Re: Question for devs: How to find out if movie recording in progress?
« Reply #8 on: 05 / April / 2008, 03: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 :(

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, 04:00:15 by GrAnd »
CHDK Developer.

*

Offline PhyrePhoX

  • *****
  • 2254
  • make RAW not WAR
    • PhyreWorX
Re: Question for devs: How to find out if movie recording in progress?
« Reply #9 on: 05 / April / 2008, 04: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 :(

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, 04:25:03 by PhyrePhoX »

 

Related Topics