forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c
....@@ -1,21 +1,12 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
2
- * Copyright (C) 2010-2013 Bluecherry, LLC <http://www.bluecherrydvr.com>
3
+ * Copyright (C) 2010-2013 Bluecherry, LLC <https://www.bluecherrydvr.com>
34 *
45 * Original author:
56 * Ben Collins <bcollins@ubuntu.com>
67 *
78 * Additional work by:
89 * John Brooks <john.brooks@bluecherry.net>
9
- *
10
- * This program is free software; you can redistribute it and/or modify
11
- * it under the terms of the GNU General Public License as published by
12
- * the Free Software Foundation; either version 2 of the License, or
13
- * (at your option) any later version.
14
- *
15
- * This program is distributed in the hope that it will be useful,
16
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
- * GNU General Public License for more details.
1910 */
2011
2112 #include <linux/kernel.h>
....@@ -775,14 +766,11 @@
775766 struct solo_enc_dev *solo_enc = video_drvdata(file);
776767 struct solo_dev *solo_dev = solo_enc->solo_dev;
777768
778
- strcpy(cap->driver, SOLO6X10_NAME);
769
+ strscpy(cap->driver, SOLO6X10_NAME, sizeof(cap->driver));
779770 snprintf(cap->card, sizeof(cap->card), "Softlogic 6x10 Enc %d",
780771 solo_enc->ch);
781772 snprintf(cap->bus_info, sizeof(cap->bus_info), "PCI:%s",
782773 pci_name(solo_dev->pdev));
783
- cap->device_caps = V4L2_CAP_VIDEO_CAPTURE |
784
- V4L2_CAP_READWRITE | V4L2_CAP_STREAMING;
785
- cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
786774 return 0;
787775 }
788776
....@@ -834,24 +822,18 @@
834822 switch (dev_type) {
835823 case SOLO_DEV_6010:
836824 f->pixelformat = V4L2_PIX_FMT_MPEG4;
837
- strcpy(f->description, "MPEG-4 part 2");
838825 break;
839826 case SOLO_DEV_6110:
840827 f->pixelformat = V4L2_PIX_FMT_H264;
841
- strcpy(f->description, "H.264");
842828 break;
843829 }
844830 break;
845831 case 1:
846832 f->pixelformat = V4L2_PIX_FMT_MJPEG;
847
- strcpy(f->description, "MJPEG");
848833 break;
849834 default:
850835 return -EINVAL;
851836 }
852
-
853
- f->flags = V4L2_FMT_FLAG_COMPRESSED;
854
-
855837 return 0;
856838 }
857839
....@@ -897,7 +879,6 @@
897879 pix->colorspace = V4L2_COLORSPACE_SMPTE170M;
898880 pix->sizeimage = FRAME_BUF_SIZE;
899881 pix->bytesperline = 0;
900
- pix->priv = 0;
901882
902883 return 0;
903884 }
....@@ -952,7 +933,6 @@
952933 V4L2_FIELD_NONE;
953934 pix->sizeimage = FRAME_BUF_SIZE;
954935 pix->colorspace = V4L2_COLORSPACE_SMPTE170M;
955
- pix->priv = 0;
956936
957937 return 0;
958938 }
....@@ -1126,7 +1106,8 @@
11261106 solo_enc->md_thresholds->p_new.p_u16);
11271107 break;
11281108 case V4L2_CID_OSD_TEXT:
1129
- strcpy(solo_enc->osd_text, ctrl->p_new.p_char);
1109
+ strscpy(solo_enc->osd_text, ctrl->p_new.p_char,
1110
+ sizeof(solo_enc->osd_text));
11301111 return solo_osd_print(solo_enc);
11311112 default:
11321113 return -EINVAL;
....@@ -1198,6 +1179,8 @@
11981179 .minor = -1,
11991180 .release = video_device_release,
12001181 .tvnorms = V4L2_STD_NTSC_M | V4L2_STD_PAL,
1182
+ .device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE |
1183
+ V4L2_CAP_STREAMING,
12011184 };
12021185
12031186 static const struct v4l2_ctrl_ops solo_ctrl_ops = {
....@@ -1321,7 +1304,7 @@
13211304 solo_enc->vfd->queue = &solo_enc->vidq;
13221305 solo_enc->vfd->lock = &solo_enc->lock;
13231306 video_set_drvdata(solo_enc->vfd, solo_enc);
1324
- ret = video_register_device(solo_enc->vfd, VFL_TYPE_GRABBER, nr);
1307
+ ret = video_register_device(solo_enc->vfd, VFL_TYPE_VIDEO, nr);
13251308 if (ret < 0)
13261309 goto vdev_release;
13271310