BPCVid.ReInit

[This is preliminary documentation and subject to change.]

The ReInit method requests that the video server reinitialize the filter graph.

Syntax

object.ReInit()

Parameters

object
Object expression that resolves to a BPCVid object.

Remarks

ReInit is typically called when an application or process changes the hardware configuration in such a way that the filter graph needs to be rebuilt. An example of an application that calls ReInit is a setup application that reconfigures auxiliary video input from composite to s-video.

When you call the ReInit method, the video server sends a BPCVid.StateChange event specifying BPC_STATE_REINIT_REQUEST to each video client. A video client is an application or component that receives a data stream from the filter graph through the video server. Applications that utilize the Video control are video clients.

When a client receives a BPC_STATE_REINIT_REQUEST notification from the video server, the client must release any outstanding references to Vid.ocx objects such as BPCDeviceBase or BPCDevices. The one exception is that your application can retain references to BPCVid objects. If your video client does not release these objects, an error will result when these objects are used after the filter graph is reinitialized.

Note  Note that Video controls automatically handle BPC_STATE_REINIT_REQUEST notifications, by releasing references to Vid.ocx objects. Therefore, if you are embedding the Video control in a Web page or application that does not contain any other references to Vid.ocx objects, you do not need to handle BPC_STATE_REINIT_REQUEST notifications.

After all video clients have been notified the filter graph is about to be reinitialized, the video server fires a BPCVid.StateChange event specifying BPC_STATE_REINIT_STARTED. It then destroys and recreates the filter graph. Once the filter graph has been successfully recreated, the video server sends a BPC_STATE_REINIT_COMPLETE notification.

When video clients receive the BPC_STATE_REINIT_COMPLETE notification, they are able to reenumerate and reselect devices. Note that the device list may have changed as a consequence of the reinitialization.

If a video client calls a method that requests an object from the video server during the reinitialization (between receiving the BPC_STATE_REINIT_STARTED and BPC_STATE_REINIT_COMPLETE notifications) the video server blocks the method call until the reinitialization is complete. When the filter graph has been recreated, the video server processes the blocked method calls.

Examples

The following example implements an BPCVid.StateChange event handler that responds to BPC_STATE_REINIT_XXX notifications. This illustrates the functionality you should implement if your application uses the Video control and contains references to other Vid.ocx objects.

Private Sub MyApp_StateChange( lpdDevice As BPCDeviceBase, _
                               oldState As Long, newState As Long)
  Select Case (newState)
  Case(BPC_STATE_REINIT_REQUEST)
    'Release all references to Vid.ocx objects except BPCVid
    '(This example shows how to do this for an 
    'application that contains a reference to 
    'a BPCDevices member variable, m_devices and 
    'a BPCDeviceBase member variable, m_inputdevice)
    Set m_devices = Nothing
    Set m_inputdevice = Nothing
 
    'Optional - you can set a flag so that other subroutines in the
    'application can check the reinitialization state 
    'of the filter graph.
    m_lReinitState = BPC_STATE_REINIT_REQUEST
 
  Case(BPC_STATE_REINIT_STARTED)
    'Optional - you can set a flag so that other subroutines in the
    'application can check the reinitialization state 
    'of the filter graph.
    m_lReinitState = BPC_STATE_REINIT_STARTED
 
  Case(BPC_STATE_REINIT_COMPLETE)
    'Reenumerate the devices
    Set m_devices = vid.Devices
 
    'Reset any needed devices. 
    '(This example displays resetting the input device.)
    For Each Device In m_devices 
      If Device.HasChannel 
        Then m_inputdevice = Device 
        Exit For 
      End If
    Next
 
    'Optional - you can set a flag so that other subroutines in the
    'application can check the reinitialization state 
    'of the filter graph.
    m_lReinitState = BPC_STATE_REINIT_COMPLETE
 
  'Optional - you can handle cases other than those listed above
  'Case (...)
  Case Else
 
  End Select
End Sub
 

You can easily adapt the preceding example into an event handler for a Web page or application that uses the Video control but does not contain references to Vid.ocx objects. Simply remove the BPC_STATE_REINIT_REQUEST case statement. Because the Video control already implements this functionality, handling BPC_STATE_REINIT_REQUEST notifications is not necessary for such an application.

QuickInfo

  Windows NT: Unsupported.
  Windows: Requires Windows 98.
  Windows CE: Unsupported.
  Header: Declared in vidsvr.odl.
  Import Library: Included as a resource in vid.ocx.
  Unicode: Yes.

See Also

Reinitializing the Filter Graph, BPCVid.StateChange