comparison dv.c @ 508:4655d19a3d94 libavformat

* fixing a bug in DV timestamp generation. Now libavtest doesn't depend on a local TZ anymore.
author romansh
date Mon, 02 Aug 2004 05:42:49 +0000
parents cb0b5994f3e0
children ad72189eec07
comparison
equal deleted inserted replaced
507:f998b32632d6 508:4655d19a3d94
193 (0 & 0x07); /* AP3: Subcode application ID */ 193 (0 & 0x07); /* AP3: Subcode application ID */
194 break; 194 break;
195 case dv_timecode: 195 case dv_timecode:
196 ct = (time_t)(c->frames / ((float)c->sys->frame_rate / 196 ct = (time_t)(c->frames / ((float)c->sys->frame_rate /
197 (float)c->sys->frame_rate_base)); 197 (float)c->sys->frame_rate_base));
198 localtime_r(&ct, &tc); 198 gmtime_r(&ct, &tc);
199 /* 199 /*
200 * LTC drop-frame frame counter drops two frames (0 and 1) every 200 * LTC drop-frame frame counter drops two frames (0 and 1) every
201 * minute, unless it is exactly divisible by 10 201 * minute, unless it is exactly divisible by 10
202 */ 202 */
203 ltc_frame = (c->frames + 2*ct/60 - 2*ct/600) % c->sys->ltc_divisor; 203 ltc_frame = (c->frames + 2*ct/60 - 2*ct/600) % c->sys->ltc_divisor;
251 break; 251 break;
252 case dv_audio_recdate: 252 case dv_audio_recdate:
253 case dv_viedo_recdate: /* VAUX recording date */ 253 case dv_viedo_recdate: /* VAUX recording date */
254 ct = c->start_time + (time_t)(c->frames / 254 ct = c->start_time + (time_t)(c->frames /
255 ((float)c->sys->frame_rate / (float)c->sys->frame_rate_base)); 255 ((float)c->sys->frame_rate / (float)c->sys->frame_rate_base));
256 localtime_r(&ct, &tc); 256 gmtime_r(&ct, &tc);
257 buf[1] = 0xff; /* ds, tm, tens of time zone, units of time zone */ 257 buf[1] = 0xff; /* ds, tm, tens of time zone, units of time zone */
258 /* 0xff is very likely to be "unknown" */ 258 /* 0xff is very likely to be "unknown" */
259 buf[2] = (3 << 6) | /* reserved -- always 1 */ 259 buf[2] = (3 << 6) | /* reserved -- always 1 */
260 ((tc.tm_mday / 10) << 4) | /* Tens of day */ 260 ((tc.tm_mday / 10) << 4) | /* Tens of day */
261 (tc.tm_mday % 10); /* Units of day */ 261 (tc.tm_mday % 10); /* Units of day */
262 buf[3] = /* we set high 4 bits to 0, shouldn't we set them to week? */ 262 buf[3] = /* we set high 4 bits to 0, shouldn't we set them to week? */
263 (tc.tm_mon % 10); /* Units of month */ 263 (((tc.tm_mon + 1) / 10) << 4) | /* Tens of month */
264 ((tc.tm_mon + 1) % 10); /* Units of month */
264 buf[4] = (((tc.tm_year % 100) / 10) << 4) | /* Tens of year */ 265 buf[4] = (((tc.tm_year % 100) / 10) << 4) | /* Tens of year */
265 (tc.tm_year % 10); /* Units of year */ 266 (tc.tm_year % 10); /* Units of year */
266 break; 267 break;
267 case dv_audio_rectime: /* AAUX recording time */ 268 case dv_audio_rectime: /* AAUX recording time */
268 case dv_video_rectime: /* VAUX recording time */ 269 case dv_video_rectime: /* VAUX recording time */
269 ct = c->start_time + (time_t)(c->frames / 270 ct = c->start_time + (time_t)(c->frames /
270 ((float)c->sys->frame_rate / (float)c->sys->frame_rate_base)); 271 ((float)c->sys->frame_rate / (float)c->sys->frame_rate_base));
271 localtime_r(&ct, &tc); 272 gmtime_r(&ct, &tc);
272 buf[1] = (3 << 6) | /* reserved -- always 1 */ 273 buf[1] = (3 << 6) | /* reserved -- always 1 */
273 0x3f; /* tens of frame, units of frame: 0x3f - "unknown" ? */ 274 0x3f; /* tens of frame, units of frame: 0x3f - "unknown" ? */
274 buf[2] = (1 << 7) | /* reserved -- always 1 */ 275 buf[2] = (1 << 7) | /* reserved -- always 1 */
275 ((tc.tm_sec / 10) << 4) | /* Tens of seconds */ 276 ((tc.tm_sec / 10) << 4) | /* Tens of seconds */
276 (tc.tm_sec % 10); /* Units of seconds */ 277 (tc.tm_sec % 10); /* Units of seconds */