mirror of
https://github.com/tuxbox-neutrino/libstb-hal.git
synced 2025-08-27 15:33:00 +02:00
libeplayer3: use actual pids instead of indexes
This commit is contained in:
@@ -110,17 +110,17 @@ int LinuxDvbOpen(Context_t *context __attribute__((unused)), char * type) {
|
||||
|
||||
linuxdvb_printf(10, "v%d a%d\n", video, audio);
|
||||
|
||||
if (video && videofd == -1) {
|
||||
if (video && videofd < 0) {
|
||||
videofd = open(VIDEODEV, O_RDWR);
|
||||
|
||||
if (videofd <= 0)
|
||||
if (videofd < 0)
|
||||
{
|
||||
linuxdvb_err("failed to open %s - errno %d\n", VIDEODEV, errno);
|
||||
linuxdvb_err("%s\n", strerror(errno));
|
||||
return cERR_LINUXDVB_ERROR;
|
||||
}
|
||||
|
||||
if (ioctl( videofd, VIDEO_CLEAR_BUFFER, NULL) == -1)
|
||||
if (ioctl( videofd, VIDEO_CLEAR_BUFFER) == -1)
|
||||
{
|
||||
linuxdvb_err("ioctl failed with errno %d\n", errno);
|
||||
linuxdvb_err("VIDEO_CLEAR_BUFFER: %s\n", strerror(errno));
|
||||
@@ -145,20 +145,20 @@ int LinuxDvbOpen(Context_t *context __attribute__((unused)), char * type) {
|
||||
}
|
||||
|
||||
}
|
||||
if (audio && audiofd == -1) {
|
||||
if (audio && audiofd < 0) {
|
||||
audiofd = open(AUDIODEV, O_RDWR);
|
||||
|
||||
if (audiofd <= 0)
|
||||
if (audiofd < 0)
|
||||
{
|
||||
linuxdvb_err("failed to open %s - errno %d\n", AUDIODEV, errno);
|
||||
linuxdvb_err("%s\n", strerror(errno));
|
||||
|
||||
if (videofd != -1)
|
||||
if (videofd < 0)
|
||||
close(videofd);
|
||||
return cERR_LINUXDVB_ERROR;
|
||||
}
|
||||
|
||||
if (ioctl( audiofd, AUDIO_CLEAR_BUFFER, NULL) == -1)
|
||||
if (ioctl( audiofd, AUDIO_CLEAR_BUFFER) == -1)
|
||||
{
|
||||
linuxdvb_err("ioctl failed with errno %d\n", errno);
|
||||
linuxdvb_err("AUDIO_CLEAR_BUFFER: %s\n", strerror(errno));
|
||||
@@ -302,7 +302,7 @@ int LinuxDvbStop(Context_t *context __attribute__((unused)), char * type) {
|
||||
getLinuxDVBMutex(FILENAME, __FUNCTION__,__LINE__);
|
||||
|
||||
if (video && videofd != -1) {
|
||||
if (ioctl(videofd, VIDEO_CLEAR_BUFFER, NULL) == -1)
|
||||
if (ioctl(videofd, VIDEO_CLEAR_BUFFER) == -1)
|
||||
{
|
||||
linuxdvb_err("ioctl failed with errno %d\n", errno);
|
||||
linuxdvb_err("VIDEO_CLEAR_BUFFER: %s\n", strerror(errno));
|
||||
@@ -314,7 +314,6 @@ int LinuxDvbStop(Context_t *context __attribute__((unused)), char * type) {
|
||||
linuxdvb_err("ioctl failed with errno %d\n", errno);
|
||||
linuxdvb_err("VIDEO_SET_SPEED: %s\n", strerror(errno));
|
||||
}
|
||||
|
||||
if (ioctl(videofd, VIDEO_STOP, NULL) == -1)
|
||||
{
|
||||
linuxdvb_err("ioctl failed with errno %d\n", errno);
|
||||
@@ -323,7 +322,7 @@ int LinuxDvbStop(Context_t *context __attribute__((unused)), char * type) {
|
||||
}
|
||||
}
|
||||
if (audio && audiofd != -1) {
|
||||
if (ioctl(audiofd, AUDIO_CLEAR_BUFFER, NULL) == -1)
|
||||
if (ioctl(audiofd, AUDIO_CLEAR_BUFFER) == -1)
|
||||
{
|
||||
linuxdvb_err("ioctl failed with errno %d\n", errno);
|
||||
linuxdvb_err("AUDIO_CLEAR_BUFFER: %s\n", strerror(errno));
|
||||
@@ -335,7 +334,6 @@ int LinuxDvbStop(Context_t *context __attribute__((unused)), char * type) {
|
||||
linuxdvb_err("ioctl failed with errno %d\n", errno);
|
||||
linuxdvb_err("AUDIO_SET_SPEED: %s\n", strerror(errno));
|
||||
}
|
||||
|
||||
if (ioctl(audiofd, AUDIO_STOP, NULL) == -1)
|
||||
{
|
||||
linuxdvb_err("ioctl failed with errno %d\n", errno);
|
||||
@@ -475,12 +473,16 @@ int LinuxDvbFlush(Context_t *context __attribute__((unused)), char * type) {
|
||||
getLinuxDVBMutex(FILENAME, __FUNCTION__,__LINE__);
|
||||
|
||||
if (video && videofd != -1) {
|
||||
if (ioctl(videofd, VIDEO_CLEAR_BUFFER) == -1)
|
||||
{
|
||||
linuxdvb_err("ioctl failed with errno %d\n", errno);
|
||||
linuxdvb_err("VIDEO_CLEAR_BUFFER: %s\n", strerror(errno));
|
||||
}
|
||||
if (ioctl(videofd, VIDEO_FLUSH ,NULL) == -1)
|
||||
{
|
||||
linuxdvb_err("ioctl failed with errno %d\n", errno);
|
||||
linuxdvb_err("VIDEO_FLUSH: %s\n", strerror(errno));
|
||||
}
|
||||
|
||||
if (ioctl(videofd, VIDEO_STOP, NULL) == -1)
|
||||
{
|
||||
linuxdvb_err("ioctl failed with errno %d\n", errno);
|
||||
@@ -489,6 +491,11 @@ int LinuxDvbFlush(Context_t *context __attribute__((unused)), char * type) {
|
||||
}
|
||||
|
||||
if (audio && audiofd != -1) {
|
||||
if (ioctl(audiofd, AUDIO_CLEAR_BUFFER) == -1)
|
||||
{
|
||||
linuxdvb_err("ioctl failed with errno %d\n", errno);
|
||||
linuxdvb_err("AUDIO_CLEAR_BUFFER: %s\n", strerror(errno));
|
||||
}
|
||||
if (ioctl(audiofd, AUDIO_FLUSH ,NULL) == -1)
|
||||
{
|
||||
linuxdvb_err("ioctl failed with errno %d\n", errno);
|
||||
@@ -721,7 +728,7 @@ int LinuxDvbClear(Context_t *context __attribute__((unused)), char * type) {
|
||||
getLinuxDVBMutex(FILENAME, __FUNCTION__,__LINE__);
|
||||
|
||||
if (video && videofd != -1) {
|
||||
if (ioctl(videofd, VIDEO_CLEAR_BUFFER, NULL) == -1)
|
||||
if (ioctl(videofd, VIDEO_CLEAR_BUFFER) == -1)
|
||||
{
|
||||
linuxdvb_err("ioctl failed with errno %d\n", errno);
|
||||
linuxdvb_err("VIDEO_CLEAR_BUFFER: %s\n", strerror(errno));
|
||||
@@ -729,7 +736,7 @@ int LinuxDvbClear(Context_t *context __attribute__((unused)), char * type) {
|
||||
}
|
||||
}
|
||||
if (audio && audiofd != -1) {
|
||||
if (ioctl(audiofd, AUDIO_CLEAR_BUFFER, NULL) == -1)
|
||||
if (ioctl(audiofd, AUDIO_CLEAR_BUFFER) == -1)
|
||||
{
|
||||
linuxdvb_err("ioctl failed with errno %d\n", errno);
|
||||
linuxdvb_err("AUDIO_CLEAR_BUFFER: %s\n", strerror(errno));
|
||||
@@ -746,35 +753,25 @@ int LinuxDvbClear(Context_t *context __attribute__((unused)), char * type) {
|
||||
}
|
||||
|
||||
int LinuxDvbPts(Context_t *context __attribute__((unused)), unsigned long long int* pts) {
|
||||
int ret = cERR_LINUXDVB_NO_ERROR;
|
||||
int ret = cERR_LINUXDVB_ERROR;
|
||||
|
||||
linuxdvb_printf(50, "\n");
|
||||
|
||||
// pts is a non writting requests and can be done in parallel to other requests
|
||||
//getLinuxDVBMutex(FILENAME, __FUNCTION__,__LINE__);
|
||||
|
||||
if (videofd != -1)
|
||||
{
|
||||
if (ioctl(videofd, VIDEO_GET_PTS, (void*)&sCURRENT_PTS) == -1)
|
||||
{
|
||||
linuxdvb_err("ioctl failed with errno %d\n", errno);
|
||||
linuxdvb_err("VIDEO_GET_PTS: %s\n", strerror(errno));
|
||||
ret = cERR_LINUXDVB_ERROR;
|
||||
}
|
||||
}
|
||||
else if (audiofd != -1)
|
||||
{
|
||||
if (ioctl(audiofd, AUDIO_GET_PTS, (void*)&sCURRENT_PTS) == -1)
|
||||
{
|
||||
linuxdvb_err("ioctl failed with errno %d\n", errno);
|
||||
linuxdvb_err("AUDIO_GET_PTS: %s\n", strerror(errno));
|
||||
ret = cERR_LINUXDVB_ERROR;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (videofd > -1 && !ioctl(videofd, VIDEO_GET_PTS, (void*)&sCURRENT_PTS))
|
||||
ret = cERR_LINUXDVB_NO_ERROR;
|
||||
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)
|
||||
sCURRENT_PTS = 0;
|
||||
ret = cERR_LINUXDVB_ERROR;
|
||||
}
|
||||
|
||||
*((unsigned long long int *)pts)=(unsigned long long int)sCURRENT_PTS;
|
||||
|
||||
@@ -849,7 +846,7 @@ int LinuxDvbSwitch(Context_t *context, char * type) {
|
||||
|
||||
}
|
||||
|
||||
if (ioctl(audiofd, AUDIO_CLEAR_BUFFER ,NULL) == -1)
|
||||
if (ioctl(audiofd, AUDIO_CLEAR_BUFFER) == -1)
|
||||
{
|
||||
linuxdvb_err("ioctl failed with errno %d\n", errno);
|
||||
linuxdvb_err("AUDIO_CLEAR_BUFFER: %s\n", strerror(errno));
|
||||
@@ -896,7 +893,7 @@ int LinuxDvbSwitch(Context_t *context, char * type) {
|
||||
linuxdvb_err("VIDEO_STOP: %s\n", strerror(errno));
|
||||
}
|
||||
|
||||
if (ioctl(videofd, VIDEO_CLEAR_BUFFER ,NULL) == -1)
|
||||
if (ioctl(videofd, VIDEO_CLEAR_BUFFER) == -1)
|
||||
{
|
||||
linuxdvb_err("ioctl failed with errno %d\n", errno);
|
||||
linuxdvb_err("VIDEO_CLEAR_BUFFER: %s\n", strerror(errno));
|
||||
|
Reference in New Issue
Block a user