mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-libstb-hal.git
synced 2025-08-26 23:12:44 +02:00
spark: add (and use) proc_put() to audio.cpp
Origin commit data
------------------
Branch: master
Commit: 8ea51a9dfb
Author: Stefan Seyfried <seife@tuxbox-git.slipkontur.de>
Date: 2012-06-08 (Fri, 08 Jun 2012)
------------------
No further description and justification available within origin commit message!
------------------
This commit was generated by Migit
This commit is contained in:
@@ -17,6 +17,19 @@
|
|||||||
|
|
||||||
cAudio * audioDecoder = NULL;
|
cAudio * audioDecoder = NULL;
|
||||||
|
|
||||||
|
static int proc_put(const char *path, const char *value, const int len)
|
||||||
|
{
|
||||||
|
int ret, ret2;
|
||||||
|
int pfd = open(path, O_WRONLY);
|
||||||
|
if (pfd < 0)
|
||||||
|
return pfd;
|
||||||
|
ret = write(pfd, value, len);
|
||||||
|
ret2 = close(pfd);
|
||||||
|
if (ret2 < 0)
|
||||||
|
return ret2;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
cAudio::cAudio(void *, void *, void *)
|
cAudio::cAudio(void *, void *, void *)
|
||||||
{
|
{
|
||||||
fd = -1;
|
fd = -1;
|
||||||
@@ -66,20 +79,15 @@ int cAudio::do_mute(bool enable, bool remember)
|
|||||||
Muted = enable;
|
Muted = enable;
|
||||||
|
|
||||||
sprintf(str, "%d", Muted);
|
sprintf(str, "%d", Muted);
|
||||||
|
proc_put("/proc/stb/audio/j1_mute", str, strlen(str));
|
||||||
int f = open("/proc/stb/audio/j1_mute", O_RDWR);
|
|
||||||
write(f, str, strlen(str));
|
|
||||||
close(f);
|
|
||||||
|
|
||||||
if (!enable)
|
if (!enable)
|
||||||
{
|
{
|
||||||
f = open("/proc/stb/avs/0/volume", O_RDWR);
|
int f = open("/proc/stb/avs/0/volume", O_RDWR);
|
||||||
read(f, str, 4);
|
read(f, str, 4);
|
||||||
close(f);
|
close(f);
|
||||||
str[3] = '\0';
|
str[3] = '\0';
|
||||||
f = open("/proc/stb/avs/0/volume", O_RDWR);
|
proc_put("/proc/stb/avs/0/volume", str, strlen(str));
|
||||||
write(f, str, strlen(str));
|
|
||||||
close(f);
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -120,9 +128,7 @@ int cAudio::setVolume(unsigned int left, unsigned int right)
|
|||||||
char str[4];
|
char str[4];
|
||||||
sprintf(str, "%d", v);
|
sprintf(str, "%d", v);
|
||||||
|
|
||||||
int f = open("/proc/stb/avs/0/volume", O_RDWR);
|
proc_put("/proc/stb/avs/0/volume", str, strlen(str));
|
||||||
write(f, str, strlen(str));
|
|
||||||
close(f);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user