Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - media-fs devctl()-s: what value to return via dev_info_ptr: (6 Items)
   
media-fs devctl()-s: what value to return via dev_info_ptr  
The documentation of mediafs provides the following
information regarding the dev_info_ptr argument
of the mediafs devctl()-s:

  To pass data to and receive data from media devices,
   a client application should use the devctl() function’s
  dev_data_ptr and dev_info_ptr arguments to point to
  the appropriate _media_* data structures.

The doc also describes what value the driver needs
to return via dev_info_ptr for 3 album art related devctl().

What value does the driver need to set *dev_info_ptr to
for the remaining devctl()-s?

This question is significant because a cursory review of
io-media sources is suggesting that io-media is relying on
the value returned via dev_info_ptr, rather than the
return code of the devctl() itself, for at least some of the
devctl()-s.
Re: media-fs devctl()-s: what value to return via dev_info_ptr  
If it's not documented it may be a hole in the documentation; sometimes 
it can be better. :)

It looks like we check a return value for DCMD_MEDIA_RELEASE_DATE 
(release date metadata available).  We also use the value for mediafs 
events when we call DCMD_MEDIA_READ_EVENTS (event size). 
DCMD_MEDIA_GET_STATE (length of state information), DCMD_MEDIA_GET_AUDIO 
(number of audio streams), and DCMD_MEDIA_GET_SUBTITLE (number of 
subtitles available) use this as a return value (in a sense) as well.

I suppose the answer is "it depends on the command".

-- 
Ryan J. Allen
QNX Software Systems
Re: media-fs devctl()-s: what value to return via dev_info_ptr  
Thanks Ryan.

Been wondering if there is some specified value for the metadata
devctl()-s, like dcmd_media_album.  Have seen a sample driver
that was returning the length of the metadata string but io-media
sources seem to be ignoring this value, except in the case of
dcmd_media_tracknum.

Do we need to set *dev_info_ptr to a specific value for the metadata events?

What value do we need to return for dcmd_media_tracknum?

--
Mate
Re: media-fs devctl()-s: what value to return via dev_info_ptr  
On 10-05-19 09:10 AM, Mate Szarvas wrote:
> Do we need to set *dev_info_ptr to a specific value for the metadata events?

You are right that io-media doesn't use this value.  I think a good 
practice would be to set the value to the length of the string including 
the nul-byte.  The string should always be nul-terminated in the buffer 
you are returning (ie, if your string is longer than can fit in the 
buffer, copy it into the buffer and nul-terminate the buffer).

> What value do we need to return for dcmd_media_tracknum?

It should be non-zero.  The length of the string (including the 
nul-byte) is probably good.

-- 
Ryan J. Allen
QNX Software Systems
Re: media-fs devctl()-s: what value to return via dev_info_ptr  
The following metadata devctls requires the 'ret' value of the devctl to be set.
DCMD_MEDIA_TRACK_NUM
DCMD_MEDIA_RELEASE_DATE
DCMD_MEDIA_ALBART_INFO

As long as the ret value is not 0, io-media will accept the metadata.
Re: media-fs devctl()-s: what value to return via dev_info_ptr  
Thank you everyone.