2006-06-19 01:40:30 +08:00
|
|
|
/*
|
|
|
|
* cx2341x - generic code for cx23415/6 based devices
|
|
|
|
*
|
|
|
|
* Copyright (C) 2006 Hans Verkuil <hverkuil@xs4all.nl>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/errno.h>
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/types.h>
|
|
|
|
#include <linux/videodev2.h>
|
|
|
|
|
|
|
|
#include <media/tuner.h>
|
|
|
|
#include <media/cx2341x.h>
|
|
|
|
#include <media/v4l2-common.h>
|
|
|
|
|
|
|
|
MODULE_DESCRIPTION("cx23415/6 driver");
|
|
|
|
MODULE_AUTHOR("Hans Verkuil");
|
|
|
|
MODULE_LICENSE("GPL");
|
|
|
|
|
2007-11-02 00:38:12 +08:00
|
|
|
static int debug;
|
2006-06-19 01:40:30 +08:00
|
|
|
module_param(debug, int, 0644);
|
|
|
|
MODULE_PARM_DESC(debug, "Debug level (0-1)");
|
|
|
|
|
2006-06-20 04:53:08 +08:00
|
|
|
const u32 cx2341x_mpeg_ctrls[] = {
|
|
|
|
V4L2_CID_MPEG_CLASS,
|
|
|
|
V4L2_CID_MPEG_STREAM_TYPE,
|
2006-06-25 01:36:02 +08:00
|
|
|
V4L2_CID_MPEG_STREAM_VBI_FMT,
|
2006-06-20 04:53:08 +08:00
|
|
|
V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ,
|
|
|
|
V4L2_CID_MPEG_AUDIO_ENCODING,
|
|
|
|
V4L2_CID_MPEG_AUDIO_L2_BITRATE,
|
|
|
|
V4L2_CID_MPEG_AUDIO_MODE,
|
|
|
|
V4L2_CID_MPEG_AUDIO_MODE_EXTENSION,
|
|
|
|
V4L2_CID_MPEG_AUDIO_EMPHASIS,
|
|
|
|
V4L2_CID_MPEG_AUDIO_CRC,
|
2007-04-27 23:31:00 +08:00
|
|
|
V4L2_CID_MPEG_AUDIO_MUTE,
|
2006-06-20 04:53:08 +08:00
|
|
|
V4L2_CID_MPEG_VIDEO_ENCODING,
|
|
|
|
V4L2_CID_MPEG_VIDEO_ASPECT,
|
|
|
|
V4L2_CID_MPEG_VIDEO_B_FRAMES,
|
|
|
|
V4L2_CID_MPEG_VIDEO_GOP_SIZE,
|
|
|
|
V4L2_CID_MPEG_VIDEO_GOP_CLOSURE,
|
|
|
|
V4L2_CID_MPEG_VIDEO_BITRATE_MODE,
|
|
|
|
V4L2_CID_MPEG_VIDEO_BITRATE,
|
|
|
|
V4L2_CID_MPEG_VIDEO_BITRATE_PEAK,
|
|
|
|
V4L2_CID_MPEG_VIDEO_TEMPORAL_DECIMATION,
|
2007-04-27 23:31:00 +08:00
|
|
|
V4L2_CID_MPEG_VIDEO_MUTE,
|
|
|
|
V4L2_CID_MPEG_VIDEO_MUTE_YUV,
|
2006-06-20 04:53:08 +08:00
|
|
|
V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE,
|
|
|
|
V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER,
|
|
|
|
V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE,
|
|
|
|
V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE,
|
|
|
|
V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE,
|
|
|
|
V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER,
|
|
|
|
V4L2_CID_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE,
|
|
|
|
V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_BOTTOM,
|
|
|
|
V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_TOP,
|
|
|
|
V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_BOTTOM,
|
|
|
|
V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_TOP,
|
2007-04-27 23:31:00 +08:00
|
|
|
V4L2_CID_MPEG_CX2341X_STREAM_INSERT_NAV_PACKETS,
|
2006-06-20 04:53:08 +08:00
|
|
|
0
|
|
|
|
};
|
2007-11-02 00:38:12 +08:00
|
|
|
EXPORT_SYMBOL(cx2341x_mpeg_ctrls);
|
2006-06-20 04:53:08 +08:00
|
|
|
|
2008-07-17 23:26:45 +08:00
|
|
|
static const struct cx2341x_mpeg_params default_params = {
|
|
|
|
/* misc */
|
|
|
|
.capabilities = 0,
|
|
|
|
.port = CX2341X_PORT_MEMORY,
|
|
|
|
.width = 720,
|
|
|
|
.height = 480,
|
|
|
|
.is_50hz = 0,
|
|
|
|
|
|
|
|
/* stream */
|
|
|
|
.stream_type = V4L2_MPEG_STREAM_TYPE_MPEG2_PS,
|
|
|
|
.stream_vbi_fmt = V4L2_MPEG_STREAM_VBI_FMT_NONE,
|
|
|
|
.stream_insert_nav_packets = 0,
|
|
|
|
|
|
|
|
/* audio */
|
|
|
|
.audio_sampling_freq = V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000,
|
|
|
|
.audio_encoding = V4L2_MPEG_AUDIO_ENCODING_LAYER_2,
|
|
|
|
.audio_l2_bitrate = V4L2_MPEG_AUDIO_L2_BITRATE_224K,
|
|
|
|
.audio_mode = V4L2_MPEG_AUDIO_MODE_STEREO,
|
|
|
|
.audio_mode_extension = V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_4,
|
|
|
|
.audio_emphasis = V4L2_MPEG_AUDIO_EMPHASIS_NONE,
|
|
|
|
.audio_crc = V4L2_MPEG_AUDIO_CRC_NONE,
|
|
|
|
.audio_mute = 0,
|
|
|
|
|
|
|
|
/* video */
|
|
|
|
.video_encoding = V4L2_MPEG_VIDEO_ENCODING_MPEG_2,
|
|
|
|
.video_aspect = V4L2_MPEG_VIDEO_ASPECT_4x3,
|
|
|
|
.video_b_frames = 2,
|
|
|
|
.video_gop_size = 12,
|
|
|
|
.video_gop_closure = 1,
|
|
|
|
.video_bitrate_mode = V4L2_MPEG_VIDEO_BITRATE_MODE_VBR,
|
|
|
|
.video_bitrate = 6000000,
|
|
|
|
.video_bitrate_peak = 8000000,
|
|
|
|
.video_temporal_decimation = 0,
|
|
|
|
.video_mute = 0,
|
|
|
|
.video_mute_yuv = 0x008080, /* YCbCr value for black */
|
|
|
|
|
|
|
|
/* encoding filters */
|
|
|
|
.video_spatial_filter_mode =
|
|
|
|
V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_MANUAL,
|
|
|
|
.video_spatial_filter = 0,
|
|
|
|
.video_luma_spatial_filter_type =
|
|
|
|
V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_HOR,
|
|
|
|
.video_chroma_spatial_filter_type =
|
|
|
|
V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_1D_HOR,
|
|
|
|
.video_temporal_filter_mode =
|
|
|
|
V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_MANUAL,
|
|
|
|
.video_temporal_filter = 8,
|
|
|
|
.video_median_filter_type =
|
|
|
|
V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF,
|
|
|
|
.video_luma_median_filter_top = 255,
|
|
|
|
.video_luma_median_filter_bottom = 0,
|
|
|
|
.video_chroma_median_filter_top = 255,
|
|
|
|
.video_chroma_median_filter_bottom = 0,
|
|
|
|
};
|
|
|
|
|
2006-06-19 01:40:30 +08:00
|
|
|
|
|
|
|
/* Map the control ID to the correct field in the cx2341x_mpeg_params
|
|
|
|
struct. Return -EINVAL if the ID is unknown, else return 0. */
|
2008-06-22 23:03:28 +08:00
|
|
|
static int cx2341x_get_ctrl(const struct cx2341x_mpeg_params *params,
|
2006-06-19 01:40:30 +08:00
|
|
|
struct v4l2_ext_control *ctrl)
|
|
|
|
{
|
|
|
|
switch (ctrl->id) {
|
|
|
|
case V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ:
|
|
|
|
ctrl->value = params->audio_sampling_freq;
|
|
|
|
break;
|
|
|
|
case V4L2_CID_MPEG_AUDIO_ENCODING:
|
|
|
|
ctrl->value = params->audio_encoding;
|
|
|
|
break;
|
|
|
|
case V4L2_CID_MPEG_AUDIO_L2_BITRATE:
|
|
|
|
ctrl->value = params->audio_l2_bitrate;
|
|
|
|
break;
|
|
|
|
case V4L2_CID_MPEG_AUDIO_MODE:
|
|
|
|
ctrl->value = params->audio_mode;
|
|
|
|
break;
|
|
|
|
case V4L2_CID_MPEG_AUDIO_MODE_EXTENSION:
|
|
|
|
ctrl->value = params->audio_mode_extension;
|
|
|
|
break;
|
|
|
|
case V4L2_CID_MPEG_AUDIO_EMPHASIS:
|
|
|
|
ctrl->value = params->audio_emphasis;
|
|
|
|
break;
|
|
|
|
case V4L2_CID_MPEG_AUDIO_CRC:
|
|
|
|
ctrl->value = params->audio_crc;
|
|
|
|
break;
|
2007-04-27 23:31:00 +08:00
|
|
|
case V4L2_CID_MPEG_AUDIO_MUTE:
|
|
|
|
ctrl->value = params->audio_mute;
|
|
|
|
break;
|
2006-06-19 01:40:30 +08:00
|
|
|
case V4L2_CID_MPEG_VIDEO_ENCODING:
|
|
|
|
ctrl->value = params->video_encoding;
|
|
|
|
break;
|
|
|
|
case V4L2_CID_MPEG_VIDEO_ASPECT:
|
|
|
|
ctrl->value = params->video_aspect;
|
|
|
|
break;
|
|
|
|
case V4L2_CID_MPEG_VIDEO_B_FRAMES:
|
|
|
|
ctrl->value = params->video_b_frames;
|
|
|
|
break;
|
|
|
|
case V4L2_CID_MPEG_VIDEO_GOP_SIZE:
|
|
|
|
ctrl->value = params->video_gop_size;
|
|
|
|
break;
|
|
|
|
case V4L2_CID_MPEG_VIDEO_GOP_CLOSURE:
|
|
|
|
ctrl->value = params->video_gop_closure;
|
|
|
|
break;
|
|
|
|
case V4L2_CID_MPEG_VIDEO_BITRATE_MODE:
|
|
|
|
ctrl->value = params->video_bitrate_mode;
|
|
|
|
break;
|
|
|
|
case V4L2_CID_MPEG_VIDEO_BITRATE:
|
|
|
|
ctrl->value = params->video_bitrate;
|
|
|
|
break;
|
|
|
|
case V4L2_CID_MPEG_VIDEO_BITRATE_PEAK:
|
|
|
|
ctrl->value = params->video_bitrate_peak;
|
|
|
|
break;
|
|
|
|
case V4L2_CID_MPEG_VIDEO_TEMPORAL_DECIMATION:
|
|
|
|
ctrl->value = params->video_temporal_decimation;
|
|
|
|
break;
|
2007-04-27 23:31:00 +08:00
|
|
|
case V4L2_CID_MPEG_VIDEO_MUTE:
|
|
|
|
ctrl->value = params->video_mute;
|
|
|
|
break;
|
|
|
|
case V4L2_CID_MPEG_VIDEO_MUTE_YUV:
|
|
|
|
ctrl->value = params->video_mute_yuv;
|
|
|
|
break;
|
2006-06-19 01:40:30 +08:00
|
|
|
case V4L2_CID_MPEG_STREAM_TYPE:
|
|
|
|
ctrl->value = params->stream_type;
|
|
|
|
break;
|
2006-06-25 01:36:02 +08:00
|
|
|
case V4L2_CID_MPEG_STREAM_VBI_FMT:
|
|
|
|
ctrl->value = params->stream_vbi_fmt;
|
|
|
|
break;
|
2006-06-19 01:40:30 +08:00
|
|
|
case V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE:
|
|
|
|
ctrl->value = params->video_spatial_filter_mode;
|
|
|
|
break;
|
|
|
|
case V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER:
|
|
|
|
ctrl->value = params->video_spatial_filter;
|
|
|
|
break;
|
|
|
|
case V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE:
|
|
|
|
ctrl->value = params->video_luma_spatial_filter_type;
|
|
|
|
break;
|
|
|
|
case V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE:
|
|
|
|
ctrl->value = params->video_chroma_spatial_filter_type;
|
|
|
|
break;
|
|
|
|
case V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE:
|
|
|
|
ctrl->value = params->video_temporal_filter_mode;
|
|
|
|
break;
|
|
|
|
case V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER:
|
|
|
|
ctrl->value = params->video_temporal_filter;
|
|
|
|
break;
|
|
|
|
case V4L2_CID_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE:
|
|
|
|
ctrl->value = params->video_median_filter_type;
|
|
|
|
break;
|
|
|
|
case V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_TOP:
|
|
|
|
ctrl->value = params->video_luma_median_filter_top;
|
|
|
|
break;
|
|
|
|
case V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_BOTTOM:
|
|
|
|
ctrl->value = params->video_luma_median_filter_bottom;
|
|
|
|
break;
|
|
|
|
case V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_TOP:
|
|
|
|
ctrl->value = params->video_chroma_median_filter_top;
|
|
|
|
break;
|
|
|
|
case V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_BOTTOM:
|
|
|
|
ctrl->value = params->video_chroma_median_filter_bottom;
|
|
|
|
break;
|
2007-04-27 23:31:00 +08:00
|
|
|
case V4L2_CID_MPEG_CX2341X_STREAM_INSERT_NAV_PACKETS:
|
|
|
|
ctrl->value = params->stream_insert_nav_packets;
|
|
|
|
break;
|
2006-06-19 01:40:30 +08:00
|
|
|
default:
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Map the control ID to the correct field in the cx2341x_mpeg_params
|
|
|
|
struct. Return -EINVAL if the ID is unknown, else return 0. */
|
2007-08-22 05:32:42 +08:00
|
|
|
static int cx2341x_set_ctrl(struct cx2341x_mpeg_params *params, int busy,
|
2006-06-19 01:40:30 +08:00
|
|
|
struct v4l2_ext_control *ctrl)
|
|
|
|
{
|
|
|
|
switch (ctrl->id) {
|
|
|
|
case V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ:
|
2007-08-22 05:32:42 +08:00
|
|
|
if (busy)
|
|
|
|
return -EBUSY;
|
2006-06-19 01:40:30 +08:00
|
|
|
params->audio_sampling_freq = ctrl->value;
|
|
|
|
break;
|
|
|
|
case V4L2_CID_MPEG_AUDIO_ENCODING:
|
|
|
|
params->audio_encoding = ctrl->value;
|
|
|
|
break;
|
|
|
|
case V4L2_CID_MPEG_AUDIO_L2_BITRATE:
|
2007-08-22 05:32:42 +08:00
|
|
|
if (busy)
|
|
|
|
return -EBUSY;
|
2006-06-19 01:40:30 +08:00
|
|
|
params->audio_l2_bitrate = ctrl->value;
|
|
|
|
break;
|
|
|
|
case V4L2_CID_MPEG_AUDIO_MODE:
|
|
|
|
params->audio_mode = ctrl->value;
|
|
|
|
break;
|
|
|
|
case V4L2_CID_MPEG_AUDIO_MODE_EXTENSION:
|
|
|
|
params->audio_mode_extension = ctrl->value;
|
|
|
|
break;
|
|
|
|
case V4L2_CID_MPEG_AUDIO_EMPHASIS:
|
|
|
|
params->audio_emphasis = ctrl->value;
|
|
|
|
break;
|
|
|
|
case V4L2_CID_MPEG_AUDIO_CRC:
|
|
|
|
params->audio_crc = ctrl->value;
|
|
|
|
break;
|
2007-04-27 23:31:00 +08:00
|
|
|
case V4L2_CID_MPEG_AUDIO_MUTE:
|
|
|
|
params->audio_mute = ctrl->value;
|
|
|
|
break;
|
2006-06-19 01:40:30 +08:00
|
|
|
case V4L2_CID_MPEG_VIDEO_ASPECT:
|
|
|
|
params->video_aspect = ctrl->value;
|
|
|
|
break;
|
|
|
|
case V4L2_CID_MPEG_VIDEO_B_FRAMES: {
|
|
|
|
int b = ctrl->value + 1;
|
|
|
|
int gop = params->video_gop_size;
|
|
|
|
params->video_b_frames = ctrl->value;
|
|
|
|
params->video_gop_size = b * ((gop + b - 1) / b);
|
|
|
|
/* Max GOP size = 34 */
|
|
|
|
while (params->video_gop_size > 34)
|
|
|
|
params->video_gop_size -= b;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case V4L2_CID_MPEG_VIDEO_GOP_SIZE: {
|
|
|
|
int b = params->video_b_frames + 1;
|
|
|
|
int gop = ctrl->value;
|
|
|
|
params->video_gop_size = b * ((gop + b - 1) / b);
|
|
|
|
/* Max GOP size = 34 */
|
|
|
|
while (params->video_gop_size > 34)
|
|
|
|
params->video_gop_size -= b;
|
|
|
|
ctrl->value = params->video_gop_size;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case V4L2_CID_MPEG_VIDEO_GOP_CLOSURE:
|
|
|
|
params->video_gop_closure = ctrl->value;
|
|
|
|
break;
|
|
|
|
case V4L2_CID_MPEG_VIDEO_BITRATE_MODE:
|
2007-08-22 05:32:42 +08:00
|
|
|
if (busy)
|
|
|
|
return -EBUSY;
|
2006-06-19 01:40:30 +08:00
|
|
|
/* MPEG-1 only allows CBR */
|
|
|
|
if (params->video_encoding == V4L2_MPEG_VIDEO_ENCODING_MPEG_1 &&
|
|
|
|
ctrl->value != V4L2_MPEG_VIDEO_BITRATE_MODE_CBR)
|
|
|
|
return -EINVAL;
|
|
|
|
params->video_bitrate_mode = ctrl->value;
|
|
|
|
break;
|
|
|
|
case V4L2_CID_MPEG_VIDEO_BITRATE:
|
2007-08-22 05:32:42 +08:00
|
|
|
if (busy)
|
|
|
|
return -EBUSY;
|
2006-06-19 01:40:30 +08:00
|
|
|
params->video_bitrate = ctrl->value;
|
|
|
|
break;
|
|
|
|
case V4L2_CID_MPEG_VIDEO_BITRATE_PEAK:
|
2007-08-22 05:32:42 +08:00
|
|
|
if (busy)
|
|
|
|
return -EBUSY;
|
2006-06-19 01:40:30 +08:00
|
|
|
params->video_bitrate_peak = ctrl->value;
|
|
|
|
break;
|
|
|
|
case V4L2_CID_MPEG_VIDEO_TEMPORAL_DECIMATION:
|
|
|
|
params->video_temporal_decimation = ctrl->value;
|
|
|
|
break;
|
2007-04-27 23:31:00 +08:00
|
|
|
case V4L2_CID_MPEG_VIDEO_MUTE:
|
|
|
|
params->video_mute = (ctrl->value != 0);
|
|
|
|
break;
|
|
|
|
case V4L2_CID_MPEG_VIDEO_MUTE_YUV:
|
|
|
|
params->video_mute_yuv = ctrl->value;
|
|
|
|
break;
|
2006-06-19 01:40:30 +08:00
|
|
|
case V4L2_CID_MPEG_STREAM_TYPE:
|
2007-08-22 05:32:42 +08:00
|
|
|
if (busy)
|
|
|
|
return -EBUSY;
|
2006-06-19 01:40:30 +08:00
|
|
|
params->stream_type = ctrl->value;
|
|
|
|
params->video_encoding =
|
2007-11-02 00:38:12 +08:00
|
|
|
(params->stream_type == V4L2_MPEG_STREAM_TYPE_MPEG1_SS ||
|
|
|
|
params->stream_type == V4L2_MPEG_STREAM_TYPE_MPEG1_VCD) ?
|
|
|
|
V4L2_MPEG_VIDEO_ENCODING_MPEG_1 :
|
|
|
|
V4L2_MPEG_VIDEO_ENCODING_MPEG_2;
|
|
|
|
if (params->video_encoding == V4L2_MPEG_VIDEO_ENCODING_MPEG_1)
|
2006-06-19 01:40:30 +08:00
|
|
|
/* MPEG-1 implies CBR */
|
2007-11-02 00:38:12 +08:00
|
|
|
params->video_bitrate_mode =
|
|
|
|
V4L2_MPEG_VIDEO_BITRATE_MODE_CBR;
|
2006-06-19 01:40:30 +08:00
|
|
|
break;
|
2006-06-25 01:36:02 +08:00
|
|
|
case V4L2_CID_MPEG_STREAM_VBI_FMT:
|
|
|
|
params->stream_vbi_fmt = ctrl->value;
|
|
|
|
break;
|
2006-06-19 01:40:30 +08:00
|
|
|
case V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE:
|
|
|
|
params->video_spatial_filter_mode = ctrl->value;
|
|
|
|
break;
|
|
|
|
case V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER:
|
|
|
|
params->video_spatial_filter = ctrl->value;
|
|
|
|
break;
|
|
|
|
case V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE:
|
|
|
|
params->video_luma_spatial_filter_type = ctrl->value;
|
|
|
|
break;
|
|
|
|
case V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE:
|
|
|
|
params->video_chroma_spatial_filter_type = ctrl->value;
|
|
|
|
break;
|
|
|
|
case V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE:
|
|
|
|
params->video_temporal_filter_mode = ctrl->value;
|
|
|
|
break;
|
|
|
|
case V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER:
|
|
|
|
params->video_temporal_filter = ctrl->value;
|
|
|
|
break;
|
|
|
|
case V4L2_CID_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE:
|
|
|
|
params->video_median_filter_type = ctrl->value;
|
|
|
|
break;
|
|
|
|
case V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_TOP:
|
|
|
|
params->video_luma_median_filter_top = ctrl->value;
|
|
|
|
break;
|
|
|
|
case V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_BOTTOM:
|
|
|
|
params->video_luma_median_filter_bottom = ctrl->value;
|
|
|
|
break;
|
|
|
|
case V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_TOP:
|
|
|
|
params->video_chroma_median_filter_top = ctrl->value;
|
|
|
|
break;
|
|
|
|
case V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_BOTTOM:
|
|
|
|
params->video_chroma_median_filter_bottom = ctrl->value;
|
|
|
|
break;
|
2007-04-27 23:31:00 +08:00
|
|
|
case V4L2_CID_MPEG_CX2341X_STREAM_INSERT_NAV_PACKETS:
|
|
|
|
params->stream_insert_nav_packets = ctrl->value;
|
|
|
|
break;
|
2006-06-19 01:40:30 +08:00
|
|
|
default:
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2007-11-02 00:38:12 +08:00
|
|
|
static int cx2341x_ctrl_query_fill(struct v4l2_queryctrl *qctrl,
|
|
|
|
s32 min, s32 max, s32 step, s32 def)
|
2006-06-19 01:40:30 +08:00
|
|
|
{
|
|
|
|
const char *name;
|
|
|
|
|
|
|
|
qctrl->flags = 0;
|
|
|
|
switch (qctrl->id) {
|
|
|
|
/* MPEG controls */
|
|
|
|
case V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE:
|
|
|
|
name = "Spatial Filter Mode";
|
|
|
|
break;
|
|
|
|
case V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER:
|
|
|
|
name = "Spatial Filter";
|
|
|
|
break;
|
|
|
|
case V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE:
|
|
|
|
name = "Spatial Luma Filter Type";
|
|
|
|
break;
|
|
|
|
case V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE:
|
|
|
|
name = "Spatial Chroma Filter Type";
|
|
|
|
break;
|
|
|
|
case V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE:
|
|
|
|
name = "Temporal Filter Mode";
|
|
|
|
break;
|
|
|
|
case V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER:
|
|
|
|
name = "Temporal Filter";
|
|
|
|
break;
|
|
|
|
case V4L2_CID_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE:
|
|
|
|
name = "Median Filter Type";
|
|
|
|
break;
|
|
|
|
case V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_TOP:
|
|
|
|
name = "Median Luma Filter Maximum";
|
|
|
|
break;
|
|
|
|
case V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_BOTTOM:
|
|
|
|
name = "Median Luma Filter Minimum";
|
|
|
|
break;
|
|
|
|
case V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_TOP:
|
|
|
|
name = "Median Chroma Filter Maximum";
|
|
|
|
break;
|
|
|
|
case V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_BOTTOM:
|
|
|
|
name = "Median Chroma Filter Minimum";
|
|
|
|
break;
|
2007-04-27 23:31:00 +08:00
|
|
|
case V4L2_CID_MPEG_CX2341X_STREAM_INSERT_NAV_PACKETS:
|
|
|
|
name = "Insert Navigation Packets";
|
|
|
|
break;
|
2006-06-19 01:40:30 +08:00
|
|
|
|
|
|
|
default:
|
|
|
|
return v4l2_ctrl_query_fill(qctrl, min, max, step, def);
|
|
|
|
}
|
|
|
|
switch (qctrl->id) {
|
|
|
|
case V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE:
|
|
|
|
case V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE:
|
|
|
|
case V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE:
|
|
|
|
case V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE:
|
|
|
|
case V4L2_CID_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE:
|
|
|
|
qctrl->type = V4L2_CTRL_TYPE_MENU;
|
|
|
|
min = 0;
|
|
|
|
step = 1;
|
|
|
|
break;
|
2007-04-27 23:31:00 +08:00
|
|
|
case V4L2_CID_MPEG_CX2341X_STREAM_INSERT_NAV_PACKETS:
|
|
|
|
qctrl->type = V4L2_CTRL_TYPE_BOOLEAN;
|
|
|
|
min = 0;
|
|
|
|
max = 1;
|
|
|
|
step = 1;
|
|
|
|
break;
|
2006-06-19 01:40:30 +08:00
|
|
|
default:
|
|
|
|
qctrl->type = V4L2_CTRL_TYPE_INTEGER;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
switch (qctrl->id) {
|
|
|
|
case V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE:
|
|
|
|
case V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE:
|
|
|
|
case V4L2_CID_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE:
|
|
|
|
qctrl->flags |= V4L2_CTRL_FLAG_UPDATE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
qctrl->minimum = min;
|
|
|
|
qctrl->maximum = max;
|
|
|
|
qctrl->step = step;
|
|
|
|
qctrl->default_value = def;
|
|
|
|
qctrl->reserved[0] = qctrl->reserved[1] = 0;
|
|
|
|
snprintf(qctrl->name, sizeof(qctrl->name), name);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-06-22 23:03:28 +08:00
|
|
|
int cx2341x_ctrl_query(const struct cx2341x_mpeg_params *params,
|
2007-11-02 00:38:12 +08:00
|
|
|
struct v4l2_queryctrl *qctrl)
|
2006-06-19 01:40:30 +08:00
|
|
|
{
|
|
|
|
int err;
|
|
|
|
|
|
|
|
switch (qctrl->id) {
|
|
|
|
case V4L2_CID_MPEG_AUDIO_ENCODING:
|
|
|
|
return v4l2_ctrl_query_fill(qctrl,
|
|
|
|
V4L2_MPEG_AUDIO_ENCODING_LAYER_2,
|
|
|
|
V4L2_MPEG_AUDIO_ENCODING_LAYER_2, 1,
|
2008-07-17 23:26:45 +08:00
|
|
|
default_params.audio_encoding);
|
2006-06-19 01:40:30 +08:00
|
|
|
|
|
|
|
case V4L2_CID_MPEG_AUDIO_L2_BITRATE:
|
|
|
|
return v4l2_ctrl_query_fill(qctrl,
|
|
|
|
V4L2_MPEG_AUDIO_L2_BITRATE_192K,
|
|
|
|
V4L2_MPEG_AUDIO_L2_BITRATE_384K, 1,
|
2008-07-17 23:26:45 +08:00
|
|
|
default_params.audio_l2_bitrate);
|
2006-06-19 01:40:30 +08:00
|
|
|
|
|
|
|
case V4L2_CID_MPEG_AUDIO_L1_BITRATE:
|
|
|
|
case V4L2_CID_MPEG_AUDIO_L3_BITRATE:
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
case V4L2_CID_MPEG_AUDIO_MODE_EXTENSION:
|
|
|
|
err = v4l2_ctrl_query_fill_std(qctrl);
|
2007-11-02 00:38:12 +08:00
|
|
|
if (err == 0 &&
|
|
|
|
params->audio_mode != V4L2_MPEG_AUDIO_MODE_JOINT_STEREO)
|
2006-06-19 01:40:30 +08:00
|
|
|
qctrl->flags |= V4L2_CTRL_FLAG_INACTIVE;
|
|
|
|
return err;
|
|
|
|
|
|
|
|
case V4L2_CID_MPEG_VIDEO_ENCODING:
|
|
|
|
/* this setting is read-only for the cx2341x since the
|
|
|
|
V4L2_CID_MPEG_STREAM_TYPE really determines the
|
|
|
|
MPEG-1/2 setting */
|
2008-08-08 18:21:00 +08:00
|
|
|
err = v4l2_ctrl_query_fill(qctrl,
|
|
|
|
V4L2_MPEG_VIDEO_ENCODING_MPEG_1,
|
|
|
|
V4L2_MPEG_VIDEO_ENCODING_MPEG_2, 1,
|
|
|
|
V4L2_MPEG_VIDEO_ENCODING_MPEG_2);
|
2006-06-19 01:40:30 +08:00
|
|
|
if (err == 0)
|
|
|
|
qctrl->flags |= V4L2_CTRL_FLAG_READ_ONLY;
|
|
|
|
return err;
|
|
|
|
|
2006-06-20 05:00:06 +08:00
|
|
|
case V4L2_CID_MPEG_VIDEO_BITRATE_MODE:
|
|
|
|
err = v4l2_ctrl_query_fill_std(qctrl);
|
2007-11-02 00:38:12 +08:00
|
|
|
if (err == 0 &&
|
|
|
|
params->video_encoding == V4L2_MPEG_VIDEO_ENCODING_MPEG_1)
|
2006-06-20 05:00:06 +08:00
|
|
|
qctrl->flags |= V4L2_CTRL_FLAG_INACTIVE;
|
|
|
|
return err;
|
|
|
|
|
2006-06-19 01:40:30 +08:00
|
|
|
case V4L2_CID_MPEG_VIDEO_BITRATE_PEAK:
|
|
|
|
err = v4l2_ctrl_query_fill_std(qctrl);
|
2007-11-02 00:38:12 +08:00
|
|
|
if (err == 0 &&
|
|
|
|
params->video_bitrate_mode ==
|
|
|
|
V4L2_MPEG_VIDEO_BITRATE_MODE_CBR)
|
2006-06-19 01:40:30 +08:00
|
|
|
qctrl->flags |= V4L2_CTRL_FLAG_INACTIVE;
|
|
|
|
return err;
|
|
|
|
|
2006-06-25 01:36:02 +08:00
|
|
|
case V4L2_CID_MPEG_STREAM_VBI_FMT:
|
|
|
|
if (params->capabilities & CX2341X_CAP_HAS_SLICED_VBI)
|
|
|
|
return v4l2_ctrl_query_fill_std(qctrl);
|
|
|
|
return cx2341x_ctrl_query_fill(qctrl,
|
|
|
|
V4L2_MPEG_STREAM_VBI_FMT_NONE,
|
|
|
|
V4L2_MPEG_STREAM_VBI_FMT_NONE, 1,
|
2008-07-17 23:26:45 +08:00
|
|
|
default_params.stream_vbi_fmt);
|
|
|
|
|
|
|
|
case V4L2_CID_MPEG_VIDEO_GOP_SIZE:
|
|
|
|
return v4l2_ctrl_query_fill(qctrl, 1, 34, 1,
|
|
|
|
params->is_50hz ? 12 : 15);
|
2006-06-25 01:36:02 +08:00
|
|
|
|
2006-06-19 01:40:30 +08:00
|
|
|
/* CX23415/6 specific */
|
|
|
|
case V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE:
|
|
|
|
return cx2341x_ctrl_query_fill(qctrl,
|
2007-11-02 00:38:12 +08:00
|
|
|
V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_MANUAL,
|
|
|
|
V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_AUTO, 1,
|
2008-07-17 23:26:45 +08:00
|
|
|
default_params.video_spatial_filter_mode);
|
2006-06-19 01:40:30 +08:00
|
|
|
|
|
|
|
case V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER:
|
2008-07-17 23:26:45 +08:00
|
|
|
cx2341x_ctrl_query_fill(qctrl, 0, 15, 1,
|
|
|
|
default_params.video_spatial_filter);
|
2006-06-19 01:40:30 +08:00
|
|
|
qctrl->flags |= V4L2_CTRL_FLAG_SLIDER;
|
2007-11-02 00:38:12 +08:00
|
|
|
if (params->video_spatial_filter_mode ==
|
|
|
|
V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_AUTO)
|
|
|
|
qctrl->flags |= V4L2_CTRL_FLAG_INACTIVE;
|
2006-06-19 01:40:30 +08:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
case V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE:
|
|
|
|
cx2341x_ctrl_query_fill(qctrl,
|
2007-11-02 00:38:12 +08:00
|
|
|
V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_OFF,
|
|
|
|
V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_2D_SYM_NON_SEPARABLE,
|
|
|
|
1,
|
2008-07-17 23:26:45 +08:00
|
|
|
default_params.video_luma_spatial_filter_type);
|
2007-11-02 00:38:12 +08:00
|
|
|
if (params->video_spatial_filter_mode ==
|
|
|
|
V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_AUTO)
|
|
|
|
qctrl->flags |= V4L2_CTRL_FLAG_INACTIVE;
|
2006-06-19 01:40:30 +08:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
case V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE:
|
|
|
|
cx2341x_ctrl_query_fill(qctrl,
|
2007-11-02 00:38:12 +08:00
|
|
|
V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_OFF,
|
|
|
|
V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_1D_HOR,
|
|
|
|
1,
|
2008-07-17 23:26:45 +08:00
|
|
|
default_params.video_chroma_spatial_filter_type);
|
2007-11-02 00:38:12 +08:00
|
|
|
if (params->video_spatial_filter_mode ==
|
|
|
|
V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_AUTO)
|
|
|
|
qctrl->flags |= V4L2_CTRL_FLAG_INACTIVE;
|
2006-06-19 01:40:30 +08:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
case V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE:
|
|
|
|
return cx2341x_ctrl_query_fill(qctrl,
|
2007-11-02 00:38:12 +08:00
|
|
|
V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_MANUAL,
|
|
|
|
V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_AUTO, 1,
|
2008-07-17 23:26:45 +08:00
|
|
|
default_params.video_temporal_filter_mode);
|
2006-06-19 01:40:30 +08:00
|
|
|
|
|
|
|
case V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER:
|
2008-07-17 23:26:45 +08:00
|
|
|
cx2341x_ctrl_query_fill(qctrl, 0, 31, 1,
|
|
|
|
default_params.video_temporal_filter);
|
2006-06-19 01:40:30 +08:00
|
|
|
qctrl->flags |= V4L2_CTRL_FLAG_SLIDER;
|
2007-11-02 00:38:12 +08:00
|
|
|
if (params->video_temporal_filter_mode ==
|
|
|
|
V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_AUTO)
|
|
|
|
qctrl->flags |= V4L2_CTRL_FLAG_INACTIVE;
|
2006-06-19 01:40:30 +08:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
case V4L2_CID_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE:
|
|
|
|
return cx2341x_ctrl_query_fill(qctrl,
|
2007-11-02 00:38:12 +08:00
|
|
|
V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF,
|
|
|
|
V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_DIAG, 1,
|
2008-07-17 23:26:45 +08:00
|
|
|
default_params.video_median_filter_type);
|
2006-06-19 01:40:30 +08:00
|
|
|
|
|
|
|
case V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_TOP:
|
2008-07-17 23:26:45 +08:00
|
|
|
cx2341x_ctrl_query_fill(qctrl, 0, 255, 1,
|
|
|
|
default_params.video_luma_median_filter_top);
|
2006-06-19 01:40:30 +08:00
|
|
|
qctrl->flags |= V4L2_CTRL_FLAG_SLIDER;
|
2007-11-02 00:38:12 +08:00
|
|
|
if (params->video_median_filter_type ==
|
|
|
|
V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF)
|
|
|
|
qctrl->flags |= V4L2_CTRL_FLAG_INACTIVE;
|
2006-06-19 01:40:30 +08:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
case V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_BOTTOM:
|
2008-07-17 23:26:45 +08:00
|
|
|
cx2341x_ctrl_query_fill(qctrl, 0, 255, 1,
|
|
|
|
default_params.video_luma_median_filter_bottom);
|
2006-06-19 01:40:30 +08:00
|
|
|
qctrl->flags |= V4L2_CTRL_FLAG_SLIDER;
|
2007-11-02 00:38:12 +08:00
|
|
|
if (params->video_median_filter_type ==
|
|
|
|
V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF)
|
|
|
|
qctrl->flags |= V4L2_CTRL_FLAG_INACTIVE;
|
2006-06-19 01:40:30 +08:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
case V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_TOP:
|
2008-07-17 23:26:45 +08:00
|
|
|
cx2341x_ctrl_query_fill(qctrl, 0, 255, 1,
|
|
|
|
default_params.video_chroma_median_filter_top);
|
2006-06-19 01:40:30 +08:00
|
|
|
qctrl->flags |= V4L2_CTRL_FLAG_SLIDER;
|
2007-11-02 00:38:12 +08:00
|
|
|
if (params->video_median_filter_type ==
|
|
|
|
V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF)
|
|
|
|
qctrl->flags |= V4L2_CTRL_FLAG_INACTIVE;
|
2006-06-19 01:40:30 +08:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
case V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_BOTTOM:
|
2008-07-17 23:26:45 +08:00
|
|
|
cx2341x_ctrl_query_fill(qctrl, 0, 255, 1,
|
|
|
|
default_params.video_chroma_median_filter_bottom);
|
2006-06-19 01:40:30 +08:00
|
|
|
qctrl->flags |= V4L2_CTRL_FLAG_SLIDER;
|
2007-11-02 00:38:12 +08:00
|
|
|
if (params->video_median_filter_type ==
|
|
|
|
V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF)
|
|
|
|
qctrl->flags |= V4L2_CTRL_FLAG_INACTIVE;
|
2006-06-19 01:40:30 +08:00
|
|
|
return 0;
|
|
|
|
|
2007-04-27 23:31:00 +08:00
|
|
|
case V4L2_CID_MPEG_CX2341X_STREAM_INSERT_NAV_PACKETS:
|
2008-07-17 23:26:45 +08:00
|
|
|
return cx2341x_ctrl_query_fill(qctrl, 0, 1, 1,
|
|
|
|
default_params.stream_insert_nav_packets);
|
2007-04-27 23:31:00 +08:00
|
|
|
|
2006-06-19 01:40:30 +08:00
|
|
|
default:
|
|
|
|
return v4l2_ctrl_query_fill_std(qctrl);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
2007-11-02 00:38:12 +08:00
|
|
|
EXPORT_SYMBOL(cx2341x_ctrl_query);
|
2006-06-19 01:40:30 +08:00
|
|
|
|
2008-06-22 23:03:28 +08:00
|
|
|
const char **cx2341x_ctrl_get_menu(const struct cx2341x_mpeg_params *p, u32 id)
|
2006-06-19 01:40:30 +08:00
|
|
|
{
|
2008-06-22 23:03:28 +08:00
|
|
|
static const char *mpeg_stream_type_without_ts[] = {
|
2006-06-19 01:40:30 +08:00
|
|
|
"MPEG-2 Program Stream",
|
|
|
|
"",
|
|
|
|
"MPEG-1 System Stream",
|
|
|
|
"MPEG-2 DVD-compatible Stream",
|
|
|
|
"MPEG-1 VCD-compatible Stream",
|
|
|
|
"MPEG-2 SVCD-compatible Stream",
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
2008-06-22 23:03:28 +08:00
|
|
|
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
|
|
|
|
};
|
|
|
|
|
2006-06-19 01:40:30 +08:00
|
|
|
static const char *cx2341x_video_spatial_filter_mode_menu[] = {
|
|
|
|
"Manual",
|
|
|
|
"Auto",
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
|
|
|
static const char *cx2341x_video_luma_spatial_filter_type_menu[] = {
|
|
|
|
"Off",
|
|
|
|
"1D Horizontal",
|
|
|
|
"1D Vertical",
|
|
|
|
"2D H/V Separable",
|
|
|
|
"2D Symmetric non-separable",
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
|
|
|
static const char *cx2341x_video_chroma_spatial_filter_type_menu[] = {
|
|
|
|
"Off",
|
|
|
|
"1D Horizontal",
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
|
|
|
static const char *cx2341x_video_temporal_filter_mode_menu[] = {
|
|
|
|
"Manual",
|
|
|
|
"Auto",
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
|
|
|
static const char *cx2341x_video_median_filter_type_menu[] = {
|
|
|
|
"Off",
|
|
|
|
"Horizontal",
|
|
|
|
"Vertical",
|
|
|
|
"Horizontal/Vertical",
|
|
|
|
"Diagonal",
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
|
|
|
switch (id) {
|
|
|
|
case V4L2_CID_MPEG_STREAM_TYPE:
|
2008-06-22 23:03:28 +08:00
|
|
|
return (p->capabilities & CX2341X_CAP_HAS_TS) ?
|
|
|
|
mpeg_stream_type_with_ts : mpeg_stream_type_without_ts;
|
2006-06-19 01:40:30 +08:00
|
|
|
case V4L2_CID_MPEG_AUDIO_L1_BITRATE:
|
|
|
|
case V4L2_CID_MPEG_AUDIO_L3_BITRATE:
|
|
|
|
return NULL;
|
|
|
|
case V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE:
|
|
|
|
return cx2341x_video_spatial_filter_mode_menu;
|
|
|
|
case V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE:
|
|
|
|
return cx2341x_video_luma_spatial_filter_type_menu;
|
|
|
|
case V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE:
|
|
|
|
return cx2341x_video_chroma_spatial_filter_type_menu;
|
|
|
|
case V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE:
|
|
|
|
return cx2341x_video_temporal_filter_mode_menu;
|
|
|
|
case V4L2_CID_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE:
|
|
|
|
return cx2341x_video_median_filter_type_menu;
|
|
|
|
default:
|
|
|
|
return v4l2_ctrl_get_menu(id);
|
|
|
|
}
|
|
|
|
}
|
2007-11-02 00:38:12 +08:00
|
|
|
EXPORT_SYMBOL(cx2341x_ctrl_get_menu);
|
2006-06-19 01:40:30 +08:00
|
|
|
|
|
|
|
static void cx2341x_calc_audio_properties(struct cx2341x_mpeg_params *params)
|
|
|
|
{
|
|
|
|
params->audio_properties = (params->audio_sampling_freq << 0) |
|
|
|
|
((3 - params->audio_encoding) << 2) |
|
|
|
|
((1 + params->audio_l2_bitrate) << 4) |
|
|
|
|
(params->audio_mode << 8) |
|
|
|
|
(params->audio_mode_extension << 10) |
|
2007-11-02 00:38:12 +08:00
|
|
|
(((params->audio_emphasis == V4L2_MPEG_AUDIO_EMPHASIS_CCITT_J17)
|
|
|
|
? 3 : params->audio_emphasis) << 12) |
|
2006-06-19 01:40:30 +08:00
|
|
|
(params->audio_crc << 14);
|
|
|
|
}
|
|
|
|
|
2007-08-22 05:32:42 +08:00
|
|
|
int cx2341x_ext_ctrls(struct cx2341x_mpeg_params *params, int busy,
|
2006-06-26 20:31:18 +08:00
|
|
|
struct v4l2_ext_controls *ctrls, unsigned int cmd)
|
2006-06-19 01:40:30 +08:00
|
|
|
{
|
|
|
|
int err = 0;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (cmd == VIDIOC_G_EXT_CTRLS) {
|
|
|
|
for (i = 0; i < ctrls->count; i++) {
|
|
|
|
struct v4l2_ext_control *ctrl = ctrls->controls + i;
|
|
|
|
|
|
|
|
err = cx2341x_get_ctrl(params, ctrl);
|
|
|
|
if (err) {
|
|
|
|
ctrls->error_idx = i;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
for (i = 0; i < ctrls->count; i++) {
|
|
|
|
struct v4l2_ext_control *ctrl = ctrls->controls + i;
|
|
|
|
struct v4l2_queryctrl qctrl;
|
|
|
|
const char **menu_items = NULL;
|
|
|
|
|
|
|
|
qctrl.id = ctrl->id;
|
|
|
|
err = cx2341x_ctrl_query(params, &qctrl);
|
|
|
|
if (err)
|
|
|
|
break;
|
|
|
|
if (qctrl.type == V4L2_CTRL_TYPE_MENU)
|
2008-06-22 23:03:28 +08:00
|
|
|
menu_items = cx2341x_ctrl_get_menu(params, qctrl.id);
|
2006-06-19 01:40:30 +08:00
|
|
|
err = v4l2_ctrl_check(ctrl, &qctrl, menu_items);
|
|
|
|
if (err)
|
|
|
|
break;
|
2007-08-22 05:32:42 +08:00
|
|
|
err = cx2341x_set_ctrl(params, busy, ctrl);
|
2006-06-19 01:40:30 +08:00
|
|
|
if (err)
|
|
|
|
break;
|
|
|
|
}
|
2007-11-02 00:38:12 +08:00
|
|
|
if (err == 0 &&
|
|
|
|
params->video_bitrate_mode == V4L2_MPEG_VIDEO_BITRATE_MODE_VBR &&
|
|
|
|
params->video_bitrate_peak < params->video_bitrate) {
|
2006-06-19 01:40:30 +08:00
|
|
|
err = -ERANGE;
|
|
|
|
ctrls->error_idx = ctrls->count;
|
|
|
|
}
|
2007-11-02 00:38:12 +08:00
|
|
|
if (err)
|
2006-06-19 01:40:30 +08:00
|
|
|
ctrls->error_idx = i;
|
2007-11-02 00:38:12 +08:00
|
|
|
else
|
2006-06-19 01:40:30 +08:00
|
|
|
cx2341x_calc_audio_properties(params);
|
|
|
|
return err;
|
|
|
|
}
|
2007-11-02 00:38:12 +08:00
|
|
|
EXPORT_SYMBOL(cx2341x_ext_ctrls);
|
2006-06-19 01:40:30 +08:00
|
|
|
|
|
|
|
void cx2341x_fill_defaults(struct cx2341x_mpeg_params *p)
|
|
|
|
{
|
|
|
|
*p = default_params;
|
|
|
|
cx2341x_calc_audio_properties(p);
|
|
|
|
}
|
2007-11-02 00:38:12 +08:00
|
|
|
EXPORT_SYMBOL(cx2341x_fill_defaults);
|
2006-06-19 01:40:30 +08:00
|
|
|
|
2007-11-02 00:38:12 +08:00
|
|
|
static int cx2341x_api(void *priv, cx2341x_mbox_func func,
|
2007-12-12 18:04:58 +08:00
|
|
|
u32 cmd, int args, ...)
|
2006-06-19 01:40:30 +08:00
|
|
|
{
|
|
|
|
u32 data[CX2341X_MBOX_MAX_DATA];
|
|
|
|
va_list vargs;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
va_start(vargs, args);
|
|
|
|
|
2007-11-02 00:38:12 +08:00
|
|
|
for (i = 0; i < args; i++)
|
2006-06-19 01:40:30 +08:00
|
|
|
data[i] = va_arg(vargs, int);
|
|
|
|
va_end(vargs);
|
|
|
|
return func(priv, cmd, args, 0, data);
|
|
|
|
}
|
|
|
|
|
2007-11-02 00:38:12 +08:00
|
|
|
#define NEQ(field) (old->field != new->field)
|
|
|
|
|
2006-06-19 01:40:30 +08:00
|
|
|
int cx2341x_update(void *priv, cx2341x_mbox_func func,
|
2007-11-02 00:38:12 +08:00
|
|
|
const struct cx2341x_mpeg_params *old,
|
|
|
|
const struct cx2341x_mpeg_params *new)
|
2006-06-19 01:40:30 +08:00
|
|
|
{
|
|
|
|
static int mpeg_stream_type[] = {
|
|
|
|
0, /* MPEG-2 PS */
|
|
|
|
1, /* MPEG-2 TS */
|
|
|
|
2, /* MPEG-1 SS */
|
|
|
|
14, /* DVD */
|
|
|
|
11, /* VCD */
|
|
|
|
12, /* SVCD */
|
|
|
|
};
|
|
|
|
|
|
|
|
int err = 0;
|
2007-11-02 00:38:12 +08:00
|
|
|
int force = (old == NULL);
|
2006-08-28 06:22:15 +08:00
|
|
|
u16 temporal = new->video_temporal_filter;
|
2006-06-19 01:40:30 +08:00
|
|
|
|
2006-06-22 04:04:13 +08:00
|
|
|
cx2341x_api(priv, func, CX2341X_ENC_SET_OUTPUT_PORT, 2, new->port, 0);
|
2006-06-19 01:40:30 +08:00
|
|
|
|
2007-11-02 00:38:12 +08:00
|
|
|
if (force || NEQ(is_50hz)) {
|
|
|
|
err = cx2341x_api(priv, func, CX2341X_ENC_SET_FRAME_RATE, 1,
|
|
|
|
new->is_50hz);
|
2006-06-19 01:40:30 +08:00
|
|
|
if (err) return err;
|
|
|
|
}
|
|
|
|
|
2007-11-02 00:38:12 +08:00
|
|
|
if (force || NEQ(width) || NEQ(height) || NEQ(video_encoding)) {
|
2006-06-19 01:40:30 +08:00
|
|
|
u16 w = new->width;
|
|
|
|
u16 h = new->height;
|
|
|
|
|
|
|
|
if (new->video_encoding == V4L2_MPEG_VIDEO_ENCODING_MPEG_1) {
|
|
|
|
w /= 2;
|
|
|
|
h /= 2;
|
|
|
|
}
|
2007-11-02 00:38:12 +08:00
|
|
|
err = cx2341x_api(priv, func, CX2341X_ENC_SET_FRAME_SIZE, 2,
|
|
|
|
h, w);
|
2006-06-19 01:40:30 +08:00
|
|
|
if (err) return err;
|
2006-12-19 00:37:50 +08:00
|
|
|
}
|
2006-08-28 06:22:15 +08:00
|
|
|
|
2006-12-19 00:37:50 +08:00
|
|
|
if (new->width != 720 || new->height != (new->is_50hz ? 576 : 480)) {
|
2007-11-02 00:38:12 +08:00
|
|
|
/* Adjust temporal filter if necessary. The problem with the
|
|
|
|
temporal filter is that it works well with full resolution
|
|
|
|
capturing, but not when the capture window is scaled (the
|
|
|
|
filter introduces a ghosting effect). So if the capture
|
|
|
|
window is scaled, then force the filter to 0.
|
2006-08-28 06:22:15 +08:00
|
|
|
|
2006-12-19 00:37:50 +08:00
|
|
|
For full resolution the filter really improves the video
|
2007-11-02 00:38:12 +08:00
|
|
|
quality, especially if the original video quality is
|
|
|
|
suboptimal. */
|
2006-12-19 00:37:50 +08:00
|
|
|
temporal = 0;
|
2006-06-19 01:40:30 +08:00
|
|
|
}
|
|
|
|
|
2007-11-02 00:38:12 +08:00
|
|
|
if (force || NEQ(stream_type)) {
|
|
|
|
err = cx2341x_api(priv, func, CX2341X_ENC_SET_STREAM_TYPE, 1,
|
|
|
|
mpeg_stream_type[new->stream_type]);
|
2006-06-19 01:40:30 +08:00
|
|
|
if (err) return err;
|
|
|
|
}
|
2007-11-02 00:38:12 +08:00
|
|
|
if (force || NEQ(video_aspect)) {
|
|
|
|
err = cx2341x_api(priv, func, CX2341X_ENC_SET_ASPECT_RATIO, 1,
|
|
|
|
1 + new->video_aspect);
|
2006-06-19 01:40:30 +08:00
|
|
|
if (err) return err;
|
|
|
|
}
|
2007-11-02 00:38:12 +08:00
|
|
|
if (force || NEQ(video_b_frames) || NEQ(video_gop_size)) {
|
2006-06-19 01:40:30 +08:00
|
|
|
err = cx2341x_api(priv, func, CX2341X_ENC_SET_GOP_PROPERTIES, 2,
|
|
|
|
new->video_gop_size, new->video_b_frames + 1);
|
|
|
|
if (err) return err;
|
|
|
|
}
|
2007-11-02 00:38:12 +08:00
|
|
|
if (force || NEQ(video_gop_closure)) {
|
|
|
|
err = cx2341x_api(priv, func, CX2341X_ENC_SET_GOP_CLOSURE, 1,
|
|
|
|
new->video_gop_closure);
|
2006-06-19 01:40:30 +08:00
|
|
|
if (err) return err;
|
|
|
|
}
|
2007-11-02 00:38:12 +08:00
|
|
|
if (force || NEQ(audio_properties)) {
|
|
|
|
err = cx2341x_api(priv, func, CX2341X_ENC_SET_AUDIO_PROPERTIES,
|
|
|
|
1, new->audio_properties);
|
2006-06-19 01:40:30 +08:00
|
|
|
if (err) return err;
|
|
|
|
}
|
2007-11-02 00:38:12 +08:00
|
|
|
if (force || NEQ(audio_mute)) {
|
|
|
|
err = cx2341x_api(priv, func, CX2341X_ENC_MUTE_AUDIO, 1,
|
|
|
|
new->audio_mute);
|
2007-04-27 23:31:00 +08:00
|
|
|
if (err) return err;
|
|
|
|
}
|
2007-11-02 00:38:12 +08:00
|
|
|
if (force || NEQ(video_bitrate_mode) || NEQ(video_bitrate) ||
|
|
|
|
NEQ(video_bitrate_peak)) {
|
2006-06-19 01:40:30 +08:00
|
|
|
err = cx2341x_api(priv, func, CX2341X_ENC_SET_BIT_RATE, 5,
|
|
|
|
new->video_bitrate_mode, new->video_bitrate,
|
|
|
|
new->video_bitrate_peak / 400, 0, 0);
|
|
|
|
if (err) return err;
|
|
|
|
}
|
2007-11-02 00:38:12 +08:00
|
|
|
if (force || NEQ(video_spatial_filter_mode) ||
|
|
|
|
NEQ(video_temporal_filter_mode) ||
|
|
|
|
NEQ(video_median_filter_type)) {
|
|
|
|
err = cx2341x_api(priv, func, CX2341X_ENC_SET_DNR_FILTER_MODE,
|
|
|
|
2, new->video_spatial_filter_mode |
|
|
|
|
(new->video_temporal_filter_mode << 1),
|
2006-06-19 01:40:30 +08:00
|
|
|
new->video_median_filter_type);
|
|
|
|
if (err) return err;
|
|
|
|
}
|
2007-11-02 00:38:12 +08:00
|
|
|
if (force || NEQ(video_luma_median_filter_bottom) ||
|
|
|
|
NEQ(video_luma_median_filter_top) ||
|
|
|
|
NEQ(video_chroma_median_filter_bottom) ||
|
|
|
|
NEQ(video_chroma_median_filter_top)) {
|
2006-06-19 01:40:30 +08:00
|
|
|
err = cx2341x_api(priv, func, CX2341X_ENC_SET_CORING_LEVELS, 4,
|
|
|
|
new->video_luma_median_filter_bottom,
|
|
|
|
new->video_luma_median_filter_top,
|
|
|
|
new->video_chroma_median_filter_bottom,
|
|
|
|
new->video_chroma_median_filter_top);
|
|
|
|
if (err) return err;
|
|
|
|
}
|
2007-11-02 00:38:12 +08:00
|
|
|
if (force || NEQ(video_luma_spatial_filter_type) ||
|
|
|
|
NEQ(video_chroma_spatial_filter_type)) {
|
|
|
|
err = cx2341x_api(priv, func,
|
|
|
|
CX2341X_ENC_SET_SPATIAL_FILTER_TYPE,
|
|
|
|
2, new->video_luma_spatial_filter_type,
|
|
|
|
new->video_chroma_spatial_filter_type);
|
2006-06-19 01:40:30 +08:00
|
|
|
if (err) return err;
|
|
|
|
}
|
2007-11-02 00:38:12 +08:00
|
|
|
if (force || NEQ(video_spatial_filter) ||
|
|
|
|
old->video_temporal_filter != temporal) {
|
|
|
|
err = cx2341x_api(priv, func, CX2341X_ENC_SET_DNR_FILTER_PROPS,
|
|
|
|
2, new->video_spatial_filter, temporal);
|
2006-06-19 01:40:30 +08:00
|
|
|
if (err) return err;
|
|
|
|
}
|
2007-11-02 00:38:12 +08:00
|
|
|
if (force || NEQ(video_temporal_decimation)) {
|
|
|
|
err = cx2341x_api(priv, func, CX2341X_ENC_SET_FRAME_DROP_RATE,
|
|
|
|
1, new->video_temporal_decimation);
|
2006-06-19 01:40:30 +08:00
|
|
|
if (err) return err;
|
|
|
|
}
|
2007-11-02 00:38:12 +08:00
|
|
|
if (force || NEQ(video_mute) ||
|
|
|
|
(new->video_mute && NEQ(video_mute_yuv))) {
|
|
|
|
err = cx2341x_api(priv, func, CX2341X_ENC_MUTE_VIDEO, 1,
|
|
|
|
new->video_mute | (new->video_mute_yuv << 8));
|
2007-04-27 23:31:00 +08:00
|
|
|
if (err) return err;
|
|
|
|
}
|
2007-11-02 00:38:12 +08:00
|
|
|
if (force || NEQ(stream_insert_nav_packets)) {
|
|
|
|
err = cx2341x_api(priv, func, CX2341X_ENC_MISC, 2,
|
|
|
|
7, new->stream_insert_nav_packets);
|
2007-04-27 23:31:00 +08:00
|
|
|
if (err) return err;
|
|
|
|
}
|
2006-06-19 01:40:30 +08:00
|
|
|
return 0;
|
|
|
|
}
|
2007-11-02 00:38:12 +08:00
|
|
|
EXPORT_SYMBOL(cx2341x_update);
|
2006-06-19 01:40:30 +08:00
|
|
|
|
2008-06-22 23:03:28 +08:00
|
|
|
static const char *cx2341x_menu_item(const struct cx2341x_mpeg_params *p, u32 id)
|
2006-06-19 01:40:30 +08:00
|
|
|
{
|
2008-06-22 23:03:28 +08:00
|
|
|
const char **menu = cx2341x_ctrl_get_menu(p, id);
|
2006-06-19 01:40:30 +08:00
|
|
|
struct v4l2_ext_control ctrl;
|
|
|
|
|
|
|
|
if (menu == NULL)
|
|
|
|
goto invalid;
|
|
|
|
ctrl.id = id;
|
|
|
|
if (cx2341x_get_ctrl(p, &ctrl))
|
|
|
|
goto invalid;
|
|
|
|
while (ctrl.value-- && *menu) menu++;
|
|
|
|
if (*menu == NULL)
|
|
|
|
goto invalid;
|
|
|
|
return *menu;
|
|
|
|
|
|
|
|
invalid:
|
|
|
|
return "<invalid>";
|
|
|
|
}
|
|
|
|
|
2008-06-22 23:03:28 +08:00
|
|
|
void cx2341x_log_status(const struct cx2341x_mpeg_params *p, const char *prefix)
|
2006-06-19 01:40:30 +08:00
|
|
|
{
|
|
|
|
int is_mpeg1 = p->video_encoding == V4L2_MPEG_VIDEO_ENCODING_MPEG_1;
|
2006-12-19 00:40:23 +08:00
|
|
|
int temporal = p->video_temporal_filter;
|
2006-06-19 01:40:30 +08:00
|
|
|
|
|
|
|
/* Stream */
|
2007-04-27 23:31:00 +08:00
|
|
|
printk(KERN_INFO "%s: Stream: %s",
|
2006-06-27 05:24:05 +08:00
|
|
|
prefix,
|
2006-06-19 01:40:30 +08:00
|
|
|
cx2341x_menu_item(p, V4L2_CID_MPEG_STREAM_TYPE));
|
2007-04-27 23:31:00 +08:00
|
|
|
if (p->stream_insert_nav_packets)
|
|
|
|
printk(" (with navigation packets)");
|
|
|
|
printk("\n");
|
2006-08-28 06:22:15 +08:00
|
|
|
printk(KERN_INFO "%s: VBI Format: %s\n",
|
|
|
|
prefix,
|
|
|
|
cx2341x_menu_item(p, V4L2_CID_MPEG_STREAM_VBI_FMT));
|
2006-06-19 01:40:30 +08:00
|
|
|
|
|
|
|
/* Video */
|
2007-04-27 23:31:00 +08:00
|
|
|
printk(KERN_INFO "%s: Video: %dx%d, %d fps%s\n",
|
2006-06-27 05:24:05 +08:00
|
|
|
prefix,
|
2006-06-19 01:40:30 +08:00
|
|
|
p->width / (is_mpeg1 ? 2 : 1), p->height / (is_mpeg1 ? 2 : 1),
|
2007-04-27 23:31:00 +08:00
|
|
|
p->is_50hz ? 25 : 30,
|
|
|
|
(p->video_mute) ? " (muted)" : "");
|
2006-06-27 05:24:05 +08:00
|
|
|
printk(KERN_INFO "%s: Video: %s, %s, %s, %d",
|
|
|
|
prefix,
|
2006-06-19 01:40:30 +08:00
|
|
|
cx2341x_menu_item(p, V4L2_CID_MPEG_VIDEO_ENCODING),
|
|
|
|
cx2341x_menu_item(p, V4L2_CID_MPEG_VIDEO_ASPECT),
|
|
|
|
cx2341x_menu_item(p, V4L2_CID_MPEG_VIDEO_BITRATE_MODE),
|
|
|
|
p->video_bitrate);
|
2007-11-02 00:38:12 +08:00
|
|
|
if (p->video_bitrate_mode == V4L2_MPEG_VIDEO_BITRATE_MODE_VBR)
|
2006-06-19 01:40:30 +08:00
|
|
|
printk(", Peak %d", p->video_bitrate_peak);
|
|
|
|
printk("\n");
|
2007-11-02 00:38:12 +08:00
|
|
|
printk(KERN_INFO
|
|
|
|
"%s: Video: GOP Size %d, %d B-Frames, %sGOP Closure\n",
|
2006-06-27 05:24:05 +08:00
|
|
|
prefix,
|
2006-06-19 01:40:30 +08:00
|
|
|
p->video_gop_size, p->video_b_frames,
|
2006-12-19 09:52:21 +08:00
|
|
|
p->video_gop_closure ? "" : "No ");
|
2007-11-02 00:38:12 +08:00
|
|
|
if (p->video_temporal_decimation)
|
2006-06-27 05:24:05 +08:00
|
|
|
printk(KERN_INFO "%s: Video: Temporal Decimation %d\n",
|
|
|
|
prefix, p->video_temporal_decimation);
|
2006-06-19 01:40:30 +08:00
|
|
|
|
|
|
|
/* Audio */
|
2007-04-27 23:31:00 +08:00
|
|
|
printk(KERN_INFO "%s: Audio: %s, %s, %s, %s%s",
|
2006-06-27 05:24:05 +08:00
|
|
|
prefix,
|
2006-06-19 01:40:30 +08:00
|
|
|
cx2341x_menu_item(p, V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ),
|
|
|
|
cx2341x_menu_item(p, V4L2_CID_MPEG_AUDIO_ENCODING),
|
|
|
|
cx2341x_menu_item(p, V4L2_CID_MPEG_AUDIO_L2_BITRATE),
|
2007-04-27 23:31:00 +08:00
|
|
|
cx2341x_menu_item(p, V4L2_CID_MPEG_AUDIO_MODE),
|
|
|
|
p->audio_mute ? " (muted)" : "");
|
2007-11-02 00:38:12 +08:00
|
|
|
if (p->audio_mode == V4L2_MPEG_AUDIO_MODE_JOINT_STEREO)
|
|
|
|
printk(", %s", cx2341x_menu_item(p,
|
|
|
|
V4L2_CID_MPEG_AUDIO_MODE_EXTENSION));
|
2006-06-19 01:40:30 +08:00
|
|
|
printk(", %s, %s\n",
|
|
|
|
cx2341x_menu_item(p, V4L2_CID_MPEG_AUDIO_EMPHASIS),
|
|
|
|
cx2341x_menu_item(p, V4L2_CID_MPEG_AUDIO_CRC));
|
|
|
|
|
|
|
|
/* Encoding filters */
|
2006-06-27 05:24:05 +08:00
|
|
|
printk(KERN_INFO "%s: Spatial Filter: %s, Luma %s, Chroma %s, %d\n",
|
|
|
|
prefix,
|
2007-11-02 00:38:12 +08:00
|
|
|
cx2341x_menu_item(p,
|
|
|
|
V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE),
|
|
|
|
cx2341x_menu_item(p,
|
|
|
|
V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE),
|
|
|
|
cx2341x_menu_item(p,
|
|
|
|
V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE),
|
2006-06-19 01:40:30 +08:00
|
|
|
p->video_spatial_filter);
|
2007-11-02 00:38:12 +08:00
|
|
|
|
|
|
|
if (p->width != 720 || p->height != (p->is_50hz ? 576 : 480))
|
2006-12-19 00:40:23 +08:00
|
|
|
temporal = 0;
|
2007-11-02 00:38:12 +08:00
|
|
|
|
2006-06-27 05:24:05 +08:00
|
|
|
printk(KERN_INFO "%s: Temporal Filter: %s, %d\n",
|
|
|
|
prefix,
|
2007-11-02 00:38:12 +08:00
|
|
|
cx2341x_menu_item(p,
|
|
|
|
V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE),
|
2006-12-19 00:40:23 +08:00
|
|
|
temporal);
|
2007-11-02 00:38:12 +08:00
|
|
|
printk(KERN_INFO
|
|
|
|
"%s: Median Filter: %s, Luma [%d, %d], Chroma [%d, %d]\n",
|
2006-06-27 05:24:05 +08:00
|
|
|
prefix,
|
2007-11-02 00:38:12 +08:00
|
|
|
cx2341x_menu_item(p,
|
|
|
|
V4L2_CID_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE),
|
2006-06-19 01:40:30 +08:00
|
|
|
p->video_luma_median_filter_bottom,
|
|
|
|
p->video_luma_median_filter_top,
|
|
|
|
p->video_chroma_median_filter_bottom,
|
|
|
|
p->video_chroma_median_filter_top);
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL(cx2341x_log_status);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Local variables:
|
|
|
|
* c-basic-offset: 8
|
|
|
|
* End:
|
|
|
|
*/
|
|
|
|
|