ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinha...@outlook.com> | 
Mon Apr 14 22:13:19 2025 +0200| [2ab10212647bd8cce73f4ff98879691e6ff5916c] | 
committer: Andreas Rheinhardt

fftools/textformat/avtextformat: Simplify avtext_print_rational()

Use snprintf() directly instead of initializing an AVBPrint
just for this.

Reviewed-by: softworkz . <softworkz-at-hotmail....@ffmpeg.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@outlook.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2ab10212647bd8cce73f4ff98879691e6ff5916c
---

 fftools/textformat/avtextformat.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/fftools/textformat/avtextformat.c 
b/fftools/textformat/avtextformat.c
index 6c09f9d2cd..c1b5eefab4 100644
--- a/fftools/textformat/avtextformat.c
+++ b/fftools/textformat/avtextformat.c
@@ -460,10 +460,9 @@ int avtext_print_string(AVTextFormatContext *tctx, const 
char *key, const char *
 void avtext_print_rational(AVTextFormatContext *tctx,
                                          const char *key, AVRational q, char 
sep)
 {
-    AVBPrint buf;
-    av_bprint_init(&buf, 0, AV_BPRINT_SIZE_AUTOMATIC);
-    av_bprintf(&buf, "%d%c%d", q.num, sep, q.den);
-    avtext_print_string(tctx, key, buf.str, 0);
+    char buf[44];
+    snprintf(buf, sizeof(buf), "%d%c%d", q.num, sep, q.den);
+    avtext_print_string(tctx, key, buf, 0);
 }
 
 void avtext_print_time(AVTextFormatContext *tctx, const char *key,

_______________________________________________
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to