{"id":382,"date":"2010-03-12T02:30:40","date_gmt":"2010-03-12T07:30:40","guid":{"rendered":"http:\/\/www.e-consystems.com\/blog\/?p=382"},"modified":"2023-08-15T12:34:55","modified_gmt":"2023-08-15T07:04:55","slug":"resolution-switching-in-directshow-camera-application","status":"publish","type":"post","link":"https:\/\/www.e-consystems.com\/blog\/system-on-module-som\/resolution-switching-in-directshow-camera-application\/","title":{"rendered":"Resolution Switching in DirectShow Camera Application"},"content":{"rendered":"<p>DirectShow sample camera test application source code resides in the ($(WINCEROOT)\\PRIVATE\\TEST\\MULTIMEDIA\\DIRECTX\\DSHOW\\CAMERA) directory of the WINCE 6.0 installation.<\/p>\n<p>The CameraFramework source present on the private code supports functions which can be used to develop full functional directshow camera application.<\/p>\n<p>Many of them were asking about the how to switch between the supported resolutions of the PINS in the application.<\/p>\n<p>In the default application source present in the PRIVATE source we don&#8217;t have option for switching between the resolutions supported by camera driver.<\/p>\n<p>The default application will simply make use of the first resolution supported by the camera driver(say for ex:320&#215;240).<\/p>\n<p>Following are the routines which are used for enumerating the supported resolutions of the camera driver.<\/p>\n<p><code><strong>int iCount = 0, iSize = 0;<br \/>\nhr = g_DShowCaptureGraph.GetNumberOfCapabilities(nStream, &amp;iCount, &amp;iSize);<\/strong><\/code><\/p>\n<p><strong> nStream<\/strong> &#8211; Pin details(CAPTURE,PREVIEW,STILL)<br \/>\n<strong> iCount <\/strong>&#8211; Number of formats supported by the driver for the selected PIN.<\/p>\n<p>Calling the GetStreamCaps () function will retrieve the format capabilities of the selected PIN. Enumerate the supported resolutions using following calls and list it in the application(ex : Using List box or group Radio Buttons).<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.e-consystems.com\/images\/blog\/Blog_Resolution_DShow.jpg\" alt=\"Resolution Swtiching in DirectShow Camera Application\" \/><\/p>\n<p>\/\/ Check the size to make sure we pass in the correct structure.<br \/>\n<code>if (iSize == sizeof(VIDEO_STREAM_CONFIG_CAPS))<br \/>\n{<br \/>\n\/\/ Use the video capabilities structure.<br \/>\nfor (int iFormat = 0; iFormat &lt; iCount; iFormat++)<br \/>\n{<br \/>\nVIDEO_STREAM_CONFIG_CAPS scc;<br \/>\nAM_MEDIA_TYPE *pmtConfig;<br \/>\nVIDEOINFOHEADER *pVih;<br \/>\nhr = g_DShowCaptureGraph.GetStreamCaps(nStream,iFormat, &amp;pmtConfig, (BYTE*)&amp;scc);<br \/>\nif (SUCCEEDED(hr))<br \/>\n{<br \/>\n\/\/ Examine the format.<br \/>\npVih = (VIDEOINFOHEADER*)pmtConfig-&gt;pbFormat;<br \/>\nRETAILMSG(1,(TEXT(\"Width = %d , Height = %d \\r\\n\"),pVih-&gt;bmiHeader.biWidth, pVih-&gt;bmiHeader.biHeight));<br \/>\n}<br \/>\n}<br \/>\n}<\/code><\/p>\n<p>After allowing the user to select the format set the corresponding resolution format using the following call of the camera framework.<\/p>\n<p><code>hr = g_DShowCaptureGraph.SetFormat(nStream,pmtConfig);<br \/>\nif (SUCCEEDED(hr))<br \/>\n{<br \/>\nRETAILMSG(1,(TEXT(\"SetFormat Success ***********\\r\\n\")));<br \/>\n}<\/code><br \/>\n<strong>nStream<\/strong> &#8211; Pin details(CAPTURE,PREVIEW,STILL)<br \/>\n<strong>pmtConfig<\/strong> &#8211; Structure returned by the GetStreamCaps()<\/p>\n","protected":false},"excerpt":{"rendered":"<p>DirectShow sample camera test application source code resides in the ($(WINCEROOT)\\PRIVATE\\TEST\\MULTIMEDIA\\DIRECTX\\DSHOW\\CAMERA) directory of the WINCE&#8230;<\/p>\n","protected":false},"author":11,"featured_media":1370,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[210,213],"tags":[27,30,63,64,75,320],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.e-consystems.com\/blog\/system-on-module-som\/wp-json\/wp\/v2\/posts\/382"}],"collection":[{"href":"https:\/\/www.e-consystems.com\/blog\/system-on-module-som\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.e-consystems.com\/blog\/system-on-module-som\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.e-consystems.com\/blog\/system-on-module-som\/wp-json\/wp\/v2\/users\/11"}],"replies":[{"embeddable":true,"href":"https:\/\/www.e-consystems.com\/blog\/system-on-module-som\/wp-json\/wp\/v2\/comments?post=382"}],"version-history":[{"count":1,"href":"https:\/\/www.e-consystems.com\/blog\/system-on-module-som\/wp-json\/wp\/v2\/posts\/382\/revisions"}],"predecessor-version":[{"id":2948,"href":"https:\/\/www.e-consystems.com\/blog\/system-on-module-som\/wp-json\/wp\/v2\/posts\/382\/revisions\/2948"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.e-consystems.com\/blog\/system-on-module-som\/wp-json\/wp\/v2\/media\/1370"}],"wp:attachment":[{"href":"https:\/\/www.e-consystems.com\/blog\/system-on-module-som\/wp-json\/wp\/v2\/media?parent=382"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.e-consystems.com\/blog\/system-on-module-som\/wp-json\/wp\/v2\/categories?post=382"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.e-consystems.com\/blog\/system-on-module-som\/wp-json\/wp\/v2\/tags?post=382"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}