[vlmc-devel] VLCMedia: Fix use of deprecated API

Hugo Beauzée-Luyssen git at videolan.org
Fri Jan 24 19:37:03 CET 2014


vlmc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Fri Jan 24 19:20:47 2014 +0200| [4fb35e1f3ceea5ec31a1deaf8c0e1ee87f22dea7] | committer: Hugo Beauzée-Luyssen

VLCMedia: Fix use of deprecated API

> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=4fb35e1f3ceea5ec31a1deaf8c0e1ee87f22dea7
---

 src/LibVLCpp/VLCMedia.cpp |   16 ++++++++--------
 src/LibVLCpp/VLCMedia.h   |    2 +-
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/LibVLCpp/VLCMedia.cpp b/src/LibVLCpp/VLCMedia.cpp
index 2bbafef..35dc4eb 100644
--- a/src/LibVLCpp/VLCMedia.cpp
+++ b/src/LibVLCpp/VLCMedia.cpp
@@ -32,7 +32,7 @@ using namespace LibVLCpp;
 
 Media::Media( const QString& filename ) :
     m_fileName( filename ),
-    m_tracksInfo( NULL )
+    m_tracks( NULL )
 {
     m_internalPtr = libvlc_media_new_location( *(LibVLCpp::Instance::getInstance()),
                                                filename.toLocal8Bit() );
@@ -40,8 +40,8 @@ Media::Media( const QString& filename ) :
 
 Media::~Media()
 {
-    // tracks info gets allocated by vlc, so we use free.
-    free( m_tracksInfo );
+    if ( m_tracks )
+        libvlc_media_tracks_release( m_tracks, m_nbTracks );
     libvlc_media_release( m_internalPtr );
 }
 
@@ -121,15 +121,15 @@ Media::parse()
 void
 Media::fetchTrackInfo()
 {
-    m_nbTracks = libvlc_media_get_tracks_info( *this, &m_tracksInfo );
+    m_nbTracks = libvlc_media_tracks_get( *this, &m_tracks );
 }
 
 unsigned int
 Media::videoCodec() const
 {
     for ( int i = 0; i < m_nbTracks; ++i )
-        if ( m_tracksInfo[i].i_type == libvlc_track_video )
-            return m_tracksInfo[i].i_codec;
+        if ( m_tracks[i]->i_type == libvlc_track_video )
+            return m_tracks[i]->i_codec;
     return 0;
 }
 
@@ -137,7 +137,7 @@ unsigned int
 Media::audioCodec() const
 {
     for ( int i = 0; i < m_nbTracks; ++i )
-        if ( m_tracksInfo[i].i_type == libvlc_track_video )
-            return m_tracksInfo[i].i_codec;
+        if ( m_tracks[i]->i_type == libvlc_track_video )
+            return m_tracks[i]->i_codec;
     return 0;
 }
diff --git a/src/LibVLCpp/VLCMedia.h b/src/LibVLCpp/VLCMedia.h
index 9260f3d..a7f92fd 100644
--- a/src/LibVLCpp/VLCMedia.h
+++ b/src/LibVLCpp/VLCMedia.h
@@ -53,7 +53,7 @@ namespace LibVLCpp
 
     private:
         QString                     m_fileName;
-        libvlc_media_track_info_t   *m_tracksInfo;
+        libvlc_media_track_t        **m_tracks;
         // this has not to be equal to nb video tracks + nb audio tracks.
         // it is only meant to use when iterating over m_tracksInfo
         int                         m_nbTracks;



More information about the Vlmc-devel mailing list