Commit 4b09ea17 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf Committed by Hugo Beauzée-Luyssen

Map the new TitleDescription calls

Signed-off-by: default avatarHugo Beauzée-Luyssen <hugo@beauzee.fr>
parent ad536571
......@@ -1337,11 +1337,32 @@ public:
*
* \return list containing description of available titles
*/
#if LIBVLC_VERSION_INT < LIBVLC_VERSION(3, 0, 0, 0)
std::vector<TrackDescription> titleDescription()
{
libvlc_track_description_t* result = libvlc_video_get_title_description( *this );
return getTracksDescription( result );
}
#else
std::vector<TitleDescription> titleDescription()
{
libvlc_title_description_t **titles;
int nbTitles = libvlc_media_player_get_full_title_descriptions( *this, &titles);
auto cleanupCb = [nbTitles]( libvlc_title_description_t** ts) {
libvlc_title_descriptions_release( ts, nbTitles );
};
std::unique_ptr<libvlc_title_description_t*[], decltype(cleanupCb)> ptr(
titles, cleanupCb);
std::vector<TitleDescription> res;
if ( nbTitles < 1 )
return res;
for ( int i = 0; i < nbTitles; ++i )
res.emplace_back( ptr[i] );
}
#endif
/**
* Get the description of available chapters for specific title.
......
......@@ -468,5 +468,50 @@ private:
std::string m_name;
};
///
/// \brief The TitleDescription class describes a title
///
class TitleDescription
{
public:
///
/// \brief duration The title duration in (ms)
///
int64_t duration() const
{
return m_duration;
}
///
/// \brief name The title name
///
const std::string& name() const
{
return m_name;
}
///
/// \brief name Is the title a menu?
///
bool isMenu() const
{
return m_menu;
}
explicit TitleDescription( libvlc_title_description_t* c )
: m_duration( c->i_duration ), m_menu( c->b_menu )
{
if ( c->psz_name != nullptr )
m_name = c->psz_name;
}
private:
int64_t m_duration;
std::string m_name;
bool m_menu;
};
} // namespace VLC
#endif
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