MythTV  master
vbi608extractor.h
Go to the documentation of this file.
1 /*
2  VBI 608 Extractor, extracts CEA-608 VBI from a line of raw data.
3  Copyright (C) 2010 Digital Nirvana, Inc.
4 
5  This program is free software; you can redistribute it and/or
6  modify it under the terms of the GNU General Public License
7  as published by the Free Software Foundation; either version 2
8  of the License, or (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program; if not, write to the Free Software
17  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 */
19 
20 #ifndef VBI_608_EXTRACTOR_H
21 #define VBI_608_EXTRACTOR_H
22 
23 #include <array>
24 #include <cstdint>
25 
26 #include <QList>
27 
28 #include "mythframe.h"
29 
30 using cc608_data = std::array<uint8_t,8>;
31 
33 {
34  public:
35  VBI608Extractor() = default;
36 
37  uint16_t GetCode1(void) const { return m_code[0]; }
38  uint16_t GetCode2(void) const { return m_code[1]; }
39 
40  bool ExtractCC(const MythVideoFrame *picframe, uint max_lines = 4);
41  bool ExtractCC12(const unsigned char *buf, uint width);
42  bool ExtractCC34(const unsigned char *buf, uint width);
43 
44  uint FillCCData(cc608_data &cc_data) const;
45 
46  private:
47  float GetClockStart(void) const { return m_start; }
48  float GetClockRate(void) const { return m_rate; }
49  bool FindClocks(const unsigned char *buf, uint width);
50 
51  QList<uint> m_rawMinimas;
52  QList<uint> m_rawMaximas;
53  QList<float> m_maximas;
54  QList<float> m_minimas;
55  float m_start {0.0F};
56  float m_rate {0.0F};
57  std::array<uint16_t,2> m_code {UINT16_MAX, UINT16_MAX};
58 };
59 
60 #endif // VBI_608_EXTRACTOR_H
VBI608Extractor::m_rawMinimas
QList< uint > m_rawMinimas
Definition: vbi608extractor.h:51
VBI608Extractor::GetClockRate
float GetClockRate(void) const
Definition: vbi608extractor.h:48
VBI608Extractor::GetClockStart
float GetClockStart(void) const
Definition: vbi608extractor.h:47
VBI608Extractor::ExtractCC
bool ExtractCC(const MythVideoFrame *picframe, uint max_lines=4)
Definition: vbi608extractor.cpp:257
VBI608Extractor::m_rate
float m_rate
Definition: vbi608extractor.h:56
VBI608Extractor::ExtractCC12
bool ExtractCC12(const unsigned char *buf, uint width)
Definition: vbi608extractor.cpp:320
VBI608Extractor
Definition: vbi608extractor.h:32
mythframe.h
VBI608Extractor::m_start
float m_start
Definition: vbi608extractor.h:55
VBI608Extractor::m_code
std::array< uint16_t, 2 > m_code
Definition: vbi608extractor.h:57
VBI608Extractor::m_maximas
QList< float > m_maximas
Definition: vbi608extractor.h:53
VBI608Extractor::m_minimas
QList< float > m_minimas
Definition: vbi608extractor.h:54
VBI608Extractor::FindClocks
bool FindClocks(const unsigned char *buf, uint width)
Definition: vbi608extractor.cpp:80
cc608_data
std::array< uint8_t, 8 > cc608_data
Definition: vbi608extractor.h:30
uint
unsigned int uint
Definition: compat.h:141
VBI608Extractor::VBI608Extractor
VBI608Extractor()=default
VBI608Extractor::GetCode1
uint16_t GetCode1(void) const
Definition: vbi608extractor.h:37
uint16_t
unsigned short uint16_t
Definition: iso6937tables.h:3
MythVideoFrame
Definition: mythframe.h:85
VBI608Extractor::GetCode2
uint16_t GetCode2(void) const
Definition: vbi608extractor.h:38
VBI608Extractor::FillCCData
uint FillCCData(cc608_data &cc_data) const
Definition: vbi608extractor.cpp:378
VBI608Extractor::m_rawMaximas
QList< uint > m_rawMaximas
Definition: vbi608extractor.h:52
VBI608Extractor::ExtractCC34
bool ExtractCC34(const unsigned char *buf, uint width)
Definition: vbi608extractor.cpp:350