Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Service Interface #91

Closed
louisbraun opened this issue Apr 23, 2015 · 34 comments
Closed

Feature Request: Service Interface #91

louisbraun opened this issue Apr 23, 2015 · 34 comments

Comments

@louisbraun
Copy link

Hi Manio,

i'd like to display some information about the encryption status of the currently displayed broadcast in my skindesigner plugin (see http://projects.vdr-developer.org/projects/plg-skindesigner). Would it be possible that you implement a service interface for that in dvbapi plugin?

For me information like for instance encryption type and last ecm times would be interesting to display during channel switching. I think you know best what information could be displayed ;)

Thanks in advance for thinking about implementation of this feature.

Cheers Louis

@MegaV0lt
Copy link

+1
I am sure it is also interesting for other skinauthors too

@manio
Copy link
Owner

manio commented Apr 23, 2015

Hello,
I think i know what you mean... I am using Kodi and some time ago @AnTi2k has provided a service and a modified skin to obtain some kind of encryption data.
His service is currently deleted (https://github.com/anti2k/service.pvrextension), but it was some python script to get needed info from /tmp/ecm.info file.
This file interface is ugly and broken when decoding more then one channel at a time, but OScam has a nice "monitor" interface.

The Kodi skin look like this:
http://skyboo.net/xbmc/screenshot304.png

@pipelka, the XVDR plugin author was also interested using the ECM info (I was suggested to get this info directly from OSCam), but his work was not finished, probably because lack of his time.

Overall: I also like the idea to have this kind of information in the VDR.

Now the question is: is it a good idea to provide such interface in my plugin (my plugin would then be only a unnecessary proxy) or maybe just obtain it directly from OSCam (i suggest the monitor interface for this; a simple text UDP parser would be needed).

What do you think?

@MegaV0lt
Copy link

Is the oscam interface also working when oscam is not on teh same machine? (Network mode)
Does oscam know what decoded channel is the one that is live?

@manio
Copy link
Owner

manio commented Apr 23, 2015

Is the oscam interface also working when oscam is not on teh same machine? (Network mode)

yes, UDP is a network protocol

Does oscam know what decoded channel is the one that is live?

No, but even my plugin doesn't know it (it only follow VDR CAM assign/deassign requests and doesn't know if the channel is for livetv or not).

@MegaV0lt
Copy link

hm, but how can then the right ecm time be displayed? Can your plugin check that in the vdr? Has a remote network oscam any chandce to get that info?

how does the skin know what to display?

@manio
Copy link
Owner

manio commented Apr 23, 2015

If a Louis is currently able to display information about live tv channel (like frequency, SID) then he is also able to get this information from OSCam (eg compare the channel SID and provide info only for this channel).

@louisbraun
Copy link
Author

Hi,

from a "pure" VDR view a service interface would be much easier since other plugins (like skins for instance) are able to query this service interface directly with a call to a defined service api. Also vnsi / xvdr vdr plugin could use this service interface to get the info from dvbapi directly and provide then the information to the kodi clients (using an internal xvdr / vnsi mechanism for that).

For sure i could also use the oscam interface directly, but then i would have to implement that on my own in skindesigner, nobody could reuse it. Also the ip address of the oscam server would have to be configured in the skin which is not really reasonable from my point of view.

So i would really tend to a service interface for dvbapi...but answering your last question, for sure i know the currently displayed channel in my plugin and could provide information to OsCam. Do you have a link where the OsCam interface is described in detail?

Cheers Louis

@manio
Copy link
Owner

manio commented Apr 23, 2015

I see - in this case indeed it is better to put this info in my plugin - to have all scrambling details in one place and to be able to give this information to all plugins which want it.
In this case I think I could try obtain this info (via the 'monitor' connected to oscam via UDP; maybe later by putting this info in main dvbapi protocol).
I think I could hold a list of all channels which are being decrypted at a time (based on its SIDs) on all adapters, and I could collect the encoding data from OSCam which you can use in your plugin.

For what I remember the data I could collect (and provide you) is:

channel SID
last ecm source (hostname/ip address as text - as provided by the oscam)
CAID
ECM request result (text: found/not found, cache etc)
last ecm time (in ms)

Is it sufficient?

I am not yet familiar with the VDR interface for plugin intercommunication - by "service interface" you mean some specific API? Can I read about it somewhere?
Or is it just a class methods which you want to call?
Will you poll for the info in some intervals or I have to call some callback method when it is changed for specified (listen) SID (this is probably better because you will have info just right after it comes in, and it will be more optimized).

The problem is my free time ... I cannot tell you any ETA for the first interface, but I can try to spend some time on it...

As regards to the OSCam interface documentation - I don't know if it is documented. I was just testing it myself some time ago. It is called a monitor mode - there are also some clients for this, but as I mentioned above I could try to parse it myself and expose it to your plugin.

@louisbraun
Copy link
Author

Hi Manio,

sounds great :-) The information you described is exactly what i thought about.

I am not yet familiar with the VDR interface for plugin intercommunication - by "service interface"
you mean some specific API? Can I read about it somewhere?
Or is it just a class methods which you want to call?

You just have to implement the "virtual bool DVBAPI::Service(const char *Id, void *Data = NULL);" function in your dvbapi.h / cpp. This function will then be called by the "asking" plugins like skindesigner. the id is the id of the currently called service, and "void *Data" is just a struct or a class used to exchange data between dvbapi and the calling plugin. For instance such a struct could look like:

struct sDVBApiInfo {

//in parameters
cChannelId channelId;

//out parameters
string lastECMSource;
string ECMRequestResult;
...
}

This is just an example. I would create such a struct in my plugin, set the "IN" parameters and provide this struct via the service call by reference. You would just have to fill the "OUT" parameters accordingly.

As an example you can check one of my other plugins (for instance "scraper2vdr" which provides a service interface to get all scraped information for an eventID from thetvdb / themoviedb):

Service Function: http://projects.vdr-developer.org/projects/plg-scraper2vdr/repository/revisions/master/entry/scraper2vdr.c#L166

Definition of service structures: http://projects.vdr-developer.org/projects/plg-scraper2vdr/repository/revisions/master/changes/services.h

And here an example how to use this service interface from another plugin (in this case skindesigner): http://projects.vdr-developer.org/projects/plg-skindesigner/repository/revisions/master/entry/views/viewhelpers.c#L196

Will you poll for the info in some intervals or I have to call some callback method when it is
changed for specified (listen) SID (this is probably better because you will have info just right
after it comes in, and it will be more optimized).

I would call the service every time a channel switch is done by the user to get the encryption information from the currently displayed broadcast. So no constant polling, just calling when i really need it.

Cheers Louis

@manio
Copy link
Owner

manio commented Apr 24, 2015

Hello,
Thank you for your explanation (and links).

I spent some time on this and first part of work (obtaining ecm info data from OSCam) is now done in the OSCam:
http://www.streamboard.tv/oscam/changeset/10652
and here in the master plugin branch:
6ac4bcd

Instead of using the UDP and monitor feature I just enhanced the OSCam dvbapi protocol (version 2), so it is more user friendly (will just work out of the box) and it is also done more proper.

If you have some time and possibilities you may check if the obtained data is correct.
Currently the plugin prints the data in the log if the loglevel is set to debug.

Next I am planning to expose this data via service interface to other VDR plugins :)

@louisbraun
Copy link
Author

Hi Manio.

wow, great! I hope to find some time at weekend to test it...

If you need some support implementing the service interface, just let me know...

Cheers Louis

@louisbraun
Copy link
Author

One additional remark: it would be great if it is possible to pass the ChannelID to dvbapi via the service interface structure and then get the ECM info for this channel - as i suggested above.

Cheers Louis

@manio
Copy link
Owner

manio commented Apr 24, 2015

I have to check if I would be able to associate the channel SID I've got from OSCam with the ChannelID you suggested.

@louisbraun
Copy link
Author

Ok, i forgot that OsCam is not VDR specific ;) The ChannelID was just a suggestion, i have access to the cChannel Object itself too...you can check the facilities of this class here in VDR:
http://projects.vdr-developer.org/git/vdr.git/tree/channels.h

So i could provide a pointer to the Object itself or any other information you need...depends on how the OsCam channel SID is build together. I think you are more familiar with that ;)

Cheers Louis

@louisbraun
Copy link
Author

PS: is it may be the ServiceID mentioned here:
http://www.vdr-wiki.de/wiki/index.php/Vdr(5)#CHANNELS

If yes, would be no issue to provide this instead of the ChannelID.

@manio
Copy link
Owner

manio commented Apr 24, 2015

Ok, will see. Maybe you can use the function GetByServiceID() - but you may also need a transponder and source. I will try to code something more after the weekend. For now I prefer to give you all info based on SID (service ID).

The OSCam channel SID is the same as in VDR, SID should be unique for channels, it is the column "SID" eg here:
http://pl.kingofsat.net/pos-19.2E.php

@manio
Copy link
Owner

manio commented Apr 25, 2015

Hello,
Please try my service-ecminfo branch.

@3PO
Copy link

3PO commented Apr 26, 2015

@ manio,

is it possible to show this issue.

Apr 26 11:24:00 [vdr] [30156] DVBAPI: Action: Got ECM_INFO: adapter_index=0, SID = 0071, CAID = 1702, PID = 1807, ProvID = 000000, ECM time = 603 ms, reader = sky, from = local, protocol = smartreader, hops = 0 

also with "loglevel 2"?

@louisbraun
Copy link
Author

Hi Manio,

tested it, works like a charm :-)

I'll integrate it later completely in skindesigner and publish it to VDR Portal so we get some more testers ;)

Thanx for your effort!

Cheers Louis

@3PO
Copy link

3PO commented Apr 26, 2015

THX @manio and @louisbraun,

it works fine! 👍

150426_161655

@manio
Copy link
Owner

manio commented Apr 27, 2015

@3PO
Thanks. And about your question: I don't want to change the DEBUGLOG to INFOLOG in this case. Infolog should stay clean when everything is working fine, I don't want to flood the log with the ECMINFO lines.

@manio manio closed this as completed in f5ae09a Apr 27, 2015
@manio
Copy link
Owner

manio commented Apr 27, 2015

Ok guys, the code is now in my master branch. Thank you all involved :)

@louisbraun
Copy link
Author

Hi Manio,

me again :-) Do you know if the "names" of the caid's are available in OSCAM? See http://www.vdr-portal.de/board16-video-disk-recorder/board109-vdr-skins/p1242988-0-4-3-es-blinkt/#post1242988

If yes (or if they are definable in an OSCAM config file) would it be possible to enhance the new protocol to get beside the caid also this info? If not, for me it would be the best to include some kind of "translation" in dvbapi, since it is not reasonable to implement it in skindesigner or any other "consuming" plugin.

What do you think?

Cheers Louis

@3PO
Copy link

3PO commented Apr 28, 2015

[...] Do you know if the "names" of the caid's are available in OSCAM? ...

Maybe you can use the "oscam.provid" or "oscam.srvid"?

--> http://www.streamboard.tv/wiki/OSCam/en/Config/oscam.provid
--> http://www.streamboard.tv/wiki/OSCam/de/Config/oscam.srvid

@manio
Copy link
Owner

manio commented Apr 29, 2015

Hello
In fact I would like to abstract my plugin from maintaining this kind of tables (and update it). I think that the correct place for this info is the OSCam. I am trying to abstract my plugin code from the CA details which are handled in OSCam - and should stay there. My plugin should only act as a "gateway" with minimum code required to pass needed data.

I can see that recently was added some function testing for CAIDs: r10588 up to r10595
There is also some nice function to obtain the name from CAID in the OSCam:
get_cardsystem_desc_by_caid()
but this function is only conditional - maybe we could make it general...

I can also see that the table and the function is nicely maintained eg here in tvh:
https://github.com/tvheadend/tvheadend/blob/master/src/descrambler/descrambler.c#L33

Overall i have to think about it but I'd prefer to get it away from my plugin and fetch it from the OSCam...

@louisbraun
Copy link
Author

Hi,

i agree that oscam would be the best place...2nd dvbapi, and last the "consumer plugins" like skindesigner. If i would implement it, every other skin would have to do the same.

So i'll wait on your decision :-)

Cheers Louis

manio added a commit that referenced this issue Apr 29, 2015
@manio
Copy link
Owner

manio commented Apr 29, 2015

Done

@louisbraun
Copy link
Author

Thanks :-) I'll add the modification to skindesigner asap...

Cheers Louis

@louisbraun
Copy link
Author

Just implemented and tested...works fine. Thx.

@ghost
Copy link

ghost commented Jun 28, 2015

3PO: what skin is that please ?

@3PO
Copy link

3PO commented Jun 28, 2015

This is my own Skin.

@ghost
Copy link

ghost commented Jun 28, 2015

It looks great! Can you share it ?;)

@taktiker12
Copy link

hi Manio
i have an other proposition , if we can bypass the oscam.dvbapi and just make a caid selector on The skin of KODI or VDR we will maybe have more comfort .

@manio
Copy link
Owner

manio commented Sep 11, 2015

@taktiker12
I am against this. IMHO this should be handled by oscam and not forced externally. This kind of abstraction was one of the main reason for creating vdr-plugin-dvbapi. Just make a proper use from oscam.dvbapi.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants