use enum for setAVInput

This commit is contained in:
Jacek Jendrzej
2018-05-19 19:21:22 +02:00
parent f182216d94
commit 5a2865d01c

View File

@@ -300,12 +300,9 @@ int image_to_mpeg2(const char *image_name, int fd)
av_free(formatContext); av_free(formatContext);
return ret; return ret;
} }
enum{ENCODER,AUX};
void setAVInput(int val) void setAVInput(int val)
{ {
if (val != 0 && val != 1)
return;
int input_fd = open("/proc/stb/avs/0/input", O_WRONLY); int input_fd = open("/proc/stb/avs/0/input", O_WRONLY);
if(input_fd){ if(input_fd){
const char *input[] = {"encoder", "aux"}; const char *input[] = {"encoder", "aux"};
@@ -337,7 +334,7 @@ cVideo::cVideo(int, void *, void *, unsigned int unit)
cVideo::~cVideo(void) cVideo::~cVideo(void)
{ {
if(fd >= 0) if(fd >= 0)
setAVInput(1); setAVInput(AUX);
if (standby_cec_activ && fd >= 0) if (standby_cec_activ && fd >= 0)
SetCECState(true); SetCECState(true);
@@ -634,14 +631,12 @@ void cVideo::Standby(unsigned int bOn)
if (bOn) if (bOn)
{ {
closeDevice(); closeDevice();
if(fd < 0) setAVInput(AUX);
setAVInput(1);
} }
else else
{ {
openDevice(); openDevice();
if(fd >= 0) setAVInput(ENCODER);
setAVInput(0);
} }
video_standby = bOn; video_standby = bOn;
SetCECState(video_standby); SetCECState(video_standby);