avcodec/encode: add a helper to convert from a duration to samples
Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
@@ -99,6 +99,18 @@ static av_always_inline int64_t ff_samples_to_time_base(const AVCodecContext *av
|
||||
avctx->time_base);
|
||||
}
|
||||
|
||||
/**
|
||||
* Rescale from time base to AVCodecContext.sample_rate.
|
||||
*/
|
||||
static av_always_inline int64_t ff_samples_from_time_base(const AVCodecContext *avctx,
|
||||
int64_t duration)
|
||||
{
|
||||
if (!duration)
|
||||
return duration;
|
||||
return av_rescale_q(duration, avctx->time_base,
|
||||
(AVRational){ 1, avctx->sample_rate });
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the elements of codec context matrices (intra_matrix, inter_matrix or
|
||||
* chroma_intra_matrix) are within the specified range.
|
||||
|
||||
Reference in New Issue
Block a user