mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-libstb-hal.git
synced 2025-08-26 23:12:44 +02:00
armbox: use proc_tools
Origin commit data
------------------
Branch: master
Commit: be07c1a1b7
Author: max_10 <max_10@gmx.de>
Date: 2017-10-07 (Sat, 07 Oct 2017)
------------------
No further description and justification available within origin commit message!
------------------
This commit was generated by Migit
This commit is contained in:
@@ -7,6 +7,8 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <linux/dvb/audio.h>
|
#include <linux/dvb/audio.h>
|
||||||
|
|
||||||
|
#include <proc_tools.h>
|
||||||
#include "audio_lib.h"
|
#include "audio_lib.h"
|
||||||
#include "audio_mixer.h"
|
#include "audio_mixer.h"
|
||||||
#include "lt_debug.h"
|
#include "lt_debug.h"
|
||||||
@@ -19,19 +21,6 @@
|
|||||||
|
|
||||||
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;
|
||||||
@@ -117,7 +106,6 @@ int map_volume(const int volume)
|
|||||||
return vol;
|
return vol;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int cAudio::setVolume(unsigned int left, unsigned int right)
|
int cAudio::setVolume(unsigned int left, unsigned int right)
|
||||||
{
|
{
|
||||||
lt_debug("%s(%d, %d)\n", __func__, left, right);
|
lt_debug("%s(%d, %d)\n", __func__, left, right);
|
||||||
@@ -281,7 +269,7 @@ int cAudio::PrepareClipPlay(int ch, int srate, int bits, int little_endian)
|
|||||||
usable = devmask & stereo;
|
usable = devmask & stereo;
|
||||||
if (usable == 0) {
|
if (usable == 0) {
|
||||||
lt_info("%s: devmask: %08x stereo: %08x, no usable dev :-(\n",
|
lt_info("%s: devmask: %08x stereo: %08x, no usable dev :-(\n",
|
||||||
__func__, devmask, stereo);
|
__func__, devmask, stereo);
|
||||||
close(mixer_fd);
|
close(mixer_fd);
|
||||||
mixer_fd = -1;
|
mixer_fd = -1;
|
||||||
return 0; /* TODO: should we treat this as error? */
|
return 0; /* TODO: should we treat this as error? */
|
||||||
@@ -290,13 +278,13 @@ int cAudio::PrepareClipPlay(int ch, int srate, int bits, int little_endian)
|
|||||||
if (__builtin_popcount (usable) != 1) {
|
if (__builtin_popcount (usable) != 1) {
|
||||||
/* TODO: this code is not yet tested as I have only single-mixer devices... */
|
/* TODO: this code is not yet tested as I have only single-mixer devices... */
|
||||||
lt_info("%s: more than one mixer control: devmask %08x stereo %08x\n"
|
lt_info("%s: more than one mixer control: devmask %08x stereo %08x\n"
|
||||||
"%s: querying MIX_NUMBER environment variable...\n",
|
"%s: querying MIX_NUMBER environment variable...\n",
|
||||||
__func__, devmask, stereo, __func__);
|
__func__, devmask, stereo, __func__);
|
||||||
const char *tmp = getenv("MIX_NUMBER");
|
const char *tmp = getenv("MIX_NUMBER");
|
||||||
if (tmp)
|
if (tmp)
|
||||||
mixer_num = atoi(tmp);
|
mixer_num = atoi(tmp);
|
||||||
lt_info("%s: mixer_num is %d -> device %08x\n",
|
lt_info("%s: mixer_num is %d -> device %08x\n",
|
||||||
__func__, mixer_num, (mixer_num >= 0) ? (1 << mixer_num) : 0);
|
__func__, mixer_num, (mixer_num >= 0) ? (1 << mixer_num) : 0);
|
||||||
/* no error checking, you'd better know what you are doing... */
|
/* no error checking, you'd better know what you are doing... */
|
||||||
} else {
|
} else {
|
||||||
mixer_num = 0;
|
mixer_num = 0;
|
||||||
|
@@ -36,6 +36,9 @@
|
|||||||
#include <linux/fb.h>
|
#include <linux/fb.h>
|
||||||
#include "video_lib.h"
|
#include "video_lib.h"
|
||||||
#include "lt_debug.h"
|
#include "lt_debug.h"
|
||||||
|
|
||||||
|
#include <proc_tools.h>
|
||||||
|
|
||||||
#define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_VIDEO, this, args)
|
#define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_VIDEO, this, args)
|
||||||
#define lt_info(args...) _lt_info(TRIPLE_DEBUG_VIDEO, this, args)
|
#define lt_info(args...) _lt_info(TRIPLE_DEBUG_VIDEO, this, args)
|
||||||
#define lt_debug_c(args...) _lt_debug(TRIPLE_DEBUG_VIDEO, NULL, args)
|
#define lt_debug_c(args...) _lt_debug(TRIPLE_DEBUG_VIDEO, NULL, args)
|
||||||
@@ -120,46 +123,6 @@ static const char *VMPEG_framerate[] = {
|
|||||||
#define VIDEO_STREAMTYPE_H265_HEVC 7
|
#define VIDEO_STREAMTYPE_H265_HEVC 7
|
||||||
#define VIDEO_STREAMTYPE_AVS 16
|
#define VIDEO_STREAMTYPE_AVS 16
|
||||||
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int proc_get(const char *path, char *value, const int len)
|
|
||||||
{
|
|
||||||
int ret, ret2;
|
|
||||||
int pfd = open(path, O_RDONLY);
|
|
||||||
if (pfd < 0)
|
|
||||||
return pfd;
|
|
||||||
ret = read(pfd, value, len);
|
|
||||||
value[len-1] = '\0'; /* make sure string is terminated */
|
|
||||||
while (ret > 0 && isspace(value[ret-1]))
|
|
||||||
value[--ret] = '\0'; /* remove trailing whitespace */
|
|
||||||
ret2 = close(pfd);
|
|
||||||
if (ret2 < 0)
|
|
||||||
return ret2;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static unsigned int proc_get_hex(const char *path)
|
|
||||||
{
|
|
||||||
unsigned int n, ret = 0;
|
|
||||||
char buf[16];
|
|
||||||
n = proc_get(path, buf, 16);
|
|
||||||
if (n > 0)
|
|
||||||
sscanf(buf, "%x", &ret);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int hdmi_out(bool enable)
|
static int hdmi_out(bool enable)
|
||||||
{
|
{
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
Reference in New Issue
Block a user