mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-libstb-hal.git
synced 2025-08-28 16:00:58 +02:00
libeplayer3-arm: insert original blank lines from exteplayer3.git, for better merge
Origin commit data
------------------
Branch: master
Commit: b8d7e5ead4
Author: max_10 <max_10@gmx.de>
Date: 2018-04-10 (Tue, 10 Apr 2018)
------------------
No further description and justification available within origin commit message!
------------------
This commit was generated by Migit
This commit is contained in:
@@ -50,9 +50,7 @@
|
||||
/* Makros/Constants */
|
||||
/* ***************************** */
|
||||
|
||||
// SULGE DEBUG
|
||||
//#define SAM_WITH_DEBUG
|
||||
|
||||
#ifdef SAM_WITH_DEBUG
|
||||
#define LINUXDVB_DEBUG
|
||||
static unsigned short debug_level = 20;
|
||||
@@ -64,15 +62,15 @@ static const char FILENAME[] = __FILE__;
|
||||
|
||||
#ifdef LINUXDVB_DEBUG
|
||||
#define linuxdvb_printf(level, fmt, x...) do { \
|
||||
if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x ); } while (0)
|
||||
if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define linuxdvb_printf(level, fmt, x...)
|
||||
#define linuxdvb_printf(x...)
|
||||
#endif
|
||||
|
||||
#ifndef LINUXDVB_SILENT
|
||||
#define linuxdvb_err(fmt, x...) do { printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define linuxdvb_err(fmt, x...)
|
||||
#define linuxdvb_err(x...)
|
||||
#endif
|
||||
|
||||
#define cERR_LINUXDVB_NO_ERROR 0
|
||||
@@ -108,10 +106,11 @@ int32_t LinuxDvbBuffResume(Context_t *context);
|
||||
|
||||
ssize_t BufferingWriteV(int fd, const struct iovec *iov, size_t ic);
|
||||
int32_t WriteSetBufferingSize(const uint32_t bufferSize);
|
||||
|
||||
int LinuxDvbStop(Context_t *context, char *type);
|
||||
|
||||
/* ***************************** */
|
||||
/* Functions */
|
||||
/* MISC Functions */
|
||||
/* ***************************** */
|
||||
|
||||
void getLinuxDVBMutex(const char *filename __attribute__((unused)), const char *function __attribute__((unused)), int line __attribute__((unused)))
|
||||
@@ -137,53 +136,67 @@ int LinuxDvbOpen(Context_t *context __attribute__((unused)), char *type)
|
||||
{
|
||||
uint8_t video = !strcmp("video", type);
|
||||
uint8_t audio = !strcmp("audio", type);
|
||||
|
||||
linuxdvb_printf(10, "v%d a%d\n", video, audio);
|
||||
|
||||
if (video && videofd < 0)
|
||||
{
|
||||
videofd = open(VIDEODEV, O_RDWR | O_CLOEXEC);
|
||||
|
||||
if (videofd < 0)
|
||||
{
|
||||
linuxdvb_err("failed to open %s - errno %d, %s\n", VIDEODEV, errno, strerror(errno));
|
||||
linuxdvb_err("%s\n",);
|
||||
return cERR_LINUXDVB_ERROR;
|
||||
}
|
||||
|
||||
if (ioctl(videofd, VIDEO_CLEAR_BUFFER) == -1)
|
||||
{
|
||||
linuxdvb_err("VIDEO_CLEAR_BUFFER: ERROR %d, %s\n", errno, strerror(errno));
|
||||
}
|
||||
|
||||
if (ioctl(videofd, VIDEO_SELECT_SOURCE, (void *)VIDEO_SOURCE_MEMORY) == -1)
|
||||
{
|
||||
linuxdvb_err("VIDEO_SELECT_SOURCE: ERROR %d, %s\n", errno, strerror(errno));
|
||||
}
|
||||
|
||||
if (ioctl(videofd, VIDEO_FREEZE) == -1)
|
||||
{
|
||||
linuxdvb_err("VIDEO_FREEZE: ERROR %d, %s\n", errno, strerror(errno));
|
||||
}
|
||||
|
||||
if (isBufferedOutput)
|
||||
LinuxDvbBuffOpen(context, type, videofd);
|
||||
}
|
||||
if (audio && audiofd < 0)
|
||||
{
|
||||
audiofd = open(AUDIODEV, O_RDWR | O_CLOEXEC);
|
||||
|
||||
if (audiofd < 0)
|
||||
{
|
||||
linuxdvb_err("failed to open %s - errno %d, %s\n", AUDIODEV, errno, strerror(errno));
|
||||
return cERR_LINUXDVB_ERROR;
|
||||
}
|
||||
|
||||
if (ioctl(audiofd, AUDIO_CLEAR_BUFFER) == -1)
|
||||
{
|
||||
linuxdvb_err("AUDIO_CLEAR_BUFFER: ERROR %d, %s\n", errno, strerror(errno));
|
||||
}
|
||||
|
||||
if (ioctl(audiofd, AUDIO_SELECT_SOURCE, AUDIO_SOURCE_MEMORY) == -1)
|
||||
{
|
||||
linuxdvb_err("AUDIO_SELECT_SOURCE: ERROR %d, %s\n", errno, strerror(errno));
|
||||
}
|
||||
|
||||
if (ioctl(audiofd, AUDIO_PAUSE) == -1)
|
||||
{
|
||||
linuxdvb_err("AUDIO_PAUSE: ERROR %d, %s\n", errno, strerror(errno));
|
||||
}
|
||||
|
||||
if (isBufferedOutput)
|
||||
LinuxDvbBuffOpen(context, type, audiofd);
|
||||
}
|
||||
|
||||
return cERR_LINUXDVB_NO_ERROR;
|
||||
}
|
||||
|
||||
@@ -191,15 +204,20 @@ int LinuxDvbClose(Context_t *context, char *type)
|
||||
{
|
||||
uint8_t video = !strcmp("video", type);
|
||||
uint8_t audio = !strcmp("audio", type);
|
||||
|
||||
linuxdvb_printf(10, "v%d a%d\n", video, audio);
|
||||
|
||||
/* closing stand alone is not allowed, so prevent
|
||||
* user from closing and don't call stop. stop will
|
||||
* set default values for us (speed and so on).
|
||||
*/
|
||||
LinuxDvbStop(context, type);
|
||||
|
||||
getLinuxDVBMutex(FILENAME, __FUNCTION__, __LINE__);
|
||||
|
||||
if (isBufferedOutput)
|
||||
LinuxDvbBuffClose(context);
|
||||
|
||||
if (video && videofd != -1)
|
||||
{
|
||||
close(videofd);
|
||||
@@ -210,6 +228,7 @@ int LinuxDvbClose(Context_t *context, char *type)
|
||||
close(audiofd);
|
||||
audiofd = -1;
|
||||
}
|
||||
|
||||
releaseLinuxDVBMutex(FILENAME, __FUNCTION__, __LINE__);
|
||||
return cERR_LINUXDVB_NO_ERROR;
|
||||
}
|
||||
@@ -218,14 +237,19 @@ int LinuxDvbPlay(Context_t *context, char *type)
|
||||
{
|
||||
int ret = cERR_LINUXDVB_NO_ERROR;
|
||||
Writer_t *writer;
|
||||
|
||||
uint8_t video = !strcmp("video", type);
|
||||
uint8_t audio = !strcmp("audio", type);
|
||||
|
||||
linuxdvb_printf(10, "v%d a%d\n", video, audio);
|
||||
|
||||
if (video && videofd != -1)
|
||||
{
|
||||
char *Encoding = NULL;
|
||||
context->manager->video->Command(context, MANAGER_GETENCODING, &Encoding);
|
||||
|
||||
linuxdvb_printf(10, "V %s\n", Encoding);
|
||||
|
||||
writer = getWriter(Encoding);
|
||||
if (writer == NULL)
|
||||
{
|
||||
@@ -242,15 +266,18 @@ int LinuxDvbPlay(Context_t *context, char *type)
|
||||
}
|
||||
}
|
||||
free(Encoding);
|
||||
|
||||
if (0 != ioctl(videofd, VIDEO_PLAY))
|
||||
{
|
||||
linuxdvb_err("VIDEO_PLAY: ERROR %d, %s\n", errno, strerror(errno));
|
||||
ret = cERR_LINUXDVB_ERROR;
|
||||
}
|
||||
|
||||
if (ioctl(videofd, VIDEO_CONTINUE) == -1)
|
||||
{
|
||||
linuxdvb_err("VIDEO_CONTINUE: ERROR %d, %s\n", errno, strerror(errno));
|
||||
}
|
||||
|
||||
if (ioctl(videofd, VIDEO_CLEAR_BUFFER) == -1)
|
||||
{
|
||||
linuxdvb_err("VIDEO_CLEAR_BUFFER: ERROR %d, %s\n", errno, strerror(errno));
|
||||
@@ -260,8 +287,11 @@ int LinuxDvbPlay(Context_t *context, char *type)
|
||||
{
|
||||
char *Encoding = NULL;
|
||||
context->manager->audio->Command(context, MANAGER_GETENCODING, &Encoding);
|
||||
|
||||
linuxdvb_printf(20, "0 A %s\n", Encoding);
|
||||
|
||||
writer = getWriter(Encoding);
|
||||
|
||||
if (writer == NULL)
|
||||
{
|
||||
linuxdvb_err("cannot found writer for encoding %s using default\n", Encoding);
|
||||
@@ -276,11 +306,13 @@ int LinuxDvbPlay(Context_t *context, char *type)
|
||||
ret = cERR_LINUXDVB_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
if (ioctl(audiofd, AUDIO_PLAY) < 0)
|
||||
{
|
||||
linuxdvb_err("AUDIO_PLAY: ERROR %d, %s\n", errno, strerror(errno));
|
||||
ret = cERR_LINUXDVB_ERROR;
|
||||
}
|
||||
|
||||
if (ioctl(audiofd, AUDIO_CONTINUE) < 0)
|
||||
{
|
||||
linuxdvb_err("AUDIO_CONTINUE: ERROR %d, %s\n", errno, strerror(errno));
|
||||
@@ -288,6 +320,7 @@ int LinuxDvbPlay(Context_t *context, char *type)
|
||||
}
|
||||
free(Encoding);
|
||||
}
|
||||
|
||||
ret = cERR_LINUXDVB_NO_ERROR;
|
||||
return ret;
|
||||
//return 0;
|
||||
@@ -298,19 +331,24 @@ int LinuxDvbStop(Context_t *context __attribute__((unused)), char *type)
|
||||
int ret = cERR_LINUXDVB_NO_ERROR;
|
||||
unsigned char video = !strcmp("video", type);
|
||||
unsigned char audio = !strcmp("audio", type);
|
||||
|
||||
linuxdvb_printf(10, "v%d a%d\n", video, audio);
|
||||
|
||||
getLinuxDVBMutex(FILENAME, __FUNCTION__, __LINE__);
|
||||
|
||||
if (video && videofd != -1)
|
||||
{
|
||||
if (ioctl(videofd, VIDEO_CLEAR_BUFFER) == -1)
|
||||
{
|
||||
linuxdvb_err("VIDEO_CLEAR_BUFFER: ERROR %d, %s\n", errno, strerror(errno));
|
||||
}
|
||||
|
||||
if (ioctl(videofd, VIDEO_STOP) == -1)
|
||||
{
|
||||
linuxdvb_err("VIDEO_STOP: ERROR %d, %s\n", errno, strerror(errno));
|
||||
ret = cERR_LINUXDVB_ERROR;
|
||||
}
|
||||
|
||||
ioctl(videofd, VIDEO_SLOWMOTION, 0);
|
||||
ioctl(videofd, VIDEO_FAST_FORWARD, 0);
|
||||
ioctl(videofd, VIDEO_SELECT_SOURCE, VIDEO_SOURCE_DEMUX);
|
||||
@@ -321,6 +359,7 @@ int LinuxDvbStop(Context_t *context __attribute__((unused)), char *type)
|
||||
{
|
||||
linuxdvb_err("AUDIO_CLEAR_BUFFER: ERROR %d, %s\n", errno, strerror(errno));
|
||||
}
|
||||
|
||||
if (ioctl(audiofd, AUDIO_STOP) == -1)
|
||||
{
|
||||
linuxdvb_err("AUDIO_STOP: ERROR %d, %s\n", errno, strerror(errno));
|
||||
@@ -328,7 +367,9 @@ int LinuxDvbStop(Context_t *context __attribute__((unused)), char *type)
|
||||
}
|
||||
ioctl(audiofd, AUDIO_SELECT_SOURCE, AUDIO_SOURCE_DEMUX);
|
||||
}
|
||||
|
||||
releaseLinuxDVBMutex(FILENAME, __FUNCTION__, __LINE__);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -337,8 +378,11 @@ int LinuxDvbPause(Context_t *context __attribute__((unused)), char *type)
|
||||
int32_t ret = cERR_LINUXDVB_NO_ERROR;
|
||||
uint8_t video = !strcmp("video", type);
|
||||
uint8_t audio = !strcmp("audio", type);
|
||||
|
||||
linuxdvb_printf(10, "v%d a%d\n", video, audio);
|
||||
|
||||
getLinuxDVBMutex(FILENAME, __FUNCTION__, __LINE__);
|
||||
|
||||
if (video && videofd != -1)
|
||||
{
|
||||
if (ioctl(videofd, VIDEO_FREEZE, NULL) == -1)
|
||||
@@ -347,6 +391,7 @@ int LinuxDvbPause(Context_t *context __attribute__((unused)), char *type)
|
||||
ret = cERR_LINUXDVB_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
if (audio && audiofd != -1)
|
||||
{
|
||||
if (ioctl(audiofd, AUDIO_PAUSE, NULL) == -1)
|
||||
@@ -355,7 +400,9 @@ int LinuxDvbPause(Context_t *context __attribute__((unused)), char *type)
|
||||
ret = cERR_LINUXDVB_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
releaseLinuxDVBMutex(FILENAME, __FUNCTION__, __LINE__);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -364,19 +411,23 @@ int LinuxDvbContinue(Context_t *context __attribute__((unused)), char *type)
|
||||
int32_t ret = cERR_LINUXDVB_NO_ERROR;
|
||||
uint8_t video = !strcmp("video", type);
|
||||
uint8_t audio = !strcmp("audio", type);
|
||||
|
||||
linuxdvb_printf(10, "v%d a%d\n", video, audio);
|
||||
|
||||
if (video && videofd != -1)
|
||||
{
|
||||
if (context->playback->isForwarding == 0)
|
||||
{
|
||||
ioctl(videofd, VIDEO_FAST_FORWARD, 0);
|
||||
}
|
||||
|
||||
if (ioctl(videofd, VIDEO_CONTINUE, NULL) == -1)
|
||||
{
|
||||
linuxdvb_err("VIDEO_CONTINUE: ERROR %d, %s\n", errno, strerror(errno));
|
||||
ret = cERR_LINUXDVB_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
if (audio && audiofd != -1)
|
||||
{
|
||||
if (ioctl(audiofd, AUDIO_CONTINUE, NULL) == -1)
|
||||
@@ -385,16 +436,21 @@ int LinuxDvbContinue(Context_t *context __attribute__((unused)), char *type)
|
||||
ret = cERR_LINUXDVB_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
if (isBufferedOutput)
|
||||
LinuxDvbBuffResume(context);
|
||||
|
||||
linuxdvb_printf(10, "exiting\n");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int LinuxDvbAudioMute(Context_t *context __attribute__((unused)), char *flag)
|
||||
{
|
||||
int ret = cERR_LINUXDVB_NO_ERROR;
|
||||
|
||||
linuxdvb_printf(10, "\n");
|
||||
|
||||
if (audiofd != -1)
|
||||
{
|
||||
if (*flag == '1')
|
||||
@@ -414,7 +470,9 @@ int LinuxDvbAudioMute(Context_t *context __attribute__((unused)), char *flag)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
linuxdvb_printf(10, "exiting\n");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -428,8 +486,11 @@ int LinuxDvbFastForward(Context_t *context, char *type)
|
||||
int32_t ret = cERR_LINUXDVB_NO_ERROR;
|
||||
uint8_t video = !strcmp("video", type);
|
||||
uint8_t audio = !strcmp("audio", type);
|
||||
|
||||
if (audio) {}
|
||||
|
||||
linuxdvb_printf(10, "v%d a%d speed %d\n", video, audio, context->playback->Speed);
|
||||
|
||||
if (video && videofd != -1)
|
||||
{
|
||||
getLinuxDVBMutex(FILENAME, __FUNCTION__, __LINE__);
|
||||
@@ -441,6 +502,7 @@ int LinuxDvbFastForward(Context_t *context, char *type)
|
||||
}
|
||||
releaseLinuxDVBMutex(FILENAME, __FUNCTION__, __LINE__);
|
||||
}
|
||||
|
||||
linuxdvb_printf(10, "exiting with value %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
@@ -448,12 +510,16 @@ int LinuxDvbFastForward(Context_t *context, char *type)
|
||||
int LinuxDvbSlowMotion(Context_t *context, char *type)
|
||||
{
|
||||
int32_t ret = cERR_LINUXDVB_NO_ERROR;
|
||||
|
||||
uint8_t video = !strcmp("video", type);
|
||||
uint8_t audio = !strcmp("audio", type);
|
||||
|
||||
linuxdvb_printf(10, "v%d a%d\n", video, audio);
|
||||
|
||||
if ((video && videofd != -1) || (audio && audiofd != -1))
|
||||
{
|
||||
getLinuxDVBMutex(FILENAME, __FUNCTION__, __LINE__);
|
||||
|
||||
if (video && videofd != -1)
|
||||
{
|
||||
if (ioctl(videofd, VIDEO_SLOWMOTION, context->playback->SlowMotion) == -1)
|
||||
@@ -462,9 +528,12 @@ int LinuxDvbSlowMotion(Context_t *context, char *type)
|
||||
ret = cERR_LINUXDVB_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
releaseLinuxDVBMutex(FILENAME, __FUNCTION__, __LINE__);
|
||||
}
|
||||
|
||||
linuxdvb_printf(10, "exiting with value %d\n", ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -480,13 +549,16 @@ int LinuxDvbAVSync(Context_t *context __attribute__((unused)), char *type __attr
|
||||
if (audiofd != -1)
|
||||
{
|
||||
getLinuxDVBMutex(FILENAME, __FUNCTION__, __LINE__);
|
||||
|
||||
if (ioctl(audiofd, AUDIO_SET_AV_SYNC, 0) == -1) //context->playback->AVSync) == -1)
|
||||
{
|
||||
linuxdvb_err("AUDIO_SET_AV_SYNC: ERROR %d, %s\n", errno, strerror(errno));
|
||||
ret = cERR_LINUXDVB_ERROR;
|
||||
}
|
||||
|
||||
releaseLinuxDVBMutex(FILENAME, __FUNCTION__, __LINE__);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -495,10 +567,13 @@ int LinuxDvbClear(Context_t *context __attribute__((unused)), char *type)
|
||||
int32_t ret = cERR_LINUXDVB_NO_ERROR;
|
||||
uint8_t video = !strcmp("video", type);
|
||||
uint8_t audio = !strcmp("audio", type);
|
||||
|
||||
linuxdvb_printf(10, "LinuxDvbClear v%d a%d\n", video, audio);
|
||||
|
||||
if ((video && videofd != -1) || (audio && audiofd != -1))
|
||||
{
|
||||
getLinuxDVBMutex(FILENAME, __FUNCTION__, __LINE__);
|
||||
|
||||
if (video && videofd != -1)
|
||||
{
|
||||
if (ioctl(videofd, VIDEO_CLEAR_BUFFER) == -1)
|
||||
@@ -515,16 +590,21 @@ int LinuxDvbClear(Context_t *context __attribute__((unused)), char *type)
|
||||
ret = cERR_LINUXDVB_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
releaseLinuxDVBMutex(FILENAME, __FUNCTION__, __LINE__);
|
||||
}
|
||||
|
||||
linuxdvb_printf(10, "exiting\n");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int LinuxDvbPts(Context_t *context __attribute__((unused)), unsigned long long int *pts)
|
||||
{
|
||||
int32_t ret = cERR_LINUXDVB_ERROR;
|
||||
|
||||
linuxdvb_printf(50, "\n");
|
||||
|
||||
// GET_PTS is immutable call, so it can be done in parallel to other requests
|
||||
if (videofd > -1 && !ioctl(videofd, VIDEO_GET_PTS, (void *)&sCURRENT_PTS))
|
||||
{
|
||||
@@ -534,6 +614,7 @@ int LinuxDvbPts(Context_t *context __attribute__((unused)), unsigned long long i
|
||||
{
|
||||
linuxdvb_err("VIDEO_GET_PTS: ERROR %d, %s\n", errno, strerror(errno));
|
||||
}
|
||||
|
||||
if (ret != cERR_LINUXDVB_NO_ERROR)
|
||||
{
|
||||
if (audiofd > -1 && !ioctl(audiofd, AUDIO_GET_PTS, (void *)&sCURRENT_PTS))
|
||||
@@ -545,10 +626,12 @@ int LinuxDvbPts(Context_t *context __attribute__((unused)), unsigned long long i
|
||||
linuxdvb_err("AUDIO_GET_PTS: ERROR %d, %s\n", errno, strerror(errno));
|
||||
}
|
||||
}
|
||||
|
||||
if (ret != cERR_LINUXDVB_NO_ERROR)
|
||||
{
|
||||
sCURRENT_PTS = 0;
|
||||
}
|
||||
|
||||
*((unsigned long long int *)pts) = (unsigned long long int)sCURRENT_PTS;
|
||||
return ret;
|
||||
}
|
||||
@@ -563,26 +646,34 @@ int LinuxDvbSwitch(Context_t *context, char *type)
|
||||
uint8_t audio = !strcmp("audio", type);
|
||||
uint8_t video = !strcmp("video", type);
|
||||
Writer_t *writer;
|
||||
|
||||
linuxdvb_printf(10, "v%d a%d\n", video, audio);
|
||||
|
||||
if ((video && videofd != -1) || (audio && audiofd != -1))
|
||||
{
|
||||
getLinuxDVBMutex(FILENAME, __FUNCTION__, __LINE__);
|
||||
|
||||
if (audio && audiofd != -1)
|
||||
{
|
||||
char *Encoding = NULL;
|
||||
if (context && context->manager && context->manager->audio)
|
||||
{
|
||||
context->manager->audio->Command(context, MANAGER_GETENCODING, &Encoding);
|
||||
|
||||
linuxdvb_printf(10, "A %s\n", Encoding);
|
||||
|
||||
writer = getWriter(Encoding);
|
||||
|
||||
if (ioctl(audiofd, AUDIO_STOP, NULL) == -1)
|
||||
{
|
||||
linuxdvb_err("AUDIO_STOP: ERROR %d, %s\n", errno, strerror(errno));
|
||||
}
|
||||
|
||||
if (ioctl(audiofd, AUDIO_CLEAR_BUFFER) == -1)
|
||||
{
|
||||
linuxdvb_err("AUDIO_CLEAR_BUFFER: ERROR %d, %s\n", errno, strerror(errno));
|
||||
}
|
||||
|
||||
if (writer == NULL)
|
||||
{
|
||||
linuxdvb_err("cannot found writer for encoding %s using default\n", Encoding);
|
||||
@@ -595,6 +686,7 @@ int LinuxDvbSwitch(Context_t *context, char *type)
|
||||
linuxdvb_err("AUDIO_SET_BYPASS_MODE: ERROR %d, %s\n", errno, strerror(errno));
|
||||
}
|
||||
}
|
||||
|
||||
if (ioctl(audiofd, AUDIO_PLAY) == -1)
|
||||
{
|
||||
linuxdvb_err("AUDIO_PLAY: ERROR %d, %s\n", errno, strerror(errno));
|
||||
@@ -606,22 +698,28 @@ int LinuxDvbSwitch(Context_t *context, char *type)
|
||||
linuxdvb_printf(20, "no context for Audio\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (video && videofd != -1)
|
||||
{
|
||||
char *Encoding = NULL;
|
||||
if (context && context->manager && context->manager->video)
|
||||
{
|
||||
context->manager->video->Command(context, MANAGER_GETENCODING, &Encoding);
|
||||
|
||||
if (ioctl(videofd, VIDEO_STOP, NULL) == -1)
|
||||
{
|
||||
linuxdvb_err("VIDEO_STOP: ERROR %d, %s\n", errno, strerror(errno));
|
||||
}
|
||||
|
||||
if (ioctl(videofd, VIDEO_CLEAR_BUFFER) == -1)
|
||||
{
|
||||
linuxdvb_err("VIDEO_CLEAR_BUFFER: ERROR %d, %s\n", errno, strerror(errno));
|
||||
}
|
||||
|
||||
linuxdvb_printf(10, "V %s\n", Encoding);
|
||||
|
||||
writer = getWriter(Encoding);
|
||||
|
||||
if (writer == NULL)
|
||||
{
|
||||
linuxdvb_err("cannot found writer for encoding %s using default\n", Encoding);
|
||||
@@ -634,6 +732,7 @@ int LinuxDvbSwitch(Context_t *context, char *type)
|
||||
linuxdvb_err("VIDEO_SET_STREAMTYPE: ERROR %d, %s\n", errno, strerror(errno));
|
||||
}
|
||||
}
|
||||
|
||||
if (ioctl(videofd, VIDEO_PLAY) == -1)
|
||||
{
|
||||
/* konfetti: fixme: think on this, I think we should
|
||||
@@ -648,42 +747,54 @@ int LinuxDvbSwitch(Context_t *context, char *type)
|
||||
linuxdvb_printf(20, "no context for Video\n");
|
||||
}
|
||||
}
|
||||
|
||||
releaseLinuxDVBMutex(FILENAME, __FUNCTION__, __LINE__);
|
||||
|
||||
}
|
||||
|
||||
linuxdvb_printf(10, "exiting\n");
|
||||
|
||||
return cERR_LINUXDVB_NO_ERROR;
|
||||
}
|
||||
|
||||
static int Write(Context_t *context, void *_out)
|
||||
{
|
||||
AudioVideoOut_t *out = (AudioVideoOut_t *) _out;
|
||||
int32_t ret = cERR_LINUXDVB_NO_ERROR;
|
||||
int32_t res = 0;
|
||||
uint8_t video = 0;
|
||||
uint8_t audio = 0;
|
||||
Writer_t *writer = NULL;
|
||||
int32_t ret = cERR_LINUXDVB_NO_ERROR;
|
||||
int32_t res = 0;
|
||||
uint8_t video = 0;
|
||||
uint8_t audio = 0;
|
||||
Writer_t *writer = NULL;
|
||||
WriterAVCallData_t call;
|
||||
|
||||
if (out == NULL)
|
||||
{
|
||||
linuxdvb_err("null pointer passed\n");
|
||||
return cERR_LINUXDVB_ERROR;
|
||||
}
|
||||
|
||||
video = !strcmp("video", out->type);
|
||||
audio = !strcmp("audio", out->type);
|
||||
|
||||
linuxdvb_printf(20, "DataLength=%u PrivateLength=%u Pts=%llu FrameRate=%f\n",
|
||||
out->len, out->extralen, out->pts, out->frameRate);
|
||||
linuxdvb_printf(20, "v%d a%d\n", video, audio);
|
||||
|
||||
if (video)
|
||||
{
|
||||
char *Encoding = NULL;
|
||||
context->manager->video->Command(context, MANAGER_GETENCODING, &Encoding);
|
||||
|
||||
linuxdvb_printf(20, "Encoding = %s\n", Encoding);
|
||||
|
||||
writer = getWriter(Encoding);
|
||||
|
||||
if (writer == NULL)
|
||||
{
|
||||
linuxdvb_printf(20, "searching default writer ... %s\n", Encoding);
|
||||
writer = getDefaultVideoWriter();
|
||||
}
|
||||
|
||||
if (writer == NULL)
|
||||
{
|
||||
linuxdvb_err("unknown video codec and no default writer %s\n", Encoding);
|
||||
@@ -734,6 +845,7 @@ static int Write(Context_t *context, void *_out)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
call.fd = videofd;
|
||||
call.data = out->data;
|
||||
call.len = out->len;
|
||||
@@ -747,11 +859,13 @@ static int Write(Context_t *context, void *_out)
|
||||
call.Height = out->height;
|
||||
call.InfoFlags = out->infoFlags;
|
||||
call.Version = 0;
|
||||
call.WriteV = isBufferedOutput ? BufferingWriteV : writev_with_retry;
|
||||
call.WriteV = isBufferedOutput ? BufferingWriteV : writev_with_retry;
|
||||
|
||||
if (writer->writeData)
|
||||
{
|
||||
res = writer->writeData(&call);
|
||||
}
|
||||
|
||||
if (res < 0)
|
||||
{
|
||||
linuxdvb_err("failed to write data %d - %d\n", res, errno);
|
||||
@@ -759,19 +873,24 @@ static int Write(Context_t *context, void *_out)
|
||||
ret = cERR_LINUXDVB_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
free(Encoding);
|
||||
}
|
||||
else if (audio)
|
||||
{
|
||||
char *Encoding = NULL;
|
||||
context->manager->audio->Command(context, MANAGER_GETENCODING, &Encoding);
|
||||
|
||||
linuxdvb_printf(20, "%s::%s Encoding = %s\n", FILENAME, __FUNCTION__, Encoding);
|
||||
|
||||
writer = getWriter(Encoding);
|
||||
|
||||
if (writer == NULL)
|
||||
{
|
||||
linuxdvb_printf(20, "searching default writer ... %s\n", Encoding);
|
||||
writer = getDefaultAudioWriter();
|
||||
}
|
||||
|
||||
if (writer == NULL)
|
||||
{
|
||||
linuxdvb_err("unknown audio codec %s and no default writer\n", Encoding);
|
||||
@@ -790,11 +909,13 @@ static int Write(Context_t *context, void *_out)
|
||||
call.FrameScale = out->timeScale;
|
||||
call.InfoFlags = out->infoFlags;
|
||||
call.Version = 0;
|
||||
call.WriteV = isBufferedOutput ? BufferingWriteV : writev_with_retry;
|
||||
call.WriteV = isBufferedOutput ? BufferingWriteV : writev_with_retry;
|
||||
|
||||
if (writer->writeData)
|
||||
{
|
||||
res = writer->writeData(&call);
|
||||
}
|
||||
|
||||
if (res < 0)
|
||||
{
|
||||
linuxdvb_err("failed to write data %d - %d\n", res, errno);
|
||||
@@ -802,8 +923,10 @@ static int Write(Context_t *context, void *_out)
|
||||
ret = cERR_LINUXDVB_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
free(Encoding);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -812,8 +935,11 @@ static int reset(Context_t *context)
|
||||
int ret = cERR_LINUXDVB_NO_ERROR;
|
||||
Writer_t *writer;
|
||||
char *Encoding = NULL;
|
||||
|
||||
context->manager->video->Command(context, MANAGER_GETENCODING, &Encoding);
|
||||
|
||||
writer = getWriter(Encoding);
|
||||
|
||||
if (writer == NULL)
|
||||
{
|
||||
linuxdvb_err("unknown video codec %s\n", Encoding);
|
||||
@@ -823,9 +949,13 @@ static int reset(Context_t *context)
|
||||
{
|
||||
writer->reset();
|
||||
}
|
||||
|
||||
free(Encoding);
|
||||
|
||||
context->manager->audio->Command(context, MANAGER_GETENCODING, &Encoding);
|
||||
|
||||
writer = getWriter(Encoding);
|
||||
|
||||
if (writer == NULL)
|
||||
{
|
||||
linuxdvb_err("unknown video codec %s\n", Encoding);
|
||||
@@ -835,16 +965,21 @@ static int reset(Context_t *context)
|
||||
{
|
||||
writer->reset();
|
||||
}
|
||||
|
||||
free(Encoding);
|
||||
|
||||
if (isBufferedOutput)
|
||||
LinuxDvbBuffFlush(context);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int Command(Context_t *context, OutputCmd_t command, void *argument)
|
||||
{
|
||||
int ret = cERR_LINUXDVB_NO_ERROR;
|
||||
|
||||
linuxdvb_printf(50, "Command %d\n", command);
|
||||
|
||||
switch (command)
|
||||
{
|
||||
case OUTPUT_OPEN:
|
||||
@@ -946,7 +1081,7 @@ static int Command(Context_t *context, OutputCmd_t command, void *argument)
|
||||
ret = cERR_LINUXDVB_ERROR;
|
||||
if (!isBufferedOutput)
|
||||
{
|
||||
uint32_t bufferSize = *((uint32_t*)argument);
|
||||
uint32_t bufferSize = *((uint32_t *)argument);
|
||||
ret = cERR_LINUXDVB_NO_ERROR;
|
||||
if (bufferSize > 0)
|
||||
{
|
||||
@@ -961,7 +1096,9 @@ static int Command(Context_t *context, OutputCmd_t command, void *argument)
|
||||
ret = cERR_LINUXDVB_ERROR;
|
||||
break;
|
||||
}
|
||||
|
||||
linuxdvb_printf(50, "exiting with value %d\n", ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user