# This allocates a double pointer and a MediaTrack object in RAM, then points to
# it, but no value is assigned to this double pointer or the MediaTrack object.
mediaTrack_pp = ctypes.POINTER(vlc.MediaTrack)()
# Assigns the MediaTrack in the double pointer to the values stored in `media`,
# returning the amount of media tracks as `n`
n = vlc.libvlc_media_tracks_get(media, ctypes.byref(mediaTrack_pp))
# Converts the double pointer to `POINTER` class that Python understands. We can
# then get the value the pointer is pointing at.
info = ctypes.cast(mediaTrack_pp, ctypes.POINTER(ctypes.POINTER(vlc.MediaTrack) * n))
# This gets the actual value of the double pointer i.e. value of MediaTrack
media_tracks = info.contents[0].contents
采样率(附加上述代码):
# According to the API doc, MediaTrack class has an `u` fie