Mercurial > mplayer.hg
comparison libmpdemux/tvi_v4l.c @ 7472:c4434bdf6e51
tons of warning fixes, also some 10l bugfixes, including Dominik's PVA bug
author | arpi |
---|---|
date | Sun, 22 Sep 2002 02:33:28 +0000 |
parents | 85897ab199a4 |
children | 26cd91676fb6 |
comparison
equal
deleted
inserted
replaced
7471:5e56ce70b551 | 7472:c4434bdf6e51 |
---|---|
233 | 233 |
234 mp_msg(MSGT_TV, MSGL_V, "Audio capture - buffer %d blocks of %d bytes, skew average from %d meas.\n", | 234 mp_msg(MSGT_TV, MSGL_V, "Audio capture - buffer %d blocks of %d bytes, skew average from %d meas.\n", |
235 priv->audio_buffer_size, priv->audio_in.blocksize, priv->aud_skew_cnt); | 235 priv->audio_buffer_size, priv->audio_in.blocksize, priv->aud_skew_cnt); |
236 } | 236 } |
237 | 237 |
238 static int one = 1, zero = 0; | |
239 | |
240 tvi_handle_t *tvi_init_v4l(char *device, char *adevice) | 238 tvi_handle_t *tvi_init_v4l(char *device, char *adevice) |
241 { | 239 { |
242 tvi_handle_t *h; | 240 tvi_handle_t *h; |
243 priv_t *priv; | 241 priv_t *priv; |
244 | 242 |
497 | 495 |
498 if (!priv->capability.audios) tv_param_noaudio = 1; | 496 if (!priv->capability.audios) tv_param_noaudio = 1; |
499 | 497 |
500 /* audio init */ | 498 /* audio init */ |
501 if (!tv_param_noaudio) { | 499 if (!tv_param_noaudio) { |
502 int err; | |
503 | 500 |
504 #ifdef HAVE_ALSA9 | 501 #ifdef HAVE_ALSA9 |
505 if (tv_param_alsa) | 502 if (tv_param_alsa) |
506 audio_in_init(&priv->audio_in, AUDIO_IN_ALSA); | 503 audio_in_init(&priv->audio_in, AUDIO_IN_ALSA); |
507 else | 504 else |
1142 #define MAX_SKEW_DELTA 0.6 | 1139 #define MAX_SKEW_DELTA 0.6 |
1143 static void *video_grabber(void *data) | 1140 static void *video_grabber(void *data) |
1144 { | 1141 { |
1145 priv_t *priv = (priv_t*)data; | 1142 priv_t *priv = (priv_t*)data; |
1146 struct timeval curtime; | 1143 struct timeval curtime; |
1147 double timestamp, skew, prev_skew, xskew, interval, prev_interval; | 1144 double skew, prev_skew, xskew, interval, prev_interval; |
1148 int frame, nextframe; | 1145 int frame, nextframe; |
1149 int fsize = priv->bytesperline * priv->height; | 1146 int fsize = priv->bytesperline * priv->height; |
1150 int i; | 1147 int i; |
1151 int first = 1; | 1148 int first = 1; |
1152 | 1149 |
1254 } | 1251 } |
1255 | 1252 |
1256 } | 1253 } |
1257 | 1254 |
1258 } | 1255 } |
1256 return NULL; | |
1259 } | 1257 } |
1260 | 1258 |
1261 static double grab_video_frame(priv_t *priv, char *buffer, int len) | 1259 static double grab_video_frame(priv_t *priv, char *buffer, int len) |
1262 { | 1260 { |
1263 double interval; | 1261 double interval; |
1285 | 1283 |
1286 static void *audio_grabber(void *data) | 1284 static void *audio_grabber(void *data) |
1287 { | 1285 { |
1288 priv_t *priv = (priv_t*)data; | 1286 priv_t *priv = (priv_t*)data; |
1289 struct timeval tv; | 1287 struct timeval tv; |
1290 int ret; | |
1291 int i, audio_skew_ptr = 0; | 1288 int i, audio_skew_ptr = 0; |
1292 double tmp, current_time, current_skew, prev_skew = 0.0; | 1289 double tmp, current_time, prev_skew = 0.0; |
1293 | 1290 |
1294 pthread_mutex_lock(&priv->audio_starter); | 1291 pthread_mutex_lock(&priv->audio_starter); |
1295 | 1292 |
1296 audio_in_start_capture(&priv->audio_in); | 1293 audio_in_start_capture(&priv->audio_in); |
1297 for (i = 0; i < priv->aud_skew_cnt; i++) | 1294 for (i = 0; i < priv->aud_skew_cnt; i++) |
1353 } else { | 1350 } else { |
1354 priv->audio_tail = (++priv->audio_tail) % priv->audio_buffer_size; | 1351 priv->audio_tail = (++priv->audio_tail) % priv->audio_buffer_size; |
1355 priv->audio_cnt++; | 1352 priv->audio_cnt++; |
1356 } | 1353 } |
1357 } | 1354 } |
1355 return NULL; | |
1358 } | 1356 } |
1359 | 1357 |
1360 static double grab_audio_frame(priv_t *priv, char *buffer, int len) | 1358 static double grab_audio_frame(priv_t *priv, char *buffer, int len) |
1361 { | 1359 { |
1362 int in_len = 0; | |
1363 int max_tries = 2; | |
1364 | |
1365 mp_dbg(MSGT_TV, MSGL_DBG2, "grab_audio_frame(priv=%p, buffer=%p, len=%d)\n", | 1360 mp_dbg(MSGT_TV, MSGL_DBG2, "grab_audio_frame(priv=%p, buffer=%p, len=%d)\n", |
1366 priv, buffer, len); | 1361 priv, buffer, len); |
1367 | 1362 |
1368 // compensate for dropped audio frames | 1363 // compensate for dropped audio frames |
1369 if (priv->audio_drop && (priv->audio_head == priv->audio_tail)) { | 1364 if (priv->audio_drop && (priv->audio_head == priv->audio_tail)) { |