Platform SDK: Broadcast Architecture |
The ReInit method requests that the Video Access server reinitialize the filter graph for use by the Video control. Visual Basic syntax is shown.
object.ReInit()
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 video to S-video.
When your application calls the ReInit method, the Video Access server sends a BPCVid.StateChange event specifying the value BPC_STATE_REINIT_REQUEST to each video client. BPC_STATE_REINIT_REQUEST indicates the Video Access server has received a request to reinitialize the filter graph. A video client is an application or component that receives a data stream from the filter graph through the Video Access server. Applications that use the Video control are video clients.
When a client receives a BPC_STATE_REINIT_REQUEST notification from the Video Access server, the client must release any outstanding references to device 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 the device objects, an error results when the objects are used after the filter graph is reinitialized.
Note Video controls automatically handle BPC_STATE_REINIT_REQUEST notifications by releasing references to device objects. Therefore, if you are embedding the Video control in a Web page or application that only contains references to BPCVid, your page or application does 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 Access server sends a BPCVid.StateChange event specifying BPC_STATE_REINIT_STARTED, which indicates reinitialization has started. The Video Access server then destroys and recreates the filter graph. Once the filter graph has been successfully recreated, the Video Access server sends a BPC_STATE_REINIT_COMPLETE notification indicating this.
When video clients receive BPC_STATE_REINIT_COMPLETE, they can re-enumerate 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 Access server during reinitialization (that is, between the client's receiving BPC_STATE_REINIT_STARTED and BPC_STATE_REINIT_COMPLETE) the Video Access server blocks the method call until the reinitialization is complete. When the filter graph has been recreated, the Video Access server processes the blocked method calls.
For more information on filter graph reinitialization, see Reinitializing the Filter Graph.
The following example implements a BPCVid.StateChange event handler that responds to BPC_STATE_REINIT_XXX notifications. This example illustrates the functionality you should implement if your application uses the Video control and contains references to BPCDevices or BPCDeviceBase 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. ' (The following 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 ' Optionally, 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) ' Optionally, 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) ' Re-enumerate the devices. Set m_devices = vid.Devices ' Reset any needed devices. ' (The following example displays resetting the input device.) For Each Device In m_devices If Device.HasChannel Then m_inputdevice = Device Exit For End If Next ' Optionally, 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 ' Optionally, you can handle cases other than those listed ' preceding. 'Case (...) Case Else End Select End Sub
You can easily adapt the preceding example as an event handler for a Web page or application that uses the Video control but contains no references to Vid.ocx objects other than BPCVid. To do so, simply remove the BPC_STATE_REINIT_REQUEST case statement. Because the Video control already handles BPC_STATE_REINIT_REQUEST notifications, handling these is not necessary for an application that contains only references to BPCVid.
Windows NT/2000: Unsupported.
Windows 95/98: Requires Windows 98.
Header: Declared in vidsvr.odl.
Import Library: Included as a resource in vid.ocx.