crude hack for movieplayer tuxtxt integration

This commit is contained in:
martii
2013-03-31 11:55:51 +02:00
parent f6f9f03152
commit 0962c08e90
4 changed files with 84 additions and 49 deletions

View File

@@ -37,6 +37,7 @@
#include <pthread.h>
#include <errno.h>
#include <sys/uio.h>
#include <errno.h>
#include "common.h"
#include "output.h"

View File

@@ -958,54 +958,42 @@ static int PlaybackSwitchSubtitle(Context_t *context, int* track) {
return ret;
}
#ifdef MARTII
static int PlaybackSwitchDVBSubtitle(Context_t *context, int* track) {
static int PlaybackSwitchDVBSubtitle(Context_t *context, int* pid) {
int ret = cERR_PLAYBACK_NO_ERROR;
playback_printf(10, "Track: %d\n", *track);
playback_printf(10, "Track: %d\n", *pid);
if (context && context->playback && context->playback->isPlaying ) {
if (context->manager && context->manager->dvbsubtitle) {
if (context->manager->dvbsubtitle->Command(context, MANAGER_SET, track) < 0)
{
playback_err("manager set track failed\n");
if (context && context->manager && context->manager->dvbsubtitle ) {
if (context->manager->dvbsubtitle->Command(context, *pid == 0xffff ? MANAGER_DEL : MANAGER_SET, pid) < 0) {
playback_err("dvbsub manager set track failed\n");
ret = cERR_PLAYBACK_ERROR;
}
} else
{
ret = cERR_PLAYBACK_ERROR;
playback_err("no dvbsubtitle\n");
}
} else
{
playback_err("not possible\n");
ret = cERR_PLAYBACK_ERROR;
}
if (*pid == 0xffff)
container_ffmpeg_update_tracks(context, "current stream");
playback_printf(10, "exiting with value %d\n", ret);
return ret;
}
static int PlaybackSwitchTeletext(Context_t *context, int* track) {
static int PlaybackSwitchTeletext(Context_t *context, int* pid) {
int ret = cERR_PLAYBACK_NO_ERROR;
playback_printf(10, "Track: %d\n", *track);
playback_printf(10, "Track: %d\n", *pid);
if (context && context->playback && context->playback->isPlaying ) {
if (context->manager && context->manager->teletext) {
if (context->manager->teletext->Command(context, MANAGER_SET, track) < 0)
{
playback_err("manager set track failed\n");
if (context && context->manager && context->manager->teletext ) {
if (context->manager->teletext->Command(context, *pid == 0xffff ? MANAGER_DEL : MANAGER_SET, pid)) {
playback_err("ttxsub manager set track failed\n");
ret = cERR_PLAYBACK_ERROR;
}
} else
{
ret = cERR_PLAYBACK_ERROR;
playback_err("no dvbsubtitle\n");
}
} else
{
playback_err("not possible\n");
ret = cERR_PLAYBACK_ERROR;
}
if (*pid == 0xffff)
container_ffmpeg_update_tracks(context, "current stream");
playback_printf(10, "exiting with value %d\n", ret);

View File

@@ -124,7 +124,7 @@ bool cPlayback::Start(char *filename, unsigned short vpid, int vtype, unsigned s
#ifdef MARTII
mSubtitleStream=-1;
mDvbsubtitleStream=-1;
mTeletextStream=0;
mTeletextStream=-1;
#endif
char file[400] = {""};
@@ -554,6 +554,7 @@ void cPlayback::FindAllPids(uint16_t *apids, unsigned short *ac3flags, uint16_t
{
printf("%s:%s\n", FILENAME, __FUNCTION__);
#ifdef MARTII
int max_numpida = *numpida;
*numpida = 0;
#endif
if(player && player->manager && player->manager->audio) {
@@ -564,6 +565,9 @@ 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]);
#ifdef MARTII
if (j < max_numpida) {
#endif
apids[j]=j;
// atUnknown, atMPEG, atMP3, atAC3, atDTS, atAAC, atPCM, atOGG, atFLAC
if( !strncmp("A_MPEG/L3", TrackList[i+1], 9))
@@ -582,7 +586,14 @@ void cPlayback::FindAllPids(uint16_t *apids, unsigned short *ac3flags, uint16_t
ac3flags[j] = 0; //todo
else
ac3flags[j] = 0; //todo
#ifdef MARTII
language[j]=std::string(TrackList[i]);
#else
language[j]=TrackList[i];
#endif
#ifdef MARTII
}
#endif
free(TrackList[i]);
free(TrackList[i+1]);
}
@@ -595,6 +606,7 @@ void cPlayback::FindAllPids(uint16_t *apids, unsigned short *ac3flags, uint16_t
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;
@@ -604,9 +616,10 @@ void cPlayback::FindAllSubtitlePids(uint16_t *pids, uint16_t *numpids, std::stri
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) {
pids[j]=j;
// atUnknown, atMPEG, atMP3, atAC3, atDTS, atAAC, atPCM, atOGG, atFLAC
language[j]=TrackList[i];
language[j]=std::string(TrackList[i]);
}
free(TrackList[i]);
free(TrackList[i+1]);
}
@@ -619,6 +632,7 @@ void cPlayback::FindAllSubtitlePids(uint16_t *pids, uint16_t *numpids, std::stri
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;
@@ -628,9 +642,10 @@ void cPlayback::FindAllDvbsubtitlePids(uint16_t *pids, uint16_t *numpids, std::s
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) {
pids[j]=j;
// atUnknown, atMPEG, atMP3, atAC3, atDTS, atAAC, atPCM, atOGG, atFLAC
language[j]=TrackList[i];
language[j]=std::string(TrackList[i]);
}
free(TrackList[i]);
free(TrackList[i+1]);
}
@@ -643,6 +658,7 @@ void cPlayback::FindAllDvbsubtitlePids(uint16_t *pids, uint16_t *numpids, std::s
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;
@@ -653,22 +669,52 @@ void cPlayback::FindAllTeletextsubtitlePids(uint16_t *pids, uint16_t *numpids, s
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) {
if (1 != sscanf(TrackList[i], "%*d %*s %d %*d %*d", &type))
continue;
if (type != 2 && type != 5) // return subtitles only
continue;
pids[j]=j;
// atUnknown, atMPEG, atMP3, atAC3, atDTS, atAAC, atPCM, atOGG, atFLAC
language[j]=TrackList[i];
language[j]=std::string(TrackList[i]);
j++;
}
free(TrackList[i]);
free(TrackList[i+1]);
j++;
}
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
//

View File

@@ -46,7 +46,7 @@ class cPlayback
unsigned short GetAPid(void) { return mAudioStream; }
unsigned short GetSubtitlePid(void) { return mSubtitleStream; }
unsigned short GetDvbsubtitlePid(void) { return mDvbsubtitleStream; }
unsigned short GetTeletextPid(void) { return mTeletextStream; }
unsigned short GetTeletextPid(void);
void SuspendSubtitle(bool);
#endif
bool SetSpeed(int speed);