Easy Coding tasks

Started by a1ex, December 22, 2013, 12:19:13 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

a1ex

Inspired from darktable. These things require minimal C skills and can be solved in roughly 5-10 lines of code => good for beginner developers looking for something easy to jump in.

Look for "easy coding task" around the forum or the issue tracker
That's how we used to mark them lately.

Minor typos
https://bitbucket.org/hudson/magic-lantern/issue/1742/typo-in-menu solved by pompeiisneaks

(keep looking for these things; we are not native English speakers)


Benchmark fonts (solved in 3aba2ce)

Cropmarks in photo mode solved by 1% and merged by pompeiisneaks

Cold pixel fix in raw2dng (solved by escho)

Bad pixel fix from a .badpixel file (solved by bouncyball)

File join support in raw2dng (autodetect and merge .RAW, .R00, .R01...) (solved by bouncyball)



Missing indicators in the LiveView info bars

Solving one indicator from this list should fit as a EasyCoding task. Solving all of them will take more than 10 lines of code.

https://bitbucket.org/hudson/magic-lantern/issue/1741/50d-maybe-others-no-longer-displays
https://bitbucket.org/hudson/magic-lantern/issue/1687/exposure-compensation-missing-from-lv (solved by ayshih)
https://bitbucket.org/hudson/magic-lantern/issue/1715/no-aperture-stop-indication-sincenightly (solved by ayshih)
http://www.magiclantern.fm/forum/index.php?topic=9282
and the API you should use is described here: http://www.magiclantern.fm/forum/index.php?topic=8539.msg79753#msg79753

Happy coding!

pravdomil

thanks for this a1ex, I plan spend some weekend on coding it, very usefull

g3gg0

Clean up movie restart feature
Current state:
The "Movie Restart" feature is for automatic restarting H264 recording if it was stopped due to reaching 4GiB or 30 min limits.
At the moment this is done by checking some error message dialog id and recording state.
This is a bit hard to port for every model and on firmware change.

Goal:
Rewrite the code so that it is more or less a simple state machine that receives the users keypresses as input (Rec, Set)
and checks if recording started (RECORDING_H264) within a second after the keypress was received. Same for stopping.
If the recording indicator indicates that recording suddenly stopped, it should re-emit a movie_start() and check if it records longer than 10 seconds.
If recording stops in less than 10 seconds again, reset the state and wait for the next user input (Rec, Set)
This check is to make sure that recording didnt stop automatically due to e.g. sensor overheating or disk space.

Hint: It would be a good start to draw a state diagram
(i *never* thought i would ever really say that i like drawing charts ;) )

Rework NotifyBox
Current state:
The NotifyBox feature is an useful on-screen display to notify the user of some happenings.
Unfortunately its implementation is quite crude, just printing the text on screen, providing not much usability.

Goal:
Pimp this functionality by
1) drawing some borders and making it look more like a information dialog, not like a bug.
2) adding e.g. NotifyBoxEx which allows to pass some icon type
(warning , error or information )
3) add an option to make the boxes disappear when the user presses a button

Make sure the icons being used are GPLed! (e.g. GNOME, KDE or any other linux window manager/toolkit provide plenty)

there is some reference implementation that cleans up the stuff a bit
Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: [email protected]
ONLY donate for things we have done, not for things you expect!

1%


a1ex

I don't know, where's your pull request?

1%

QuoteI don't know, where's your pull request?

No HG transplant?

Quote
Unfortunately its implementation is quite crude, just printing the text on screen, providing not much usability.

From using it, also seems inefficient.

g3gg0

Quote from: 1% on February 02, 2014, 09:23:17 PM
No HG transplant?

From using it, also seems inefficient.

it is much easier to get a pull request, than to dig in other repositories, expecially when you dont know where to look.

yes, its inefficient. but it was never meant to get used that much ;)
Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: [email protected]
ONLY donate for things we have done, not for things you expect!

pompeiisneaks

Quote from: 1% on February 02, 2014, 08:52:46 PM
Did my fix not work for this?

Sorry I found that you didn't put this in as a pull request, so I just put your fix into my tree and submitted the pull request,  I gave credit to you for the find though.  a1ex if you want to wait and reject mine to give 1% credit by all means do so :)

~Phil

1%

As long as it makes it back to main I'm happy.

viniciusatique

Quote from: g3gg0 on February 02, 2014, 08:40:53 PM
Clean up movie restart feature
Current state:
The "Movie Restart" feature is for automatic restarting H264 recording if it was stopped due to reaching 4GiB or 30 min limits.
At the moment this is done by checking some error message dialog id and recording state.
This is a bit hard to port for every model and on firmware change.

Goal:
Rewrite the code so that it is more or less a simple state machine that receives the users keypresses as input (Rec, Set)
and checks if recording started (RECORDING_H264) within a second after the keypress was received. Same for stopping.
If the recording indicator indicates that recording suddenly stopped, it should re-emit a movie_start() and check if it records longer than 10 seconds.
If recording stops in less than 10 seconds again, reset the state and wait for the next user input (Rec, Set)
This check is to make sure that recording didnt stop automatically due to e.g. sensor overheating or disk space.

Hint: It would be a good start to draw a state diagram
(i *never* thought i would ever really say that i like drawing charts ;) )

Rework NotifyBox
Current state:
The NotifyBox feature is an useful on-screen display to notify the user of some happenings.
Unfortunately its implementation is quite crude, just printing the text on screen, providing not much usability.

Goal:
Pimp this functionality by
1) drawing some borders and making it look more like a information dialog, not like a bug.
2) adding e.g. NotifyBoxEx which allows to pass some icon type
(warning , error or information )
3) add an option to make the boxes disappear when the user presses a button

Make sure the icons being used are GPLed! (e.g. GNOME, KDE or any other linux window manager/toolkit provide plenty)

If so, how does the camera know if the button was pushed by user or by the movie restart feature? Because if it can't tell the diference, I think it will never stop recording. Am I right or did I miss something? Perhaps using the time (29'.59") as a marker that it was stopped because it reached the limit time? Any inputs?

1%

It stops at like 1799 frames. Maybe can do a frame count.

g3gg0

Quote from: viniciusatique on February 08, 2014, 11:32:05 PM
If so, how does the camera know if the button was pushed by user or by the movie restart feature?

as described, the user keys have to be monitored.
if user pressed REC and the video stops, well then its likely that this was intended ;)
if nothing was pressed, stopping was not intended by the user.
Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: [email protected]
ONLY donate for things we have done, not for things you expect!

viniciusatique

Quote from: 1% on February 09, 2014, 12:16:05 AM
It stops at like 1799 frames. Maybe can do a frame count.

But then it would be different for every h264 format, no? like 24fps and 50 fps and 29 fps. Any idea on how I can use the time?
I was thinking something in the line of:
if(!RECORDING_H264 && recording_prev && BGMT_REC && time elapsed 1799 seconds?) But I don;t know how to code this!

And what is the difference between BGMT_REC and BGMT_FLASH_MOVIE?

viniciusatique

Quote from: g3gg0 on February 09, 2014, 12:22:04 AM
as described, the user keys have to be monitored.
if user pressed REC and the video stops, well then its likely that this was intended ;)
if nothing was pressed, stopping was not intended by the user.

Yes, I understand that, but what then is the command the canon firmware gives the camera to stop recording? If it isn't an error (because we don't want to use errors anymore, right?), I was under the impression it was a BGMT_REC or something similar to movie_was_stopped_by_set.

g3gg0

Quote from: viniciusatique on February 09, 2014, 12:30:02 AM
Yes, I understand that, but what then is the command the canon firmware gives the camera to stop recording?
canon does not fake a keypress.
it is handled in the state objects internally.
Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: [email protected]
ONLY donate for things we have done, not for things you expect!

viniciusatique

So I'm missing only one information and I can't find it, though I've looked for it: what is the line I should use in the code to tell that the camera stopped the recording because of the time limit?

g3gg0

if the video stopped and the user did not press rec, restart video.
Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: [email protected]
ONLY donate for things we have done, not for things you expect!

viniciusatique

Ooooh! Right! Thanks g3gg0

viniciusatique

Just one last thing: when video stopped on 5D2 it was "stopped by set", right? Now on 5D3 is it the same thing? And if it is, can I use it even when 5D3 doesn't have a gui.c?

viniciusatique

So, I tried this code and it didn't work. Any ideas why? As far as I can understand it should work because it wasn't a press of BGMT_REC that stopped the recording.

if(!RECORDING_H264 && recording_prev && !BGMT_REC)
        #endif
        {
            if (movie_restart)
            {
                msleep(500);
                movie_start();
            }
        }
        recording_prev = RECORDING_H264;

        if(!RECORDING_H264)
        {
            movie_was_stopped_by_set = 0;
        }
    #endif

viniciusatique

Done! Working on my 5D3. Movie restarting after every 29 minutes. May work for all cameras. Doesn't depend on error messages. See what you think.

#ifdef FEATURE_MOVIE_RESTART
        static int recording_prev = 0;
        static int first_time = 0;
        static int start_rec_time = 0;
        static int r = 0;
       
        #if defined(CONFIG_5D2) || defined(CONFIG_50D) || defined(CONFIG_7D)
        if(!RECORDING_H264 && recording_prev && !movie_was_stopped_by_set) // see also gui.c
        #else
        if(RECORDING_H264)
        #endif
        {
            if (movie_restart)
            { 
               if(!first_time)
                  {
                 start_rec_time = get_seconds_clock();
                 NotifyBox(2000,"Movie Restart Active", start_rec_time, r > 1 ? "s" : "");
                 first_time = 1;   
                    }
                r =  get_seconds_clock() - start_rec_time;
                     if(r > 1740)
                    {
                movie_end();
                start_rec_time = 0;
                first_time = 0;
                NotifyBox(2000,"Restarting", start_rec_time, r > 1 ? "s" : "");
                movie_start();
                    }
            }
        }
       
        recording_prev = RECORDING_H264;

        if(!RECORDING_H264)
        {
            movie_was_stopped_by_set = 0;
        }
    #endif

a1ex

It probably works for you, but the assumption about 1740 is pretty hard. What happens if you use FPS override? What if it stops because of high bitrate / slow card?

Try to follow g3gg0's advice, it's much more robust.

viniciusatique

It stops and doesn't restart. It restarts only if the command movie_end() was issued. Tested putting 2000 and letting the camera stopping automatically. Didn't restart.
Anyway, it was the way I could do it. Would love to do exactly what g3gg0 suggested but there are too many variables I don't know. Like: what is the codification of the button rec? Which button starts recording and what is its name. What are the commands available for me to use. I couldn't find documentation that explains how everything works. :-(
Anyway, for now this works. Don't know if it will alonside fps override though. Will keep trying to think about g3gg9's solution

1%

The popup way works... just probably the stub is wrong in 5DIII, it was working on 6D when I was testing it and also when movies stopped from BR being too high.

g3gg0

nah sorry, thats not what i meant it to be.
i recommended starting with a state diagram to clarify the problem.
Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: [email protected]
ONLY donate for things we have done, not for things you expect!