-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose frame rate of streams #35
base: master
Are you sure you want to change the base?
Conversation
Hi @niklaskorz! And thank you for the pull request.
I think it won't be that easy. I hope you are familiar with the FFmpeg documentation for the
There is also another field named
Using
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job! Sorry for the delay. There's a few minor things that need to be fixed. Otherwise, I'm happy with the PR.
src/time.rs
Outdated
pub const fn new(num: u32, den: u32) -> Self { | ||
Self { num, den } | ||
Self { | ||
rational: Rational::new(num as i32, den as i32), | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Casting the numerator and denominator types from u32
to i32
can lead to unexpected results. I think it's better to simply change the method to:
pub const fn new(num: i32, den: i32) -> Self {
...
}
and allow negative time bases. I guess it's less evil than allowing unexpected results. FFmpeg allows negative time bases anyway.
Thanks for the input @operutka! I'll try to add the required changes tomorrow. |
@operutka As suggested, timebases now use |
Getting the frame rate of a stream works essentially the same way as getting the time base.
I'm unsure about whether it makes sense to introduce a new type, as
TimeBase
basically already resembles theAVRational
type.If anything, it might make sense to rename
TimeBase
to a sharedRational
type and makeTimeBase
an alias ofRational
.