PR #22301 opened by michaelni
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/22301
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/22301.patch

The docs currently talk about 0 but for fractions that means 0/x with x!=0
but 0/0 is often used and is mathematical a more correct choice for "unknown"
0 in fact is not unknown in a mathematical sense

Signed-off-by: Michael Niedermayer <[email protected]>


>From 2b21b5ca8a7e73a35eed12370bb7796586be5891 Mon Sep 17 00:00:00 2001
From: Michael Niedermayer <[email protected]>
Date: Fri, 27 Feb 2026 00:58:56 +0100
Subject: [PATCH] Suggest 0/0 explicitly as unknown aspect ratio

The docs currently talk about 0 but for fractions that means 0/x with x!=0
but 0/0 is often used and is mathematical a more correct choice for "unknown"
0 in fact is not unknown in a mathematical sense

Signed-off-by: Michael Niedermayer <[email protected]>
---
 libavcodec/avcodec.h   | 2 +-
 libavcodec/codec_par.h | 2 +-
 libavformat/avformat.h | 2 +-
 libavformat/internal.h | 2 +-
 libavutil/frame.h      | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 1a8f77af82..9d413a3510 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -615,7 +615,7 @@ typedef struct AVCodecContext {
     int coded_width, coded_height;
 
     /**
-     * sample aspect ratio (0 if unknown)
+     * sample aspect ratio (0/0 or 0 if unknown)
      * That is the width of a pixel divided by the height of the pixel.
      * Numerator and denominator must be relatively prime and smaller than 256 
for some video standards.
      * - encoding: Set by user.
diff --git a/libavcodec/codec_par.h b/libavcodec/codec_par.h
index 2697605d4d..b86ac85ce0 100644
--- a/libavcodec/codec_par.h
+++ b/libavcodec/codec_par.h
@@ -139,7 +139,7 @@ typedef struct AVCodecParameters {
      * should have when displayed.
      *
      * When the aspect ratio is unknown / undefined, the numerator should be
-     * set to 0 (the denominator may have any value).
+     * set to 0 (the denominator may have any value but 0 is the mathematical 
correct value).
      */
     AVRational sample_aspect_ratio;
 
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 76c251ac02..c8526c0063 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -817,7 +817,7 @@ typedef struct AVStream {
     enum AVDiscard discard; ///< Selects which packets can be discarded at 
will and do not need to be demuxed.
 
     /**
-     * sample aspect ratio (0 if unknown)
+     * sample aspect ratio (0/0 or 0 if unknown)
      * - encoding: Set by user.
      * - decoding: Set by libavformat.
      */
diff --git a/libavformat/internal.h b/libavformat/internal.h
index 64452cce6e..bd42db738b 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -289,7 +289,7 @@ typedef struct FFStream {
     uint8_t dts_misordered;
 
     /**
-     * display aspect ratio (0 if unknown)
+     * display aspect ratio (0 or 0/0 if unknown)
      * - encoding: unused
      * - decoding: Set by libavformat to calculate sample_aspect_ratio 
internally
      */
diff --git a/libavutil/frame.h b/libavutil/frame.h
index 088b24b717..8b2a8a2c11 100644
--- a/libavutil/frame.h
+++ b/libavutil/frame.h
@@ -519,7 +519,7 @@ typedef struct AVFrame {
     enum AVPictureType pict_type;
 
     /**
-     * Sample aspect ratio for the video frame, 0/1 if unknown/unspecified.
+     * Sample aspect ratio for the video frame, 0/0 or 0/1 if 
unknown/unspecified.
      */
     AVRational sample_aspect_ratio;
 
-- 
2.52.0

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

Reply via email to