mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-libstb-hal.git
synced 2025-08-26 23:12:44 +02:00
libeplayer3: extend API
Origin commit data
------------------
Branch: master
Commit: b6a2310df6
Author: martii <m4rtii@gmx.de>
Date: 2014-04-09 (Wed, 09 Apr 2014)
------------------
No further description and justification available within origin commit message!
------------------
This commit was generated by Migit
This commit is contained in:
@@ -4,8 +4,8 @@ AM_CPPFLAGS = -I$(srcdir)/include
|
|||||||
AM_CPPFLAGS += -Wall
|
AM_CPPFLAGS += -Wall
|
||||||
AM_CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE
|
AM_CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE
|
||||||
AM_CPPFLAGS += -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS
|
AM_CPPFLAGS += -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS
|
||||||
AM_CPPFLAGS += -fno-rtti
|
#AM_CPPFLAGS += -fno-rtti
|
||||||
#AM_CPPFLAGS += -ggdb
|
AM_CPPFLAGS += -ggdb
|
||||||
|
|
||||||
libeplayer3_la_SOURCES = \
|
libeplayer3_la_SOURCES = \
|
||||||
input.cpp output.cpp manager.cpp player.cpp \
|
input.cpp output.cpp manager.cpp player.cpp \
|
||||||
|
@@ -56,7 +56,6 @@ class Input
|
|||||||
float seek_sec_abs;
|
float seek_sec_abs;
|
||||||
float seek_sec_rel;
|
float seek_sec_rel;
|
||||||
bool isContainerRunning;
|
bool isContainerRunning;
|
||||||
bool terminating;
|
|
||||||
bool abortPlayback;
|
bool abortPlayback;
|
||||||
|
|
||||||
Player *player;
|
Player *player;
|
||||||
|
@@ -90,6 +90,11 @@ class Player {
|
|||||||
bool SwitchTeletext(int pid);
|
bool SwitchTeletext(int pid);
|
||||||
bool SwitchSubtitle(int pid);
|
bool SwitchSubtitle(int pid);
|
||||||
|
|
||||||
|
int GetAudioPid();
|
||||||
|
int GetVideoPid();
|
||||||
|
int GetSubtitlePid();
|
||||||
|
int GetTeletextPid();
|
||||||
|
|
||||||
bool GetPts(int64_t &pts);
|
bool GetPts(int64_t &pts);
|
||||||
bool GetFrameCount(int64_t &framecount);
|
bool GetFrameCount(int64_t &framecount);
|
||||||
bool GetDuration(double &duration);
|
bool GetDuration(double &duration);
|
||||||
@@ -98,6 +103,7 @@ class Player {
|
|||||||
bool SlowMotion(int repeats);
|
bool SlowMotion(int repeats);
|
||||||
bool FastBackward(int speed);
|
bool FastBackward(int speed);
|
||||||
bool FastForward(int speed);
|
bool FastForward(int speed);
|
||||||
|
|
||||||
bool Open(const char *Url, bool noprobe = false);
|
bool Open(const char *Url, bool noprobe = false);
|
||||||
bool Close();
|
bool Close();
|
||||||
bool Play();
|
bool Play();
|
||||||
|
@@ -49,7 +49,7 @@ Input::Input()
|
|||||||
hasPlayThreadStarted = 0;
|
hasPlayThreadStarted = 0;
|
||||||
seek_sec_abs = -1.0;
|
seek_sec_abs = -1.0;
|
||||||
seek_sec_rel = 0.0;
|
seek_sec_rel = 0.0;
|
||||||
terminating = false;
|
abortPlayback = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Input::~Input()
|
Input::~Input()
|
||||||
@@ -377,8 +377,6 @@ bool Input::Init(const char *filename)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
terminating = false;
|
|
||||||
|
|
||||||
bool res = UpdateTracks();
|
bool res = UpdateTracks();
|
||||||
|
|
||||||
if (!videoTrack && !audioTrack) {
|
if (!videoTrack && !audioTrack) {
|
||||||
@@ -398,19 +396,15 @@ bool Input::Init(const char *filename)
|
|||||||
|
|
||||||
bool Input::UpdateTracks()
|
bool Input::UpdateTracks()
|
||||||
{
|
{
|
||||||
if (terminating)
|
if (abortPlayback)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
std::vector<Chapter> chapters;
|
std::vector<Chapter> chapters;
|
||||||
for (unsigned int i = 0; i < avfc->nb_chapters; i++) {
|
for (unsigned int i = 0; i < avfc->nb_chapters; i++) {
|
||||||
AVDictionaryEntry *title = av_dict_get(avfc->metadata, "title", NULL, 0);
|
|
||||||
if (!title)
|
|
||||||
continue;
|
|
||||||
AVChapter *ch = avfc->chapters[i];
|
AVChapter *ch = avfc->chapters[i];
|
||||||
if (!ch)
|
AVDictionaryEntry* title = av_dict_get(ch->metadata, "title", NULL, 0);
|
||||||
continue;
|
|
||||||
Chapter chapter;
|
Chapter chapter;
|
||||||
chapter.title = title ? title->value : "?";
|
chapter.title = title ? title->value : "";
|
||||||
chapter.start = (double) ch->start * av_q2d(ch->time_base) * 1000.0;
|
chapter.start = (double) ch->start * av_q2d(ch->time_base) * 1000.0;
|
||||||
chapter.end = (double) ch->end * av_q2d(ch->time_base) * 1000.0;
|
chapter.end = (double) ch->end * av_q2d(ch->time_base) * 1000.0;
|
||||||
chapters.push_back(chapter);
|
chapters.push_back(chapter);
|
||||||
@@ -496,11 +490,12 @@ bool Input::UpdateTracks()
|
|||||||
stream->codec->codec = avcodec_find_decoder(stream->codec->codec_id);
|
stream->codec->codec = avcodec_find_decoder(stream->codec->codec_id);
|
||||||
if (!stream->codec->codec)
|
if (!stream->codec->codec)
|
||||||
fprintf(stderr, "avcodec_find_decoder failed for subtitle track %d\n", n);
|
fprintf(stderr, "avcodec_find_decoder failed for subtitle track %d\n", n);
|
||||||
else if (avcodec_open2(stream->codec, stream->codec->codec, NULL)) {
|
else {
|
||||||
fprintf(stderr, "avcodec_open2 failed for subtitle track %d\n", n);
|
int err = avcodec_open2(stream->codec, stream->codec->codec, NULL);
|
||||||
stream->codec->codec = NULL;
|
if (averror(err, avcodec_open2))
|
||||||
|
stream->codec->codec = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (stream->codec->codec)
|
if (stream->codec->codec)
|
||||||
player->manager.addSubtitleTrack(track);
|
player->manager.addSubtitleTrack(track);
|
||||||
}
|
}
|
||||||
@@ -522,8 +517,6 @@ bool Input::Stop()
|
|||||||
while (hasPlayThreadStarted != 0)
|
while (hasPlayThreadStarted != 0)
|
||||||
usleep(100000);
|
usleep(100000);
|
||||||
|
|
||||||
terminating = true;
|
|
||||||
|
|
||||||
if (avfc)
|
if (avfc)
|
||||||
avformat_close_input(&avfc);
|
avformat_close_input(&avfc);
|
||||||
|
|
||||||
|
@@ -156,5 +156,5 @@ void Manager::clearTracks()
|
|||||||
|
|
||||||
Manager::~Manager()
|
Manager::~Manager()
|
||||||
{
|
{
|
||||||
clearTracks();
|
clearTracks();
|
||||||
}
|
}
|
||||||
|
@@ -38,6 +38,13 @@ Player::Player()
|
|||||||
output.player = this;
|
output.player = this;
|
||||||
manager.player = this;
|
manager.player = this;
|
||||||
hasThreadStarted = false;
|
hasThreadStarted = false;
|
||||||
|
|
||||||
|
isPaused = false;
|
||||||
|
isPlaying = false;
|
||||||
|
isForwarding = false;
|
||||||
|
isBackWard = false;
|
||||||
|
isSlowMotion = false;
|
||||||
|
Speed = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *Player::playthread(void *arg)
|
void *Player::playthread(void *arg)
|
||||||
@@ -337,25 +344,25 @@ bool Player::GetDuration(double &duration)
|
|||||||
bool Player::SwitchVideo(int pid)
|
bool Player::SwitchVideo(int pid)
|
||||||
{
|
{
|
||||||
Track *track = manager.getVideoTrack(pid);
|
Track *track = manager.getVideoTrack(pid);
|
||||||
return track && input.SwitchVideo(track);
|
return input.SwitchVideo(track);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Player::SwitchAudio(int pid)
|
bool Player::SwitchAudio(int pid)
|
||||||
{
|
{
|
||||||
Track *track = manager.getAudioTrack(pid);
|
Track *track = manager.getAudioTrack(pid);
|
||||||
return track && input.SwitchAudio(track);
|
return input.SwitchAudio(track);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Player::SwitchSubtitle(int pid)
|
bool Player::SwitchSubtitle(int pid)
|
||||||
{
|
{
|
||||||
Track *track = manager.getSubtitleTrack(pid);
|
Track *track = manager.getSubtitleTrack(pid);
|
||||||
return track && input.SwitchSubtitle(track);
|
return input.SwitchSubtitle(track);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Player::SwitchTeletext(int pid)
|
bool Player::SwitchTeletext(int pid)
|
||||||
{
|
{
|
||||||
Track *track = manager.getTeletextTrack(pid);
|
Track *track = manager.getTeletextTrack(pid);
|
||||||
return track && input.SwitchTeletext(track);
|
return input.SwitchTeletext(track);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Player::GetMetadata(std::vector<std::string> &keys, std::vector<std::string> &values)
|
bool Player::GetMetadata(std::vector<std::string> &keys, std::vector<std::string> &values)
|
||||||
@@ -386,3 +393,35 @@ void Player::RequestAbort()
|
|||||||
{
|
{
|
||||||
abortRequested = true;
|
abortRequested = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Player::GetVideoPid()
|
||||||
|
{
|
||||||
|
Track *track = input.videoTrack;
|
||||||
|
if (track)
|
||||||
|
return track->pid;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int Player::GetAudioPid()
|
||||||
|
{
|
||||||
|
Track *track = input.audioTrack;
|
||||||
|
if (track)
|
||||||
|
return track->pid;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int Player::GetSubtitlePid()
|
||||||
|
{
|
||||||
|
Track *track = input.subtitleTrack;
|
||||||
|
if (track)
|
||||||
|
return track->pid;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int Player::GetTeletextPid()
|
||||||
|
{
|
||||||
|
Track *track = input.teletextTrack;
|
||||||
|
if (track)
|
||||||
|
return track->pid;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
@@ -11,18 +11,8 @@
|
|||||||
|
|
||||||
#include "playback_libeplayer3.h"
|
#include "playback_libeplayer3.h"
|
||||||
|
|
||||||
static Player *player = NULL;
|
|
||||||
|
|
||||||
extern cAudio *audioDecoder;
|
extern cAudio *audioDecoder;
|
||||||
extern cVideo *videoDecoder;
|
extern cVideo *videoDecoder;
|
||||||
static bool decoders_closed = false;
|
|
||||||
|
|
||||||
static const char * FILENAME = "playback_libeplayer3.cpp";
|
|
||||||
static playmode_t pm;
|
|
||||||
static std::string fn_ts;
|
|
||||||
static std::string fn_xml;
|
|
||||||
static off_t last_size;
|
|
||||||
static int init_jump;
|
|
||||||
|
|
||||||
//Used by Fileplay
|
//Used by Fileplay
|
||||||
bool cPlayback::Open(playmode_t PlayMode)
|
bool cPlayback::Open(playmode_t PlayMode)
|
||||||
@@ -32,14 +22,13 @@ bool cPlayback::Open(playmode_t PlayMode)
|
|||||||
"PLAYMODE_FILE"
|
"PLAYMODE_FILE"
|
||||||
};
|
};
|
||||||
|
|
||||||
if (PlayMode != PLAYMODE_TS)
|
if (PlayMode != PLAYMODE_TS) {
|
||||||
{
|
|
||||||
audioDecoder->closeDevice();
|
audioDecoder->closeDevice();
|
||||||
videoDecoder->closeDevice();
|
videoDecoder->closeDevice();
|
||||||
decoders_closed = true;
|
decoders_closed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("%s:%s - PlayMode=%s\n", FILENAME, __FUNCTION__, aPLAYMODE[PlayMode]);
|
printf("%s:%s - PlayMode=%s\n", __FILE__, __func__, aPLAYMODE[PlayMode]);
|
||||||
pm = PlayMode;
|
pm = PlayMode;
|
||||||
fn_ts = "";
|
fn_ts = "";
|
||||||
fn_xml = "";
|
fn_xml = "";
|
||||||
@@ -53,7 +42,7 @@ bool cPlayback::Open(playmode_t PlayMode)
|
|||||||
//Used by Fileplay
|
//Used by Fileplay
|
||||||
void cPlayback::Close(void)
|
void cPlayback::Close(void)
|
||||||
{
|
{
|
||||||
printf("%s:%s\n", FILENAME, __FUNCTION__);
|
printf("%s:%s\n", __FILE__, __func__);
|
||||||
|
|
||||||
//Dagobert: movieplayer does not call stop, it calls close ;)
|
//Dagobert: movieplayer does not call stop, it calls close ;)
|
||||||
Stop();
|
Stop();
|
||||||
@@ -66,19 +55,16 @@ void cPlayback::Close(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Used by Fileplay
|
//Used by Fileplay
|
||||||
bool cPlayback::Start(char *filename, int vpid, int vtype, int apid, int ac3, unsigned int, bool no_probe)
|
bool cPlayback::Start(char *filename, int vpid, int vtype, int apid, int ac3, unsigned int)
|
||||||
{
|
{
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
bool isHTTP = false;
|
bool isHTTP = false;
|
||||||
|
no_probe = false;
|
||||||
|
|
||||||
printf("%s:%s - filename=%s vpid=%u vtype=%d apid=%u ac3=%d, no_probe=%d\n",
|
printf("%s:%s - filename=%s vpid=%u vtype=%d apid=%u ac3=%d, no_probe=%d\n",
|
||||||
FILENAME, __FUNCTION__, filename, vpid, vtype, apid, ac3, no_probe);
|
__FILE__, __func__, filename, vpid, vtype, apid, ac3, no_probe);
|
||||||
|
|
||||||
init_jump = -1;
|
init_jump = -1;
|
||||||
//create playback path
|
|
||||||
mAudioStream=0;
|
|
||||||
mSubtitleStream=-1;
|
|
||||||
mTeletextStream=-1;
|
|
||||||
|
|
||||||
//try to open file
|
//try to open file
|
||||||
if(player && player->Open(filename, no_probe)) {
|
if(player && player->Open(filename, no_probe)) {
|
||||||
@@ -110,11 +96,13 @@ bool cPlayback::Start(char *filename, int vpid, int vtype, int apid, int ac3, un
|
|||||||
playing = true;
|
playing = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("%s:%s - return=%d\n", FILENAME, __FUNCTION__, ret);
|
printf("%s:%s - return=%d\n", __FILE__, __func__, ret);
|
||||||
|
|
||||||
fn_ts = std::string(filename);
|
fn_ts = std::string(filename);
|
||||||
if (fn_ts.rfind(".ts") == fn_ts.length() - 3)
|
if (fn_ts.length() > 3 && fn_ts.rfind(".ts") == fn_ts.length() - 3) {
|
||||||
fn_xml = fn_ts.substr(0, fn_ts.length() - 3) + ".xml";
|
fn_xml = fn_ts.substr(0, fn_ts.length() - 3) + ".xml";
|
||||||
|
no_probe = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (pm == PLAYMODE_TS) {
|
if (pm == PLAYMODE_TS) {
|
||||||
struct stat s;
|
struct stat s;
|
||||||
@@ -132,7 +120,7 @@ bool cPlayback::Start(char *filename, int vpid, int vtype, int apid, int ac3, un
|
|||||||
//Used by Fileplay
|
//Used by Fileplay
|
||||||
bool cPlayback::Stop(void)
|
bool cPlayback::Stop(void)
|
||||||
{
|
{
|
||||||
printf("%s:%s playing %d\n", FILENAME, __FUNCTION__, playing);
|
printf("%s:%s playing %d\n", __FILE__, __func__, playing);
|
||||||
//if(playing==false) return false;
|
//if(playing==false) return false;
|
||||||
|
|
||||||
player->Stop();
|
player->Stop();
|
||||||
@@ -143,39 +131,24 @@ bool cPlayback::Stop(void)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cPlayback::SetAPid(int pid, bool ac3 __attribute__((unused)))
|
bool cPlayback::SetAPid(int pid, bool /* ac3 */)
|
||||||
{
|
{
|
||||||
printf("%s:%s\n", FILENAME, __FUNCTION__);
|
return player->SwitchAudio(pid);
|
||||||
if(pid!=mAudioStream){
|
|
||||||
player->SwitchAudio(pid);
|
|
||||||
mAudioStream=pid;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cPlayback::SetSubtitlePid(int pid)
|
bool cPlayback::SetSubtitlePid(int pid)
|
||||||
{
|
{
|
||||||
printf("%s:%s\n", FILENAME, __FUNCTION__);
|
return player->SwitchSubtitle(pid);
|
||||||
if(pid!=mSubtitleStream){
|
|
||||||
player->SwitchSubtitle(pid);
|
|
||||||
mSubtitleStream = pid;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cPlayback::SetTeletextPid(int pid)
|
bool cPlayback::SetTeletextPid(int pid)
|
||||||
{
|
{
|
||||||
printf("%s:%s\n", FILENAME, __FUNCTION__);
|
return player->SwitchTeletext(pid);
|
||||||
if(pid!=mTeletextStream){
|
|
||||||
player->SwitchTeletext(pid);
|
|
||||||
mTeletextStream=pid;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cPlayback::SetSpeed(int speed)
|
bool cPlayback::SetSpeed(int speed)
|
||||||
{
|
{
|
||||||
printf("%s:%s playing %d speed %d\n", FILENAME, __FUNCTION__, playing, speed);
|
printf("%s:%s playing %d speed %d\n", __FILE__, __func__, playing, speed);
|
||||||
|
|
||||||
if (! decoders_closed)
|
if (! decoders_closed)
|
||||||
{
|
{
|
||||||
@@ -230,7 +203,6 @@ bool cPlayback::SetSpeed(int speed)
|
|||||||
|
|
||||||
bool cPlayback::GetSpeed(int &speed) const
|
bool cPlayback::GetSpeed(int &speed) const
|
||||||
{
|
{
|
||||||
//printf("%s:%s\n", FILENAME, __FUNCTION__);
|
|
||||||
speed = nPlaybackSpeed;
|
speed = nPlaybackSpeed;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -247,8 +219,7 @@ bool cPlayback::GetPosition(int &position, int &duration)
|
|||||||
|
|
||||||
/* hack: if the file is growing (timeshift), then determine its length
|
/* hack: if the file is growing (timeshift), then determine its length
|
||||||
* by comparing the mtime with the mtime of the xml file */
|
* by comparing the mtime with the mtime of the xml file */
|
||||||
if (pm == PLAYMODE_TS)
|
if (pm == PLAYMODE_TS) {
|
||||||
{
|
|
||||||
struct stat s;
|
struct stat s;
|
||||||
if (!stat(fn_ts.c_str(), &s))
|
if (!stat(fn_ts.c_str(), &s))
|
||||||
{
|
{
|
||||||
@@ -303,7 +274,6 @@ bool cPlayback::GetPosition(int &position, int &duration)
|
|||||||
|
|
||||||
bool cPlayback::SetPosition(int position, bool absolute)
|
bool cPlayback::SetPosition(int position, bool absolute)
|
||||||
{
|
{
|
||||||
printf("%s:%s %d\n", FILENAME, __FUNCTION__,position);
|
|
||||||
if (playing == false)
|
if (playing == false)
|
||||||
{
|
{
|
||||||
/* the calling sequence is:
|
/* the calling sequence is:
|
||||||
@@ -322,7 +292,6 @@ bool cPlayback::SetPosition(int position, bool absolute)
|
|||||||
|
|
||||||
void cPlayback::FindAllPids(int *pids, unsigned int *ac3flags, unsigned int *numpids, std::string *language)
|
void cPlayback::FindAllPids(int *pids, unsigned int *ac3flags, unsigned int *numpids, std::string *language)
|
||||||
{
|
{
|
||||||
printf("%s:%s\n", FILENAME, __FUNCTION__);
|
|
||||||
unsigned int i = 0;
|
unsigned int i = 0;
|
||||||
|
|
||||||
std::vector<Track> tracks = player->manager.getAudioTracks();
|
std::vector<Track> tracks = player->manager.getAudioTracks();
|
||||||
@@ -338,7 +307,6 @@ void cPlayback::FindAllPids(int *pids, unsigned int *ac3flags, unsigned int *num
|
|||||||
|
|
||||||
void cPlayback::FindAllSubtitlePids(int *pids, unsigned int *numpids, std::string *language)
|
void cPlayback::FindAllSubtitlePids(int *pids, unsigned int *numpids, std::string *language)
|
||||||
{
|
{
|
||||||
printf("%s:%s\n", FILENAME, __FUNCTION__);
|
|
||||||
unsigned int i = 0;
|
unsigned int i = 0;
|
||||||
|
|
||||||
std::vector<Track> tracks = player->manager.getSubtitleTracks();
|
std::vector<Track> tracks = player->manager.getSubtitleTracks();
|
||||||
@@ -351,27 +319,26 @@ void cPlayback::FindAllSubtitlePids(int *pids, unsigned int *numpids, std::strin
|
|||||||
*numpids = i;
|
*numpids = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cPlayback::FindAllTeletextsubtitlePids(int *pids, unsigned int *numpids, std::string *language)
|
void cPlayback::FindAllTeletextsubtitlePids(int *pids, unsigned int *numpids, std::string *language, int *mags, int *pages)
|
||||||
{
|
{
|
||||||
printf("%s:%s\n", FILENAME, __FUNCTION__);
|
|
||||||
unsigned int i = 0;
|
unsigned int i = 0;
|
||||||
|
|
||||||
std::vector<Track> tracks = player->manager.getTeletextTracks();
|
std::vector<Track> tracks = player->manager.getTeletextTracks();
|
||||||
for (std::vector<Track>::iterator it = tracks.begin(); it != tracks.end() && i < *numpids; ++it) {
|
for (std::vector<Track>::iterator it = tracks.begin(); it != tracks.end() && i < *numpids; ++it) {
|
||||||
pids[i] = it->pid;
|
|
||||||
if (it->type != 2 && it->type != 5) // return subtitles only
|
if (it->type != 2 && it->type != 5) // return subtitles only
|
||||||
continue;
|
continue;
|
||||||
char tmp[80];
|
pids[i] = it->pid;
|
||||||
snprintf(tmp, sizeof(tmp), "%s %d %d %d", it->Name.c_str(), it->type, it->mag, it->page);
|
language[i] = it->Name;
|
||||||
language[i] = std::string(tmp);
|
mags[i] = it->mag;
|
||||||
|
pages[i] = it->page;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
*numpids = i;
|
*numpids = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
int cPlayback::GetTeletextPid(void)
|
int cPlayback::GetFirstTeletextPid(void)
|
||||||
{
|
{
|
||||||
printf("%s:%s\n", FILENAME, __FUNCTION__);
|
|
||||||
std::vector<Track> tracks = player->manager.getTeletextTracks();
|
std::vector<Track> tracks = player->manager.getTeletextTracks();
|
||||||
for (std::vector<Track>::iterator it = tracks.begin(); it != tracks.end(); ++it) {
|
for (std::vector<Track>::iterator it = tracks.begin(); it != tracks.end(); ++it) {
|
||||||
if (it->type == 1)
|
if (it->type == 1)
|
||||||
@@ -387,21 +354,18 @@ void cPlayback::GetChapters(std::vector<int> &positions, std::vector<std::string
|
|||||||
|
|
||||||
void cPlayback::GetMetadata(std::vector<std::string> &keys, std::vector<std::string> &values)
|
void cPlayback::GetMetadata(std::vector<std::string> &keys, std::vector<std::string> &values)
|
||||||
{
|
{
|
||||||
printf("%s:%s\n", FILENAME, __FUNCTION__);
|
|
||||||
player->input.GetMetadata(keys, values);
|
player->input.GetMetadata(keys, values);
|
||||||
}
|
}
|
||||||
|
|
||||||
cPlayback::cPlayback(int num __attribute__((unused)))
|
cPlayback::cPlayback(int num __attribute__((unused)))
|
||||||
{
|
{
|
||||||
printf("%s:%s\n", FILENAME, __FUNCTION__);
|
|
||||||
playing=false;
|
playing=false;
|
||||||
|
decoders_closed = false;
|
||||||
player = new Player();
|
player = new Player();
|
||||||
}
|
}
|
||||||
|
|
||||||
cPlayback::~cPlayback()
|
cPlayback::~cPlayback()
|
||||||
{
|
{
|
||||||
printf("%s:%s\n", FILENAME, __FUNCTION__);
|
|
||||||
if(player)
|
if(player)
|
||||||
delete player;
|
delete player;
|
||||||
}
|
}
|
||||||
@@ -417,27 +381,28 @@ bool cPlayback::IsPlaying() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long long cPlayback::GetReadCount() {
|
uint64_t cPlayback::GetReadCount() {
|
||||||
if (player)
|
if (player)
|
||||||
return player->readCount;
|
return player->readCount;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
int cPlayback::GetAPid(void)
|
||||||
bool cPlayback::IsPlaying(void) const
|
|
||||||
{
|
{
|
||||||
printf("%s:%s\n", FILENAME, __FUNCTION__);
|
return player->GetAudioPid();
|
||||||
|
}
|
||||||
/* konfetti: there is no event/callback mechanism in libeplayer2
|
|
||||||
* so in case of ending playback we have no information on a
|
int cPlayback::GetVPid(void)
|
||||||
* terminated stream currently (or did I oversee it?).
|
{
|
||||||
* So let's ask the player the state.
|
return player->GetVideoPid();
|
||||||
*/
|
}
|
||||||
if (playing)
|
|
||||||
{
|
int cPlayback::GetSubtitlePid(void)
|
||||||
return player->isPlaying;
|
{
|
||||||
}
|
return player->GetSubtitlePid();
|
||||||
|
}
|
||||||
return playing;
|
|
||||||
|
int cPlayback::GetTeletextPid(void)
|
||||||
|
{
|
||||||
|
return player->GetTeletextPid();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
@@ -9,30 +9,38 @@ typedef enum {
|
|||||||
PLAYMODE_FILE
|
PLAYMODE_FILE
|
||||||
} playmode_t;
|
} playmode_t;
|
||||||
|
|
||||||
|
class Player;
|
||||||
|
|
||||||
class cPlayback
|
class cPlayback
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
bool enabled;
|
bool enabled;
|
||||||
bool playing;
|
bool playing;
|
||||||
|
bool no_probe;
|
||||||
int nPlaybackSpeed;
|
int nPlaybackSpeed;
|
||||||
int mAudioStream;
|
|
||||||
int mSubtitleStream;
|
|
||||||
int mTeletextStream;
|
|
||||||
bool Stop(void);
|
bool Stop(void);
|
||||||
|
bool decoders_closed;
|
||||||
|
playmode_t pm;
|
||||||
|
std::string fn_ts;
|
||||||
|
std::string fn_xml;
|
||||||
|
off_t last_size;
|
||||||
|
int init_jump;
|
||||||
|
Player *player;
|
||||||
public:
|
public:
|
||||||
cPlayback(int num = 0);
|
cPlayback(int num = 0);
|
||||||
~cPlayback();
|
~cPlayback();
|
||||||
|
|
||||||
bool Open(playmode_t PlayMode);
|
bool Open(playmode_t PlayMode);
|
||||||
void Close(void);
|
void Close(void);
|
||||||
bool Start(char *filename, int vpid, int vtype, int apid,
|
bool Start(char *filename, int vpid, int vtype, int apid, int ac3, unsigned int duration);
|
||||||
int ac3, unsigned int duration, bool no_probe = true);
|
|
||||||
bool SetAPid(int pid, bool ac3);
|
bool SetAPid(int pid, bool ac3);
|
||||||
bool SetSubtitlePid(int pid);
|
bool SetSubtitlePid(int pid);
|
||||||
bool SetTeletextPid(int pid);
|
bool SetTeletextPid(int pid);
|
||||||
int GetAPid(void) { return mAudioStream; }
|
int GetAPid(void);
|
||||||
int GetSubtitlePid(void) { return mSubtitleStream; }
|
int GetVPid(void);
|
||||||
|
int GetSubtitlePid(void);
|
||||||
int GetTeletextPid(void);
|
int GetTeletextPid(void);
|
||||||
|
int GetFirstTeletextPid(void);
|
||||||
bool SetSpeed(int speed);
|
bool SetSpeed(int speed);
|
||||||
bool GetSpeed(int &speed) const;
|
bool GetSpeed(int &speed) const;
|
||||||
bool GetPosition(int &position, int &duration);
|
bool GetPosition(int &position, int &duration);
|
||||||
@@ -40,10 +48,10 @@ class cPlayback
|
|||||||
bool SetPosition(int position, bool absolute = false);
|
bool SetPosition(int position, bool absolute = false);
|
||||||
void FindAllPids(int *apids, unsigned int *ac3flags, unsigned int *numpida, std::string *language);
|
void FindAllPids(int *apids, unsigned int *ac3flags, unsigned int *numpida, std::string *language);
|
||||||
void FindAllSubtitlePids(int *pids, unsigned int *numpids, std::string *language);
|
void FindAllSubtitlePids(int *pids, unsigned int *numpids, std::string *language);
|
||||||
void FindAllTeletextsubtitlePids(int *pids, unsigned int *numpidt, std::string *tlanguage);
|
void FindAllTeletextsubtitlePids(int *pids, unsigned int *numpidt, std::string *tlanguage, int *mags, int *pages);
|
||||||
void RequestAbort(void);
|
void RequestAbort(void);
|
||||||
bool IsPlaying(void);
|
bool IsPlaying(void);
|
||||||
unsigned long long GetReadCount(void);
|
uint64_t GetReadCount(void);
|
||||||
#if 0
|
#if 0
|
||||||
void FindAllSubs(uint16_t *pids, unsigned short *supported, uint16_t *numpida, std::string *language);
|
void FindAllSubs(uint16_t *pids, unsigned short *supported, uint16_t *numpida, std::string *language);
|
||||||
bool SelectSubtitles(int pid);
|
bool SelectSubtitles(int pid);
|
||||||
|
Reference in New Issue
Block a user