aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/bt8xx/bttv-vbi.c
diff options
context:
space:
mode:
authorDouglas Schilling Landgraf <dougsland@gmail.com>2007-12-27 20:20:58 -0500
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-01-25 16:04:20 -0500
commit402aa76aa5e57801b4db5ccf8c7beea9f580bb1b (patch)
treee6575fc05013a8ad0560911d07d678570b063137 /drivers/media/video/bt8xx/bttv-vbi.c
parent4041f1a58774249f5f26163e68b844521ece1fb4 (diff)
V4L/DVB (6911): Converted bttv to use video_ioctl2
Signed-off-by: Douglas Schilling Landgraf <dougsland@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/bt8xx/bttv-vbi.c')
-rw-r--r--drivers/media/video/bt8xx/bttv-vbi.c52
1 files changed, 25 insertions, 27 deletions
diff --git a/drivers/media/video/bt8xx/bttv-vbi.c b/drivers/media/video/bt8xx/bttv-vbi.c
index b924f05e3b74..da2708176aad 100644
--- a/drivers/media/video/bt8xx/bttv-vbi.c
+++ b/drivers/media/video/bt8xx/bttv-vbi.c
@@ -236,10 +236,8 @@ struct videobuf_queue_ops bttv_vbi_qops = {
236 236
237/* ----------------------------------------------------------------------- */ 237/* ----------------------------------------------------------------------- */
238 238
239static int 239static int try_fmt(struct v4l2_vbi_format *f, const struct bttv_tvnorm *tvnorm,
240try_fmt (struct v4l2_vbi_format * f, 240 __s32 crop_start)
241 const struct bttv_tvnorm * tvnorm,
242 __s32 crop_start)
243{ 241{
244 __s32 min_start, max_start, max_end, f2_offset; 242 __s32 min_start, max_start, max_end, f2_offset;
245 unsigned int i; 243 unsigned int i;
@@ -305,10 +303,9 @@ try_fmt (struct v4l2_vbi_format * f,
305 return 0; 303 return 0;
306} 304}
307 305
308int 306int vidioc_try_fmt_vbi(struct file *file, void *f, struct v4l2_format *frt)
309bttv_vbi_try_fmt (struct bttv_fh * fh,
310 struct v4l2_vbi_format * f)
311{ 307{
308 struct bttv_fh *fh = f;
312 struct bttv *btv = fh->btv; 309 struct bttv *btv = fh->btv;
313 const struct bttv_tvnorm *tvnorm; 310 const struct bttv_tvnorm *tvnorm;
314 __s32 crop_start; 311 __s32 crop_start;
@@ -320,13 +317,13 @@ bttv_vbi_try_fmt (struct bttv_fh * fh,
320 317
321 mutex_unlock(&btv->lock); 318 mutex_unlock(&btv->lock);
322 319
323 return try_fmt(f, tvnorm, crop_start); 320 return try_fmt(&frt->fmt.vbi, tvnorm, crop_start);
324} 321}
325 322
326int 323
327bttv_vbi_set_fmt (struct bttv_fh * fh, 324int vidioc_s_fmt_vbi(struct file *file, void *f, struct v4l2_format *frt)
328 struct v4l2_vbi_format * f)
329{ 325{
326 struct bttv_fh *fh = f;
330 struct bttv *btv = fh->btv; 327 struct bttv *btv = fh->btv;
331 const struct bttv_tvnorm *tvnorm; 328 const struct bttv_tvnorm *tvnorm;
332 __s32 start1, end; 329 __s32 start1, end;
@@ -340,11 +337,12 @@ bttv_vbi_set_fmt (struct bttv_fh * fh,
340 337
341 tvnorm = &bttv_tvnorms[btv->tvnorm]; 338 tvnorm = &bttv_tvnorms[btv->tvnorm];
342 339
343 rc = try_fmt(f, tvnorm, btv->crop_start); 340 rc = try_fmt(&frt->fmt.vbi, tvnorm, btv->crop_start);
344 if (0 != rc) 341 if (0 != rc)
345 goto fail; 342 goto fail;
346 343
347 start1 = f->start[1] - tvnorm->vbistart[1] + tvnorm->vbistart[0]; 344 start1 = frt->fmt.vbi.start[1] - tvnorm->vbistart[1] +
345 tvnorm->vbistart[0];
348 346
349 /* First possible line of video capturing. Should be 347 /* First possible line of video capturing. Should be
350 max(f->start[0] + f->count[0], start1 + f->count[1]) * 2 348 max(f->start[0] + f->count[0], start1 + f->count[1]) * 2
@@ -352,11 +350,11 @@ bttv_vbi_set_fmt (struct bttv_fh * fh,
352 pretend the VBI and video capture window may overlap, 350 pretend the VBI and video capture window may overlap,
353 so end = start + 1, the lowest possible value, times two 351 so end = start + 1, the lowest possible value, times two
354 because vbi_fmt.end counts field lines times two. */ 352 because vbi_fmt.end counts field lines times two. */
355 end = max(f->start[0], start1) * 2 + 2; 353 end = max(frt->fmt.vbi.start[0], start1) * 2 + 2;
356 354
357 mutex_lock(&fh->vbi.lock); 355 mutex_lock(&fh->vbi.lock);
358 356
359 fh->vbi_fmt.fmt = *f; 357 fh->vbi_fmt.fmt = frt->fmt.vbi;
360 fh->vbi_fmt.tvnorm = tvnorm; 358 fh->vbi_fmt.tvnorm = tvnorm;
361 fh->vbi_fmt.end = end; 359 fh->vbi_fmt.end = end;
362 360
@@ -370,13 +368,13 @@ bttv_vbi_set_fmt (struct bttv_fh * fh,
370 return rc; 368 return rc;
371} 369}
372 370
373void 371
374bttv_vbi_get_fmt (struct bttv_fh * fh, 372int vidioc_g_fmt_vbi(struct file *file, void *f, struct v4l2_format *frt)
375 struct v4l2_vbi_format * f)
376{ 373{
374 struct bttv_fh *fh = f;
377 const struct bttv_tvnorm *tvnorm; 375 const struct bttv_tvnorm *tvnorm;
378 376
379 *f = fh->vbi_fmt.fmt; 377 frt->fmt.vbi = fh->vbi_fmt.fmt;
380 378
381 tvnorm = &bttv_tvnorms[fh->btv->tvnorm]; 379 tvnorm = &bttv_tvnorms[fh->btv->tvnorm];
382 380
@@ -391,28 +389,28 @@ bttv_vbi_get_fmt (struct bttv_fh * fh,
391 max_end = (tvnorm->cropcap.bounds.top 389 max_end = (tvnorm->cropcap.bounds.top
392 + tvnorm->cropcap.bounds.height) >> 1; 390 + tvnorm->cropcap.bounds.height) >> 1;
393 391
394 f->sampling_rate = tvnorm->Fsc; 392 frt->fmt.vbi.sampling_rate = tvnorm->Fsc;
395 393
396 for (i = 0; i < 2; ++i) { 394 for (i = 0; i < 2; ++i) {
397 __s32 new_start; 395 __s32 new_start;
398 396
399 new_start = f->start[i] 397 new_start = frt->fmt.vbi.start[i]
400 + tvnorm->vbistart[i] 398 + tvnorm->vbistart[i]
401 - fh->vbi_fmt.tvnorm->vbistart[i]; 399 - fh->vbi_fmt.tvnorm->vbistart[i];
402 400
403 f->start[i] = min(new_start, max_end - 1); 401 frt->fmt.vbi.start[i] = min(new_start, max_end - 1);
404 f->count[i] = min((__s32) f->count[i], 402 frt->fmt.vbi.count[i] =
405 max_end - f->start[i]); 403 min((__s32) frt->fmt.vbi.count[i],
404 max_end - frt->fmt.vbi.start[i]);
406 405
407 max_end += tvnorm->vbistart[1] 406 max_end += tvnorm->vbistart[1]
408 - tvnorm->vbistart[0]; 407 - tvnorm->vbistart[0];
409 } 408 }
410 } 409 }
410 return 0;
411} 411}
412 412
413void 413void bttv_vbi_fmt_reset(struct bttv_vbi_fmt *f, int norm)
414bttv_vbi_fmt_reset (struct bttv_vbi_fmt * f,
415 int norm)
416{ 414{
417 const struct bttv_tvnorm *tvnorm; 415 const struct bttv_tvnorm *tvnorm;
418 unsigned int real_samples_per_line; 416 unsigned int real_samples_per_line;