Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: michaelni via ffmpeg-devel <ffmpeg-devel@ffmpeg.org>
To: ffmpeg-devel@ffmpeg.org
Cc: michaelni <code@ffmpeg.org>
Subject: [FFmpeg-devel] [PR] Suggest 0/0 explicitly as unknown aspect ratio (PR #22301)
Date: Fri, 27 Feb 2026 00:07:50 -0000
Message-ID: <177215087105.25.16152482500797726348@29965ddac10e> (raw)

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 <michael@niedermayer.cc>


>From 2b21b5ca8a7e73a35eed12370bb7796586be5891 Mon Sep 17 00:00:00 2001
From: Michael Niedermayer <michael@niedermayer.cc>
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 <michael@niedermayer.cc>
---
 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 -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org

                 reply	other threads:[~2026-02-27  0:08 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=177215087105.25.16152482500797726348@29965ddac10e \
    --to=ffmpeg-devel@ffmpeg.org \
    --cc=code@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git