-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsubtitles.cpp
47 lines (38 loc) · 1.09 KB
/
subtitles.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include "subtitles.h"
#include "FenCodeGenere.h"
#include <vlc/vlc.h>
#include <QDebug>
subtitles::subtitles()
{
}
void subtitles::GetSubtitlesInfo(libvlc_media_player_t *player)
{
int nbSub;
/* Get numbers of subtitle available */
nbSub = libvlc_video_get_spu_count(player);
/* get subtitles list and description */
sub_desc = libvlc_video_get_spu_description(player);
/* Parse list of available subtitles and print their id */
for (int i = 0; i < nbSub; i++)
{
qDebug() << "Available subs" << sub_desc->i_id;
sub_desc = sub_desc->p_next;
}
}
void subtitles::setSubtitlesNext(libvlc_media_player_t *player)
{
int currentSub;
/* Get id of current subtitle, -1 if no subtitle */
currentSub = libvlc_video_get_spu(player);
/* get subtitles list and description */
sub_desc = libvlc_video_get_spu_description(player);
/* If subtitle already on screen then disable it */
if (currentSub != -1)
{
libvlc_video_set_spu(player, -1);
}
else /* If no subtitle then choose the first on ne list */
{
libvlc_video_set_spu(player, sub_desc->p_next->i_id);
}
}