summaryrefslogtreecommitdiffstats
path: root/stream/tv.c
diff options
context:
space:
mode:
authorvoroshil <voroshil@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-10-14 05:15:51 +0000
committervoroshil <voroshil@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-10-14 05:15:51 +0000
commit4800f1bf6204df0f26b7956af4e48ca543871ded (patch)
tree1229df83a05fd978ccdf4e6a2071dc99da06609c /stream/tv.c
parent6ec3aa115972ead61b6e94775cb6f56b9146e7d5 (diff)
downloadmpv-4800f1bf6204df0f26b7956af4e48ca543871ded.tar.bz2
mpv-4800f1bf6204df0f26b7956af4e48ca543871ded.tar.xz
Remove driver-dependent #ifdef from norm_from_string routine.
It will use TVI_CONTROL_SPC_GET_NORMID if supported by driver and fallback to hardcoded norms otherwise. This will not change current behaviour because hardcoded norms were used with drivers which do not support above ioctl. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@24777 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'stream/tv.c')
-rw-r--r--stream/tv.c36
1 files changed, 14 insertions, 22 deletions
diff --git a/stream/tv.c b/stream/tv.c
index 9fb31f50c4..f9ed1ebe9a 100644
--- a/stream/tv.c
+++ b/stream/tv.c
@@ -206,14 +206,20 @@ static int demux_tv_fill_buffer(demuxer_t *demux, demux_stream_t *ds)
static int norm_from_string(tvi_handle_t *tvh, char* norm)
{
- if (1
-#ifdef HAVE_TV_V4L2
- && strcmp(tvh->tv_param->driver, "v4l2") != 0
-#endif
-#ifdef HAVE_TV_DSHOW
- && strcmp(tvh->tv_param->driver, "dshow") != 0
-#endif
- ) {
+ tvi_functions_t *funcs = tvh->functions;
+ char str[8];
+ int ret;
+ strncpy(str, norm, sizeof(str)-1);
+ str[sizeof(str)-1] = '\0';
+ ret=funcs->control(tvh->priv, TVI_CONTROL_SPC_GET_NORMID, str);
+ if(ret==TVI_CONTROL_TRUE)
+ return *(int *)str;
+ if(ret!=TVI_CONTROL_UNKNOWN)
+ {
+ mp_msg(MSGT_TV, MSGL_WARN, MSGTR_TV_BogusNormParameter, norm,"default");
+ return 0;
+ }
+
if (!strcasecmp(norm, "pal"))
return TV_NORM_PAL;
else if (!strcasecmp(norm, "ntsc"))
@@ -232,20 +238,6 @@ static int norm_from_string(tvi_handle_t *tvh, char* norm)
mp_msg(MSGT_TV, MSGL_WARN, MSGTR_TV_BogusNormParameter, norm, "PAL");
return TV_NORM_PAL;
}
-#if defined(HAVE_TV_V4L2) || defined(HAVE_TV_DSHOW)
- } else {
- tvi_functions_t *funcs = tvh->functions;
- char str[8];
- strncpy(str, norm, sizeof(str)-1);
- str[sizeof(str)-1] = '\0';
- if (funcs->control(tvh->priv, TVI_CONTROL_SPC_GET_NORMID, str) != TVI_CONTROL_TRUE)
- {
- mp_msg(MSGT_TV, MSGL_WARN, MSGTR_TV_BogusNormParameter, norm,"default");
- return 0;
- }
- return *(int *)str;
- }
-#endif
}
static void parse_channels(tvi_handle_t *tvh)