diff mbox series

[05/15] media/i2c: rename MPEG to CODEC

Message ID 20210313144323.143600-6-hverkuil-cisco@xs4all.nl
State New
Headers show
Series v4l2-controls.h: rename _MPEG_ to _CODEC_ | expand

Commit Message

Hans Verkuil March 13, 2021, 2:43 p.m. UTC
Historically all codec-related data structures and defines used the
MPEG prefix. This is confusing. Rename MPEG to CODEC to make it clear
that the MPEG prefix isn't MPEG specific.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
---
 drivers/media/i2c/saa6752hs.c | 144 +++++++++++++++++-----------------
 1 file changed, 72 insertions(+), 72 deletions(-)
diff mbox series

Patch

diff --git a/drivers/media/i2c/saa6752hs.c b/drivers/media/i2c/saa6752hs.c
index 6171ced809bb..8c4731495739 100644
--- a/drivers/media/i2c/saa6752hs.c
+++ b/drivers/media/i2c/saa6752hs.c
@@ -53,13 +53,13 @@  struct saa6752hs_mpeg_params {
 	__u16				ts_pid_pcr;
 
 	/* audio */
-	enum v4l2_mpeg_audio_encoding    au_encoding;
-	enum v4l2_mpeg_audio_l2_bitrate  au_l2_bitrate;
-	enum v4l2_mpeg_audio_ac3_bitrate au_ac3_bitrate;
+	enum v4l2_codec_audio_encoding    au_encoding;
+	enum v4l2_codec_audio_l2_bitrate  au_l2_bitrate;
+	enum v4l2_codec_audio_ac3_bitrate au_ac3_bitrate;
 
 	/* video */
-	enum v4l2_mpeg_video_aspect	vi_aspect;
-	enum v4l2_mpeg_video_bitrate_mode vi_bitrate_mode;
+	enum v4l2_codec_video_aspect	vi_aspect;
+	enum v4l2_codec_video_bitrate_mode vi_bitrate_mode;
 	__u32				vi_bitrate;
 	__u32				vi_bitrate_peak;
 };
@@ -207,14 +207,14 @@  static const struct saa6752hs_mpeg_params param_defaults =
 	.ts_pid_audio    = 256,
 	.ts_pid_pcr      = 259,
 
-	.vi_aspect       = V4L2_MPEG_VIDEO_ASPECT_4x3,
+	.vi_aspect       = V4L2_CODEC_VIDEO_ASPECT_4x3,
 	.vi_bitrate      = 4000,
 	.vi_bitrate_peak = 6000,
-	.vi_bitrate_mode = V4L2_MPEG_VIDEO_BITRATE_MODE_VBR,
+	.vi_bitrate_mode = V4L2_CODEC_VIDEO_BITRATE_MODE_VBR,
 
-	.au_encoding     = V4L2_MPEG_AUDIO_ENCODING_LAYER_2,
-	.au_l2_bitrate   = V4L2_MPEG_AUDIO_L2_BITRATE_256K,
-	.au_ac3_bitrate  = V4L2_MPEG_AUDIO_AC3_BITRATE_256K,
+	.au_encoding     = V4L2_CODEC_AUDIO_ENCODING_LAYER_2,
+	.au_l2_bitrate   = V4L2_CODEC_AUDIO_L2_BITRATE_256K,
+	.au_ac3_bitrate  = V4L2_CODEC_AUDIO_AC3_BITRATE_256K,
 };
 
 /* ---------------------------------------------------------------------- */
@@ -314,10 +314,10 @@  static int saa6752hs_set_bitrate(struct i2c_client *client,
 
 	/* set the bitrate mode */
 	set_reg8(client, 0x71,
-		params->vi_bitrate_mode != V4L2_MPEG_VIDEO_BITRATE_MODE_VBR);
+		params->vi_bitrate_mode != V4L2_CODEC_VIDEO_BITRATE_MODE_VBR);
 
 	/* set the video bitrate */
-	if (params->vi_bitrate_mode == V4L2_MPEG_VIDEO_BITRATE_MODE_VBR) {
+	if (params->vi_bitrate_mode == V4L2_CODEC_VIDEO_BITRATE_MODE_VBR) {
 		/* set the target bitrate */
 		set_reg16(client, 0x80, params->vi_bitrate);
 
@@ -332,13 +332,13 @@  static int saa6752hs_set_bitrate(struct i2c_client *client,
 
 	/* set the audio encoding */
 	set_reg8(client, 0x93,
-			params->au_encoding == V4L2_MPEG_AUDIO_ENCODING_AC3);
+			params->au_encoding == V4L2_CODEC_AUDIO_ENCODING_AC3);
 
 	/* set the audio bitrate */
-	if (params->au_encoding == V4L2_MPEG_AUDIO_ENCODING_AC3)
-		is_384k = V4L2_MPEG_AUDIO_AC3_BITRATE_384K == params->au_ac3_bitrate;
+	if (params->au_encoding == V4L2_CODEC_AUDIO_ENCODING_AC3)
+		is_384k = V4L2_CODEC_AUDIO_AC3_BITRATE_384K == params->au_ac3_bitrate;
 	else
-		is_384k = V4L2_MPEG_AUDIO_L2_BITRATE_384K == params->au_l2_bitrate;
+		is_384k = V4L2_CODEC_AUDIO_L2_BITRATE_384K == params->au_l2_bitrate;
 	set_reg8(client, 0x94, is_384k);
 	tot_bitrate += is_384k ? 384 : 256;
 
@@ -361,9 +361,9 @@  static int saa6752hs_try_ctrl(struct v4l2_ctrl *ctrl)
 		container_of(ctrl->handler, struct saa6752hs_state, hdl);
 
 	switch (ctrl->id) {
-	case V4L2_CID_MPEG_VIDEO_BITRATE_MODE:
+	case V4L2_CID_CODEC_VIDEO_BITRATE_MODE:
 		/* peak bitrate shall be >= normal bitrate */
-		if (ctrl->val == V4L2_MPEG_VIDEO_BITRATE_MODE_VBR &&
+		if (ctrl->val == V4L2_CODEC_VIDEO_BITRATE_MODE_VBR &&
 		    h->video_bitrate_peak->val < h->video_bitrate->val)
 			h->video_bitrate_peak->val = h->video_bitrate->val;
 		break;
@@ -378,42 +378,42 @@  static int saa6752hs_s_ctrl(struct v4l2_ctrl *ctrl)
 	struct saa6752hs_mpeg_params *params = &h->params;
 
 	switch (ctrl->id) {
-	case V4L2_CID_MPEG_STREAM_TYPE:
+	case V4L2_CID_CODEC_STREAM_TYPE:
 		break;
-	case V4L2_CID_MPEG_STREAM_PID_PMT:
+	case V4L2_CID_CODEC_STREAM_PID_PMT:
 		params->ts_pid_pmt = ctrl->val;
 		break;
-	case V4L2_CID_MPEG_STREAM_PID_AUDIO:
+	case V4L2_CID_CODEC_STREAM_PID_AUDIO:
 		params->ts_pid_audio = ctrl->val;
 		break;
-	case V4L2_CID_MPEG_STREAM_PID_VIDEO:
+	case V4L2_CID_CODEC_STREAM_PID_VIDEO:
 		params->ts_pid_video = ctrl->val;
 		break;
-	case V4L2_CID_MPEG_STREAM_PID_PCR:
+	case V4L2_CID_CODEC_STREAM_PID_PCR:
 		params->ts_pid_pcr = ctrl->val;
 		break;
-	case V4L2_CID_MPEG_AUDIO_ENCODING:
+	case V4L2_CID_CODEC_AUDIO_ENCODING:
 		params->au_encoding = ctrl->val;
 		break;
-	case V4L2_CID_MPEG_AUDIO_L2_BITRATE:
+	case V4L2_CID_CODEC_AUDIO_L2_BITRATE:
 		params->au_l2_bitrate = ctrl->val;
 		break;
-	case V4L2_CID_MPEG_AUDIO_AC3_BITRATE:
+	case V4L2_CID_CODEC_AUDIO_AC3_BITRATE:
 		params->au_ac3_bitrate = ctrl->val;
 		break;
-	case V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ:
+	case V4L2_CID_CODEC_AUDIO_SAMPLING_FREQ:
 		break;
-	case V4L2_CID_MPEG_VIDEO_ENCODING:
+	case V4L2_CID_CODEC_VIDEO_ENCODING:
 		break;
-	case V4L2_CID_MPEG_VIDEO_ASPECT:
+	case V4L2_CID_CODEC_VIDEO_ASPECT:
 		params->vi_aspect = ctrl->val;
 		break;
-	case V4L2_CID_MPEG_VIDEO_BITRATE_MODE:
+	case V4L2_CID_CODEC_VIDEO_BITRATE_MODE:
 		params->vi_bitrate_mode = ctrl->val;
 		params->vi_bitrate = h->video_bitrate->val / 1000;
 		params->vi_bitrate_peak = h->video_bitrate_peak->val / 1000;
 		v4l2_ctrl_activate(h->video_bitrate_peak,
-				ctrl->val == V4L2_MPEG_VIDEO_BITRATE_MODE_VBR);
+				ctrl->val == V4L2_CODEC_VIDEO_BITRATE_MODE_VBR);
 		break;
 	default:
 		return -EINVAL;
@@ -469,7 +469,7 @@  static int saa6752hs_init(struct v4l2_subdev *sd, u32 leading_null_bytes)
 	localPAT[sizeof(PAT) - 1] = crc & 0xFF;
 
 	/* compute PMT */
-	if (h->params.au_encoding == V4L2_MPEG_AUDIO_ENCODING_AC3) {
+	if (h->params.au_encoding == V4L2_CODEC_AUDIO_ENCODING_AC3) {
 		size = sizeof(PMT_AC3);
 		memcpy(localPMT, PMT_AC3, size);
 	} else {
@@ -527,10 +527,10 @@  static int saa6752hs_init(struct v4l2_subdev *sd, u32 leading_null_bytes)
 	buf[4] = 0xB0;
 	buf[5] = buf2[0];
 	switch (h->params.vi_aspect) {
-	case V4L2_MPEG_VIDEO_ASPECT_16x9:
+	case V4L2_CODEC_VIDEO_ASPECT_16x9:
 		buf[6] = buf2[1] | 0x40;
 		break;
-	case V4L2_MPEG_VIDEO_ASPECT_4x3:
+	case V4L2_CODEC_VIDEO_ASPECT_4x3:
 	default:
 		buf[6] = buf2[1] & 0xBF;
 		break;
@@ -690,67 +690,67 @@  static int saa6752hs_probe(struct i2c_client *client,
 	hdl = &h->hdl;
 	v4l2_ctrl_handler_init(hdl, 14);
 	v4l2_ctrl_new_std_menu(hdl, &saa6752hs_ctrl_ops,
-		V4L2_CID_MPEG_AUDIO_ENCODING,
-		h->has_ac3 ? V4L2_MPEG_AUDIO_ENCODING_AC3 :
-			V4L2_MPEG_AUDIO_ENCODING_LAYER_2,
-		0x0d, V4L2_MPEG_AUDIO_ENCODING_LAYER_2);
+		V4L2_CID_CODEC_AUDIO_ENCODING,
+		h->has_ac3 ? V4L2_CODEC_AUDIO_ENCODING_AC3 :
+			V4L2_CODEC_AUDIO_ENCODING_LAYER_2,
+		0x0d, V4L2_CODEC_AUDIO_ENCODING_LAYER_2);
 
 	v4l2_ctrl_new_std_menu(hdl, &saa6752hs_ctrl_ops,
-		V4L2_CID_MPEG_AUDIO_L2_BITRATE,
-		V4L2_MPEG_AUDIO_L2_BITRATE_384K,
-		~((1 << V4L2_MPEG_AUDIO_L2_BITRATE_256K) |
-		  (1 << V4L2_MPEG_AUDIO_L2_BITRATE_384K)),
-		V4L2_MPEG_AUDIO_L2_BITRATE_256K);
+		V4L2_CID_CODEC_AUDIO_L2_BITRATE,
+		V4L2_CODEC_AUDIO_L2_BITRATE_384K,
+		~((1 << V4L2_CODEC_AUDIO_L2_BITRATE_256K) |
+		  (1 << V4L2_CODEC_AUDIO_L2_BITRATE_384K)),
+		V4L2_CODEC_AUDIO_L2_BITRATE_256K);
 
 	if (h->has_ac3)
 		v4l2_ctrl_new_std_menu(hdl, &saa6752hs_ctrl_ops,
-			V4L2_CID_MPEG_AUDIO_AC3_BITRATE,
-			V4L2_MPEG_AUDIO_AC3_BITRATE_384K,
-			~((1 << V4L2_MPEG_AUDIO_AC3_BITRATE_256K) |
-			  (1 << V4L2_MPEG_AUDIO_AC3_BITRATE_384K)),
-			V4L2_MPEG_AUDIO_AC3_BITRATE_256K);
+			V4L2_CID_CODEC_AUDIO_AC3_BITRATE,
+			V4L2_CODEC_AUDIO_AC3_BITRATE_384K,
+			~((1 << V4L2_CODEC_AUDIO_AC3_BITRATE_256K) |
+			  (1 << V4L2_CODEC_AUDIO_AC3_BITRATE_384K)),
+			V4L2_CODEC_AUDIO_AC3_BITRATE_256K);
 
 	v4l2_ctrl_new_std_menu(hdl, &saa6752hs_ctrl_ops,
-		V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ,
-		V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000,
-		~(1 << V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000),
-		V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000);
+		V4L2_CID_CODEC_AUDIO_SAMPLING_FREQ,
+		V4L2_CODEC_AUDIO_SAMPLING_FREQ_48000,
+		~(1 << V4L2_CODEC_AUDIO_SAMPLING_FREQ_48000),
+		V4L2_CODEC_AUDIO_SAMPLING_FREQ_48000);
 
 	v4l2_ctrl_new_std_menu(hdl, &saa6752hs_ctrl_ops,
-		V4L2_CID_MPEG_VIDEO_ENCODING,
-		V4L2_MPEG_VIDEO_ENCODING_MPEG_2,
-		~(1 << V4L2_MPEG_VIDEO_ENCODING_MPEG_2),
-		V4L2_MPEG_VIDEO_ENCODING_MPEG_2);
+		V4L2_CID_CODEC_VIDEO_ENCODING,
+		V4L2_CODEC_VIDEO_ENCODING_MPEG_2,
+		~(1 << V4L2_CODEC_VIDEO_ENCODING_MPEG_2),
+		V4L2_CODEC_VIDEO_ENCODING_MPEG_2);
 
 	v4l2_ctrl_new_std_menu(hdl, &saa6752hs_ctrl_ops,
-		V4L2_CID_MPEG_VIDEO_ASPECT,
-		V4L2_MPEG_VIDEO_ASPECT_16x9, 0x01,
-		V4L2_MPEG_VIDEO_ASPECT_4x3);
+		V4L2_CID_CODEC_VIDEO_ASPECT,
+		V4L2_CODEC_VIDEO_ASPECT_16x9, 0x01,
+		V4L2_CODEC_VIDEO_ASPECT_4x3);
 
 	h->video_bitrate_peak = v4l2_ctrl_new_std(hdl, &saa6752hs_ctrl_ops,
-		V4L2_CID_MPEG_VIDEO_BITRATE_PEAK,
+		V4L2_CID_CODEC_VIDEO_BITRATE_PEAK,
 		1000000, 27000000, 1000, 8000000);
 
 	v4l2_ctrl_new_std_menu(hdl, &saa6752hs_ctrl_ops,
-		V4L2_CID_MPEG_STREAM_TYPE,
-		V4L2_MPEG_STREAM_TYPE_MPEG2_TS,
-		~(1 << V4L2_MPEG_STREAM_TYPE_MPEG2_TS),
-		V4L2_MPEG_STREAM_TYPE_MPEG2_TS);
+		V4L2_CID_CODEC_STREAM_TYPE,
+		V4L2_CODEC_STREAM_TYPE_MPEG2_TS,
+		~(1 << V4L2_CODEC_STREAM_TYPE_MPEG2_TS),
+		V4L2_CODEC_STREAM_TYPE_MPEG2_TS);
 
 	h->video_bitrate_mode = v4l2_ctrl_new_std_menu(hdl, &saa6752hs_ctrl_ops,
-		V4L2_CID_MPEG_VIDEO_BITRATE_MODE,
-		V4L2_MPEG_VIDEO_BITRATE_MODE_CBR, 0,
-		V4L2_MPEG_VIDEO_BITRATE_MODE_VBR);
+		V4L2_CID_CODEC_VIDEO_BITRATE_MODE,
+		V4L2_CODEC_VIDEO_BITRATE_MODE_CBR, 0,
+		V4L2_CODEC_VIDEO_BITRATE_MODE_VBR);
 	h->video_bitrate = v4l2_ctrl_new_std(hdl, &saa6752hs_ctrl_ops,
-		V4L2_CID_MPEG_VIDEO_BITRATE, 1000000, 27000000, 1000, 6000000);
+		V4L2_CID_CODEC_VIDEO_BITRATE, 1000000, 27000000, 1000, 6000000);
 	v4l2_ctrl_new_std(hdl, &saa6752hs_ctrl_ops,
-		V4L2_CID_MPEG_STREAM_PID_PMT, 0, (1 << 14) - 1, 1, 16);
+		V4L2_CID_CODEC_STREAM_PID_PMT, 0, (1 << 14) - 1, 1, 16);
 	v4l2_ctrl_new_std(hdl, &saa6752hs_ctrl_ops,
-		V4L2_CID_MPEG_STREAM_PID_AUDIO, 0, (1 << 14) - 1, 1, 260);
+		V4L2_CID_CODEC_STREAM_PID_AUDIO, 0, (1 << 14) - 1, 1, 260);
 	v4l2_ctrl_new_std(hdl, &saa6752hs_ctrl_ops,
-		V4L2_CID_MPEG_STREAM_PID_VIDEO, 0, (1 << 14) - 1, 1, 256);
+		V4L2_CID_CODEC_STREAM_PID_VIDEO, 0, (1 << 14) - 1, 1, 256);
 	v4l2_ctrl_new_std(hdl, &saa6752hs_ctrl_ops,
-		V4L2_CID_MPEG_STREAM_PID_PCR, 0, (1 << 14) - 1, 1, 259);
+		V4L2_CID_CODEC_STREAM_PID_PCR, 0, (1 << 14) - 1, 1, 259);
 	sd->ctrl_handler = hdl;
 	if (hdl->error) {
 		int err = hdl->error;