Commit 305d6662 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

VLCMedia: Rely on libvlc to store the mrl

parent b65fd307
......@@ -31,9 +31,9 @@
using namespace LibVLCpp;
Media::Media( LibVLCpp::Instance* instance, const QString& filename )
: m_fileName( filename )
, m_tracks( NULL )
: m_tracks( NULL )
, m_nbTracks( 0 )
, m_mrl( NULL )
{
m_internalPtr = libvlc_media_new_location( *instance, filename.toLocal8Bit() );
......@@ -42,6 +42,7 @@ Media::Media( LibVLCpp::Instance* instance, const QString& filename )
Media::Media( LibVLCpp::Media &media )
: m_tracks( NULL )
, m_nbTracks( 0 )
, m_mrl( NULL )
{
m_internalPtr = libvlc_media_duplicate( media );
}
......@@ -51,6 +52,7 @@ Media::~Media()
if ( m_tracks != NULL )
libvlc_media_tracks_release( m_tracks, m_nbTracks );
libvlc_media_release( m_internalPtr );
free( m_mrl );
}
void
......@@ -115,10 +117,12 @@ Media::setAudioDataCtx( void* dataCtx )
addOption( param );
}
const QString&
Media::getFileName() const
const char*
Media::mrl()
{
return m_fileName;
if ( m_mrl == NULL )
m_mrl = libvlc_media_get_mrl( m_internalPtr );
return m_mrl;
}
void
......
......@@ -48,18 +48,18 @@ namespace LibVLCpp
void setAudioUnlockCallback( void* );
void setVideoDataCtx( void* dataCtx );
void setAudioDataCtx( void* dataCtx );
const QString& getFileName() const;
const char* mrl();
void parse();
void fetchTrackInfo();
unsigned int videoCodec() const;
unsigned int audioCodec() const;
private:
QString m_fileName;
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;
char* m_mrl;
};
}
......
......@@ -82,7 +82,7 @@ VLCSource::preparse()
mediaPlayer->getSize( &m_width, &m_height );
m_fps = mediaPlayer->getFps();
if ( m_fps < 0.1f )
vlmcWarning() << "Invalid FPS for source" << m_media->getFileName();
vlmcWarning() << "Invalid FPS for source" << m_media->mrl();
return computeSnapshot( renderer );
}
delete renderer;
......
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