libvlc : API to free tracks info
Posted: 23 Sep 2010 17:23
I'm not sure if this is the right place to suggest this feature, since it's about libvlc and not directly VLC.
The function libvlc_media_get_tracks_info allocates memory for the returned tracks info that must be freed by the caller. I suggest/request the addition of a function such as:
that would free the memory.
The reason why I think this could be useful, aside from the possibility to change the way memory is allocated/freed inside libvlc without having to change client code, is the following. I've been using libvlc with an application compiled with Visual Studio (I know that __building VLC__ with Visual Studio is a complicated/not recommended thing, but using libvlc with it works great). When it comes the time to call free() on the allocated memory, Visual Studio's version of free() is called instead of mingw's, which crashes. In order to fix this, I had to create another DLL that I compiled with mingw with the very simple following code:
I can dynamically load that DLL and the mingw_free() function pointer, in order to call mingw's version of free(). It's not that dirty of a workaround, but still I think that memory allocated by a library should be freed by that same library.
That's why I request a function to free the memory allocated by the function:
If that is considered relevant, I could probably write a (about 10 lines long) patch.
Thanks,
pogo11
The function libvlc_media_get_tracks_info allocates memory for the returned tracks info that must be freed by the caller. I suggest/request the addition of a function such as:
Code: Select all
VLC_PUBLIC_API
int libvlc_media_free_tracks_info(libvlc_media_track_info_t *tracks );
The reason why I think this could be useful, aside from the possibility to change the way memory is allocated/freed inside libvlc without having to change client code, is the following. I've been using libvlc with an application compiled with Visual Studio (I know that __building VLC__ with Visual Studio is a complicated/not recommended thing, but using libvlc with it works great). When it comes the time to call free() on the allocated memory, Visual Studio's version of free() is called instead of mingw's, which crashes. In order to fix this, I had to create another DLL that I compiled with mingw with the very simple following code:
Code: Select all
#include <stdlib.h>
void mingw_free( void * p )
{
free( p );
}
That's why I request a function to free the memory allocated by the function:
Code: Select all
VLC_PUBLIC_API
int libvlc_media_free_tracks_info(libvlc_media_track_info_t *tracks );
Thanks,
pogo11