diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-03-05 17:00:04 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-03-05 17:01:23 +0300 |
commit | df267bd4c48a3b73ad959951419161ae8f9ed126 (patch) | |
tree | 1e2929fbfee0ea0f0a3a070d6c15a6d12b3fac14 /source/blender/blenkernel/intern/movieclip.c | |
parent | caa0b0fadf928b4f34be8ce761ac342b72450bcb (diff) |
Sequencer: Expose read-only FPS property for movie-type strips
Main purpose is to make it possible to cover FPS detection with regression test.
But it might also be handy for some other scripters.
Thanks Campbell for review!
Diffstat (limited to 'source/blender/blenkernel/intern/movieclip.c')
-rw-r--r-- | source/blender/blenkernel/intern/movieclip.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c index f67560fe006..607307554da 100644 --- a/source/blender/blenkernel/intern/movieclip.c +++ b/source/blender/blenkernel/intern/movieclip.c @@ -1202,6 +1202,23 @@ int BKE_movieclip_get_duration(MovieClip *clip) return clip->len; } +float BKE_movieclip_get_fps(MovieClip *clip) +{ + if (clip->source != MCLIP_SRC_MOVIE) { + return 0.0f; + } + movieclip_open_anim_file(clip); + if (clip->anim == NULL) { + return 0.0f; + } + short frs_sec; + float frs_sec_base; + if (IMB_anim_get_fps(clip->anim, &frs_sec, &frs_sec_base, true)) { + return (float)frs_sec / frs_sec_base; + } + return 0.0f; +} + void BKE_movieclip_get_aspect(MovieClip *clip, float *aspx, float *aspy) { *aspx = 1.0; |