mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-libstb-hal.git
synced 2025-08-26 23:12:44 +02:00
formatting code using astyle
Origin commit data
------------------
Branch: master
Commit: bc17c13de4
Author: vanhofen <vanhofen@gmx.de>
Date: 2021-05-17 (Mon, 17 May 2021)
Origin message was:
------------------
- formatting code using astyle
------------------
No further description and justification available within origin commit message!
------------------
This commit was generated by Migit
This commit is contained in:
@@ -32,8 +32,8 @@
|
||||
|
||||
static const char *FILENAME = "eplayer/player.cpp";
|
||||
|
||||
#define cMaxSpeed_ff 128 /* fixme: revise */
|
||||
#define cMaxSpeed_fr -320 /* fixme: revise */
|
||||
#define cMaxSpeed_ff 128 /* fixme: revise */
|
||||
#define cMaxSpeed_fr -320 /* fixme: revise */
|
||||
|
||||
Player::Player()
|
||||
{
|
||||
@@ -75,16 +75,23 @@ bool Player::Open(const char *Url, bool _noprobe, std::string headers)
|
||||
|
||||
manager.clearTracks();
|
||||
|
||||
if (!strncmp("mms://", Url, 6)) {
|
||||
if (!strncmp("mms://", Url, 6))
|
||||
{
|
||||
url = "mmst";
|
||||
url += Url + 3;
|
||||
isHttp = true;
|
||||
} else if (strstr(Url, "://")) {
|
||||
}
|
||||
else if (strstr(Url, "://"))
|
||||
{
|
||||
url = Url;
|
||||
isHttp = strncmp("file://", Url, 7);
|
||||
} else if (!strncmp(Url, "bluray:/", 8)) {
|
||||
}
|
||||
else if (!strncmp(Url, "bluray:/", 8))
|
||||
{
|
||||
url = Url;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "%s %s %d: Unknown stream (%s)\n", FILENAME, __func__, __LINE__, Url);
|
||||
return false;
|
||||
}
|
||||
@@ -109,37 +116,46 @@ bool Player::Play()
|
||||
{
|
||||
bool ret = true;
|
||||
|
||||
if (!isPlaying) {
|
||||
if (!isPlaying)
|
||||
{
|
||||
output.AVSync(true);
|
||||
|
||||
ret = output.Play();
|
||||
|
||||
if (ret) {
|
||||
if (ret)
|
||||
{
|
||||
isPlaying = true;
|
||||
isPaused = false;
|
||||
isForwarding = false;
|
||||
if (isBackWard) {
|
||||
if (isBackWard)
|
||||
{
|
||||
isBackWard = false;
|
||||
output.Mute(false);
|
||||
}
|
||||
isSlowMotion = false;
|
||||
Speed = 1;
|
||||
|
||||
if (!hasThreadStarted) {
|
||||
if (!hasThreadStarted)
|
||||
{
|
||||
int err = pthread_create(&playThread, NULL, playthread, this);
|
||||
|
||||
if (err) {
|
||||
if (err)
|
||||
{
|
||||
fprintf(stderr, "%s %s %d: pthread_create: %d (%s)\n", FILENAME, __func__, __LINE__, err, strerror(err));
|
||||
ret = false;
|
||||
isPlaying = false;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
pthread_detach(playThread);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
fprintf(stderr,"playback already running\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "playback already running\n");
|
||||
ret = false;
|
||||
}
|
||||
return ret;
|
||||
@@ -149,7 +165,8 @@ bool Player::Pause()
|
||||
{
|
||||
bool ret = true;
|
||||
|
||||
if (isPlaying && !isPaused) {
|
||||
if (isPlaying && !isPaused)
|
||||
{
|
||||
|
||||
if (isSlowMotion)
|
||||
output.Clear();
|
||||
@@ -159,14 +176,17 @@ bool Player::Pause()
|
||||
isPaused = true;
|
||||
//isPlaying = 1;
|
||||
isForwarding = false;
|
||||
if (isBackWard) {
|
||||
if (isBackWard)
|
||||
{
|
||||
isBackWard = false;
|
||||
output.Mute(false);
|
||||
}
|
||||
isSlowMotion = false;
|
||||
Speed = 1;
|
||||
} else {
|
||||
fprintf(stderr,"playback not playing or already in pause mode\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "playback not playing or already in pause mode\n");
|
||||
ret = false;
|
||||
}
|
||||
return ret;
|
||||
@@ -176,7 +196,8 @@ bool Player::Continue()
|
||||
{
|
||||
int ret = true;
|
||||
|
||||
if (isPlaying && (isPaused || isForwarding || isBackWard || isSlowMotion)) {
|
||||
if (isPlaying && (isPaused || isForwarding || isBackWard || isSlowMotion))
|
||||
{
|
||||
|
||||
if (isSlowMotion)
|
||||
output.Clear();
|
||||
@@ -186,14 +207,17 @@ bool Player::Continue()
|
||||
isPaused = false;
|
||||
//isPlaying = 1;
|
||||
isForwarding = false;
|
||||
if (isBackWard) {
|
||||
if (isBackWard)
|
||||
{
|
||||
isBackWard = false;
|
||||
output.Mute(false);
|
||||
}
|
||||
isSlowMotion = false;
|
||||
Speed = 1;
|
||||
} else {
|
||||
fprintf(stderr,"continue not possible\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "continue not possible\n");
|
||||
ret = false;
|
||||
}
|
||||
|
||||
@@ -204,11 +228,13 @@ bool Player::Stop()
|
||||
{
|
||||
bool ret = true;
|
||||
|
||||
if (isPlaying) {
|
||||
if (isPlaying)
|
||||
{
|
||||
isPaused = false;
|
||||
isPlaying = false;
|
||||
isForwarding = false;
|
||||
if (isBackWard) {
|
||||
if (isBackWard)
|
||||
{
|
||||
isBackWard = false;
|
||||
output.Mute(false);
|
||||
}
|
||||
@@ -218,8 +244,10 @@ bool Player::Stop()
|
||||
output.Stop();
|
||||
input.Stop();
|
||||
|
||||
} else {
|
||||
fprintf(stderr,"stop not possible\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "stop not possible\n");
|
||||
ret = false;
|
||||
}
|
||||
|
||||
@@ -234,9 +262,11 @@ bool Player::FastForward(int speed)
|
||||
int ret = true;
|
||||
|
||||
/* Audio only forwarding not supported */
|
||||
if (input.videoTrack && !isHttp && !isBackWard && (!isPaused || isPlaying)) {
|
||||
if (input.videoTrack && !isHttp && !isBackWard && (!isPaused || isPlaying))
|
||||
{
|
||||
|
||||
if ((speed <= 0) || (speed > cMaxSpeed_ff)) {
|
||||
if ((speed <= 0) || (speed > cMaxSpeed_ff))
|
||||
{
|
||||
fprintf(stderr, "speed %d out of range (1 - %d) \n", speed, cMaxSpeed_ff);
|
||||
return false;
|
||||
}
|
||||
@@ -244,8 +274,10 @@ bool Player::FastForward(int speed)
|
||||
isForwarding = 1;
|
||||
Speed = speed;
|
||||
output.FastForward(speed);
|
||||
} else {
|
||||
fprintf(stderr,"fast forward not possible\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "fast forward not possible\n");
|
||||
ret = false;
|
||||
}
|
||||
|
||||
@@ -257,32 +289,40 @@ bool Player::FastBackward(int speed)
|
||||
bool ret = true;
|
||||
|
||||
/* Audio only reverse play not supported */
|
||||
if (input.videoTrack && !isForwarding && (!isPaused || isPlaying)) {
|
||||
if (input.videoTrack && !isForwarding && (!isPaused || isPlaying))
|
||||
{
|
||||
|
||||
if ((speed > 0) || (speed < cMaxSpeed_fr)) {
|
||||
if ((speed > 0) || (speed < cMaxSpeed_fr))
|
||||
{
|
||||
fprintf(stderr, "speed %d out of range (0 - %d) \n", speed, cMaxSpeed_fr);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (speed == 0) {
|
||||
if (speed == 0)
|
||||
{
|
||||
isBackWard = false;
|
||||
Speed = 0; /* reverse end */
|
||||
} else {
|
||||
Speed = 0; /* reverse end */
|
||||
}
|
||||
else
|
||||
{
|
||||
Speed = speed;
|
||||
isBackWard = true;
|
||||
}
|
||||
|
||||
output.Clear();
|
||||
#if 0
|
||||
if (output->Command(player, OUTPUT_REVERSE, NULL) < 0) {
|
||||
fprintf(stderr,"OUTPUT_REVERSE failed\n");
|
||||
if (output->Command(player, OUTPUT_REVERSE, NULL) < 0)
|
||||
{
|
||||
fprintf(stderr, "OUTPUT_REVERSE failed\n");
|
||||
isBackWard = false;
|
||||
Speed = 1;
|
||||
ret = false;
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
fprintf(stderr,"fast backward not possible\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "fast backward not possible\n");
|
||||
ret = false;
|
||||
}
|
||||
|
||||
@@ -294,11 +334,13 @@ bool Player::FastBackward(int speed)
|
||||
|
||||
bool Player::SlowMotion(int repeats)
|
||||
{
|
||||
if (input.videoTrack && !isHttp && isPlaying) {
|
||||
if (input.videoTrack && !isHttp && isPlaying)
|
||||
{
|
||||
if (isPaused)
|
||||
Continue();
|
||||
|
||||
switch (repeats) {
|
||||
switch (repeats)
|
||||
{
|
||||
case 2:
|
||||
case 4:
|
||||
case 8:
|
||||
@@ -318,7 +360,7 @@ bool Player::SlowMotion(int repeats)
|
||||
bool Player::Seek(int64_t pos, bool absolute)
|
||||
{
|
||||
if (GetVideoPid())
|
||||
/* Don't Clear if no video track */
|
||||
/* Don't Clear if no video track */
|
||||
output.Clear();
|
||||
return input.Seek(pos, absolute);
|
||||
}
|
||||
@@ -375,8 +417,9 @@ bool Player::GetChapters(std::vector<int> &positions, std::vector<std::string> &
|
||||
titles.clear();
|
||||
input.UpdateTracks();
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> m_lock(chapterMutex);
|
||||
for (std::vector<Chapter>::iterator it = chapters.begin(); it != chapters.end(); ++it) {
|
||||
positions.push_back(it->start/1000);
|
||||
for (std::vector<Chapter>::iterator it = chapters.begin(); it != chapters.end(); ++it)
|
||||
{
|
||||
positions.push_back(it->start / 1000);
|
||||
titles.push_back(it->title);
|
||||
}
|
||||
return true;
|
||||
@@ -427,7 +470,8 @@ bool Player::GetPrograms(std::vector<std::string> &keys, std::vector<std::string
|
||||
if (p.empty())
|
||||
return false;
|
||||
|
||||
for (std::vector<Program>::iterator it = p.begin(); it != p.end(); ++it) {
|
||||
for (std::vector<Program>::iterator it = p.begin(); it != p.end(); ++it)
|
||||
{
|
||||
std::stringstream s;
|
||||
s << it->id;
|
||||
keys.push_back(s.str());
|
||||
|
Reference in New Issue
Block a user