mrfearless / MediaPlayer

A Media Player using the MFPlayer Library
8 stars 0 forks source link

is possible to add audio and subtitle track changing in the future? #5

Open makson5 opened 2 weeks ago

makson5 commented 2 weeks ago

is possible to add audio and subtitle track changing in the future?

greenozon commented 2 weeks ago

do you have some sample videos having multiple audio tracks?

mrfearless commented 2 weeks ago

It might be possible to do the audio track changing if the media item has multiple audio tracks. I will look into it. Subtitles as far as I can see are not likely.

For subtitle support, as far as I can see I dont think the MFPlay API supports subtitles. Later versions for win10/11 using The IMFMediaEngineEx objects might support SAMI. But I am not currently looking at the newer Media Foundation APIs - which wont work on older windows operating system anyhow.

I spent a good amount of time trying to come up with a workaround, but the video player window when rendering doesn't allow any other drawing inside of it, either by subclassing it or directly drawing onto the dc of the video window. From what I could gather, it is using the DWM and DirectX to do the rendering. The only partial success I had was to create a popup window that wasnt a child of the MediaPlayer (displays over the whole desktop), with that I could place this popup over the video window with some test text. But if the user moves/resizes or changes focus the popup would remain on the desktop - so not ideal.

Even then I would have to write a library of functions to parse the srt file, build an index of entries with the times and then handle displaying the text at certain times to sync with the position in the media file, and I couldn't be sure it wouldn't go out of sync or lag somehow.

So I dont think my basic MediaPlayer example application will ever support srt/subtitles unfortunately.

makson5 commented 1 week ago

This player is the smallest and fastest player I have ever used. Is it possible to add plug-in functionality for subtitle support?

mrfearless commented 1 week ago

Thanks. Unfortunately the MFPlay API doesn't support subtitles, so there is no way to add plug-in functionality for that.

mrfearless commented 2 days ago

I can now list the audio streams, as shown in the tooltip over the 'i' button. Tested it with a few multi audio language files and it does show, for example a video stream, an english audio and an italian audio stream. I will look into being able to switch over/select a particular audio stream.