mirror of
https://github.com/tuxbox-neutrino/libstb-hal.git
synced 2025-08-27 07:23:11 +02:00
libeplayer3: use actual pids instead of indexes
This commit is contained in:
@@ -174,6 +174,7 @@ bool cPlayback::Start(char *filename, unsigned short vpid, int vtype, unsigned s
|
||||
if (pm != PLAYMODE_TS && player && player->output && player->playback) {
|
||||
player->output->Command(player, OUTPUT_OPEN, NULL);
|
||||
|
||||
SetAPid(apid, 0);
|
||||
if ( player->playback->Command(player, PLAYBACK_PLAY, NULL) == 0 ) // playback.c uses "int = 0" for "true"
|
||||
ret = true;
|
||||
}
|
||||
@@ -452,25 +453,31 @@ void cPlayback::FindAllPids(uint16_t *apids, unsigned short *ac3flags, uint16_t
|
||||
int i = 0,j=0;
|
||||
for (i = 0,j=0; TrackList[i] != NULL; i+=2,j++) {
|
||||
printf("\t%s - %s\n", TrackList[i], TrackList[i+1]);
|
||||
apids[j]=j;
|
||||
// atUnknown, atMPEG, atMP3, atAC3, atDTS, atAAC, atPCM, atOGG, atFLAC
|
||||
if( !strncmp("A_MPEG/L3", TrackList[i+1], 9))
|
||||
ac3flags[j] = 4;
|
||||
else if(!strncmp("A_AC3", TrackList[i+1], 5))
|
||||
ac3flags[j] = 1;
|
||||
else if(!strncmp("A_DTS", TrackList[i+1], 5))
|
||||
ac3flags[j] = 6;
|
||||
else if(!strncmp("A_AAC", TrackList[i+1], 5))
|
||||
ac3flags[j] = 5;
|
||||
else if(!strncmp("A_PCM", TrackList[i+1], 5))
|
||||
ac3flags[j] = 0; //todo
|
||||
else if(!strncmp("A_VORBIS", TrackList[i+1], 8))
|
||||
ac3flags[j] = 0; //todo
|
||||
else if(!strncmp("A_FLAC", TrackList[i+1], 6))
|
||||
ac3flags[j] = 0; //todo
|
||||
else
|
||||
ac3flags[j] = 0; //todo
|
||||
language[j]=TrackList[i];
|
||||
if (j < max_numpida) {
|
||||
int _pid;
|
||||
char _lang[strlen(TrackList[i])];
|
||||
if (2 == sscanf(TrackList[i], "%d %s\n", &_pid, _lang)) {
|
||||
apids[j]=(uint16_t)_pid;
|
||||
// atUnknown, atMPEG, atMP3, atAC3, atDTS, atAAC, atPCM, atOGG, atFLAC
|
||||
if( !strncmp("A_MPEG/L3", TrackList[i+1], 9))
|
||||
ac3flags[j] = 4;
|
||||
else if(!strncmp("A_AC3", TrackList[i+1], 5))
|
||||
ac3flags[j] = 1;
|
||||
else if(!strncmp("A_DTS", TrackList[i+1], 5))
|
||||
ac3flags[j] = 6;
|
||||
else if(!strncmp("A_AAC", TrackList[i+1], 5))
|
||||
ac3flags[j] = 5;
|
||||
else if(!strncmp("A_PCM", TrackList[i+1], 5))
|
||||
ac3flags[j] = 0; //todo
|
||||
else if(!strncmp("A_VORBIS", TrackList[i+1], 8))
|
||||
ac3flags[j] = 0; //todo
|
||||
else if(!strncmp("A_FLAC", TrackList[i+1], 6))
|
||||
ac3flags[j] = 0; //todo
|
||||
else
|
||||
ac3flags[j] = 0; //todo
|
||||
language[j]=std::string(_lang);
|
||||
}
|
||||
}
|
||||
free(TrackList[i]);
|
||||
free(TrackList[i+1]);
|
||||
}
|
||||
@@ -480,6 +487,130 @@ void cPlayback::FindAllPids(uint16_t *apids, unsigned short *ac3flags, uint16_t
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
void cPlayback::FindAllSubtitlePids(uint16_t *pids, uint16_t *numpids, std::string *language)
|
||||
{
|
||||
printf("%s:%s\n", FILENAME, __FUNCTION__);
|
||||
int max_numpids = *numpids;
|
||||
*numpids = 0;
|
||||
if(player && player->manager && player->manager->subtitle) {
|
||||
char ** TrackList = NULL;
|
||||
player->manager->subtitle->Command(player, MANAGER_LIST, &TrackList);
|
||||
if (TrackList != NULL) {
|
||||
printf("SubtitleTrack List\n");
|
||||
int i = 0,j=0;
|
||||
for (i = 0,j=0; TrackList[i] != NULL; i+=2,j++) {
|
||||
printf("\t%s - %s\n", TrackList[i], TrackList[i+1]);
|
||||
if (j < max_numpids) {
|
||||
int _pid;
|
||||
char _lang[strlen(TrackList[i])];
|
||||
if (2 == sscanf(TrackList[i], "%d %s\n", &_pid, _lang)) {
|
||||
pids[j]=(uint16_t)_pid;
|
||||
language[j]=std::string(_lang);
|
||||
}
|
||||
}
|
||||
free(TrackList[i]);
|
||||
free(TrackList[i+1]);
|
||||
}
|
||||
free(TrackList);
|
||||
*numpids=j;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void cPlayback::FindAllDvbsubtitlePids(uint16_t *pids, uint16_t *numpids, std::string *language)
|
||||
{
|
||||
printf("%s:%s\n", FILENAME, __FUNCTION__);
|
||||
int max_numpids = *numpids;
|
||||
*numpids = 0;
|
||||
if(player && player->manager && player->manager->dvbsubtitle) {
|
||||
char ** TrackList = NULL;
|
||||
player->manager->dvbsubtitle->Command(player, MANAGER_LIST, &TrackList);
|
||||
if (TrackList != NULL) {
|
||||
printf("DvbsubtitleTrack List\n");
|
||||
int i = 0,j=0;
|
||||
for (i = 0,j=0; TrackList[i] != NULL; i+=2,j++) {
|
||||
printf("\t%s - %s\n", TrackList[i], TrackList[i+1]);
|
||||
if (j < max_numpids) {
|
||||
int _pid;
|
||||
char _lang[strlen(TrackList[i])];
|
||||
if (2 == sscanf(TrackList[i], "%d %s\n", &_pid, _lang)) {
|
||||
pids[j]=(uint16_t)_pid;
|
||||
language[j]=std::string(_lang);
|
||||
}
|
||||
}
|
||||
free(TrackList[i]);
|
||||
free(TrackList[i+1]);
|
||||
}
|
||||
free(TrackList);
|
||||
*numpids=j;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void cPlayback::FindAllTeletextsubtitlePids(uint16_t *pids, uint16_t *numpids, std::string *language)
|
||||
{
|
||||
printf("%s:%s\n", FILENAME, __FUNCTION__);
|
||||
int max_numpids = *numpids;
|
||||
*numpids = 0;
|
||||
if(player && player->manager && player->manager->teletext) {
|
||||
char ** TrackList = NULL;
|
||||
player->manager->teletext->Command(player, MANAGER_LIST, &TrackList);
|
||||
if (TrackList != NULL) {
|
||||
printf("Teletext List\n");
|
||||
int i = 0,j=0;
|
||||
for (i = 0,j=0; TrackList[i] != NULL; i+=2) {
|
||||
int type = 0;
|
||||
printf("\t%s - %s\n", TrackList[i], TrackList[i+1]);
|
||||
if (j < max_numpids) {
|
||||
int _pid;
|
||||
if (2 != sscanf(TrackList[i], "%d %*s %d %*d %*d", &_pid, &type))
|
||||
continue;
|
||||
if (type != 2 && type != 5) // return subtitles only
|
||||
continue;
|
||||
pids[j]=(uint16_t)_pid;
|
||||
language[j]=std::string(TrackList[i]);
|
||||
j++;
|
||||
}
|
||||
free(TrackList[i]);
|
||||
free(TrackList[i+1]);
|
||||
}
|
||||
free(TrackList);
|
||||
*numpids=j;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unsigned short cPlayback::GetTeletextPid(void)
|
||||
{
|
||||
printf("%s:%s\n", FILENAME, __FUNCTION__);
|
||||
int pid = 0;
|
||||
if(player && player->manager && player->manager->teletext) {
|
||||
char ** TrackList = NULL;
|
||||
player->manager->teletext->Command(player, MANAGER_LIST, &TrackList);
|
||||
if (TrackList != NULL) {
|
||||
printf("Teletext List\n");
|
||||
int i = 0;
|
||||
for (i = 0; TrackList[i] != NULL; i+=2) {
|
||||
int type = 0;
|
||||
printf("\t%s - %s\n", TrackList[i], TrackList[i+1]);
|
||||
if (!pid) {
|
||||
if (2 != sscanf(TrackList[i], "%d %*s %d %*d %*d", &pid, &type))
|
||||
continue;
|
||||
if (type != 1)
|
||||
pid = 0;
|
||||
}
|
||||
free(TrackList[i]);
|
||||
free(TrackList[i+1]);
|
||||
}
|
||||
free(TrackList);
|
||||
}
|
||||
}
|
||||
printf("teletext pid id %d (0x%x)\n", pid, pid);
|
||||
return (unsigned short)pid;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* dummy functions for subtitles */
|
||||
void cPlayback::FindAllSubs(uint16_t * /*pids*/, unsigned short * /*supp*/, uint16_t *num, std::string * /*lang*/)
|
||||
{
|
||||
@@ -522,7 +653,7 @@ bool cPlayback::IsPlaying(void) const
|
||||
{
|
||||
printf("%s:%s\n", FILENAME, __FUNCTION__);
|
||||
|
||||
/* konfetti: there is no event/callback mechanism in libeplayer2
|
||||
/* konfetti: there is no event/callback mechanism in libeplayer2
|
||||
* so in case of ending playback we have no information on a
|
||||
* terminated stream currently (or did I oversee it?).
|
||||
* So let's ask the player the state.
|
||||
@@ -530,7 +661,7 @@ bool cPlayback::IsPlaying(void) const
|
||||
if (playing)
|
||||
{
|
||||
return player->playback->isPlaying;
|
||||
}
|
||||
}
|
||||
|
||||
return playing;
|
||||
}
|
||||
|
Reference in New Issue
Block a user