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  return 0;
474 }
475 
476 
477 
478 void
480 {
481  struct vbi_client *cl = nullptr;
482 
483  for (cl = static_cast<vbi_client*>((void*)vbi->clients->first);
484  cl->node->next != nullptr;
485  cl = static_cast<vbi_client*>((void*)cl->node->next))
486  {
487  if (cl->handler == handler && cl->data == data)
488  {
489  dl_remove(cl->node);
490  delete cl;
491  break;
492  }
493  }
494 }
495 
496 #ifdef USING_V4L2
497 static int
498 set_decode_parms(struct vbi *vbi, struct v4l2_vbi_format *p)
499 {
500  if (p->sample_format != V4L2_PIX_FMT_GREY)
501  {
502  fprintf(stderr, "got pix fmt %x\n", p->sample_format);
503  error("v4l2: unsupported vbi data format");
504  return -1;
505  }
506 
507  // some constants from the standard:
508  // horizontal frequency fh = 15625Hz
509  // teletext bitrate ft = 444*fh = 6937500Hz
510  // teletext identification sequence 10101010 10101010 11100100
511  // 13th bit of seq rel to falling hsync 12us -1us +0.4us
512  // I search for the clock run-in (10101010 10101010) from 12us-1us-12.5/ft
513  // (earliest first bit) to 12us+0.4us+3.5/ft (latest last bit)
514  // earlist first bit tf = 12us-1us-12.5/ft = 9.2us
515  // latest last bit tl = 12us+0.4us+3.5/ft = 12.9us
516  // total number of used bits n = (2+1+2+40)*8 = 360
517 
518  int bpl = p->samples_per_line; // bytes per line
519  double fs = p->sampling_rate; // sampling rate
520  double bpb = fs/6937500.0; // bytes per bit
521  int soc = (int)(9.2e-6*fs) - (int)p->offset; // start of clock run-in
522  int eoc = (int)(12.9e-6*fs) - (int)p->offset; // end of clock run-in
523  if (soc < 0)
524  soc = 0;
525  if (eoc > bpl - (int)(43*8*bpb))
526  eoc = bpl - (int)(43*8*bpb);
527  if (eoc - soc < (int)(16*bpb))
528  {
529  // line too short or offset too large or wrong sample_rate
530  error("v4l2: broken vbi format specification");
531  return -1;
532  }
533  if (eoc > 240)
534  {
535  // the vbi_line routine can hold max 240 values in its work buffer
536  error("v4l2: unable to handle these sampling parameters");
537  return -1;
538  }
539 
540  vbi->bpb = lround(bpb * FAC);
541  vbi->soc = soc;
542  vbi->eoc = eoc;
543  vbi->bp8bl = 0.97 * 8*bpb; // -3% tolerance
544  vbi->bp8bh = 1.03 * 8*bpb; // +3% tolerance
545 
546  vbi->bpl = bpl;
547  vbi->bufsize = bpl * (p->count[0] + p->count[1]);
548 
549  return 0;
550 }
551 #endif // USING_V4L2
552 
553 static int
554 setup_dev(struct vbi *vbi)
555 {
556 #ifdef USING_V4L2
557  struct v4l2_format v4l2_format {};
558  struct v4l2_vbi_format *vbifmt = &v4l2_format.fmt.vbi;
559 
560  memset(&v4l2_format, 0, sizeof(v4l2_format));
561  v4l2_format.type = V4L2_BUF_TYPE_VBI_CAPTURE;
562  if (ioctl(vbi->fd, VIDIOC_G_FMT, &v4l2_format) == -1)
563  {
564 #ifdef USING_V4L1
565  // not a v4l2 device. assume bttv and create a standard fmt-struct.
566  int size;
567  perror("ioctl VIDIOC_G_FMT");
568 
569  vbifmt->sample_format = V4L2_PIX_FMT_GREY;
570  vbifmt->sampling_rate = 35468950;
571  vbifmt->samples_per_line = 2048;
572  vbifmt->offset = 244;
573  if ((size = ioctl(vbi->fd, BTTV_VBISIZE, 0)) == -1)
574  {
575  // BSD or older bttv driver.
576  vbifmt->count[0] = 16;
577  vbifmt->count[1] = 16;
578  }
579  else if (size % 2048)
580  {
581  error("broken bttv driver (bad buffer size)");
582  return -1;
583  }
584  else
585  {
586  size /= 2048;
587  vbifmt->count[0] = size/2;
588  vbifmt->count[1] = size - size/2;
589  }
590 #else
591  error("Video 4 Linux version 1 support is not enabled.");
592  return -1;
593 #endif
594  }
595 
596  if (set_decode_parms(vbi, vbifmt) == -1)
597  return -1;
598 
599  if (vbi->bpl < 1 || vbi->bufsize < vbi->bpl || vbi->bufsize % vbi->bpl != 0)
600  {
601  error("strange size of vbi buffer (%d/%d)", vbi->bufsize, vbi->bpl);
602  return -1;
603  }
604 
605  // grow buffer if necessary
606  if (rawbuf_size < vbi->bufsize)
607  {
608  delete [] rawbuf;
610  if (!(rawbuf = new u_char[rawbuf_size]))
611  {
612  error("unable to allocate in setup_dev()\n");
613  }
614  }
615 
616  return 0;
617 #else
618  (void)vbi;
619  return -1;
620 #endif // USING_V4L2
621 }
622 
623 
624 
625 struct vbi *
626 vbi_open(const char *vbi_dev_name, struct cache *ca, int fine_tune, int big_buf)
627 {
628  static int s_inited = 0;
629  struct vbi *vbi = nullptr;
630 
631  (void)ca;
632 
633  if (! s_inited)
634  lang_init();
635  s_inited = 1;
636 
637  vbi = new struct vbi;
638  if (vbi == nullptr)
639  {
640  error("out of memory");
641  goto fail1;
642  }
643 
644  if ((vbi->fd = open(vbi_dev_name, O_RDONLY)) == -1)
645  {
646  error("cannot open vbi device");
647  goto fail2;
648  }
649 
650  if (big_buf != -1)
651  error("-oldbttv/-newbttv is obsolete. option ignored.");
652 
653  if (setup_dev(vbi) == -1)
654  goto fail3;
655 
656 // vbi->cache = ca;
657 
658  dl_init(vbi->clients);
659  vbi->seq = 0;
660  out_of_sync(vbi);
661  vbi->ppage = vbi->rpage;
662 
663  vbi_pll_reset(vbi, fine_tune);
664 // ECA removed fdset_add_fd(fds, vbi->fd, vbi_handler, vbi);
665  return vbi;
666 
667 fail3:
668  close(vbi->fd);
669 fail2:
670  delete vbi;
671 fail1:
672  return nullptr;
673 }
674 
675 
676 
677 void
678 vbi_close(struct vbi *vbi)
679 {
680 // fdset_del_fd(fds, vbi->fd);
681 // if (vbi->cache)
682 // vbi->cache->op->close(vbi->cache);
683  close(vbi->fd);
684  delete vbi;
685 }
686 
687 
688 struct vt_page *
689 vbi_query_page(struct vbi *vbi, int pgno, int subno)
690 {
691 #ifdef IMPLEMENTED
692  struct vt_page *vtp = 0;
693 
694  (void)pgno;
695  (void)subno;
696 
697  if (vbi->cache)
698  vtp = vbi->cache->op->get(vbi->cache, pgno, subno);
699  if (vtp == 0)
700  {
701  // EV_PAGE will come later...
702  return 0;
703  }
704 
705  vbi_send(vbi, EV_PAGE, 1, 0, 0, vtp);
706  return vtp;
707 #else
708  (void)vbi;
709  (void)pgno;
710  (void)subno;
711  return nullptr;
712 #endif
713 }
714 
715 void
716 vbi_reset(struct vbi *vbi)
717 {
718 // if (vbi->cache)
719 // vbi->cache->op->reset(vbi->cache);
720  vbi_send(vbi, EV_RESET, 0, 0, 0, nullptr);
721 }
722 
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: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:554
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]
vbi_query_page
struct vt_page * vbi_query_page(struct vbi *vbi, int pgno, int subno)
Definition: vbi.cpp:689
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:36
vt_line
static int vt_line(struct vbi *vbi, unsigned char *p)
Definition: vbi.cpp:186
latin1
int latin1
Definition: lang.cpp: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:678
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: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: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:716
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:498
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:479
FAC
#define FAC
Definition: vbi.cpp:30
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:626
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