|Microsoft DirectX 9.0|
Digital Video (DV) capture application.
This sample demonstrates how to build various types of filter graphs for controlling DV camcorders. It also shows how to perform capture, preview, transmit, and device control with a DV camcorder.
Source: (SDK root)\Samples\C++\DirectShow\Capture\DVApp
Executable: (SDK root)\Samples\C++\DirectShow\Bin\DVApp.exe
The DVApp application supports the following modes:
The capture and transmit modes also perform preview. Each of those modes has a No Preview option as well, which disables preview. Capturing without preview is more efficient and can reduce the number of dropped frames.
The application starts in preview mode. To select another mode, choose a mode from the Graph Mode menu. For each mode, DVApp builds a filter graph that supports the functionality of that mode. To save the graph as a GraphEdit (.grf) file, select Save Graph to File from the File menu. Quit DVApp before opening the file in GraphEdit.
To capture to a file:
To transmit from a file to the camcorder:
If the camcorder is in VTR mode, the user can control the transport mechanism through the application's VCR-style buttons. To seek the tape, enter the target timecode and click the seek button.
To limit how much data the application captures, choose Capture Size from the File menu.
To check the tape format (NTSC or PAL), choose Check Tape from the Options menu.
To change the size of the preview window, choose Change Decode Size from the Options menu.
The main purpose of this application is to show how to build various DV capture and transmit graphs.
Device Arrival and Removal
The application handles device arrival and removal, using two different techniques. For device arrival, the application's message loop responds to WM_DEVICECHANGE messages. For device removal, the application responds to EC_DEVICE_LOST events from the filter graph manager. Either approach works, although the EC_DEVICE_LOST event depends on the existence of the device in the filter graph.
The application only handles one device at a time. If the current device is removed, the application looks for another DV device on the system.
On some DV camcorders, the user must shut off the device when switching it between camera mode and VTR mode, which triggers a device-lost message. The application responds by enabling or disabling the appropriate menu commands. However, if the user toggles rapidly between modes, the camcorder might not generate a device-lost message. You can force the menus to update by choosing Refresh Mode from the Options menu. Some DV camcorders can toggle modes without shutting off, but send a device-lost message only when they switch to VTR mode.
Note Microsoft Windows NT 4.0 and earlier do not support the data types used for device arrival. In order to compile the application for these platforms, the data types are conditionally included if WINVER is less than 0x500. However, the application does not support device detection on those platforms.
The functionality of the application's Play and Record button depends on the current mode:
The sample application does not perform frame-accurate capture. At various points, the application calls the Sleep function to wait for the device to respond. Newer DV camcorders send a notification when the state of the device changes. Older devices might not support notification; for the purposes of a sample, calling Sleep is a simpler solution.