73 lines
1.9 KiB
C++
73 lines
1.9 KiB
C++
/*
|
|
*******************************************************************************
|
|
* INCLUDE
|
|
*******************************************************************************
|
|
*/
|
|
#include "HDMIFrontend.h"
|
|
#include <unistd.h>
|
|
#include <fcntl.h>
|
|
#include <signal.h>
|
|
#include <iostream>
|
|
|
|
namespace Video
|
|
{
|
|
namespace ITE
|
|
{
|
|
/*
|
|
*******************************************************************************
|
|
* CLASS DEFINE
|
|
*******************************************************************************
|
|
*/
|
|
HDMIFrontend::HDMIFrontend(std::string device): Core::Frontend("HDMIFrontend"), _it66021(device), _path(device)
|
|
{
|
|
_hdmiInfo.have_audio = false;
|
|
_hdmiInfo.have_video = false;
|
|
|
|
_it66021.readInfo(_hdmiInfo);
|
|
|
|
_pollCancelled = false;
|
|
_pollThread.startFunc(
|
|
[&]() -> void
|
|
{
|
|
while (!_pollCancelled)
|
|
{
|
|
unsigned int revents = 0;
|
|
if (_it66021.poll(revents, 1000))
|
|
{
|
|
if (revents & POLLIN)
|
|
{
|
|
_it66021.readInfo(_hdmiInfo);
|
|
notifyStatusChanged();
|
|
}
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
HDMIFrontend::~HDMIFrontend()
|
|
{
|
|
if (_pollThread.isRunning())
|
|
{
|
|
_pollCancelled = true;
|
|
_pollThread.join();
|
|
}
|
|
}
|
|
|
|
void HDMIFrontend::read(MediaInfo& info)
|
|
{
|
|
info.haveVideo = _hdmiInfo.have_video;
|
|
info.haveAudio = _hdmiInfo.have_audio;
|
|
|
|
info.video.width = _hdmiInfo.hactive;
|
|
info.video.height = _hdmiInfo.vactive;
|
|
info.video.frameRate = _hdmiInfo.frame_rate;
|
|
|
|
if (_hdmiInfo.scanmode == 0)
|
|
info.video.scanMode = Core::VideoScanMode::PROGRESSIVE;
|
|
else
|
|
info.video.scanMode = Core::VideoScanMode::INTERLACED;
|
|
|
|
info.audio.sampleRate = _hdmiInfo.sample_rate;
|
|
}
|
|
}
|
|
}
|