comparison stream/tv.c @ 24744:d81eef9beb1b

DirectShow based tv:// driver for win32 Teletext is also supported (but 625 system parameters are hardcoded). pthreads is required for teletext. Code is still experimental.
author voroshil
date Sat, 13 Oct 2007 17:14:39 +0000
parents d6bba2781d01
children 4147969ee500
comparison
equal deleted inserted replaced
24743:acb856c03bd8 24744:d81eef9beb1b
40 tv_channels_t *tv_channel_current, *tv_channel_last; 40 tv_channels_t *tv_channel_current, *tv_channel_last;
41 char *tv_channel_last_real; 41 char *tv_channel_last_real;
42 42
43 /* enumerating drivers (like in stream.c) */ 43 /* enumerating drivers (like in stream.c) */
44 extern tvi_info_t tvi_info_dummy; 44 extern tvi_info_t tvi_info_dummy;
45 #ifdef HAVE_TV_DSHOW
46 extern tvi_info_dshow;
47 #endif
45 #ifdef HAVE_TV_V4L1 48 #ifdef HAVE_TV_V4L1
46 extern tvi_info_t tvi_info_v4l; 49 extern tvi_info_t tvi_info_v4l;
47 #endif 50 #endif
48 #ifdef HAVE_TV_V4L2 51 #ifdef HAVE_TV_V4L2
49 extern tvi_info_t tvi_info_v4l2; 52 extern tvi_info_t tvi_info_v4l2;
60 #ifdef HAVE_TV_V4L1 63 #ifdef HAVE_TV_V4L1
61 &tvi_info_v4l, 64 &tvi_info_v4l,
62 #endif 65 #endif
63 #ifdef HAVE_TV_BSDBT848 66 #ifdef HAVE_TV_BSDBT848
64 &tvi_info_bsdbt848, 67 &tvi_info_bsdbt848,
68 #endif
69 #ifdef HAVE_TV_DSHOW
70 &tvi_info_dshow,
65 #endif 71 #endif
66 &tvi_info_dummy, 72 &tvi_info_dummy,
67 NULL 73 NULL
68 }; 74 };
69 75
198 return 1; 204 return 1;
199 } 205 }
200 206
201 static int norm_from_string(tvi_handle_t *tvh, char* norm) 207 static int norm_from_string(tvi_handle_t *tvh, char* norm)
202 { 208 {
209 if (1
203 #ifdef HAVE_TV_V4L2 210 #ifdef HAVE_TV_V4L2
204 if (strcmp(tvh->tv_param->driver, "v4l2") != 0) { 211 && strcmp(tvh->tv_param->driver, "v4l2") != 0 &&
205 #endif 212 #endif
213 #ifdef HAVE_TV_DSHOW
214 && strcmp(tvh->tv_param->driver, "dshow") != 0
215 #endif
216 ) {
206 if (!strcasecmp(norm, "pal")) 217 if (!strcasecmp(norm, "pal"))
207 return TV_NORM_PAL; 218 return TV_NORM_PAL;
208 else if (!strcasecmp(norm, "ntsc")) 219 else if (!strcasecmp(norm, "ntsc"))
209 return TV_NORM_NTSC; 220 return TV_NORM_NTSC;
210 else if (!strcasecmp(norm, "secam")) 221 else if (!strcasecmp(norm, "secam"))
219 return TV_NORM_NTSCJP; 230 return TV_NORM_NTSCJP;
220 else { 231 else {
221 mp_msg(MSGT_TV, MSGL_WARN, MSGTR_TV_BogusNormParameter, norm, "PAL"); 232 mp_msg(MSGT_TV, MSGL_WARN, MSGTR_TV_BogusNormParameter, norm, "PAL");
222 return TV_NORM_PAL; 233 return TV_NORM_PAL;
223 } 234 }
224 #ifdef HAVE_TV_V4L2 235 #if defined(HAVE_TV_V4L2) || defined(HAVE_TV_DSHOW)
225 } else { 236 } else {
226 tvi_functions_t *funcs = tvh->functions; 237 tvi_functions_t *funcs = tvh->functions;
227 char str[8]; 238 char str[8];
228 strncpy(str, norm, sizeof(str)-1); 239 strncpy(str, norm, sizeof(str)-1);
229 str[sizeof(str)-1] = '\0'; 240 str[sizeof(str)-1] = '\0';
359 } 370 }
360 371
361 /* set some params got from cmdline */ 372 /* set some params got from cmdline */
362 funcs->control(tvh->priv, TVI_CONTROL_SPC_SET_INPUT, &tvh->tv_param->input); 373 funcs->control(tvh->priv, TVI_CONTROL_SPC_SET_INPUT, &tvh->tv_param->input);
363 374
375 #if defined(HAVE_TV_V4L2) || defined(HAVE_TV_DSHOW)
376 if (0
364 #ifdef HAVE_TV_V4L2 377 #ifdef HAVE_TV_V4L2
365 if (!strcmp(tvh->tv_param->driver, "v4l2") && tvh->tv_param->normid >= 0) { 378 || (!strcmp(tvh->tv_param->driver, "v4l2") && tvh->tv_param->normid >= 0)
379 #endif
380 #ifdef HAVE_TV_DSHOW
381 || (!strcmp(tvh->tv_param->driver, "dshow") && tvh->tv_param->normid >= 0)
382 #endif
383 ) {
366 mp_msg(MSGT_TV, MSGL_V, MSGTR_TV_SelectedNormId, tvh->tv_param->normid); 384 mp_msg(MSGT_TV, MSGL_V, MSGTR_TV_SelectedNormId, tvh->tv_param->normid);
367 if (funcs->control(tvh->priv, TVI_CONTROL_TUN_SET_NORM, &tvh->tv_param->normid) != TVI_CONTROL_TRUE) { 385 if (funcs->control(tvh->priv, TVI_CONTROL_TUN_SET_NORM, &tvh->tv_param->normid) != TVI_CONTROL_TRUE) {
368 mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_CannotSetNorm); 386 mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_CannotSetNorm);
369 } 387 }
370 } else { 388 } else {
374 392
375 mp_msg(MSGT_TV, MSGL_V, MSGTR_TV_SelectedNorm, tvh->tv_param->norm); 393 mp_msg(MSGT_TV, MSGL_V, MSGTR_TV_SelectedNorm, tvh->tv_param->norm);
376 if (funcs->control(tvh->priv, TVI_CONTROL_TUN_SET_NORM, &tvh->norm) != TVI_CONTROL_TRUE) { 394 if (funcs->control(tvh->priv, TVI_CONTROL_TUN_SET_NORM, &tvh->norm) != TVI_CONTROL_TRUE) {
377 mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_CannotSetNorm); 395 mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_CannotSetNorm);
378 } 396 }
379 #ifdef HAVE_TV_V4L2 397 #if defined(HAVE_TV_V4L2) || defined(HAVE_TV_DSHOW)
380 } 398 }
381 #endif 399 #endif
382 400
383 #ifdef HAVE_TV_V4L1 401 #ifdef HAVE_TV_V4L1
384 if ( tvh->tv_param->mjpeg ) 402 if ( tvh->tv_param->mjpeg )