Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
YangLei
libvlcpp
Commits
56e36380
Commit
56e36380
authored
Jun 16, 2020
by
Hugo Beauzée-Luyssen
Browse files
Always expose MediaTrack::Type instead of libvlc_track_type_t
parent
7eb7e720
Changes
4
Hide whitespace changes
Inline
Side-by-side
vlcpp/EventManager.hpp
View file @
56e36380
...
...
@@ -746,55 +746,54 @@ class MediaPlayerEventManager : public EventManager
#if LIBVLC_VERSION_INT >= LIBVLC_VERSION(4, 0, 0, 0)
/**
* \brief onESAdded Registers an event called when an elementary stream get added
* \param f A std::function<void(
libvlc_t
rack
_t
ype
_t
, int)> (or an equivalent Callable type)
*
libvlc_t
rack
_t
ype
_t
: The new track type
* \param f A std::function<void(
MediaT
rack
::T
ype, int)> (or an equivalent Callable type)
*
MediaT
rack
::T
ype: The new track type
* int: the new track index
*/
template
<
typename
Func
>
RegisteredEvent
onESAdded
(
Func
&&
f
)
{
//FIXME: Expose libvlc_track_type_t as an enum class
EXPECT_SIGNATURE
(
void
(
libvlc_track_type_t
,
const
std
::
string
&
));
EXPECT_SIGNATURE
(
void
(
MediaTrack
::
Type
,
const
std
::
string
&
));
return
handle
(
libvlc_MediaPlayerESAdded
,
std
::
forward
<
Func
>
(
f
),
[](
const
libvlc_event_t
*
e
,
void
*
data
)
{
auto
callback
=
static_cast
<
DecayPtr
<
Func
>>
(
data
);
(
*
callback
)(
e
->
u
.
media_player_es_changed
.
i_type
,
(
*
callback
)(
static_cast
<
MediaTrack
::
Type
>
(
e
->
u
.
media_player_es_changed
.
i_type
)
,
std
::
string
{
e
->
u
.
media_player_es_changed
.
psz_id
}
);
});
}
/**
* \brief onESDeleted Registers an event called when an elementary stream get deleted
* \param f A std::function<void(
libvlc_t
rack
_t
ype
_t
, int)> (or an equivalent Callable type)
*
libvlc_t
rack
_t
ype
_t
: The track type
* \param f A std::function<void(
MediaT
rack
::T
ype, int)> (or an equivalent Callable type)
*
MediaT
rack
::T
ype: The track type
* int: the track index
*/
template
<
typename
Func
>
RegisteredEvent
onESDeleted
(
Func
&&
f
)
{
EXPECT_SIGNATURE
(
void
(
libvlc_t
rack
_t
ype
_t
,
const
std
::
string
&
));
EXPECT_SIGNATURE
(
void
(
MediaT
rack
::
T
ype
,
const
std
::
string
&
));
return
handle
(
libvlc_MediaPlayerESDeleted
,
std
::
forward
<
Func
>
(
f
),
[](
const
libvlc_event_t
*
e
,
void
*
data
)
{
auto
callback
=
static_cast
<
DecayPtr
<
Func
>>
(
data
);
(
*
callback
)(
e
->
u
.
media_player_es_changed
.
i_type
,
(
*
callback
)(
static_cast
<
MediaTrack
::
Type
>
(
e
->
u
.
media_player_es_changed
.
i_type
)
,
std
::
string
{
e
->
u
.
media_player_es_changed
.
psz_id
}
);
});
}
/**
* \brief onESSelected Registers an event called when an elementary stream get selected
* \param f A std::function<void(
libvlc_t
rack
_t
ype
_t
, int)> (or an equivalent Callable type)
*
libvlc_t
rack
_t
ype
_t
: The track type
* \param f A std::function<void(
MediaT
rack
::T
ype, int)> (or an equivalent Callable type)
*
MediaT
rack
::T
ype: The track type
* int: the track index
*/
template
<
typename
Func
>
RegisteredEvent
onESSelected
(
Func
&&
f
)
{
EXPECT_SIGNATURE
(
void
(
libvlc_t
rack
_t
ype
_t
,
const
std
::
string
&
,
const
std
::
string
&
));
EXPECT_SIGNATURE
(
void
(
MediaT
rack
::
T
ype
,
const
std
::
string
&
,
const
std
::
string
&
));
return
handle
(
libvlc_MediaPlayerESSelected
,
std
::
forward
<
Func
>
(
f
),
[](
const
libvlc_event_t
*
e
,
void
*
data
)
{
auto
callback
=
static_cast
<
DecayPtr
<
Func
>>
(
data
);
(
*
callback
)(
e
->
u
.
media_player_es_changed
.
i_type
,
(
*
callback
)(
static_cast
<
MediaTrack
::
Type
>
(
e
->
u
.
media_player_es_changed
.
i_type
)
,
std
::
string
{
e
->
u
.
media_player_es_selection_changed
.
psz_selected_id
},
std
::
string
{
e
->
u
.
media_player_es_selection_changed
.
psz_unselected_id
}
);
});
...
...
@@ -818,53 +817,55 @@ class MediaPlayerEventManager : public EventManager
#elif LIBVLC_VERSION_INT >= LIBVLC_VERSION(3, 0, 0, 0)
/**
* \brief onESAdded Registers an event called when an elementary stream get added
* \param f A std::function<void(
libvlc_t
rack
_t
ype
_t
, int)> (or an equivalent Callable type)
*
libvlc_t
rack
_t
ype
_t
: The new track type
* \param f A std::function<void(
MediaT
rack
::T
ype, int)> (or an equivalent Callable type)
*
MediaT
rack
::T
ype: The new track type
* int: the new track index
*/
template
<
typename
Func
>
RegisteredEvent
onESAdded
(
Func
&&
f
)
{
//FIXME: Expose libvlc_track_type_t as an enum class
EXPECT_SIGNATURE
(
void
(
libvlc_track_type_t
,
int
));
EXPECT_SIGNATURE
(
void
(
MediaTrack
::
Type
,
int
));
return
handle
(
libvlc_MediaPlayerESAdded
,
std
::
forward
<
Func
>
(
f
),
[](
const
libvlc_event_t
*
e
,
void
*
data
)
{
auto
callback
=
static_cast
<
DecayPtr
<
Func
>>
(
data
);
(
*
callback
)(
e
->
u
.
media_player_es_changed
.
i_type
,
e
->
u
.
media_player_es_changed
.
i_id
);
(
*
callback
)(
static_cast
<
MediaTrack
::
Type
>
(
e
->
u
.
media_player_es_changed
.
i_type
),
e
->
u
.
media_player_es_changed
.
i_id
);
});
}
/**
* \brief onESDeleted Registers an event called when an elementary stream get deleted
* \param f A std::function<void(
libvlc_t
rack
_t
ype
_t
, int)> (or an equivalent Callable type)
*
libvlc_t
rack
_t
ype
_t
: The track type
* \param f A std::function<void(
MediaT
rack
::T
ype, int)> (or an equivalent Callable type)
*
MediaT
rack
::T
ype: The track type
* int: the track index
*/
template
<
typename
Func
>
RegisteredEvent
onESDeleted
(
Func
&&
f
)
{
EXPECT_SIGNATURE
(
void
(
libvlc_t
rack
_t
ype
_t
,
int
));
EXPECT_SIGNATURE
(
void
(
MediaT
rack
::
T
ype
,
int
));
return
handle
(
libvlc_MediaPlayerESDeleted
,
std
::
forward
<
Func
>
(
f
),
[](
const
libvlc_event_t
*
e
,
void
*
data
)
{
auto
callback
=
static_cast
<
DecayPtr
<
Func
>>
(
data
);
(
*
callback
)(
e
->
u
.
media_player_es_changed
.
i_type
,
e
->
u
.
media_player_es_changed
.
i_id
);
(
*
callback
)(
static_cast
<
MediaTrack
::
Type
>
(
e
->
u
.
media_player_es_changed
.
i_type
),
e
->
u
.
media_player_es_changed
.
i_id
);
});
}
/**
* \brief onESSelected Registers an event called when an elementary stream get selected
* \param f A std::function<void(
libvlc_t
rack
_t
ype
_t
, int)> (or an equivalent Callable type)
*
libvlc_t
rack
_t
ype
_t
: The track type
* \param f A std::function<void(
MediaT
rack
::T
ype, int)> (or an equivalent Callable type)
*
MediaT
rack
::T
ype: The track type
* int: the track index
*/
template
<
typename
Func
>
RegisteredEvent
onESSelected
(
Func
&&
f
)
{
EXPECT_SIGNATURE
(
void
(
libvlc_t
rack
_t
ype
_t
,
int
));
EXPECT_SIGNATURE
(
void
(
MediaT
rack
::
T
ype
,
int
));
return
handle
(
libvlc_MediaPlayerESSelected
,
std
::
forward
<
Func
>
(
f
),
[](
const
libvlc_event_t
*
e
,
void
*
data
)
{
auto
callback
=
static_cast
<
DecayPtr
<
Func
>>
(
data
);
(
*
callback
)(
e
->
u
.
media_player_es_changed
.
i_type
,
e
->
u
.
media_player_es_changed
.
i_id
);
(
*
callback
)(
static_cast
<
MediaTrack
::
Type
>
(
e
->
u
.
media_player_es_changed
.
i_type
),
e
->
u
.
media_player_es_changed
.
i_id
);
});
}
...
...
vlcpp/Media.hpp
View file @
56e36380
...
...
@@ -655,11 +655,12 @@ public:
* \return a vector containing all tracks
*/
#if LIBVLC_VERSION_INT >= LIBVLC_VERSION(4, 0, 0, 0)
std
::
vector
<
MediaTrack
>
tracks
(
libvlc_t
rack
_t
ype
_t
type
)
std
::
vector
<
MediaTrack
>
tracks
(
MediaT
rack
::
T
ype
type
)
{
using
TrackListPtr
=
std
::
unique_ptr
<
libvlc_media_tracklist_t
,
decltype
(
&
libvlc_media_tracklist_delete
)
>
;
TrackListPtr
trackList
{
libvlc_media_get_tracklist
(
*
this
,
type
),
TrackListPtr
trackList
{
libvlc_media_get_tracklist
(
*
this
,
static_cast
<
libvlc_track_type_t
>
(
type
)
),
&
libvlc_media_tracklist_delete
};
if
(
trackList
==
nullptr
)
return
{};
...
...
vlcpp/MediaPlayer.hpp
View file @
56e36380
...
...
@@ -1843,11 +1843,12 @@ public:
#if LIBVLC_VERSION_INT >= LIBVLC_VERSION(4, 0, 0, 0)
std
::
vector
<
MediaTrack
>
tracks
(
libvlc_t
rack
_t
ype
_t
type
)
std
::
vector
<
MediaTrack
>
tracks
(
MediaT
rack
::
T
ype
type
)
{
using
TrackListPtr
=
std
::
unique_ptr
<
libvlc_media_tracklist_t
,
decltype
(
&
libvlc_media_tracklist_delete
)
>
;
TrackListPtr
trackList
{
libvlc_media_player_get_tracklist
(
*
this
,
type
),
TrackListPtr
trackList
{
libvlc_media_player_get_tracklist
(
*
this
,
static_cast
<
libvlc_track_type_t
>
(
type
)
),
&
libvlc_media_tracklist_delete
};
if
(
trackList
==
nullptr
)
return
{};
...
...
vlcpp/structures.hpp
View file @
56e36380
...
...
@@ -103,13 +103,13 @@ public:
///
enum
class
Type
{
Unknown
=
-
1
,
Unknown
=
libvlc_track_unknown
,
/// Audio track
Audio
,
Audio
=
libvlc_track_audio
,
/// Video track
Video
,
Video
=
libvlc_track_video
,
/// Subtitle track (also called SPU sometimes)
Subtitle
Subtitle
=
libvlc_track_text
,
};
///
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment