ivtv-ioctl.c (1136fa0c07de570dc17858745af8be169d1440ba) ivtv-ioctl.c (25e94139218c0293b4375233c14f2256d7dcfaa8)
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 ioctl system call
4 Copyright (C) 2003-2004 Kevin Thayer <nufan_wfk at yahoo.com>
5 Copyright (C) 2005-2007 Hans Verkuil <hverkuil@xs4all.nl>
6
7 */
8

--- 424 unchanged lines hidden (view full) ---

433}
434
435static int ivtv_g_fmt_vid_out_overlay(struct file *file, void *fh, struct v4l2_format *fmt)
436{
437 struct ivtv *itv = fh2id(fh)->itv;
438 struct ivtv_stream *s = &itv->streams[fh2id(fh)->type];
439 struct v4l2_window *winfmt = &fmt->fmt.win;
440
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 ioctl system call
4 Copyright (C) 2003-2004 Kevin Thayer <nufan_wfk at yahoo.com>
5 Copyright (C) 2005-2007 Hans Verkuil <hverkuil@xs4all.nl>
6
7 */
8

--- 424 unchanged lines hidden (view full) ---

433}
434
435static int ivtv_g_fmt_vid_out_overlay(struct file *file, void *fh, struct v4l2_format *fmt)
436{
437 struct ivtv *itv = fh2id(fh)->itv;
438 struct ivtv_stream *s = &itv->streams[fh2id(fh)->type];
439 struct v4l2_window *winfmt = &fmt->fmt.win;
440
441 if (!(s->caps & V4L2_CAP_VIDEO_OUTPUT_OVERLAY))
441 if (!(s->vdev.device_caps & V4L2_CAP_VIDEO_OUTPUT_OVERLAY))
442 return -EINVAL;
443 if (!itv->osd_video_pbase)
444 return -EINVAL;
445 winfmt->chromakey = itv->osd_chroma_key;
446 winfmt->global_alpha = itv->osd_global_alpha;
447 winfmt->field = V4L2_FIELD_INTERLACED;
448 winfmt->clips = NULL;
449 winfmt->clipcount = 0;

--- 94 unchanged lines hidden (view full) ---

544
545static int ivtv_try_fmt_vid_out_overlay(struct file *file, void *fh, struct v4l2_format *fmt)
546{
547 struct ivtv *itv = fh2id(fh)->itv;
548 struct ivtv_stream *s = &itv->streams[fh2id(fh)->type];
549 u32 chromakey = fmt->fmt.win.chromakey;
550 u8 global_alpha = fmt->fmt.win.global_alpha;
551
442 return -EINVAL;
443 if (!itv->osd_video_pbase)
444 return -EINVAL;
445 winfmt->chromakey = itv->osd_chroma_key;
446 winfmt->global_alpha = itv->osd_global_alpha;
447 winfmt->field = V4L2_FIELD_INTERLACED;
448 winfmt->clips = NULL;
449 winfmt->clipcount = 0;

--- 94 unchanged lines hidden (view full) ---

544
545static int ivtv_try_fmt_vid_out_overlay(struct file *file, void *fh, struct v4l2_format *fmt)
546{
547 struct ivtv *itv = fh2id(fh)->itv;
548 struct ivtv_stream *s = &itv->streams[fh2id(fh)->type];
549 u32 chromakey = fmt->fmt.win.chromakey;
550 u8 global_alpha = fmt->fmt.win.global_alpha;
551
552 if (!(s->caps & V4L2_CAP_VIDEO_OUTPUT_OVERLAY))
552 if (!(s->vdev.device_caps & V4L2_CAP_VIDEO_OUTPUT_OVERLAY))
553 return -EINVAL;
554 if (!itv->osd_video_pbase)
555 return -EINVAL;
556 ivtv_g_fmt_vid_out_overlay(file, fh, fmt);
557 fmt->fmt.win.chromakey = chromakey;
558 fmt->fmt.win.global_alpha = global_alpha;
559 return 0;
560}

--- 817 unchanged lines hidden (view full) ---

1378 V4L2_PIX_FMT_YUV555,
1379 V4L2_PIX_FMT_YUV444,
1380 V4L2_PIX_FMT_YUV32,
1381 0,
1382 0,
1383 0,
1384 };
1385
553 return -EINVAL;
554 if (!itv->osd_video_pbase)
555 return -EINVAL;
556 ivtv_g_fmt_vid_out_overlay(file, fh, fmt);
557 fmt->fmt.win.chromakey = chromakey;
558 fmt->fmt.win.global_alpha = global_alpha;
559 return 0;
560}

--- 817 unchanged lines hidden (view full) ---

1378 V4L2_PIX_FMT_YUV555,
1379 V4L2_PIX_FMT_YUV444,
1380 V4L2_PIX_FMT_YUV32,
1381 0,
1382 0,
1383 0,
1384 };
1385
1386 if (!(s->caps & V4L2_CAP_VIDEO_OUTPUT_OVERLAY))
1386 if (!(s->vdev.device_caps & V4L2_CAP_VIDEO_OUTPUT_OVERLAY))
1387 return -ENOTTY;
1388 if (!itv->osd_video_pbase)
1389 return -ENOTTY;
1390
1391 fb->capability = V4L2_FBUF_CAP_EXTERNOVERLAY | V4L2_FBUF_CAP_CHROMAKEY |
1392 V4L2_FBUF_CAP_GLOBAL_ALPHA;
1393
1394 ivtv_vapi_result(itv, data, CX2341X_OSD_GET_STATE, 0);

--- 50 unchanged lines hidden (view full) ---

1445
1446static int ivtv_s_fbuf(struct file *file, void *fh, const struct v4l2_framebuffer *fb)
1447{
1448 struct ivtv_open_id *id = fh2id(fh);
1449 struct ivtv *itv = id->itv;
1450 struct ivtv_stream *s = &itv->streams[fh2id(fh)->type];
1451 struct yuv_playback_info *yi = &itv->yuv_info;
1452
1387 return -ENOTTY;
1388 if (!itv->osd_video_pbase)
1389 return -ENOTTY;
1390
1391 fb->capability = V4L2_FBUF_CAP_EXTERNOVERLAY | V4L2_FBUF_CAP_CHROMAKEY |
1392 V4L2_FBUF_CAP_GLOBAL_ALPHA;
1393
1394 ivtv_vapi_result(itv, data, CX2341X_OSD_GET_STATE, 0);

--- 50 unchanged lines hidden (view full) ---

1445
1446static int ivtv_s_fbuf(struct file *file, void *fh, const struct v4l2_framebuffer *fb)
1447{
1448 struct ivtv_open_id *id = fh2id(fh);
1449 struct ivtv *itv = id->itv;
1450 struct ivtv_stream *s = &itv->streams[fh2id(fh)->type];
1451 struct yuv_playback_info *yi = &itv->yuv_info;
1452
1453 if (!(s->caps & V4L2_CAP_VIDEO_OUTPUT_OVERLAY))
1453 if (!(s->vdev.device_caps & V4L2_CAP_VIDEO_OUTPUT_OVERLAY))
1454 return -ENOTTY;
1455 if (!itv->osd_video_pbase)
1456 return -ENOTTY;
1457
1458 itv->osd_global_alpha_state = (fb->flags & V4L2_FBUF_FLAG_GLOBAL_ALPHA) != 0;
1459 itv->osd_local_alpha_state =
1460 (fb->flags & (V4L2_FBUF_FLAG_LOCAL_ALPHA|V4L2_FBUF_FLAG_LOCAL_INV_ALPHA)) != 0;
1461 itv->osd_chroma_key_state = (fb->flags & V4L2_FBUF_FLAG_CHROMAKEY) != 0;
1462 ivtv_set_osd_alpha(itv);
1463 yi->track_osd = (fb->flags & V4L2_FBUF_FLAG_OVERLAY) != 0;
1464 return 0;
1465}
1466
1467static int ivtv_overlay(struct file *file, void *fh, unsigned int on)
1468{
1469 struct ivtv_open_id *id = fh2id(fh);
1470 struct ivtv *itv = id->itv;
1471 struct ivtv_stream *s = &itv->streams[fh2id(fh)->type];
1472
1454 return -ENOTTY;
1455 if (!itv->osd_video_pbase)
1456 return -ENOTTY;
1457
1458 itv->osd_global_alpha_state = (fb->flags & V4L2_FBUF_FLAG_GLOBAL_ALPHA) != 0;
1459 itv->osd_local_alpha_state =
1460 (fb->flags & (V4L2_FBUF_FLAG_LOCAL_ALPHA|V4L2_FBUF_FLAG_LOCAL_INV_ALPHA)) != 0;
1461 itv->osd_chroma_key_state = (fb->flags & V4L2_FBUF_FLAG_CHROMAKEY) != 0;
1462 ivtv_set_osd_alpha(itv);
1463 yi->track_osd = (fb->flags & V4L2_FBUF_FLAG_OVERLAY) != 0;
1464 return 0;
1465}
1466
1467static int ivtv_overlay(struct file *file, void *fh, unsigned int on)
1468{
1469 struct ivtv_open_id *id = fh2id(fh);
1470 struct ivtv *itv = id->itv;
1471 struct ivtv_stream *s = &itv->streams[fh2id(fh)->type];
1472
1473 if (!(s->caps & V4L2_CAP_VIDEO_OUTPUT_OVERLAY))
1473 if (!(s->vdev.device_caps & V4L2_CAP_VIDEO_OUTPUT_OVERLAY))
1474 return -ENOTTY;
1475 if (!itv->osd_video_pbase)
1476 return -ENOTTY;
1477
1478 ivtv_vapi(itv, CX2341X_OSD_SET_STATE, 1, on != 0);
1479
1480 return 0;
1481}

--- 263 unchanged lines hidden ---
1474 return -ENOTTY;
1475 if (!itv->osd_video_pbase)
1476 return -ENOTTY;
1477
1478 ivtv_vapi(itv, CX2341X_OSD_SET_STATE, 1, on != 0);
1479
1480 return 0;
1481}

--- 263 unchanged lines hidden ---