diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2011-12-15 08:32:53 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-02-14 10:44:41 -0500 |
commit | debf80014fc1e8d02b3fd57e5fae0d315ac2cb04 (patch) | |
tree | b4275b68e02eab7865d5b61fd9ca4ac1ee9408a4 /drivers/media/video/ivtv/ivtv-ioctl.c | |
parent | 77bd4c0ff1671214ee026c175b4a5e1cc8776a0a (diff) |
[media] ivtv: implement new decoder controls
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/ivtv/ivtv-ioctl.c')
-rw-r--r-- | drivers/media/video/ivtv/ivtv-ioctl.c | 67 |
1 files changed, 12 insertions, 55 deletions
diff --git a/drivers/media/video/ivtv/ivtv-ioctl.c b/drivers/media/video/ivtv/ivtv-ioctl.c index 13020a7e5db9..cd8032693e6d 100644 --- a/drivers/media/video/ivtv/ivtv-ioctl.c +++ b/drivers/media/video/ivtv/ivtv-ioctl.c | |||
@@ -1510,13 +1510,6 @@ static int ivtv_log_status(struct file *file, void *fh) | |||
1510 | "YUV Frames", | 1510 | "YUV Frames", |
1511 | "Passthrough", | 1511 | "Passthrough", |
1512 | }; | 1512 | }; |
1513 | static const char * const audio_modes[5] = { | ||
1514 | "Stereo", | ||
1515 | "Left", | ||
1516 | "Right", | ||
1517 | "Mono", | ||
1518 | "Swapped" | ||
1519 | }; | ||
1520 | static const char * const alpha_mode[4] = { | 1513 | static const char * const alpha_mode[4] = { |
1521 | "None", | 1514 | "None", |
1522 | "Global", | 1515 | "Global", |
@@ -1545,9 +1538,6 @@ static int ivtv_log_status(struct file *file, void *fh) | |||
1545 | ivtv_get_output(itv, itv->active_output, &vidout); | 1538 | ivtv_get_output(itv, itv->active_output, &vidout); |
1546 | ivtv_get_audio_output(itv, 0, &audout); | 1539 | ivtv_get_audio_output(itv, 0, &audout); |
1547 | IVTV_INFO("Video Output: %s\n", vidout.name); | 1540 | IVTV_INFO("Video Output: %s\n", vidout.name); |
1548 | IVTV_INFO("Audio Output: %s (Stereo/Bilingual: %s/%s)\n", audout.name, | ||
1549 | audio_modes[itv->audio_stereo_mode], | ||
1550 | audio_modes[itv->audio_bilingual_mode]); | ||
1551 | if (mode < 0 || mode > OUT_PASSTHROUGH) | 1541 | if (mode < 0 || mode > OUT_PASSTHROUGH) |
1552 | mode = OUT_NONE; | 1542 | mode = OUT_NONE; |
1553 | IVTV_INFO("Output Mode: %s\n", output_modes[mode]); | 1543 | IVTV_INFO("Output Mode: %s\n", output_modes[mode]); |
@@ -1560,7 +1550,10 @@ static int ivtv_log_status(struct file *file, void *fh) | |||
1560 | } | 1550 | } |
1561 | IVTV_INFO("Tuner: %s\n", | 1551 | IVTV_INFO("Tuner: %s\n", |
1562 | test_bit(IVTV_F_I_RADIO_USER, &itv->i_flags) ? "Radio" : "TV"); | 1552 | test_bit(IVTV_F_I_RADIO_USER, &itv->i_flags) ? "Radio" : "TV"); |
1563 | v4l2_ctrl_handler_log_status(&itv->cxhdl.hdl, itv->v4l2_dev.name); | 1553 | if (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT) |
1554 | v4l2_ctrl_handler_log_status(&itv->hdl_out, itv->v4l2_dev.name); | ||
1555 | else | ||
1556 | v4l2_ctrl_handler_log_status(&itv->cxhdl.hdl, itv->v4l2_dev.name); | ||
1564 | IVTV_INFO("Status flags: 0x%08lx\n", itv->i_flags); | 1557 | IVTV_INFO("Status flags: 0x%08lx\n", itv->i_flags); |
1565 | for (i = 0; i < IVTV_MAX_STREAMS; i++) { | 1558 | for (i = 0; i < IVTV_MAX_STREAMS; i++) { |
1566 | struct ivtv_stream *s = &itv->streams[i]; | 1559 | struct ivtv_stream *s = &itv->streams[i]; |
@@ -1633,8 +1626,8 @@ static int ivtv_decoder_ioctls(struct file *filp, unsigned int cmd, void *arg) | |||
1633 | } | 1626 | } |
1634 | 1627 | ||
1635 | case VIDEO_GET_PTS: { | 1628 | case VIDEO_GET_PTS: { |
1636 | u32 data[CX2341X_MBOX_MAX_DATA]; | 1629 | s64 *pts = arg; |
1637 | u64 *pts = arg; | 1630 | s64 frame; |
1638 | 1631 | ||
1639 | IVTV_DEBUG_IOCTL("VIDEO_GET_PTS\n"); | 1632 | IVTV_DEBUG_IOCTL("VIDEO_GET_PTS\n"); |
1640 | if (s->type < IVTV_DEC_STREAM_TYPE_MPG) { | 1633 | if (s->type < IVTV_DEC_STREAM_TYPE_MPG) { |
@@ -1643,29 +1636,12 @@ static int ivtv_decoder_ioctls(struct file *filp, unsigned int cmd, void *arg) | |||
1643 | } | 1636 | } |
1644 | if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT)) | 1637 | if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT)) |
1645 | return -EINVAL; | 1638 | return -EINVAL; |
1646 | 1639 | return ivtv_g_pts_frame(itv, pts, &frame); | |
1647 | if (test_bit(IVTV_F_I_VALID_DEC_TIMINGS, &itv->i_flags)) { | ||
1648 | *pts = (u64) ((u64)itv->last_dec_timing[2] << 32) | | ||
1649 | (u64)itv->last_dec_timing[1]; | ||
1650 | break; | ||
1651 | } | ||
1652 | *pts = 0; | ||
1653 | if (atomic_read(&itv->decoding)) { | ||
1654 | if (ivtv_api(itv, CX2341X_DEC_GET_TIMING_INFO, 5, data)) { | ||
1655 | IVTV_DEBUG_WARN("GET_TIMING: couldn't read clock\n"); | ||
1656 | return -EIO; | ||
1657 | } | ||
1658 | memcpy(itv->last_dec_timing, data, sizeof(itv->last_dec_timing)); | ||
1659 | set_bit(IVTV_F_I_VALID_DEC_TIMINGS, &itv->i_flags); | ||
1660 | *pts = (u64) ((u64) data[2] << 32) | (u64) data[1]; | ||
1661 | /*timing->scr = (u64) (((u64) data[4] << 32) | (u64) (data[3]));*/ | ||
1662 | } | ||
1663 | break; | ||
1664 | } | 1640 | } |
1665 | 1641 | ||
1666 | case VIDEO_GET_FRAME_COUNT: { | 1642 | case VIDEO_GET_FRAME_COUNT: { |
1667 | u32 data[CX2341X_MBOX_MAX_DATA]; | 1643 | s64 *frame = arg; |
1668 | u64 *frame = arg; | 1644 | s64 pts; |
1669 | 1645 | ||
1670 | IVTV_DEBUG_IOCTL("VIDEO_GET_FRAME_COUNT\n"); | 1646 | IVTV_DEBUG_IOCTL("VIDEO_GET_FRAME_COUNT\n"); |
1671 | if (s->type < IVTV_DEC_STREAM_TYPE_MPG) { | 1647 | if (s->type < IVTV_DEC_STREAM_TYPE_MPG) { |
@@ -1674,22 +1650,7 @@ static int ivtv_decoder_ioctls(struct file *filp, unsigned int cmd, void *arg) | |||
1674 | } | 1650 | } |
1675 | if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT)) | 1651 | if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT)) |
1676 | return -EINVAL; | 1652 | return -EINVAL; |
1677 | 1653 | return ivtv_g_pts_frame(itv, &pts, frame); | |
1678 | if (test_bit(IVTV_F_I_VALID_DEC_TIMINGS, &itv->i_flags)) { | ||
1679 | *frame = itv->last_dec_timing[0]; | ||
1680 | break; | ||
1681 | } | ||
1682 | *frame = 0; | ||
1683 | if (atomic_read(&itv->decoding)) { | ||
1684 | if (ivtv_api(itv, CX2341X_DEC_GET_TIMING_INFO, 5, data)) { | ||
1685 | IVTV_DEBUG_WARN("GET_TIMING: couldn't read clock\n"); | ||
1686 | return -EIO; | ||
1687 | } | ||
1688 | memcpy(itv->last_dec_timing, data, sizeof(itv->last_dec_timing)); | ||
1689 | set_bit(IVTV_F_I_VALID_DEC_TIMINGS, &itv->i_flags); | ||
1690 | *frame = data[0]; | ||
1691 | } | ||
1692 | break; | ||
1693 | } | 1654 | } |
1694 | 1655 | ||
1695 | case VIDEO_PLAY: { | 1656 | case VIDEO_PLAY: { |
@@ -1804,17 +1765,13 @@ static int ivtv_decoder_ioctls(struct file *filp, unsigned int cmd, void *arg) | |||
1804 | IVTV_DEBUG_IOCTL("AUDIO_CHANNEL_SELECT\n"); | 1765 | IVTV_DEBUG_IOCTL("AUDIO_CHANNEL_SELECT\n"); |
1805 | if (iarg > AUDIO_STEREO_SWAPPED) | 1766 | if (iarg > AUDIO_STEREO_SWAPPED) |
1806 | return -EINVAL; | 1767 | return -EINVAL; |
1807 | itv->audio_stereo_mode = iarg; | 1768 | return v4l2_ctrl_s_ctrl(itv->ctrl_audio_playback, iarg); |
1808 | ivtv_vapi(itv, CX2341X_DEC_SET_AUDIO_MODE, 2, itv->audio_bilingual_mode, itv->audio_stereo_mode); | ||
1809 | return 0; | ||
1810 | 1769 | ||
1811 | case AUDIO_BILINGUAL_CHANNEL_SELECT: | 1770 | case AUDIO_BILINGUAL_CHANNEL_SELECT: |
1812 | IVTV_DEBUG_IOCTL("AUDIO_BILINGUAL_CHANNEL_SELECT\n"); | 1771 | IVTV_DEBUG_IOCTL("AUDIO_BILINGUAL_CHANNEL_SELECT\n"); |
1813 | if (iarg > AUDIO_STEREO_SWAPPED) | 1772 | if (iarg > AUDIO_STEREO_SWAPPED) |
1814 | return -EINVAL; | 1773 | return -EINVAL; |
1815 | itv->audio_bilingual_mode = iarg; | 1774 | return v4l2_ctrl_s_ctrl(itv->ctrl_audio_multilingual_playback, iarg); |
1816 | ivtv_vapi(itv, CX2341X_DEC_SET_AUDIO_MODE, 2, itv->audio_bilingual_mode, itv->audio_stereo_mode); | ||
1817 | return 0; | ||
1818 | 1775 | ||
1819 | default: | 1776 | default: |
1820 | return -EINVAL; | 1777 | return -EINVAL; |