Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PR] Suggest 0/0 explicitly as unknown aspect ratio (PR #22301)
@ 2026-02-27  0:07 michaelni via ffmpeg-devel
  0 siblings, 0 replies; only message in thread
From: michaelni via ffmpeg-devel @ 2026-02-27  0:07 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: michaelni

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-02-27  0:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-02-27  0:07 [FFmpeg-devel] [PR] Suggest 0/0 explicitly as unknown aspect ratio (PR #22301) michaelni via ffmpeg-devel

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