I'm trying to develop an object model for a scenario related closely to the one described below.
Imagine an application for displaying video windows containing TV images on a PC monitor. The video windows are generated by video overlay / inlay devices. The app should be able to control a range of video devices from
different manufacturers so the type of video device will not be known at compile time. In addition the app could potentially have to control more than one device simultaneously so that the user could have 2 or more video
windows visible at any time. We can assume that all of these devices have some core funtionality, such as the ability to display different TV channels and to set the size and position of video window. However, some of the
devices may have additional features such as the ability to freeze-frame.
How the TV channel must be set etc. will vary from device to device but this should be seemless to the client. Extensibility is also key. It should be possible to cater for new devices in the future with minimal impact on the
rest of the system.
I've been looking at Gamma et al's 'Design Patterns..." to try and establish an existing object model for this type of problem but with not too much success so far. From a structural view point I'd considered the Bridge Pattern since that way I could expose a generic VideoWindow class to the client and encapsulate the implementation for different video devices (DeviceA and DeviceB) in separate 'device driver' classes...
TVideoWindow = class (TObject)
DeviceImp : TVideoDeviceImp;
TVideoWindowImp = class (TObject)
T_DeviceA_WindowImp = class (TVideoWindowImp);
T_DeviceB_WindowImp = class (TVideoWindowImp);
In this case the ability to freeze-frame is supposed to be unique to DeviceA, but I can't see how the client can determine that DeviceB does not have this feature. Is there a better pattern for doing this, i.e. a pattern that allows the client to determine the unique capabilities of sub-classes of some base class?
Also, what's the best way of initialising these classes in the first place. Its seems that the Abstract Factory pattern would only be useful if either DeviceA OR DeviceN were being used at any one time, but my app may have each
device displaying a video window and so it will need instances of each device driver class.
Thanks in advance.