From 2403ba5a43e17f691d03fa316e6455e0b125c2ae Mon Sep 17 00:00:00 2001
From: rogerdpack <rogerpack2005@gmail.com>
Date: Mon, 2 Feb 2015 07:42:04 -0700
Subject: [PATCH 2/2] dshow: show incremental values allowed

Signed-off-by: rogerdpack <rogerpack2005@gmail.com>
---
 libavdevice/dshow.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/libavdevice/dshow.c b/libavdevice/dshow.c
index 77f0a75..8e61bf2 100644
--- a/libavdevice/dshow.c
+++ b/libavdevice/dshow.c
@@ -372,11 +372,12 @@ dshow_cycle_formats(AVFormatContext *avctx, enum dshowDeviceType devtype,
                 } else {
                     av_log(avctx, AV_LOG_INFO, "  pixel_format=%s", av_get_pix_fmt_name(pix_fmt));
                 }
-                av_log(avctx, AV_LOG_INFO, "  min s=%ldx%ld fps=%g max s=%ldx%ld fps=%g\n",
+
+                av_log(avctx, AV_LOG_INFO, "  min s=%ldx%ld fps=%g max s=%ldx%ld fps=%g (allowed increments x=%d y=%d fps=?)\n",
                        vcaps->MinOutputSize.cx, vcaps->MinOutputSize.cy,
                        1e7 / vcaps->MaxFrameInterval,
                        vcaps->MaxOutputSize.cx, vcaps->MaxOutputSize.cy,
-                       1e7 / vcaps->MinFrameInterval);
+                       1e7 / vcaps->MinFrameInterval, vcaps->OutputGranularityX, vcaps->OutputGranularityY);
                 continue;
             }
             if (ctx->video_codec_id != AV_CODEC_ID_RAWVIDEO) {
@@ -416,9 +417,14 @@ dshow_cycle_formats(AVFormatContext *avctx, enum dshowDeviceType devtype,
                 goto next;
             }
             if (!pformat_set) {
-                av_log(avctx, AV_LOG_INFO, "  min ch=%lu bits=%lu rate=%6lu max ch=%lu bits=%lu rate=%6lu\n",
+                av_log(avctx, AV_LOG_INFO, "  min ch=%lu bits=%lu rate=%6lu max ch=%lu bits=%lu rate=%6lu",
                        acaps->MinimumChannels, acaps->MinimumBitsPerSample, acaps->MinimumSampleFrequency,
                        acaps->MaximumChannels, acaps->MaximumBitsPerSample, acaps->MaximumSampleFrequency);
+                if (acaps->BitsPerSampleGranularity > 1 || acaps->SampleFrequencyGranularity > 1)
+                    av_log(avctx, AV_LOG_INFO, " (allowed increments bits=%lu rate=%lu)\n",
+                        acaps->BitsPerSampleGranularity, acaps->SampleFrequencyGranularity);
+                else
+                    av_log(avctx, AV_LOG_INFO, " (allowed increments bits=? rate=?)\n");
                 continue;
             }
             if (ctx->sample_rate) {
@@ -1174,6 +1180,7 @@ static int dshow_read_packet(AVFormatContext *s, AVPacket *pkt)
 #define OFFSET(x) offsetof(struct dshow_ctx, x)
 #define DEC AV_OPT_FLAG_DECODING_PARAM
 static const AVOption options[] = {
+    /* also sets requested_height, both are also set by -s */
     { "video_size", "set video size given a string such as 640x480 or hd720.", OFFSET(requested_width), AV_OPT_TYPE_IMAGE_SIZE, {.str = NULL}, 0, 0, DEC },
     { "pixel_format", "set video pixel format", OFFSET(pixel_format), AV_OPT_TYPE_PIXEL_FMT, {.i64 = AV_PIX_FMT_NONE}, -1, INT_MAX, DEC },
     { "framerate", "set video frame rate", OFFSET(framerate), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC },
-- 
1.9.5.msysgit.0

