View Single Post
Old 20th July 2013, 14:16   #50  |  Link
clsid
*****
 
Join Date: Feb 2005
Posts: 5,646
There does not seem to be an elegant solution for the auto-loading problems, and most suggested workarounds involve assistance from the player. So I suggest to keep things as simple as possible: give the player complete control of loading a subtitle provider (when needed) and limit the interface to the communication between providers and consumers.

In other words:
* A consumer does not do anything related to loading. It only communicates with providers.
* A provider should not attempt to auto-load itself unless it is able to load itself for external subs (which implies it connects to the video pin). This means that a filter like XySubFilter should have a merit equal to MERIT_DO_NOT_USE.
* The player is responsible for loading (non-video handling) subtitle providers such as XySubFilter. All players that are capable of using a non-standard video renderer are already customizing the graph building, so it should be rather trivial to add for player developers.


It is theoretically possible that multiple providers are in the graph. In case of external subs, this means a sub file could be loaded twice. This could be prevented by letting the (first) provider setting a mutex, signaling to other providers that a file is already loaded (and thus should be skipped). The mutex could be for example "MadSubInterface" + HashOf(subtitle_filename). The reason for mutexing individual files, is because providers might only support a subset of all formats, or use different auto-loading rules and source locations.


I suggest adding a function to XySubFilter (or maybe all non-video handling providers) that allows the player to instruct it to add an external subtitle file. This could be used by for example MPC-HC to load a downloaded subtitle file, or a file that is added through drag&drop. Such a direct function would not require any dynamic DirectShow graph handling (and the complexities that implies). Then XySubFilter could be used as a full ISR replacement in the case where madVR is used as video renderer.
__________________
MPC-HC 2.2.1
clsid is offline   Reply With Quote