예제 #1
0
        public int GetDefaultCaps(int nIndex, out VideoStreamConfigCaps _caps)
        {
            _caps = new VideoStreamConfigCaps();

            _caps.guid = FormatType.VideoInfo;
            _caps.VideoStandard = AnalogVideoStandard.None;
            _caps.InputSize.Width = c_iDefaultWidth;
            _caps.InputSize.Height = c_iDefaultHeight;
            _caps.MinCroppingSize.Width = c_nMinWidth;
            _caps.MinCroppingSize.Height = c_nMinHeight;

            _caps.MaxCroppingSize.Width = c_nMaxWidth;
            _caps.MaxCroppingSize.Height = c_nMaxHeight;
            _caps.CropGranularityX = c_nGranularityW;
            _caps.CropGranularityY = c_nGranularityH;
            _caps.CropAlignX = 0;
            _caps.CropAlignY = 0;

            _caps.MinOutputSize.Width = _caps.MinCroppingSize.Width;
            _caps.MinOutputSize.Height = _caps.MinCroppingSize.Height;
            _caps.MaxOutputSize.Width = _caps.MaxCroppingSize.Width;
            _caps.MaxOutputSize.Height = _caps.MaxCroppingSize.Height;
            _caps.OutputGranularityX = _caps.CropGranularityX;
            _caps.OutputGranularityY = _caps.CropGranularityY;
            _caps.StretchTapsX = 0;
            _caps.StretchTapsY = 0;
            _caps.ShrinkTapsX = 0;
            _caps.ShrinkTapsY = 0;
            _caps.MinFrameInterval = UNITS / c_nMaxFPS;
            _caps.MaxFrameInterval = UNITS / c_nMinFPS;
            _caps.MinBitsPerSecond = (_caps.MinOutputSize.Width * _caps.MinOutputSize.Height * c_nDefaultBitCount) * c_nMinFPS;
            _caps.MaxBitsPerSecond = (_caps.MaxOutputSize.Width * _caps.MaxOutputSize.Height * c_nDefaultBitCount) * c_nMaxFPS;

            return NOERROR;
        }
예제 #2
0
        public int GetStreamCaps(int iIndex,out AMMediaType ppmt, out VideoStreamConfigCaps _caps)
        {
            ppmt = null;
            _caps = null;
            if (iIndex < 0) return E_INVALIDARG;

            ppmt = new AMMediaType();
            HRESULT hr = (HRESULT)GetMediaType(iIndex, ref ppmt);
            if (FAILED(hr)) return hr;
            if (hr == VFW_S_NO_MORE_ITEMS) return S_FALSE;
            hr = (HRESULT)GetDefaultCaps(iIndex, out _caps);
            return hr;
        }
        public int GetDefaultCaps(int nIndex, out VideoStreamConfigCaps caps)
        {
            caps = new VideoStreamConfigCaps
            {
                guid = FormatType.VideoInfo,
                VideoStandard = AnalogVideoStandard.None,
                InputSize =
                {
                    Width = _width,
                    Height = _height
                },
                MinCroppingSize =
                {
                    Width = MinWidth,
                    Height = MinHeight
                },
                MaxCroppingSize =
                {
                    Width = MaxWidth,
                    Height = MaxHeight
                },
                CropGranularityX = GranularityW,
                CropGranularityY = GranularityH,
                CropAlignX = 0,
                CropAlignY = 0
            };

            caps.MinOutputSize.Width = caps.MinCroppingSize.Width;
            caps.MinOutputSize.Height = caps.MinCroppingSize.Height;
            caps.MaxOutputSize.Width = caps.MaxCroppingSize.Width;
            caps.MaxOutputSize.Height = caps.MaxCroppingSize.Height;
            caps.OutputGranularityX = caps.CropGranularityX;
            caps.OutputGranularityY = caps.CropGranularityY;
            caps.StretchTapsX = 0;
            caps.StretchTapsY = 0;
            caps.ShrinkTapsX = 0;
            caps.ShrinkTapsY = 0;
            caps.MinFrameInterval = UNITS / MaxFps;
            caps.MaxFrameInterval = UNITS / MinFps;
            caps.MinBitsPerSecond = (caps.MinOutputSize.Width * caps.MinOutputSize.Height * _bitCount) * MinFps;
            caps.MaxBitsPerSecond = (caps.MaxOutputSize.Width * caps.MaxOutputSize.Height * _bitCount) * MaxFps;

            return NOERROR;
        }