mirror of
https://github.com/tuxbox-neutrino/libstb-hal.git
synced 2025-08-27 07:23:11 +02:00
libeplayer3 cleanup
This commit is contained in:
@@ -131,15 +131,29 @@ static int container_ffmpeg_seek_rel(Context_t *context, off_t pos, long long in
|
||||
/* MISC Functions */
|
||||
/* ***************************** */
|
||||
|
||||
void getMutex(const char *filename __attribute__((unused)), const char *function __attribute__((unused)), int line) {
|
||||
static int mutexInitialized = 0;
|
||||
|
||||
static void initMutex(void)
|
||||
{
|
||||
pthread_mutexattr_t attr;
|
||||
pthread_mutexattr_init(&attr);
|
||||
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK_NP);
|
||||
pthread_mutex_init(&mutex, &attr);
|
||||
mutexInitialized = 1;
|
||||
}
|
||||
|
||||
static void getMutex(const char *filename __attribute__((unused)), const char *function __attribute__((unused)), int line) {
|
||||
ffmpeg_printf(100, "::%d requesting mutex\n", line);
|
||||
|
||||
if (!mutexInitialized)
|
||||
initMutex();
|
||||
|
||||
pthread_mutex_lock(&mutex);
|
||||
|
||||
ffmpeg_printf(100, "::%d received mutex\n", line);
|
||||
}
|
||||
|
||||
void releaseMutex(const char *filename __attribute__((unused)), const const char *function __attribute__((unused)), int line) {
|
||||
static void releaseMutex(const char *filename __attribute__((unused)), const const char *function __attribute__((unused)), int line) {
|
||||
pthread_mutex_unlock(&mutex);
|
||||
|
||||
ffmpeg_printf(100, "::%d released mutex\n", line);
|
||||
@@ -400,9 +414,10 @@ static void FFMPEGThread(Context_t *context) {
|
||||
bofcount = 1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
getMutex(FILENAME, __FUNCTION__,__LINE__);
|
||||
|
||||
if (do_seek_target_seconds || do_seek_target_bytes) {
|
||||
if (do_seek_target_seconds) {
|
||||
float seek_target_seconds_min = seek_target_seconds - 15 * AV_TIME_BASE;
|
||||
@@ -422,8 +437,6 @@ static void FFMPEGThread(Context_t *context) {
|
||||
context->output->Command(context, OUTPUT_AUDIOMUTE, "0");
|
||||
}
|
||||
|
||||
getMutex(FILENAME, __FUNCTION__,__LINE__);
|
||||
|
||||
if (av_read_frame(avContext, &packet) == 0 )
|
||||
{
|
||||
long long int pts;
|
||||
|
@@ -712,10 +712,12 @@ int LinuxDvbPts(Context_t *context __attribute__((unused)), unsigned long long
|
||||
else
|
||||
linuxdvb_err("VIDEO_GET_PTS: %d (%s)\n", errno, strerror(errno));
|
||||
|
||||
if (audiofd > -1 && ret != cERR_LINUXDVB_NO_ERROR && !ioctl(audiofd, AUDIO_GET_PTS, (void*)&sCURRENT_PTS))
|
||||
ret = cERR_LINUXDVB_NO_ERROR;
|
||||
else
|
||||
linuxdvb_err("AUDIO_GET_PTS: %d (%s)\n", errno, strerror(errno));
|
||||
if (ret != cERR_LINUXDVB_NO_ERROR) {
|
||||
if (audiofd > -1 && !ioctl(audiofd, AUDIO_GET_PTS, (void*)&sCURRENT_PTS))
|
||||
ret = cERR_LINUXDVB_NO_ERROR;
|
||||
else
|
||||
linuxdvb_err("AUDIO_GET_PTS: %d (%s)\n", errno, strerror(errno));
|
||||
}
|
||||
|
||||
if (ret != cERR_LINUXDVB_NO_ERROR)
|
||||
sCURRENT_PTS = 0;
|
||||
|
Reference in New Issue
Block a user