diff --git a/libarmbox/video.cpp b/libarmbox/video.cpp index 3b1f244..6fb8495 100644 --- a/libarmbox/video.cpp +++ b/libarmbox/video.cpp @@ -300,6 +300,16 @@ int image_to_mpeg2(const char *image_name, int fd) av_free(formatContext); return ret; } +enum{ENCODER,AUX}; +void setAVInput(int val) +{ + int input_fd = open("/proc/stb/avs/0/input", O_WRONLY); + if(input_fd){ + const char *input[] = {"encoder", "aux"}; + write(input_fd, input[val], strlen(input[val])); + close(input_fd); + } +} cVideo::cVideo(int, void *, void *, unsigned int unit) { @@ -323,6 +333,11 @@ cVideo::cVideo(int, void *, void *, unsigned int unit) cVideo::~cVideo(void) { + if(fd >= 0) + setAVInput(AUX); + if (standby_cec_activ && fd >= 0) + SetCECState(true); + closeDevice(); } @@ -616,10 +631,12 @@ void cVideo::Standby(unsigned int bOn) if (bOn) { closeDevice(); + setAVInput(AUX); } else { openDevice(); + setAVInput(ENCODER); } video_standby = bOn; SetCECState(video_standby); @@ -1108,7 +1125,7 @@ bool cVideo::SetCECMode(VIDEO_HDMI_CEC_MODE _deviceType) physicalAddress[0] = 0x10; physicalAddress[1] = 0x00; logicalAddress = 1; - + if (_deviceType == VIDEO_HDMI_CEC_MODE_OFF) { if (hdmiFd >= 0) { @@ -1192,11 +1209,15 @@ bool cVideo::SetCECMode(VIDEO_HDMI_CEC_MODE _deviceType) if (ioctl(hdmiFd, CEC_S_MODE, &monitor) < 0) lt_info("%s: CEC monitor failed (%m)\n", __func__); + GetCECAddressInfo(); + + if(autoview_cec_activ) + SetCECState(false); + + return true; + } - - GetCECAddressInfo(); - - return true; + return false; } void cVideo::GetCECAddressInfo()