View Single Post
Old 20th July 2013, 14:37   #51  |  Link
madshi
Registered Developer
 
Join Date: Sep 2006
Posts: 9,140
Quote:
Originally Posted by clsid View Post
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.
All of that could be achieved by my suggested modification of the new subtitle header. Media players who prefer your suggested behaviour would simply have to call "EnableSubtitleAutoLoading(false)" before building the graph.

The problem with following your suggestion by default is that auto-loading would stop working for every single media player out there, until they manually add support for it. And that is a situation I don't like at all. If a media player is willing to add support for the new subtitle interface, then it should be easy for the media player to call "EnableSubtitleAutoLoading(false)" before building the graph. And that would fulfil most (all?) of your wishes.

Adding a video input pin to XySubFilter is a bad idea, IMHO, because it wouldn't be used for any purpose (other than to get loaded), and it would add complication to XySubFilter development, and maybe harm DXVA decoding compatability.

Quote:
Originally Posted by clsid View Post
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.
Yes, that sounds like a useful addition. Instead of explaining the mutex logic in the header, I'd prefer to add a little helper function, though, to make things easier for the media player devs.

Quote:
Originally Posted by clsid View Post
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.
Yes, that would be useful. It would be nice to have this as part of the interface, though, so that it isn't XySubFilter specific but could also be used by/with other providers.
madshi is offline   Reply With Quote