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

Map the new chapters description calls

Signed-off-by: default avatarHugo Beauzée-Luyssen <hugo@beauzee.fr>
parent 4b09ea17
......@@ -1369,14 +1369,34 @@ public:
*
* \param i_title selected title
*
* \return list containing description of available chapter for title
* \return list containing description of available chapters for title
* i_title
*/
#if LIBVLC_VERSION_INT < LIBVLC_VERSION(3, 0, 0, 0)
std::vector<TrackDescription> chapterDescription(int i_title)
{
libvlc_track_description_t* result = libvlc_video_get_chapter_description( *this, i_title );
return getTracksDescription( result );
}
#else
std::vector<ChapterDescription> chapterDescription(int i_title)
{
libvlc_chapter_description_t **chapters;
int nbChapters = libvlc_media_player_get_full_chapter_descriptions( *this, i_title, &chapters );
auto cleanupCb = [nbChapters](libvlc_chapter_description_t** cs) {
libvlc_chapter_descriptions_release( cs, nbChapters );
};
std::unique_ptr<libvlc_chapter_description_t*[], decltype(cleanupCb)> ptr( chapters, cleanupCb );
std::vector<ChapterDescription> res;
if ( nbChapters < 1 )
return res;
for ( int i = 0; i < nbChapters; ++i )
res.emplace_back( ptr[i] );
}
#endif
/**
* Get current crop filter geometry.
......
......@@ -512,6 +512,48 @@ private:
bool m_menu;
};
///
/// \brief The ChapterDescription class describes a chapter
///
class ChapterDescription
{
public:
///
/// \brief timeoffset The chapter start time in (ms)
///
int64_t starttime() const
{
return m_starttime;
}
///
/// \brief duration The chapter duration in (ms)
///
int64_t duration() const
{
return m_duration;
}
///
/// \brief name The chapter name
///
const std::string& name() const
{
return m_name;
}
explicit ChapterDescription( libvlc_chapter_description_t* c )
: m_duration( c->i_duration ), m_starttime( c->i_time_offset )
{
if ( c->psz_name != nullptr )
m_name = c->psz_name;
}
private:
int64_t m_duration, m_starttime;
std::string m_name;
};
} // 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