MythTV  master
vbi.cpp
Go to the documentation of this file.
1 // POSIX headers
2 #include <unistd.h>
3 #include <fcntl.h>
4 
5 #include <sys/ioctl.h>
6 
7 // ANSI C++ headers
8 #include <cmath>
9 #include <cstdlib>
10 #include <cstring>
11 #include <cstdio>
12 #include <cstdarg>
13 
14 #ifdef USING_V4L2
15 #include <linux/videodev2.h>
16 #endif // USING_V4L2
17 
18 // vbitext headers
19 #include "vt.h"
20 #include "vbi.h"
21 #include "vbilut.h"
22 
23 #define FAC (1<<16) // factor for fix-point arithmetic
24 
25 static unsigned char *rawbuf = nullptr;// one common buffer for raw vbi data.
26 #ifdef USING_V4L2
27 static int rawbuf_size; // its current size
28 #endif // USING_V4L2
29 
30 /***** bttv api *****/
31 #define BTTV_VBISIZE _IOR('v' , BASE_VIDIOCPRIVATE+8, int)
32 
33 
34 static void
35 error(const char *str, ...)
36 {
37  va_list ap;
38 
39  va_start(ap, str);
40  vfprintf(stderr, str, ap);
41  fprintf(stderr, "\n");
42  va_end(ap);
43 }
44 
45 
46 static int
47 chk_parity(uint8_t *p, int n)
48 {
49  int err = 0;
50 
51  for (err = 0; n--; p++)
52  {
53  if (hamm24par[0][*p] & 32)
54  *p &= 0x7f;
55  else
56  *p = BAD_CHAR, err++;
57  }
58  return err;
59 }
60 
61 static void
63 {
64  int i = 0;
65 
66  // discard all in progress pages
67  for (i = 0; i < 8; ++i)
68  vbi->rpage[i].page->flags &= ~PG_ACTIVE;
69 }
70 
71 
72 // send an event to all clients
73 
74 static void
75 vbi_send(struct vbi *vbi, int type, int i1, int i2, int i3, void *p1)
76 {
77  struct vt_event ev {};
78  struct vbi_client *cl = nullptr;
79  struct vbi_client *cln = nullptr;
80 
81  ev.resource = vbi;
82  ev.type = type;
83  ev.i1 = i1;
84  ev.i2 = i2;
85  ev.i3 = i3;
86  ev.p1 = p1;
87 
88  for (cl = static_cast<vbi_client *>((void*)vbi->clients[0].first);
89  (cln = static_cast<vbi_client *>((void*)cl->node->next)) != nullptr;
90  cl = cln)
91  cl->handler(cl->data, &ev);
92 }
93 
94 static void
95 vbi_send_page(struct vbi *vbi, struct raw_page *rvtp, int page)
96 {
97  if (rvtp->page->flags & PG_ACTIVE)
98  {
99  if (rvtp->page->pgno % 256 != page)
100  {
101  struct vt_page *cvtp = nullptr;
102  rvtp->page->flags &= ~PG_ACTIVE;
103  do_enhancements(rvtp->enh, rvtp->page);
104 // if (vbi->cache)
105 // cvtp = vbi->cache->op->put(vbi->cache, rvtp->page);
106  vbi_send(vbi, EV_PAGE, 0, 0, 0, cvtp ?: rvtp->page);
107  }
108  }
109 }
110 
111 // fine tune pll
112 // this routines tries to adjust the sampling point of the decoder.
113 // it collects parity and hamming errors and moves the sampling point
114 // a 10th of a bitlength left or right.
115 
116 #define PLL_SAMPLES 4 // number of err vals to collect
117 #define PLL_ERROR 4 // if this err val is crossed, readjust
118 //#define PLL_ADJUST 4 // max/min adjust (10th of bitlength)
119 
120 static void
121 pll_add(struct vbi *vbi, int n, int err)
122 {
123  if (vbi->pll_fixed)
124  return;
125 
126  if (err > PLL_ERROR*2/3) // limit burst errors
127  err = PLL_ERROR*2/3;
128 
129  vbi->pll_err += err;
130  vbi->pll_cnt += n;
131  if (vbi->pll_cnt < PLL_SAMPLES)
132  return;
133 
134  if (vbi->pll_err > PLL_ERROR)
135  {
136  if (vbi->pll_err > vbi->pll_lerr)
137  vbi->pll_dir = -vbi->pll_dir;
138  vbi->pll_lerr = vbi->pll_err;
139 
140  vbi->pll_adj += vbi->pll_dir;
141  if (vbi->pll_adj < -PLL_ADJUST || vbi->pll_adj > PLL_ADJUST)
142  {
143  vbi->pll_adj = 0;
144  vbi->pll_dir = -1;
145  vbi->pll_lerr = 0;
146  }
147 
148 #ifdef DEBUG
149  printf("pll_adj = %2d\n", vbi->pll_adj);
150 #endif
151  }
152  vbi->pll_cnt = 0;
153  vbi->pll_err = 0;
154 }
155 
156 void
157 vbi_pll_reset(struct vbi *vbi, int fine_tune)
158 {
159  vbi->pll_fixed = static_cast<int>(fine_tune >= -PLL_ADJUST && fine_tune <= PLL_ADJUST);
160 
161  vbi->pll_err = 0;
162  vbi->pll_lerr = 0;
163  vbi->pll_cnt = 0;
164  vbi->pll_dir = -1;
165  vbi->pll_adj = 0;
166  if (vbi->pll_fixed)
167  vbi->pll_adj = fine_tune;
168 #ifdef DEBUG
169  if (vbi->pll_fixed)
170  printf("pll_reset (fixed@%d)\n", vbi->pll_adj);
171  else
172  printf("pll_reset (auto)\n");
173 #endif
174 }
175 
176 // process one videotext packet
177 
178 static int
179 vt_line(struct vbi *vbi, unsigned char *p)
180 {
181  struct vt_page *cvtp = nullptr;
182  struct raw_page *rvtp = nullptr;
183  int err = 0;
184 
185  int hdr = hamm16(p, &err);
186  if (err & 0xf000)
187  return -4;
188 
189  int mag = hdr & 7;
190  int mag8 = mag?: 8;
191  int pkt = (hdr >> 3) & 0x1f;
192  p += 2;
193 
194  rvtp = vbi->rpage + mag;
195  cvtp = rvtp->page;
196 
197  switch (pkt)
198  {
199  case 0:
200  {
201  int b1 = hamm16(p, &err); // page number
202  int b2 = hamm16(p+2, &err); // subpage number + flags
203  int b3 = hamm16(p+4, &err); // subpage number + flags
204  int b4 = hamm16(p+6, &err); // language code + more flags
205 
206  if (vbi->ppage->page->flags & PG_MAGSERIAL)
207  vbi_send_page(vbi, vbi->ppage, b1);
208  vbi_send_page(vbi, rvtp, b1);
209 
210  if (err & 0xf000)
211  return 4;
212 
213  cvtp->errors = (err >> 8) + chk_parity(p + 8, 32);;
214  cvtp->pgno = mag8 * 256 + b1;
215  cvtp->subno = (b2 + b3 * 256) & 0x3f7f;
216  cvtp->lang = "\0\4\2\6\1\5\3\7"[b4 >> 5] + (isLatin1 ? 0 : 8);
217  cvtp->flags = b4 & 0x1f;
218  cvtp->flags |= b3 & 0xc0;
219  cvtp->flags |= (b2 & 0x80) >> 2;
220  cvtp->lines = 1;
221  cvtp->flof = 0;
222  vbi->ppage = rvtp;
223 
224  pll_add(vbi, 1, cvtp->errors);
225 
226  conv2latin(p + 8, 32, cvtp->lang);
227  vbi_send(vbi, EV_HEADER, cvtp->pgno, cvtp->subno, cvtp->flags, p);
228 
229  if (b1 == 0xff)
230  return 0;
231 
232  cvtp->flags |= PG_ACTIVE;
233  init_enhance(rvtp->enh);
234  memcpy(cvtp->data[0]+0, p, 40);
235  memset(cvtp->data[0]+40, ' ', sizeof(cvtp->data)-40);
236  return 0;
237  }
238 
239  case 1 ... 24:
240  {
241  pll_add(vbi, 1, err = chk_parity(p, 40));
242 
243  if (~cvtp->flags & PG_ACTIVE)
244  return 0;
245 
246  cvtp->errors += err;
247  cvtp->lines |= 1 << pkt;
248  conv2latin(p, 40, cvtp->lang);
249  memcpy(cvtp->data[pkt], p, 40);
250  return 0;
251  }
252  case 26:
253  {
254  if (~cvtp->flags & PG_ACTIVE)
255  return 0;
256 
257  int d = hamm8(p, &err);
258  if (err & 0xf000)
259  return 4;
260 
261  std::array<unsigned int,13> t {};
262  for (int i = 0; i < 13; ++i)
263  t[i] = hamm24(p + 1 + 3*i, &err);
264  if (err & 0xf000)
265  return 4;
266 
267  //printf("enhance on %x/%x\n", cvtp->pgno, cvtp->subno);
268  add_enhance(rvtp->enh, d, t);
269  return 0;
270  }
271  case 27:
272  {
273  // FLOF data (FastText)
274  if (~cvtp->flags & PG_ACTIVE)
275  return 0; // -1 flushes all pages. we may never resync again :(
276 
277  int b1 = hamm8(p, &err);
278  int b2 = hamm8(p + 37, &err);
279  if (err & 0xf000)
280  return 4;
281  if (b1 != 0 || !(b2 & 8))
282  return 0;
283 
284  for (int i = 0; i < 6; ++i)
285  {
286  err = 0;
287  b1 = hamm16(p+1+6*i, &err);
288  b2 = hamm16(p+3+6*i, &err);
289  int b3 = hamm16(p+5+6*i, &err);
290  if (err & 0xf000)
291  return 1;
292  int x = (b2 >> 7) | ((b3 >> 5) & 0x06);
293  cvtp->link[i].pgno = ((mag ^ x) ?: 8) * 256 + b1;
294  cvtp->link[i].subno = (b2 + b3 * 256) & 0x3f7f;
295  }
296  cvtp->flof = 1;
297  return 0;
298  }
299  case 30:
300  {
301  if (mag8 != 8)
302  return 0;
303 
304  p[0] = hamm8(p, &err); // designation code
305  p[1] = hamm16(p+1, &err); // initial page
306  p[3] = hamm16(p+3, &err); // initial subpage + mag
307  p[5] = hamm16(p+5, &err); // initial subpage + mag
308  if (err & 0xf000)
309  return 4;
310 
311  err += chk_parity(p+20, 20);
312  conv2latin(p+20, 20, 0);
313 
314  vbi_send(vbi, EV_XPACKET, mag8, pkt, err, p);
315  return 0;
316  }
317  default:
318  // unused at the moment...
319  //vbi_send(vbi, EV_XPACKET, mag8, pkt, err, p);
320  return 0;
321  }
322  return 0;
323 }
324 
325 
326 
327 // process one raw vbi line
328 
329 static int
330 vbi_line(struct vbi *vbi, const unsigned char *p)
331 {
332  std::array<unsigned char,43> data {};
333  std::array<int,2566> dt {};
334  std::array<int,6> hi {};
335  std::array<int,6> lo {};
336  int i = 0;
337  int n = 0;
338  int bpb = vbi->bpb;
339 
340  /* remove DC. edge-detector */
341  for (i = vbi->soc; i < vbi->eoc; ++i)
342  dt[i] = p[i+bpb/FAC] - p[i]; // amplifies the edges best.
343 
344  /* set barrier */
345  for (i = vbi->eoc; i < vbi->eoc+16; i += 2)
346  dt[i] = 100, dt[i+1] = -100;
347 
348  /* find 6 rising and falling edges */
349  for (i = vbi->soc, n = 0; n < 6; ++n)
350  {
351  while (dt[i] < 32)
352  i++;
353  hi[n] = i;
354  while (dt[i] > -32)
355  i++;
356  lo[n] = i;
357  }
358  if (i >= vbi->eoc)
359  return -1; // not enough periods found
360 
361  i = hi[5] - hi[1]; // length of 4 periods (8 bits)
362  if (i < vbi->bp8bl || i > vbi->bp8bh)
363  return -1; // bad frequency
364 
365  /* AGC and sync-reference */
366  unsigned char min = 255;
367  unsigned char max = 0;
368  int sync = 0;
369  for (i = hi[4]; i < hi[5]; ++i)
370  if (p[i] > max)
371  max = p[i], sync = i;
372  for (i = lo[4]; i < lo[5]; ++i)
373  if (p[i] < min)
374  min = p[i];
375  int thr = (min + max) / 2;
376 
377  p += sync;
378 
379  /* search start-byte 11100100 */
380  for (i = 4*bpb + vbi->pll_adj*bpb/10; i < 16*bpb; i += bpb)
381  {
382  if (p[i/FAC] > thr && p[(i+bpb)/FAC] > thr) // two ones is enough...
383  {
384  /* got it... */
385  data.fill(0);
386 
387  for (n = 0; n < 43*8; ++n, i += bpb)
388  if (p[i/FAC] > thr)
389  data[n/8] |= 1 << (n%8);
390 
391  if (data[0] != 0x27) // really 11100100? (rev order!)
392  return -1;
393 
394  if ((i = vt_line(vbi, data.data()+1)))
395  {
396  if (i < 0)
397  pll_add(vbi, 2, -i);
398  else
399  pll_add(vbi, 1, i);
400  }
401  return 0;
402  }
403  }
404  return -1;
405 }
406 
407 
408 
409 // called when new vbi data is waiting
410 
411 void
412 vbi_handler(struct vbi *vbi, int fd)
413 {
414  int n = 0;
415  unsigned int seq = 0;
416 
417  (void)fd;
418 
419  n = read(vbi->fd, rawbuf, vbi->bufsize);
420 
421  if (dl_empty(vbi->clients))
422  return;
423 
424  if (n != vbi->bufsize)
425  return;
426 
427  seq = *(unsigned int *)&rawbuf[n - 4];
428  if (vbi->seq+1 != seq)
429  {
430  out_of_sync(vbi);
431  if (seq < 3 && vbi->seq >= 3)
432  vbi_reset(vbi);
433  }
434  vbi->seq = seq;
435 
436  if (seq > 1) // the first may contain data from prev channel
437  {
438 #if 1
439  for (int i = 0; i+vbi->bpl <= n; i += vbi->bpl)
440  vbi_line(vbi, rawbuf + i);
441 #else
442  /* work-around for old saa7134 driver versions (prior 0.2.6) */
443  for (int i = 16 * vbi->bpl; i + vbi->bpl <= n; i += vbi->bpl)
444  vbi_line(vbi, rawbuf + i);
445 
446  for (int i = 0; i + vbi->bpl <= 16 * vbi->bpl; i += vbi->bpl)
447  vbi_line(vbi, rawbuf + i);
448 #endif
449  }
450 }
451 
452 
453 
454 int
455 vbi_add_handler(struct vbi *vbi, vbic_handler handler, void *data)
456 {
457  struct vbi_client *cl = nullptr;
458 
459  if (!(cl = new struct vbi_client))
460  return -1;
461  cl->handler = handler;
462  cl->data = data;
463  // cl is not leaking, the first struct element has the same address
464  // as the struct
466  return 0;
467 }
468 
469 
470 
471 void
473 {
474  struct vbi_client *cl = nullptr;
475 
476  for (cl = static_cast<vbi_client*>((void*)vbi->clients->first);
477  cl->node->next != nullptr;
478  cl = static_cast<vbi_client*>((void*)cl->node->next))
479  {
480  if (cl->handler == handler && cl->data == data)
481  {
482  dl_remove(cl->node);
483  delete cl;
484  break;
485  }
486  }
487 }
488 
489 #ifdef USING_V4L2
490 static int
491 set_decode_parms(struct vbi *vbi, struct v4l2_vbi_format *p)
492 {
493  if (p->sample_format != V4L2_PIX_FMT_GREY)
494  {
495  fprintf(stderr, "got pix fmt %x\n", p->sample_format);
496  error("v4l2: unsupported vbi data format");
497  return -1;
498  }
499 
500  // some constants from the standard:
501  // horizontal frequency fh = 15625Hz
502  // teletext bitrate ft = 444*fh = 6937500Hz
503  // teletext identification sequence 10101010 10101010 11100100
504  // 13th bit of seq rel to falling hsync 12us -1us +0.4us
505  // I search for the clock run-in (10101010 10101010) from 12us-1us-12.5/ft
506  // (earliest first bit) to 12us+0.4us+3.5/ft (latest last bit)
507  // earlist first bit tf = 12us-1us-12.5/ft = 9.2us
508  // latest last bit tl = 12us+0.4us+3.5/ft = 12.9us
509  // total number of used bits n = (2+1+2+40)*8 = 360
510 
511  int bpl = p->samples_per_line; // bytes per line
512  double fs = p->sampling_rate; // sampling rate
513  double bpb = fs/6937500.0; // bytes per bit
514  int soc = (int)(9.2e-6*fs) - (int)p->offset; // start of clock run-in
515  int eoc = (int)(12.9e-6*fs) - (int)p->offset; // end of clock run-in
516  if (soc < 0)
517  soc = 0;
518  if (eoc > bpl - (int)(43*8*bpb))
519  eoc = bpl - (int)(43*8*bpb);
520  if (eoc - soc < (int)(16*bpb))
521  {
522  // line too short or offset too large or wrong sample_rate
523  error("v4l2: broken vbi format specification");
524  return -1;
525  }
526  if (eoc > 240)
527  {
528  // the vbi_line routine can hold max 240 values in its work buffer
529  error("v4l2: unable to handle these sampling parameters");
530  return -1;
531  }
532 
533  vbi->bpb = lround(bpb * FAC);
534  vbi->soc = soc;
535  vbi->eoc = eoc;
536  vbi->bp8bl = 0.97 * 8*bpb; // -3% tolerance
537  vbi->bp8bh = 1.03 * 8*bpb; // +3% tolerance
538 
539  vbi->bpl = bpl;
540  vbi->bufsize = bpl * (p->count[0] + p->count[1]);
541 
542  return 0;
543 }
544 #endif // USING_V4L2
545 
546 static int
547 setup_dev(struct vbi *vbi)
548 {
549 #ifdef USING_V4L2
550  struct v4l2_format v4l2_format {};
551  struct v4l2_vbi_format *vbifmt = &v4l2_format.fmt.vbi;
552 
553  memset(&v4l2_format, 0, sizeof(v4l2_format));
554  v4l2_format.type = V4L2_BUF_TYPE_VBI_CAPTURE;
555  if (ioctl(vbi->fd, VIDIOC_G_FMT, &v4l2_format) == -1)
556  {
557  error("Video 4 Linux version 1 support is not enabled.");
558  return -1;
559  }
560 
561  if (set_decode_parms(vbi, vbifmt) == -1)
562  return -1;
563 
564  if (vbi->bpl < 1 || vbi->bufsize < vbi->bpl || vbi->bufsize % vbi->bpl != 0)
565  {
566  error("strange size of vbi buffer (%d/%d)", vbi->bufsize, vbi->bpl);
567  return -1;
568  }
569 
570  // grow buffer if necessary
571  if (rawbuf_size < vbi->bufsize)
572  {
573  delete [] rawbuf;
575  if (!(rawbuf = new u_char[rawbuf_size]))
576  {
577  error("unable to allocate in setup_dev()\n");
578  }
579  }
580 
581  return 0;
582 #else
583  (void)vbi;
584  return -1;
585 #endif // USING_V4L2
586 }
587 
588 
589 
590 struct vbi *
591 vbi_open(const char *vbi_dev_name, struct cache *ca, int fine_tune, int big_buf)
592 {
593  static int s_inited = 0;
594  struct vbi *vbi = nullptr;
595 
596  (void)ca;
597 
598  if (! s_inited)
599  lang_init();
600  s_inited = 1;
601 
602  vbi = new struct vbi;
603  if (vbi == nullptr)
604  {
605  error("out of memory");
606  goto fail1;
607  }
608 
609  if ((vbi->fd = open(vbi_dev_name, O_RDONLY)) == -1)
610  {
611  error("cannot open vbi device");
612  goto fail2;
613  }
614 
615  if (big_buf != -1)
616  error("-oldbttv/-newbttv is obsolete. option ignored.");
617 
618  if (setup_dev(vbi) == -1)
619  goto fail3;
620 
621 // vbi->cache = ca;
622 
623  dl_init(vbi->clients);
624  vbi->seq = 0;
625  out_of_sync(vbi);
626  vbi->ppage = vbi->rpage;
627 
628  vbi_pll_reset(vbi, fine_tune);
629 // ECA removed fdset_add_fd(fds, vbi->fd, vbi_handler, vbi);
630  return vbi;
631 
632 fail3:
633  close(vbi->fd);
634 fail2:
635  delete vbi;
636 fail1:
637  return nullptr;
638 }
639 
640 
641 
642 void
643 vbi_close(struct vbi *vbi)
644 {
645 // fdset_del_fd(fds, vbi->fd);
646 // if (vbi->cache)
647 // vbi->cache->op->close(vbi->cache);
648  close(vbi->fd);
649  delete vbi;
650 }
651 
652 
653 struct vt_page *
654 vbi_query_page(struct vbi *vbi, int pgno, int subno)
655 {
656 #ifdef IMPLEMENTED
657  struct vt_page *vtp = 0;
658 
659  (void)pgno;
660  (void)subno;
661 
662  if (vbi->cache)
663  vtp = vbi->cache->op->get(vbi->cache, pgno, subno);
664  if (vtp == 0)
665  {
666  // EV_PAGE will come later...
667  return 0;
668  }
669 
670  vbi_send(vbi, EV_PAGE, 1, 0, 0, vtp);
671  return vtp;
672 #else
673  (void)vbi;
674  (void)pgno;
675  (void)subno;
676  return nullptr;
677 #endif
678 }
679 
680 void
681 vbi_reset(struct vbi *vbi)
682 {
683 // if (vbi->cache)
684 // vbi->cache->op->reset(vbi->cache);
685  vbi_send(vbi, EV_RESET, 0, 0, 0, nullptr);
686 }
687 
hamm24par
const std::array< const std::array< const uint8_t, 256 >, 3 > hamm24par
This table generates the parity checks for hamm24/18 decoding.
Definition: vbilut.cpp:213
vt_event::i2
int i2
Definition: vt.h:12
vbi.h
vt.h
error
static void error(const char *str,...)
Definition: vbi.cpp:35
vbi_send
static void vbi_send(struct vbi *vbi, int type, int i1, int i2, int i3, void *p1)
Definition: vbi.cpp:75
vbi
Definition: vbi.h:17
vbi::pll_err
int pll_err
Definition: vbi.h:34
vbi::clients
struct dl_head clients[1]
Definition: vbi.h:21
setup_dev
static int setup_dev(struct vbi *vbi)
Definition: vbi.cpp:547
vt_page::flags
int flags
Definition: vt.h:40
discid.disc.read
def read(device=None, features=[])
Definition: disc.py:35
vt_page::link
struct vt_page::@69 link[6]
isLatin1
int isLatin1
Definition: lang.cpp:6
vbi_query_page
struct vt_page * vbi_query_page(struct vbi *vbi, int pgno, int subno)
Definition: vbi.cpp:654
vbi_line
static int vbi_line(struct vbi *vbi, const unsigned char *p)
Definition: vbi.cpp:330
vt_page::subno
int subno
Definition: vt.h:38
vt_event::i1
int i1
Definition: vt.h:12
dl_head::first
struct dl_node * first
Definition: dllist.h:16
PLL_SAMPLES
#define PLL_SAMPLES
Definition: vbi.cpp:116
vbi::pll_dir
int pll_dir
Definition: vbi.h:32
vbi::pll_adj
int pll_adj
Definition: vbi.h:31
vt_page
Definition: vt.h:36
vt_line
static int vt_line(struct vbi *vbi, unsigned char *p)
Definition: vbi.cpp:179
BAD_CHAR
#define BAD_CHAR
Definition: vt.h:6
PLL_ADJUST
#define PLL_ADJUST
Definition: vbi.h:9
vbi_close
void vbi_close(struct vbi *vbi)
Definition: vbi.cpp:643
vt_event::i3
int i3
Definition: vt.h:12
vbi_handler
void vbi_handler(struct vbi *vbi, int fd)
Definition: vbi.cpp:412
vbi::ppage
struct raw_page * ppage
Definition: vbi.h:28
close
#define close
Definition: compat.h:17
EV_XPACKET
#define EV_XPACKET
Definition: vt.h:22
raw_page::enh
struct enhance enh[1]
Definition: vbi.h:14
vbi_pll_reset
void vbi_pll_reset(struct vbi *vbi, int fine_tune)
Definition: vbi.cpp:157
rawbuf_size
static int rawbuf_size
Definition: vbi.cpp:27
vbi::bpb
int bpb
Definition: vbi.h:36
do_enhancements
void do_enhancements(struct enhance *eh, struct vt_page *vtp)
Definition: lang.cpp:145
vt_page::errors
int errors
Definition: vt.h:41
dl_remove
static struct dl_node * dl_remove(struct dl_node *n)
Definition: dllist.h:31
vbi_client::data
void * data
Definition: vbi.h:47
vbilut.h
out_of_sync
static void out_of_sync(struct vbi *vbi)
Definition: vbi.cpp:62
vbi::bpl
int bpl
Definition: vbi.h:24
dl_node::next
struct dl_node * next
Definition: dllist.h:10
hardwareprofile.config.p
p
Definition: config.py:33
hardwareprofile.i18n.t
t
Definition: i18n.py:36
conv2latin
void conv2latin(unsigned char *p, int n, int lang)
Definition: lang.cpp:106
vt_page::flof
int flof
Definition: vt.h:44
vbi_send_page
static void vbi_send_page(struct vbi *vbi, struct raw_page *rvtp, int page)
Definition: vbi.cpp:95
chk_parity
static int chk_parity(uint8_t *p, int n)
Definition: vbi.cpp:47
vt_event::type
int type
Definition: vt.h:10
vbi::eoc
int eoc
Definition: vbi.h:38
init_enhance
void init_enhance(struct enhance *eh)
Definition: lang.cpp:127
vbi::bp8bh
int bp8bh
Definition: vbi.h:37
vbi::bufsize
int bufsize
Definition: vbi.h:23
lang_init
void lang_init(void)
Definition: lang.cpp:95
rawbuf
static unsigned char * rawbuf
Definition: vbi.cpp:25
vbi_add_handler
int vbi_add_handler(struct vbi *vbi, vbic_handler handler, void *data)
Definition: vbi.cpp:455
p1
static guint32 * p1
Definition: goom_core.cpp:31
vbi::pll_fixed
int pll_fixed
Definition: vbi.h:30
hamm8
int hamm8(const uint8_t *p, int *err)
Definition: vbilut.cpp:326
vbi_reset
void vbi_reset(struct vbi *vbi)
Definition: vbi.cpp:681
vbi::pll_cnt
int pll_cnt
Definition: vbi.h:33
vbi::seq
unsigned int seq
Definition: vbi.h:25
EV_HEADER
#define EV_HEADER
Definition: vt.h:21
dl_insert_last
#define dl_insert_last(h, n)
Definition: dllist.h:52
vt_page::lines
unsigned int lines
Definition: vt.h:42
pll_add
static void pll_add(struct vbi *vbi, int n, int err)
Definition: vbi.cpp:121
set_decode_parms
static int set_decode_parms(struct vbi *vbi, struct v4l2_vbi_format *p)
Definition: vbi.cpp:491
vbi::rpage
struct raw_page rpage[8]
Definition: vbi.h:27
vt_event::resource
void * resource
Definition: vt.h:11
PG_MAGSERIAL
#define PG_MAGSERIAL
Definition: vt.h:55
EV_PAGE
#define EV_PAGE
Definition: vt.h:20
vbi::pll_lerr
int pll_lerr
Definition: vbi.h:34
ttvdb.stderr
stderr
Definition: ttvdb.py:1426
PG_ACTIVE
#define PG_ACTIVE
Definition: vt.h:60
vbi_client::handler
vbic_handler handler
Definition: vbi.h:46
dl_init
static struct dl_head * dl_init(struct dl_head *h)
Definition: dllist.h:22
raw_page
Definition: vbi.h:11
vbi::cache
struct cache * cache
Definition: vbi.h:20
d
static const iso6937table * d
Definition: iso6937tables.cpp:1025
vbi_client::node
struct dl_node node[1]
Definition: vbi.h:45
vbi::soc
int soc
Definition: vbi.h:38
vbi_client
Definition: vbi.h:43
vbi_del_handler
void vbi_del_handler(struct vbi *vbi, vbic_handler handler, void *data)
Definition: vbi.cpp:472
FAC
#define FAC
Definition: vbi.cpp:23
vt_event
Definition: vt.h:8
vt_page::data
unsigned char data[VT_HEIGHT][VT_WIDTH]
Definition: vt.h:43
vbi_open
struct vbi * vbi_open(const char *vbi_dev_name, struct cache *ca, int fine_tune, int big_buf)
Definition: vbi.cpp:591
PLL_ERROR
#define PLL_ERROR
Definition: vbi.cpp:117
vbi::fd
int fd
Definition: vbi.h:19
vt_event::p1
void * p1
Definition: vt.h:13
add_enhance
void add_enhance(struct enhance *eh, int dcode, std::array< unsigned int, 13 > &data)
Definition: lang.cpp:133
EV_RESET
#define EV_RESET
Definition: vt.h:23
vt_page::pgno
int pgno
Definition: vt.h:38
vbi::bp8bl
int bp8bl
Definition: vbi.h:37
vbic_handler
void(*)(void *data, struct vt_event *ev) vbic_handler
Definition: vbi.h:41
vt_page::lang
int lang
Definition: vt.h:39
hamm16
int hamm16(const uint8_t *p, int *err)
Definition: vbilut.cpp:343
raw_page::page
struct vt_page page[1]
Definition: vbi.h:13
hamm24
int hamm24(const uint8_t *p, int *err)
Definition: vbilut.cpp:352
dl_empty
#define dl_empty(h)
Definition: dllist.h:48