libeplayer3 cleanup

Origin commit data
------------------
Branch: master
Commit: ad36db9281
Author: martii <m4rtii@gmx.de>
Date: 2013-07-14 (Sun, 14 Jul 2013)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
martii
2013-07-14 14:55:48 +02:00
parent 3a9e1a77da
commit 8bdb757351
2 changed files with 24 additions and 9 deletions

View File

@@ -131,15 +131,29 @@ static int container_ffmpeg_seek_rel(Context_t *context, off_t pos, long long in
/* MISC Functions */ /* 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); ffmpeg_printf(100, "::%d requesting mutex\n", line);
if (!mutexInitialized)
initMutex();
pthread_mutex_lock(&mutex); pthread_mutex_lock(&mutex);
ffmpeg_printf(100, "::%d received mutex\n", line); 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); pthread_mutex_unlock(&mutex);
ffmpeg_printf(100, "::%d released mutex\n", line); ffmpeg_printf(100, "::%d released mutex\n", line);
@@ -400,9 +414,10 @@ static void FFMPEGThread(Context_t *context) {
bofcount = 1; bofcount = 1;
} }
} }
} }
getMutex(FILENAME, __FUNCTION__,__LINE__);
if (do_seek_target_seconds || do_seek_target_bytes) { if (do_seek_target_seconds || do_seek_target_bytes) {
if (do_seek_target_seconds) { if (do_seek_target_seconds) {
float seek_target_seconds_min = seek_target_seconds - 15 * AV_TIME_BASE; 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"); context->output->Command(context, OUTPUT_AUDIOMUTE, "0");
} }
getMutex(FILENAME, __FUNCTION__,__LINE__);
if (av_read_frame(avContext, &packet) == 0 ) if (av_read_frame(avContext, &packet) == 0 )
{ {
long long int pts; long long int pts;

View File

@@ -712,10 +712,12 @@ int LinuxDvbPts(Context_t *context __attribute__((unused)), unsigned long long
else else
linuxdvb_err("VIDEO_GET_PTS: %d (%s)\n", errno, strerror(errno)); 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)) if (ret != cERR_LINUXDVB_NO_ERROR) {
if (audiofd > -1 && !ioctl(audiofd, AUDIO_GET_PTS, (void*)&sCURRENT_PTS))
ret = cERR_LINUXDVB_NO_ERROR; ret = cERR_LINUXDVB_NO_ERROR;
else else
linuxdvb_err("AUDIO_GET_PTS: %d (%s)\n", errno, strerror(errno)); linuxdvb_err("AUDIO_GET_PTS: %d (%s)\n", errno, strerror(errno));
}
if (ret != cERR_LINUXDVB_NO_ERROR) if (ret != cERR_LINUXDVB_NO_ERROR)
sCURRENT_PTS = 0; sCURRENT_PTS = 0;