[vlc-devel] Patch for a feature request
mart at float4.com
mart at float4.com
Tue Sep 28 23:42:28 CEST 2010
Hi,
I've recently made a feature request to add a function to free the
memory allocated by libvlc_media_get_tracks_info() in order to avoid a
problem that I detailed in
http://forum.videolan.org/viewtopic.php?f=7&t=82804
Basically, it's about not mixing malloc and free calls between 2
different compilers.
I created a patch implementing this "feature" that is attached to this mail.
Feel free to comment, tell me if it's relevant and/or if it's going to
be included.
Thanks,
Martin
-------------- next part --------------
--- A/include/vlc/libvlc_media.h 2010-09-27 17:56:38.000000000 -0400
+++ B/include/vlc/libvlc_media.h 2010-09-28 17:25:29.000000000 -0400
@@ -465,21 +465,31 @@
*
* This is very likely to change in next release, and be done at the parsing
* phase.
*
* \param p_md media descriptor object
* \param tracks address to store an allocated array of Elementary Streams
- * descriptions (must be freed by the caller)
+ * descriptions (must be freed by libvlc_media_free_tracks_info())
*
* return the number of Elementary Streams
*/
VLC_PUBLIC_API
int libvlc_media_get_tracks_info( libvlc_media_t *p_md,
libvlc_media_track_info_t **tracks );
+/**
+* Free the memory allocated by libvlc_media_get_tracks_info() for the
+* media descriptor's elementary streams description
+*
+* \param tracks an allocated array of Elementary Streams descriptions
+* to be freed
+*/
+VLC_PUBLIC_API
+void libvlc_media_free_tracks_info( libvlc_media_track_info_t *tracks );
+
/** @}*/
# ifdef __cplusplus
}
# endif
#endif /* VLC_LIBVLC_MEDIA_H */
--- A/src/control/media.c 2010-09-27 17:56:38.000000000 -0400
+++ B/src/control/media.c 2010-09-28 17:09:50.000000000 -0400
@@ -731,6 +731,16 @@
}
}
vlc_mutex_unlock( &p_input_item->lock );
return i_es;
}
+
+/**************************************************************************
+* Free media descriptor's elementary streams description
+**************************************************************************/
+void
+libvlc_media_free_tracks_info( libvlc_media_track_info_t * p_es )
+{
+ if ( p_es )
+ free( p_es );
+}
More information about the vlc-devel
mailing list