+#include <lib/base/eerror.h>
#include <lib/dvb/volume.h>
#include <stdio.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <unistd.h>
-#if HAVE_DVB_API_VERSION < 3
-#define VIDEO_DEV "/dev/dvb/card0/video0"
-#define AUDIO_DEV "/dev/dvb/card0/audio0"
-#include <ost/audio.h>
-#include <ost/video.h>
-#else
#define VIDEO_DEV "/dev/dvb/adapter0/video0"
#define AUDIO_DEV "/dev/dvb/adapter0/audio0"
#include <linux/dvb/audio.h>
#include <linux/dvb/video.h>
-#endif
eDVBVolumecontrol* eDVBVolumecontrol::instance = NULL;
void eDVBVolumecontrol::volumeUp(int left, int right)
{
- printf("[volume.cpp] Volume up\n");
setVolume(leftVol + left, rightVol + right);
}
void eDVBVolumecontrol::volumeDown(int left, int right)
{
- printf("[volume.cpp] Volume down\n");
setVolume(leftVol - left, rightVol - right);
}
right = 63 - rightVol * 63 / 100;
/* now range is 63..0, where 0 is loudest */
-#if HAVE_DVB_API_VERSION < 3
- audioMixer_t mixer;
-#else
audio_mixer_t mixer;
-#endif
-#ifdef HAVE_DVB_API_VERSION
- /* convert to linear scale. 0 = loudest, ..63 */
- mixer.volume_left = 63.0-pow(1.068241, 63-left);
- mixer.volume_right = 63.0-pow(1.068241, 63-right);
-#endif
+ mixer.volume_left = left;
+ mixer.volume_right = right;
- printf("Setvolume: %d %d (raw)\n", leftVol, rightVol);
- printf("Setvolume: %d %d (-1db)\n", left, right);
- printf("Setvolume: %d %d (lin)\n", mixer.volume_left, mixer.volume_right);
+ eDebug("Setvolume: %d %d (raw)", leftVol, rightVol);
+ eDebug("Setvolume: %d %d (-1db)", left, right);
int fd = openMixer();
if (fd >= 0)
{
-#ifdef HAVE_DVB_API_VERSION
ioctl(fd, AUDIO_SET_MIXER, &mixer);
-#endif
closeMixer(fd);
return;
}
//HACK?
FILE *f;
if((f = fopen("/proc/stb/avs/0/volume", "wb")) == NULL) {
- printf("cannot open /proc/stb/avs/0/volume\n");
+ eDebug("cannot open /proc/stb/avs/0/volume(%m)");
return;
}
int eDVBVolumecontrol::getVolume()
{
- if (isMuted())
- return 0;
return leftVol;
}
void eDVBVolumecontrol::volumeMute()
{
int fd = openMixer();
-#ifdef HAVE_DVB_API_VERSION
ioctl(fd, AUDIO_SET_MUTE, true);
-#endif
closeMixer(fd);
muted = true;
//HACK?
FILE *f;
if((f = fopen("/proc/stb/audio/j1_mute", "wb")) == NULL) {
- printf("cannot open /proc/stb/audio/j1_mute\n");
+ eDebug("cannot open /proc/stb/audio/j1_mute(%m)");
return;
}
void eDVBVolumecontrol::volumeUnMute()
{
int fd = openMixer();
-#ifdef HAVE_DVB_API_VERSION
ioctl(fd, AUDIO_SET_MUTE, false);
-#endif
closeMixer(fd);
muted = false;
//HACK?
FILE *f;
if((f = fopen("/proc/stb/audio/j1_mute", "wb")) == NULL) {
- printf("cannot open /proc/stb/audio/j1_mute\n");
+ eDebug("cannot open /proc/stb/audio/j1_mute(%m)");
return;
}