Lines Matching refs:target

55 static void write_header_block(unsigned char* target, int ds, int isPAL)  in write_header_block()  argument
57 target[0] = 0x1f; /* header magic */ in write_header_block()
58 target[1] = 0x07 | (ds << 4); in write_header_block()
59 target[2] = 0x00; in write_header_block()
61 target[3] = ( isPAL ? 0xbf : 0x3f); in write_header_block()
62 target[4] = 0x68; /* FIXME ? */ in write_header_block()
63 target[5] = 0x78; /* FIXME ? */ in write_header_block()
64 target[6] = 0x78; /* FIXME ? */ in write_header_block()
65 target[7] = 0x78; /* FIXME ? */ in write_header_block()
67 memset(target + 8, 0xff, 80 - 8); in write_header_block()
70 static inline void write_bcd(unsigned char* target, int val) in write_bcd() argument
72 *target = ((val / 10) << 4) + (val % 10); in write_bcd()
75 static void write_timecode_13(unsigned char* target, struct tm * now, int frame, in write_timecode_13() argument
78 target[0] = 0x13; in write_timecode_13()
79 write_bcd(target+1, frame % (isPAL ? 25 : 30)); in write_timecode_13()
80 write_bcd(target+2, now->tm_sec); in write_timecode_13()
81 write_bcd(target+3, now->tm_min); in write_timecode_13()
82 write_bcd(target+4, now->tm_hour); in write_timecode_13()
89 static void write_timecode_60(unsigned char* target, struct tm * now, int isPAL) in write_timecode_60() argument
91 target[0] = 0x60; in write_timecode_60()
92 target[1] = 0xff; in write_timecode_60()
93 target[2] = 0xff; in write_timecode_60()
94 target[3] = isPAL ? 0x20 : 0x00; in write_timecode_60()
95 target[4] = 0xff; in write_timecode_60()
98 static void write_timecode_61(unsigned char* target, struct tm * now, in write_timecode_61() argument
101 target[0] = 0x61; /* FIXME: What's this? */ in write_timecode_61()
103 target[1] = 0x33; in write_timecode_61()
104 target[2] = 0xc8 | (is16x9 ? 0x7 : 0x0); in write_timecode_61()
105 target[3] = 0xfd; in write_timecode_61()
107 target[4] = 0xff; in write_timecode_61()
110 static void write_timecode_62(unsigned char* target, struct tm * now) in write_timecode_62() argument
112 target[0] = 0x62; in write_timecode_62()
113 target[1] = 0xff; in write_timecode_62()
114 write_bcd(target + 2, now->tm_mday); in write_timecode_62()
115 write_bcd(target + 3, now->tm_mon+1); in write_timecode_62()
116 write_bcd(target + 4, now->tm_year % 100); in write_timecode_62()
119 static void write_timecode_63(unsigned char* target, struct tm * now) in write_timecode_63() argument
121 target[0] = 0x63; in write_timecode_63()
122 target[1] = 0xff; in write_timecode_63()
123 write_bcd(target + 2, now->tm_sec); in write_timecode_63()
124 write_bcd(target + 3, now->tm_min); in write_timecode_63()
125 write_bcd(target + 4, now->tm_hour); in write_timecode_63()
128 static void write_subcode_blocks(unsigned char* target, int ds, int frame, in write_subcode_blocks() argument
133 memset(target, 0xff, 2*80); in write_subcode_blocks()
135 target[0] = 0x3f; /* subcode magic */ in write_subcode_blocks()
136 target[1] = 0x07 | (ds << 4); in write_subcode_blocks()
137 target[2] = 0x00; in write_subcode_blocks()
139 target[80 + 0] = 0x3f; /* subcode magic */ in write_subcode_blocks()
140 target[80 + 1] = 0x07 | (ds << 4); in write_subcode_blocks()
141 target[80 + 2] = 0x01; in write_subcode_blocks()
143 target[5] = target[80 + 5] = 0xff; in write_subcode_blocks()
146 target[3] = 0x80 | (block_count >> 8); in write_subcode_blocks()
147 target[4] = block_count; in write_subcode_blocks()
149 target[80 + 3] = 0x80 | (block_count >> 8); in write_subcode_blocks()
150 target[80 + 4] = block_count + 6; in write_subcode_blocks()
152 write_timecode_13(target + 6, now, frame, isPAL); in write_subcode_blocks()
153 write_timecode_13(target + 80 + 6, now, frame, isPAL); in write_subcode_blocks()
155 write_timecode_62(target + 6 + 8, now); in write_subcode_blocks()
156 write_timecode_62(target + 80 + 6 + 8, now); in write_subcode_blocks()
158 write_timecode_63(target + 6 + 2*8, now); in write_subcode_blocks()
159 write_timecode_63(target + 80 + 6 + 2*8, now); in write_subcode_blocks()
161 write_timecode_13(target + 6 + 3*8, now, frame, isPAL); in write_subcode_blocks()
162 write_timecode_13(target + 80 + 6 + 3*8, now, frame, isPAL); in write_subcode_blocks()
164 write_timecode_62(target + 6 + 4*8, now); in write_subcode_blocks()
165 write_timecode_62(target + 80 + 6 + 4*8, now); in write_subcode_blocks()
167 write_timecode_63(target + 6 + 5*8, now); in write_subcode_blocks()
168 write_timecode_63(target + 80 + 6 + 5*8, now); in write_subcode_blocks()
170 target[3] = (block_count >> 8); in write_subcode_blocks()
171 target[4] = block_count; in write_subcode_blocks()
173 target[80 + 3] = (block_count >> 8); in write_subcode_blocks()
174 target[80 + 4] = block_count + 6; in write_subcode_blocks()
181 static void write_vaux_blocks(unsigned char* target, int ds, struct tm* now, in write_vaux_blocks() argument
184 memset(target, 0xff, 3*80); in write_vaux_blocks()
186 target[0] = 0x5f; /* vaux magic */ in write_vaux_blocks()
187 target[1] = 0x07 | (ds << 4); in write_vaux_blocks()
188 target[2] = 0x00; in write_vaux_blocks()
190 target[0 + 80] = 0x5f; /* vaux magic */ in write_vaux_blocks()
191 target[1 + 80] = 0x07 | (ds << 4); in write_vaux_blocks()
192 target[2 + 80] = 0x01; in write_vaux_blocks()
194 target[0 + 2*80] = 0x5f; /* vaux magic */ in write_vaux_blocks()
195 target[1 + 2*80] = 0x07 | (ds << 4); in write_vaux_blocks()
196 target[2 + 2*80] = 0x02; in write_vaux_blocks()
201 target[3] = 0x70; /* FIXME: What's this? */ in write_vaux_blocks()
202 target[4] = 0xc5; in write_vaux_blocks()
203 target[5] = 0x41; /* 42 ? */ in write_vaux_blocks()
204 target[6] = 0x20; in write_vaux_blocks()
205 target[7] = 0xff; in write_vaux_blocks()
206 target[8] = 0x71; in write_vaux_blocks()
207 target[9] = 0xff; in write_vaux_blocks()
208 target[10] = 0x7f; in write_vaux_blocks()
209 target[11] = 0xff; in write_vaux_blocks()
210 target[12] = 0xff; in write_vaux_blocks()
211 target[13] = 0x7f; in write_vaux_blocks()
212 target[14] = 0xff; in write_vaux_blocks()
213 target[15] = 0xff; in write_vaux_blocks()
214 target[16] = 0x38; in write_vaux_blocks()
215 target[17] = 0x81; in write_vaux_blocks()
218 write_timecode_60(target + 3, now, isPAL); in write_vaux_blocks()
219 write_timecode_61(target + 3 + 5, now, is16x9); in write_vaux_blocks()
220 write_timecode_62(target + 3 + 2*5, now); in write_vaux_blocks()
221 write_timecode_63(target + 3 + 3*5, now); in write_vaux_blocks()
223 write_timecode_60(target + 2*80+ 48, now, isPAL); in write_vaux_blocks()
224 write_timecode_61(target + 2*80+ 48 + 5, now, is16x9); in write_vaux_blocks()
225 write_timecode_62(target + 2*80+ 48 + 2*5, now); in write_vaux_blocks()
226 write_timecode_63(target + 2*80+ 48 + 3*5, now); in write_vaux_blocks()
229 static void write_video_headers(unsigned char* target, int frame, int ds) in write_video_headers() argument
234 target += 80; in write_video_headers()
236 target[0] = 0x90 | ((frame + 0xb) % 12); in write_video_headers()
237 target[1] = 0x07 | (ds << 4); in write_video_headers()
238 target[2] = z++; in write_video_headers()
239 target += 80; in write_video_headers()
244 static void write_audio_headers(unsigned char* target, int frame, int ds) in write_audio_headers() argument
249 memset(target, 0xff, 80); in write_audio_headers()
251 target[0] = 0x70 | ((frame + 0xb) % 12); in write_audio_headers()
252 target[1] = 0x07 | (ds << 4); in write_audio_headers()
253 target[2] = z++; in write_audio_headers()
255 target += 16 * 80; in write_audio_headers()
260 void _dv_write_meta_data(unsigned char* target, int frame, int isPAL, in _dv_write_meta_data() argument
276 write_header_block(target, ds, isPAL); in _dv_write_meta_data()
277 target += 1 * 80; in _dv_write_meta_data()
278 write_subcode_blocks(target, ds, frame, now_t, isPAL); in _dv_write_meta_data()
279 target += 2 * 80; in _dv_write_meta_data()
280 write_vaux_blocks(target, ds, now_t, isPAL, is16x9); in _dv_write_meta_data()
281 target += 3 * 80; in _dv_write_meta_data()
282 write_video_headers(target, frame, ds); in _dv_write_meta_data()
283 write_audio_headers(target, frame, ds); in _dv_write_meta_data()
284 target += 144 * 80; in _dv_write_meta_data()
301 void dv_encode_metadata(uint8_t *target, int isPAL, int is16x9, time_t *datetime, int frame) in dv_encode_metadata() argument
316 target += 1 * 80; in dv_encode_metadata()
317 write_subcode_blocks(target, ds, frame, &now_t, isPAL); in dv_encode_metadata()
318 target += 2 * 80; in dv_encode_metadata()
319 write_vaux_blocks(target, ds, &now_t, isPAL, is16x9); in dv_encode_metadata()
320 target += 3 * 80; in dv_encode_metadata()
321 target += 144 * 80; in dv_encode_metadata()
334 void dv_encode_timecode(uint8_t* target, int isPAL, int frame) in dv_encode_timecode() argument
337 unsigned char* buf = target; in dv_encode_timecode()