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