Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e0e31cdb authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab
Browse files

V4L/DVB (8105): cx2341x: add TS capability



The cx18 can support transport streams with newer firmwares. Add a TS
capability to the generic cx2341x module.

Signed-off-by: default avatarHans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent 37f89f95
Loading
Loading
Loading
Loading
+3 −1
Original line number Original line Diff line number Diff line
@@ -92,11 +92,13 @@ int cx18_queryctrl(struct file *file, void *fh, struct v4l2_queryctrl *qctrl)


int cx18_querymenu(struct file *file, void *fh, struct v4l2_querymenu *qmenu)
int cx18_querymenu(struct file *file, void *fh, struct v4l2_querymenu *qmenu)
{
{
	struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
	struct v4l2_queryctrl qctrl;
	struct v4l2_queryctrl qctrl;


	qctrl.id = qmenu->id;
	qctrl.id = qmenu->id;
	cx18_queryctrl(file, fh, &qctrl);
	cx18_queryctrl(file, fh, &qctrl);
	return v4l2_ctrl_query_menu(qmenu, &qctrl, cx2341x_ctrl_get_menu(qmenu->id));
	return v4l2_ctrl_query_menu(qmenu, &qctrl,
			cx2341x_ctrl_get_menu(&cx->params, qmenu->id));
}
}


int cx18_s_ctrl(struct file *file, void *fh, struct v4l2_control *vctrl)
int cx18_s_ctrl(struct file *file, void *fh, struct v4l2_control *vctrl)
+20 −9
Original line number Original line Diff line number Diff line
@@ -80,7 +80,7 @@ EXPORT_SYMBOL(cx2341x_mpeg_ctrls);


/* Map the control ID to the correct field in the cx2341x_mpeg_params
/* Map the control ID to the correct field in the cx2341x_mpeg_params
   struct. Return -EINVAL if the ID is unknown, else return 0. */
   struct. Return -EINVAL if the ID is unknown, else return 0. */
static int cx2341x_get_ctrl(struct cx2341x_mpeg_params *params,
static int cx2341x_get_ctrl(const struct cx2341x_mpeg_params *params,
		struct v4l2_ext_control *ctrl)
		struct v4l2_ext_control *ctrl)
{
{
	switch (ctrl->id) {
	switch (ctrl->id) {
@@ -420,7 +420,7 @@ static int cx2341x_ctrl_query_fill(struct v4l2_queryctrl *qctrl,
	return 0;
	return 0;
}
}


int cx2341x_ctrl_query(struct cx2341x_mpeg_params *params,
int cx2341x_ctrl_query(const struct cx2341x_mpeg_params *params,
		       struct v4l2_queryctrl *qctrl)
		       struct v4l2_queryctrl *qctrl)
{
{
	int err;
	int err;
@@ -580,9 +580,9 @@ int cx2341x_ctrl_query(struct cx2341x_mpeg_params *params,
}
}
EXPORT_SYMBOL(cx2341x_ctrl_query);
EXPORT_SYMBOL(cx2341x_ctrl_query);


const char **cx2341x_ctrl_get_menu(u32 id)
const char **cx2341x_ctrl_get_menu(const struct cx2341x_mpeg_params *p, u32 id)
{
{
	static const char *mpeg_stream_type[] = {
	static const char *mpeg_stream_type_without_ts[] = {
		"MPEG-2 Program Stream",
		"MPEG-2 Program Stream",
		"",
		"",
		"MPEG-1 System Stream",
		"MPEG-1 System Stream",
@@ -592,6 +592,16 @@ const char **cx2341x_ctrl_get_menu(u32 id)
		NULL
		NULL
	};
	};


	static const char *mpeg_stream_type_with_ts[] = {
		"MPEG-2 Program Stream",
		"MPEG-2 Transport Stream",
		"MPEG-1 System Stream",
		"MPEG-2 DVD-compatible Stream",
		"MPEG-1 VCD-compatible Stream",
		"MPEG-2 SVCD-compatible Stream",
		NULL
	};

	static const char *cx2341x_video_spatial_filter_mode_menu[] = {
	static const char *cx2341x_video_spatial_filter_mode_menu[] = {
		"Manual",
		"Manual",
		"Auto",
		"Auto",
@@ -630,7 +640,8 @@ const char **cx2341x_ctrl_get_menu(u32 id)


	switch (id) {
	switch (id) {
	case V4L2_CID_MPEG_STREAM_TYPE:
	case V4L2_CID_MPEG_STREAM_TYPE:
		return mpeg_stream_type;
		return (p->capabilities & CX2341X_CAP_HAS_TS) ?
			mpeg_stream_type_with_ts : mpeg_stream_type_without_ts;
	case V4L2_CID_MPEG_AUDIO_L1_BITRATE:
	case V4L2_CID_MPEG_AUDIO_L1_BITRATE:
	case V4L2_CID_MPEG_AUDIO_L3_BITRATE:
	case V4L2_CID_MPEG_AUDIO_L3_BITRATE:
		return NULL;
		return NULL;
@@ -690,7 +701,7 @@ int cx2341x_ext_ctrls(struct cx2341x_mpeg_params *params, int busy,
		if (err)
		if (err)
			break;
			break;
		if (qctrl.type == V4L2_CTRL_TYPE_MENU)
		if (qctrl.type == V4L2_CTRL_TYPE_MENU)
			menu_items = cx2341x_ctrl_get_menu(qctrl.id);
			menu_items = cx2341x_ctrl_get_menu(params, qctrl.id);
		err = v4l2_ctrl_check(ctrl, &qctrl, menu_items);
		err = v4l2_ctrl_check(ctrl, &qctrl, menu_items);
		if (err)
		if (err)
			break;
			break;
@@ -933,9 +944,9 @@ int cx2341x_update(void *priv, cx2341x_mbox_func func,
}
}
EXPORT_SYMBOL(cx2341x_update);
EXPORT_SYMBOL(cx2341x_update);


static const char *cx2341x_menu_item(struct cx2341x_mpeg_params *p, u32 id)
static const char *cx2341x_menu_item(const struct cx2341x_mpeg_params *p, u32 id)
{
{
	const char **menu = cx2341x_ctrl_get_menu(id);
	const char **menu = cx2341x_ctrl_get_menu(p, id);
	struct v4l2_ext_control ctrl;
	struct v4l2_ext_control ctrl;


	if (menu == NULL)
	if (menu == NULL)
@@ -952,7 +963,7 @@ static const char *cx2341x_menu_item(struct cx2341x_mpeg_params *p, u32 id)
	return "<invalid>";
	return "<invalid>";
}
}


void cx2341x_log_status(struct cx2341x_mpeg_params *p, const char *prefix)
void cx2341x_log_status(const struct cx2341x_mpeg_params *p, const char *prefix)
{
{
	int is_mpeg1 = p->video_encoding == V4L2_MPEG_VIDEO_ENCODING_MPEG_1;
	int is_mpeg1 = p->video_encoding == V4L2_MPEG_VIDEO_ENCODING_MPEG_1;
	int temporal = p->video_temporal_filter;
	int temporal = p->video_temporal_filter;
+1 −1
Original line number Original line Diff line number Diff line
@@ -1173,7 +1173,7 @@ static int cx23885_querymenu(struct cx23885_dev *dev,
	qctrl.id = qmenu->id;
	qctrl.id = qmenu->id;
	cx23885_queryctrl(dev, &qctrl);
	cx23885_queryctrl(dev, &qctrl);
	return v4l2_ctrl_query_menu(qmenu, &qctrl,
	return v4l2_ctrl_query_menu(qmenu, &qctrl,
		cx2341x_ctrl_get_menu(qmenu->id));
		cx2341x_ctrl_get_menu(&dev->mpeg_params, qmenu->id));
}
}


int cx23885_do_ioctl(struct inode *inode, struct file *file, int radio,
int cx23885_do_ioctl(struct inode *inode, struct file *file, int radio,
+2 −1
Original line number Original line Diff line number Diff line
@@ -715,7 +715,8 @@ static int vidioc_querymenu (struct file *file, void *priv,


	qctrl.id = qmenu->id;
	qctrl.id = qmenu->id;
	blackbird_queryctrl(dev, &qctrl);
	blackbird_queryctrl(dev, &qctrl);
	return v4l2_ctrl_query_menu(qmenu, &qctrl, cx2341x_ctrl_get_menu(qmenu->id));
	return v4l2_ctrl_query_menu(qmenu, &qctrl,
			cx2341x_ctrl_get_menu(&dev->params, qmenu->id));
}
}


static int vidioc_querycap (struct file *file, void  *priv,
static int vidioc_querycap (struct file *file, void  *priv,
+3 −1
Original line number Original line Diff line number Diff line
@@ -89,11 +89,13 @@ int ivtv_queryctrl(struct file *file, void *fh, struct v4l2_queryctrl *qctrl)


int ivtv_querymenu(struct file *file, void *fh, struct v4l2_querymenu *qmenu)
int ivtv_querymenu(struct file *file, void *fh, struct v4l2_querymenu *qmenu)
{
{
	struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv;
	struct v4l2_queryctrl qctrl;
	struct v4l2_queryctrl qctrl;


	qctrl.id = qmenu->id;
	qctrl.id = qmenu->id;
	ivtv_queryctrl(file, fh, &qctrl);
	ivtv_queryctrl(file, fh, &qctrl);
	return v4l2_ctrl_query_menu(qmenu, &qctrl, cx2341x_ctrl_get_menu(qmenu->id));
	return v4l2_ctrl_query_menu(qmenu, &qctrl,
			cx2341x_ctrl_get_menu(&itv->params, qmenu->id));
}
}


int ivtv_s_ctrl(struct file *file, void *fh, struct v4l2_control *vctrl)
int ivtv_s_ctrl(struct file *file, void *fh, struct v4l2_control *vctrl)
Loading