comparison libmpdemux/tv.c @ 10521:141141fdd250

I'd like to change tv tuner frequency in the slave mode. So this patch helps me. Patch by Kir Kostuchenko <kir@users.sourceforge.net>
author gabucino
date Mon, 04 Aug 2003 09:13:10 +0000
parents 6fb8a6a4a071
children 31f12f99118b
comparison
equal deleted inserted replaced
10520:880e5d24c4c3 10521:141141fdd250
116 } 116 }
117 117
118 return 1; 118 return 1;
119 } 119 }
120 120
121 /* forward declarations */ 121 static int norm_from_string(char* norm)
122 int tv_set_freq(tvi_handle_t *tvh, unsigned long freq); 122 {
123 int tv_get_freq(tvi_handle_t *tvh, unsigned long *freq); 123 if (!strcasecmp(norm, "pal"))
124 return TV_NORM_PAL;
125 else if (!strcasecmp(norm, "ntsc"))
126 return TV_NORM_NTSC;
127 else if (!strcasecmp(norm, "secam"))
128 return TV_NORM_SECAM;
129 else if (!strcasecmp(norm, "palnc"))
130 return TV_NORM_PALNC;
131 else if (!strcasecmp(norm, "palm"))
132 return TV_NORM_PALM;
133 else if (!strcasecmp(norm, "paln"))
134 return TV_NORM_PALN;
135 else if (!strcasecmp(norm, "ntscjp"))
136 return TV_NORM_NTSCJP;
137 else {
138 mp_msg(MSGT_TV, MSGL_V, "tv.c : norm_from_string(%s): Bogus norm parameter, setting PAL.\n", norm);
139 return TV_NORM_PAL;
140 }
141 }
124 142
125 static int open_tv(tvi_handle_t *tvh) 143 static int open_tv(tvi_handle_t *tvh)
126 { 144 {
127 int i; 145 int i;
128 tvi_functions_t *funcs = tvh->functions; 146 tvi_functions_t *funcs = tvh->functions;
160 178
161 /* set some params got from cmdline */ 179 /* set some params got from cmdline */
162 funcs->control(tvh->priv, TVI_CONTROL_SPC_SET_INPUT, &tv_param_input); 180 funcs->control(tvh->priv, TVI_CONTROL_SPC_SET_INPUT, &tv_param_input);
163 181
164 /* select video norm */ 182 /* select video norm */
165 if (!strcasecmp(tv_param_norm, "pal")) 183 tvh->norm = norm_from_string(tv_param_norm);
166 tvh->norm = TV_NORM_PAL;
167 else if (!strcasecmp(tv_param_norm, "ntsc"))
168 tvh->norm = TV_NORM_NTSC;
169 else if (!strcasecmp(tv_param_norm, "secam"))
170 tvh->norm = TV_NORM_SECAM;
171 else if (!strcasecmp(tv_param_norm, "palnc"))
172 tvh->norm = TV_NORM_PALNC;
173 else if (!strcasecmp(tv_param_norm, "palm"))
174 tvh->norm = TV_NORM_PALM;
175 else if (!strcasecmp(tv_param_norm, "paln"))
176 tvh->norm = TV_NORM_PALN;
177 else if (!strcasecmp(tv_param_norm, "ntscjp"))
178 tvh->norm = TV_NORM_NTSCJP;
179 else {
180 mp_msg(MSGT_TV, MSGL_V, "Bogus norm parameter, setting PAL.\n");
181 tvh->norm = TV_NORM_PAL;
182 }
183 184
184 mp_msg(MSGT_TV, MSGL_V, "Selected norm: %s\n", tv_param_norm); 185 mp_msg(MSGT_TV, MSGL_V, "Selected norm: %s\n", tv_param_norm);
185 if (funcs->control(tvh->priv, TVI_CONTROL_TUN_SET_NORM, &tvh->norm) != TVI_CONTROL_TRUE) { 186 if (funcs->control(tvh->priv, TVI_CONTROL_TUN_SET_NORM, &tvh->norm) != TVI_CONTROL_TRUE) {
186 mp_msg(MSGT_TV, MSGL_ERR, "Error: cannot set norm!\n"); 187 mp_msg(MSGT_TV, MSGL_ERR, "Error: cannot set norm!\n");
187 return 0; 188 return 0;
802 803
803 int tv_step_chanlist(tvi_handle_t *tvh) 804 int tv_step_chanlist(tvi_handle_t *tvh)
804 { 805 {
805 return(1); 806 return(1);
806 } 807 }
808
809 int tv_set_norm(tvi_handle_t *tvh, char* norm)
810 {
811 tvh->norm = norm_from_string(norm);
812
813 mp_msg(MSGT_TV, MSGL_V, "Selected norm: %s\n", tv_param_norm);
814 if (tvh->functions->control(tvh->priv, TVI_CONTROL_TUN_SET_NORM, &tvh->norm) != TVI_CONTROL_TRUE) {
815 mp_msg(MSGT_TV, MSGL_ERR, "Error: cannot set norm!\n");
816 return 0;
817 }
818 return(1);
819 }
820
807 #endif /* USE_TV */ 821 #endif /* USE_TV */