vuduo4k/vuduo4kse/vuultimo4k/vuuno4kse: HDMI input as mode and PiP added

This commit is contained in:
BPanther
2021-05-09 21:25:43 +02:00
committed by Thilo Graf
parent d7da634795
commit dbad7ef37a
10 changed files with 175 additions and 6 deletions

View File

@@ -26,6 +26,7 @@ typedef struct hw_caps
{
int has_fan;
int has_HDMI;
int has_HDMI_input;
int has_SCART;
int has_SCART_input;
int has_YUV_cinch;

View File

@@ -18,13 +18,31 @@
#define hal_debug(args...) _hal_debug(HAL_DEBUG_AUDIO, this, args)
#define hal_info(args...) _hal_info(HAL_DEBUG_AUDIO, this, args)
#define fop(cmd, args...) ({ \
int _r; \
if (fd >= 0) { \
if ((_r = ::cmd(fd, args)) < 0) \
hal_info(#cmd"(fd, "#args")\n");\
else \
hal_debug(#cmd"(fd, "#args")\n");\
} \
else { _r = fd; } \
_r; \
})
#include <linux/soundcard.h>
enum
{ ENCODER,
AUX
};
cAudio * audioDecoder = NULL;
cAudio::cAudio(void *, void *, void *)
{
fd = -1;
fdd = false;
clipfd = -1;
mixer_fd = -1;
openDevice();
@@ -65,6 +83,48 @@ void cAudio::closeDevice(void)
}
}
#ifndef AUDIO_SOURCE_HDMI
#define AUDIO_SOURCE_HDMI 2
#endif
void cAudio::open_AVInput_Device(void)
{
hal_debug("%s\n", __func__);
if (fdd) /* already open */
return;
fop(ioctl, AUDIO_SELECT_SOURCE, AUDIO_SOURCE_HDMI);
fop(ioctl, AUDIO_PLAY);
fdd = true;
}
void cAudio::close_AVInput_Device(void)
{
hal_debug("%s\n", __func__);
if (fdd) {
fop(ioctl, AUDIO_STOP);
}
fdd = false;
}
void cAudio::setAVInput(int val)
{
hal_info("%s - switching to: %s\n", __func__, val == AUX ? "AUX" : "ENCODER");
if (val == AUX) {
Stop();
open_AVInput_Device();
} else {
if (fdd) {
close_AVInput_Device();
fop(ioctl, AUDIO_SELECT_SOURCE, AUDIO_SOURCE_DEMUX);
Start();
}
}
}
int cAudio::do_mute(bool enable, bool remember)
{
hal_debug("%s(%d, %d)\n", __FUNCTION__, enable, remember);

View File

@@ -25,6 +25,7 @@ class cAudio
friend class cPlayback;
private:
int fd;
bool fdd;
bool Muted;
int clipfd; /* for pcm playback */
@@ -39,15 +40,20 @@ class cAudio
int do_mute(bool enable, bool remember);
void setBypassMode(bool disable);
public:
/* construct & destruct */
cAudio(void *, void *, void *);
~cAudio(void);
/* used internally by playback */
void openDevice(void);
void closeDevice(void);
void open_AVInput_Device(void);
void close_AVInput_Device(void);
void setAVInput(int val);
void *GetHandle() { return NULL; };
/* shut up */
int mute(bool remember = true) { return do_mute(true, remember); };

View File

@@ -68,6 +68,7 @@ hw_caps_t *get_hwcaps(void)
caps.has_button_timer = 1;
caps.has_button_vformat = 0;
caps.has_HDMI = 2;
caps.has_HDMI_input = 1;
strcpy(caps.startup_file, "STARTUP");
strcpy(caps.boxvendor, "VU+");
strcpy(caps.boxname, "DUO4K");
@@ -88,6 +89,7 @@ hw_caps_t *get_hwcaps(void)
caps.display_has_colon = 0;
caps.has_button_timer = 1;
caps.has_HDMI = 2;
caps.has_HDMI_input = 1;
strcpy(caps.startup_file, "STARTUP");
strcpy(caps.boxvendor, "VU+");
strcpy(caps.boxname, "DUO4KSE");
@@ -110,6 +112,7 @@ hw_caps_t *get_hwcaps(void)
caps.has_button_timer = 1;
caps.has_button_vformat = 0;
caps.has_HDMI = 2;
caps.has_HDMI_input = 1;
strcpy(caps.startup_file, "STARTUP");
strcpy(caps.boxvendor, "VU+");
strcpy(caps.boxname, "ULTIMO4K");
@@ -152,6 +155,7 @@ hw_caps_t *get_hwcaps(void)
caps.has_button_timer = 1;
caps.has_button_vformat = 0;
caps.has_HDMI = 2;
caps.has_HDMI_input = 1;
strcpy(caps.startup_file, "STARTUP");
strcpy(caps.boxvendor, "VU+");
strcpy(caps.boxname, "UNO4KSE");

View File

@@ -72,6 +72,11 @@ extern "C"
#define VIDEO_GET_FRAME_RATE _IOR('o', 56, unsigned int)
#endif
enum
{ ENCODER,
AUX
};
cVideo * videoDecoder = NULL;
cVideo * pipDecoder = NULL;
@@ -385,15 +390,56 @@ int image_to_mpeg2(const char *image_name, int fd)
av_free(formatContext);
return ret;
}
enum{ENCODER,AUX};
void setAVInput(int val)
#ifndef VIDEO_SOURCE_HDMI
#define VIDEO_SOURCE_HDMI 2
#endif
void cVideo::open_AVInput_Device(void)
{
hal_debug("%s\n", __func__);
if (fdd) /* already open */
return;
fop(ioctl, VIDEO_SELECT_SOURCE, VIDEO_SOURCE_HDMI);
fop(ioctl, VIDEO_PLAY);
fdd = true;
}
void cVideo::close_AVInput_Device(void)
{
hal_debug("%s\n", __func__);
if (fdd) {
fop(ioctl, VIDEO_STOP);
fop(ioctl, VIDEO_SELECT_SOURCE, VIDEO_SOURCE_DEMUX);
}
fdd = false;
}
void cVideo::setAVInput(int val)
{
hal_info("%s - switching to: %s\n", __func__, val == AUX ? "AUX" : "ENCODER");
if (val == AUX) {
setBlank(1);
open_AVInput_Device();
} else {
if (fdd) {
close_AVInput_Device();
setBlank(0);
}
}
#if 0 // not working
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);
}
#endif
}
cVideo::cVideo(int, void *, void *, unsigned int unit)
@@ -412,14 +458,19 @@ cVideo::cVideo(int, void *, void *, unsigned int unit)
} else
devnum = unit;
fd = -1;
fdd = false;
openDevice();
#if 0
setAVInput(ENCODER);
#endif
}
cVideo::~cVideo(void)
{
#if 0
if(fd >= 0)
setAVInput(AUX);
#endif
if (hdmi_cec::getInstance()->standby_cec_activ && fd >= 0)
hdmi_cec::getInstance()->SetCECState(true);
@@ -743,12 +794,16 @@ void cVideo::Standby(unsigned int bOn)
if (bOn)
{
closeDevice();
#if 0
setAVInput(AUX);
#endif
}
else
{
openDevice();
#if 0
setAVInput(ENCODER);
#endif
}
video_standby = bOn;
hdmi_cec::getInstance()->SetCECState(video_standby);

View File

@@ -161,6 +161,7 @@ class cVideo
private:
/* video device */
int fd;
bool fdd;
unsigned int devnum;
/* apparently we cannot query the driver's state
=> remember it */
@@ -195,7 +196,6 @@ class cVideo
/* used internally by dmx */
int64_t GetPTS(void);
public:
/* constructor & destructor */
cVideo(int mode, void *, void *, unsigned int unit = 0);
@@ -205,6 +205,11 @@ class cVideo
void openDevice(void);
void closeDevice(void);
void open_AVInput_Device(void);
void close_AVInput_Device(void);
void setAVInput(int val);
void * GetTVEnc() { return NULL; };
void * GetTVEncSD() { return NULL; };

View File

@@ -20,6 +20,11 @@
#include <linux/soundcard.h>
enum
{ ENCODER,
AUX
};
cAudio * audioDecoder = NULL;
cAudio::cAudio(void *, void *, void *)
@@ -75,6 +80,11 @@ void cAudio::closeDevice(void)
}
}
void cAudio::setAVInput(int val)
{
hal_info("%s not implemented yet - switching to: %s\n", __func__, val == AUX ? "AUX" : "ENCODER");
}
int cAudio::do_mute(bool enable, bool remember)
{
hal_debug("%s(%d, %d)\n", __FUNCTION__, enable, remember);

View File

@@ -52,6 +52,11 @@ class cAudio
cAudio(void *, void *, void *);
~cAudio(void);
void open_AVInput_Device(void) { return; };
void close_AVInput_Device(void) { return; };
void setAVInput(int val);
void *GetHandle() { return NULL; };
/* shut up */
int mute(bool remember = true) { return do_mute(true, remember); };

View File

@@ -65,6 +65,11 @@ extern "C"
_r; \
})
enum
{ ENCODER,
AUX
};
cVideo * videoDecoder = NULL;
cVideo * pipDecoder = NULL;
@@ -365,6 +370,19 @@ int image_to_mpeg2(const char *image_name, const char *encode_name)
return 0;
}
void cVideo::setAVInput(int val)
{
hal_info("%s not implemented yet - switching to: %s\n", __func__, val == AUX ? "SCART" : "ENCODER");
#if 0 // not working
int input_fd = open("/proc/stb/avs/0/input", O_WRONLY);
if(input_fd){
const char *input[] = {"encoder", "scart"};
write(input_fd, input[val], strlen(input[val]));
close(input_fd);
}
#endif
}
cVideo::cVideo(int, void *, void *, unsigned int unit)
{
hal_debug("%s unit %u\n", __func__, unit);

View File

@@ -128,7 +128,6 @@ typedef enum
VIDEO_CONTROL_MAX = VIDEO_CONTROL_SHARPNESS
} VIDEO_CONTROL;
class cVideo
{
friend class cPlayback;
@@ -157,6 +156,7 @@ class cVideo
int brightness, contrast, saturation, hue;
/* used internally by playback */
void openDevice(void);
void closeDevice(void);
public:
@@ -164,6 +164,11 @@ class cVideo
cVideo(int mode, void *, void *, unsigned int unit = 0);
~cVideo(void);
void open_AVInput_Device(void) { return; }; // Dummy
void close_AVInput_Device(void) { return; }; // Dummy
void setAVInput(int val);
void * GetTVEnc() { return NULL; };
void * GetTVEncSD() { return NULL; };