MythTV master
mythdrmencoder.cpp
Go to the documentation of this file.
1// MythTV
3
10DRMEnc MythDRMEncoder::Create(int FD, uint32_t Id)
11{
12 if (FD && Id)
13 if (auto e = std::shared_ptr<MythDRMEncoder>(new MythDRMEncoder(FD, Id)); e.get() && e->m_id)
14 return e;
15
16 return nullptr;
17}
18
20{
21 auto match = [&Id](const auto & Enc) { return Enc->m_id == Id; };
22 if (auto found = std::find_if(Encoders.cbegin(), Encoders.cend(), match); found != Encoders.cend())
23 return *found;
24 return nullptr;
25}
26
28{
29 DRMEncs result;
30 if (auto resources = MythDRMResources(FD); *resources)
31 {
32 for (auto i = 0; i < resources->count_encoders; ++i)
33 if (auto encoder = Create(FD, resources->encoders[i]); encoder.get())
34 result.emplace_back(encoder);
35 }
36 return result;
37}
38
40{
41 if (auto * encoder = drmModeGetEncoder(FD, Id); encoder)
42 {
43 m_id = encoder->encoder_id;
44 m_type = encoder->encoder_type;
45 m_crtcId = encoder->crtc_id;
46 m_possibleCrtcs = encoder->possible_crtcs;
47 drmModeFreeEncoder(encoder);
48 }
49}
50
static DRMEncs GetEncoders(int FD)
uint32_t m_possibleCrtcs
MythDRMEncoder(int FD, uint32_t Id)
static DRMEnc Create(int FD, uint32_t Id)
static DRMEnc GetEncoder(const DRMEncs &Encoders, uint32_t Id)
uint32_t m_crtcId
A simple wrapper around a drmModeResPtr that ensures proper cleanup.
std::vector< uint32_t > Encoders
std::vector< DRMEnc > DRMEncs
Definition: mythdrmencoder.h:8
std::shared_ptr< class MythDRMEncoder > DRMEnc
Definition: mythdrmencoder.h:7