Skip to content

Add dvdnav_get_number_of_subtitles

Dear all,

I've been working recently on optical disc functionality in Kodi and have been spending a bit of time trying to understand the differences (and need for) our dll wrapping of the lib and our patches. Unfortunately, libdvdnav in Kodi is highly patched, most of the patches are quick hacks to get functionality available to the kodi core codebase and most (if not all) are not ready for upstream. My goal here is to slowly identify functionality that can't be done using the public API and try to get it upstream and rewrite what it can be already achieved using the public interface of the libs.

In Kodi we expose the private vm (dvdnav_get_vm) to have access to multiple properties (which is obviously wrong)[1]. One of the reasons for this is to get access to the subtitle stream count [2]. We need access to the subtitle stream count to iterate over them, set a valid index and get the stream properties to display on the video OSD using dvdnav_get_spu_attr [3]. I couldn't find any way of getting the subtitle count without adding a new function to the dvdnav interface. This is what this PR does. It has been runtime tested in Kodi by replacing the snippet from [2] with:

int8_t subCount = m_dll.dvdnav_get_number_of_subtitles(m_dvdnav);

Refs:

[1] https://github.com/xbmc/libdvdnav/commit/8305696be79fe650d3d9eee29b2a88e020d7c58f

[2] https://github.com/xbmc/xbmc/blob/master/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamNavigator.cpp#L971-L988

[3] https://github.com/xbmc/xbmc/blob/a15445fe44b7c89296fcb7ee736ac813f2410254/xbmc/cores/VideoPlayer/VideoPlayer.cpp#L456-L471

Edited by Miguel Borges de Freitas

Merge request reports