diff options
author | Baptiste Coudurier <baptiste.coudurier@gmail.com> | 2018-03-21 13:13:51 -0700 |
---|---|---|
committer | Baptiste Coudurier <baptiste.coudurier@gmail.com> | 2018-10-12 12:27:58 -0700 |
commit | bb89109a0a29d51cb207352834f6b92784c1700d (patch) | |
tree | e25dbf6678f05c427387bbb1f82e5c1e315a9688 /libavformat/mxf.c | |
parent | 84e8a87ca082f5a882e83fcb34a970f8b720cc25 (diff) | |
download | ffmpeg-bb89109a0a29d51cb207352834f6b92784c1700d.tar.gz |
avformat/mxfenc: correctly set content package rate in system element
Diffstat (limited to 'libavformat/mxf.c')
-rw-r--r-- | libavformat/mxf.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/libavformat/mxf.c b/libavformat/mxf.c index c8b57f7f0b..8376a2b9bf 100644 --- a/libavformat/mxf.c +++ b/libavformat/mxf.c @@ -171,3 +171,20 @@ const MXFSamplesPerFrame *ff_mxf_get_samples_per_frame(AVFormatContext *s, return &mxf_spf[idx]; } + +static const int mxf_content_package_rates[] = { + 3, 2, 7, 13, 4, 10, 12, +}; + +int ff_mxf_get_content_package_rate(AVRational time_base) +{ + int idx = av_find_nearest_q_idx(time_base, mxf_time_base); + AVRational diff = av_sub_q(time_base, mxf_time_base[idx]); + + diff.num = FFABS(diff.num); + + if (av_cmp_q(diff, (AVRational){1, 1000}) >= 0) + return -1; + + return mxf_content_package_rates[idx]; +} |