File: videocrypts.h

package info (click to toggle)
hacktv 0%2Bgit20201203-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,052 kB
  • sloc: ansic: 14,314; sh: 91; makefile: 43
file content (73 lines) | stat: -rw-r--r-- 2,584 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/* hacktv - Analogue video transmitter for the HackRF                    */
/*=======================================================================*/
/* Copyright 2019 Philip Heron <phil@sanslogic.co.uk>                    */
/*                                                                       */
/* This program is free software: you can redistribute it and/or modify  */
/* it under the terms of the GNU General Public License as published by  */
/* the Free Software Foundation, either version 3 of the License, or     */
/* (at your option) any later version.                                   */
/*                                                                       */
/* This program is distributed in the hope that it will be useful,       */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of        */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         */
/* GNU General Public License for more details.                          */
/*                                                                       */
/* You should have received a copy of the GNU General Public License     */
/* along with this program.  If not, see <http://www.gnu.org/licenses/>. */

#ifndef _VIDEOCRYPTS_H
#define _VIDEOCRYPTS_H

#include <stdint.h>
#include "video.h"

#define VCS_SAMPLE_RATE         17734475
#define VCS_WIDTH               1135
#define VCS_VBI_LEFT            211
#define VCS_VBI_FIELD_1_START   24
#define VCS_VBI_FIELD_2_START   336
#define VCS_VBI_LINES_PER_FIELD 4
#define VCS_VBI_LINES_PER_FRAME (VCS_VBI_LINES_PER_FIELD * 2)
#define VCS_VBI_SAMPLES_PER_BIT 22
#define VCS_VBI_BITS_PER_LINE   40
#define VCS_VBI_BYTES_PER_LINE  (VCS_VBI_BITS_PER_LINE / 8)
#define VCS_PACKET_LENGTH       32

/* This is not correct - just a placeholder */
#define VCS_PRBS_CW_FA (((uint64_t) 1 << 60) - 1)

/* VCS_DELAY_LINES needs to be long enough for the scrambler to access any
 * line in the next block, which may be in the next field... */

#define VCS_DELAY_LINES 125

typedef struct {
	uint8_t mode;
	uint8_t channel;
	uint64_t codeword;
	uint8_t messages[8][32];
} _vcs_block_t;

typedef struct {
	
	uint8_t counter;
	
	/* VCS blocks */
	const _vcs_block_t *blocks;
	size_t block_num;
	size_t block_len;
	uint8_t message[32];
	uint8_t vbi[VCS_VBI_BYTES_PER_LINE * VCS_VBI_LINES_PER_FRAME];
	
	int block[47];
	
	int video_scale[VCS_WIDTH];
	
} vcs_t;

extern int vcs_init(vcs_t *s, vid_t *vs, const char *mode);
extern void vcs_free(vcs_t *s);
extern int vcs_render_line(vid_t *s, void *arg, int nlines, vid_line_t **lines);

#endif