This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit dd9756286d0c98959dea77a79920063716d3c5c1
Author:     James Almer <[email protected]>
AuthorDate: Fri Feb 13 13:00:10 2026 -0300
Commit:     James Almer <[email protected]>
CommitDate: Tue Feb 17 20:17:23 2026 -0300

    avcodec/encode: add a helper to convert from a duration to samples
    
    Signed-off-by: James Almer <[email protected]>
---
 libavcodec/encode.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/libavcodec/encode.h b/libavcodec/encode.h
index 82bd3c9431..b66b387030 100644
--- a/libavcodec/encode.h
+++ b/libavcodec/encode.h
@@ -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.

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to