From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <ffmpeg-devel-bounces@ffmpeg.org>
Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100])
	by master.gitmailbox.com (Postfix) with ESMTP id B429E40412
	for <ffmpegdev@gitmailbox.com>; Fri, 25 Mar 2022 14:13:45 +0000 (UTC)
Received: from [127.0.1.1] (localhost [127.0.0.1])
	by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id BE60068B28F;
	Fri, 25 Mar 2022 16:12:35 +0200 (EET)
Received: from mail-lj1-f173.google.com (mail-lj1-f173.google.com
 [209.85.208.173])
 by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id F35C568B281
 for <ffmpeg-devel@ffmpeg.org>; Fri, 25 Mar 2022 16:12:34 +0200 (EET)
Received: by mail-lj1-f173.google.com with SMTP id u3so10524787ljd.0
 for <ffmpeg-devel@ffmpeg.org>; Fri, 25 Mar 2022 07:12:34 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=from:to:cc:subject:date:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding;
 bh=hwoBhR7NeixusKzUXC9TCxI7eXMsIgi1bf84sm0xmMo=;
 b=VlUKDnVRqlFntFouey+dV1ccovIcgHVAIGnDZS+Lu4vDgetd1oEQIGn21VWGbI4sXR
 AEEKOLZkCNcF5I95rRcfG0g6wEvykju75QAk0b+prx51DZGxIlXzUjKEDmHHyvx64NLf
 o0bN7nPU+SgF6sQL+dVIFoeCT8vjHx2UlMe424UnHTHdxEj77jxPSFLBQrlddPg7I0LK
 JgYOJMo8v6/5jUWP/QEIuM8Lqlsz4Myojvtv0rXPyHE7yvdJJDFc3DkSKK4Z5uPYO1df
 dz/p5NwYlALErlAvGQeSDXGpTiyw7DS/oVTWyDWRf7ix8ZMhOEzIDicRvRS7WGAqURmU
 cXgA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=hwoBhR7NeixusKzUXC9TCxI7eXMsIgi1bf84sm0xmMo=;
 b=iDP/hSjxyCb4MHIw6RpuCTayrtzDYPLA6HNtTtAyAT6KCVi5sb51tUnn8o8zUYIZSV
 eM8e/d0jjs7ezhZA9VqxeQYKEQ2gM3YJ6FaukDSjt69q6rQIKvzNW0j9UL/J9dJzrBTb
 1H9GB6C+i/uAlpS4XlONaNI2kgEIwvGMsHnEItkV0SldUAps0gzo1qer1s+4cZplWKKU
 V5pWXfvRlvjvafOxaZBGcwCWiiRGiAws9zTPjQmtlW3V73JDroC/UYPSET53w5uRVF1O
 FK83pAzQv4/UQavreuJiLzR4TVHzlO+hesQjUz9WjFfOd8bYWWq4LriaeL9TfsYcB7ps
 8XEA==
X-Gm-Message-State: AOAM533WkfPZ7Xa3bB3wL+syKx7CZR1Reo/GOMERPPbcN+XYUU3w182z
 98GSkshtg86eu2Bk1mz9NIfQ8CnqXIE=
X-Google-Smtp-Source: ABdhPJw36+UvFZy/LRbNJWB0E4LqX58ngI1qRxPiM03yaB0WbYYABNPlqful0bQrw89VGifn+OcM7g==
X-Received: by 2002:a2e:7313:0:b0:249:84e3:a848 with SMTP id
 o19-20020a2e7313000000b0024984e3a848mr8440188ljc.320.1648217553732; 
 Fri, 25 Mar 2022 07:12:33 -0700 (PDT)
Received: from localhost.localdomain (deedock.humlab.lu.se. [130.235.135.183])
 by smtp.gmail.com with ESMTPSA id
 y1-20020a0565123f0100b0044584339e5dsm718608lfa.190.2022.03.25.07.12.33
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 25 Mar 2022 07:12:33 -0700 (PDT)
From: Diederick Niehorster <dcnieho@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Date: Fri, 25 Mar 2022 15:10:32 +0100
Message-Id: <20220325141041.1748-14-dcnieho@gmail.com>
X-Mailer: git-send-email 2.28.0.windows.1
In-Reply-To: <20220325141041.1748-1-dcnieho@gmail.com>
References: <20220325141041.1748-1-dcnieho@gmail.com>
MIME-Version: 1.0
Subject: [FFmpeg-devel] [PATCH v4 13/22] avdevice: change device
 capabilities option type
X-BeenThere: ffmpeg-devel@ffmpeg.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: FFmpeg development discussions and patches <ffmpeg-devel.ffmpeg.org>
List-Unsubscribe: <https://ffmpeg.org/mailman/options/ffmpeg-devel>,
 <mailto:ffmpeg-devel-request@ffmpeg.org?subject=unsubscribe>
List-Archive: <https://ffmpeg.org/pipermail/ffmpeg-devel>
List-Post: <mailto:ffmpeg-devel@ffmpeg.org>
List-Help: <mailto:ffmpeg-devel-request@ffmpeg.org?subject=help>
List-Subscribe: <https://ffmpeg.org/mailman/listinfo/ffmpeg-devel>,
 <mailto:ffmpeg-devel-request@ffmpeg.org?subject=subscribe>
Reply-To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Cc: Diederick Niehorster <dcnieho@gmail.com>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: ffmpeg-devel-bounces@ffmpeg.org
Sender: "ffmpeg-devel" <ffmpeg-devel-bounces@ffmpeg.org>
Archived-At: <https://master.gitmailbox.com/ffmpegdev/20220325141041.1748-14-dcnieho@gmail.com/>
List-Archive: <https://master.gitmailbox.com/ffmpegdev/>
List-Post: <mailto:ffmpegdev@gitmailbox.com>

Changes fps option from AVRational to double. This since any device
capability query results are returned in AVOptionRanges, which hold the
value as doubles, which can't contain AVRationals.

Also updated documentation of other capabilities, some had the wrong
option type listed.

micro version bump as this capabilities API is unused for now.

Signed-off-by: Diederick Niehorster <dcnieho@gmail.com>
---
 libavdevice/avdevice.c | 4 ++--
 libavdevice/avdevice.h | 6 +++---
 libavdevice/internal.h | 4 +++-
 libavdevice/version.h  | 2 +-
 4 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/libavdevice/avdevice.c b/libavdevice/avdevice.c
index db412985b2..33061b4408 100644
--- a/libavdevice/avdevice.c
+++ b/libavdevice/avdevice.c
@@ -51,8 +51,8 @@ const AVOption ff_device_capabilities[] = {
         {.str = NULL}, -1, INT_MAX, E|D|V },
     { "frame_size", "frame size", OFFSET(frame_width), AV_OPT_TYPE_IMAGE_SIZE,
         {.str = NULL}, -1, INT_MAX, E|D|V },
-    { "fps", "fps", OFFSET(fps), AV_OPT_TYPE_RATIONAL,
-        {.dbl = -1}, -1, INT_MAX, E|D|V },
+    { "fps", "fps", OFFSET(fps), AV_OPT_TYPE_DOUBLE,
+        {.dbl = NAN}, 0, INT_MAX, E|D|V },
     { NULL }
 };
 
diff --git a/libavdevice/avdevice.h b/libavdevice/avdevice.h
index 6d45c74616..a815d65f12 100644
--- a/libavdevice/avdevice.h
+++ b/libavdevice/avdevice.h
@@ -360,7 +360,7 @@ int avdevice_dev_to_app_control_message(struct AVFormatContext *s,
  *                      type: AV_OPT_TYPE_INT (AVCodecID value)
  *  - Capabilities valid for audio devices:
  *    - sample_format:  supported sample formats.
- *                      type: AV_OPT_TYPE_INT (AVSampleFormat value)
+ *                      type: AV_OPT_TYPE_SAMPLE_FMT
  *    - sample_rate:    supported sample rates.
  *                      type: AV_OPT_TYPE_INT
  *    - channels:       supported number of channels.
@@ -369,13 +369,13 @@ int avdevice_dev_to_app_control_message(struct AVFormatContext *s,
  *                      type: AV_OPT_TYPE_INT64
  *  - Capabilities valid for video devices:
  *    - pixel_format:   supported pixel formats.
- *                      type: AV_OPT_TYPE_INT (AVPixelFormat value)
+ *                      type: AV_OPT_TYPE_PIXEL_FMT
  *    - window_size:    supported window sizes (describes size of the window size presented to the user).
  *                      type: AV_OPT_TYPE_IMAGE_SIZE
  *    - frame_size:     supported frame sizes (describes size of provided video frames).
  *                      type: AV_OPT_TYPE_IMAGE_SIZE
  *    - fps:            supported fps values
- *                      type: AV_OPT_TYPE_RATIONAL
+ *                      type: AV_OPT_TYPE_DOUBLE
  *
  * Value of the capability may be set by user using av_opt_set() function
  * and AVDeviceCapabilitiesQuery object. Following queries will
diff --git a/libavdevice/internal.h b/libavdevice/internal.h
index eee493a4c7..5f0bd403dd 100644
--- a/libavdevice/internal.h
+++ b/libavdevice/internal.h
@@ -50,7 +50,9 @@ struct AVDeviceCapabilitiesQuery {
     int window_height;
     int frame_width;
     int frame_height;
-    AVRational fps;
+    // NB: an AVRational cannot be represented in the AVOptionRange
+    // output of av_opt_query_ranges, so we store fps as double instead
+    double fps;
 };
 
 /**
diff --git a/libavdevice/version.h b/libavdevice/version.h
index d789b3fd7b..9853069a2d 100644
--- a/libavdevice/version.h
+++ b/libavdevice/version.h
@@ -31,7 +31,7 @@
 #include "version_major.h"
 
 #define LIBAVDEVICE_VERSION_MINOR   1
-#define LIBAVDEVICE_VERSION_MICRO 100
+#define LIBAVDEVICE_VERSION_MICRO 101
 
 #define LIBAVDEVICE_VERSION_INT AV_VERSION_INT(LIBAVDEVICE_VERSION_MAJOR, \
                                                LIBAVDEVICE_VERSION_MINOR, \
-- 
2.28.0.windows.1

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

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