home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / sdk / graphics / ba / usevideo / readme.txt < prev   
Text File  |  1997-09-23  |  20KB  |  411 lines

  1. ------------------------------------------------------------------
  2.     Microsoft Broadcast Architecture SDK UseVideo Readme File
  3.                          August 1997
  4. ------------------------------------------------------------------
  5.  
  6.              (c) Copyright Microsoft Corporation, 1997
  7.  
  8. CONTENTS
  9. ========
  10.  
  11. Using the Video ActiveX Control
  12.  
  13.  
  14. SUMMARY
  15. =======
  16.  
  17. The UseVideo samples demonstrate presenting audio and video 
  18. in an application, a Web browser, and in a control you create.
  19. The following four programs are contained in the UseVideo sample:
  20.  
  21. 1. Video Test Project (VidCntrl) demonstrates a project containing a 
  22.    standard Microsoft(r) Visual Basic form that hosts and manipulates an instance 
  23.    of the Microsoft(r) ActiveX(TM) control (the Video ActiveX control).
  24.  
  25. 2. Video Web Page (WebTune) demonstrates embedding and using the 
  26.    Video ActiveX control in a Web page.
  27.  
  28. 3. Video Test Control (Vid_Tune) demonstrates creating a control that 
  29.    contains the Video ActiveX control as a constituent control.
  30.  
  31. 4. Video MFC Test describes building an application for Windows with 
  32.    C++ classes from the Microsoft(r) Foundation Class Library (MFC).
  33.  
  34. In addition to presenting audio and video, these samples show how to embed 
  35. a Video ActiveX control in your program and how to select different devices 
  36. to provide input to such a control. If your computer contains a tuner card,
  37. these samples show how to tune to a channel.
  38.  
  39. /////////////////////////////////////////////////////////////////////////////
  40. MORE INFORMATION
  41. ================
  42.  
  43. The following information describes running the UseVideo samples.
  44. For information on system requirements, see the Client Hardware Requirements 
  45. section of the Broadcast Architecture Programmer's Reference or Broadcast 
  46. Architecture Device-Driver Development Kit (DDK).
  47.  
  48. Note: For these samples to have maximum value, you should have the 
  49.       following components installed:
  50.       
  51.    1. The Microsoft(r) Windows(r) 98 operating system, including the optional 
  52.       TV Viewer component.
  53.  
  54.    2. Visual Basic version 5.0. For more information on installing 
  55.       and using Visual Basic 5.0, see the Visual Basic 5.0 documentation.
  56.  
  57.    3. The Microsoft(r) Visual C++ development system, version 5.0. For more information 
  58.       on installing and using Visual C++ 5.0, including MFC, see the Visual C++ 5.0 
  59.       documentation. 
  60.  
  61.  
  62. /////////////////////////////////////////////////////////////////////////////
  63. To Run VidCntrl 
  64. -----------------------------
  65.  
  66. 1. Start Visual Basic 5.0.
  67.  
  68. 2. When the New Project dialog box appears, click the Existing tab, and 
  69.    open the VidCntrl.vbp project file.
  70.  
  71. 3. On the Run menu, click Start.
  72.  
  73. 4. When the Video Control Test form appears in run mode, click the 
  74.    File Source (Async.) item in the list box to select it for the 
  75.    video control's input source. Enter the file name of a particular 
  76.    MPEG-1 file, along with the required path to locate the file, in 
  77.    the text box, and click the Set Input button to assign the 
  78.    file you specified as the input source for audio and video. Click the 
  79.    Play button to play the file; click the Pause button to temporarily 
  80.    suspend playing; click the Stop command button to stop the file. 
  81.    Move the Volume slider to change the intensity of the video control's 
  82.    sound and the Balance slider to change the video control's stereo balance.
  83.  
  84. 5. If your computer contains a tuner card for analog television, click 
  85.    the WDM TvTuner item in the list box to select it for the video control's 
  86.    input source. Enter a channel number in the text box, and click the 
  87.    Set Input button to tune your card to the channel number you specified.
  88.  
  89. VidCntrl Files
  90. ------------
  91.  
  92. VidCntrl.frm 
  93.     This file contains the form image, in addition to the images of all the 
  94.     elements on the form and the code to manipulate the video control. 
  95.     The form's code uses the following properties and methods of the video control
  96.     and other objects associated with video control. It:
  97.     a. Declares and allocates storage for variables of BPCDevices and 
  98.        BPCDeviceBase object types. 
  99.     b. Obtains a reference to each device of the video control's Devices property. 
  100.     c. Obtains the name of each device with the BPCDeviceBase Name property. 
  101.     d. Determines if the computer contains any tuner cards that support the tuning 
  102.        space for Analog Cable TV with the video control's TSDeviceCount method. 
  103.     e. If the computer does, tunes to a channel with the video control's Tune 
  104.        method.
  105.     f. Sets the video control's Input property equal to one of the devices in
  106.        the video control's Devices property. 
  107.     g. Determines if the video control's input source is from a tuner with the 
  108.        BPCDeviceBase HasChannel property. 
  109.     h. If it is, sets the channel number of the tuner with the BPCDeviceBase Channel 
  110.        property. 
  111.     i. Determines if the video control's input source is from a file with the 
  112.        BPCDeviceBase HasFilename property. 
  113.     j. If it is, sets the name of the file with the BPCDeviceBase filename property. 
  114.     k. For file sources, plays, pauses, stops, changes the volume and balance with the 
  115.        video control's Run, Pause, Stop, Volume, and Balance properties respectively.
  116.  
  117. VidCntrl.vbp 
  118.     This file is the makefile for the project.
  119.  
  120.  
  121. /////////////////////////////////////////////////////////////////////////////
  122. To Run WebTune
  123. -------------
  124.  
  125. 1. Start Microsoft Internet Explorer 4.0.
  126.  
  127. 2. In Internet Explorer, click the Open command on the File menu. 
  128.    When the Open dialog box appears, click Browse and locate
  129.    the Vid_Test.htm file, and then click Open. When the Open 
  130.    dialog box reappears, click OK.
  131.  
  132. 3. When the Web page loads and Internet Explorer displays the page's 
  133.    text and objects, enter the file name of a particular MPEG-1 file along
  134.    with the required path to locate this file in the text box. Click 
  135.    Set File to assign the file you specified as the input source
  136.    for audio and video and to play the file, and click Stop File
  137.    to stop the file.
  138.  
  139. 4. If your computer contains a tuner card for analog television, enter 
  140.    a channel number in the text box and click Set Chan to tune your card 
  141.    to the channel number you specified.
  142.  
  143. WebTune File
  144. ------------
  145.  
  146. Vid_Test.htm 
  147.     This file is an HTML document that contains the text, input elements,
  148.     the Video ActiveX control object, and code written in
  149.     Microsoft(r) Visual Basic(r) Scripting Edition (VBScript) that manipulates 
  150.     the video control. The code enclosed in the SCRIPT tag uses all the same 
  151.     properties and methods as those used in the VidCntrl.frm code.
  152.  
  153.  
  154. /////////////////////////////////////////////////////////////////////////////
  155. To Run Vid_Tune
  156. -------------
  157.  
  158. 1. Start Microsoft Visual Basic 5.0.
  159.  
  160. 2. When the New Project dialog box appears, click the Existing tab and 
  161.    open the Vid_Tune.vbg group project file.
  162.  
  163. 3. On the Run menu, click Start.
  164.  
  165. 4. When the form for the video test control appears in run mode, enter 
  166.    the file name of a particular MPEG-1 file along with the required path 
  167.    to locate this file in the text box.
  168.  
  169. 5. Click File to assign the MPEG-1 file you specified as the 
  170.    input source for audio and video and to play the file, and click Stop 
  171.    to stop playing the file.
  172.  
  173. 6. If your computer contains a tuner card for analog television, click any 
  174.    of the channel buttons to assign the WDM TvTuner as the input source for 
  175.    audio and video and to tune your card to the channel number specified by 
  176.    the button.
  177.  
  178. Vid_Tune Files
  179. ------------
  180.  
  181. Vid_Tune.ctl 
  182.     This file contains the images of all the elements on the control's 
  183.     designer and the code to manipulate the video control. The designer's code 
  184.     uses all the same properties and methods as those used in the VidCntrl.frm 
  185.     code. In addition, code in the designer exposes custom properties, creates
  186.     and sends a click event, and creates the MyTune method.
  187.  
  188. Test_Vid.frm 
  189.     This file contains the form image, the image of the Video Test control, 
  190.     and the code to manipulate the Video Test control. The form's code contains 
  191.     the click event procedure that calls the Video Test control's MyTune method.
  192.  
  193. Vid_Tune.vbp 
  194.     This file is the makefile for the Video Test Control project.
  195.  
  196. Test_Vid.vbp 
  197.     This file is the makefile for the test project that verifies the Video 
  198.     Test Control.
  199.  
  200. Vid_Tune.vbg 
  201.     This file is the group file containing the Control project and the test 
  202.     project.
  203.    
  204.  
  205. /////////////////////////////////////////////////////////////////////////////
  206. To Run VideoMFC
  207. -----------------------------
  208.  
  209. 1. Start Visual C++ 5.0.
  210.  
  211. 2. On the File menu, click Open Workspace.
  212.  
  213. 3. When the Open Workspace dialog box appears, go to the appropriate 
  214.    directory and open the VdMFC.mak file. 
  215.  
  216. 4. On the Build menu, click the Win32 Release configuration from 
  217.    the Set Active Configuration menu item. After setting the project 
  218.    configuration, click Build VdMFC.exe on the Build menu. After 
  219.    building the project, click Execute VdMFC.exe on the Build menu. 
  220.    
  221. 5. When the VdMFC application starts, click the File Source (Async.) 
  222.    item in the list box to select it for the Vid control's input source. 
  223.    Enter the file name of a particular MPEG-1 file along with the required 
  224.    path to locate this file in the edit box. Click Set Input to assign the 
  225.    MPEG-1 file you specified as the input source for audio and video. Click 
  226.    Set File Name and then Play to start playing the MPEG-1 file you  
  227.    specified. Click Pause to temporarily suspend playing. Click Stop to stop
  228.    playing the file.
  229.  
  230. 6. If your computer contains a tuner card for analog television, click the 
  231.    WDM TvTuner item in the list box and then the Set Input button 
  232.    to select it for the video control's input source. Enter a channel number 
  233.    in the edit box, and then click Set Channels to tune your card to the 
  234.    channel number you specified. Click On/Off Video to allow the Vid 
  235.    control to receive video or to prevent it from receiving video.
  236.  
  237. /////////////////////////////////////////////////////////////////////////////
  238. To Run VideoMFC from the Command Line 
  239. -----------------------------
  240.  
  241. 1. Open a Command Prompt window, switch to the directory on your 
  242.    computer that contains the makefile (VdMFC.mak) and the source files 
  243.    for the video MFC application, and then type the following exactly 
  244.    as shown including the case of the text:
  245.    NMAKE /f "VdMFC.mak" CFG="VdMFC - Win32 Release"
  246.  
  247. 2. To run the built VdMFC application, switch to the \Release directory 
  248.    created within the directory containing the source files, and type VdMFC.
  249.  
  250. VideoMFC Files
  251. ------------
  252. The MFC AppWizard created all but one of the skeleton files for the VdMFC  
  253. application. Most of the files did not require modification. The following 
  254. summaries of the contents of each of the files that make up VdMFC are divided 
  255. into the group requiring modifications and the group not requiring modifications. 
  256.  
  257. *********************
  258. NOT CREATED BY MFC APPWIZARD
  259. *********************
  260. Vidtypes.h
  261.     This file contains the definitions for all the constants and interfaces 
  262.     that make up the Vid control. This file was not generated by the MFC
  263.     AppWizard. This file was added to the project.
  264.  
  265. *********************
  266. NO EDITING REQUIRED
  267. *********************
  268. VdMFC.h
  269.     Main header file for the application that includes other project-specific 
  270.     headers (including Resource.h) and defines the CVdMFCApp application class.
  271.     This file was generated by the MFC AppWizard and did not require editing.
  272.  
  273. VdMFC.cpp
  274.     This file is the main application source file that contains the application
  275.     class CVdMFCApp. This file was generated by the MFC AppWizard and did not 
  276.     require editing.
  277.  
  278. VdMFC.rc
  279.     This file lists all the Microsoft Windows resources that the VdMFC application
  280.     uses, including the icon stored in the RES subdirectory. This file was 
  281.     generated by the MFC AppWizard and did not require editing.
  282.  
  283. Res\VdMFC.ico
  284.     This is an icon file that is used as the application's icon.  This
  285.     icon is included by the main resource file VdMFC.rc.
  286.  
  287. Res\VdMFC.rc2
  288.     This file contains resources that are not edited by Microsoft Developer 
  289.     Studio. This file was generated by the MFC AppWizard and did not 
  290.     require editing.
  291.  
  292. VdMFC.mak 
  293.     This file is the makefile for the project.
  294.  
  295. VdMFC.dsp 
  296.     This file is the project file.
  297.  
  298. StdAfx.h, StdAfx.cpp
  299.     These files are used to build a precompiled header (PCH) file
  300.     named VdMFC.pch and a precompiled types file named StdAfx.obj. 
  301.     These files were generated by the MFC AppWizard and did not 
  302.     require editing.
  303.  
  304. Resource.h
  305.     This is the standard header file, which defines new resource identifiers.
  306.     This file was generated by the MFC AppWizard and did not 
  307.     require editing. 
  308.  
  309. Bpcvid.h, Bpcvid.cpp 
  310.     These files contain the CBPCVid class, which defines the behavior 
  311.     of the object that provides streaming video functionality. These 
  312.     files were generated by the MFC AppWizard and did not require editing.
  313.  
  314. Bpcbase.h, Bpcbase.cpp 
  315.     These files contain the CBPCDeviceBase class, which defines the behavior 
  316.     of the object that represents either an input or an output device for 
  317.     the Vid control. These files were generated by the MFC AppWizard and 
  318.     did not require editing.
  319.  
  320. *********************
  321. EDITING REQUIRED
  322. *********************
  323. VdMFCDlg.h, VdMFCDlg.cpp -- the dialog box
  324.     These files contain the CVdMFCDlg class. This class defines the 
  325.     behavior of the application's main dialog box. These files were generated 
  326.     by the MFC AppWizard. The following additions were made to these files:
  327.     a. The header files that define the CBPCVid, CBPCDevices, and 
  328.        CBPCDeviceBase classes and the data types and interfaces for the Vid
  329.        control were included.
  330.     b. ClassWizard was used to create variable names for the Vid control and 
  331.        for values typed in the edit box for setting channels (m_channel) and 
  332.        for strings typed in the edit box for setting file names (m_filename).
  333.        The class definition was edited to create protected variables for the
  334.        list box (box) and an available input or output device for the Vid
  335.        control (m_id). The class definition was also edited to create a private 
  336.        variable for a pointer to the IBPCDeviceBase interface.
  337.     c. The constructor for this class was modified by the ClassWizard to assign 
  338.        initial values to the channel and file name variables (m_channel = 0, 
  339.        m_filename = _T("")). 
  340.     d. The DoDataExchange method for this class was modified by the ClassWizard to associate 
  341.        information stored in variables with the appropriate elements of the 
  342.        application. This method associates variable information by using the 
  343.        DDX_Control macro. 
  344.     e. The class definition was edited to declare methods that are implemented  
  345.        in the class. In the class implementation, the BEGIN_MESSAGE_MAP macro 
  346.        was edited to associate click events of user-interface elements with 
  347.        some class methods by using the ON_BN_CLICKED macro.
  348.     f. The OnInitDialog method for this class was edited to: 
  349.        Assign the list-box control of the user interface to the CListBox 
  350.        variable, box.
  351.        Obtain pointers to unknown and enumerate-variant objects that are part 
  352.        of the MFC library.
  353.        Declare and allocate a CBPCDevices object and assign the collection of 
  354.        all the available input and output devices for the Vid control to this object.
  355.        Assign the unknown object to the value returned from the custom 
  356.        CBPCDevices::GetNewEnum method.
  357.        Query the unknown object to obtain an enumerate-variant object and then 
  358.        release the unknown object.
  359.        Enter a while loop set to repeat until there are no more variants in 
  360.        the enumerate-variant object. 
  361.        Get the next variant in the enumerate-variant object and obtain a dispatch 
  362.        for such a variant. Declare and allocate a CBPCDeviceBase object and assign 
  363.        the dispatch value of the obtained variant to this object. Retrieve the 
  364.        name of the device-base object with the CBPCDeviceBase::GetName method 
  365.        and add it to the list box. Clear the variant.
  366.        After exiting the while loop, release the enumerate-variant object. 
  367.     g. The OnSetInput and OnSetOutput methods for this class were implemented to:
  368.        Obtain pointers to unknown and enumerate-variant objects.
  369.        Obtain an interface pointer to IBPCDeviceBase defined in Vidtypes.h.
  370.        Declare and allocate a CBPCDevices object and assign the collection of 
  371.        all the available input and output devices for the Vid control to it.
  372.        Assign the unknown object to the value returned from the custom 
  373.        CBPCDevices::GetNewEnum method.
  374.        Query the unknown object to obtain an enumerate-variant object and then 
  375.        release the unknown object.
  376.        Enter a for loop set to repeat the number of times determined by the 
  377.        CBPCVid::GetDeviceCount method.
  378.        For each iteration of the loop, the methods were implemented to: 
  379.          Obtain the next variant in the enumerate-variant object.
  380.          Query the variant object to obtain an IBPCDeviceBase interface pointer.
  381.          Get the name property of the device with the interface's get_Name method.
  382.          Get the selected item in the list box and then get the string 
  383.          associated with the item.
  384.          If this string is the same as the device name, assign the video control's 
  385.          input and output to that particular device with the SetInput and 
  386.          SetOutput methods of the CBPCVid class. Also, assign the device to
  387.          the private member variable for the device, m_pDeviceBase.
  388.     h. The OnSetChannel method for this class was implemented to dispatch a 
  389.        pointer to the selected item of the list box, then attach this pointer 
  390.        to a CBPCDeviceBase variable with the CBPCDeviceBase::AttachDispatch 
  391.        method, and then assign the channel number specified in the edit box with 
  392.        the CBPCDeviceBase::SetChannel method.
  393.     i. The OnVideoOn method for this class was implemented to reverse the 
  394.        VideoOn value of the Vid control by first retrieving this value and then 
  395.        setting it to the opposite value.
  396.     j. The OnSetFile method for this class was implemented to assign the file 
  397.        name specified in the edit box with the CBPCVid::SetFileName method.
  398.     k. The OnPlay, OnPause, and OnStop methods for this class were 
  399.        implemented to play, suspend play, and stop the file with the Run, 
  400.        Pause, and Stop methods respectively of the CBPCVid class.
  401.  
  402. Bpcdev.h, Bpcdev.cpp 
  403.     These files contain the CBPCDevices class, which defines the behavior 
  404.     of the object that represents a collection of all the available input 
  405.     and output devices for the Vid control. These files were generated 
  406.     by the MFC AppWizard. 
  407.     A declaration and an implementation were added for the GetNewEnum 
  408.     method. This method retrieves an unknown object that refers to an 
  409.     enumerate-variant object.
  410.  
  411.