@@ -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 }
};
@@ -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
@@ -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;
};
/**
@@ -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, \
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(-)