windows-nt/Source/XPSP1/NT/drivers/wdm/capture/mini/1394dcam/sonydcam.htm

98 lines
8.4 KiB
HTML
Raw Permalink Normal View History

2020-09-26 03:20:57 -05:00
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252">
<META NAME="Generator" CONTENT="Microsoft Word 97">
<TITLE>SonyDCam</TITLE>
<META NAME="Template" CONTENT="E:\MsOff97\Office\html.dot">
</HEAD>
<BODY TEXT="#000000" LINK="#0000ff" VLINK="#800080" BGCOLOR="#ffffff" leftmargin="8">
<FONT FACE="Verdana"><H2><A NAME="MYSAMPLE">SonyDCam</H2>
<H3>SUMMARY</H3>
</FONT><FONT FACE="Verdana" SIZE=2><P>Sonydcam is a sample WDM stream class video capture driver that supports two IEEE 1394 digital cameras:</P>
<UL>
<LI>Sony 1394 CCM-DS250 Desktop Camera </LI>
<LI>TI 1394 MC680-DCC Desktop Camera</LI></UL>
<P>The same driver may be able to support other digital cameras that conform to 1394-based Digital Camera Specification from 1394 Trade Association. </P>
<P>Digital camera supported by Sonydcam.sys is a data source that produces digital image data without any other input connection. It manifests itself in a DirectShow graph as a WDM Streaming Capture Device and as a capture filter that has output capture stream supporting image sizes of 320x240 with a UYVY color space. Its de-compressor, Msyuv.dll, is part of the OS delivery, and it can convert image data format from UYVY to RGB16, RGB8, or to a Direct Draw surface if the video card supports UYVY format. </P>
<P><! ---------------- Snip Snip ---------------- ></P>
</FONT><FONT FACE="Verdana"><H3>BUILDING THE SAMPLE</H3>
<P><! ---------------- Snip Snip ---------------- ></FONT><FONT FACE="Verdana" SIZE=2>The sample is built with the standard DDK BUILD utility in the standard checked or free DDK build environment. </P>
<P>Sonydcam is a Plug and Play driver, and the Image.inf shipped with Windows OS is used to install detected devices. It cannot be manually installed. The sample Sonydcam.inf, which is a subset of Image.inf, can be used as an installation file template.</P>
<P>The 1394Dcam sample is completely contained in one directory. </P>
<P><! ---------------- Snip Snip ---------------- ></P>
</FONT><FONT FACE="Verdana"><H3>RESOURCES</H3>
</FONT><FONT FACE="Verdana" SIZE=2><P>The site <A HREF="http://www.1394TA.org/">http://www.1394TA.org</A> contains many other IEEE 1394 bus-related articles and specifications. <P>
<P>The site <A HREF="http://www.microsoft.com/hwdev">http://www.microsoft.com/hwdev</A> contains some of the class driver support for IEEE 1394 bus on both Windows&#174; 98 and Windows 2000.</P>
<H3>CODE TOUR</H3>
<H4>File Manifest</H4>
<P><! ---------------- Snip Snip ---------------- ></P>
</FONT><U><PRE>File&#9;&#9;Description
</U>1394DCam.htm&#9;The documentation for this sample (this file)
<FONT FACE="Courier">SOURCES&#9;&#9;The generic file for building the code sample
SonyDCam.inf&#9;A sample installation file
SonyDCam.c&#9;DriverEntry(), Initialize and un-initialize device
DCamPkt.c&#9;Process stream class's SRB_* packets
CtrlPkt.c&#9;Process stream control packet, like querying and setting streaming state
DataPkt.c&#9;Process stream read data packet.
Callback.c&#9;Process callbacks from controller driver for either a filled buffer or a bus reset
Device.c&#9;Process reading and writing to device's registers
CapProp.c&#9;Process VideoProcAmp and CameraControl properties
CapProp.h&#9;Function prototypes for CapProp.c
Dbg.h&#9;&#9;Debug preprocessor
DcamDef.h&#9;Function prototypes
DcamPkt.h&#9;Function prototypes and major structure definition
PropData.h&#9;Static streaming properties for Sony digital camera
PropDta2.h&#9;Static streaming properties for TI digital camera
SonyDCam.h&#9;Function prototypes for sonydcam.c
StrmData.h&#9;Supported stream format
SonyDCam.rc&#9;Resource file mainly for version
</FONT><FONT FACE="Verdana"> </PRE>
</FONT><H4>Programming Tour</H4>
<FONT FACE="Verdana" SIZE=2><P>&nbsp;</P>
<P>In DriverEntry(), it initializes the hardware initialization structure including registers its entry point functions. </P>
<P>HwReceivePacket field describes the entry point for receiving SRBs (Stream Request Packet) from stream class driver. Here is a possible sequence of SRBs that this driver may receive.</P>
<OL>
<LI>SRB_INITIALIZE_DEVICE to initialize the device, and called after DriverEntry().</LI>
<LI>SRB_GET_STREAM_INFO to get supported stream format.</LI>
<LI>SRB_GET_DATA_INTERSECTION to query a supported format given some key fields.</LI>
<LI>SRB_OPEN_STREAM to open a stream with supply format from SRB_GET_DATA_INTERSECTION. Two additional entry point functions are register for this stream for controlling the streaming state (Srb-&gt;StreamObject-&gt;ReceiveControlPacket) and for streaming data (Srb-&gt;StreamObject-&gt;ReceiveDataPacket). </LI>
<LI>SRB_CLOSE_STREAM to close the open stream.</LI>
<LI>SRB_UNINITIALIZE_DEVICE to indicate that a device has been unloaded or removed.</LI></OL>
<P>This driver also register entry points for canceling packets (HwCancelPacket) and for notifying if a packet has timeout (HwRequestTimeoutHandler). </P>
<P>There are two callback functions used in this driver. DCamIsochCallback() is called from the controller driver when an attached buffer is filled with data. DCamBusResetNotification() is called also from controller driver to indicate a bus reset has occurred. Both are executed in DISPATCH_LEVEL.</P>
<P>This web site can provide additional and detail information about stream class architecture and its interface:</P><DIR>
<DIR>
</FONT><P><A HREF="http://www.microsoft.com/hwdev">http://www.microsoft.com/hwdev</A></P>
<FONT FACE="Verdana" SIZE=2><P>&nbsp;</P></DIR>
</DIR>
<B><P>Bus Reset</P>
</B><P>Since this driver supports a PnP device, there are some special cases. For example, (1) unplug this camera while streaming, or (2) plug in a 2<SUP>nd</SUP> device into the same controller that has a device already streaming. In either case, it triggered a bus reset from the controller. After a reset, the controller invalidate its clients' bandwidth and channel; however, after the bus reset, the streaming device should continue to source isochronous video data according to IEEE 1394 digital camera specification. </P>
<P>For a device that has been removed, it will receive a SRB_SURPRISE_REMOVAL. It then must cancel all pending reads and prepare to be unloaded. In this case, this driver is likely to receive SRB_UNINITIALIZE_DEVICE before SRB_CLOSE_STREAM. If a driver still has pending reads SRB, stream class driver will not send SRB_CLOSE_STREAM even after its client application is closed. </P>
<P>For a device that is still plugged in, it will get a notification callback from the controller to restore to its original state, including freeing and reallocating channel and bandwidth (but not resource), and restore to its original streaming state. In this sample, the device is re-initialize and restarted. This is only necessary if the device stop sourcing isochronous video data. Re-initializing the device is also necessary if a device was attached but suspended (loss power) and awaken. In this case, it will also get a bus reset callback notification. </P>
<P>&nbsp;</P>
<B><P>Frame rate and dropped frames</P>
</B><P>Digital cameras support discrete frame rates; however, a client application can request to stream at any rate. It is required by WDM video capture driver to match or down shift to its next frame rate from the requested frame rate. Over sampling can cause synchronization problems. </P>
<P>The dropped frame information is calculated instead of actual count, and it is based on the capture rate and the actual counts of frames captured. After a buffer is attached to the controller driver, sonydcam is in passive mode waiting for the data to be filled. If its controller misses the data, a dropped frame, it cannot know that; and the controller does not report that information back to it. That is why the frame rate information is calculated.</P>
<P>&nbsp;</P>
<B><P>Work items</P>
</B><P>Sonydcam is not persisting property settings between reboots. It should.</P>
<P>Sonydcam is not power management enabled. It should. Currently, it has " DontSuspendIfStreamsAreRunning" set in its INF, and ought to be removed, and process D3-&gt;D0 and D0-&gt;D3 power state change.</P>
</FONT><P ALIGN="CENTER"><A HREF="#top"><FONT FACE="Verdana" SIZE=2>Top of page</FONT></A><FONT FACE="Verdana" SIZE=2> </P></FONT>
<TABLE CELLSPACING=0 BORDER=0 WIDTH=624>
<TR><TD VALIGN="MIDDLE" BGCOLOR="#00ffff" HEIGHT=2>
<P></TD>
</TR>
</TABLE>
<FONT FACE="MS Sans Serif" SIZE=1><P>&copy; 1999 Microsoft Corporation</FONT><FONT FACE="Verdana" SIZE=2> </P></FONT></BODY>
</HTML>