Lines Matching refs:hdl
1297 return container_of(ctrl->handler, struct cx2341x_handler, hdl);
1300 static int cx2341x_hdl_api(struct cx2341x_handler *hdl,
1312 return hdl->func(hdl->priv, cmd, args, 0, data);
1323 struct cx2341x_handler *hdl = to_cxhdl(ctrl);
1330 int gop = hdl->video_gop_size->val;
1337 hdl->video_gop_size->val = gop;
1343 hdl->video_encoding->val =
1344 (hdl->stream_type->val == V4L2_MPEG_STREAM_TYPE_MPEG1_SS ||
1345 hdl->stream_type->val == V4L2_MPEG_STREAM_TYPE_MPEG1_VCD) ?
1348 if (hdl->video_encoding->val == V4L2_MPEG_VIDEO_ENCODING_MPEG_1)
1350 hdl->video_bitrate_mode->val =
1353 if (hdl->video_bitrate_mode->val == V4L2_MPEG_VIDEO_BITRATE_MODE_VBR &&
1354 hdl->video_bitrate_peak->val < hdl->video_bitrate->val)
1355 hdl->video_bitrate_peak->val = hdl->video_bitrate->val;
1371 struct cx2341x_handler *hdl = to_cxhdl(ctrl);
1378 if (hdl->ops && hdl->ops->s_stream_vbi_fmt)
1379 return hdl->ops->s_stream_vbi_fmt(hdl, val);
1383 return cx2341x_hdl_api(hdl,
1387 return cx2341x_hdl_api(hdl, CX2341X_ENC_SET_GOP_CLOSURE, 1, val);
1390 return cx2341x_hdl_api(hdl, CX2341X_ENC_MUTE_AUDIO, 1, val);
1393 return cx2341x_hdl_api(hdl,
1397 return cx2341x_hdl_api(hdl, CX2341X_ENC_MISC, 2, 7, val);
1401 props = (hdl->audio_sampling_freq->val << 0) |
1402 (hdl->audio_mode->val << 8) |
1403 (hdl->audio_mode_extension->val << 10) |
1404 (hdl->audio_crc->val << 14);
1405 if (hdl->audio_emphasis->val == V4L2_MPEG_AUDIO_EMPHASIS_CCITT_J17)
1408 props |= hdl->audio_emphasis->val << 12;
1410 if (hdl->audio_encoding->val == V4L2_MPEG_AUDIO_ENCODING_AC3) {
1416 (hdl->audio_ac3_bitrate->val << 4) |
1421 ((3 - hdl->audio_encoding->val) << 2) |
1422 ((1 + hdl->audio_l2_bitrate->val) << 4);
1424 err = cx2341x_hdl_api(hdl,
1429 hdl->audio_properties = props;
1430 if (hdl->audio_ac3_bitrate) {
1431 int is_ac3 = hdl->audio_encoding->val ==
1434 v4l2_ctrl_activate(hdl->audio_ac3_bitrate, is_ac3);
1435 v4l2_ctrl_activate(hdl->audio_l2_bitrate, !is_ac3);
1437 v4l2_ctrl_activate(hdl->audio_mode_extension,
1438 hdl->audio_mode->val == V4L2_MPEG_AUDIO_MODE_JOINT_STEREO);
1439 if (cx2341x_neq(hdl->audio_sampling_freq) &&
1440 hdl->ops && hdl->ops->s_audio_sampling_freq)
1441 return hdl->ops->s_audio_sampling_freq(hdl, hdl->audio_sampling_freq->val);
1442 if (cx2341x_neq(hdl->audio_mode) &&
1443 hdl->ops && hdl->ops->s_audio_mode)
1444 return hdl->ops->s_audio_mode(hdl, hdl->audio_mode->val);
1449 return cx2341x_hdl_api(hdl, CX2341X_ENC_SET_GOP_PROPERTIES, 2,
1450 hdl->video_gop_size->val,
1451 hdl->video_b_frames->val + 1);
1455 err = cx2341x_hdl_api(hdl,
1460 err = cx2341x_hdl_api(hdl, CX2341X_ENC_SET_BIT_RATE, 5,
1461 hdl->video_bitrate_mode->val,
1462 hdl->video_bitrate->val,
1463 hdl->video_bitrate_peak->val / 400, 0, 0);
1467 v4l2_ctrl_activate(hdl->video_bitrate_mode,
1468 hdl->video_encoding->val != V4L2_MPEG_VIDEO_ENCODING_MPEG_1);
1469 v4l2_ctrl_activate(hdl->video_bitrate_peak,
1470 hdl->video_bitrate_mode->val != V4L2_MPEG_VIDEO_BITRATE_MODE_CBR);
1471 if (cx2341x_neq(hdl->video_encoding) &&
1472 hdl->ops && hdl->ops->s_video_encoding)
1473 return hdl->ops->s_video_encoding(hdl, hdl->video_encoding->val);
1478 return cx2341x_hdl_api(hdl, CX2341X_ENC_MUTE_VIDEO, 1,
1479 hdl->video_mute->val |
1480 (hdl->video_mute_yuv->val << 8));
1486 err = cx2341x_hdl_api(hdl, CX2341X_ENC_SET_DNR_FILTER_MODE, 2,
1487 hdl->video_spatial_filter_mode->val |
1488 (hdl->video_temporal_filter_mode->val << 1),
1489 hdl->video_median_filter_type->val);
1493 active_filter = hdl->video_spatial_filter_mode->val !=
1495 v4l2_ctrl_activate(hdl->video_spatial_filter, active_filter);
1496 v4l2_ctrl_activate(hdl->video_luma_spatial_filter_type, active_filter);
1497 v4l2_ctrl_activate(hdl->video_chroma_spatial_filter_type, active_filter);
1498 active_filter = hdl->video_temporal_filter_mode->val !=
1500 v4l2_ctrl_activate(hdl->video_temporal_filter, active_filter);
1501 active_filter = hdl->video_median_filter_type->val !=
1503 v4l2_ctrl_activate(hdl->video_luma_median_filter_bottom, active_filter);
1504 v4l2_ctrl_activate(hdl->video_luma_median_filter_top, active_filter);
1505 v4l2_ctrl_activate(hdl->video_chroma_median_filter_bottom, active_filter);
1506 v4l2_ctrl_activate(hdl->video_chroma_median_filter_top, active_filter);
1512 return cx2341x_hdl_api(hdl,
1514 hdl->video_luma_spatial_filter_type->val,
1515 hdl->video_chroma_spatial_filter_type->val);
1519 return cx2341x_hdl_api(hdl, CX2341X_ENC_SET_DNR_FILTER_PROPS, 2,
1520 hdl->video_spatial_filter->val,
1521 hdl->video_temporal_filter->val);
1525 return cx2341x_hdl_api(hdl, CX2341X_ENC_SET_CORING_LEVELS, 4,
1526 hdl->video_luma_median_filter_bottom->val,
1527 hdl->video_luma_median_filter_top->val,
1528 hdl->video_chroma_median_filter_bottom->val,
1529 hdl->video_chroma_median_filter_top->val);
1539 static struct v4l2_ctrl *cx2341x_ctrl_new_custom(struct v4l2_ctrl_handler *hdl,
1559 return v4l2_ctrl_new_custom(hdl, &cfg, NULL);
1562 static struct v4l2_ctrl *cx2341x_ctrl_new_std(struct v4l2_ctrl_handler *hdl,
1565 return v4l2_ctrl_new_std(hdl, &cx2341x_ops, id, min, max, step, def);
1568 static struct v4l2_ctrl *cx2341x_ctrl_new_menu(struct v4l2_ctrl_handler *hdl,
1571 return v4l2_ctrl_new_std_menu(hdl, &cx2341x_ops, id, max, mask, def);
1577 struct v4l2_ctrl_handler *hdl = &cxhdl->hdl;
1586 v4l2_ctrl_handler_init(hdl, nr_of_controls_hint);
1590 cxhdl->stream_type = cx2341x_ctrl_new_menu(hdl,
1594 cxhdl->stream_vbi_fmt = cx2341x_ctrl_new_menu(hdl,
1598 cxhdl->audio_sampling_freq = cx2341x_ctrl_new_menu(hdl,
1602 cxhdl->audio_encoding = cx2341x_ctrl_new_menu(hdl,
1606 cxhdl->audio_l2_bitrate = cx2341x_ctrl_new_menu(hdl,
1610 cxhdl->audio_mode = cx2341x_ctrl_new_menu(hdl,
1614 cxhdl->audio_mode_extension = cx2341x_ctrl_new_menu(hdl,
1618 cxhdl->audio_emphasis = cx2341x_ctrl_new_menu(hdl,
1622 cxhdl->audio_crc = cx2341x_ctrl_new_menu(hdl,
1627 cx2341x_ctrl_new_std(hdl, V4L2_CID_MPEG_AUDIO_MUTE, 0, 1, 1, 0);
1629 cxhdl->audio_ac3_bitrate = cx2341x_ctrl_new_menu(hdl,
1633 cxhdl->video_encoding = cx2341x_ctrl_new_menu(hdl,
1637 cx2341x_ctrl_new_menu(hdl,
1641 cxhdl->video_b_frames = cx2341x_ctrl_new_std(hdl,
1643 cxhdl->video_gop_size = cx2341x_ctrl_new_std(hdl,
1646 cx2341x_ctrl_new_std(hdl, V4L2_CID_MPEG_VIDEO_GOP_CLOSURE, 0, 1, 1, 1);
1647 cxhdl->video_bitrate_mode = cx2341x_ctrl_new_menu(hdl,
1651 cxhdl->video_bitrate = cx2341x_ctrl_new_std(hdl,
1654 cxhdl->video_bitrate_peak = cx2341x_ctrl_new_std(hdl,
1657 cx2341x_ctrl_new_std(hdl,
1659 cxhdl->video_mute = cx2341x_ctrl_new_std(hdl,
1661 cxhdl->video_mute_yuv = cx2341x_ctrl_new_std(hdl,
1665 cxhdl->video_spatial_filter_mode = cx2341x_ctrl_new_custom(hdl,
1670 cxhdl->video_spatial_filter = cx2341x_ctrl_new_custom(hdl,
1673 cxhdl->video_luma_spatial_filter_type = cx2341x_ctrl_new_custom(hdl,
1679 cxhdl->video_chroma_spatial_filter_type = cx2341x_ctrl_new_custom(hdl,
1685 cxhdl->video_temporal_filter_mode = cx2341x_ctrl_new_custom(hdl,
1691 cxhdl->video_temporal_filter = cx2341x_ctrl_new_custom(hdl,
1694 cxhdl->video_median_filter_type = cx2341x_ctrl_new_custom(hdl,
1700 cxhdl->video_luma_median_filter_bottom = cx2341x_ctrl_new_custom(hdl,
1703 cxhdl->video_luma_median_filter_top = cx2341x_ctrl_new_custom(hdl,
1706 cxhdl->video_chroma_median_filter_bottom = cx2341x_ctrl_new_custom(hdl,
1709 cxhdl->video_chroma_median_filter_top = cx2341x_ctrl_new_custom(hdl,
1712 cx2341x_ctrl_new_custom(hdl, V4L2_CID_MPEG_CX2341X_STREAM_INSERT_NAV_PACKETS,
1715 if (hdl->error) {
1716 int err = hdl->error;
1718 v4l2_ctrl_handler_free(hdl);
1762 return v4l2_ctrl_handler_setup(&cxhdl->hdl);