整理代码
This commit is contained in:
commit
c7b4e178ec
364 changed files with 59691 additions and 0 deletions
73
video/ite/HDMIFrontend.cpp
Normal file
73
video/ite/HDMIFrontend.cpp
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
/*
|
||||
*******************************************************************************
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue