Commit 4fb35e1f authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

VLCMedia: Fix use of deprecated API

parent a243f81f
...@@ -32,7 +32,7 @@ using namespace LibVLCpp; ...@@ -32,7 +32,7 @@ using namespace LibVLCpp;
Media::Media( const QString& filename ) : Media::Media( const QString& filename ) :
m_fileName( filename ), m_fileName( filename ),
m_tracksInfo( NULL ) m_tracks( NULL )
{ {
m_internalPtr = libvlc_media_new_location( *(LibVLCpp::Instance::getInstance()), m_internalPtr = libvlc_media_new_location( *(LibVLCpp::Instance::getInstance()),
filename.toLocal8Bit() ); filename.toLocal8Bit() );
...@@ -40,8 +40,8 @@ Media::Media( const QString& filename ) : ...@@ -40,8 +40,8 @@ Media::Media( const QString& filename ) :
Media::~Media() Media::~Media()
{ {
// tracks info gets allocated by vlc, so we use free. if ( m_tracks )
free( m_tracksInfo ); libvlc_media_tracks_release( m_tracks, m_nbTracks );
libvlc_media_release( m_internalPtr ); libvlc_media_release( m_internalPtr );
} }
...@@ -121,15 +121,15 @@ Media::parse() ...@@ -121,15 +121,15 @@ Media::parse()
void void
Media::fetchTrackInfo() Media::fetchTrackInfo()
{ {
m_nbTracks = libvlc_media_get_tracks_info( *this, &m_tracksInfo ); m_nbTracks = libvlc_media_tracks_get( *this, &m_tracks );
} }
unsigned int unsigned int
Media::videoCodec() const Media::videoCodec() const
{ {
for ( int i = 0; i < m_nbTracks; ++i ) for ( int i = 0; i < m_nbTracks; ++i )
if ( m_tracksInfo[i].i_type == libvlc_track_video ) if ( m_tracks[i]->i_type == libvlc_track_video )
return m_tracksInfo[i].i_codec; return m_tracks[i]->i_codec;
return 0; return 0;
} }
...@@ -137,7 +137,7 @@ unsigned int ...@@ -137,7 +137,7 @@ unsigned int
Media::audioCodec() const Media::audioCodec() const
{ {
for ( int i = 0; i < m_nbTracks; ++i ) for ( int i = 0; i < m_nbTracks; ++i )
if ( m_tracksInfo[i].i_type == libvlc_track_video ) if ( m_tracks[i]->i_type == libvlc_track_video )
return m_tracksInfo[i].i_codec; return m_tracks[i]->i_codec;
return 0; return 0;
} }
...@@ -53,7 +53,7 @@ namespace LibVLCpp ...@@ -53,7 +53,7 @@ namespace LibVLCpp
private: private:
QString m_fileName; 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. // this has not to be equal to nb video tracks + nb audio tracks.
// it is only meant to use when iterating over m_tracksInfo // it is only meant to use when iterating over m_tracksInfo
int m_nbTracks; int m_nbTracks;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment