From e8e08ee49c6f80b02334891207d9f0d1b165b4b9 Mon Sep 17 00:00:00 2001
From: rogerdpack <rogerpack2005@gmail.com>
Date: Fri, 30 Jan 2015 08:53:16 -0700
Subject: [PATCH] dshow: show incremental values allowed

Signed-off-by: rogerdpack <rogerpack2005@gmail.com>
---
 libavdevice/dshow.c         | 12 +++++++-----
 libavdevice/dshow_capture.h |  1 +
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/libavdevice/dshow.c b/libavdevice/dshow.c
index d03670e..f823793 100644
--- a/libavdevice/dshow.c
+++ b/libavdevice/dshow.c
@@ -365,18 +365,18 @@ dshow_cycle_formats(AVFormatContext *avctx, enum dshowDeviceType devtype,
                     enum AVCodecID codec_id = av_codec_get_id(tags, bih->biCompression);
                     AVCodec *codec = avcodec_find_decoder(codec_id);
                     if (codec_id == AV_CODEC_ID_NONE || !codec) {
-                        av_log(avctx, AV_LOG_INFO, "  unknown compression type 0x%X", (int) bih->biCompression);
+                        av_log(avctx, AV_LOG_INFO, "  unknown compression type [please report] 0x%X", (int) bih->biCompression);
                     } else {
                         av_log(avctx, AV_LOG_INFO, "  vcodec=%s", codec->name);
                     }
                 } 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 +416,10 @@ 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 (allowed increments bits=%lu rate=%lu)\n",
                        acaps->MinimumChannels, acaps->MinimumBitsPerSample, acaps->MinimumSampleFrequency,
-                       acaps->MaximumChannels, acaps->MaximumBitsPerSample, acaps->MaximumSampleFrequency);
+                       acaps->MaximumChannels, acaps->MaximumBitsPerSample, acaps->MaximumSampleFrequency,
+                       acaps->BitsPerSampleGranularity, acaps->SampleFrequencyGranularity);
                 continue;
             }
             if (ctx->sample_rate) {
@@ -1174,6 +1175,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 },
diff --git a/libavdevice/dshow_capture.h b/libavdevice/dshow_capture.h
index f258476..21c949d 100644
--- a/libavdevice/dshow_capture.h
+++ b/libavdevice/dshow_capture.h
@@ -22,6 +22,7 @@
 #ifndef AVDEVICE_DSHOW_H
 #define AVDEVICE_DSHOW_H
 
+/* Set to 1 to enable lots of verbose DSHOW debug info to the logger */
 #define DSHOWDEBUG 0
 
 #include "avdevice.h"
-- 
1.9.1

