mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-libstb-hal.git
synced 2025-08-27 07:22:44 +02:00
azbox: handle rmfp_player failures/features more graceful
Origin commit data
------------------
Branch: master
Commit: 929acbae43
Author: Stefan Seyfried <seife@tuxbox-git.slipkontur.de>
Date: 2012-11-24 (Sat, 24 Nov 2012)
------------------
No further description and justification available within origin commit message!
------------------
This commit was generated by Migit
This commit is contained in:
@@ -184,12 +184,12 @@ void cPlayback::run_rmfp()
|
|||||||
lt_info("%s out: '%s'\n", __func__, output);
|
lt_info("%s out: '%s'\n", __func__, output);
|
||||||
if (strstr(output, "Playback has started..."))
|
if (strstr(output, "Playback has started..."))
|
||||||
{
|
{
|
||||||
playing = true;
|
playing = 1;
|
||||||
lt_info("%s: ===================> playing = true\n", __func__);
|
lt_info("%s: ===================> playing = true\n", __func__);
|
||||||
}
|
}
|
||||||
else if (strstr(output, "End of file..."))
|
else if (strstr(output, "End of file..."))
|
||||||
{
|
{
|
||||||
playing = true; /* this can happen without "Playback has started..." */
|
playing = 1; /* this can happen without "Playback has started..." */
|
||||||
eof_reached = true;
|
eof_reached = true;
|
||||||
lt_info("%s: ===================> eof_reached = true\n", __func__);
|
lt_info("%s: ===================> eof_reached = true\n", __func__);
|
||||||
}
|
}
|
||||||
@@ -202,7 +202,10 @@ void cPlayback::run_rmfp()
|
|||||||
}
|
}
|
||||||
|
|
||||||
lt_info("%s: terminating\n", __func__);
|
lt_info("%s: terminating\n", __func__);
|
||||||
playing = false;
|
if (playing == 0) /* playback did not start */
|
||||||
|
playing = 2;
|
||||||
|
else
|
||||||
|
playing = 0;
|
||||||
eof_reached = true;
|
eof_reached = true;
|
||||||
pthread_exit(NULL);
|
pthread_exit(NULL);
|
||||||
}
|
}
|
||||||
@@ -293,6 +296,8 @@ bool cPlayback::Start(char *filename, unsigned short vpid, int vtype, unsigned s
|
|||||||
}
|
}
|
||||||
while (! playing)
|
while (! playing)
|
||||||
sleep(1);
|
sleep(1);
|
||||||
|
if (playing == 2)
|
||||||
|
playing = 0;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -306,7 +311,7 @@ void cPlayback::Close(void)
|
|||||||
|
|
||||||
if (pthread_join(thread, NULL))
|
if (pthread_join(thread, NULL))
|
||||||
lt_info("%s: error joining rmfp thread (%m)\n", __func__);
|
lt_info("%s: error joining rmfp thread (%m)\n", __func__);
|
||||||
playing = false;
|
playing = 0;
|
||||||
thread_started = false;
|
thread_started = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -315,6 +320,7 @@ void cPlayback::Close(void)
|
|||||||
if (open_success)
|
if (open_success)
|
||||||
{
|
{
|
||||||
proc_put("/proc/player", "1", 2);
|
proc_put("/proc/player", "1", 2);
|
||||||
|
open_success = false;
|
||||||
lt_info("%s: /proc/player switched to '1'\n", __func__);
|
lt_info("%s: /proc/player switched to '1'\n", __func__);
|
||||||
usleep(1000000);
|
usleep(1000000);
|
||||||
}
|
}
|
||||||
@@ -394,6 +400,9 @@ bool cPlayback::GetPosition(int &position, int &duration)
|
|||||||
if (!p)
|
if (!p)
|
||||||
return false;
|
return false;
|
||||||
position = atoi(++p);
|
position = atoi(++p);
|
||||||
|
/* some mpegs return length 0... which would lead to "eof" after 10 seconds */
|
||||||
|
if (duration == 0)
|
||||||
|
duration = position + 1000;
|
||||||
|
|
||||||
if (playMode == PLAYMODE_TS)
|
if (playMode == PLAYMODE_TS)
|
||||||
{
|
{
|
||||||
@@ -490,7 +499,7 @@ void cPlayback::FindAllSPids(int *spids, uint16_t *numpids, std::string *languag
|
|||||||
cPlayback::cPlayback(int /*num*/)
|
cPlayback::cPlayback(int /*num*/)
|
||||||
{
|
{
|
||||||
lt_info("%s: constructor\n", __func__);
|
lt_info("%s: constructor\n", __func__);
|
||||||
playing = false;
|
playing = 0;
|
||||||
thread_started = false;
|
thread_started = false;
|
||||||
eof_reached = false;
|
eof_reached = false;
|
||||||
open_success = false;
|
open_success = false;
|
||||||
|
@@ -13,7 +13,7 @@ class cPlayback
|
|||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
pthread_mutex_t rmfp_cmd_mutex;
|
pthread_mutex_t rmfp_cmd_mutex;
|
||||||
bool playing;
|
int playing;
|
||||||
bool eof_reached;
|
bool eof_reached;
|
||||||
int playback_speed;
|
int playback_speed;
|
||||||
playmode_t playMode;
|
playmode_t playMode;
|
||||||
|
Reference in New Issue
Block a user