Skip to contentSkip to conversation

Reduce the gap between DVBv5 API and the specs

PATCH In review Mauro Carvalho Chehab 4 participants 12 messages Jun 8, 2011 – Jun 9, 2011 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

cover Reduce the gap between DVBv5 API and the specs

There's a huge gap between the DVB specs and the current implementation. This were caused by years of changes that happened at the code but no updates to the specs were done.

This patch series tries to reduce this gap.

Basically, the headers at include/linux/dvb were included at the API. The Makefile scripting auto-generate references for structs, typedefs and ioctls. With this, it is now easy to identify when something is missing.

After adding such logic, I've manually synchronized the specs with the header file and updated the data structures.

The work is not complete yet: there are still several ioctl's not documented at the specs:

Error: no ID for constraint linkend: AUDIO_BILINGUAL_CHANNEL_SELECT.
Error: no ID for constraint linkend: CA_RESET.
Error: no ID for constraint linkend: CA_GET_CAP.
Error: no ID for constraint linkend: CA_GET_SLOT_INFO.
Error: no ID for constraint linkend: CA_GET_DESCR_INFO.
Error: no ID for constraint linkend: CA_GET_MSG.
Error: no ID for constraint linkend: CA_SEND_MSG.
Error: no ID for constraint linkend: CA_SET_DESCR.
Error: no ID for constraint linkend: CA_SET_PID.
Error: no ID for constraint linkend: DMX_GET_PES_PIDS.
Error: no ID for constraint linkend: DMX_GET_CAPS.
Error: no ID for constraint linkend: DMX_SET_SOURCE.
Error: no ID for constraint linkend: DMX_ADD_PID.
Error: no ID for constraint linkend: DMX_REMOVE_PID.
Error: no ID for constraint linkend: NET_ADD_IF.
Error: no ID for constraint linkend: NET_REMOVE_IF.
Error: no ID for constraint linkend: NET_GET_IF.
Error: no ID for constraint linkend: VIDEO_GET_SIZE.
Error: no ID for constraint linkend: VIDEO_GET_FRAME_RATE.
Error: no ID for constraint linkend: VIDEO_GET_PTS.
Error: no ID for constraint linkend: VIDEO_GET_FRAME_COUNT.
Error: no ID for constraint linkend: VIDEO_COMMAND.
Error: no ID for constraint linkend: VIDEO_TRY_COMMAND.

I also opted to not add the osd.h header into the DocBook, as it seemed odd on my eyes, and it is used only by one legacy hardware.

While here, I noticed that one audio ioctl is not used anyware (AUDIO_GET_PTS). There is just the ioctl definition and that's it. I just removed this definition, as removing it won't cause any regression, as no in-kernel driver or dvb-core uses it.

Btw, there are several ioctl's and correponding data structures that are used on just one or two old drivers. I think we should consider to deprecate those old stuff.

Mauro Carvalho Chehab (13):
[media] DocBook: Add the other DVB API header files
[media] DocBook/audio.xml: match section ID's with the reference links [media] DocBook/audio.xml: synchronize attribute changes [media] DocBook: Document AUDIO_CONTINUE ioctl
[media] dvb/audio.h: Remove definition for AUDIO_GET_PTS [media] Docbook/ca.xml: match section ID's with the reference links [media] DocBook/ca.xml: Describe structure ca_pid
[media] DocBook/demux.xml: Fix section references with dmx.h.xml [media] DocBook/demux.xml: Add the remaining data structures to the API spec [media] DocBook/net.xml: Synchronize Network data structure [media] DocBook/Makefile: Remove osd.h header
[media] DocBook/video.xml: Fix section references with video.h.xml [media] DocBook/video.xml: Document the remaining data structures

 Documentation/DocBook/media/Makefile       |   81 ++++++++++-
 Documentation/DocBook/media/dvb/audio.xml  |  176 +++++++++++++++--------
 Documentation/DocBook/media/dvb/ca.xml     |  106 ++++++++------
 Documentation/DocBook/media/dvb/demux.xml  |  206 +++++++++++++++-----------
 Documentation/DocBook/media/dvb/dvbapi.xml |   20 +++
 Documentation/DocBook/media/dvb/intro.xml  |   19 +++-
 Documentation/DocBook/media/dvb/net.xml    |   17 ++
 Documentation/DocBook/media/dvb/video.xml  |  220 +++++++++++++++++-----------
 include/linux/dvb/audio.h                  |   14 +--
 9 files changed, 564 insertions(+), 295 deletions(-)
#1 lore raw
Quoted 18 lines · On Wednesday, June 08, 2011 22:23:11 Mauro Carvalho Chehab wrote:

There's a huge gap between the DVB specs and the current implementation. This were caused by years of changes that happened at the code but no updates to the specs were done.

This patch series tries to reduce this gap.

Basically, the headers at include/linux/dvb were included at the API. The Makefile scripting auto-generate references for structs, typedefs and ioctls. With this, it is now easy to identify when something is missing.

After adding such logic, I've manually synchronized the specs with the header file and updated the data structures.

The work is not complete yet: there are still several ioctl's not documented at the specs:

Error: no ID for constraint linkend: AUDIO_BILINGUAL_CHANNEL_SELECT.

...

Quoted 6 lines

Error: no ID for constraint linkend: VIDEO_GET_SIZE.
Error: no ID for constraint linkend: VIDEO_GET_FRAME_RATE.
Error: no ID for constraint linkend: VIDEO_GET_PTS.
Error: no ID for constraint linkend: VIDEO_GET_FRAME_COUNT.
Error: no ID for constraint linkend: VIDEO_COMMAND.
Error: no ID for constraint linkend: VIDEO_TRY_COMMAND.

A lot of these video/audio commands should be converted to V4L ioctls.

VIDEO_COMMAND and VIDEO_TRY_COMMAND should become VIDIOC_(TRY_)DECODER_CMD, the others can either be integrated into VIDIOC_DECODER_CMD or become (read-only) controls or something similar. Or just dropped if no apps use them.

The only drivers that use these at the moment are ivtv and av7110. At least for ivtv I'd love to switch to V4L ioctls (documented and all) and leave the old VIDEO/AUDIO ioctls as specific to av7110 (just like osd.h).

Realistically this would be a job for me, but I am still way too busy to tackle something like this.

Quoted 7 lines

I also opted to not add the osd.h header into the DocBook, as it seemed odd on my eyes, and it is used only by one legacy hardware.

While here, I noticed that one audio ioctl is not used anyware (AUDIO_GET_PTS). There is just the ioctl definition and that's it. I just removed this definition, as removing it won't cause any regression, as no in-kernel driver or dvb-core uses it.

It was originally planned to be used in ivtv, but this never happened.

Quoted 3 lines

Btw, there are several ioctl's and correponding data structures that are used on just one or two old drivers. I think we should consider to deprecate those old stuff.

Which? If you have a list of those, then that would make for an interesting RFC.

Regards,

Hans

Quoted 33 lines

Mauro Carvalho Chehab (13):
[media] DocBook: Add the other DVB API header files
[media] DocBook/audio.xml: match section ID's with the reference links [media] DocBook/audio.xml: synchronize attribute changes [media] DocBook: Document AUDIO_CONTINUE ioctl
[media] dvb/audio.h: Remove definition for AUDIO_GET_PTS [media] Docbook/ca.xml: match section ID's with the reference links [media] DocBook/ca.xml: Describe structure ca_pid
[media] DocBook/demux.xml: Fix section references with dmx.h.xml [media] DocBook/demux.xml: Add the remaining data structures to the API spec [media] DocBook/net.xml: Synchronize Network data structure [media] DocBook/Makefile: Remove osd.h header
[media] DocBook/video.xml: Fix section references with video.h.xml [media] DocBook/video.xml: Document the remaining data structures

 Documentation/DocBook/media/Makefile       |   81 ++++++++++-
 Documentation/DocBook/media/dvb/audio.xml  |  176 +++++++++++++++--------
 Documentation/DocBook/media/dvb/ca.xml     |  106 ++++++++------
 Documentation/DocBook/media/dvb/demux.xml  |  206 +++++++++++++++-----------
 Documentation/DocBook/media/dvb/dvbapi.xml |   20 +++
 Documentation/DocBook/media/dvb/intro.xml  |   19 +++-
 Documentation/DocBook/media/dvb/net.xml    |   17 ++
 Documentation/DocBook/media/dvb/video.xml  |  220 +++++++++++++++++-----------
 include/linux/dvb/audio.h                  |   14 +--
 9 files changed, 564 insertions(+), 295 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw

Em 08-06-2011 17:59, Hans Verkuil escreveu:

Quoted 20 lines · On Wednesday, June 08, 2011 22:23:11 Mauro Carvalho Chehab wrote:
Quoted 18 lines

There's a huge gap between the DVB specs and the current implementation. This were caused by years of changes that happened at the code but no updates to the specs were done.

This patch series tries to reduce this gap.

Basically, the headers at include/linux/dvb were included at the API. The Makefile scripting auto-generate references for structs, typedefs and ioctls. With this, it is now easy to identify when something is missing.

After adding such logic, I've manually synchronized the specs with the header file and updated the data structures.

The work is not complete yet: there are still several ioctl's not documented at the specs:

Error: no ID for constraint linkend: AUDIO_BILINGUAL_CHANNEL_SELECT.

...

Quoted 8 lines
Quoted 6 lines

Error: no ID for constraint linkend: VIDEO_GET_SIZE.
Error: no ID for constraint linkend: VIDEO_GET_FRAME_RATE.
Error: no ID for constraint linkend: VIDEO_GET_PTS.
Error: no ID for constraint linkend: VIDEO_GET_FRAME_COUNT.
Error: no ID for constraint linkend: VIDEO_COMMAND.
Error: no ID for constraint linkend: VIDEO_TRY_COMMAND.

A lot of these video/audio commands should be converted to V4L ioctls.

Agreed.

Quoted 7 lines

VIDEO_COMMAND and VIDEO_TRY_COMMAND should become VIDIOC_(TRY_)DECODER_CMD, the others can either be integrated into VIDIOC_DECODER_CMD or become (read-only) controls or something similar. Or just dropped if no apps use them.

The only drivers that use these at the moment are ivtv and av7110. At least for ivtv I'd love to switch to V4L ioctls (documented and all) and leave the old VIDEO/AUDIO ioctls as specific to av7110 (just like osd.h).

That seems to be the right approach to me.

Quoted 11 lines

Realistically this would be a job for me, but I am still way too busy to tackle something like this.

Quoted 7 lines

I also opted to not add the osd.h header into the DocBook, as it seemed odd on my eyes, and it is used only by one legacy hardware.

While here, I noticed that one audio ioctl is not used anyware (AUDIO_GET_PTS). There is just the ioctl definition and that's it. I just removed this definition, as removing it won't cause any regression, as no in-kernel driver or dvb-core uses it.

Quoted 8 lines

It was originally planned to be used in ivtv, but this never happened.

Quoted 3 lines

Btw, there are several ioctl's and correponding data structures that are used on just one or two old drivers. I think we should consider to deprecate those old stuff.

Which? If you have a list of those, then that would make for an interesting RFC.

Well, with a simple git grep, we can check this:

$ for i in $(perl -ne 'print "$1\n" if /\#define\s+([^\s]+)\s+_IO/' include/linux/dvb/*); do echo $i; git grep -l $i drivers/media ; done
AUDIO_STOP
drivers/media/dvb/ttpci/av7110_av.c
AUDIO_PLAY
drivers/media/dvb/ttpci/av7110_av.c
AUDIO_PAUSE
drivers/media/dvb/ttpci/av7110_av.c
AUDIO_CONTINUE
drivers/media/dvb/ttpci/av7110_av.c
AUDIO_SELECT_SOURCE
drivers/media/dvb/ttpci/av7110_av.c
AUDIO_SET_MUTE
drivers/media/dvb/ttpci/av7110_av.c
drivers/media/video/ivtv/ivtv-ioctl.c
AUDIO_SET_AV_SYNC
drivers/media/dvb/ttpci/av7110_av.c
AUDIO_SET_BYPASS_MODE
drivers/media/dvb/ttpci/av7110_av.c
AUDIO_CHANNEL_SELECT
drivers/media/dvb/ttpci/av7110_av.c
drivers/media/video/ivtv/ivtv-ioctl.c
AUDIO_GET_STATUS
drivers/media/dvb/ttpci/av7110_av.c
AUDIO_GET_CAPABILITIES
drivers/media/dvb/ttpci/av7110_av.c
AUDIO_CLEAR_BUFFER
drivers/media/dvb/ttpci/av7110_av.c
AUDIO_SET_ID
drivers/media/dvb/ttpci/av7110_av.c
AUDIO_SET_MIXER
drivers/media/dvb/ttpci/av7110_av.c
AUDIO_SET_STREAMTYPE
drivers/media/dvb/ttpci/av7110_av.c
AUDIO_SET_EXT_ID
AUDIO_SET_ATTRIBUTES
AUDIO_SET_KARAOKE
AUDIO_BILINGUAL_CHANNEL_SELECT
drivers/media/video/ivtv/ivtv-ioctl.c
AUDIO_STOP
drivers/media/dvb/ttpci/av7110_av.c
AUDIO_PLAY
drivers/media/dvb/ttpci/av7110_av.c
AUDIO_PAUSE
drivers/media/dvb/ttpci/av7110_av.c
AUDIO_CONTINUE
drivers/media/dvb/ttpci/av7110_av.c
AUDIO_SELECT_SOURCE
drivers/media/dvb/ttpci/av7110_av.c
AUDIO_SET_MUTE
drivers/media/dvb/ttpci/av7110_av.c
drivers/media/video/ivtv/ivtv-ioctl.c
AUDIO_SET_AV_SYNC
drivers/media/dvb/ttpci/av7110_av.c
AUDIO_SET_BYPASS_MODE
drivers/media/dvb/ttpci/av7110_av.c
AUDIO_CHANNEL_SELECT
drivers/media/dvb/ttpci/av7110_av.c
drivers/media/video/ivtv/ivtv-ioctl.c
AUDIO_GET_STATUS
drivers/media/dvb/ttpci/av7110_av.c
AUDIO_GET_CAPABILITIES
drivers/media/dvb/ttpci/av7110_av.c
AUDIO_CLEAR_BUFFER
drivers/media/dvb/ttpci/av7110_av.c
AUDIO_SET_ID
drivers/media/dvb/ttpci/av7110_av.c
AUDIO_SET_MIXER
drivers/media/dvb/ttpci/av7110_av.c
AUDIO_SET_STREAMTYPE
drivers/media/dvb/ttpci/av7110_av.c
AUDIO_SET_EXT_ID
AUDIO_SET_ATTRIBUTES
AUDIO_SET_KARAOKE
AUDIO_BILINGUAL_CHANNEL_SELECT
drivers/media/video/ivtv/ivtv-ioctl.c
CA_RESET
drivers/media/dvb/bt8xx/dst_ca.c
drivers/media/dvb/dvb-core/dvb_ca_en50221.c
drivers/media/dvb/firewire/firedtv-avc.c
drivers/media/dvb/firewire/firedtv-ci.c
drivers/media/dvb/ttpci/av7110_ca.c
CA_GET_CAP
drivers/media/dvb/bt8xx/dst_ca.c
drivers/media/dvb/dvb-core/dvb_ca_en50221.c
drivers/media/dvb/firewire/firedtv-ci.c
drivers/media/dvb/ttpci/av7110_ca.c
CA_GET_SLOT_INFO
drivers/media/dvb/bt8xx/dst_ca.c
drivers/media/dvb/dvb-core/dvb_ca_en50221.c
drivers/media/dvb/firewire/firedtv-ci.c
drivers/media/dvb/ttpci/av7110_ca.c
CA_GET_DESCR_INFO
drivers/media/dvb/bt8xx/dst_ca.c
drivers/media/dvb/ttpci/av7110_ca.c
CA_GET_MSG
drivers/media/dvb/bt8xx/dst_ca.c
drivers/media/dvb/dvb-core/dvb_ca_en50221.c
drivers/media/dvb/firewire/firedtv-ci.c
drivers/media/dvb/ttpci/av7110_ca.c
CA_SEND_MSG
drivers/media/dvb/bt8xx/dst_ca.c
drivers/media/dvb/dvb-core/dvb_ca_en50221.c
drivers/media/dvb/firewire/firedtv-ci.c
drivers/media/dvb/ttpci/av7110_ca.c
CA_SET_DESCR
drivers/media/dvb/bt8xx/dst_ca.c
drivers/media/dvb/ttpci/av7110_ca.c
CA_SET_PID
drivers/media/dvb/bt8xx/dst_ca.c
DMX_START
drivers/media/dvb/dvb-core/dmxdev.c
DMX_STOP
drivers/media/dvb/dvb-core/dmxdev.c
DMX_SET_FILTER
drivers/media/dvb/dvb-core/dmxdev.c
DMX_SET_PES_FILTER
drivers/media/dvb/dvb-core/dmxdev.c
DMX_SET_BUFFER_SIZE
drivers/media/dvb/dvb-core/dmxdev.c
DMX_GET_PES_PIDS
drivers/media/dvb/dvb-core/dmxdev.c
DMX_GET_CAPS
drivers/media/dvb/dvb-core/dmxdev.c
DMX_SET_SOURCE
drivers/media/dvb/dvb-core/dmxdev.c
DMX_GET_STC
drivers/media/dvb/dvb-core/dmxdev.c
DMX_ADD_PID
drivers/media/dvb/dvb-core/dmxdev.c
DMX_REMOVE_PID
drivers/media/dvb/dvb-core/dmxdev.c
FE_SET_PROPERTY
drivers/media/dvb/dvb-core/dvb_frontend.c
FE_GET_PROPERTY
drivers/media/dvb/dvb-core/dvb_frontend.c
FE_GET_INFO
drivers/media/dvb/dvb-core/dvb_frontend.c
FE_DISEQC_RESET_OVERLOAD
drivers/media/dvb/dvb-core/dvb_frontend.c
FE_DISEQC_SEND_MASTER_CMD
drivers/media/dvb/dvb-core/dvb_frontend.c
FE_DISEQC_RECV_SLAVE_REPLY
drivers/media/dvb/dvb-core/dvb_frontend.c
FE_DISEQC_SEND_BURST
drivers/media/dvb/dvb-core/dvb_frontend.c
FE_SET_TONE
drivers/media/dvb/dvb-core/dvb_frontend.c
FE_SET_VOLTAGE
drivers/media/dvb/dvb-core/dvb_frontend.c
FE_ENABLE_HIGH_LNB_VOLTAGE
drivers/media/dvb/dvb-core/dvb_frontend.c
FE_READ_STATUS
drivers/media/dvb/dvb-core/dvb_frontend.c
drivers/media/dvb/frontends/si21xx.c
drivers/media/dvb/frontends/stv0288.c
drivers/media/dvb/frontends/stv0299.c
FE_READ_BER
drivers/media/dvb/dvb-core/dvb_frontend.c
FE_READ_SIGNAL_STRENGTH
drivers/media/dvb/dvb-core/dvb_frontend.c
drivers/media/dvb/frontends/stv0299.c
FE_READ_SNR
drivers/media/dvb/dvb-core/dvb_frontend.c
FE_READ_UNCORRECTED_BLOCKS
drivers/media/dvb/dvb-core/dvb_frontend.c
FE_SET_FRONTEND
drivers/media/dvb/dvb-core/dvb_frontend.c
drivers/media/dvb/frontends/si21xx.c
drivers/media/dvb/frontends/stv0288.c
drivers/media/dvb/frontends/stv0299.c
drivers/media/video/cx23885/cx23885-dvb.c
FE_GET_FRONTEND
drivers/media/dvb/dvb-core/dvb_frontend.c
FE_SET_FRONTEND_TUNE_MODE
drivers/media/dvb/dvb-core/dvb_frontend.c
FE_GET_EVENT
drivers/media/dvb/dvb-core/dvb_frontend.c
FE_DISHNETWORK_SEND_LEGACY_CMD
drivers/media/dvb/dvb-core/dvb_frontend.c
NET_ADD_IF
drivers/media/dvb/dvb-core/dvb_net.c
NET_REMOVE_IF
drivers/media/dvb/dvb-core/dvb_net.c
NET_GET_IF
drivers/media/dvb/dvb-core/dvb_net.c
__NET_ADD_IF_OLD
drivers/media/dvb/dvb-core/dvb_net.c
drivers/media/dvb/ttpci/av7110.c
OSD_GET_CAPABILITY
drivers/media/dvb/ttpci/av7110.c
VIDEO_STOP
drivers/media/dvb/ttpci/av7110_av.c
drivers/media/video/ivtv/ivtv-ioctl.c
VIDEO_PLAY
drivers/media/dvb/ttpci/av7110_av.c
drivers/media/video/ivtv/ivtv-ioctl.c
VIDEO_FREEZE
drivers/media/dvb/ttpci/av7110.c
drivers/media/dvb/ttpci/av7110_av.c
drivers/media/video/ivtv/ivtv-ioctl.c
VIDEO_CONTINUE
drivers/media/dvb/ttpci/av7110_av.c
drivers/media/video/ivtv/ivtv-ioctl.c
VIDEO_SELECT_SOURCE
drivers/media/dvb/ttpci/av7110_av.c
drivers/media/video/ivtv/ivtv-ioctl.c
VIDEO_SET_BLANK
drivers/media/dvb/ttpci/av7110_av.c
VIDEO_GET_STATUS
drivers/media/dvb/ttpci/av7110_av.c
VIDEO_GET_EVENT
drivers/media/dvb/ttpci/av7110_av.c
drivers/media/video/ivtv/ivtv-ioctl.c
VIDEO_SET_DISPLAY_FORMAT
drivers/media/dvb/ttpci/av7110_av.c
VIDEO_STILLPICTURE
drivers/media/dvb/ttpci/av7110_av.c
VIDEO_FAST_FORWARD
drivers/media/dvb/ttpci/av7110_av.c
VIDEO_SLOWMOTION
drivers/media/dvb/ttpci/av7110_av.c
VIDEO_GET_CAPABILITIES
drivers/media/dvb/ttpci/av7110_av.c
VIDEO_CLEAR_BUFFER
drivers/media/dvb/ttpci/av7110_av.c
VIDEO_SET_ID
VIDEO_SET_STREAMTYPE
drivers/media/dvb/ttpci/av7110_av.c
VIDEO_SET_FORMAT
drivers/media/dvb/ttpci/av7110_av.c
VIDEO_SET_SYSTEM
VIDEO_SET_HIGHLIGHT
VIDEO_SET_SPU
VIDEO_SET_SPU_PALETTE
VIDEO_GET_NAVI
VIDEO_SET_ATTRIBUTES
VIDEO_GET_SIZE
drivers/media/dvb/ttpci/av7110_av.c
VIDEO_GET_FRAME_RATE
VIDEO_GET_PTS
drivers/media/video/ivtv/ivtv-ioctl.c
VIDEO_GET_FRAME_COUNT
drivers/media/video/ivtv/ivtv-ioctl.c
VIDEO_COMMAND
drivers/media/dvb/ttpci/av7110_hw.h
drivers/media/video/ivtv/ivtv-ioctl.c
VIDEO_TRY_COMMAND
drivers/media/video/ivtv/ivtv-ioctl.c

Basically:

- all AUDIO*, OSD* and VIDEO* are used only by av7110 and ivtv.

- The CA* ioctls are used by core (although several are only implemented inside a few drivers);

- All the DMX*, FE*, NET* ioctl's are implemented inside the core.

I'll write a RFC.

Quoted 42 lines

Regards,

Hans

Quoted 27 lines

Mauro Carvalho Chehab (13):
[media] DocBook: Add the other DVB API header files
[media] DocBook/audio.xml: match section ID's with the reference links [media] DocBook/audio.xml: synchronize attribute changes [media] DocBook: Document AUDIO_CONTINUE ioctl
[media] dvb/audio.h: Remove definition for AUDIO_GET_PTS [media] Docbook/ca.xml: match section ID's with the reference links [media] DocBook/ca.xml: Describe structure ca_pid
[media] DocBook/demux.xml: Fix section references with dmx.h.xml [media] DocBook/demux.xml: Add the remaining data structures to the API spec [media] DocBook/net.xml: Synchronize Network data structure [media] DocBook/Makefile: Remove osd.h header
[media] DocBook/video.xml: Fix section references with video.h.xml [media] DocBook/video.xml: Document the remaining data structures

 Documentation/DocBook/media/Makefile       |   81 ++++++++++-
 Documentation/DocBook/media/dvb/audio.xml  |  176 +++++++++++++++--------
 Documentation/DocBook/media/dvb/ca.xml     |  106 ++++++++------
 Documentation/DocBook/media/dvb/demux.xml  |  206 +++++++++++++++-----------
 Documentation/DocBook/media/dvb/dvbapi.xml |   20 +++
 Documentation/DocBook/media/dvb/intro.xml  |   19 +++-
 Documentation/DocBook/media/dvb/net.xml    |   17 ++
 Documentation/DocBook/media/dvb/video.xml  |  220 +++++++++++++++++-----------
 include/linux/dvb/audio.h                  |   14 +--
 9 files changed, 564 insertions(+), 295 deletions(-)
Quoted 6 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
Quoted 4 lines · Mauro Carvalho Chehab

- all AUDIO*, OSD* and VIDEO* are used only by av7110 and ivtv.

- The CA* ioctls are used by core (although several are only implemented inside a few drivers);

All (or most) of these ioctls (except OSD, which AFAIR has been deprecated since v3) are used by out-of-tree drivers. av7110 and ivtv just happen to be the only in-tree drivers supporting audio and video decoders.

Regards,
Andreas

#4 lore raw

Hi Andreas,

Em 09-06-2011 09:51, Andreas Oberritter escreveu:

Quoted 10 lines · Mauro Carvalho Chehab
Quoted 4 lines

- all AUDIO*, OSD* and VIDEO* are used only by av7110 and ivtv.

- The CA* ioctls are used by core (although several are only implemented inside a few drivers);

All (or most) of these ioctls (except OSD, which AFAIR has been deprecated since v3) are used by out-of-tree drivers. av7110 and ivtv just happen to be the only in-tree drivers supporting audio and video decoders.

We should not care with drivers that will never be upstream.

Those out-of-tree drivers are there just because they're still being prepared for submission, or because the driver maintainers decided that they won't submit upstream?

In the first case, I think we should try to merge those drivers first, before taking any decision about any API removal/change. So, maybe we can postpone any API removal decision to kernel 3.2, in order to merge those drivers upstream.

Thanks,
Mauro.

#5 lore raw

RFC] Media kernelspace-userspace API specs (V4L/DVB/IR) - Was: Re: [PATCH 00/13] Reduce the gap between DVBv5 API and the specs

In reply to Mauro Carvalho Chehab

Hi,

Em 08-06-2011 17:23, Mauro Carvalho Chehab escreveu:

Quoted 53 lines

There's a huge gap between the DVB specs and the current implementation. This were caused by years of changes that happened at the code but no updates to the specs were done.

This patch series tries to reduce this gap.

Basically, the headers at include/linux/dvb were included at the API. The Makefile scripting auto-generate references for structs, typedefs and ioctls. With this, it is now easy to identify when something is missing.

After adding such logic, I've manually synchronized the specs with the header file and updated the data structures.

The work is not complete yet: there are still several ioctl's not documented at the specs:

Error: no ID for constraint linkend: AUDIO_BILINGUAL_CHANNEL_SELECT.
Error: no ID for constraint linkend: CA_RESET.
Error: no ID for constraint linkend: CA_GET_CAP.
Error: no ID for constraint linkend: CA_GET_SLOT_INFO.
Error: no ID for constraint linkend: CA_GET_DESCR_INFO.
Error: no ID for constraint linkend: CA_GET_MSG.
Error: no ID for constraint linkend: CA_SEND_MSG.
Error: no ID for constraint linkend: CA_SET_DESCR.
Error: no ID for constraint linkend: CA_SET_PID.
Error: no ID for constraint linkend: DMX_GET_PES_PIDS.
Error: no ID for constraint linkend: DMX_GET_CAPS.
Error: no ID for constraint linkend: DMX_SET_SOURCE.
Error: no ID for constraint linkend: DMX_ADD_PID.
Error: no ID for constraint linkend: DMX_REMOVE_PID.
Error: no ID for constraint linkend: NET_ADD_IF.
Error: no ID for constraint linkend: NET_REMOVE_IF.
Error: no ID for constraint linkend: NET_GET_IF.
Error: no ID for constraint linkend: VIDEO_GET_SIZE.
Error: no ID for constraint linkend: VIDEO_GET_FRAME_RATE.
Error: no ID for constraint linkend: VIDEO_GET_PTS.
Error: no ID for constraint linkend: VIDEO_GET_FRAME_COUNT.
Error: no ID for constraint linkend: VIDEO_COMMAND.
Error: no ID for constraint linkend: VIDEO_TRY_COMMAND.

I also opted to not add the osd.h header into the DocBook, as it seemed odd on my eyes, and it is used only by one legacy hardware.

While here, I noticed that one audio ioctl is not used anyware (AUDIO_GET_PTS). There is just the ioctl definition and that's it. I just removed this definition, as removing it won't cause any regression, as no in-kernel driver or dvb-core uses it.

Btw, there are several ioctl's and correponding data structures that are used on just one or two old drivers. I think we should consider to deprecate those old stuff.

Quoted 14 lines

Mauro Carvalho Chehab (13):
[media] DocBook: Add the other DVB API header files
[media] DocBook/audio.xml: match section ID's with the reference links [media] DocBook/audio.xml: synchronize attribute changes [media] DocBook: Document AUDIO_CONTINUE ioctl
[media] dvb/audio.h: Remove definition for AUDIO_GET_PTS [media] Docbook/ca.xml: match section ID's with the reference links [media] DocBook/ca.xml: Describe structure ca_pid
[media] DocBook/demux.xml: Fix section references with dmx.h.xml [media] DocBook/demux.xml: Add the remaining data structures to the API spec [media] DocBook/net.xml: Synchronize Network data structure [media] DocBook/Makefile: Remove osd.h header
[media] DocBook/video.xml: Fix section references with video.h.xml [media] DocBook/video.xml: Document the remaining data structures

1) INTRODUTION
===========

Over the last few days, I did a big effort to identify the gaps between the code implementation and the media documentation.

As most of you know, our API's are documented since some time inside the Linux Kernel tree. However, unfortunately, developers sometimes add improvements at the drivers without taking enough care of documenting the changes at the API specs.

The gap at V4L side were solved several years ago, when we've added the V4L DocBook specs inside the mercurial tree and added some Makefile and DocBook "magic" to allow discovering that some information were missing[1]. Of course, the logic is not perfect, as it doesn't validate the quality of the documentation.

For DVB, the situation were worse: while in Kernel, all specs are at DocBook format (and, thankfully, V4L were already using DocBook), DVB were using latex format. Worse than that, except for the original writers, the other DVB developers didn't have the habit to update. So, while the DVB API were in version 3, the specs were in version 1.

A few years ago, I've ported the DVB docs to DocBook format, migrated the V4L DocBook format to the one used inside the Kernel, merged both and added some documentation about IR. The end result is the Media API DocBook:

http://linuxtv.org/downloads/v4l-dvb-apis/

Due to the differences between DVB and V4L formats, I broke it into two
divisions: one for V4L and one for DVB. Later, the Remote Controller and the Media Controller divisions were added.

Yet, the DVB documentation were still at version 1. With ISDB-T support, the specs for version 5 were added. A few other updates were added there, from time to time, but no major efforts of really updating it to v5 were done.

Well, Over the last few days, I did a big effort to identify the gaps between the code implementation and the media documentation, at the DVB side.

-
[1] Basically, the Makefile auto-generate indexes for the data types and ioctl's. Cross-references between the header files and the specs warrants that everything is documented, otherwise, an error is generated.

2) CURRENT STATUS
==============

After the last day patches, the end result of is that:

- API gaps on both V4L and DVB parts are now shown;

- The V4L gaps were already fixed;

- include/linux/osd.h: the API is not documented. I decided to
keep it outside the documentation, as it is being used only by a legacy driver, and the API violates several Linux CodingStyle rules. I suspect that we can just deprecate this API, instead of propagating its usage.

- 100% of the DVB data structures are now documented;

- there are 22 DVB ioctl's not documented at the API (excluding the osd ones), from the total amount of 111 ioctl's. So, about 20% of the ioctl's are not documented yet.

- the API specs contain several IOCTL's and data structures
that are used only by one or two old drivers, without any recent driver needing to use them;

- there are some overlap area between DVB Video/Audio API's and V4L API;

- there are some overlap area between DVB Audio API and ALSA API;

- there are still some gaps at the Remote Controller API. Basically, the sysfs nodes are not documented yet;

- currently, there's no Makefile "magic" to double check discrepancies at the Remote Controller and at the Media Controller API's.

3) PROPOSALS
=========

A badly documented API is something very bad, as:

- userspace developers need to figure out how the driver and core works in order to write their code. Worse than that, if a driver has a bug and is doing something wrong, the userspace developer may assume that the broken behavior is the correct one. So, a latter fix at the driver will break the userspace application;

- kernelspace developers may have different opinions about how to implement some feature, leading into different, incompatible implementations.

So, we need to be sure that the API is properly documenting what's the expected behavior, otherwise the specs are useless.

I got some interesting statistics at the annex part of this RFC. Based on that, I propose to:

a) Put a notice at the specs that the AUDIO, VIDEO and OSD ioctl's are deprecated and shouldn't be used on newer drivers. We don't need to remove them from the drivers, but, at least on ivtv, we should expand the V4L/ALSA support if needed, in order to implement what's missed there.

b) Better analyse the following CA ioctls:

	CA_GET_DESCR_INFO, CA_SET_DESCR (used on bt8xx/dst_ca and av7110_ca);
	CA_SET_PID (used only on bt8xx/dst_ca.c).

As they're implemented only inside two drivers. Maybe they should also be supported by the dvb core (dvb_ca_en50221.c). None of the above are documented.

c) Document the ioctl's bellow, as they are used inside the core:
CA_RESET
CA_GET_CAP
CA_GET_SLOT_INFO
CA_GET_MSG
CA_SEND_MSG
DMX_GET_PES_PIDS
DMX_GET_CAPS
DMX_SET_SOURCE
DMX_ADD_PID
DMX_REMOVE_PID
NET_ADD_IF
NET_REMOVE_IF
NET_GET_IF

d) Marking the removal of the legacy NET ioctls (__NET_ADD_IF_OLD, __NET_GET_IF_OLD) at Documentation/feature-removal-schedule.txt for its removal on 3.2.

e) Document the Remote Controller sysfs nodes;

f) Add some logic to compare the API's implemented for RC and Media Controller with the *.h files.

Comments?

---

ANNEX) SOME STATISTICS
======================

a) The complete list of ioctl's can be obtained by this small shell script:

$ perl -ne 'print "$1\n" if /\#define\s+([^\s]+)\s+_IO/' include/linux/dvb/*

b) Combining it with git grep, it is clear that there are only 41 ioctl's that are implemented inside the DVB core:

$ for i in $(perl -ne 'print "$1\n" if /\#define\s+([^\s]+)\s+_IO/' include/linux/dvb/*); do if [ "$(git grep -l $i drivers/media/dvb/dvb-core/)" != "" ]; then echo $i; fi ; done |wc -l
41

Those ioctl's are:

$ for i in $(perl -ne 'print "$1\n" if /\#define\s+([^\s]+)\s+_IO/' include/linux/dvb/*); do if [ "$(git grep -l $i drivers/media/dvb/dvb-core/)" != "" ]; then echo $i; fi ; done
CA_RESET
CA_GET_CAP
CA_GET_SLOT_INFO
CA_GET_MSG
CA_SEND_MSG
DMX_START
DMX_STOP
DMX_SET_FILTER
DMX_SET_PES_FILTER
DMX_SET_BUFFER_SIZE
DMX_GET_PES_PIDS
DMX_GET_CAPS
DMX_SET_SOURCE
DMX_GET_STC
DMX_ADD_PID
DMX_REMOVE_PID
FE_SET_PROPERTY
FE_GET_PROPERTY
FE_GET_INFO
FE_DISEQC_RESET_OVERLOAD
FE_DISEQC_SEND_MASTER_CMD
FE_DISEQC_RECV_SLAVE_REPLY
FE_DISEQC_SEND_BURST
FE_SET_TONE
FE_SET_VOLTAGE
FE_ENABLE_HIGH_LNB_VOLTAGE
FE_READ_STATUS
FE_READ_BER
FE_READ_SIGNAL_STRENGTH
FE_READ_SNR
FE_READ_UNCORRECTED_BLOCKS
FE_SET_FRONTEND
FE_GET_FRONTEND
FE_SET_FRONTEND_TUNE_MODE
FE_GET_EVENT
FE_DISHNETWORK_SEND_LEGACY_CMD
NET_ADD_IF
NET_REMOVE_IF
NET_GET_IF
__NET_ADD_IF_OLD
__NET_GET_IF_OLD

The last two ones are obsolete ioctl's.

c) If we do a grep -v removing the above from the list of the ioctls, we have the ioctl's that are implemented only inside the drivers:

AUDIO_STOP
AUDIO_PLAY
AUDIO_PAUSE
AUDIO_CONTINUE
AUDIO_SELECT_SOURCE
AUDIO_SET_MUTE
AUDIO_SET_AV_SYNC
AUDIO_SET_BYPASS_MODE
AUDIO_CLEAR_BUFFER
AUDIO_SET_ID
AUDIO_SET_MIXER
AUDIO_SET_STREAMTYPE
AUDIO_SET_EXT_ID
AUDIO_SET_ATTRIBUTES
AUDIO_SET_KARAOKE
AUDIO_BILINGUAL_CHANNEL_SELECT
AUDIO_STOP
AUDIO_PLAY
AUDIO_PAUSE
AUDIO_CONTINUE
AUDIO_SELECT_SOURCE
AUDIO_SET_MUTE
AUDIO_SET_AV_SYNC
AUDIO_SET_BYPASS_MODE
AUDIO_CHANNEL_SELECT
AUDIO_GET_STATUS
AUDIO_GET_CAPABILITIES
AUDIO_CLEAR_BUFFER
AUDIO_SET_ID
AUDIO_SET_MIXER
AUDIO_SET_STREAMTYPE
AUDIO_SET_EXT_ID
AUDIO_SET_ATTRIBUTES
AUDIO_SET_KARAOKE
AUDIO_BILINGUAL_CHANNEL_SELECT
CA_GET_DESCR_INFO
CA_SET_DESCR
CA_SET_PID
OSD_SEND_CMD
OSD_GET_CAPABILITY
VIDEO_STOP
VIDEO_PLAY
VIDEO_FREEZE
VIDEO_CONTINUE
VIDEO_SELECT_SOURCE
VIDEO_SET_BLANK
VIDEO_GET_STATUS
VIDEO_GET_EVENT
VIDEO_SET_DISPLAY_FORMAT
VIDEO_STILLPICTURE
VIDEO_FAST_FORWARD
VIDEO_SLOWMOTION
VIDEO_GET_CAPABILITIES
VIDEO_CLEAR_BUFFER
VIDEO_SET_ID
VIDEO_SET_STREAMTYPE
VIDEO_SET_FORMAT
VIDEO_SET_SYSTEM
VIDEO_SET_HIGHLIGHT
VIDEO_SET_SPU
VIDEO_SET_SPU_PALETTE
VIDEO_GET_NAVI
VIDEO_SET_ATTRIBUTES
VIDEO_GET_SIZE
VIDEO_GET_FRAME_RATE
VIDEO_GET_PTS
VIDEO_GET_FRAME_COUNT
VIDEO_COMMAND
VIDEO_TRY_COMMAND

d) The API usage inside drivers/media and drivers/staging is given by:

$ for i in $(perl -ne 'print "$1\n" if /\#define\s+([^\s]+)\s+_IO/' include/linux/dvb/*); do echo $i; git grep -l $i drivers/media/ drivers/staging/ ; done
AUDIO_STOP
drivers/media/dvb/ttpci/av7110_av.c
AUDIO_PLAY
drivers/media/dvb/ttpci/av7110_av.c
AUDIO_PAUSE
drivers/media/dvb/ttpci/av7110_av.c
AUDIO_CONTINUE
drivers/media/dvb/ttpci/av7110_av.c
AUDIO_SELECT_SOURCE
drivers/media/dvb/ttpci/av7110_av.c
AUDIO_SET_MUTE
drivers/media/dvb/ttpci/av7110_av.c
drivers/media/video/ivtv/ivtv-ioctl.c
AUDIO_SET_AV_SYNC
drivers/media/dvb/ttpci/av7110_av.c
AUDIO_SET_BYPASS_MODE
drivers/media/dvb/ttpci/av7110_av.c
AUDIO_CHANNEL_SELECT
drivers/media/dvb/ttpci/av7110_av.c
drivers/media/video/ivtv/ivtv-ioctl.c
AUDIO_GET_STATUS
drivers/media/dvb/ttpci/av7110_av.c
AUDIO_GET_CAPABILITIES
drivers/media/dvb/ttpci/av7110_av.c
AUDIO_CLEAR_BUFFER
drivers/media/dvb/ttpci/av7110_av.c
AUDIO_SET_ID
drivers/media/dvb/ttpci/av7110_av.c
AUDIO_SET_MIXER
drivers/media/dvb/ttpci/av7110_av.c
AUDIO_SET_STREAMTYPE
drivers/media/dvb/ttpci/av7110_av.c
AUDIO_SET_EXT_ID
AUDIO_SET_ATTRIBUTES
AUDIO_SET_KARAOKE
AUDIO_BILINGUAL_CHANNEL_SELECT
drivers/media/video/ivtv/ivtv-ioctl.c
AUDIO_STOP
drivers/media/dvb/ttpci/av7110_av.c
AUDIO_PLAY
drivers/media/dvb/ttpci/av7110_av.c
AUDIO_PAUSE
drivers/media/dvb/ttpci/av7110_av.c
AUDIO_CONTINUE
drivers/media/dvb/ttpci/av7110_av.c
AUDIO_SELECT_SOURCE
drivers/media/dvb/ttpci/av7110_av.c
AUDIO_SET_MUTE
drivers/media/dvb/ttpci/av7110_av.c
drivers/media/video/ivtv/ivtv-ioctl.c
AUDIO_SET_AV_SYNC
drivers/media/dvb/ttpci/av7110_av.c
AUDIO_SET_BYPASS_MODE
drivers/media/dvb/ttpci/av7110_av.c
AUDIO_CHANNEL_SELECT
drivers/media/dvb/ttpci/av7110_av.c
drivers/media/video/ivtv/ivtv-ioctl.c
AUDIO_GET_STATUS
drivers/media/dvb/ttpci/av7110_av.c
AUDIO_GET_CAPABILITIES
drivers/media/dvb/ttpci/av7110_av.c
AUDIO_CLEAR_BUFFER
drivers/media/dvb/ttpci/av7110_av.c
AUDIO_SET_ID
drivers/media/dvb/ttpci/av7110_av.c
AUDIO_SET_MIXER
drivers/media/dvb/ttpci/av7110_av.c
AUDIO_SET_STREAMTYPE
drivers/media/dvb/ttpci/av7110_av.c
AUDIO_SET_EXT_ID
AUDIO_SET_ATTRIBUTES
AUDIO_SET_KARAOKE
AUDIO_BILINGUAL_CHANNEL_SELECT
drivers/media/video/ivtv/ivtv-ioctl.c
CA_RESET
drivers/media/dvb/bt8xx/dst_ca.c
drivers/media/dvb/dvb-core/dvb_ca_en50221.c
drivers/media/dvb/firewire/firedtv-avc.c
drivers/media/dvb/firewire/firedtv-ci.c
drivers/media/dvb/ttpci/av7110_ca.c
CA_GET_CAP
drivers/media/dvb/bt8xx/dst_ca.c
drivers/media/dvb/dvb-core/dvb_ca_en50221.c
drivers/media/dvb/firewire/firedtv-ci.c
drivers/media/dvb/ttpci/av7110_ca.c
CA_GET_SLOT_INFO
drivers/media/dvb/bt8xx/dst_ca.c
drivers/media/dvb/dvb-core/dvb_ca_en50221.c
drivers/media/dvb/firewire/firedtv-ci.c
drivers/media/dvb/ttpci/av7110_ca.c
CA_GET_DESCR_INFO
drivers/media/dvb/bt8xx/dst_ca.c
drivers/media/dvb/ttpci/av7110_ca.c
CA_GET_MSG
drivers/media/dvb/bt8xx/dst_ca.c
drivers/media/dvb/dvb-core/dvb_ca_en50221.c
drivers/media/dvb/firewire/firedtv-ci.c
drivers/media/dvb/ttpci/av7110_ca.c
CA_SEND_MSG
drivers/media/dvb/bt8xx/dst_ca.c
drivers/media/dvb/dvb-core/dvb_ca_en50221.c
drivers/media/dvb/firewire/firedtv-ci.c
drivers/media/dvb/ttpci/av7110_ca.c
CA_SET_DESCR
drivers/media/dvb/bt8xx/dst_ca.c
drivers/media/dvb/ttpci/av7110_ca.c
CA_SET_PID
drivers/media/dvb/bt8xx/dst_ca.c
DMX_START
drivers/media/dvb/dvb-core/dmxdev.c
DMX_STOP
drivers/media/dvb/dvb-core/dmxdev.c
DMX_SET_FILTER
drivers/media/dvb/dvb-core/dmxdev.c
DMX_SET_PES_FILTER
drivers/media/dvb/dvb-core/dmxdev.c
DMX_SET_BUFFER_SIZE
drivers/media/dvb/dvb-core/dmxdev.c
DMX_GET_PES_PIDS
drivers/media/dvb/dvb-core/dmxdev.c
DMX_GET_CAPS
drivers/media/dvb/dvb-core/dmxdev.c
DMX_SET_SOURCE
drivers/media/dvb/dvb-core/dmxdev.c
DMX_GET_STC
drivers/media/dvb/dvb-core/dmxdev.c
DMX_ADD_PID
drivers/media/dvb/dvb-core/dmxdev.c
DMX_REMOVE_PID
drivers/media/dvb/dvb-core/dmxdev.c
FE_SET_PROPERTY
drivers/media/dvb/dvb-core/dvb_frontend.c
FE_GET_PROPERTY
drivers/media/dvb/dvb-core/dvb_frontend.c
FE_GET_INFO
drivers/media/dvb/dvb-core/dvb_frontend.c
FE_DISEQC_RESET_OVERLOAD
drivers/media/dvb/dvb-core/dvb_frontend.c
FE_DISEQC_SEND_MASTER_CMD
drivers/media/dvb/dvb-core/dvb_frontend.c
FE_DISEQC_RECV_SLAVE_REPLY
drivers/media/dvb/dvb-core/dvb_frontend.c
FE_DISEQC_SEND_BURST
drivers/media/dvb/dvb-core/dvb_frontend.c
FE_SET_TONE
drivers/media/dvb/dvb-core/dvb_frontend.c
FE_SET_VOLTAGE
drivers/media/dvb/dvb-core/dvb_frontend.c
FE_ENABLE_HIGH_LNB_VOLTAGE
drivers/media/dvb/dvb-core/dvb_frontend.c
FE_READ_STATUS
drivers/media/dvb/dvb-core/dvb_frontend.c
drivers/media/dvb/frontends/si21xx.c
drivers/media/dvb/frontends/stv0288.c
drivers/media/dvb/frontends/stv0299.c
FE_READ_BER
drivers/media/dvb/dvb-core/dvb_frontend.c
FE_READ_SIGNAL_STRENGTH
drivers/media/dvb/dvb-core/dvb_frontend.c
drivers/media/dvb/frontends/stv0299.c
FE_READ_SNR
drivers/media/dvb/dvb-core/dvb_frontend.c
FE_READ_UNCORRECTED_BLOCKS
drivers/media/dvb/dvb-core/dvb_frontend.c
FE_SET_FRONTEND
drivers/media/dvb/dvb-core/dvb_frontend.c
drivers/media/dvb/frontends/si21xx.c
drivers/media/dvb/frontends/stv0288.c
drivers/media/dvb/frontends/stv0299.c
drivers/media/video/cx23885/cx23885-dvb.c
FE_GET_FRONTEND
drivers/media/dvb/dvb-core/dvb_frontend.c
FE_SET_FRONTEND_TUNE_MODE
drivers/media/dvb/dvb-core/dvb_frontend.c
FE_GET_EVENT
drivers/media/dvb/dvb-core/dvb_frontend.c
FE_DISHNETWORK_SEND_LEGACY_CMD
drivers/media/dvb/dvb-core/dvb_frontend.c
NET_ADD_IF
drivers/media/dvb/dvb-core/dvb_net.c
NET_REMOVE_IF
drivers/media/dvb/dvb-core/dvb_net.c
NET_GET_IF
drivers/media/dvb/dvb-core/dvb_net.c
__NET_ADD_IF_OLD
drivers/media/dvb/dvb-core/dvb_net.c
drivers/media/dvb/ttpci/av7110.c
OSD_GET_CAPABILITY
drivers/media/dvb/ttpci/av7110.c
VIDEO_STOP
drivers/media/dvb/ttpci/av7110_av.c
drivers/media/video/ivtv/ivtv-ioctl.c
VIDEO_PLAY
drivers/media/dvb/ttpci/av7110_av.c
drivers/media/video/ivtv/ivtv-ioctl.c
VIDEO_FREEZE
drivers/media/dvb/ttpci/av7110.c
drivers/media/dvb/ttpci/av7110_av.c
drivers/media/video/ivtv/ivtv-ioctl.c
VIDEO_CONTINUE
drivers/media/dvb/ttpci/av7110_av.c
drivers/media/video/ivtv/ivtv-ioctl.c
VIDEO_SELECT_SOURCE
drivers/media/dvb/ttpci/av7110_av.c
drivers/media/video/ivtv/ivtv-ioctl.c
VIDEO_SET_BLANK
drivers/media/dvb/ttpci/av7110_av.c
VIDEO_GET_STATUS
drivers/media/dvb/ttpci/av7110_av.c
VIDEO_GET_EVENT
drivers/media/dvb/ttpci/av7110_av.c
drivers/media/video/ivtv/ivtv-ioctl.c
VIDEO_SET_DISPLAY_FORMAT
drivers/media/dvb/ttpci/av7110_av.c
VIDEO_STILLPICTURE
drivers/media/dvb/ttpci/av7110_av.c
VIDEO_FAST_FORWARD
drivers/media/dvb/ttpci/av7110_av.c
VIDEO_SLOWMOTION
drivers/media/dvb/ttpci/av7110_av.c
VIDEO_GET_CAPABILITIES
drivers/media/dvb/ttpci/av7110_av.c
VIDEO_CLEAR_BUFFER
drivers/media/dvb/ttpci/av7110_av.c
VIDEO_SET_ID
VIDEO_SET_STREAMTYPE
drivers/media/dvb/ttpci/av7110_av.c
VIDEO_SET_FORMAT
drivers/media/dvb/ttpci/av7110_av.c
VIDEO_SET_SYSTEM
VIDEO_SET_HIGHLIGHT
VIDEO_SET_SPU
VIDEO_SET_SPU_PALETTE
VIDEO_GET_NAVI
VIDEO_SET_ATTRIBUTES
VIDEO_GET_SIZE
drivers/media/dvb/ttpci/av7110_av.c
VIDEO_GET_FRAME_RATE
VIDEO_GET_PTS
drivers/media/video/ivtv/ivtv-ioctl.c
VIDEO_GET_FRAME_COUNT
drivers/media/video/ivtv/ivtv-ioctl.c
VIDEO_COMMAND
drivers/media/dvb/ttpci/av7110_hw.h
drivers/media/video/ivtv/ivtv-ioctl.c
VIDEO_TRY_COMMAND
drivers/media/video/ivtv/ivtv-ioctl.c
#6 lore raw

Re: RFC] Media kernelspace-userspace API specs (V4L/DVB/IR) - Was: Re: [PATCH 00/13] Reduce the gap between DVBv5 API and the specs

Quoted 5 lines · On Thursday, June 09, 2011 03:20:43 Mauro Carvalho Chehab wrote:

2) CURRENT STATUS
==============

After the last day patches, the end result of is that:

Quoted 8 lines

- API gaps on both V4L and DVB parts are now shown;

- The V4L gaps were already fixed;

- include/linux/osd.h: the API is not documented. I decided to
keep it outside the documentation, as it is being used only by a legacy driver, and the API violates several Linux CodingStyle rules. I suspect that we can just deprecate this API, instead of propagating its usage.

Agreed.

Quoted 1 line

- 100% of the DVB data structures are now documented;

Great!

Quoted 35 lines

- there are 22 DVB ioctl's not documented at the API (excluding the osd ones), from the total amount of 111 ioctl's. So, about 20% of the ioctl's are not documented yet.

- the API specs contain several IOCTL's and data structures
that are used only by one or two old drivers, without any recent driver needing to use them;

- there are some overlap area between DVB Video/Audio API's and V4L API;

- there are some overlap area between DVB Audio API and ALSA API;

- there are still some gaps at the Remote Controller API. Basically, the sysfs nodes are not documented yet;

- currently, there's no Makefile "magic" to double check discrepancies at the Remote Controller and at the Media Controller API's.

3) PROPOSALS
=========

A badly documented API is something very bad, as:

- userspace developers need to figure out how the driver and core works in order to write their code. Worse than that, if a driver has a bug and is doing something wrong, the userspace developer may assume that the broken behavior is the correct one. So, a latter fix at the driver will break the userspace application;

- kernelspace developers may have different opinions about how to implement some feature, leading into different, incompatible implementations.

So, we need to be sure that the API is properly documenting what's the expected behavior, otherwise the specs are useless.

Quoted 8 lines

I got some interesting statistics at the annex part of this RFC. Based on that, I propose to:

a) Put a notice at the specs that the AUDIO, VIDEO and OSD ioctl's are deprecated and shouldn't be used on newer drivers. We don't need to remove them from the drivers, but, at least on ivtv, we should expand the V4L/ALSA support if needed, in order to implement what's missed there.

Agreed.

Quoted 1 line

d) The API usage inside drivers/media and drivers/staging is given by:

I'll comment on those ioctls used by ivtv:

Quoted 3 lines

AUDIO_SET_MUTE
drivers/media/dvb/ttpci/av7110_av.c
drivers/media/video/ivtv/ivtv-ioctl.c

Used to mute the audio when playing back an mpeg stream.

We can use the AUDIO_MUTE control for this. This will require some work in ivtv since at the moment all video nodes share the same controls. In this case the video output node should get its own MUTE control.

Quoted 3 lines

AUDIO_CHANNEL_SELECT
drivers/media/dvb/ttpci/av7110_av.c
drivers/media/video/ivtv/ivtv-ioctl.c

How to playback normal MPEG audio: left, right, stereo, swapped.

Quoted 2 lines

AUDIO_BILINGUAL_CHANNEL_SELECT
drivers/media/video/ivtv/ivtv-ioctl.c

How to playback bilingual MPEG audio: left, right, stereo, swapped.

The decoder will automatically detect whether the source is bilingual or not and select either CHANNEL_SELECT or BILINGUAL_CHANNEL_SELECT as needed for the audio output.

I'm not sure what to do with these. There are multiple options:

- Reimplement them as menu controls.
- Add them to VIDIOC_DECODER_CMD, either as a separate command or as part of the PLAY command. I'm not enthusiastic about this since these properties can be changed while decoding is in progress. It does not really fit my idea of a 'decoder command'.
- Add support for this to VIDIOC_G/S_AUDOUT. Any decoder with audio output should have this ioctl. There is a currently unused 'mode' field in struct v4l2_audioout that might be used for this purpose.

I think either controls or using AUDOUT is the way to go. I am leaning towards controls since they will automatically appear in properly written applications and this is really a user-driven setting. And with menu controls it is easy to extend the number of options.

Quoted 5 lines

VIDEO_STOP
drivers/media/dvb/ttpci/av7110_av.c
drivers/media/video/ivtv/ivtv-ioctl.c
VIDEO_PLAY
drivers/media/dvb/ttpci/av7110_av.c

Quoted 8 lines

drivers/media/video/ivtv/ivtv-ioctl.c
VIDEO_FREEZE
drivers/media/dvb/ttpci/av7110.c
drivers/media/dvb/ttpci/av7110_av.c
drivers/media/video/ivtv/ivtv-ioctl.c
VIDEO_CONTINUE
drivers/media/dvb/ttpci/av7110_av.c
drivers/media/video/ivtv/ivtv-ioctl.c

Stop/Play/Pause/Continue MPEG decoding.

There should all be deprecated and replaced with VIDIOC_DECODER_CMD.

Quoted 3 lines

VIDEO_SELECT_SOURCE
drivers/media/dvb/ttpci/av7110_av.c
drivers/media/video/ivtv/ivtv-ioctl.c

Select passthrough mode where the input is directly linked to the output in the hardware. This really changes the topology of the device. The media controller does just that, so ivtv should implement the MC.

There are no applications that use this to my knowledge other than ivtv-ctl in v4l-utils.

Quoted 3 lines

VIDEO_GET_EVENT
drivers/media/dvb/ttpci/av7110_av.c
drivers/media/video/ivtv/ivtv-ioctl.c

Already deprecated: use the V4L event APIs for that (VIDIOC_DQEVENT et al).

Quoted 11 lines

AUDIO_SET_EXT_ID
AUDIO_SET_ATTRIBUTES
AUDIO_SET_KARAOKE
VIDEO_SET_SYSTEM
VIDEO_SET_HIGHLIGHT
VIDEO_SET_SPU
VIDEO_SET_SPU_PALETTE
VIDEO_GET_NAVI
VIDEO_SET_ATTRIBUTES
VIDEO_SET_ID
VIDEO_GET_FRAME_RATE

These are only seen in audio.h/video.h and fs/compat_ioctl.c. Remove these ioctls + associated structs?

Quoted 2 lines

VIDEO_GET_PTS
drivers/media/video/ivtv/ivtv-ioctl.c

Returns the current PTS of the decoder. Perhaps a read-only MPEG control is more suitable?

Quoted 2 lines

VIDEO_GET_FRAME_COUNT
drivers/media/video/ivtv/ivtv-ioctl.c

Returns the number of decoded frames since the decoder started. Make this a read-only MPEG control?

Quoted 5 lines

VIDEO_COMMAND
drivers/media/dvb/ttpci/av7110_hw.h
drivers/media/video/ivtv/ivtv-ioctl.c
VIDEO_TRY_COMMAND
drivers/media/video/ivtv/ivtv-ioctl.c

These to command the decoder (play/stop/pause/continue with various additional flags/attributes to facilitate fast/slow forward/backward). This should become a traditional V4L2 API: VIDIOC_(TRY_)DECODER_CMD.

So, to summarize: in order to add the decoder API to V4L2 we would need to do:

- Add two controls to select the audio output channels.
- Add two read-only controls for the PTS and frame count.
- Copy and paste the old VIDEO_(TRY_)COMMAND to VIDIOC_(TRY_)DECODER_CMD.

And ivtv needs to use the MC and implement AUDIO_MUTE for output video nodes.

Comments? If not, then I'll see if I can work on an RFC for this next week. It's less work than I expected.

Regards,

Hans

#7 lore raw

Re: RFC] Media kernelspace-userspace API specs (V4L/DVB/IR) - Was: Re: [PATCH 00/13] Reduce the gap between DVBv5 API and the specs

Quoted 12 lines
Quoted 11 lines

AUDIO_SET_EXT_ID
AUDIO_SET_ATTRIBUTES
AUDIO_SET_KARAOKE
VIDEO_SET_SYSTEM
VIDEO_SET_HIGHLIGHT
VIDEO_SET_SPU
VIDEO_SET_SPU_PALETTE
VIDEO_GET_NAVI
VIDEO_SET_ATTRIBUTES
VIDEO_SET_ID
VIDEO_GET_FRAME_RATE

Quoted 2 lines

These are only seen in audio.h/video.h and fs/compat_ioctl.c. Remove these ioctls + associated structs?

I meant of course: 'mark for removal'.

Basically all the AUDIO, VIDEO and OSD ioctls should be removed eventually as a general API: they are really a poor-man's V4L and have nothing to do with DVB.

The first step is to get ivtv converted so that av7110 is the only one still using them. ivtv will still need to have a small backwards compatibility layer, but at least there is no more need to keep these ioctls in DocBook.

Regards,

Hans

#8 lore raw

Re: RFC] Media kernelspace-userspace API specs (V4L/DVB/IR) - Was: Re: [PATCH 00/13] Reduce the gap between DVBv5 API and the specs

In reply to Hans Verkuil

Em 09-06-2011 04:08, Hans Verkuil escreveu:

Quoted 41 lines · On Thursday, June 09, 2011 03:20:43 Mauro Carvalho Chehab wrote:
Quoted 1 line

d) The API usage inside drivers/media and drivers/staging is given by:

I'll comment on those ioctls used by ivtv:

Quoted 3 lines

AUDIO_SET_MUTE
drivers/media/dvb/ttpci/av7110_av.c
drivers/media/video/ivtv/ivtv-ioctl.c

Used to mute the audio when playing back an mpeg stream.

We can use the AUDIO_MUTE control for this. This will require some work in ivtv since at the moment all video nodes share the same controls. In this case the video output node should get its own MUTE control.

Quoted 3 lines

AUDIO_CHANNEL_SELECT
drivers/media/dvb/ttpci/av7110_av.c
drivers/media/video/ivtv/ivtv-ioctl.c

How to playback normal MPEG audio: left, right, stereo, swapped.

Quoted 2 lines

AUDIO_BILINGUAL_CHANNEL_SELECT
drivers/media/video/ivtv/ivtv-ioctl.c

How to playback bilingual MPEG audio: left, right, stereo, swapped.

The decoder will automatically detect whether the source is bilingual or not and select either CHANNEL_SELECT or BILINGUAL_CHANNEL_SELECT as needed for the audio output.

I'm not sure what to do with these. There are multiple options:

- Reimplement them as menu controls.
- Add them to VIDIOC_DECODER_CMD, either as a separate command or as part of the PLAY command. I'm not enthusiastic about this since these properties can be changed while decoding is in progress. It does not really fit my idea of a 'decoder command'.
- Add support for this to VIDIOC_G/S_AUDOUT. Any decoder with audio output should have this ioctl. There is a currently unused 'mode' field in struct v4l2_audioout that might be used for this purpose.

Quoted 4 lines

I think either controls or using AUDOUT is the way to go. I am leaning towards controls since they will automatically appear in properly written applications and this is really a user-driven setting. And with menu controls it is easy to extend the number of options.

I think that using AUDOUT would be more coherent. There are two fields there that are reserved: "capability" and "mode". We can add capability flags to indicate that the audout supports channel mode changes and use the "mode" on a way similar to rxsubchans to select between the channel outputs.

Yet, MPEG AAC supports up to 48 channels and multiple languages. We may need to have a way to get the information from the hardware about what channels are available, and how they're grouped.

Quoted 14 lines
Quoted 5 lines

VIDEO_STOP
drivers/media/dvb/ttpci/av7110_av.c
drivers/media/video/ivtv/ivtv-ioctl.c
VIDEO_PLAY
drivers/media/dvb/ttpci/av7110_av.c

Quoted 8 lines

drivers/media/video/ivtv/ivtv-ioctl.c
VIDEO_FREEZE
drivers/media/dvb/ttpci/av7110.c
drivers/media/dvb/ttpci/av7110_av.c
drivers/media/video/ivtv/ivtv-ioctl.c
VIDEO_CONTINUE
drivers/media/dvb/ttpci/av7110_av.c
drivers/media/video/ivtv/ivtv-ioctl.c

Quoted 3 lines

Stop/Play/Pause/Continue MPEG decoding.

There should all be deprecated and replaced with VIDIOC_DECODER_CMD.

Another alternative would be to consider:
VIDIOC_STREAMON = VIDEO_PLAY
VIDIOC_STREAMOFF = VIDEO_STOP
And add VIDIOC_FREEZE/VIDIOC_CONTINUE.

Adding a VIDIOC_DECODER_CMD ioctl that also controls play/stop seems to be a bad idea, as we'll have some API overlap here.

Quoted 10 lines
Quoted 3 lines

VIDEO_SELECT_SOURCE
drivers/media/dvb/ttpci/av7110_av.c
drivers/media/video/ivtv/ivtv-ioctl.c

Select passthrough mode where the input is directly linked to the output in the hardware. This really changes the topology of the device. The media controller does just that, so ivtv should implement the MC.

There are no applications that use this to my knowledge other than ivtv-ctl in v4l-utils.

We don't need to use MC for that. The VIDIOC_*_AUDIOOUT already provides the elements to enumerate and select the audio output.

Quoted 5 lines
Quoted 3 lines

VIDEO_GET_EVENT
drivers/media/dvb/ttpci/av7110_av.c
drivers/media/video/ivtv/ivtv-ioctl.c

Already deprecated: use the V4L event APIs for that (VIDIOC_DQEVENT et al).

OK.

Quoted 12 lines
Quoted 11 lines

AUDIO_SET_EXT_ID
AUDIO_SET_ATTRIBUTES
AUDIO_SET_KARAOKE
VIDEO_SET_SYSTEM
VIDEO_SET_HIGHLIGHT
VIDEO_SET_SPU
VIDEO_SET_SPU_PALETTE
VIDEO_GET_NAVI
VIDEO_SET_ATTRIBUTES
VIDEO_SET_ID
VIDEO_GET_FRAME_RATE

Quoted 2 lines

These are only seen in audio.h/video.h and fs/compat_ioctl.c. Remove these ioctls + associated structs?

Yes, that sounds the right way to do it. As nobody is using it, I don't think we need to add it at the list of the Kernel features to be removed. as this is unused stuff. So, no regressions will happen.

Quoted 6 lines
Quoted 3 lines

VIDEO_GET_PTS
drivers/media/video/ivtv/ivtv-ioctl.c

Returns the current PTS of the decoder. Perhaps a read-only MPEG control is more suitable?

Yes, a MPEG control for it seems to be enough.

Quoted 5 lines
Quoted 2 lines

VIDEO_GET_FRAME_COUNT
drivers/media/video/ivtv/ivtv-ioctl.c

Returns the number of decoded frames since the decoder started. Make this a read-only MPEG control?

Yes, a MPEG control for it seems to be enough.

Quoted 9 lines
Quoted 5 lines

VIDEO_COMMAND
drivers/media/dvb/ttpci/av7110_hw.h
drivers/media/video/ivtv/ivtv-ioctl.c
VIDEO_TRY_COMMAND
drivers/media/video/ivtv/ivtv-ioctl.c

These to command the decoder (play/stop/pause/continue with various additional flags/attributes to facilitate fast/slow forward/backward). This should become a traditional V4L2 API: VIDIOC_(TRY_)DECODER_CMD.

Ah, now I see why you're proposing a decoder command: due to those additional flags. Ok, it may actually make sense, but I would avoid to do overlaps with VIDIOC_STREAMON/STREAMOFF, as it may make the API messy.

Quoted 10 lines

So, to summarize: in order to add the decoder API to V4L2 we would need to do:

- Add two controls to select the audio output channels.
- Add two read-only controls for the PTS and frame count.
- Copy and paste the old VIDEO_(TRY_)COMMAND to VIDIOC_(TRY_)DECODER_CMD.

And ivtv needs to use the MC and implement AUDIO_MUTE for output video nodes.

Comments? If not, then I'll see if I can work on an RFC for this next week. It's less work than I expected.

Cheers,
Mauro

#9 lore raw
In reply to Mauro Carvalho Chehab
Quoted 14 lines · Mauro Carvalho Chehab

There's a huge gap between the DVB specs and the current implementation. This were caused by years of changes that happened at the code but no updates to the specs were done.

This patch series tries to reduce this gap.

Basically, the headers at include/linux/dvb were included at the API. The Makefile scripting auto-generate references for structs, typedefs and ioctls. With this, it is now easy to identify when something is missing.

After adding such logic, I've manually synchronized the specs with the header file and updated the data structures.

Quoted 7 lines

The work is not complete yet: there are still several ioctl's not documented at the specs:

While here, I noticed that one audio ioctl is not used anyware (AUDIO_GET_PTS). There is just the ioctl definition and that's it. I just removed this definition, as removing it won't cause any regression, as no in-kernel driver or dvb-core uses it.

Please do not apply this patch; the SAA716x FF DVB driver uses the same ioctl.

Best Regards,
Manu

#10 lore raw

Em 09-06-2011 10:06, Manu Abraham escreveu:

Quoted 18 lines · Mauro Carvalho Chehab
Quoted 16 lines

There's a huge gap between the DVB specs and the current implementation. This were caused by years of changes that happened at the code but no updates to the specs were done.

This patch series tries to reduce this gap.

Basically, the headers at include/linux/dvb were included at the API. The Makefile scripting auto-generate references for structs, typedefs and ioctls. With this, it is now easy to identify when something is missing.

After adding such logic, I've manually synchronized the specs with the header file and updated the data structures.

The work is not complete yet: there are still several ioctl's not documented at the specs:

Quoted 7 lines
Quoted 4 lines

While here, I noticed that one audio ioctl is not used anyware (AUDIO_GET_PTS). There is just the ioctl definition and that's it. I just removed this definition, as removing it won't cause any regression, as no in-kernel driver or dvb-core uses it.

Please do not apply this patch; the SAA716x FF DVB driver uses the same ioctl.

I'll revert this patch for now, in order to wait for driver submissions that use this ioctl (and the other ioctl's that are not used anywhere inside the Kernel).

Thanks,
Mauro

#11 lore raw
Quoted 25 lines · Mauro Carvalho Chehab

Em 09-06-2011 10:06, Manu Abraham escreveu:

Quoted 24 lines · Mauro Carvalho Chehab
Quoted 21 lines

There's a huge gap between the DVB specs and the current implementation. This were caused by years of changes that happened at the code but no updates to the specs were done.

This patch series tries to reduce this gap.

Basically, the headers at include/linux/dvb were included at the API. The Makefile scripting auto-generate references for structs, typedefs and ioctls. With this, it is now easy to identify when something is missing.

After adding such logic, I've manually synchronized the specs with the header file and updated the data structures.

The work is not complete yet: there are still several ioctl's not documented at the specs:

While here, I noticed that one audio ioctl is not used anyware (AUDIO_GET_PTS). There is just the ioctl definition and that's it. I just removed this definition, as removing it won't cause any regression, as no in-kernel driver or dvb-core uses it.

Quoted 6 lines
Quoted 2 lines

Please do not apply this patch; the SAA716x FF DVB driver uses the same ioctl.

I'll revert this patch for now, in order to wait for driver submissions that use this ioctl (and the other ioctl's that are not used anywhere inside the Kernel).

Thanks!

Best Regards,
Manu